Adjusted various multiplayer client netmode checks for boss AIs to avoid bugs at all cost.
This commit is contained in:
1 parent
f0cd8f78e4
commit
3ef36036ef
18 files changed
+1023
-912
No files matched your search
@@ -2796,9 +2796,7 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
NPC npc = Main.npc[l];
|
||||
if (npc.active && !npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f)
|
||||
{
|
||||
npc.AddBuff(ModContent.BuffType<Enraged>(), 600, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ namespace CalamityMod.NPCs.Abyss
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (NPC.ai[1] == 0f)
|
||||
{
|
||||
if (NPC.ai[1] == 0f)
|
||||
NPC.ai[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NPC.ai[1] = 1f;
|
||||
int spawnedNPC = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<BobbitWormHead>(), NPC.whoAmI, 0f, 0f, 0f, 0f, 255);
|
||||
Main.npc[spawnedNPC].ai[2] = (float)CalamityGlobalNPC.bobbitWormBottom[(int)NPC.ai[0]];
|
||||
NPC.ai[2] = (float)spawnedNPC;
|
||||
|
||||
@@ -464,18 +464,21 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
DownedBossSystem.downedDragonfolly = true;
|
||||
CalamityNetcode.SyncWorld();
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld)
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
int spacing = 40;
|
||||
int amt = 7;
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
|
||||
for (int i = 0; i < amt; i++)
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f);
|
||||
Vector2 ai0 = NPC.Center - fireFrom;
|
||||
float ai = Main.rand.Next(100);
|
||||
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
|
||||
for (int i = 0; i < amt; i++)
|
||||
{
|
||||
Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f);
|
||||
Vector2 ai0 = NPC.Center - fireFrom;
|
||||
float ai = Main.rand.Next(100);
|
||||
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,16 +55,19 @@ namespace CalamityMod.NPCs.Bumblebirb
|
||||
if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2)
|
||||
Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld)
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f);
|
||||
for (int i = 0; i < 5; i++)
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f);
|
||||
Vector2 ai0 = NPC.Center - fireFrom;
|
||||
float ai = Main.rand.Next(100);
|
||||
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f);
|
||||
Vector2 ai0 = NPC.Center - fireFrom;
|
||||
float ai = Main.rand.Next(100);
|
||||
Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType<RedLightning>(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+427
-329
File diff suppressed because it is too large.
Load diff
+30
-35
@@ -191,47 +191,44 @@ namespace CalamityMod.NPCs.Crabulon
|
||||
if (NPC.ai[0] < 2f)
|
||||
{
|
||||
Vector2 vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
int num352 = 1;
|
||||
NPC.localAI[3] += 2f;
|
||||
if (phase2)
|
||||
{
|
||||
NPC.localAI[3] += 1f;
|
||||
num352 += 2;
|
||||
}
|
||||
if (phase3)
|
||||
{
|
||||
int num352 = 1;
|
||||
NPC.localAI[3] += 2f;
|
||||
if (phase2)
|
||||
{
|
||||
NPC.localAI[3] += 1f;
|
||||
num352 += 2;
|
||||
}
|
||||
if (phase3)
|
||||
{
|
||||
NPC.localAI[3] += 2f;
|
||||
num352 += 3;
|
||||
}
|
||||
if (NPC.ai[3] == 0f)
|
||||
{
|
||||
if (NPC.localAI[3] > 600f)
|
||||
{
|
||||
NPC.ai[3] = 1f;
|
||||
NPC.localAI[3] = 0f;
|
||||
}
|
||||
}
|
||||
else if (NPC.localAI[3] > 45f)
|
||||
num352 += 3;
|
||||
}
|
||||
if (NPC.ai[3] == 0f)
|
||||
{
|
||||
if (NPC.localAI[3] > 600f)
|
||||
{
|
||||
NPC.ai[3] = 1f;
|
||||
NPC.localAI[3] = 0f;
|
||||
NPC.ai[3] += 1f;
|
||||
if (NPC.ai[3] >= num352)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
}
|
||||
float num353 = 10f;
|
||||
int type = ModContent.ProjectileType<MushBomb>();
|
||||
SoundEngine.PlaySound(SoundID.Item42, NPC.Center);
|
||||
}
|
||||
}
|
||||
else if (NPC.localAI[3] > 45f)
|
||||
{
|
||||
NPC.localAI[3] = 0f;
|
||||
NPC.ai[3] += 1f;
|
||||
if (NPC.ai[3] >= num352)
|
||||
NPC.ai[3] = 0f;
|
||||
|
||||
float num353 = 10f;
|
||||
int type = ModContent.ProjectileType<MushBomb>();
|
||||
SoundEngine.PlaySound(SoundID.Item42, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
if (phase2)
|
||||
{
|
||||
num353 += 1f;
|
||||
}
|
||||
if (phase3)
|
||||
{
|
||||
num353 += 1f;
|
||||
}
|
||||
|
||||
vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
|
||||
float num349 = player.position.X + player.width * 0.5f - vector34.X;
|
||||
float num350 = player.position.Y + player.height * 0.5f - vector34.Y;
|
||||
@@ -873,9 +870,7 @@ namespace CalamityMod.NPCs.Crabulon
|
||||
if (Main.zenithWorld && Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
for (int i = 0; i < Main.rand.Next(10, 23); i++)
|
||||
{
|
||||
NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-NPC.width / 2, NPC.width / 2), (int)NPC.Center.Y + Main.rand.Next(-NPC.height / 2, NPC.height / 2), NPCID.Crab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+65
-53
@@ -331,26 +331,30 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
float chargeSlownDownPhaseGateValue = chargeGateValue + chargeSlowDownTime;
|
||||
bool chargePhase = NPC.ai[1] >= chargePhaseGateValue;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (NPC.ai[0] < 5f || !phase6) && !chargePhase)
|
||||
if (expertMode && (NPC.ai[0] < 5f || !phase6) && !chargePhase)
|
||||
{
|
||||
calamityGlobalNPC.newAI[3] += 1f;
|
||||
if (calamityGlobalNPC.newAI[3] >= (bossRush ? 660f : 900f))
|
||||
{
|
||||
calamityGlobalNPC.newAI[3] = 0f;
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = 3;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBomb;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float velocity = 2f + NPC.ai[0];
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer);
|
||||
int totalProjectiles = 3;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBomb;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float velocity = 2f + NPC.ai[0];
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -359,16 +363,17 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
{
|
||||
NPC.rotation = NPC.velocity.X * 0.1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 120f)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 120f)
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 24 : 16;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -419,16 +424,17 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
|
||||
NPC.rotation = NPC.velocity.X * 0.1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 120f)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 120f)
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 18 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -498,11 +504,12 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
float totalSpreads = 3f;
|
||||
if ((NPC.ai[1] - chargePhaseGateValue) % (chargeTelegraphTime / totalSpreads) == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceRain;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float maxVelocity = 9f + enrageScale;
|
||||
@@ -593,16 +600,17 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
|
||||
NPC.rotation = NPC.velocity.X * 0.1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 120f)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 120f)
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
NPC.TargetClosest();
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 18 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -644,11 +652,12 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
float totalSpreads = 2f;
|
||||
if ((NPC.ai[1] - chargePhaseGateValue) % (chargeTelegraphTime / totalSpreads) == 0f)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceRain;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float maxVelocity = 9f + enrageScale;
|
||||
@@ -742,15 +751,16 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
{
|
||||
NPC.rotation = NPC.velocity.X * 0.1f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 90f && NPC.Opacity == 1f)
|
||||
{
|
||||
NPC.localAI[0] += 1f;
|
||||
if (NPC.localAI[0] >= 90f && NPC.Opacity == 1f)
|
||||
NPC.localAI[0] = 0f;
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int totalProjectiles = bossRush ? 18 : 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
int type = iceBlast;
|
||||
@@ -855,12 +865,13 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
Main.dust[num39].noGravity = true;
|
||||
}
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
NPC.localAI[0] = 0f;
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
NPC.localAI[0] = 0f;
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceRain;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float velocity = 9f + enrageScale;
|
||||
@@ -939,11 +950,12 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
{
|
||||
NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center);
|
||||
int type = iceBlast;
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float velocity = 1.5f + enrageScale * 0.5f;
|
||||
|
||||
@@ -252,47 +252,51 @@ namespace CalamityMod.NPCs.DesertScourge
|
||||
}
|
||||
TailSpawned = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (expertMode)
|
||||
if (expertMode)
|
||||
{
|
||||
if (NPC.Calamity().newAI[2] < 300f)
|
||||
NPC.Calamity().newAI[2] += 1f;
|
||||
|
||||
if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) &&
|
||||
NPC.Calamity().newAI[2] >= 300f && Vector2.Distance(NPC.Center, player.Center) > 320f &&
|
||||
Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
{
|
||||
if (NPC.Calamity().newAI[2] < 300f)
|
||||
NPC.Calamity().newAI[2] += 1f;
|
||||
|
||||
if (NPC.SafeDirectionTo(player.Center).AngleBetween((NPC.rotation - MathHelper.PiOver2).ToRotationVector2()) < MathHelper.ToRadians(18f) &&
|
||||
NPC.Calamity().newAI[2] >= 300f && Vector2.Distance(NPC.Center, player.Center) > 320f &&
|
||||
Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
|
||||
if (NPC.Calamity().newAI[2] % 30f == 0f)
|
||||
{
|
||||
if (NPC.Calamity().newAI[2] % 30f == 0f)
|
||||
SoundEngine.PlaySound(SoundID.Item21, NPC.Center);
|
||||
|
||||
float velocity = bossRush ? 6f : death ? 5.5f : 5f;
|
||||
int type = ModContent.ProjectileType<SandBlast>();
|
||||
int type2 = ModContent.ProjectileType<HorsWaterBlast>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * velocity;
|
||||
int baseProjectileAmt = bossRush ? 6 : death ? 4 : revenge ? 3 : 2;
|
||||
int numProj = NPC.Calamity().newAI[2] % 60f == 0f ? (int)(baseProjectileAmt * 1.5) : baseProjectileAmt;
|
||||
int spread = bossRush ? 18 : death ? 14 : revenge ? 12 : 10;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < numProj; i++)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item21, NPC.Center);
|
||||
float velocity = bossRush ? 6f : death ? 5.5f : 5f;
|
||||
int type = ModContent.ProjectileType<SandBlast>();
|
||||
int type2 = ModContent.ProjectileType<HorsWaterBlast>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * velocity;
|
||||
int baseProjectileAmt = bossRush ? 6 : death ? 4 : revenge ? 3 : 2;
|
||||
int numProj = NPC.Calamity().newAI[2] % 60f == 0f ? (int)(baseProjectileAmt * 1.5) : baseProjectileAmt;
|
||||
int spread = bossRush ? 18 : death ? 14 : revenge ? 12 : 10;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < numProj; i++)
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
perturbedSpeed *= Main.rand.NextFloat() + 0.5f;
|
||||
|
||||
for (int k = 0; k < 10; k++)
|
||||
Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
|
||||
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
|
||||
perturbedSpeed *= Main.rand.NextFloat() + 0.5f;
|
||||
|
||||
for (int k = 0; k < 10; k++)
|
||||
Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y);
|
||||
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
|
||||
if (Main.zenithWorld)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 3f, perturbedSpeed, type2, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
NPC.Calamity().newAI[2] += 1f;
|
||||
if (NPC.Calamity().newAI[2] > 360f)
|
||||
NPC.Calamity().newAI[2] = 0f;
|
||||
}
|
||||
|
||||
NPC.Calamity().newAI[2] += 1f;
|
||||
if (NPC.Calamity().newAI[2] > 360f)
|
||||
NPC.Calamity().newAI[2] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,27 +435,25 @@ namespace CalamityMod.NPCs.DesertScourge
|
||||
{
|
||||
// Spit a huge spread of sand upwards that falls down
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 16f : bossRush ? 9f : death ? 7f : 6f;
|
||||
int type = ModContent.ProjectileType<GreatSandBlast>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 projectileVelocity = Vector2.Normalize(NPC.Center + NPC.velocity * 10f - NPC.Center) * velocity;
|
||||
int numProj = bossRush ? 24 : death ? 20 : revenge ? 18 : expertMode ? 16 : 12;
|
||||
if (Main.getGoodWorld)
|
||||
numProj *= 2;
|
||||
|
||||
int spread = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 120 : 90;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < numProj; i++)
|
||||
{
|
||||
float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 16f : bossRush ? 9f : death ? 7f : 6f;
|
||||
int type = ModContent.ProjectileType<GreatSandBlast>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 projectileVelocity = Vector2.Normalize(NPC.Center + NPC.velocity * 10f - NPC.Center) * velocity;
|
||||
int numProj = bossRush ? 24 : death ? 20 : revenge ? 18 : expertMode ? 16 : 12;
|
||||
if (Main.getGoodWorld)
|
||||
numProj *= 2;
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
|
||||
|
||||
int spread = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 120 : 90;
|
||||
float rotation = MathHelper.ToRadians(spread);
|
||||
for (int i = 0; i < numProj; i++)
|
||||
{
|
||||
Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
|
||||
|
||||
for (int k = 0; k < 10; k++)
|
||||
Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y);
|
||||
for (int k = 0; k < 10; k++)
|
||||
Dust.NewDust(NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, 10, 10, 85, perturbedSpeed.X, perturbedSpeed.Y);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
NPC.TargetClosest();
|
||||
|
||||
@@ -978,11 +978,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
|
||||
{
|
||||
pickNewLocation = true;
|
||||
NPC.ai[2] += 1f;
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaShootSound, NPC.Center);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
int type = ModContent.ProjectileType<ApolloFireball>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaShootSound, NPC.Center);
|
||||
Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity;
|
||||
Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
|
||||
|
||||
@@ -904,9 +904,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
// Create a bunch of lightning bolts in the sky
|
||||
ExoMechsSky.CreateLightningBolt(12);
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, NPC.Center);
|
||||
int type = ModContent.ProjectileType<AresDeathBeamTelegraph>();
|
||||
Vector2 spawnPoint = NPC.Center + new Vector2(-1f, 23f);
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
|
||||
@@ -411,18 +411,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 1f;
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound, NPC.Center);
|
||||
Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound, NPC.Center);
|
||||
Vector2 gaussNukeVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
|
||||
int type = ModContent.ProjectileType<AresGaussNukeProjectile>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
float offset = 40f;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * offset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y);
|
||||
|
||||
// Recoil
|
||||
NPC.velocity -= gaussNukeVelocity * 2f;
|
||||
}
|
||||
|
||||
// Recoil
|
||||
NPC.velocity -= gaussNukeVelocity * 2f;
|
||||
}
|
||||
|
||||
EnergyDrawer.ParticleSpawnRate = AresBody.telegraphParticlesSpawnRate;
|
||||
|
||||
@@ -433,10 +433,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
if ((calamityGlobalNPC.newAI[2] - plasmaBoltTelegraphDuration) % divisor == 0f && canFire)
|
||||
{
|
||||
NPC.ai[3] += 1f;
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaShootSound, NPC.Center);
|
||||
Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoPlasmaShootSound, NPC.Center);
|
||||
Vector2 plasmaBoltVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
|
||||
int type = ModContent.ProjectileType<AresPlasmaFireball>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 offset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f;
|
||||
@@ -445,10 +445,10 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f);
|
||||
else
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y);
|
||||
|
||||
// Recoil
|
||||
NPC.velocity -= plasmaBoltVelocity;
|
||||
}
|
||||
|
||||
// Recoil
|
||||
NPC.velocity -= plasmaBoltVelocity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -430,19 +430,19 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
|
||||
if ((calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) % divisor == 0f && canFire)
|
||||
{
|
||||
SoundEngine.PlaySound(TeslaOrbShootSound, NPC.Center);
|
||||
Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
SoundEngine.PlaySound(TeslaOrbShootSound, NPC.Center);
|
||||
Vector2 teslaOrbVelocity = Vector2.Normalize(rotationVector) * projectileVelocity;
|
||||
int type = ModContent.ProjectileType<AresTeslaOrb>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Vector2 offset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f;
|
||||
float identity = fireMoreOrbs ? -2f : calamityGlobalNPC.newAI[3] + (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity);
|
||||
|
||||
// Recoil
|
||||
NPC.velocity -= teslaOrbVelocity;
|
||||
}
|
||||
|
||||
// Recoil
|
||||
NPC.velocity -= teslaOrbVelocity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1071,10 +1071,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
|
||||
ExoMechsSky.CreateLightningBolt(12);
|
||||
|
||||
// Fire deathray
|
||||
DeathraySoundSlot = SoundEngine.PlaySound(SpinLaserbeamSound, NPC.Center);
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
DeathraySoundSlot = SoundEngine.PlaySound(SpinLaserbeamSound, NPC.Center);
|
||||
|
||||
int type = ModContent.ProjectileType<ArtemisSpinLaserbeam>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
int laser = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.whoAmI);
|
||||
|
||||
@@ -47,7 +47,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
private const float timeToOpenAndFireLasers = 36f;
|
||||
|
||||
private const float segmentCloseTimerDecrement = 0.2f;
|
||||
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ThanatosHead.DisplayName");
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
this.HideFromBestiary();
|
||||
@@ -249,164 +251,165 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootLasers && !invisiblePhase)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
// Only charge up lasers if not venting or firing lasers
|
||||
if (NPC.Calamity().newAI[0] == 0f)
|
||||
NPC.ai[3] += 1f;
|
||||
|
||||
double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D;
|
||||
if (shouldGetBuffedByBerserkPhase)
|
||||
numSegmentsAbleToFire *= 1.25;
|
||||
|
||||
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
|
||||
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
{
|
||||
// Only charge up lasers if not venting or firing lasers
|
||||
if (NPC.Calamity().newAI[0] == 0f)
|
||||
NPC.ai[3] += 1f;
|
||||
|
||||
double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D;
|
||||
if (shouldGetBuffedByBerserkPhase)
|
||||
numSegmentsAbleToFire *= 1.25;
|
||||
|
||||
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
|
||||
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f;
|
||||
if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f;
|
||||
if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume}, NPC.Center);
|
||||
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Normal laser
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center);
|
||||
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
// Normal laser
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
|
||||
if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
else
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
|
||||
if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f;
|
||||
if (NPC.ai[0] % 3f == 0f)
|
||||
predictionAmt *= 0.5f;
|
||||
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal laser
|
||||
if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f;
|
||||
if (NPC.ai[0] % 3f == 0f)
|
||||
predictionAmt *= 0.5f;
|
||||
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal laser
|
||||
if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -451,9 +454,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
// Noise
|
||||
float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f;
|
||||
if (NPC.localAI[0] == 0f)
|
||||
{
|
||||
SoundEngine.PlaySound(ThanatosHead.VentSound with { Volume = volume * ThanatosHead.VentSound.Volume }, NPC.Center);
|
||||
}
|
||||
|
||||
// Steam
|
||||
NPC.localAI[0] += 1f;
|
||||
@@ -489,9 +490,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
npcCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
|
||||
targetCenterX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - npcCenter.X;
|
||||
targetCenterY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - npcCenter.Y;
|
||||
} catch
|
||||
{
|
||||
}
|
||||
catch { }
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(targetCenterY, targetCenterX) + MathHelper.PiOver2;
|
||||
distanceFromTarget = (float)Math.Sqrt(targetCenterX * targetCenterX + targetCenterY * targetCenterY);
|
||||
@@ -599,13 +599,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
int index = (int)NPC.ai[2];
|
||||
if (index < 0 || index >= Main.maxNPCs || Main.npc[index] is null)
|
||||
return;
|
||||
|
||||
if (Main.npc[index].type != ModContent.NPCType<ThanatosHead>())
|
||||
return;
|
||||
|
||||
if (Main.npc[index].ModNPC<ThanatosHead>().exoMechdusa)
|
||||
{
|
||||
typeName = CalamityUtils.GetTextValue("NPCs.ThanatosHead.HekateName");
|
||||
}
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC.HitInfo hit)
|
||||
@@ -631,9 +630,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
if (NPC.life <= 0)
|
||||
{
|
||||
for (int num193 = 0; num193 < 2; num193++)
|
||||
{
|
||||
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
|
||||
}
|
||||
|
||||
for (int num194 = 0; num194 < 20; num194++)
|
||||
{
|
||||
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
|
||||
|
||||
@@ -249,164 +249,165 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootLasers && !invisiblePhase)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
// Only charge up lasers if not venting or firing lasers
|
||||
if (NPC.Calamity().newAI[0] == 0f)
|
||||
NPC.ai[3] += 1f;
|
||||
|
||||
double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D;
|
||||
if (shouldGetBuffedByBerserkPhase)
|
||||
numSegmentsAbleToFire *= 1.25;
|
||||
|
||||
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
|
||||
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
{
|
||||
// Only charge up lasers if not venting or firing lasers
|
||||
if (NPC.Calamity().newAI[0] == 0f)
|
||||
NPC.ai[3] += 1f;
|
||||
|
||||
double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D;
|
||||
if (shouldGetBuffedByBerserkPhase)
|
||||
numSegmentsAbleToFire *= 1.25;
|
||||
|
||||
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
|
||||
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f;
|
||||
if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f;
|
||||
if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center);
|
||||
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Normal laser
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center);
|
||||
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
// Normal laser
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
|
||||
if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
else
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
|
||||
if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f;
|
||||
if (NPC.ai[0] % 3f == 0f)
|
||||
predictionAmt *= 0.5f;
|
||||
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal laser
|
||||
if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f;
|
||||
if (NPC.ai[0] % 3f == 0f)
|
||||
predictionAmt *= 0.5f;
|
||||
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal laser
|
||||
if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,164 +249,165 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f;
|
||||
if (shootLasers && !invisiblePhase)
|
||||
{
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
// Only charge up lasers if not venting or firing lasers
|
||||
if (NPC.Calamity().newAI[0] == 0f)
|
||||
NPC.ai[3] += 1f;
|
||||
|
||||
double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D;
|
||||
if (shouldGetBuffedByBerserkPhase)
|
||||
numSegmentsAbleToFire *= 1.25;
|
||||
|
||||
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
|
||||
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
{
|
||||
// Only charge up lasers if not venting or firing lasers
|
||||
if (NPC.Calamity().newAI[0] == 0f)
|
||||
NPC.ai[3] += 1f;
|
||||
|
||||
double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D;
|
||||
if (shouldGetBuffedByBerserkPhase)
|
||||
numSegmentsAbleToFire *= 1.25;
|
||||
|
||||
float segmentDivisor = (float)Math.Round(numSegments / numSegmentsAbleToFire);
|
||||
|
||||
if (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge)
|
||||
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f;
|
||||
if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
float divisor = lastMechAlive ? 45f : shouldGetBuffedByBerserkPhase ? 60f : 75f;
|
||||
if ((NPC.ai[3] % divisor == 0f && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center);
|
||||
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Normal laser
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound with { Volume = 0.1f * CommonCalamitySounds.ExoLaserShootSound.Volume }, NPC.Center);
|
||||
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
// Normal laser
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
|
||||
if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
else
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float divisor = NPC.ai[0] * (lastMechAlive ? 1f : shouldGetBuffedByBerserkPhase ? 2f : 3f); // Ranges from 3 to 300
|
||||
if ((NPC.ai[3] == divisor && NPC.ai[0] % segmentDivisor == 0f) || NPC.Calamity().newAI[0] > 0f)
|
||||
{
|
||||
// Body is vulnerable while firing lasers
|
||||
vulnerable = true;
|
||||
|
||||
if (NPC.Calamity().newAI[1] == 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] += 1f;
|
||||
if (NPC.Calamity().newAI[0] >= timeToOpenAndFireLasers)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
{
|
||||
NPC.ai[3] = 0f;
|
||||
NPC.Calamity().newAI[1] = 1f;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
int maxTargets = 3;
|
||||
int[] whoAmIArray = new int[maxTargets];
|
||||
Vector2[] targetCenterArray = new Vector2[maxTargets];
|
||||
int numProjectiles = 0;
|
||||
float maxDistance = 2400f;
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Main.maxPlayers; i++)
|
||||
float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f;
|
||||
if (NPC.ai[0] % 3f == 0f)
|
||||
predictionAmt *= 0.5f;
|
||||
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal laser
|
||||
if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f)
|
||||
{
|
||||
if (!Main.player[i].active || Main.player[i].dead)
|
||||
continue;
|
||||
|
||||
Vector2 playerCenter = Main.player[i].Center;
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
if (projectileLimit >= targetCenterArray.Length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f;
|
||||
if (NPC.ai[0] % 3f == 0f)
|
||||
predictionAmt *= 0.5f;
|
||||
|
||||
int type = ModContent.ProjectileType<ThanatosLaser>();
|
||||
int damage = NPC.GetProjectileDamage(type);
|
||||
SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center);
|
||||
for (int i = 0; i < numProjectiles; i++)
|
||||
{
|
||||
// Fire normal lasers if head is in passive state
|
||||
if (calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.Passive)
|
||||
{
|
||||
// Normal laser
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normal laser
|
||||
if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
|
||||
// Predictive laser
|
||||
Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
|
||||
// Opposite laser
|
||||
projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt;
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] -= segmentCloseTimerDecrement + fasterSegmentClosingVar;
|
||||
if (NPC.Calamity().newAI[0] <= 0f)
|
||||
{
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
NPC.Calamity().newAI[0] = 0f;
|
||||
NPC.Calamity().newAI[1] = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace CalamityMod.Projectiles.Boss
|
||||
public class DoGDeath : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Boss";
|
||||
|
||||
public float TelegraphDelay
|
||||
{
|
||||
get => Projectile.ai[0];
|
||||
|
||||
Reference in new issue
Block a user