65 lines
2.5 KiB
C#
65 lines
2.5 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class Fork : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Fork");
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 14;
|
|
Projectile.height = 14;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.aiStyle = 113;
|
|
Projectile.timeLeft = 600;
|
|
AIType = ProjectileID.BoneJavelin;
|
|
Projectile.DamageType = RogueDamageClass.Instance;
|
|
Projectile.extraUpdates = 1;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Main.rand.Next(5) == 0)
|
|
{
|
|
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 5, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
|
|
}
|
|
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
|
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi);
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
Player player = Main.player[Projectile.owner];
|
|
target.AddBuff(ModContent.BuffType<BurningBlood>(), 180);
|
|
if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1)
|
|
player.AddBuff(BuffID.WellFed, 180);
|
|
}
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit)
|
|
{
|
|
Player player = Main.player[Projectile.owner];
|
|
target.AddBuff(BuffID.Bleeding, 300);
|
|
target.AddBuff(ModContent.BuffType<BurningBlood>(), 180);
|
|
if (player.FindBuffIndex(BuffID.WellFed2) > -1 && player.FindBuffIndex(BuffID.WellFed3) > -1)
|
|
player.AddBuff(BuffID.WellFed, 180);
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
}
|
|
}
|