Decimation_Mod/Content/Items/Weapons/Bloodshot/VampiricShiv.cs
2020-06-30 15:41:35 -04:00

65 lines
2.1 KiB
C#

using Decimation.Content.Projectiles;
using Decimation.Lib.Items;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace Decimation.Content.Items.Weapons.Bloodshot
{
internal class VampiricShiv : DecimationWeapon
{
private readonly int shootDelay = 72;
private int _timeToShoot = 72;
protected override string ItemName => "Vampiric Shiv";
protected override string ItemTooltip => "Heal 10% of damages inflicted";
protected override int Damages => 12;
protected override int ProjectileId => ModContent.ProjectileType<Tooth>();
protected override void InitWeapon()
{
item.width = 46;
item.height = 52;
item.crit = 4;
// item.useStyle = 3;
item.useTime = 20;
item.useAnimation = 20;
item.shootSpeed = 5f;
item.rare = Rarity.Green.GetRarityValue();
item.knockBack = 5;
item.value = Item.buyPrice(0, 2);
}
public override void UpdateInventory(Player player)
{
if (_timeToShoot > 0) _timeToShoot--;
}
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY,
ref int type, ref int damage, ref float knockBack)
{
if (_timeToShoot > 0) return false;
_timeToShoot = shootDelay;
return base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack);
}
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
int lifeSteal = (int) (damage * 0.1f);
player.lifeSteal += lifeSteal;
player.HealEffect(lifeSteal);
}
public override void OnHitPvp(Player player, Player target, int damage, bool crit)
{
int lifeSteal = (int) (damage * 0.1f);
player.lifeSteal += lifeSteal;
player.HealEffect(lifeSteal);
}
}
}