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

namespace Decimation.Content.Items.Ammo
{
    internal class MoltenStyngerBolt : DecimationAmmo
    {
        protected override string ItemName => "Molten Stynger Bolt";
        protected override string ItemTooltip => "Explodes into molten shrapnel.";
        protected override string Projectile => "MoltenStyngerBolt";
        protected override int Ammo => AmmoID.StyngerBolt;
        protected override int Damages => 25;

        protected override void InitAmmo()
        {
            item.width = 8;
            item.height = 8;
            item.knockBack = 1;
            item.rare = Rarity.Orange.GetRarityValue();
            item.value = Item.buyPrice(0, 0, 10);
            item.consumable = true;

            this.item.shootSpeed = 2f;
        }

        public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool isCritical)
        {
            target.AddBuff(ModContent.BuffType<Singed>(), 600);
        }

        public override void OnHitPvp(Player player, Player target, int damage, bool isCritical)
        {
            player.AddBuff(ModContent.BuffType<Singed>(), 600);
        }

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

            recipe.AddIngredient(ItemID.StyngerBolt, 50);
            recipe.AddIngredient(ModContent.ItemType<Thermoplasm>(), 5);

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