Files
CalamityModPublic/Projectiles/Magic/ManaBoltSmall.cs
T
Ozzatron ba14da9cdd Initial tModPorter run. Almost all of this is Kill -> OnKill in every Projectile ever.
Profaned Soul Crystal's anti-whip-stack only works on vanilla whips at the moment.
2023-09-30 01:17:11 -04:00

47 lines
1.7 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class ManaBoltSmall : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 60;
Projectile.DamageType = DamageClass.Magic;
}
public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 40 && target.CanBeChasedBy(Projectile);
public override void AI()
{
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2;
if (Projectile.timeLeft < 40)
CalamityUtils.HomeInOnNPC(Projectile, true, 450f, 6f, 20f);
else
Projectile.velocity *= 0.975f;
if (Projectile.timeLeft % 4 == 0)
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 10; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 15, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
}
}
}