From f48b00a036f541b822927126ed80c0cd07a61924 Mon Sep 17 00:00:00 2001 From: jnotsknab Date: Tue, 24 Jun 2025 12:09:25 -0500 Subject: [PATCH] Moved early override check to top of calculateEscapeChance --- src/phases/attempt-run-phase.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/phases/attempt-run-phase.ts b/src/phases/attempt-run-phase.ts index 5d838d5d562..3709374287a 100644 --- a/src/phases/attempt-run-phase.ts +++ b/src/phases/attempt-run-phase.ts @@ -73,6 +73,11 @@ export class AttemptRunPhase extends FieldPhase { * @returns The final escape chance, as percentage out of 100. */ public calculateEscapeChance(escapeAttempts: number): number { + // Check for override, guaranteeing or forbidding random flee attempts as applicable. + if (Overrides.RUN_SUCCESS_OVERRIDE !== null) { + return Overrides.RUN_SUCCESS_OVERRIDE ? 100 : 0; + } + const enemyField = globalScene.getEnemyField(); const activePlayerField = globalScene.getPlayerField(true); @@ -113,11 +118,6 @@ export class AttemptRunPhase extends FieldPhase { /** Slope of the escape chance curve */ const escapeSlope = (maxChance - minChance) / speedCap; - // Check for override, guaranteeing or forbidding random flee attempts as applicable. - if (Overrides.RUN_SUCCESS_OVERRIDE !== null) { - return Overrides.RUN_SUCCESS_OVERRIDE ? 100 : 0; - } - // This will calculate the escape chance given all of the above and clamp it to the range of [`minChance`, `maxChance`] return Phaser.Math.Clamp( Math.round(escapeSlope * speedRatio + minChance + escapeBonus * escapeAttempts),