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[],
|
actions: string[],
|
||||||
shop: string,
|
shop: string,
|
||||||
biome: string,
|
biome: string,
|
||||||
|
clearActionsFlag: boolean,
|
||||||
trainer?: TrainerData,
|
trainer?: TrainerData,
|
||||||
pokemon?: PokeData[]
|
pokemon?: PokeData[]
|
||||||
}
|
}
|
||||||
@ -300,6 +301,7 @@ export function exportWave(scene: BattleScene): Wave {
|
|||||||
double: scene.currentBattle.double,
|
double: scene.currentBattle.double,
|
||||||
actions: [],
|
actions: [],
|
||||||
shop: "",
|
shop: "",
|
||||||
|
clearActionsFlag: false,
|
||||||
biome: getBiomeName(scene.arena.biomeType)
|
biome: getBiomeName(scene.arena.biomeType)
|
||||||
}
|
}
|
||||||
if (ret.double == undefined) ret.double = false;
|
if (ret.double == undefined) ret.double = false;
|
||||||
@ -608,6 +610,11 @@ export function logActions(scene: BattleScene, floor: integer, action: string) {
|
|||||||
var drpd = getDRPD(scene)
|
var drpd = getDRPD(scene)
|
||||||
console.log("Log Action", drpd)
|
console.log("Log Action", drpd)
|
||||||
var wv: Wave = getWave(drpd, floor, scene)
|
var wv: Wave = getWave(drpd, floor, scene)
|
||||||
|
if (wv.clearActionsFlag) {
|
||||||
|
console.log("Triggered clearActionsFlag")
|
||||||
|
wv.clearActionsFlag = false
|
||||||
|
wv.actions = []
|
||||||
|
}
|
||||||
wv.actions.push(action)
|
wv.actions.push(action)
|
||||||
console.log(drpd)
|
console.log(drpd)
|
||||||
localStorage.setItem(getLogID(scene), JSON.stringify(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,
|
double: scene.currentBattle.double,
|
||||||
actions: [],
|
actions: [],
|
||||||
shop: "",
|
shop: "",
|
||||||
|
clearActionsFlag: false,
|
||||||
biome: getBiomeName(scene.arena.biomeType),
|
biome: getBiomeName(scene.arena.biomeType),
|
||||||
pokemon: []
|
//pokemon: []
|
||||||
}
|
}
|
||||||
wv = drpd.waves[insertPos]
|
wv = drpd.waves[insertPos]
|
||||||
}
|
}
|
||||||
@ -724,7 +732,8 @@ export function getWave(drpd: DRPD, floor: integer, scene: BattleScene): Wave {
|
|||||||
actions: [],
|
actions: [],
|
||||||
shop: "",
|
shop: "",
|
||||||
biome: getBiomeName(scene.arena.biomeType),
|
biome: getBiomeName(scene.arena.biomeType),
|
||||||
pokemon: []
|
clearActionsFlag: false,
|
||||||
|
//pokemon: []
|
||||||
}
|
}
|
||||||
wv = drpd.waves[drpd.waves.length - 1]
|
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,
|
double: scene.currentBattle.double,
|
||||||
actions: [],
|
actions: [],
|
||||||
shop: "",
|
shop: "",
|
||||||
|
clearActionsFlag: false,
|
||||||
biome: getBiomeName(scene.arena.biomeType),
|
biome: getBiomeName(scene.arena.biomeType),
|
||||||
pokemon: []
|
//pokemon: []
|
||||||
}
|
}
|
||||||
wv = drpd.waves[insertPos]
|
wv = drpd.waves[insertPos]
|
||||||
}
|
}
|
||||||
@ -873,9 +883,10 @@ export function logPokemon(scene: BattleScene, floor: integer = undefined, slot:
|
|||||||
if (pk.rarity == undefined)
|
if (pk.rarity == undefined)
|
||||||
pk.rarity = "[Unknown]"
|
pk.rarity = "[Unknown]"
|
||||||
wv.pokemon[slot] = pk;
|
wv.pokemon[slot] = pk;
|
||||||
while (wv.actions.length > 0)
|
//while (wv.actions.length > 0)
|
||||||
wv.actions.pop()
|
//wv.actions.pop()
|
||||||
wv.actions = []
|
//wv.actions = []
|
||||||
|
wv.clearActionsFlag = false;
|
||||||
wv.shop = ""
|
wv.shop = ""
|
||||||
console.log(drpd)
|
console.log(drpd)
|
||||||
localStorage.setItem(getLogID(scene), JSON.stringify(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 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.
|
* @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 (floor == undefined) floor = scene.currentBattle.waveIndex
|
||||||
if (localStorage.getItem(getLogID(scene)) == null) localStorage.setItem(getLogID(scene), JSON.stringify(newDocument(getMode(scene) + " Run")))
|
if (localStorage.getItem(getLogID(scene)) == null) localStorage.setItem(getLogID(scene), JSON.stringify(newDocument(getMode(scene) + " Run")))
|
||||||
var drpd = getDRPD(scene)
|
var drpd = getDRPD(scene)
|
||||||
console.log("Clear Actions", drpd)
|
console.log("Clear Actions", drpd)
|
||||||
var wv: Wave = getWave(drpd, floor, scene)
|
var wv: Wave = getWave(drpd, floor, scene)
|
||||||
wv.actions = []
|
if (softflag) {
|
||||||
|
wv.clearActionsFlag = true;
|
||||||
|
} else {
|
||||||
|
wv.actions = []
|
||||||
|
}
|
||||||
console.log(drpd, wv)
|
console.log(drpd, wv)
|
||||||
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
|
localStorage.setItem(getLogID(scene), JSON.stringify(drpd))
|
||||||
}
|
}
|
||||||
|
@ -1406,7 +1406,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
if (this.scene.currentBattle.waveIndex == 1) {
|
if (this.scene.currentBattle.waveIndex == 1) {
|
||||||
LoggerTools.logPlayerTeam(this.scene)
|
LoggerTools.logPlayerTeam(this.scene)
|
||||||
}
|
}
|
||||||
LoggerTools.resetWaveActions(this.scene)
|
LoggerTools.resetWaveActions(this.scene, undefined, true)
|
||||||
|
|
||||||
if (LoggerTools.autoCheckpoints.includes(this.scene.currentBattle.waveIndex)) {
|
if (LoggerTools.autoCheckpoints.includes(this.scene.currentBattle.waveIndex)) {
|
||||||
this.scene.gameData.saveGameToAuto(this.scene)
|
this.scene.gameData.saveGameToAuto(this.scene)
|
||||||
@ -5684,6 +5684,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
|||||||
this.removePb();
|
this.removePb();
|
||||||
this.end();
|
this.end();
|
||||||
};
|
};
|
||||||
|
LoggerTools.logCapture(this.scene, this.scene.currentBattle.waveIndex, pokemon)
|
||||||
const removePokemon = () => {
|
const removePokemon = () => {
|
||||||
this.scene.addFaintedEnemyScore(pokemon);
|
this.scene.addFaintedEnemyScore(pokemon);
|
||||||
this.scene.getPlayerField().filter(p => p.isActive(true)).forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
|
this.scene.getPlayerField().filter(p => p.isActive(true)).forEach(playerPokemon => playerPokemon.removeTagsBySourceId(pokemon.id));
|
||||||
|
Loading…
Reference in New Issue
Block a user