Files
CalamityModPublic/Projectiles/Boss/PhantomMine.cs
T
Xyk 7aa44ad7d9 Changed all ~640 instances of Main.rand.NextBool(2) to remove the unnecessary 2
Also I forgot to push my reality rupture and ichor spear minor tweaks before hand so they're in here too.
Reality rupture stealth hit sound is louder.
Reality rupture stealth visual always has at least one big crack, cracks fade out.
There's more consistency in the spark particles on realty rupture stealth and ichor spear on hit sparks.
Reality Rupture stealth produces light.
2023-09-26 01:58:55 -07:00

115 lines
4.9 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.World;
namespace CalamityMod.Projectiles.Boss
{
public class PhantomMine : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override void SetDefaults()
{
Projectile.Calamity().DealsDefenseDamage = true;
Projectile.width = 30;
Projectile.height = 30;
Projectile.hostile = true;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.timeLeft = 480;
Projectile.Opacity = 0f;
CooldownSlot = ImmunityCooldownID.Bosses;
}
public override void AI()
{
Projectile.Opacity = MathHelper.Lerp(0f, 1f, Projectile.velocity.Length() / Projectile.ai[0]);
if (Projectile.velocity.Length() < Projectile.ai[0])
{
Projectile.velocity *= Projectile.ai[1];
if (Projectile.velocity.Length() > Projectile.ai[0])
{
Projectile.velocity.Normalize();
Projectile.velocity *= Projectile.ai[0];
}
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
{
if (Projectile.velocity.Length() >= Projectile.ai[0])
{
if (Projectile.owner == Main.myPlayer)
{
int totalProjectiles = 8;
float radians = MathHelper.TwoPi / totalProjectiles;
for (int i = 0; i < totalProjectiles; i++)
{
Vector2 vector = new Vector2(0f, -8f).RotatedBy(radians * i);
int type = Main.rand.NextBool() ? ModContent.ProjectileType<PhantomShot2>() : ModContent.ProjectileType<PhantomShot>();
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector, type, Projectile.damage, 0f, Main.myPlayer);
}
}
Projectile.Kill();
}
}
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color((byte)(200 * Projectile.Opacity), (byte)(200 * Projectile.Opacity), (byte)(200 * Projectile.Opacity), Projectile.alpha);
}
public override bool CanHitPlayer(Player target) => Projectile.velocity.Length() >= Projectile.ai[0];
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 12f, targetHitbox);
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
Projectile.position.X = Projectile.position.X + (Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2);
Projectile.width = 150;
Projectile.height = 150;
Projectile.position.X = Projectile.position.X - (Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2);
for (int num621 = 0; num621 < 15; num621++)
{
int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.2f);
Main.dust[num622].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 30; num623++)
{
int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 180, 0f, 0f, 100, default, 1.7f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 60, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
if (info.Damage <= 0)
return;
if (Projectile.velocity.Length() >= Projectile.ai[0])
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 120);
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 180);
}
}
}
}