From 072f2259fefb4260c00aee253fbd678cfe42d5f1 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Mon, 18 Mar 2024 13:08:17 -0500 Subject: [PATCH] 1 - Rev+ Plantera charge afterimages. 2 - Fixed an issue with Rev+ Plantera's phase 2 seed spreads not being fast enough. --- Items/Armor/Reaver/ReaverHeadTank.cs | 2 +- NPCs/CalamityGlobalNPC.cs | 25 +++++++++++++++++++ NPCs/OldDuke/OldDuke.cs | 23 ++++------------- .../Bosses/PlanteraAI.cs | 2 +- Projectiles/CalamityGlobalProjectile.cs | 2 +- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 2970ae04c9..a05e04bbd7 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Armor.Reaver modPlayer.reaverDefense = true; modPlayer.wearingRogueArmor = true; player.setBonus = this.GetLocalizedValue("SetBonus"); - //Reaver Rage provides 30% damage to offset the helm "bonus", 5 def, and 5% melee speed. + // Reaver Rage provides 30% damage to offset the helm "bonus", 5 def, and 5% melee speed. } public override void UpdateEquip(Player player) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 6b7761858e..c319da22b0 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1119,6 +1119,13 @@ namespace CalamityMod.NPCs #endregion #region Set Defaults + public override void SetStaticDefaults() + { + // Set Plantera to be able to update oldPos[x] + // This is only used for her Rev+ AI charge attacks + NPCID.Sets.TrailingMode[NPCID.Plantera] = 1; + } + public override void SetDefaults(NPC npc) { ShouldFallThroughPlatforms = false; @@ -7184,6 +7191,24 @@ namespace CalamityMod.NPCs { float telegraphScalar = MathHelper.Clamp((Math.Abs(PlanteraAI.StopChargeGateValue) - telegraphTimer) / Math.Abs(PlanteraAI.StopChargeGateValue), 0f, 1f); Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); + + if (CalamityConfig.Instance.Afterimages) + { + int afterimageAmount = 10; + int afterImageIncrement = 2; + for (int j = 0; j < afterimageAmount; j += afterImageIncrement) + { + Color afterimageColor = telegraphColor; + afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f); + afterimageColor = npc.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmount - j) / 15f; + Vector2 afterimagePos = npc.oldPos[j] + new Vector2(npc.width, npc.height) / 2f - screenPos; + afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f; + afterimagePos += origin * npc.scale + new Vector2(0f, npc.gfxOffY) + glowOffset; + spriteBatch.Draw(npcTexture, afterimagePos, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); + } + } + spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f); } } diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index d74476d180..d1cf93c6a6 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -127,9 +127,7 @@ namespace CalamityMod.NPCs.OldDuke public override void ModifyTypeName(ref string typeName) { if (Main.zenithWorld) - { typeName = CalamityUtils.GetTextValue("NPCs.BoomerDuke"); - } } public override void FindFrame(int frameHeight) @@ -139,9 +137,8 @@ namespace CalamityMod.NPCs.OldDuke { int frameChangeFrequency = tired ? 14 : 7; if (NPC.ai[0] == 5f || NPC.ai[0] == 12f) - { frameChangeFrequency = tired ? 12 : 6; - } + NPC.frameCounter += 1D; if (NPC.frameCounter > frameChangeFrequency) { @@ -149,18 +146,15 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] == 11f) - { NPC.frame.Y = frameHeight * 2; - } + if (NPC.ai[0] == 2f || NPC.ai[0] == 7f || NPC.ai[0] == 14f) - { NPC.frame.Y = frameHeight * 6; - } + if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f || NPC.ai[0] == -1f) { int frameChangeGateValue = 120; @@ -173,19 +167,16 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } else { NPC.frame.Y = frameHeight * 5; if (NPC.ai[2] > (frameChangeGateValue - 40) && NPC.ai[2] < (frameChangeGateValue - 15)) - { NPC.frame.Y = frameHeight * 6; - } } } + if (NPC.ai[0] == 4f || NPC.ai[0] == 9f) { int secondFrameChangeGateValue = 180; @@ -198,17 +189,13 @@ namespace CalamityMod.NPCs.OldDuke NPC.frame.Y += frameHeight; } if (NPC.frame.Y >= frameHeight * 6) - { NPC.frame.Y = 0; - } } else { NPC.frame.Y = frameHeight * 5; if (NPC.ai[2] > (secondFrameChangeGateValue - 50) && NPC.ai[2] < (secondFrameChangeGateValue - 25)) - { NPC.frame.Y = frameHeight * 6; - } } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index 477294c731..a2879abe0b 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -773,7 +773,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed * 0.25f, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileSpeed); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, perturbedSpeed * projectileSpeed * 0.5f, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileSpeed); } if (death) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 3f63b67785..f72a2413e9 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2265,7 +2265,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[2] > 0f) { if (projectile.velocity.Length() < projectile.ai[2]) - projectile.velocity *= 1.025f; + projectile.velocity *= 1.012f; } projectile.frameCounter++;