From ab1341f0d952a89dcacd66fb4a78ad74a524cc72 Mon Sep 17 00:00:00 2001 From: ImmuState Date: Sun, 22 May 2022 05:45:36 -0700 Subject: [PATCH] Make sure offFieldPenalty does not go below 0.1 --- .../emu/grasscutter/game/managers/EnergyManager.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/emu/grasscutter/game/managers/EnergyManager.java b/src/main/java/emu/grasscutter/game/managers/EnergyManager.java index 0c8f7c939..862a01c35 100644 --- a/src/main/java/emu/grasscutter/game/managers/EnergyManager.java +++ b/src/main/java/emu/grasscutter/game/managers/EnergyManager.java @@ -150,10 +150,16 @@ public class EnergyManager { // On-field vs off-field multiplier. // The on-field character gets no penalty. // Off-field characters get a penalty depending on the team size, as follows: - // - 4 character team: 0.6 - // - 3 character team: 0.7 // - 2 character team: 0.8 - float offFieldPenalty = (this.player.getTeamManager().getCurrentCharacterIndex() == i) ? 1.0f : 1.0f - this.player.getTeamManager().getActiveTeam().size() * 0.1f; + // - 3 character team: 0.7 + // - 4 character team: 0.6 + // - etc. + // We set a lower bound of 0.1 here, to avoid gaining no or negative energy. + float offFieldPenalty = + (this.player.getTeamManager().getCurrentCharacterIndex() == i) + ? 1.0f + : 1.0f - this.player.getTeamManager().getActiveTeam().size() * 0.1f; + offFieldPenalty = Math.max(offFieldPenalty, 0.1f); // Same element/neutral bonus. // Same-element characters get a bonus of *3, while different-element characters get no bonus at all.