mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 23:42:18 +02:00
Moved early override check to top of calculateEscapeChance
This commit is contained in:
parent
8de5ae99b6
commit
f48b00a036
@ -73,6 +73,11 @@ export class AttemptRunPhase extends FieldPhase {
|
|||||||
* @returns The final escape chance, as percentage out of 100.
|
* @returns The final escape chance, as percentage out of 100.
|
||||||
*/
|
*/
|
||||||
public calculateEscapeChance(escapeAttempts: number): number {
|
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 enemyField = globalScene.getEnemyField();
|
||||||
const activePlayerField = globalScene.getPlayerField(true);
|
const activePlayerField = globalScene.getPlayerField(true);
|
||||||
|
|
||||||
@ -113,11 +118,6 @@ export class AttemptRunPhase extends FieldPhase {
|
|||||||
/** Slope of the escape chance curve */
|
/** Slope of the escape chance curve */
|
||||||
const escapeSlope = (maxChance - minChance) / speedCap;
|
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`]
|
// This will calculate the escape chance given all of the above and clamp it to the range of [`minChance`, `maxChance`]
|
||||||
return Phaser.Math.Clamp(
|
return Phaser.Math.Clamp(
|
||||||
Math.round(escapeSlope * speedRatio + minChance + escapeBonus * escapeAttempts),
|
Math.round(escapeSlope * speedRatio + minChance + escapeBonus * escapeAttempts),
|
||||||
|
Loading…
Reference in New Issue
Block a user