diff --git a/src/logger.ts b/src/logger.ts index 1d6c67c1838..c6fd8d023c3 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1398,6 +1398,30 @@ export function logActions(scene: BattleScene, floor: integer, action: string) { console.log(drpd) localStorage.setItem(getLogID(scene), JSON.stringify(drpd)) } +/** + * Logs the actions that the player took, adding text to the most recent action. + * @param scene The BattleScene. Used to get the log ID. + * @param floor The wave index to write to. + * @param action The text you want to add to the actions list. + * + * @see resetWaveActions + */ +export function appendAction(scene: BattleScene, floor: integer, action: string) { + if (localStorage.getItem(getLogID(scene)) == null) localStorage.setItem(getLogID(scene), JSON.stringify(newDocument(getMode(scene) + " Run"))) + var drpd = getDRPD(scene) + console.log("Append to Action", drpd) + var wv: Wave = getWave(drpd, floor, scene) + if (wv.double == undefined) + wv.double = false + if (wv.clearActionsFlag) { + console.log("Triggered clearActionsFlag") + wv.clearActionsFlag = false + wv.actions = [] + } + wv.actions[wv.actions.length - 1] = wv.actions[wv.actions.length - 1] + action + console.log(drpd) + localStorage.setItem(getLogID(scene), JSON.stringify(drpd)) +} /** * Logs that a Pokémon was captured. * @param scene The BattleScene. Used to get the log ID. diff --git a/src/phases.ts b/src/phases.ts index 7d22f02d4ab..60a9b99303d 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -6142,6 +6142,8 @@ export class AttemptCapturePhase extends PokemonPhase { this.scene.pokemonInfoContainer.show(pokemon, true); // Update new IVs this.scene.gameData.updateSpeciesDexIvs(pokemon.species.getRootSpeciesId(true), pokemon.ivs); + + LoggerTools.appendAction(this.scene, this.scene.currentBattle.waveIndex, ` (Catches ${pokemon.name})`) this.scene.ui.showText(i18next.t("battle:pokemonCaught", { pokemonName: pokemon.name }), null, () => { const end = () => { @@ -6192,7 +6194,7 @@ export class AttemptCapturePhase extends PokemonPhase { promptRelease(); } }); - }); + }, undefined, undefined, undefined, undefined, pokemon.name); }, () => { // NO LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, "Don't keep " + pokemon.name) @@ -6249,7 +6251,7 @@ export class AttemptRunPhase extends PokemonPhase { if (playerPokemon.randSeedInt(256) < escapeChance.value) { this.scene.playSound("flee"); - LoggerTools.logShop(this.scene, this.scene.currentBattle.waveIndex, "") + LoggerTools.logShop(this.scene, this.scene.currentBattle.waveIndex, "Fled") this.scene.queueMessage(i18next.t("battle:runAwaySuccess"), null, true, 500); this.scene.tweens.add({ diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 32ce45d2a63..1e2fd6f98f2 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -110,6 +110,8 @@ export default class PartyUiHandler extends MessageUiHandler { private tmMoveId: Moves; private showMovePp: boolean; + private incomingMon: string; + private iconAnimHandler: PokemonIconAnimHandler; private static FilterAll = (_pokemon: PlayerPokemon) => null; @@ -251,6 +253,7 @@ export default class PartyUiHandler extends MessageUiHandler { : PartyUiHandler.FilterAllMoves; this.tmMoveId = args.length > 5 && args[5] ? args[5] : Moves.NONE; this.showMovePp = args.length > 6 && args[6]; + this.incomingMon = args.length > 7 && args[7] ? args[7] : undefined this.partyContainer.setVisible(true); this.partyBg.setTexture(`party_bg${this.scene.currentBattle.double ? "_double" : ""}`); @@ -284,7 +287,15 @@ export default class PartyUiHandler extends MessageUiHandler { if (this.optionsMode) { const option = this.options[this.optionsCursor]; if (button === Button.ACTION) { + //console.log("Menu Action (" + option + " - targ " + PartyOption.RELEASE + ")") const pokemon = this.scene.getParty()[this.cursor]; + if (option === PartyOption.RELEASE) { + if (this.incomingMon != undefined) { + LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, `Add ${this.incomingMon}, replacing ${this.scene.getParty()[this.cursor].name} (Slot ${this.cursor + 1})`) + } else { + LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, `Release ${this.scene.getParty()[this.cursor].name} (Slot ${this.cursor + 1})`) + } + } if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && !this.transferMode && option !== PartyOption.CANCEL) { this.startTransfer(); this.clearOptions(); @@ -407,7 +418,6 @@ export default class PartyUiHandler extends MessageUiHandler { this.showText(i18next.t("partyUiHandler:releaseConfirmation", { pokemonName: pokemon.name }), null, () => { ui.setModeWithoutClear(Mode.CONFIRM, () => { ui.setMode(Mode.PARTY); - LoggerTools.logActions(this.scene, this.scene.currentBattle.waveIndex, `Add ${pokemon.name} to party, replacing ${this.scene.getParty()[this.cursor].name} (Slot ${this.cursor + 1})`) this.doRelease(this.cursor); }, () => { ui.setMode(Mode.PARTY);