mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-25 22:45:52 +02:00
* various bug fixes for MEs * various bug fixes for MEs * fix final isTransferable rename that was missed * change Trainer's test vouchers for second option * change unit test skips * cut down excess ME track length and loop properly * ME bug fix cleanup * updating AI for Slumbering Snorlax ME, and small ME balance changes * fix ts error * fix bug type superfan dialogue discrepancy * ME bug fixes PR feedback * ME PR nits and fixes * update naming convention of sprites * ME balance changes and bug fixes * fix tests * fix An Offer You Can't Refuse ME requirements * clean up post-battle logic for Breeder ME * party size requirement cleanup * clean up challenge requirements for disabling certain MEs --------- Co-authored-by: ImperialSympathizer <imperialsympathizer@gmail.com>
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { applyPostBattleAbAttrs, PostBattleAbAttr } from "#app/data/ability";
|
|
import { LapsingPersistentModifier, LapsingPokemonHeldItemModifier } from "#app/modifier/modifier";
|
|
import { BattlePhase } from "./battle-phase";
|
|
import { GameOverPhase } from "./game-over-phase";
|
|
import BattleScene from "#app/battle-scene";
|
|
|
|
export class BattleEndPhase extends BattlePhase {
|
|
/** If true, will increment battles won */
|
|
isVictory: boolean;
|
|
|
|
constructor(scene: BattleScene, isVictory: boolean = true) {
|
|
super(scene);
|
|
|
|
this.isVictory = isVictory;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
if (this.isVictory) {
|
|
this.scene.currentBattle.addBattleScore(this.scene);
|
|
|
|
this.scene.gameData.gameStats.battles++;
|
|
if (this.scene.currentBattle.trainer) {
|
|
this.scene.gameData.gameStats.trainersDefeated++;
|
|
}
|
|
if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex + 1 > this.scene.gameData.gameStats.highestEndlessWave) {
|
|
this.scene.gameData.gameStats.highestEndlessWave = this.scene.currentBattle.waveIndex + 1;
|
|
}
|
|
}
|
|
|
|
// Endless graceful end
|
|
if (this.scene.gameMode.isEndless && this.scene.currentBattle.waveIndex >= 5850) {
|
|
this.scene.clearPhaseQueue();
|
|
this.scene.unshiftPhase(new GameOverPhase(this.scene, true));
|
|
}
|
|
|
|
for (const pokemon of this.scene.getParty().filter(p => p.isAllowedInBattle())) {
|
|
applyPostBattleAbAttrs(PostBattleAbAttr, pokemon);
|
|
}
|
|
|
|
if (this.scene.currentBattle.moneyScattered) {
|
|
this.scene.currentBattle.pickUpScatteredMoney(this.scene);
|
|
}
|
|
|
|
this.scene.clearEnemyHeldItemModifiers();
|
|
|
|
const lapsingModifiers = this.scene.findModifiers(m => m instanceof LapsingPersistentModifier || m instanceof LapsingPokemonHeldItemModifier) as (LapsingPersistentModifier | LapsingPokemonHeldItemModifier)[];
|
|
for (const m of lapsingModifiers) {
|
|
const args: any[] = [];
|
|
if (m instanceof LapsingPokemonHeldItemModifier) {
|
|
args.push(this.scene.getPokemonById(m.pokemonId));
|
|
}
|
|
if (!m.lapse(args)) {
|
|
this.scene.removeModifier(m);
|
|
}
|
|
}
|
|
|
|
this.scene.updateModifiers().then(() => this.end());
|
|
}
|
|
}
|