using System;
using Decimation.Content.Items.Weapons;
using Decimation.Lib.Items;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace Decimation.Content.Projectiles
{
   internal class Tooth : DecimationProjectile
    {
        protected override void Init()
        {
            projectile.width = 10;
            projectile.height = 18;
            projectile.aiStyle = 1;
            Damages = 20;
            projectile.tileCollide = true;
            projectile.ignoreWater = false;
            projectile.penetrate = 1;
            projectile.timeLeft = 600;

            DamageType = DecimationWeapon.DamageType.Ranged;
        }

        public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
        {
            int regen = (int)(damage * 0.08f);
            Player owner = Main.player[projectile.owner];

            owner.statLife += regen;
            owner.HealEffect(regen);
        }

        public override void OnHitPvp(Player target, int damage, bool crit)
        {
            int regen = (int)(damage * 0.08f);
            Player owner = Main.player[projectile.owner];

            owner.statLife += regen;
            owner.HealEffect(regen);
        }

        public override void OnHitPlayer(Player target, int damage, bool crit)
        {
            int regen = (int)(damage * 0.08f);
            Player owner = Main.player[projectile.owner];

            owner.statLife += regen;
            owner.HealEffect(regen);
        }
    }
}
