From 18bea6707dc1da2c37d9a4cd75324c563f4a5ecc Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 29 Jan 2023 04:08:46 -0600 Subject: [PATCH] 1 - Yharon moves slower for 2 seconds after using a fireball bullet hell attack in order to make the charge that occurs afterwards more fair. 2 - Most Providence and Guardian projectiles emit light. --- NPCs/Yharon/Yharon.cs | 27 ++++++++++---- Projectiles/Boss/HolyBlast.cs | 4 ++- Projectiles/Boss/HolyBomb.cs | 10 +++--- Projectiles/Boss/HolyBurnOrb.cs | 4 ++- Projectiles/Boss/HolyFire.cs | 4 ++- Projectiles/Boss/HolyFire2.cs | 4 ++- Projectiles/Boss/HolyFlare.cs | 4 ++- Projectiles/Boss/HolyLight.cs | 2 ++ Projectiles/Boss/HolySpear.cs | 4 ++- Projectiles/Boss/MoltenBlast.cs | 4 ++- Projectiles/Boss/MoltenBlob.cs | 4 ++- Projectiles/Boss/ProfanedSpear.cs | 2 ++ Projectiles/Boss/ProvidenceCrystalShard.cs | 41 +++++++++++----------- 13 files changed, 75 insertions(+), 39 deletions(-) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 0fee275ea3..6d7a64bc6d 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -291,7 +291,14 @@ namespace CalamityMod.NPCs.Yharon float spinPhaseVelocity = 25f; float spinPhaseRotation = MathHelper.TwoPi * 3 / spinTime; - float increasedIdleTimeAfterBulletHell = -120f; + float increasedIdleTimeAfterBulletHell = 120f; + bool moveSlowerAfterBulletHell = NPC.ai[2] < 0f; + if (moveSlowerAfterBulletHell) + { + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, 1f, (NPC.ai[2] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + acceleration *= reducedMovementMultiplier; + velocity *= reducedMovementMultiplier; + } float teleportPhaseTimer = 30f; @@ -1021,7 +1028,7 @@ namespace CalamityMod.NPCs.Yharon { NPC.ai[0] = 6f; NPC.ai[1] = 0f; - NPC.ai[2] = increasedIdleTimeAfterBulletHell; + NPC.ai[2] = -increasedIdleTimeAfterBulletHell; NPC.TargetClosest(); NPC.netUpdate = true; } @@ -1376,7 +1383,7 @@ namespace CalamityMod.NPCs.Yharon { NPC.ai[0] = 13f; NPC.ai[1] = 0f; - NPC.ai[2] = increasedIdleTimeAfterBulletHell; + NPC.ai[2] = -increasedIdleTimeAfterBulletHell; NPC.localAI[2] = 0f; NPC.TargetClosest(); NPC.netUpdate = true; @@ -1696,7 +1703,15 @@ namespace CalamityMod.NPCs.Yharon int spinPhaseTimer = secondPhasePhase == 4 ? (bossRush ? 80 : death ? 100 : 120) : (bossRush ? 120 : death ? 150 : 180); int flareDustSpawnDivisor = spinPhaseTimer / 10; int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); - float increasedIdleTimeAfterBulletHell = -120f; + + float increasedIdleTimeAfterBulletHell = 120f; + bool moveSlowerAfterBulletHell = NPC.ai[1] < 0f; + if (moveSlowerAfterBulletHell) + { + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, 1f, (NPC.ai[1] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + acceleration *= reducedMovementMultiplier; + velocity *= reducedMovementMultiplier; + } float flareSpawnDecelerationTimer = bossRush ? 60f : death ? 75f : 90f; int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (ai2GateValue - lifeRatio)) : 0; @@ -2269,7 +2284,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] >= spinPhaseTimer) { NPC.ai[0] = 1f; - NPC.ai[1] = increasedIdleTimeAfterBulletHell; + NPC.ai[1] = -increasedIdleTimeAfterBulletHell; NPC.ai[2] = 0f; NPC.localAI[2] = 0f; NPC.TargetClosest(); @@ -2917,7 +2932,7 @@ namespace CalamityMod.NPCs.Yharon } #endregion - #region On Hit Player + #region On Hit Player public override void OnHitPlayer(Player player, int damage, bool crit) { if (damage > 0) diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 66eb4ef7fd..439e36b7dd 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -36,7 +36,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 8116449e30..8976aee093 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -34,11 +34,13 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + /* - Uses maxPenetrate because it's kinda pointless for a boss projectile - and it's convenient to copypaste without having to do adjustments - If someone really feels like making a proper int for this purpose they can do it themselves - Iris + * Day mode by default but syncs with the boss + * Uses maxPenetrate because it's kinda pointless for a boss projectile + * and it's convenient to copypaste without having to do adjustments + * If someone really feels like making a proper int for this purpose they can do it themselves - Iris */ if (CalamityGlobalNPC.holyBoss != -1) { diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index e40700791c..c41367e6d3 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -37,7 +37,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index e88cfc75c0..139ebecc82 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -34,7 +34,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index bf02fc4fa8..bc2a450602 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -34,7 +34,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index fcf6ee915a..612d0a338f 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -34,7 +34,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index ca5f7e1b45..70c053cbde 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f); + if (Projectile.ai[0] < 240f) { Projectile.ai[0] += 1f; diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 913102e02b..7301a21588 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -53,7 +53,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 7c669fa712..0ac2656a4d 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -44,7 +44,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index ff86ae6118..d76cbd0558 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -31,7 +31,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - //Day mode by default but syncs with the boss + Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); + + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { if (Main.npc[CalamityGlobalNPC.holyBoss].active) diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index a150abe798..124e2cca5c 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); + if (Projectile.timeLeft < 510) Projectile.tileCollide = true; diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 0d471631a8..312c1aae4a 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; - Projectile.alpha = 255; + Projectile.Opacity = 0f; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; @@ -46,6 +46,8 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { + Lighting.AddLight(Projectile.Center, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity); + // Day mode by default but syncs with the boss if (CalamityGlobalNPC.holyBoss != -1) { @@ -60,22 +62,19 @@ namespace CalamityMod.Projectiles.Boss Projectile.extraUpdates = 1; if (Projectile.timeLeft < 300) - { Projectile.tileCollide = true; - } + Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); - if (Projectile.alpha > 0) - { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - if (Projectile.alpha == 0) - { + + if (Projectile.Opacity < 1f) + Projectile.Opacity += 0.03f; + + if (Projectile.Opacity > 1f) + Projectile.Opacity = 1f; + + if (Projectile.Opacity == 1f) Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); - } + Projectile.velocity.X *= 0.995f; if (Projectile.velocity.Y < 0f) { @@ -86,16 +85,17 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.Y *= 1.06f; float fallSpeed = (CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day)) ? 3.5f : 3f; if (Projectile.velocity.Y > fallSpeed) - { Projectile.velocity.Y = fallSpeed; - } } + if (Projectile.velocity.Y > -0.5f && Projectile.localAI[1] == 0f) { Projectile.localAI[1] = 1f; Projectile.velocity.Y = 0.5f; } - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - 1.57f; + + Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; + for (int num979 = 0; num979 < 2; num979++) { if (Main.rand.NextBool(10)) @@ -109,6 +109,7 @@ namespace CalamityMod.Projectiles.Boss dust24.velocity = value55; } } + for (int num980 = 0; num980 < 2; num980++) { if (Main.rand.NextBool(10)) @@ -122,6 +123,7 @@ namespace CalamityMod.Projectiles.Boss dust25.velocity = value56; } } + if (Main.rand.NextBool(10)) { float scaleFactor13 = 1f + Main.rand.NextFloat() * 2f; @@ -205,10 +207,7 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); - } + public override Color? GetAlpha(Color lightColor) => new Color(255 * Projectile.Opacity, 255 * Projectile.Opacity, 255 * Projectile.Opacity, 0); public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) {