using Continuity.Content.Items.Materials;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;

namespace continuity.Content.Items.Weapons
{
    public class Geltana : ModItem
    {
        public override void SetDefaults()
        {
            Item.useStyle = 1;
            Item.crit = 20;
            Item.useTurn = true;
            Item.autoReuse = true;
            Item.knockBack = 3f;
            Item.useAnimation = 15;
            Item.DamageType = DamageClass.Melee;
            Item.useTime = 15;
            Item.damage = 24;
            Item.width = 88;
            Item.height = 96;
            Item.value = Item.buyPrice(gold: 15);
            Item.rare = ItemRarityID.Blue;
        }

        public override void AddRecipes()
        {
            Recipe recipe = Recipe.Create(ModContent.ItemType<Geltana>());
            recipe.AddIngredient(ItemID.Katana, 1);
            recipe.AddIngredient(ModContent.ItemType<ExquisiteGel>(), 8);
            recipe.AddIngredient(ModContent.ItemType<Coal>(), 10);
            recipe.AddTile(TileID.Solidifier);
            recipe.AddTile(TileID.Anvils);
            recipe.Register();
        }

        public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
        {
            target.AddBuff(BuffID.OnFire, 120);
        }

        public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
        {
            target.AddBuff(BuffID.OnFire, 120);
        }

        public override void MeleeEffects(Player player, Rectangle hitbox)
        {
            Dust.NewDust(new Vector2(hitbox.Center.X, hitbox.Center.Y), hitbox.Width, hitbox.Height, DustID.Lava);
        }
    }
}
