From 582ca1487ac3cbfdbfc68f6c947b97ff5f20b74b Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sun, 10 Mar 2024 00:45:23 -0600 Subject: [PATCH] Abyssal Mirror and Eclipse Mirror now use the new dodge and cooldown system of the Black Belt, BoC and Amalgam. --- Balancing/BalancingConstants.cs | 3 +- CalPlayer/CalamityPlayerHitHurt.cs | 34 +++++++++++++++---- .../Mods.CalamityMod.Items.Accessories.hjson | 8 +++-- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 2f6e09e2d2..4c1bbea0a5 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -39,7 +39,8 @@ internal static readonly int BrainDodgeCooldownMax = 5400; internal static readonly int AmalgamDodgeCooldownMin = 900; internal static readonly int AmalgamDodgeCooldownMax = 5400; - internal static readonly int MirrorDodgeCooldown = 5400; + internal static readonly int MirrorDodgeCooldownMin = 900; + internal static readonly int MirrorDodgeCooldownMax = 5400; internal static readonly int DaedalusReflectCooldown = 5400; internal static readonly int EvolutionReflectCooldown = 5400; #endregion diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 352dd56117..c4cbdb65ff 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -135,11 +135,21 @@ namespace CalamityMod.CalPlayer NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } - public void AbyssMirrorDodge() + public void AbyssMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((hitDamage - dodgeDamageGateValue) / maxCooldownDurationDamageValue, 0f, 1f); + if (Player.whoAmI == Main.myPlayer && abyssalMirror && !eclipseMirror) { - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.MirrorDodgeCooldown, true, "abyssmirror"); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "abyssmirror"); // TODO -- why is this here? Player.noKnockback = true; @@ -169,11 +179,21 @@ namespace CalamityMod.CalPlayer } } - public void EclipseMirrorDodge() + public void EclipseMirrorDodge(double dodgeDamageGateValuePercent, int dodgeDamageGateValue, int hitDamage) { + double maxCooldownDurationDamagePercent = 0.5; + int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); + + // Just in case... + if (maxCooldownDurationDamageValue <= 0) + maxCooldownDurationDamageValue = 1; + + float cooldownDurationScalar = MathHelper.Clamp((hitDamage - dodgeDamageGateValue) / maxCooldownDurationDamageValue, 0f, 1f); + if (Player.whoAmI == Main.myPlayer && eclipseMirror) { - Player.AddCooldown(GlobalDodge.ID, BalancingConstants.MirrorDodgeCooldown, true, "eclipsemirror"); + int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.MirrorDodgeCooldownMin, BalancingConstants.MirrorDodgeCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration, true, "eclipsemirror"); // TODO -- why is this here? Player.noKnockback = true; @@ -1530,16 +1550,16 @@ namespace CalamityMod.CalPlayer return true; // Mirror evades do not work if the global dodge cooldown is active. This cooldown can be triggered by either mirror. - if (!Player.HasCooldown(GlobalDodge.ID)) + if (!Player.HasCooldown(GlobalDodge.ID) && info.Damage >= dodgeDamageGateValue) { if (eclipseMirror) { - EclipseMirrorDodge(); + EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); return true; } else if (abyssalMirror) { - AbyssMirrorDodge(); + AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); return true; } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 05004e2246..caa3892630 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -60,7 +60,9 @@ AbyssalMirror: { Significantly reduces enemy aggression, even in the abyss Stealth generates 25% faster when standing still and 12% faster while moving Grants the ability to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies - Evading an attack grants a lot of stealth but has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be evaded + The evade has a cooldown that ranges between 15 and 90 seconds depending on the evaded attack's damage + Evading an attack grants a lot of stealth This cooldown is shared with all other dodges and reflects 'Light does not reach the depths of the ocean' ''' @@ -606,7 +608,9 @@ EclipseMirror: { Mobile stealth generation accelerates while not attacking Stealth strikes only expend 50% of your max stealth Grants the ability to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area - Evading an attack grants full stealth but has a 90 second cooldown + Attacks that deal less than 5% of your max life in damage will not be evaded + The evade has a cooldown that ranges between 15 and 90 seconds depending on the evaded attack's damage + Evading an attack grants full stealth This cooldown is shared with all other dodges and reflects 'Its reflection shows naught but darkness' '''