From 58d26505058ce741f20d1143e502a052dd599b56 Mon Sep 17 00:00:00 2001 From: Thoronium <107363768+NotThorny@users.noreply.github.com> Date: Sun, 6 Aug 2023 22:25:59 -0600 Subject: [PATCH] Fix swim stamina cost (#2287) --- .../grasscutter/game/managers/stamina/StaminaManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java b/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java index b05567638..8a0a86b10 100644 --- a/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java +++ b/src/main/java/emu/grasscutter/game/managers/stamina/StaminaManager.java @@ -389,6 +389,9 @@ public class StaminaManager extends BasePlayerManager { return; } + // Update previous motion state + this.previousState = currentState; + // Update the current state. this.currentState = motionState; // logger.trace(currentState + "\t" + (notifyEntityId == currentAvatarEntityId ? "character" : "vehicle")); @@ -417,6 +420,11 @@ public class StaminaManager extends BasePlayerManager { // Internal handler private void handleImmediateStamina(GameSession session, @NotNull MotionState motionState) { + // Don't double dip on sustained stamina start costs + if (previousState == currentState) { + return; + } + switch (motionState) { case MOTION_STATE_CLIMB -> updateStaminaRelative(session, new Consumption(ConsumptionType.CLIMB_START), true);