using System.Collections.Generic;
using Decimation.Content.Items.Misc;
using Decimation.Content.Items.Misc.Souls;
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 DeadeyesQuiver : DecimationAccessory
    {
        protected override string ItemName => "Deadeye's Quiver";

        protected override string ItemTooltip =>
            "Turns wooden arrows into ichor arrows and turns musket balls into chlorophyte bullets\n+16% ranged damage\n+15% arrow and bullet velocity\n15% chance not to consume ammo\n+2% increased ranged crit chance";

        protected override void InitAccessory()
        {
            item.width = 30;
            item.height = 30;
            item.rare = Rarity.Red.GetRarityValue();
            this.item.value = Item.buyPrice(0, 15);
        }

        protected override List<ModRecipe> GetRecipes()
        {
            ModRecipe recipe = GetNewModRecipe(this, 1, new List<int> {ModContent.TileType<ChlorophyteAnvil>()});
            recipe.AddIngredient(ModContent.ItemType<JestersQuiver>());
            //r.AddIngredient(ModContent.ItemType<SoulofKight>());
            recipe.AddIngredient(ModContent.ItemType<SoulofSpite>(), 15);
            recipe.AddIngredient(ItemID.SoulofSight, 15);
            recipe.AddIngredient(ItemID.SoulofFright, 15);
            recipe.AddIngredient(ModContent.ItemType<EndlessPouchofLife>());
            recipe.AddIngredient(ModContent.ItemType<RedThread>(), 5);
            recipe.AddIngredient(ItemID.FlaskofIchor, 5);
            recipe.AddIngredient(ItemID.BlackDye, 3);
            recipe.AddIngredient(ItemID.RedDye, 3);

            return new List<ModRecipe> {recipe};
        }

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.rangedDamage += 0.16f;
            player.rangedCrit += 2;
            player.GetModPlayer<DecimationPlayer>().deadeyesQuiverEquipped = true;
        }
    }
}