From bf99fd491d6d523e3f48e09f7ffd662e2103f249 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 1 May 2022 21:30:56 -0500 Subject: [PATCH] 1 - Edited Rev+ Destroyer lasers. Now has a 50% chance to not fire a laser if the segment has launched its Probe. --- NPCs/CalamityGlobalNPC.cs | 7 +++-- .../VanillaNPCOverrides/Bosses/DestroyerAI.cs | 26 +++++++++---------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 931c02d0e8..2363f8ee68 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5354,8 +5354,11 @@ namespace CalamityMod.NPCs { if ((newAI[3] >= 900f && npc.life / (float)npc.lifeMax < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f)) { - spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + for (int i = 0; i < 3; i++) + { + spriteBatch.Draw(TextureAssets.Dest[npc.type - NPCID.TheDestroyer].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, + new Color(50, 50, 255, 0) * (1f - npc.alpha / 255f), npc.rotation, halfSize, npc.scale, spriteEffects, 0f); + } } else { diff --git a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs index 0d55536110..31c11c9df4 100644 --- a/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCOverrides/Bosses/DestroyerAI.cs @@ -215,28 +215,28 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses // Fire lasers if (npc.type == NPCID.TheDestroyerBody) { - // Set to a high number from the start so that the lasers are more staggered - if (calamityGlobalNPC.newAI[0] < 5400f) - calamityGlobalNPC.newAI[0] = 5400f; - // Laser rate of fire calamityGlobalNPC.newAI[0] += 1f; - float shootProjectile = death ? 300 : 600; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; + float shootProjectile = death ? 180 : 300; + float timer = npc.ai[0] * 30f; + float shootProjectileGateValue = timer + shootProjectile; - if (calamityGlobalNPC.newAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) + // Shoot lasers + // 50% chance to not shoot if probe has been launched + bool probeLaunched = npc.ai[2] == 1f; + if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue) { + calamityGlobalNPC.newAI[0] = 0f; npc.TargetClosest(); - 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) && (!probeLaunched || Main.rand.NextBool())) { // Laser speed - float projectileSpeed = 4f + Main.rand.NextFloat(); + float projectileSpeed = 3.5f + Main.rand.NextFloat() * 1.5f; projectileSpeed += enrageScale; - // Set projectile damage and type, set projectile to saucer scrap if probe has been launched + // Set projectile damage and type int projectileType = ProjectileID.DeathLaser; - float laserSpawnDistance = 5f; + float laserSpawnDistance = 10f; int random = phase3 ? 4 : phase2 ? 3 : 2; switch (Main.rand.Next(random)) { @@ -254,7 +254,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses if (calamityGlobalNPC.newAI[2] > 0f || malice) { projectileType = ModContent.ProjectileType(); - laserSpawnDistance = 10f; + laserSpawnDistance = 20f; } // Get target vector