mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-22 13:05:51 +02:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { trainerConfigs } from "#app/data/trainer-config";
|
|
import type { TrainerType } from "#app/enums/trainer-type";
|
|
import { BattlePhase } from "./battle-phase";
|
|
import { TestMessagePhase } from "./test-message-phase";
|
|
|
|
export class TrainerMessageTestPhase extends BattlePhase {
|
|
private trainerTypes: TrainerType[];
|
|
|
|
constructor(...trainerTypes: TrainerType[]) {
|
|
super();
|
|
|
|
this.trainerTypes = trainerTypes;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
const testMessages: string[] = [];
|
|
|
|
for (const t of Object.keys(trainerConfigs)) {
|
|
const type = parseInt(t);
|
|
if (this.trainerTypes.length && !this.trainerTypes.find(tt => tt === type as TrainerType)) {
|
|
continue;
|
|
}
|
|
const config = trainerConfigs[type];
|
|
[ config.encounterMessages, config.femaleEncounterMessages, config.victoryMessages, config.femaleVictoryMessages, config.defeatMessages, config.femaleDefeatMessages ]
|
|
.map(messages => {
|
|
if (messages?.length) {
|
|
testMessages.push(...messages);
|
|
}
|
|
});
|
|
}
|
|
|
|
for (const message of testMessages) {
|
|
globalScene.pushPhase(new TestMessagePhase(message));
|
|
}
|
|
|
|
this.end();
|
|
}
|
|
}
|