mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 17:29:30 +02:00
Fix capture logging
Logs when a Pokemon is released from your party to add another one to the team Logs who a Poke Ball caught, next to the instruction to use it, so there's never any confusion Marks the shop as "Flee" if you ran away from battle Added logger function to append text onto the most recently logged action
This commit is contained in:
parent
7d4c4118fe
commit
9d968917f5
@ -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.
|
||||
|
@ -6143,6 +6143,8 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||
// 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 = () => {
|
||||
this.scene.pokemonInfoContainer.hide();
|
||||
@ -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({
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user