Files
CalamityModPublic/Projectiles/Boss/CirrusBlaster.cs
T
mountaindrew10 ef99a5be8a 1 - Cirrus' special attack.
2 - Rev+ Moon Lord Deathray Charge sound.
2023-07-28 18:18:30 -05:00

71 lines
2.7 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Boss
{
public class CirrusBlaster : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => "CalamityMod/Items/Potions/Alcohol/OddMushroom";
public static readonly SoundStyle SANSCharge = new("CalamityMod/Sounds/Custom/Ravager/GasterBlasterCharge");
public static readonly SoundStyle SANSFire = new("CalamityMod/Sounds/Custom/Ravager/GasterBlasterFire");
public Vector2 storedVelocity;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 42;
Projectile.hostile = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.timeLeft = 180;
CooldownSlot = ImmunityCooldownID.Bosses;
}
public override void AI()
{
// ai0 = timer, ai1 = laser size
if (Projectile.ai[0] < 90f) // Before the laser
{
Projectile.ai[0]++;
if (storedVelocity == Vector2.Zero)
{
storedVelocity = Projectile.SafeDirectionTo(Projectile.velocity);
Projectile.velocity = Vector2.Zero;
Projectile.netUpdate = true;
Projectile.rotation = (float)Math.Atan2(storedVelocity.Y, storedVelocity.X) + MathHelper.PiOver2;
SoundEngine.PlaySound(SANSCharge, Projectile.Center); // Funny Gaster Blaster sounds
}
else if (Projectile.ai[0] >= 55f)
{
Projectile.ai[0] = 90f;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, storedVelocity, ModContent.ProjectileType<CirrusBlast>(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[1], Projectile.whoAmI);
SoundEngine.PlaySound(SANSFire, Projectile.Center); // Funny Gaster Blaster sounds #2
}
}
else // Move out and despawn
{
// Start moving
if (Projectile.velocity == Vector2.Zero)
Projectile.velocity = storedVelocity * -1f;
else
Projectile.velocity *= 1.01f;
// Fade out and die
Projectile.alpha += 3;
if (Projectile.alpha >= 255)
Projectile.Kill();
}
}
// Does no contact damage
public override bool? CanDamage() => false;
}
}