mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-03 23:12:20 +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 */
|
/** If the current battle is a Mystery Encounter, this will always be defined */
|
||||||
public mysteryEncounter?: MysteryEncounter;
|
public mysteryEncounter?: MysteryEncounter;
|
||||||
|
|
||||||
|
public failedRunAway = false;
|
||||||
|
|
||||||
private rngCounter = 0;
|
private rngCounter = 0;
|
||||||
|
|
||||||
constructor(gameMode: GameMode, waveIndex: number, battleType: BattleType, trainer?: Trainer, double = false) {
|
constructor(gameMode: GameMode, waveIndex: number, battleType: BattleType, trainer?: Trainer, double = false) {
|
||||||
|
@ -20,10 +20,10 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
start() {
|
start() {
|
||||||
super.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 activePlayerField = globalScene.getActivePlayerField();
|
||||||
const enemyField = globalScene.getEnemyField();
|
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 escapeChance = new NumberHolder(0);
|
||||||
const escapeRoll = this.getTeamRNG(100);
|
const escapeRoll = this.getTeamRNG(100);
|
||||||
@ -67,11 +67,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
|||||||
|
|
||||||
globalScene.phaseManager.pushNew("NewBattlePhase");
|
globalScene.phaseManager.pushNew("NewBattlePhase");
|
||||||
} else {
|
} else {
|
||||||
//there should be a general failed run away bool for the active team
|
globalScene.currentBattle.failedRunAway = true;
|
||||||
activePlayerField.forEach(p => {
|
|
||||||
p.turnData.failedRunAway = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
globalScene.phaseManager.queueMessage(i18next.t("battle:runAwayCannotEscape"), null, true, 500);
|
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";
|
import { Phase } from "#app/phase";
|
||||||
|
|
||||||
export abstract class BattlePhase extends 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 {
|
showEnemyTrainer(trainerSlot: TrainerSlot = TrainerSlot.NONE): void {
|
||||||
if (!globalScene.currentBattle.trainer) {
|
if (!globalScene.currentBattle.trainer) {
|
||||||
console.warn("Enemy trainer is missing!");
|
console.warn("Enemy trainer is missing!");
|
||||||
|
Loading…
Reference in New Issue
Block a user