From 4434199cb31dbcfbb7cc66b8e5dc2d37b75d23cc Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Wed, 13 Mar 2024 03:29:17 -0500 Subject: [PATCH] 1 - Fixed Destroyer telegraph colors and lights. 2 - Adjusted Twins phase transition attacks and made Spazmatism move much faster while not within range during his flamethrower attack. 3 - Made Rev+ Retinazer homing laser darts far more dangerous. --- NPCs/CalamityGlobalNPC.cs | 14 +- .../Bosses/DestroyerAI.cs | 14 +- NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs | 23 ++-- Projectiles/Boss/ScavengerLaser.cs | 130 +++++++++++------- 4 files changed, 106 insertions(+), 75 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index c6da44f0b6..8fed3028e2 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -6732,8 +6732,8 @@ namespace CalamityMod.NPCs destroyerLifeRatio = Main.npc[npc.realLife].life / (float)Main.npc[npc.realLife].lifeMax; // Light colors - Color groundColor = new Color(128, 25, 25, 0) * (1f - npc.alpha / 255f); - Color flightColor = (CalamityWorld.revenge || BossRushEvent.BossRushActive) ? (new Color(25, 25, 128, 0) * (1f - npc.alpha / 255f)) : groundColor; + Color groundColor = new Color(50, 10, 10, 0) * (1f - npc.alpha / 255f); + Color flightColor = (CalamityWorld.revenge || BossRushEvent.BossRushActive) ? (new Color(10, 10, 50, 0) * (1f - npc.alpha / 255f)) : groundColor; Color segmentColor = ((newAI[3] >= 900f && destroyerLifeRatio < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) ? flightColor : groundColor; Color telegraphColor = Color.Red; @@ -6768,7 +6768,8 @@ namespace CalamityMod.NPCs float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; float bodySegmentTime = npc.ai[0] * 30f; float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - if (newAI[0] > shootProjectileGateValue - DestroyerAI.LaserTelegraphTime) + float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + if (newAI[0] > telegraphGateValue) { switch (destroyerLaserColor) { @@ -6784,7 +6785,7 @@ namespace CalamityMod.NPCs telegraphColor = Color.Cyan; break; } - telegraphProgress = MathHelper.Clamp((newAI[0] - shootProjectileGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); } } else if (npc.type == NPCID.TheDestroyerBody) @@ -6792,8 +6793,9 @@ namespace CalamityMod.NPCs float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; float bodySegmentTime = npc.ai[0] * 30f; float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - if (npc.localAI[0] > shootProjectileGateValue - DestroyerAI.LaserTelegraphTime) - telegraphProgress = MathHelper.Clamp((npc.localAI[0] - shootProjectileGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); + float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + if (npc.localAI[0] > telegraphGateValue) + telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 1253dc0575..a010a63c42 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -647,7 +647,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Light colors Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); Vector3 flightColor = new Vector3(0.05f, 0.1f, 0.3f); - Vector3 segmentColor = (flyAtTarget ? flightColor : groundColor) * 0.5f; + Vector3 segmentColor = (flyAtTarget ? flightColor : groundColor) * 0.2f; Vector3 telegraphColor = groundColor; // Telegraph for the laser breath and body lasers @@ -681,7 +681,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; float bodySegmentTime = npc.ai[0] * 30f; float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - if (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) + float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + if (calamityGlobalNPC.newAI[0] > telegraphGateValue) { switch (calamityGlobalNPC.destroyerLaserColor) { @@ -697,7 +698,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses telegraphColor = new Vector3(0.05f, 0.2f, 0.2f); break; } - telegraphProgress = MathHelper.Clamp((calamityGlobalNPC.newAI[0] - shootProjectileGateValue) / LaserTelegraphTime, 0f, 1f); + telegraphProgress = MathHelper.Clamp((calamityGlobalNPC.newAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); } } } @@ -1297,7 +1298,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Light colors Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); - Vector3 segmentColor = groundColor * 0.5f; + Vector3 segmentColor = groundColor * 0.2f; Vector3 telegraphColor = groundColor; // Telegraph for the laser breath and body lasers @@ -1309,8 +1310,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; float bodySegmentTime = npc.ai[0] * 30f; float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - if (npc.localAI[0] > shootProjectileGateValue - LaserTelegraphTime) - telegraphProgress = MathHelper.Clamp((npc.localAI[0] - shootProjectileGateValue) / LaserTelegraphTime, 0f, 1f); + float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + if (npc.localAI[0] > telegraphGateValue) + telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 3da6d2c69f..a0dbdecb41 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -422,7 +422,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); + int type = npc.ai[1] % 20f == 0f ? ProjectileID.DeathLaser : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes @@ -436,7 +436,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(12f, 12f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 10f + Main.rand.NextVector2CircularEdge(2f, 2f); int numProj = 2; int spread = 40; float rotation = MathHelper.ToRadians(spread); @@ -1412,8 +1412,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - float velocity = 16f; - int type = ModContent.ProjectileType(); + int type = npc.ai[1] % 20f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); // Reduce mech boss projectile damage depending on the new ore progression changes @@ -1427,8 +1426,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(velocity, velocity); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 25f + Main.rand.NextVector2CircularEdge(5f, 5f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[proj].tileCollide = false; } } } @@ -1512,17 +1512,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses spazmatismFlamethrowerFaceDirection = -1; Vector2 spazmatismFlamethrowerPos = npc.Center; - float spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X + (spazmatismFlamethrowerFaceDirection * 180) - spazmatismFlamethrowerPos.X; + int flamethrowerDistance = 180; + float spazmatismFlamethrowerTargetX = Main.player[npc.target].Center.X + (spazmatismFlamethrowerFaceDirection * flamethrowerDistance) - spazmatismFlamethrowerPos.X; float spazmatismFlamethrowerTargetY = Main.player[npc.target].Center.Y - spazmatismFlamethrowerPos.Y; float spazmatismFlamethrowerTargetDist = (float)Math.Sqrt(spazmatismFlamethrowerTargetX * spazmatismFlamethrowerTargetX + spazmatismFlamethrowerTargetY * spazmatismFlamethrowerTargetY); if (!NPC.IsMechQueenUp) { // Boost speed if too far from target - if (spazmatismFlamethrowerTargetDist > 300f) - spazmatismFlamethrowerMaxSpeed += 0.5f; - if (spazmatismFlamethrowerTargetDist > 400f) - spazmatismFlamethrowerMaxSpeed += 0.5f; + if (spazmatismFlamethrowerTargetDist > flamethrowerDistance) + spazmatismFlamethrowerMaxSpeed += MathHelper.Lerp(0f, Main.masterMode ? 10f : 6.6f, MathHelper.Clamp((spazmatismFlamethrowerTargetDist - flamethrowerDistance) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -3027,7 +3026,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!NPC.IsMechQueenUp) { if (num485 > flamethrowerDistance) - num480 += MathHelper.Lerp(0f, Main.masterMode ? 5f : 3.3f, MathHelper.Clamp((num485 - flamethrowerDistance) / 800f, 0f, 1f)); + num480 += MathHelper.Lerp(0f, Main.masterMode ? 10f : 6.6f, MathHelper.Clamp((num485 - flamethrowerDistance) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { diff --git a/Projectiles/Boss/ScavengerLaser.cs b/Projectiles/Boss/ScavengerLaser.cs index d37afeba01..23e447f7b2 100644 --- a/Projectiles/Boss/ScavengerLaser.cs +++ b/Projectiles/Boss/ScavengerLaser.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Boss public class ScavengerLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 5; @@ -45,6 +46,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Projectile.frameCounter++; if (Projectile.frameCounter > 5) @@ -77,10 +79,41 @@ namespace CalamityMod.Projectiles.Boss return; } + // Fly away from other lasers + float pushForce = death ? 0.12f : 0.08f; + float pushDistance = death ? 120f : 80f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + // Short circuits to make the loop as fast as possible + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + if (sameProjType && taxicabDist < pushDistance) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + + if (Projectile.position.Y < otherProj.position.Y) + Projectile.velocity.Y -= pushForce; + else + Projectile.velocity.Y += pushForce; + } + } + + Vector2 maxVelocity = new Vector2(death ? 16f : 12f, 16f); + float maxAcceleration = death ? 0.6f : 0.4f; + float timeBeforeHoming = death ? 30f : 45f; + float explodeDistance = death ? 32f : 16f; if (Projectile.ai[0] == 0f) { Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 45f) + if (Projectile.localAI[0] >= timeBeforeHoming) { Projectile.localAI[0] = 0f; Projectile.ai[0] = 1f; @@ -88,77 +121,74 @@ namespace CalamityMod.Projectiles.Boss Projectile.netUpdate = true; } - Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0D).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -maxVelocity.X, maxVelocity.X); - Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + Projectile.velocity.Y -= maxAcceleration * 0.2f; if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - if (Projectile.velocity.Y < -7f) - Projectile.velocity.Y = -7f; + Projectile.velocity.Y -= maxAcceleration * 0.5f; + if (Projectile.velocity.Y < -maxVelocity.Y) + Projectile.velocity.Y = -maxVelocity.Y; } else if (Projectile.ai[0] == 1f) { - if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + 90f) + if (Main.player[(int)Projectile.ai[1]].Center.Y > Projectile.Center.Y + 80f) { Projectile.ai[0] = 2f; Projectile.netUpdate = true; } - Projectile.velocity.X = Projectile.velocity.RotatedBy(0.0, default).X; - Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -6f, 6f); + Projectile.velocity.X = Projectile.velocity.RotatedBy(0D).X; + Projectile.velocity.X = MathHelper.Clamp(Projectile.velocity.X, -maxVelocity.X, maxVelocity.X); - Projectile.velocity.Y = Projectile.velocity.Y - 0.08f; + Projectile.velocity.Y -= maxAcceleration * 0.2f; if (Projectile.velocity.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y - 0.2f; - if (Projectile.velocity.Y < -7f) - Projectile.velocity.Y = -7f; + Projectile.velocity.Y -= maxAcceleration * 0.5f; + if (Projectile.velocity.Y < -maxVelocity.Y) + Projectile.velocity.Y = -maxVelocity.Y; } else if (Projectile.ai[0] == 2f) { if (Main.player[(int)Projectile.ai[1]].Center.Y < Projectile.Center.Y) Projectile.tileCollide = true; - float speed = revenge ? 9f : 7.5f; - Vector2 playerDistance = Main.player[(int)Projectile.ai[1]].Center - Projectile.Center; - if (playerDistance.Length() < 20f) + if (playerDistance.Length() < explodeDistance) { Projectile.Kill(); return; } - playerDistance.Normalize(); - playerDistance *= 14f; - playerDistance = Vector2.Lerp(Projectile.velocity, playerDistance, 0.6f); - if (playerDistance.Y < speed) - playerDistance.Y = speed; + Vector2 projectileVelocity = playerDistance.SafeNormalize(Vector2.UnitY); + projectileVelocity *= maxVelocity.Length(); + projectileVelocity = Vector2.Lerp(Projectile.velocity, projectileVelocity, 0.6f); + if (projectileVelocity.Y < maxVelocity.Y) + projectileVelocity.Y = maxVelocity.Y; - float projVelocityMult = 0.4f; - if (Projectile.velocity.X < playerDistance.X) + if (Projectile.velocity.X < projectileVelocity.X) { - Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; - if (Projectile.velocity.X < 0f && playerDistance.X > 0f) - Projectile.velocity.X = Projectile.velocity.X + projVelocityMult; + Projectile.velocity.X += maxAcceleration; + if (Projectile.velocity.X < 0f && projectileVelocity.X > 0f) + Projectile.velocity.X += maxAcceleration; } - else if (Projectile.velocity.X > playerDistance.X) + else if (Projectile.velocity.X > projectileVelocity.X) { - Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; - if (Projectile.velocity.X > 0f && playerDistance.X < 0f) - Projectile.velocity.X = Projectile.velocity.X - projVelocityMult; + Projectile.velocity.X -= maxAcceleration; + if (Projectile.velocity.X > 0f && projectileVelocity.X < 0f) + Projectile.velocity.X -= maxAcceleration; } - if (Projectile.velocity.Y < playerDistance.Y) + if (Projectile.velocity.Y < projectileVelocity.Y) { - Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; - if (Projectile.velocity.Y < 0f && playerDistance.Y > 0f) - Projectile.velocity.Y = Projectile.velocity.Y + projVelocityMult; + Projectile.velocity.Y += maxAcceleration; + if (Projectile.velocity.Y < 0f && projectileVelocity.Y > 0f) + Projectile.velocity.Y += maxAcceleration; } - else if (Projectile.velocity.Y > playerDistance.Y) + else if (Projectile.velocity.Y > projectileVelocity.Y) { - Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; - if (Projectile.velocity.Y > 0f && playerDistance.Y < 0f) - Projectile.velocity.Y = Projectile.velocity.Y - projVelocityMult; + Projectile.velocity.Y -= maxAcceleration; + if (Projectile.velocity.Y > 0f && projectileVelocity.Y < 0f) + Projectile.velocity.Y -= maxAcceleration; } } } @@ -171,10 +201,7 @@ namespace CalamityMod.Projectiles.Boss target.AddBuff(BuffID.OnFire, 180); } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255, 50, 50, Projectile.alpha); - } + public override Color? GetAlpha(Color lightColor) => new Color(255, 50, 50, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { @@ -186,22 +213,23 @@ namespace CalamityMod.Projectiles.Boss { SoundEngine.PlaySound(SoundID.Zombie103, Projectile.Center); Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 64; + Projectile.width = Projectile.height = 96; Projectile.position.X = Projectile.position.X - (Projectile.width / 2); Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); - for (int i = 0; i < 2; i++) + + for (int i = 0; i < 3; i++) + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); + + for (int j = 0; j < 30; j++) { - Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1.5f); - } - for (int j = 0; j < 20; j++) - { - int killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 2.5f); + int killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 2.5f); Main.dust[killDust].noGravity = true; Main.dust[killDust].velocity *= 3f; - killDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); + killDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 100, default, 1.5f); Main.dust[killDust].velocity *= 2f; Main.dust[killDust].noGravity = true; } + Projectile.Damage(); } }