Files
CalamityModPublic/Projectiles/Magic/ForbiddenAxeBlade.cs
T
tomat 67bceff6e7 Initial dotnet format pass.
This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
2024-02-28 21:49:50 -08:00

69 lines
2.2 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class ForbiddenAxeBlade : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 26;
Projectile.height = 26;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.alpha = 255;
Projectile.timeLeft = 300;
Projectile.DamageType = DamageClass.Magic;
}
public override void AI()
{
Projectile.alpha -= 3;
Projectile.rotation += 0.75f;
Projectile.ai[1] += 1f;
if (Projectile.ai[1] <= 20f)
{
Projectile.velocity *= 0.85f;
}
else if (Projectile.ai[1] > 20f && Projectile.ai[1] <= 39f)
{
Projectile.velocity *= 1.25f;
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 10f, 20f);
}
else if (Projectile.ai[1] == 40f)
{
Projectile.ai[1] = 0f;
}
if (Main.rand.NextBool(8))
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f);
}
}
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 3; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
}
}