diff --git a/CalamityMod.cs b/CalamityMod.cs index 8ba8d06659..f3d7ea4557 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -549,7 +549,8 @@ namespace CalamityMod { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 7200 }, { ModContent.NPCType(), 14400 }, - { ModContent.NPCType(), 1200 }, + { ModContent.NPCType(), 10800 }, + { ModContent.NPCType(), 1200 }, { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 5400 }, { ModContent.NPCType(), 5400 }, diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index 1093885b2f..da01d660ce 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -4020,9 +4020,11 @@ namespace CalamityMod.NPCs bool death = CalamityWorld.death || BossRushEvent.BossRushActive || malice; // Phases - bool phase2 = lifeRatio <= 0.7f; - bool phase3 = lifeRatio <= 0.4f; - bool phase4 = lifeRatio <= 0.1f; + bool phase2 = lifeRatio <= 0.7; + bool phase3 = lifeRatio <= 0.4; + bool phase4 = lifeRatio <= 0.1; + bool theBigSucc = npc.life / (double)npc.lifeMax <= 0.1; + bool succSoHardThatYouDie = npc.life / (double)npc.lifeMax <= 0.005; // Spawn Dark Energies int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; @@ -4051,7 +4053,8 @@ namespace CalamityMod.NPCs // If there are any Dark Energies alive, change AI and don't take damage bool anyDarkEnergies = NPC.AnyNPCs(ModContent.NPCType()); - npc.dontTakeDamage = anyDarkEnergies; + bool movingDuringSuccPhase = npc.ai[3] == 0f; + npc.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -4141,15 +4144,27 @@ namespace CalamityMod.NPCs float suckDistance = (malice ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f) * tileEnrageMult; // Move closer to the target before trying to succ - if (npc.ai[3] == 0f) + if (movingDuringSuccPhase) { - if (Vector2.Distance(vector, player.Center) > 320f) + if (Vector2.Distance(vector, player.Center) > 320f || !Collision.CanHit(vector, 1, 1, player.Center, 1, 1)) Movement(true); else npc.ai[3] = 1f; } else { + // Use this to generate more and more dust in final phase + float finalPhaseDustRatio = 1f; + if (succSoHardThatYouDie) + { + finalPhaseDustRatio = 5f; + } + else if (theBigSucc) + { + float amount = (10f - (float)(npc.life / (double)npc.lifeMax) * 100f) / 10f; + finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); + } + // Slow down if (npc.velocity.Length() > 0.5f) npc.velocity *= 0.8f; @@ -4173,8 +4188,8 @@ namespace CalamityMod.NPCs Vector2 dustOffset = new Vector2(dustDistance, 0f); dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - int var = (int)dustDistance; - float dustVelocity = 36f / distanceDivisor; + int var = (int)(dustDistance / finalPhaseDustRatio); + float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; for (int i = 0; i < numDust; i++) { if (Main.rand.NextBool(var)) @@ -4190,9 +4205,9 @@ namespace CalamityMod.NPCs } } + float succPower = 0.1f + finalPhaseDustRatio * 0.1f; for (int i = 0; i < Main.maxPlayers; i++) { - float succPower = 0.2f * tileEnrageMult; float distance = Vector2.Distance(Main.player[i].Center, vector); if (distance < suckDistance && Main.player[i].grappling[0] == -1) { @@ -4213,98 +4228,128 @@ namespace CalamityMod.NPCs } } } - } - // Projectiles - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Beam Portals - if (calamityGlobalNPC.newAI[1] == 0f) + // Projectiles + if (Main.netMode != NetmodeID.MultiplayerClient) { - calamityGlobalNPC.newAI[1] = 1f; - int numBeamPortals = malice ? 3 : revenge ? 2 : 1; - float degrees = 360 / numBeamPortals; - float beamPortalDistance = malice ? 800f : death ? 960f : revenge ? 1000f : expertMode ? 1040f : 1080f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < numBeamPortals; i++) + // Slowly die in final phase and then implode + // This phase lasts 20 seconds + if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) { - float ai1 = i * degrees; - int proj = Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, player.whoAmI, ai1, 0f); - Main.projectile[proj].timeLeft = baseProjectileTimeLeft / 2; + int damageAmt = npc.lifeMax / 200; + npc.life -= damageAmt; + npc.HealEffect(-damageAmt, true); + + if (npc.life <= 0) + npc.StrikeNPCNoInteraction(9999, 0f, 0); + + npc.netUpdate = true; } - } - // Suck in Dark Energy projectiles from far away - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= 12f * projectileFireRateMultiplier) - { - calamityGlobalNPC.newAI[3] = 0f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 0.5f; - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - for (int i = 0; i < totalProjectiles; i++) + // Beam Portals + if (calamityGlobalNPC.newAI[1] == 0f) { - Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.localAI[1]))) * suckDistance; - Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; - Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - npc.localAI[1] += 10f; - } - - if (phase2 && expertMode) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) - { - npc.localAI[2] = 0f; - int type = ModContent.ProjectileType(); + int numBeamPortals = malice ? 3 : revenge ? 2 : 1; + float degrees = 360 / numBeamPortals; + float beamPortalDistance = malice ? 800f : death ? 960f : revenge ? 1000f : expertMode ? 1040f : 1080f; + int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f != 0f; - float speed = 2f; - int totalProjectiles = 2; + for (int i = 0; i < numBeamPortals; i++) + { + float ai1 = i * degrees; + int proj = Projectile.NewProjectile(player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, player.whoAmI, ai1, 0f); + Main.projectile[proj].timeLeft = baseProjectileTimeLeft / 2; + } + } + + // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active + float beamPortalTimeLeft = 600f; + bool summonLessDarkEnergies = false; + if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) + { + calamityGlobalNPC.newAI[1] += 1f; + summonLessDarkEnergies = true; + } + else if (theBigSucc) + calamityGlobalNPC.newAI[1] += 1f; + + // Suck in Dark Energy projectiles from far away + calamityGlobalNPC.newAI[3] += 1f; + float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 36f : 12f) * projectileFireRateMultiplier; + if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) + { + calamityGlobalNPC.newAI[3] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f == 0f; + float speed = 0.5f; + int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1]); for (int i = 0; i < totalProjectiles; i++) { - Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.localAI[1]))) * suckDistance; + Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); } + npc.localAI[1] += 10f; } - } - if (phase4 && revenge) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) + // Summon some extra projectiles in Expert Mode + if (phase2 && expertMode && !summonLessDarkEnergies) { - npc.localAI[3] = 0f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 4f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - for (int i = 0; i < totalProjectiles; i++) + npc.localAI[2] += 1f; + if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) { - Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(npc.localAI[1]))) * suckDistance; - Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; - Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + npc.localAI[2] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f != 0f; + float speed = 2f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } + } + } + + // Summon some extra projectiles in Revengeance Mode + if (phase4 && revenge && !summonLessDarkEnergies) + { + npc.localAI[3] += 1f; + if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) + { + npc.localAI[3] = 0f; + int type = ModContent.ProjectileType(); + int damage = npc.GetProjectileDamage(type); + bool normalSpread = npc.localAI[0] % 2f == 0f; + float speed = 4f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); + float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = vector + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(vector - spawnVector) * speed; + Projectile.NewProjectile(spawnVector, velocity, type, damage, 0f, Main.myPlayer); + } } } } @@ -4542,8 +4587,8 @@ namespace CalamityMod.NPCs if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) { - if (projectile.timeLeft > 85) - projectile.timeLeft = 85; + if (projectile.timeLeft > 30) + projectile.timeLeft = 30; } } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 8d07065cd1..c8c419f690 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -37,10 +37,12 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.defense = 80; CalamityGlobalNPC global = npc.Calamity(); global.DR = 0.5f; - npc.lifeMax = 25000; + + bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; + npc.LifeMaxNERB(notDoGFight ? 67200 : 16800, notDoGFight ? 77280 : 19320, 720000); // If fought alone, Ceaseless Void plays its own theme - if (CalamityWorld.DoGSecondStageCountdown <= 0) + if (notDoGFight) { npc.value = Item.buyPrice(0, 35, 0, 0); music = CalamityMod.Instance.GetMusicFromMusicMod("Void") ?? MusicID.Boss3; @@ -49,7 +51,9 @@ namespace CalamityMod.NPCs.CeaselessVoid else music = CalamityMod.Instance.GetMusicFromMusicMod("ScourgeofTheUniverse") ?? MusicID.Boss3; - npc.aiStyle = -1; + double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01; + npc.lifeMax += (int)(npc.lifeMax * HPBoost); + npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; npc.noGravity = true; @@ -89,6 +93,11 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.frame.Y = frame * frameHeight; } + public override void AI() + { + CalamityAI.CeaselessVoidAI(npc, mod); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -143,12 +152,7 @@ namespace CalamityMod.NPCs.CeaselessVoid return false; } - public override void AI() - { - CalamityAI.CeaselessVoidAI(npc, mod); - } - - public override void NPCLoot() + public override void NPCLoot() { // Only drop items if fought at full strength bool fullStrength = !CalamityWorld.downedSentinel1 || CalamityWorld.DoGSecondStageCountdown <= 0; @@ -208,12 +212,17 @@ namespace CalamityMod.NPCs.CeaselessVoid } } - public override void BossLoot(ref string name, ref int potionType) + public override void ScaleExpertStats(int numPlayers, float bossLifeScale) + { + npc.lifeMax = (int)(npc.lifeMax * 0.8f * bossLifeScale); + } + + public override void BossLoot(ref string name, ref int potionType) { potionType = ModContent.ItemType(); } - public override void HitEffect(int hitDirection, double damage) + public override void HitEffect(int hitDirection, double damage) { if (npc.soundDelay == 0) { diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 30d743aaff..008cfe156a 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -42,7 +42,6 @@ namespace CalamityMod.NPCs.Signus npc.width = 130; npc.height = 130; npc.defense = 60; - bool notDoGFight = CalamityWorld.DoGSecondStageCountdown <= 0 || !CalamityWorld.downedSentinel3; npc.LifeMaxNERB(notDoGFight ? 224000 : 56000, notDoGFight ? 356400 : 87600, 2400000); diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 054efa6046..0bfdd14d05 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -194,7 +194,6 @@ namespace CalamityMod.NPCs.StormWeaver projectile.penetrate = 1; } } - } public override void HitEffect(int hitDirection, double damage) diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index 2923868378..a89d70e5a7 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.timeLeft = 600; projectile.penetrate = -1; + projectile.Opacity = 0f; cooldownSlot = 1; } @@ -38,7 +39,10 @@ namespace CalamityMod.Projectiles.Boss if (projectile.velocity.Length() < 10f) projectile.velocity *= 1.05f; - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 570) / 30f), 0f, 1f); + if (projectile.timeLeft < 30) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 570) / 30f), 0f, 1f); projectile.frameCounter++; if (projectile.frameCounter > 4) @@ -89,7 +93,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.VortexDebuff, 60); + if (projectile.Opacity == 1f) + target.AddBuff(BuffID.VortexDebuff, 60); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index c6026647da..8e4b5c5b2c 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -29,7 +29,8 @@ namespace CalamityMod.Projectiles.Boss projectile.tileCollide = false; projectile.timeLeft = 600; projectile.penetrate = -1; - cooldownSlot = 1; + projectile.Opacity = 0f; + cooldownSlot = 1; } public override void AI() @@ -40,7 +41,10 @@ namespace CalamityMod.Projectiles.Boss if (projectile.velocity.Length() < 10f) projectile.velocity *= 1.05f; - projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 570) / 30f), 0f, 1f); + if (projectile.timeLeft < 30) + projectile.Opacity = MathHelper.Clamp(projectile.timeLeft / 30f, 0f, 1f); + else + projectile.Opacity = MathHelper.Clamp(1f - ((projectile.timeLeft - 570) / 30f), 0f, 1f); projectile.frameCounter++; if (projectile.frameCounter > 4) @@ -91,7 +95,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.VortexDebuff, 60); + if (projectile.Opacity == 1f) + target.AddBuff(BuffID.VortexDebuff, 60); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 64428fb52f..4ad7dd6f33 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -56,13 +56,13 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft == 950) projectile.damage = (int)projectile.ai[0]; - if (projectile.timeLeft < 85) + if (projectile.timeLeft < 30) projectile.damage = 0; } public override bool CanHitPlayer(Player target) { - if (projectile.timeLeft > 950 || projectile.timeLeft < 85) + if (projectile.timeLeft > 950 || projectile.timeLeft < 30) { return false; } @@ -75,9 +75,9 @@ namespace CalamityMod.Projectiles.Boss { return new Color(0, 0, 0, 0); } - if (projectile.timeLeft < 85) + if (projectile.timeLeft < 30) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(projectile.timeLeft * 8.5); byte a2 = (byte)(100f * ((float)b2 / 255f)); return new Color((int)b2, (int)b2, (int)b2, (int)a2); } diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index f8d0f951d3..be313a49b1 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss projectile.ai[1] += 1f; // Don't fire projectiles if Ceaseless Void is entering a new phase - if (projectile.timeLeft > 85) + if (projectile.timeLeft > 30) { projectile.localAI[0] += 1f; if (projectile.localAI[0] >= 240f) @@ -128,9 +128,9 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - if (projectile.timeLeft < 85) + if (projectile.timeLeft < 30) { - byte b2 = (byte)(projectile.timeLeft * 3); + byte b2 = (byte)(projectile.timeLeft * 8.5); byte a2 = (byte)(100f * (b2 / 255f)); return new Color(b2, b2, b2, a2); }