63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using Decimation.Lib.Items;
|
|
using Decimation.Lib.Util;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
|
|
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 string Projectile => "Tooth";
|
|
|
|
protected override void InitWeapon()
|
|
{
|
|
item.width = 20;
|
|
item.height = 20;
|
|
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);
|
|
}
|
|
}
|
|
} |