mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-10-20 20:15:50 +02:00
* Grabbed reverted changes from stuff
* Added version migrator for rage fist data + deepMergeSpriteData tests
* fixed formattign
* Fied a few
* Fixed constructor (maybe), moved deepCopy and deepMergeSpriteData to own file
`common.ts` is hella bloated so seems legit
* Moved empty moveset verification mapping thing to upgrade script bc i wanted to
* Fixed tests
* test added
* Fixed summondata being cleared inside summonPhase, removed `summonDataPrimer`
like seriously how come no-one checked this
* Fixed test
I forgot that we outsped and oneshot
* Fixed test
* huhjjjjjb
* Hopefully fixed bug
my sanity and homework are paying the price for this lol
* added commented out console.log statement
uncomment to see new berry data
* Fixed migrate script, re-added deprecated attributes out of necessity
* Fixed failing test by not trying to mock rng
* Fixed test
* Fixed tests
* Update ability.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update ability.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update overrides.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update berry-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update encounter-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update game-data.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Added utility function `randSeedFloat`
basically just `Phaser.math.RND.realInRange(0, 1)`
* Applied review comments, cleaned up code a bit
* Removed unnecessary null checks for turnData and co.
I explicitly made them initialized by default for this very reason
* Added tests for Last Resort regarding moveHistory
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update battle-scene.ts
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
* Update the-winstrate-challenge-encounter.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update ability.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update move.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update battle-anims.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon.ts comments
* Fixed a few outstanding issues with documentation
* Updated switch summon phase comment
* Re-added BattleSummonData as TempSummonData
* Hppefully fixed -1 sprite scale glitch
* Fixed comment
* Reveted `pokemon-forms.ts`
* Fuxed constructor
* fixed -1 bug
* Revert "Added utility function `randSeedFloat`"
This reverts commit 4c3447c851
.
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
101 lines
3.0 KiB
TypeScript
101 lines
3.0 KiB
TypeScript
import { globalScene } from "#app/global-scene";
|
|
import { applyPostBattleAbAttrs, PostBattleAbAttr } from "#app/data/abilities/ability";
|
|
import { LapsingPersistentModifier, LapsingPokemonHeldItemModifier } from "#app/modifier/modifier";
|
|
import { BattlePhase } from "./battle-phase";
|
|
import { GameOverPhase } from "./game-over-phase";
|
|
|
|
export class BattleEndPhase extends BattlePhase {
|
|
/** If true, will increment battles won */
|
|
isVictory: boolean;
|
|
|
|
constructor(isVictory: boolean) {
|
|
super();
|
|
|
|
this.isVictory = isVictory;
|
|
}
|
|
|
|
start() {
|
|
super.start();
|
|
|
|
// cull any extra `BattleEnd` phases from the queue.
|
|
globalScene.phaseQueue = globalScene.phaseQueue.filter(phase => {
|
|
if (phase instanceof BattleEndPhase) {
|
|
this.isVictory ||= phase.isVictory;
|
|
return false;
|
|
}
|
|
return true;
|
|
});
|
|
// `phaseQueuePrepend` is private, so we have to use this inefficient loop.
|
|
while (
|
|
globalScene.tryRemoveUnshiftedPhase(phase => {
|
|
if (phase instanceof BattleEndPhase) {
|
|
this.isVictory ||= phase.isVictory;
|
|
return true;
|
|
}
|
|
return false;
|
|
})
|
|
) {}
|
|
|
|
globalScene.gameData.gameStats.battles++;
|
|
if (
|
|
globalScene.gameMode.isEndless &&
|
|
globalScene.currentBattle.waveIndex + 1 > globalScene.gameData.gameStats.highestEndlessWave
|
|
) {
|
|
globalScene.gameData.gameStats.highestEndlessWave = globalScene.currentBattle.waveIndex + 1;
|
|
}
|
|
|
|
if (this.isVictory) {
|
|
globalScene.currentBattle.addBattleScore();
|
|
|
|
if (globalScene.currentBattle.trainer) {
|
|
globalScene.gameData.gameStats.trainersDefeated++;
|
|
}
|
|
}
|
|
|
|
// Endless graceful end
|
|
if (globalScene.gameMode.isEndless && globalScene.currentBattle.waveIndex >= 5850) {
|
|
globalScene.clearPhaseQueue();
|
|
globalScene.unshiftPhase(new GameOverPhase(true));
|
|
}
|
|
|
|
for (const pokemon of globalScene.getField()) {
|
|
if (pokemon) {
|
|
pokemon.tempSummonData.waveTurnCount = 1;
|
|
}
|
|
}
|
|
|
|
for (const pokemon of globalScene.getPokemonAllowedInBattle()) {
|
|
applyPostBattleAbAttrs(PostBattleAbAttr, pokemon, false, this.isVictory);
|
|
}
|
|
|
|
if (globalScene.currentBattle.moneyScattered) {
|
|
globalScene.currentBattle.pickUpScatteredMoney();
|
|
}
|
|
|
|
globalScene.clearEnemyHeldItemModifiers();
|
|
for (const p of globalScene.getEnemyParty()) {
|
|
try {
|
|
p.destroy();
|
|
} catch {
|
|
console.warn("Unable to destroy stale pokemon object in BattleEndPhase:", p);
|
|
}
|
|
}
|
|
|
|
const lapsingModifiers = globalScene.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(globalScene.getPokemonById(m.pokemonId));
|
|
}
|
|
if (!m.lapse(...args)) {
|
|
globalScene.removeModifier(m);
|
|
}
|
|
}
|
|
|
|
globalScene.updateModifiers();
|
|
this.end();
|
|
}
|
|
}
|