Files
CalamityModPublic/Projectiles/Melee/AtaraxiaSplit.cs
T
DominicKarma42 55e89c9b98 Replaced (hopefully) every magic number with a constant
Note: Does not include item rarities, and appears to shown nonexistant using directive movement in the commit. This does not really affect anything, however.
2020-05-30 17:56:36 -04:00

56 lines
1.9 KiB
C#

using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class AtaraxiaSplit : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Still Not Exoblade");
}
public override void SetDefaults()
{
projectile.width = 8;
projectile.height = 8;
projectile.friendly = true;
projectile.melee = true;
projectile.penetrate = -1;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 6;
projectile.timeLeft = 50;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.alpha = 0;
}
public override void AI()
{
drawOffsetX = -5;
drawOriginOffsetY = -1;
drawOriginOffsetX = 0;
projectile.rotation = projectile.velocity.ToRotation();
// Slow down exponentially and fade away
projectile.velocity *= 0.93f;
projectile.alpha += 5;
// Light which scales down as it fades
float lightFactor = (255f - (float)projectile.alpha) / 255f;
Lighting.AddLight(projectile.Center, 0.3f * lightFactor, 0.05f * lightFactor, 0.2f * lightFactor);
// Spawn dust, with less dust as it fades away
if (Main.rand.Next(256) > projectile.alpha - 60)
{
int idx = Dust.NewDust(projectile.Center, 1, 1, 71);
Main.dust[idx].position = projectile.Center - projectile.velocity * 0.7f;
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 0.3f;
Main.dust[idx].velocity += projectile.velocity * 0.4f;
Main.dust[idx].scale = Main.rand.NextFloat(0.5f, 1.0f);
Main.dust[idx].alpha = Main.rand.Next(80, 200);
}
}
}
}