mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-03 06:52:16 +02:00
Decoupled individual pokemon from run phase logic
This commit is contained in:
parent
53c5efc82e
commit
3fcccfecd4
@ -94,6 +94,8 @@ export default class Battle {
|
||||
/** If the current battle is a Mystery Encounter, this will always be defined */
|
||||
public mysteryEncounter?: MysteryEncounter;
|
||||
|
||||
public failedRunAway = false;
|
||||
|
||||
private rngCounter = 0;
|
||||
|
||||
constructor(gameMode: GameMode, waveIndex: number, battleType: BattleType, trainer?: Trainer, double = false) {
|
||||
|
@ -20,10 +20,10 @@ export class AttemptRunPhase extends PokemonPhase {
|
||||
start() {
|
||||
super.start();
|
||||
|
||||
//Attempting to run is a TEAM not PLAYER based action, we should not be referercing individual pokemon,
|
||||
//we should instead be referring to the team as a whole
|
||||
const activePlayerField = globalScene.getActivePlayerField();
|
||||
const enemyField = globalScene.getEnemyField();
|
||||
//Attempting to run is a TEAM not PLAYER based action, we should not be referercing individual pokemon,
|
||||
//we should instead be referring to the team as a whole and
|
||||
|
||||
const escapeChance = new NumberHolder(0);
|
||||
const escapeRoll = this.getTeamRNG(100);
|
||||
@ -67,11 +67,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
||||
|
||||
globalScene.phaseManager.pushNew("NewBattlePhase");
|
||||
} else {
|
||||
//there should be a general failed run away bool for the active team
|
||||
activePlayerField.forEach(p => {
|
||||
p.turnData.failedRunAway = true;
|
||||
});
|
||||
|
||||
globalScene.currentBattle.failedRunAway = true;
|
||||
globalScene.phaseManager.queueMessage(i18next.t("battle:runAwayCannotEscape"), null, true, 500);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,17 @@ import { TrainerSlot } from "#enums/trainer-slot";
|
||||
import { Phase } from "#app/phase";
|
||||
|
||||
export abstract class BattlePhase extends Phase {
|
||||
start() {
|
||||
if (globalScene.currentBattle.failedRunAway) {
|
||||
const activePlayerField = globalScene.getActivePlayerField();
|
||||
|
||||
activePlayerField.forEach(p => {
|
||||
p.turnData.failedRunAway = true;
|
||||
});
|
||||
|
||||
globalScene.currentBattle.failedRunAway = false;
|
||||
}
|
||||
}
|
||||
showEnemyTrainer(trainerSlot: TrainerSlot = TrainerSlot.NONE): void {
|
||||
if (!globalScene.currentBattle.trainer) {
|
||||
console.warn("Enemy trainer is missing!");
|
||||
|
Loading…
Reference in New Issue
Block a user