mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Added some tracking, but not enough.
This commit is contained in:
parent
4802f512ff
commit
949e4b67a1
@ -10,7 +10,7 @@ import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets
|
||||
import { Phase } from "#app/phase";
|
||||
import { initGameSpeed } from "#app/system/game-speed";
|
||||
import { Arena, ArenaBase } from "#app/field/arena";
|
||||
import { GameData } from "#app/system/game-data";
|
||||
import { GameData, BiomeSessionData } from "#app/system/game-data";
|
||||
import { addTextObject, getTextColor, TextStyle } from "#app/ui/text";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { MusicPreference } from "#app/system/settings/settings";
|
||||
@ -259,6 +259,7 @@ export default class BattleScene extends SceneBase {
|
||||
public pokeballCounts: PokeballCounts;
|
||||
public money: integer;
|
||||
public pokemonInfoContainer: PokemonInfoContainer;
|
||||
public biomeTracker: BiomeSessionData;
|
||||
private party: PlayerPokemon[];
|
||||
/** Session save data that pertains to Mystery Encounters */
|
||||
public mysteryEncounterSaveData: MysteryEncounterSaveData = new MysteryEncounterSaveData();
|
||||
@ -1324,6 +1325,22 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
|
||||
newArena(biome: Biome): Arena {
|
||||
const biomeTrackerLimit = 22;
|
||||
if (Utils.isNullOrUndefined(this.biomeTracker)) {
|
||||
this.biomeTracker = {};
|
||||
}
|
||||
if (this.currentBattle) {
|
||||
this.biomeTracker[this.currentBattle.waveIndex] = biome;
|
||||
} else {
|
||||
this.biomeTracker[1] = biome;
|
||||
}
|
||||
const biomeTrackerKeys = Object.keys(this.biomeTracker).map(Number);
|
||||
console.log(this.biomeTracker);
|
||||
// Arbitrary limit of 22 entries per session --> Can increase or decrease
|
||||
while (biomeTrackerKeys.length >= biomeTrackerLimit ) {
|
||||
const smallestWave = Math.min.apply(Math, biomeTrackerKeys);
|
||||
delete this.biomeTracker[smallestWave];
|
||||
}
|
||||
this.arena = new Arena(this, biome, Biome[biome].toLowerCase());
|
||||
this.eventTarget.dispatchEvent(new NewArenaEvent());
|
||||
|
||||
|
@ -39,6 +39,7 @@ import { Device } from "#enums/devices";
|
||||
import { GameDataType } from "#enums/game-data-type";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
import { Biome } from "#enums/biome";
|
||||
import { Species } from "#enums/species";
|
||||
import { applyChallenges, ChallengeType } from "#app/data/challenge";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
@ -136,12 +137,17 @@ export interface SessionSaveData {
|
||||
challenges: ChallengeData[];
|
||||
mysteryEncounterType: MysteryEncounterType | -1; // Only defined when current wave is ME,
|
||||
mysteryEncounterSaveData: MysteryEncounterSaveData;
|
||||
biomeTracker: BiomeSessionData;
|
||||
}
|
||||
|
||||
interface Unlocks {
|
||||
[key: integer]: boolean;
|
||||
}
|
||||
|
||||
export interface BiomeSessionData {
|
||||
[key: number]: Biome;
|
||||
}
|
||||
|
||||
interface AchvUnlocks {
|
||||
[key: string]: integer
|
||||
}
|
||||
@ -963,7 +969,8 @@ export class GameData {
|
||||
timestamp: new Date().getTime(),
|
||||
challenges: scene.gameMode.challenges.map(c => new ChallengeData(c)),
|
||||
mysteryEncounterType: scene.currentBattle.mysteryEncounter?.encounterType ?? -1,
|
||||
mysteryEncounterSaveData: scene.mysteryEncounterSaveData
|
||||
mysteryEncounterSaveData: scene.mysteryEncounterSaveData,
|
||||
biomeTracker: scene.biomeTracker
|
||||
} as SessionSaveData;
|
||||
}
|
||||
|
||||
@ -1023,6 +1030,7 @@ export class GameData {
|
||||
|
||||
scene.sessionPlayTime = sessionData.playTime || 0;
|
||||
scene.lastSavePlayTime = 0;
|
||||
scene.biomeTracker = sessionData.biomeTracker || {};
|
||||
|
||||
const loadPokemonAssets: Promise<void>[] = [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user