From cef2a8e2836bb5ea204c64787c64acaa00c09329 Mon Sep 17 00:00:00 2001 From: Storm2103 Date: Sun, 26 May 2024 00:24:02 -0600 Subject: [PATCH] NEEDS MORE TESTING: fixed that annoying mp cooldown error spam by moving ascendant insignia (error only triggered once (instead of several), it would be best if it doesnt happen at all) --- CalPlayer/CalamityPlayer.cs | 9 ++++++++ CalPlayer/CalamityPlayerMiscEffects.cs | 31 +++++++++++--------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c61fbf50db..553903583f 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2699,6 +2699,15 @@ namespace CalamityMod.CalPlayer if (Player.dead) return; + if (ascendantInsignia && Main.myPlayer == Player.whoAmI && CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) + { + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); + ascendantInsigniaCooldown = 2400; + ascendantInsigniaBuffTime = 240; //4 seconds + } + //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != Player.oldVelocity.Y) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 03434292cc..ba586732b5 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -1337,6 +1337,8 @@ namespace CalamityMod.CalPlayer if (expiredCooldowns.Count > 0) SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns); + if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) + ascendantInsigniaCooldown--; if (DragonsBreathAudioCooldown > 0) DragonsBreathAudioCooldown--; if (DragonsBreathAudioCooldown2 > 0) @@ -2012,6 +2014,13 @@ namespace CalamityMod.CalPlayer } // This section of code ensures set bonuses and accessories with cooldowns go on cooldown immediately if the armor or accessory is removed. + if (!ascendantInsignia && ascendantInsigniaBuffTime > 0) + { + ascendantInsigniaBuffTime = 0; + ascendantInsigniaCooldown = 2400; + Player.AddCooldown(AscendEffect.ID, 2400); + } + if (!brimflameSet && brimflameFrenzy) { brimflameFrenzy = false; @@ -3077,27 +3086,13 @@ namespace CalamityMod.CalPlayer } } - if (ascendantInsignia) + if (ascendantInsignia && ascendantInsigniaBuffTime > 0) { - if (CalamityKeybinds.AscendantInsigniaHotKey.JustPressed && ascendantInsigniaCooldown <= 0) - { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - Projectile.NewProjectileDirect(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); - ascendantInsigniaCooldown = 2400; - ascendantInsigniaBuffTime = 240; //4 seconds - } - - if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) - ascendantInsigniaCooldown--; + ascendantTrail = true; + infiniteFlight = true; if (ascendantInsigniaBuffTime == 1) Player.AddCooldown(AscendEffect.ID, 2400); - if (ascendantInsigniaBuffTime > 0) - { - ascendantTrail = true; - infiniteFlight = true; - ascendantInsigniaBuffTime--; - } + ascendantInsigniaBuffTime--; } if (abyssalDivingSuit && !Player.IsUnderwater())