Master Mode Queen Slime and contact damage fairness (includes some vanilla Expert Mode changes too since she didn't have many).

This commit is contained in:
mountaindrew10 committed 2024-02-19 23:56:37 -06:00
1 parent 8713eff4bd
commit ed4e78f356
3 files changed
+856 -18

No files matched your search

+2 -2
View File
@@ -3091,10 +3091,10 @@ namespace CalamityMod.NPCs
case NPCID.WallofFleshEye:
return WallOfFleshAI.VanillaWallofFleshEyeAI(npc, Mod);
/*case NPCID.QueenSlimeBoss:
case NPCID.QueenSlimeBoss:
return QueenSlimeAI.VanillaQueenSlimeAI(npc, Mod);
case NPCID.TheDestroyer:
/*case NPCID.TheDestroyer:
case NPCID.TheDestroyerBody:
case NPCID.TheDestroyerTail:
return DestroyerAI.VanillaDestroyerAI(npc, Mod);
+847 -13
View File
@@ -16,6 +16,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
{
// Difficulty bools
bool bossRush = BossRushEvent.BossRushActive;
bool masterMode = Main.masterMode || bossRush;
bool death = CalamityWorld.death || bossRush;
// Percent life remaining
@@ -55,7 +56,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
// Teleport
float teleportGateValue = 600f;
float teleportGateValue = masterMode ? 300f : 600f;
if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !phase2 && npc.ai[3] >= teleportGateValue && npc.ai[0] == 0f && npc.velocity.Y == 0f)
{
// Avoid cheap bullshit
@@ -300,8 +301,37 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
// Spawn crown gore
if (npc.ai[1] == teleportTime)
{
Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown);
// Spawn spread of projectiles in Master Mode
if (masterMode)
{
int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12;
if (Main.getGoodWorld)
numGelProjectiles = 15;
float projectileVelocity = death ? 15f : 12f;
int type = ProjectileID.QueenSlimeGelAttack;
int damage = npc.GetProjectileDamage(type);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
for (int j = 0; j < numGelProjectiles; j++)
{
Vector2 spinningpoint = new Vector2(projectileVelocity, 0f);
if (CalamityWorld.LegendaryMode)
spinningpoint *= Main.rand.NextFloat() + 0.5f;
spinningpoint = spinningpoint.RotatedBy((-j) * ((float)Math.PI * 2f) / numGelProjectiles, Vector2.Zero);
int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f);
Main.projectile[proj].timeLeft = 900;
}
}
}
}
if (npc.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient)
{
npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]);
@@ -401,6 +431,9 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
npc.ai[2] += 1f;
}
if (masterMode)
npc.velocity *= 1.2f;
npc.noTileCollide = true;
}
else
@@ -408,16 +441,16 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.target >= Main.maxPlayers)
break;
float jumpVelocity = bossRush ? 6.5f : death ? 5.5f : 4.5f;
float jumpVelocity = bossRush ? 9f : death ? (masterMode ? 7f : 5.5f) : (masterMode ? 6f : 4.5f);
if (Main.getGoodWorld)
jumpVelocity = 7f;
jumpVelocity = 9f;
if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity))
{
if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1))
npc.velocity.X += (bossRush ? 0.5f : death ? 0.35f : 0.3f) * npc.direction;
npc.velocity.X += (bossRush ? 1f : death ? (masterMode ? 0.45f : 0.35f) : (masterMode ? 0.4f : 0.3f)) * npc.direction;
else
npc.velocity.X *= bossRush ? 0.88f : death ? 0.9f : 0.91f;
npc.velocity.X *= bossRush ? 0.8f : death ? (masterMode ? 0.85f : 0.9f) : (masterMode ? 0.88f : 0.91f);
}
if (!Main.player[npc.target].dead)
@@ -467,10 +500,23 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
int damage = npc.GetProjectileDamage(type);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, damage, 0f, Main.myPlayer);
// Line of explosions in Master Mode
if (masterMode)
{
Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * 1000f;
for (int i = 0; i < 11; i++)
{
if (i != 5)
Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, damage, 0f, Main.myPlayer);
extraSmashPosition -= Vector2.UnitX * 200f;
}
}
// Eruption of crystals in phase 3
if (npc.ai[0] == 6f && phase3)
{
float projectileVelocity = 12f;
float projectileVelocity = masterMode ? 15f : 12f;
type = ProjectileID.QueenSlimeMinionBlueSpike;
damage = npc.GetProjectileDamage(type);
Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center;
@@ -561,13 +607,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
int projectileAmt = 2;
int type = ProjectileID.QueenSlimeMinionBlueSpike;
int damage = npc.GetProjectileDamage(type);
Vector2 velocityIncrease = masterMode ? (Vector2.UnitY * 4f) : Vector2.Zero;
for (int i = 0; i < projectileAmt; i++)
{
int totalProjectiles = 2;
float radians = MathHelper.TwoPi / totalProjectiles;
for (int j = 0; j < totalProjectiles; j++)
{
Vector2 projVelocity = npc.velocity.RotatedBy(radians * j + MathHelper.PiOver2);
Vector2 projVelocity = (npc.velocity + velocityIncrease).RotatedBy(radians * j + MathHelper.PiOver2);
Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f);
}
}
@@ -612,7 +659,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
{
npc.velocity = center - npc.Center;
npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero);
npc.velocity *= bossRush ? 30f : death ? 26f : 24f;
npc.velocity *= bossRush ? 30f : death ? (masterMode ? 27.3f : 26f) : (masterMode ? 25.2f : 24f);
}
else
npc.velocity.Y *= 0.95f;
@@ -641,10 +688,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int numGelProjectiles = phase4 ? Main.rand.Next(9, 12) : phase2 ? Main.rand.Next(6, 9) : 12;
if (masterMode)
numGelProjectiles += 2;
if (Main.getGoodWorld)
numGelProjectiles = 15;
float projectileVelocity = death ? 12f : 10.5f;
float projectileVelocity = death ? (masterMode ? 15f : 12f) : (masterMode ? 13f : 10.5f);
int type = ProjectileID.QueenSlimeGelAttack;
int damage = npc.GetProjectileDamage(type);
if (phase2)
@@ -780,7 +829,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
npc.netUpdate = true;
}
int slimeSpawnThreshold = (int)(npc.lifeMax * (CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f));
float slimeSpawnHealthGateValue = CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f;
if (masterMode)
slimeSpawnHealthGateValue *= 0.8f;
int slimeSpawnThreshold = (int)(npc.lifeMax * slimeSpawnHealthGateValue);
if (!((npc.life + slimeSpawnThreshold) < npc.localAI[0]))
return false;
@@ -820,18 +874,730 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
return false;
}
public static bool VanillaQueenSlimeAI(NPC npc, Mod mod)
{
int num = 30;
int num2 = 40;
float num3 = 1f;
bool flag = false;
bool flag2 = npc.life <= npc.lifeMax / 2;
if (npc.localAI[0] == 0f)
{
npc.ai[1] = -100f;
npc.localAI[0] = npc.lifeMax;
npc.TargetClosest();
npc.netUpdate = true;
}
Lighting.AddLight(npc.Center, 1f, 0.7f, 0.9f);
int num4 = 500;
if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4)
{
npc.TargetClosest();
if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4)
{
npc.EncourageDespawn(10);
if (Main.player[npc.target].Center.X < npc.Center.X)
npc.direction = 1;
else
npc.direction = -1;
}
}
if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !flag2 && npc.ai[3] >= 300f && npc.ai[0] == 0f && npc.velocity.Y == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.ai[0] = 2f;
npc.ai[1] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.netUpdate = true;
npc.TargetClosest(false);
Point point = npc.Center.ToTileCoordinates();
Point point2 = Main.player[npc.target].Center.ToTileCoordinates();
Vector2 vector = Main.player[npc.target].Center - npc.Center;
int num5 = 10;
int num6 = 0;
int num7 = 7;
int num8 = 0;
bool flag3 = false;
if (npc.ai[3] >= 360f || vector.Length() > 2000f)
{
if (npc.ai[3] > 360f)
npc.ai[3] = 360f;
flag3 = true;
num8 = 100;
}
while (!flag3 && num8 < 100)
{
num8++;
int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1);
int num10 = Main.rand.Next(point2.Y - num5, point2.Y + 1);
if ((num10 >= point2.Y - num7 && num10 <= point2.Y + num7 && num9 >= point2.X - num7 && num9 <= point2.X + num7) || (num10 >= point.Y - num6 && num10 <= point.Y + num6 && num9 >= point.X - num6 && num9 <= point.X + num6) || Main.tile[num9, num10].HasUnactuatedTile)
continue;
int num11 = num10;
int i = 0;
if (Main.tile[num9, num11].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num11].TileType] && !Main.tileSolidTop[Main.tile[num9, num11].TileType])
{
i = 1;
}
else
{
for (; i < 150 && num11 + i < Main.maxTilesY; i++)
{
int num12 = num11 + i;
if (Main.tile[num9, num12].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num12].TileType] && !Main.tileSolidTop[Main.tile[num9, num12].TileType])
{
i--;
break;
}
}
}
num10 += i;
bool flag4 = true;
if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava)
flag4 = false;
if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
flag4 = false;
if (flag4)
{
npc.localAI[1] = num9 * 16 + 8;
npc.localAI[2] = num10 * 16 + 16;
flag3 = true;
break;
}
}
if (num8 >= 100)
{
Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom;
npc.localAI[1] = bottom.X;
npc.localAI[2] = bottom.Y;
npc.ai[3] = 0f;
}
}
}
if (!flag2 && (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f))
{
npc.ai[3] += (Main.masterMode ? 3f : Main.expertMode ? 2f : 1.5f);
}
else
{
float num13 = npc.ai[3];
npc.ai[3] -= 1f;
if (npc.ai[3] < 0f)
{
if (Main.netMode != NetmodeID.MultiplayerClient && num13 > 0f)
npc.netUpdate = true;
npc.ai[3] = 0f;
}
}
if (npc.timeLeft <= 10 && ((flag2 && npc.ai[0] != 0f) || (!flag2 && npc.ai[0] != 3f)))
{
if (flag2)
npc.ai[0] = 0f;
else
npc.ai[0] = 3f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.ai[3] = 0f;
npc.netUpdate = true;
}
npc.noTileCollide = false;
npc.noGravity = false;
if (flag2)
{
npc.localAI[3] += 1f;
if (npc.localAI[3] >= 24f)
npc.localAI[3] = 0f;
if (npc.ai[0] == 4f && npc.ai[2] == 1f)
npc.localAI[3] = 6f;
if (npc.ai[0] == 5f && npc.ai[2] != 1f)
npc.localAI[3] = 7f;
}
switch ((int)npc.ai[0])
{
case 0:
{
// Avoid cheap bullshit
npc.damage = 0;
if (flag2)
{
QueenSlime_FlyMovement_Vanilla(npc);
}
else
{
npc.noTileCollide = false;
npc.noGravity = false;
if (npc.velocity.Y == 0f)
{
npc.velocity.X *= 0.8f;
if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1)
npc.velocity.X = 0f;
}
}
if (npc.timeLeft <= 10 || (!flag2 && npc.velocity.Y != 0f))
break;
npc.ai[1] += 1f;
int num18 = 60;
if (flag2)
num18 = 120;
if (Main.masterMode)
num18 /= 2;
if (!(npc.ai[1] > (float)num18))
break;
npc.ai[1] = 0f;
if (flag2)
{
Player player = Main.player[npc.target];
int num19 = Main.rand.Next(2);
if (num19 != 1)
npc.ai[0] = 4f;
else
npc.ai[0] = 5f;
if (npc.ai[0] == 4f)
{
npc.ai[2] = 1f;
if (player != null && player.active && !player.dead && (player.Bottom.Y < npc.Bottom.Y || Math.Abs(player.Center.X - npc.Center.X) > 250f))
{
npc.ai[0] = 5f;
npc.ai[2] = 0f;
}
}
}
else
{
switch (Main.rand.Next(3))
{
default:
npc.ai[0] = 3f;
break;
case 1:
npc.ai[0] = 4f;
break;
case 2:
npc.ai[0] = 5f;
break;
}
}
npc.netUpdate = true;
break;
}
case 1:
{
// Avoid cheap bullshit
npc.damage = 0;
npc.rotation = 0f;
npc.ai[1] += (Main.masterMode ? 2f : 1f);
num3 = MathHelper.Clamp(npc.ai[1] / 30f, 0f, 1f);
num3 = 0.5f + num3 * 0.5f;
if (npc.ai[1] >= 30f && Main.netMode != NetmodeID.MultiplayerClient)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.netUpdate = true;
npc.TargetClosest();
}
if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 60f)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.TargetClosest();
}
Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor();
newColor2.A = 150;
for (int num27 = 0; num27 < 10; num27++)
{
int num28 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f);
Main.dust[num28].noGravity = true;
Main.dust[num28].velocity *= 2f;
}
break;
}
case 2:
// Avoid cheap bullshit
npc.damage = 0;
npc.rotation = 0f;
npc.ai[1] += (Main.masterMode ? 2f : 1f);
num3 = MathHelper.Clamp((60f - npc.ai[1]) / 60f, 0f, 1f);
num3 = 0.5f + num3 * 0.5f;
if (npc.ai[1] >= 60f)
flag = true;
if (npc.ai[1] == 60f)
{
Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown);
if (Main.masterMode)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int num14 = 10;
if (Main.getGoodWorld)
num14 = 15;
for (int j = 0; j < num14; j++)
{
Vector2 spinningpoint = new Vector2(9f, 0f);
spinningpoint = spinningpoint.RotatedBy((float)(-j) * ((float)Math.PI * 2f) / (float)num14, Vector2.Zero);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, spinningpoint.X, spinningpoint.Y, ProjectileID.QueenSlimeGelAttack, num, 0f, Main.myPlayer);
}
}
}
}
if (npc.ai[1] >= 60f && Main.netMode != NetmodeID.MultiplayerClient)
{
npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]);
npc.ai[0] = 1f;
npc.ai[1] = 0f;
npc.netUpdate = true;
}
if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 120f)
{
npc.ai[0] = 1f;
npc.ai[1] = 0f;
}
if (!flag)
{
Color newColor = NPC.AI_121_QueenSlime_GetDustColor();
newColor.A = 150;
for (int n = 0; n < 10; n++)
{
int num26 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, 4, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f);
Main.dust[num26].noGravity = true;
Main.dust[num26].velocity *= 0.5f;
}
}
break;
case 3:
npc.rotation = 0f;
if (npc.velocity.Y == 0f)
{
// Avoid cheap bullshit
npc.damage = 0;
npc.velocity.X *= 0.8f;
if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1)
npc.velocity.X = 0f;
npc.ai[1] += 4f;
if ((double)npc.life < (double)npc.lifeMax * 0.8)
npc.ai[1] += 4f;
if ((double)npc.life < (double)npc.lifeMax * 0.6)
npc.ai[1] += 4f;
if (!(npc.ai[1] >= 0f))
break;
// Set damage
npc.damage = npc.defDamage;
npc.netUpdate = true;
npc.TargetClosest();
if (npc.ai[2] == 3f)
{
npc.velocity.Y = -13f;
npc.velocity.X += 3.5f * (float)npc.direction;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
if (npc.timeLeft > 10)
npc.ai[0] = 0f;
else
npc.ai[1] = -60f;
}
else if (npc.ai[2] == 2f)
{
npc.velocity.Y = -6f;
npc.velocity.X += 4.5f * (float)npc.direction;
npc.ai[1] = -40f;
npc.ai[2] += 1f;
}
else
{
npc.velocity.Y = -8f;
npc.velocity.X += 4f * (float)npc.direction;
npc.ai[1] = -40f;
npc.ai[2] += 1f;
}
if (Main.expertMode)
{
npc.velocity.X *= 1.5f;
npc.velocity.Y *= 1.25f;
}
if (Main.masterMode)
{
npc.velocity.X *= 1.3f;
npc.velocity.Y *= 1.1f;
}
}
else
{
if (npc.target >= Main.maxPlayers)
break;
float num20 = Main.masterMode ? 5f : 3f;
if (Main.getGoodWorld)
num20 = 7f;
if ((npc.direction == 1 && npc.velocity.X < num20) || (npc.direction == -1 && npc.velocity.X > 0f - num20))
{
if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1))
npc.velocity.X += 0.2f * (float)npc.direction;
else
npc.velocity.X *= 0.93f;
}
}
break;
case 4:
{
// Avoid cheap bullshit
npc.damage = 0;
npc.rotation *= 0.9f;
npc.noTileCollide = true;
npc.noGravity = true;
if (npc.ai[2] == 1f)
{
npc.noTileCollide = false;
npc.noGravity = false;
int num21 = 30;
if (flag2)
num21 = 10;
if (Main.getGoodWorld)
num21 = 0;
Player player2 = Main.player[npc.target];
if (npc.velocity.Y == 0f)
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.netUpdate = true;
SoundEngine.PlaySound(SoundID.Item167, npc.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, ProjectileID.QueenSlimeSmash, num2, 0f, Main.myPlayer);
if (Main.masterMode)
{
Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * 1000f;
for (int i = 0; i < 11; i++)
{
if (i != 5)
Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, ProjectileID.QueenSlimeSmash, num2, 0f, Main.myPlayer);
extraSmashPosition -= Vector2.UnitX * 200f;
}
}
}
for (int l = 0; l < 20; l++)
{
int num22 = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor());
Main.dust[num22].noGravity = true;
Main.dust[num22].velocity.Y = -5f + Main.rand.NextFloat() * -3f;
Main.dust[num22].velocity.X *= 7f;
}
}
else if (npc.ai[1] >= (float)num21)
{
for (int m = 0; m < 4; m++)
{
Vector2 vector3 = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8));
int num23 = Dust.NewDust(vector3, 2, 2, 31, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f);
Main.dust[num23].position = vector3;
Main.dust[num23].noGravity = true;
Main.dust[num23].velocity.Y = npc.velocity.Y * 0.9f;
Main.dust[num23].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f;
}
}
npc.velocity.X *= 0.8f;
float num24 = npc.ai[1];
npc.ai[1] += 1f;
if (npc.ai[1] >= (float)num21)
{
if (num24 < (float)num21)
npc.netUpdate = true;
if (flag2 && npc.ai[1] > (float)(num21 + 120))
{
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.velocity.Y *= 0.8f;
npc.netUpdate = true;
break;
}
// Set damage
npc.damage = npc.defDamage;
npc.velocity.Y += 1f;
float num25 = 14f;
if (Main.getGoodWorld)
{
npc.velocity.Y += 1f;
num25 = 15.99f;
}
if (npc.velocity.Y == 0f)
npc.velocity.Y = 0.01f;
if (npc.velocity.Y >= num25)
npc.velocity.Y = num25;
}
else
npc.velocity.Y *= 0.8f;
break;
}
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f)
{
npc.TargetClosest();
npc.netUpdate = true;
}
npc.ai[1] += 1f;
if (!(npc.ai[1] >= 30f))
break;
if (npc.ai[1] >= 60f)
{
npc.ai[1] = 60f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.ai[1] = 0f;
npc.ai[2] = 1f;
npc.velocity.Y = -3f;
npc.netUpdate = true;
}
}
Player player3 = Main.player[npc.target];
Vector2 center = npc.Center;
if (!player3.dead && player3.active && Math.Abs(npc.Center.X - player3.Center.X) / 16f <= (float)num4)
center = player3.Center;
center.Y -= 384f;
if (npc.velocity.Y == 0f)
{
npc.velocity = center - npc.Center;
npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero);
npc.velocity *= (Main.masterMode ? 28f : Main.expertMode ? 24f : 20f);
}
else
npc.velocity.Y *= 0.95f;
break;
}
case 5:
{
// Avoid cheap bullshit
npc.damage = 0;
npc.rotation *= 0.9f;
npc.noTileCollide = true;
npc.noGravity = true;
if (flag2)
npc.ai[3] = 0f;
if (npc.ai[2] == 1f)
{
npc.ai[1] += 1f;
if (!(npc.ai[1] >= 10f))
break;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int num14 = 10;
if (Main.getGoodWorld)
num14 = 15;
int num15 = num14;
if (!flag2)
num15 = 6;
for (int j = 0; j < num15; j++)
{
Vector2 spinningpoint = new Vector2(Main.masterMode ? 12f : 9f, 0f);
spinningpoint = spinningpoint.RotatedBy((float)(-j) * ((float)Math.PI * 2f) / (float)num14, Vector2.Zero);
Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, ProjectileID.QueenSlimeGelAttack, num, 0f, Main.myPlayer);
}
}
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.netUpdate = true;
break;
}
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f)
{
npc.TargetClosest();
npc.netUpdate = true;
}
npc.ai[1] += 1f;
if (npc.ai[1] >= 50f)
{
npc.ai[1] = 50f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.ai[1] = 0f;
npc.ai[2] = 1f;
npc.netUpdate = true;
}
}
float num16 = 100f;
for (int k = 0; k < 4; k++)
{
Vector2 vector2 = npc.Center + Main.rand.NextVector2CircularEdge(num16, num16);
if (!flag2)
vector2 += new Vector2(0f, 20f);
Vector2 v = vector2 - npc.Center;
v = v.SafeNormalize(Vector2.Zero) * -8f;
int num17 = Dust.NewDust(vector2, 2, 2, 31, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f);
Main.dust[num17].position = vector2;
Main.dust[num17].noGravity = true;
Main.dust[num17].alpha = 250;
Main.dust[num17].velocity = v;
Main.dust[num17].customData = npc;
}
if (flag2)
QueenSlime_FlyMovement_Vanilla(npc);
break;
}
}
npc.dontTakeDamage = (npc.hide = flag);
if (num3 != npc.scale)
{
npc.position.X += npc.width / 2;
npc.position.Y += npc.height;
npc.scale = num3;
npc.width = (int)(114f * npc.scale);
npc.height = (int)(100f * npc.scale);
npc.position.X -= npc.width / 2;
npc.position.Y -= npc.height;
}
if (npc.life <= 0)
return false;
if (Main.netMode == NetmodeID.MultiplayerClient)
return false;
if (npc.localAI[0] >= (float)(npc.lifeMax / 2) && npc.life < npc.lifeMax / 2)
{
npc.localAI[0] = npc.life;
npc.ai[0] = 0f;
npc.ai[1] = 0f;
npc.ai[2] = 0f;
npc.netUpdate = true;
}
int num29 = (int)((float)npc.lifeMax * 0.02f);
if (flag2)
num29 = (int)((float)npc.lifeMax * 0.015f);
if (!((float)(npc.life + num29) < npc.localAI[0]))
return false;
npc.localAI[0] = npc.life;
int num30 = Main.rand.Next(Main.masterMode ? 2 : 1, Main.masterMode ? 4 : 3);
for (int num31 = 0; num31 < num30; num31++)
{
int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32));
int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32));
int num32 = NPCID.QueenSlimeMinionBlue;
switch (Main.rand.Next(3))
{
case 0:
num32 = NPCID.QueenSlimeMinionBlue;
break;
case 1:
num32 = NPCID.QueenSlimeMinionPink;
break;
case 2:
num32 = NPCID.QueenSlimeMinionPurple;
break;
}
int num33 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num32);
Main.npc[num33].SetDefaults(num32);
Main.npc[num33].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f;
Main.npc[num33].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f;
Main.npc[num33].ai[0] = -500 * Main.rand.Next(3);
Main.npc[num33].ai[1] = 0f;
if (Main.netMode == NetmodeID.Server && num33 < Main.maxNPCs)
NetMessage.SendData(23, -1, -1, null, num33);
}
return false;
}
public static void QueenSlime_FlyMovement(NPC npc)
{
// Difficulty bools
bool bossRush = BossRushEvent.BossRushActive;
bool masterMode = Main.masterMode;
bool death = CalamityWorld.death;
npc.noTileCollide = true;
npc.noGravity = true;
float flyVelocity = bossRush ? 20f : death ? 18f : 16f;
float flyAcceleration = bossRush ? 0.18f : death ? 0.14f : 0.12f;
float flyDistanceY = 450f;
float flyVelocity = bossRush ? 24f : death ? (masterMode ? 21f : 18f) : (masterMode ? 19f : 16f);
float flyAcceleration = bossRush ? 0.3f : death ? (masterMode ? 0.18f : 0.14f) : (masterMode ? 0.16f : 0.12f);
float flyDistanceY = masterMode ? 350f : 450f;
npc.TargetClosest();
@@ -894,5 +1660,73 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.rotation < -0.5f)
npc.rotation = -0.5f;
}
public static void QueenSlime_FlyMovement_Vanilla(NPC npc)
{
npc.noTileCollide = true;
npc.noGravity = true;
float num = Main.masterMode ? 18f : Main.expertMode ? 15f : 12f;
float num2 = Main.masterMode ? 0.12f : Main.expertMode ? 0.1f : 0.085f;
float num3 = 250f;
npc.TargetClosest();
Vector2 desiredVelocity = npc.Center;
if (npc.timeLeft > 10)
{
if (!Collision.CanHit(npc, Main.player[npc.target]))
{
bool flag = false;
Vector2 center = Main.player[npc.target].Center;
for (int i = 0; i < 16; i++)
{
float num4 = 16 * i;
Point point = (center + new Vector2(0f, 0f - num4)).ToTileCoordinates();
if (WorldGen.SolidOrSlopedTile(point.X, point.Y))
{
desiredVelocity = center + new Vector2(0f, 0f - num4 + 16f) - npc.Center;
flag = true;
break;
}
}
if (!flag)
desiredVelocity = center - npc.Center;
}
else
desiredVelocity = Main.player[npc.target].Center + new Vector2(0f, 0f - num3) - npc.Center;
}
else
desiredVelocity = npc.Center + new Vector2(500f * (float)npc.direction, 0f - num3) - npc.Center;
float num5 = desiredVelocity.Length();
if (Math.Abs(desiredVelocity.X) < 40f)
desiredVelocity.X = npc.velocity.X;
float num6 = num - 2f;
if (num5 > 100f && ((npc.velocity.X < 0f - num6 && desiredVelocity.X > 0f) || (npc.velocity.X > num6 && desiredVelocity.X < 0f)))
num2 *= 2f;
if (num5 < 40f)
{
desiredVelocity = npc.velocity;
}
else if (num5 < 80f)
{
desiredVelocity.Normalize();
desiredVelocity *= num * 0.65f;
}
else
{
desiredVelocity.Normalize();
desiredVelocity *= num;
}
npc.SimpleFlyMovement(desiredVelocity, num2);
npc.rotation = npc.velocity.X * 0.1f;
if (npc.rotation > 0.5f)
npc.rotation = 0.5f;
if (npc.rotation < -0.5f)
npc.rotation = -0.5f;
}
}
}
+7 -3
View File
@@ -1463,10 +1463,10 @@ namespace CalamityMod.Projectiles
else if (projectile.type == ProjectileID.QueenSlimeGelAttack)
{
// Phase 1 and 2 projectiles do not bounce and do not have gravity.
// Phase 1 and 2 projectiles do not bounce.
if (projectile.ai[1] == -2f)
{
if (projectile.alpha == 0 && Main.rand.Next(3) == 0)
if (projectile.alpha == 0 && Main.rand.NextBool(3))
{
Color newColor = NPC.AI_121_QueenSlime_GetDustColor();
newColor.A = 150;
@@ -1484,6 +1484,10 @@ namespace CalamityMod.Projectiles
projectile.rotation += (Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y)) * 0.05f;
projectile.velocity.Y += 0.1f;
if (projectile.velocity.Y > 16f)
projectile.velocity.Y = 16f;
if (CalamityWorld.LegendaryMode && projectile.velocity.Length() > 2f)
projectile.velocity *= 0.985f;
@@ -1502,7 +1506,7 @@ namespace CalamityMod.Projectiles
projectile.frame = Main.rand.Next(3);
}
if (projectile.alpha == 0 && Main.rand.Next(3) == 0)
if (projectile.alpha == 0 && Main.rand.NextBool(3))
{
Color newColor = new Color(78, 136, 255, 150);
Dust slime = Dust.NewDustDirect(projectile.position + projectile.velocity, projectile.width, projectile.height, 4, 0f, 0f, 50, newColor, 1.2f);