mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
Fix action logging
This commit is contained in:
parent
84fc8c9443
commit
a140719cd2
@ -158,6 +158,7 @@ export interface Wave {
|
||||
actions: string[],
|
||||
shop: string,
|
||||
biome: string,
|
||||
clearActionsFlag: boolean,
|
||||
trainer?: TrainerData,
|
||||
pokemon?: PokeData[]
|
||||
}
|
||||
@ -300,6 +301,7 @@ export function exportWave(scene: BattleScene): Wave {
|
||||
double: scene.currentBattle.double,
|
||||
actions: [],
|
||||
shop: "",
|
||||
clearActionsFlag: false,
|
||||
biome: getBiomeName(scene.arena.biomeType)
|
||||
}
|
||||
if (ret.double == undefined) ret.double = false;
|
||||
@ -608,6 +610,11 @@ export function logActions(scene: BattleScene, floor: integer, action: string) {
|
||||
var drpd = getDRPD(scene)
|
||||
console.log("Log Action", drpd)
|
||||
var wv: Wave = getWave(drpd, floor, scene)
|
||||
if (wv.clearActionsFlag) {
|
||||
console.log("Triggered clearActionsFlag")
|
||||
wv.clearActionsFlag = false
|
||||
wv.actions = []
|
||||
}
|
||||
wv.actions.push(action)
|
||||
console.log(drpd)
|
||||
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
|
||||
@ -670,8 +677,9 @@ export function getWave(drpd: DRPD, floor: integer, scene: BattleScene): Wave {
|
||||
double: scene.currentBattle.double,
|
||||
actions: [],
|
||||
shop: "",
|
||||
clearActionsFlag: false,
|
||||
biome: getBiomeName(scene.arena.biomeType),
|
||||
pokemon: []
|
||||
//pokemon: []
|
||||
}
|
||||
wv = drpd.waves[insertPos]
|
||||
}
|
||||
@ -724,7 +732,8 @@ export function getWave(drpd: DRPD, floor: integer, scene: BattleScene): Wave {
|
||||
actions: [],
|
||||
shop: "",
|
||||
biome: getBiomeName(scene.arena.biomeType),
|
||||
pokemon: []
|
||||
clearActionsFlag: false,
|
||||
//pokemon: []
|
||||
}
|
||||
wv = drpd.waves[drpd.waves.length - 1]
|
||||
}
|
||||
@ -750,8 +759,9 @@ export function getWave(drpd: DRPD, floor: integer, scene: BattleScene): Wave {
|
||||
double: scene.currentBattle.double,
|
||||
actions: [],
|
||||
shop: "",
|
||||
clearActionsFlag: false,
|
||||
biome: getBiomeName(scene.arena.biomeType),
|
||||
pokemon: []
|
||||
//pokemon: []
|
||||
}
|
||||
wv = drpd.waves[insertPos]
|
||||
}
|
||||
@ -873,9 +883,10 @@ export function logPokemon(scene: BattleScene, floor: integer = undefined, slot:
|
||||
if (pk.rarity == undefined)
|
||||
pk.rarity = "[Unknown]"
|
||||
wv.pokemon[slot] = pk;
|
||||
while (wv.actions.length > 0)
|
||||
wv.actions.pop()
|
||||
wv.actions = []
|
||||
//while (wv.actions.length > 0)
|
||||
//wv.actions.pop()
|
||||
//wv.actions = []
|
||||
wv.clearActionsFlag = false;
|
||||
wv.shop = ""
|
||||
console.log(drpd)
|
||||
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
|
||||
@ -885,13 +896,17 @@ export function logPokemon(scene: BattleScene, floor: integer = undefined, slot:
|
||||
* @param scene The BattleScene. Used to get the log ID and trainer data.
|
||||
* @param floor The wave index to write to. Defaults to the current floor.
|
||||
*/
|
||||
export function resetWaveActions(scene: BattleScene, floor: integer = undefined) {
|
||||
export function resetWaveActions(scene: BattleScene, floor: integer = undefined, softflag: boolean) {
|
||||
if (floor == undefined) floor = scene.currentBattle.waveIndex
|
||||
if (localStorage.getItem(getLogID(scene)) == null) localStorage.setItem(getLogID(scene), JSON.stringify(newDocument(getMode(scene) + " Run")))
|
||||
var drpd = getDRPD(scene)
|
||||
console.log("Clear Actions", drpd)
|
||||
var wv: Wave = getWave(drpd, floor, scene)
|
||||
if (softflag) {
|
||||
wv.clearActionsFlag = true;
|
||||
} else {
|
||||
wv.actions = []
|
||||
}
|
||||
console.log(drpd, wv)
|
||||
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
|
||||
}
|
||||
|
@ -1406,7 +1406,7 @@ export class EncounterPhase extends BattlePhase {
|
||||
if (this.scene.currentBattle.waveIndex == 1) {
|
||||
LoggerTools.logPlayerTeam(this.scene)
|
||||
}
|
||||
LoggerTools.resetWaveActions(this.scene)
|
||||
LoggerTools.resetWaveActions(this.scene, undefined, true)
|
||||
|
||||
if (LoggerTools.autoCheckpoints.includes(this.scene.currentBattle.waveIndex)) {
|
||||
this.scene.gameData.saveGameToAuto(this.scene)
|
||||
@ -5684,6 +5684,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||
this.removePb();
|
||||
this.end();
|
||||
};
|
||||
LoggerTools.logCapture(this.scene, this.scene.currentBattle.waveIndex, pokemon)
|
||||
const removePokemon = () => {
|
||||
this.scene.addFaintedEnemyScore(pokemon);
|
||||
this.scene.getPlayerField().filter(p => p.isActive(true)).forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
|
||||
|
Loading…
Reference in New Issue
Block a user