- Added support for animated projectiles - Refactoring - Removed useless fields - Fixed swords not dealing damages - Added Hour Hand (from Evie's PR)
57 lines
1.5 KiB
C#
57 lines
1.5 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
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 SiphonArrow : DecimationProjectile
|
|
{
|
|
protected override void Init()
|
|
{
|
|
projectile.width = 14;
|
|
projectile.height = 32;
|
|
projectile.aiStyle = 1;
|
|
DamageType = DecimationWeapon.DamageType.Ranged;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 600;
|
|
projectile.tileCollide = true;
|
|
projectile.arrow = true;
|
|
aiType = ProjectileID.WoodenArrowFriendly;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
Heal(damage);
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, int damage, bool crit)
|
|
{
|
|
Heal(damage);
|
|
}
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit)
|
|
{
|
|
Heal(damage);
|
|
}
|
|
|
|
private void Heal(int damage)
|
|
{
|
|
int healAmount = (int)(damage * (Main.rand.Next(26) / 100f));
|
|
|
|
Player player = Main.player[projectile.owner];
|
|
player.statLife += healAmount;
|
|
player.HealEffect(healAmount);
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|