using System.Collections.Generic;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Lib.Items;
using Decimation.Lib.Util;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Decimation.Content.Items.Accessories
{
    internal class RedHotShackle : DecimationAccessory
    {
        protected override string ItemName => "Red Hot Shackle";
        protected override string ItemTooltip => "Your attackers gain Singed for 6 seconds.";

        protected override void InitAccessory()
        {
            item.width = 24;
            item.height = 24;
            item.rare = Rarity.Green.GetRarityValue();
            item.value = Item.buyPrice(0, 0, 2);
            item.defense = 1;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.EquipAccessory(this);
        }

        protected override List<ModRecipe> GetRecipes()
        {
            ModRecipe recipe = GetNewModRecipe(this, 1, new List<int>() {TileID.Furnaces}, true);

            recipe.AddIngredient(ItemID.Shackle);
            recipe.AddIngredient(ItemID.Gel, 10);

            return new List<ModRecipe> {recipe};
        }
    }

    internal class RedHotShackleEffect : GlobalNPC
    {
        public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit)
        {
            if (target.HasEquippedAccessory(ModContent.ItemType<RedHotShackle>()))
                npc.AddBuff(ModContent.BuffType<Singed>(), 600);
        }
    }
}