Files
CalamityModPublic/Projectiles/Melee/GelWave.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

79 lines
2.7 KiB
C#

using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class GelWave : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 1;
}
public override void SetDefaults()
{
Projectile.width = 30;
Projectile.height = 30;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 2;
Projectile.alpha = 120;
Projectile.timeLeft = 200;
Projectile.tileCollide = false;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override void AI()
{
if (Projectile.localAI[0] == 0f)
{
SoundEngine.PlaySound(SoundID.Item92, Projectile.position);
Projectile.localAI[0] += 1f;
}
Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.4f);
Projectile.rotation = (float)Math.Atan2((double)Projectile.velocity.Y, (double)Projectile.velocity.X) + 1.57f;
Projectile.velocity.Y += Projectile.ai[0];
if (Main.rand.NextBool())
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurificationPowder, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f);
}
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.timeLeft > 195)
return false;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
return false;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(200, 200, 200, Projectile.alpha);
}
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 3; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.PurificationPowder, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Slimed, 300);
Projectile.velocity *= 0.5f;
}
}
}