diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 7bb5a85897..b52b4fad5f 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -66,16 +66,8 @@ namespace CalamityMod.CalPlayer // No category // Give the player a 24% jump speed boost while wings are equipped - // Give the player a 10% jump speed boost while not using wings and not using a balloon if (player.wingsLogic > 0) player.jumpSpeedBoost += 1.2f; - else if (!player.jumpBoost) - player.jumpSpeedBoost += 0.5f; - - // Reduce balloon jump speed boosts by 15% because they'd be too powerful when stacked with wings - // Normally gives 30%, now gives 15% - if (player.jumpBoost) - player.jumpSpeedBoost -= 0.75f; // Decrease the counter on Fearmonger set turbo regeneration if (modPlayer.fearmongerRegenFrames > 0) @@ -4170,8 +4162,8 @@ namespace CalamityMod.CalPlayer modPlayer.moveSpeedStat = (int)((player.moveSpeed - 1f) * 100f); modPlayer.wingFlightTimeStat = player.wingTimeMax / 60f; float trueJumpSpeedBoost = player.jumpSpeedBoost + - (player.wereWolf ? 0.2f : 0f) + - (player.jumpBoost ? 1.5f : 0f); + (player.wereWolf ? 0.2f : 0f) + + (player.jumpBoost ? 0.75f : 0f); modPlayer.jumpSpeedStat = trueJumpSpeedBoost * 20f; modPlayer.rageDamageStat = (int)(100D * modPlayer.RageDamageBoost); modPlayer.adrenalineDamageStat = (int)(100D * modPlayer.GetAdrenalineDamage()); diff --git a/ILEditing/ILChanges.cs b/ILEditing/ILChanges.cs index 66829c5e97..1915a43a90 100644 --- a/ILEditing/ILChanges.cs +++ b/ILEditing/ILChanges.cs @@ -152,8 +152,10 @@ namespace CalamityMod.ILEditing IL.Terraria.Projectile.Damage += RemoveAerialBaneDamageBoost; IL.Terraria.Projectile.AI_001 += AdjustChlorophyteBullets; - // Movement speed balance - IL.Terraria.Player.Update += MaxRunSpeedAdjustment; + // Movement speed balance + IL.Terraria.Player.UpdateJumpHeight += BalloonAdjustment; + IL.Terraria.Player.Update += JumpSpeedAdjustment; + IL.Terraria.Player.Update += MaxRunSpeedAdjustment; IL.Terraria.Player.Update += RunSpeedAdjustments; IL.Terraria.Player.Update += ReduceWingHoverVelocities; @@ -222,8 +224,10 @@ namespace CalamityMod.ILEditing IL.Terraria.Projectile.Damage -= RemoveAerialBaneDamageBoost; IL.Terraria.Projectile.AI_001 -= AdjustChlorophyteBullets; - // Movement speed balance - IL.Terraria.Player.Update -= MaxRunSpeedAdjustment; + // Movement speed balance + IL.Terraria.Player.UpdateJumpHeight -= BalloonAdjustment; + IL.Terraria.Player.Update -= JumpSpeedAdjustment; + IL.Terraria.Player.Update -= MaxRunSpeedAdjustment; IL.Terraria.Player.Update -= RunSpeedAdjustments; IL.Terraria.Player.Update -= ReduceWingHoverVelocities; @@ -943,10 +947,45 @@ namespace CalamityMod.ILEditing cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, 150f); // Reduce homing range by 50%. } - #endregion + #endregion - #region Movement speed balance - private static void MaxRunSpeedAdjustment(ILContext il) + #region Movement speed balance + private static void BalloonAdjustment(ILContext il) + { + // Remove the jump height boosts of balloons to make balancing them easier. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(20))) // The jump height variable is set to this specific value by the balloons. + { + LogFailure("Balloon Jump Height Removal", "Could not locate the balloon jump height buff variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_I4, 15); // Reduce to base jump height. + + // Decrease the jump speed given by balloons. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(6.51f))) // The jumpSpeed variable is set to this specific value by the balloons. + { + LogFailure("Balloon Jump Speed Nerf", "Could not locate the balloon jump speed buff variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 6.26f); // Reduce by 5%. + } + + private static void JumpSpeedAdjustment(ILContext il) + { + // Increase the base jump speed of the player to make early game less of a slog. + var cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(5.01f))) // The jumpSpeed variable is set to this specific value before anything else occurs. + { + LogFailure("Base Jump Speed Buff", "Could not locate the jump speed variable."); + return; + } + cursor.Remove(); + cursor.Emit(OpCodes.Ldc_R4, 5.51f); // Increase by 10%. + } + + private static void MaxRunSpeedAdjustment(ILContext il) { // Increase the base max run speed of the player to make early game less of a slog. var cursor = new ILCursor(il);