using System.Collections.Generic;
using Decimation.Content.Items.Ores;
using Decimation.Content.Tiles;
using Decimation.Lib.Items;
using Decimation.Lib.Util;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Decimation.Content.Items.Accessories
{
    internal class TideTurner : DecimationAccessory
    {
        protected override string ItemName => "Tide Turner";

        protected override string ItemTooltip => "Not one of ya’s going to survive this!\n" +
                                                 "Deals the same amount of damage as held item\n" +
                                                 "Increase underwater mobility\n" +
                                                 "+10% chance to dodge attacks when charging";

        protected override void InitAccessory()
        {
            item.width = 46;
            item.height = 36;
            item.rare = Rarity.Rainbow.GetRarityValue();
            item.value = Item.buyPrice(0, 3);
            item.defense = 3;
            item.shieldSlot = 5;
            item.expert = true;
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>();

            item.damage = player.HeldItem.damage;
            modPlayer.dashDamages = player.HeldItem.damage;
            modPlayer.dash = 2;

            player.accFlipper = true;
        }

        protected override List<ModRecipe> GetRecipes()
        {
            ModRecipe recipe = GetNewModRecipe(this, 1, new List<int> {ModContent.TileType<ChlorophyteAnvil>()}, false);

            recipe.AddIngredient(ItemID.EoCShield);
            recipe.AddIngredient(ItemID.Coral, 10);
            recipe.AddIngredient(ModContent.ItemType<DenziumBar>(), 5);

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