mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 15:22:19 +02:00
Add player faint count to ArenaData, track total player/enemy faints in BattleScene
This commit is contained in:
parent
de148277ea
commit
8d051b07b5
@ -339,6 +339,8 @@ export default class BattleScene extends SceneBase {
|
||||
public currentBattle: Battle;
|
||||
public pokeballCounts: PokeballCounts;
|
||||
public money: number;
|
||||
public totalPlayerFaints: number;
|
||||
public totalEnemyFaints: number;
|
||||
public pokemonInfoContainer: PokemonInfoContainer;
|
||||
private party: PlayerPokemon[];
|
||||
/** Session save data that pertains to Mystery Encounters */
|
||||
@ -1401,6 +1403,8 @@ export default class BattleScene extends SceneBase {
|
||||
|
||||
this.score = 0;
|
||||
this.money = 0;
|
||||
this.totalPlayerFaints = 0;
|
||||
this.totalEnemyFaints = 0;
|
||||
|
||||
this.lockModifierTiers = false;
|
||||
|
||||
@ -1794,8 +1798,8 @@ export default class BattleScene extends SceneBase {
|
||||
return this.currentBattle;
|
||||
}
|
||||
|
||||
newArena(biome: Biome, playerFaints?: number): Arena {
|
||||
this.arena = new Arena(biome, Biome[biome].toLowerCase(), playerFaints);
|
||||
newArena(biome: Biome): Arena {
|
||||
this.arena = new Arena(biome, Biome[biome].toLowerCase());
|
||||
this.eventTarget.dispatchEvent(new NewArenaEvent());
|
||||
|
||||
this.arenaBg.pipelineData = {
|
||||
|
@ -58,14 +58,14 @@ export class Arena {
|
||||
|
||||
public readonly eventTarget: EventTarget = new EventTarget();
|
||||
|
||||
constructor(biome: Biome, bgm: string, playerFaints: number = 0) {
|
||||
constructor(biome: Biome, bgm: string) {
|
||||
this.biomeType = biome;
|
||||
this.tags = [];
|
||||
this.bgm = bgm;
|
||||
this.trainerPool = biomeTrainerPools[biome];
|
||||
this.updatePoolsForTimeOfDay();
|
||||
this.playerTerasUsed = 0;
|
||||
this.playerFaints = playerFaints;
|
||||
this.playerFaints = 0;
|
||||
}
|
||||
|
||||
init() {
|
||||
@ -696,7 +696,6 @@ export class Arena {
|
||||
this.trySetWeather(WeatherType.NONE, false);
|
||||
}
|
||||
this.trySetTerrain(TerrainType.NONE, false, true);
|
||||
this.resetPlayerFaintCount();
|
||||
this.removeAllTags();
|
||||
}
|
||||
|
||||
@ -782,10 +781,6 @@ export class Arena {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
resetPlayerFaintCount(): void {
|
||||
this.playerFaints = 0;
|
||||
}
|
||||
}
|
||||
|
||||
export function getBiomeKey(biome: Biome): string {
|
||||
|
@ -100,9 +100,11 @@ export class FaintPhase extends PokemonPhase {
|
||||
if (pokemon.isPlayer()) {
|
||||
globalScene.arena.playerFaints += 1;
|
||||
globalScene.currentBattle.playerFaintsHistory.push({ pokemon: pokemon, turn: globalScene.currentBattle.turn });
|
||||
globalScene.totalPlayerFaints++;
|
||||
} else {
|
||||
globalScene.currentBattle.enemyFaints += 1;
|
||||
globalScene.currentBattle.enemyFaintsHistory.push({ pokemon: pokemon, turn: globalScene.currentBattle.turn });
|
||||
globalScene.totalEnemyFaints++;
|
||||
}
|
||||
|
||||
globalScene.queueMessage(i18next.t("battle:fainted", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }), null, true);
|
||||
|
@ -11,6 +11,7 @@ export default class ArenaData {
|
||||
public terrain: Terrain | null;
|
||||
public tags: ArenaTag[];
|
||||
public playerTerasUsed: number;
|
||||
public playerFaints: number;
|
||||
|
||||
constructor(source: Arena | any) {
|
||||
const sourceArena = source instanceof Arena ? source as Arena : null;
|
||||
@ -18,6 +19,7 @@ export default class ArenaData {
|
||||
this.weather = sourceArena ? sourceArena.weather : source.weather ? new Weather(source.weather.weatherType, source.weather.turnsLeft) : null;
|
||||
this.terrain = sourceArena ? sourceArena.terrain : source.terrain ? new Terrain(source.terrain.terrainType, source.terrain.turnsLeft) : null;
|
||||
this.playerTerasUsed = (sourceArena ? sourceArena.playerTerasUsed : source.playerTerasUsed) ?? 0;
|
||||
this.playerFaints = (sourceArena ? sourceArena.playerFaints : source.playerFaints) ?? 0;
|
||||
this.tags = [];
|
||||
|
||||
if (source.tags) {
|
||||
|
@ -144,9 +144,10 @@ export interface SessionSaveData {
|
||||
mysteryEncounterType: MysteryEncounterType | -1; // Only defined when current wave is ME,
|
||||
mysteryEncounterSaveData: MysteryEncounterSaveData;
|
||||
/**
|
||||
* Counts the amount of pokemon fainted in your party during the current arena encounter.
|
||||
* Counts the amount of pokemon fainted in your party throughout the run.
|
||||
*/
|
||||
playerFaints: number;
|
||||
enemyFaints: number;
|
||||
}
|
||||
|
||||
interface Unlocks {
|
||||
@ -972,7 +973,8 @@ export class GameData {
|
||||
challenges: globalScene.gameMode.challenges.map(c => new ChallengeData(c)),
|
||||
mysteryEncounterType: globalScene.currentBattle.mysteryEncounter?.encounterType ?? -1,
|
||||
mysteryEncounterSaveData: globalScene.mysteryEncounterSaveData,
|
||||
playerFaints: globalScene.arena.playerFaints
|
||||
playerFaints: globalScene.totalPlayerFaints,
|
||||
enemyFaints: globalScene.totalEnemyFaints
|
||||
} as SessionSaveData;
|
||||
}
|
||||
|
||||
@ -1064,7 +1066,10 @@ export class GameData {
|
||||
|
||||
globalScene.mysteryEncounterSaveData = new MysteryEncounterSaveData(sessionData.mysteryEncounterSaveData);
|
||||
|
||||
globalScene.newArena(sessionData.arena.biome, sessionData.playerFaints);
|
||||
globalScene.totalPlayerFaints = sessionData.playerFaints;
|
||||
globalScene.totalEnemyFaints = sessionData.enemyFaints;
|
||||
|
||||
globalScene.newArena(sessionData.arena.biome);
|
||||
|
||||
const battleType = sessionData.battleType || 0;
|
||||
const trainerConfig = sessionData.trainer ? trainerConfigs[sessionData.trainer.trainerType] : null;
|
||||
@ -1092,6 +1097,8 @@ export class GameData {
|
||||
|
||||
globalScene.arena.playerTerasUsed = sessionData.arena.playerTerasUsed;
|
||||
|
||||
globalScene.arena.playerFaints = sessionData.arena.playerFaints;
|
||||
|
||||
globalScene.arena.tags = sessionData.arena.tags;
|
||||
if (globalScene.arena.tags) {
|
||||
for (const tag of globalScene.arena.tags) {
|
||||
|
Loading…
Reference in New Issue
Block a user