This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
124 lines
5.0 KiB
C#
124 lines
5.0 KiB
C#
using System;
|
|
using System.IO;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Boss
|
|
{
|
|
public class PhantomBlast : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Boss";
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.Calamity().DealsDefenseDamage = true;
|
|
Projectile.width = 18;
|
|
Projectile.height = 18;
|
|
Projectile.hostile = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.alpha = 255;
|
|
Projectile.penetrate = -1;
|
|
Projectile.tileCollide = false;
|
|
CooldownSlot = ImmunityCooldownID.Bosses;
|
|
}
|
|
|
|
public override void SendExtraAI(BinaryWriter writer)
|
|
{
|
|
writer.Write(Projectile.localAI[0]);
|
|
writer.Write(Projectile.localAI[1]);
|
|
}
|
|
|
|
public override void ReceiveExtraAI(BinaryReader reader)
|
|
{
|
|
Projectile.localAI[0] = reader.ReadSingle();
|
|
Projectile.localAI[1] = reader.ReadSingle();
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.ai[1] == 0f)
|
|
{
|
|
Projectile.ai[1] = 1f;
|
|
SoundEngine.PlaySound(SoundID.Item20, Projectile.Center);
|
|
}
|
|
|
|
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2;
|
|
|
|
if (Projectile.velocity.Length() < 10f)
|
|
Projectile.velocity *= 1.01f;
|
|
|
|
Projectile.localAI[0] += 1f;
|
|
if (Projectile.localAI[0] > 9f)
|
|
{
|
|
Projectile.alpha -= 5;
|
|
if (Projectile.alpha < 30)
|
|
Projectile.alpha = 30;
|
|
}
|
|
|
|
Projectile.localAI[1] += 1f;
|
|
if (Projectile.localAI[1] == 24f)
|
|
{
|
|
Projectile.localAI[1] = 0f;
|
|
for (int l = 0; l < 12; l++)
|
|
{
|
|
Vector2 dustRotation = Vector2.UnitX * -Projectile.width / 2f;
|
|
dustRotation += -Vector2.UnitY.RotatedBy(l * MathHelper.Pi / 6f) * new Vector2(8f, 16f);
|
|
dustRotation = dustRotation.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
|
|
int phantomDust = Dust.NewDust(Projectile.Center, 0, 0, DustID.DungeonSpirit, 0f, 0f, 160, default, 1f);
|
|
Main.dust[phantomDust].scale = 1.1f;
|
|
Main.dust[phantomDust].noGravity = true;
|
|
Main.dust[phantomDust].position = Projectile.Center + dustRotation;
|
|
Main.dust[phantomDust].velocity = Projectile.velocity * 0.1f;
|
|
Main.dust[phantomDust].velocity = Vector2.Normalize(Projectile.Center - Projectile.velocity * 3f - Main.dust[phantomDust].position) * 1.25f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
return new Color(100, 250, 250, Projectile.alpha);
|
|
}
|
|
|
|
public override void OnKill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item125, Projectile.Center);
|
|
Projectile.position.X = Projectile.position.X + (Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2);
|
|
Projectile.width = 50;
|
|
Projectile.height = 50;
|
|
Projectile.position.X = Projectile.position.X - (Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2);
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
int killGhostDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.2f);
|
|
Main.dust[killGhostDust].velocity *= 3f;
|
|
Main.dust[killGhostDust].noGravity = true;
|
|
if (Main.rand.NextBool())
|
|
{
|
|
Main.dust[killGhostDust].scale = 0.5f;
|
|
Main.dust[killGhostDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int j = 0; j < 5; j++)
|
|
{
|
|
int killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1.7f);
|
|
Main.dust[killGhostDust2].noGravity = true;
|
|
Main.dust[killGhostDust2].velocity *= 5f;
|
|
killGhostDust2 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.DungeonSpirit, 0f, 0f, 100, default, 1f);
|
|
Main.dust[killGhostDust2].velocity *= 2f;
|
|
}
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
|
{
|
|
if (info.Damage <= 0)
|
|
return;
|
|
|
|
target.AddBuff(ModContent.BuffType<Nightwither>(), 120);
|
|
}
|
|
}
|
|
}
|