Files
CalamityModPublic/Projectiles/Enemy/BelchingCoralSpike.cs
T

59 lines
2.1 KiB
C#

using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Enemy
{
public class BelchingCoralSpike : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Enemy";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 2;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 20;
Projectile.hostile = true;
Projectile.timeLeft = 480;
Projectile.ignoreWater = true;
}
public override void AI()
{
if (Projectile.ai[0]++ < 10f)
{
Projectile.alpha = (int)MathHelper.Lerp(255f, 0f, Projectile.ai[0] / 10f);
}
else
{
if (Projectile.velocity.Y < 12f)
Projectile.velocity.Y += 0.1f;
}
Projectile.tileCollide = Projectile.ai[0] > 30f;
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void Kill(int timeLeft)
{
for (int i = 0; i <= 2; i++)
{
int idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 3f;
idx = Dust.NewDust(Projectile.position, 8, 8, (int)CalamityDusts.SulfurousSeaAcid, 0, 0, 0, default, 0.75f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 3f;
}
}
}
}