Files
CalamityModPublic/Projectiles/Summon/AstrageldonLaser.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.5 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class AstrageldonLaser : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 3;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
ProjectileID.Sets.MinionShot[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 10;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.alpha = 255;
Projectile.penetrate = -1;
Projectile.timeLeft = 600;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -2;
Projectile.extraUpdates = 1;
Projectile.DamageType = DamageClass.Summon;
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 4)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame >= 3)
{
Projectile.frame = 0;
}
if (Projectile.ai[0] == 0f)
{
Projectile.ai[0] = 1f;
SoundEngine.PlaySound(SoundID.Item12, Projectile.position);
}
if (Projectile.alpha > 0)
{
Projectile.alpha -= 25;
}
if (Projectile.alpha < 0)
{
Projectile.alpha = 0;
}
Projectile.rotation = Projectile.velocity.ToRotation();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 120);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 255, 255, Projectile.alpha);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
}
}