diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 6865a35376..07b540a747 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -650,6 +650,9 @@ namespace CalamityMod.NPCs.SlimeGod float jumpSpeedX = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 10f) + distanceSpeedBoost) * NPC.direction; float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -16f) + jumpSpeedY = -16f; + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); NPC.ai[2] += 1f; diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 9ea656170d..dfd3f73e7d 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -590,6 +590,9 @@ namespace CalamityMod.NPCs.SlimeGod float jumpSpeedX = ((death ? 16.25f : revenge ? 14.5f : expertMode ? 13.5f : 11.5f) + distanceSpeedBoost) * NPC.direction; float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -16f) + jumpSpeedY = -16f; + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); NPC.ai[2] += 1f; diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 0879e1ec26..bbbd3c5e50 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -124,6 +124,10 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + + // How fast the slime slams down + float slamVelocity = bossRush ? 20f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -167,6 +171,17 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; } + // Slow down dramatically while teleporting + if (NPC.ai[0] == 5f || NPC.ai[0] == 6f) + { + if (Math.Abs(NPC.velocity.X) > 0.1f) + { + NPC.velocity.X *= 0.8f; + if (Math.Abs(NPC.velocity.X) <= 0.1f) + NPC.velocity.X = 0f; + } + } + // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -174,10 +189,7 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - // Slow down dramatically - NPC.velocity.X *= 0.5f; - - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -235,31 +247,27 @@ namespace CalamityMod.NPCs.SlimeGod // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - NPC.ai[3] += death ? 3f : 2f; + // Teleport very soon if too far away + float catchUpDistance = 1500f; + bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; + if (fastTeleport) + { + NPC.ai[3] += 10f; + } else - NPC.ai[3] += 1f; + { + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) + NPC.ai[3] += death ? 3f : 2f; + else + NPC.ai[3] += 1f; + } } - float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); + float distanceSpeedBoost = NPC.Distance(player.Center) * (bossRush ? 0.008f : 0.005f); if (NPC.ai[0] == 0f) { - // Catch up to the target if too far away - float catchUpDistance = 1600f; - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[0] = 5f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit @@ -288,7 +296,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += hyperMode ? 2f : 1f; float jumpGateValue = 45f; - float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + float velocityX = death ? 13f : revenge ? 12f : expertMode ? 11f : 9f; if (revenge) { float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); @@ -297,7 +305,7 @@ namespace CalamityMod.NPCs.SlimeGod velocityX += speedBoost; } - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); float speedMult = 1f; if (distanceBelowTarget > 0f) speedMult += distanceBelowTarget * 0.002f; @@ -306,9 +314,6 @@ namespace CalamityMod.NPCs.SlimeGod speedMult = 2f; float velocityY = 10f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; if (NPC.ai[1] > jumpGateValue) { @@ -377,7 +382,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; + NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; } NPC.ai[1] = 0f; @@ -404,7 +409,7 @@ namespace CalamityMod.NPCs.SlimeGod float slimeShotVelocity = 6f; Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; float minFiringDistance = 160f; // 10 tile distance - if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) + if (NPC.Distance(player.Center) > minFiringDistance) { SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -442,37 +447,40 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 targetCenter = player.Center; - targetCenter.Y -= 350f; - Vector2 targetDist = targetCenter - NPC.Center; + + float distanceAboveTarget = 350f; + Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; + float moveSpeed = slamVelocity - 6f; + float inertia = 5f; + velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; - if (NPC.ai[1] > 12f) + float delayBeforeSlamming = 12f; + if (NPC.ai[1] > delayBeforeSlamming) { NPC.ai[1] = 0f; NPC.ai[0] = 2.1f; NPC.ai[2] = 0f; - NPC.velocity = targetDist; + NPC.velocity = velocity; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - targetDist = targetDist.SafeNormalize(Vector2.UnitY); - targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; + float moveSpeed = (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) + distanceSpeedBoost; + float inertia = 6f; + velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; } } else if (NPC.ai[0] == 2.1f) @@ -480,7 +488,7 @@ namespace CalamityMod.NPCs.SlimeGod // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -588,9 +596,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; NPC.velocity.Y += 0.5f; - float velocityLimit = bossRush ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; + if (NPC.velocity.Y > slamVelocity) + NPC.velocity.Y = slamVelocity; } else if (NPC.ai[0] == 3f) { @@ -603,30 +610,21 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - if (NPC.ai[1] > 15f) + float jumpGateValue = 15f; + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - NPC.velocity.Y -= 6f; - if (player.position.Y + player.height < NPC.Center.Y) - NPC.velocity.Y -= 1.2f; - if (player.position.Y + player.height < NPC.Center.Y - 40f) - NPC.velocity.Y -= 1.4f; - if (player.position.Y + player.height < NPC.Center.Y - 80f) - NPC.velocity.Y -= 1.7f; - if (player.position.Y + player.height < NPC.Center.Y - 120f) - NPC.velocity.Y -= 2f; - if (player.position.Y + player.height < NPC.Center.Y - 160f) - NPC.velocity.Y -= 2.2f; - if (player.position.Y + player.height < NPC.Center.Y - 200f) - NPC.velocity.Y -= 2.4f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - NPC.velocity.Y -= 2f; + float jumpSpeedX = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 8f) + distanceSpeedBoost) * NPC.direction; + float jumpSpeedY = -6f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -18f) + jumpSpeedY = -18f; + + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); - NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else @@ -638,7 +636,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); + float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -682,43 +680,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } + // Teleport shit else if (NPC.ai[0] == 5f) - { - // Set damage - NPC.damage = setDamage; - - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.spriteDirection = NPC.direction; - - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.knockBackResist = 0f; - - Vector2 distanceFromTarget = player.Center - NPC.Center; - distanceFromTarget.Y -= 16f; - if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - - float movementSpeed = 16f; - if (distanceFromTarget.Length() > movementSpeed) - { - distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); - distanceFromTarget *= movementSpeed; - } - - float inertia = 25f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; - } - else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; @@ -731,14 +694,14 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 7f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 7f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; } @@ -752,7 +715,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[corruptDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 7f) + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0;