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.Weapons
{
    internal class TitanicPike : DecimationWeapon
    {
        protected override string ItemName => "Titanic Pike";
        protected override int Damages => 120;
        protected override string ProjectileName => "TitanicPikeProjectile";

        protected override void InitWeapon()
        {
            item.crit = 14;
            item.knockBack = 12;
            item.useStyle = 5;
            this.item.value = Item.buyPrice(gold: 45);
            item.rare = Rarity.LightPurple.GetRarityValue();
            this.item.noUseGraphic = true;
            this.item.useTurn = true;
            item.autoReuse = true;
            item.width = 94;
            item.height = 94;
            item.useAnimation = 18;
            item.useTime = 24;
            item.shootSpeed = 3.7f;
        }

        public override bool CanUseItem(Player player)
        {
            // Ensures no more than one spear can be thrown out, use this when using autoReuse
            return player.ownedProjectileCounts[this.item.shoot] < 1;
        }

        protected override ModRecipe GetRecipe()
        {
            ModRecipe recipe = GetNewModRecipe(this, 1, ModContent.TileType<TitanForge>());

            recipe.AddIngredient(ModContent.ItemType<TitaniteBar>(), 12);
            recipe.AddIngredient(ItemID.SoulofMight, 15);

            return recipe;
        }
    }
}