diff --git a/src/logger.ts b/src/logger.ts index 7d5e864e7bf..d6a23adc3d3 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -968,6 +968,27 @@ export function flagReset(scene: BattleScene, floor: integer = undefined) { console.log(drpd) localStorage.setItem(getLogID(scene), JSON.stringify(drpd)) } +export function flagResetIfExists(scene: BattleScene, floor: integer = undefined) { + 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: DRPD = JSON.parse(localStorage.getItem(getLogID(scene))) as DRPD; + drpd = updateLog(drpd); + var waveExists = false + for (var i = 0; i < drpd.waves.length; i++) { + if (drpd.waves[i] != undefined) { + if (drpd.waves[i].id == floor) { + waveExists = true; + } + } + } + if (!waveExists) return; + var wv = getWave(drpd, floor, scene) + wv.reload = true; + console.log(drpd) + localStorage.setItem(getLogID(scene), JSON.stringify(drpd)) +} /** * Prints a DRPD as a string, for saving it to your device. * @param inData The data to add on to. diff --git a/src/phases.ts b/src/phases.ts index 5e036c203a4..046ab6dc385 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1354,6 +1354,9 @@ export class EncounterPhase extends BattlePhase { const enemyField = this.scene.getEnemyField(); //LoggerTools.resetWave(this.scene, this.scene.currentBattle.waveIndex) + if (this.scene.lazyReloads) { + LoggerTools.flagResetIfExists(this.scene) + } LoggerTools.logTeam(this.scene, this.scene.currentBattle.waveIndex) if (this.scene.getEnemyParty()[0].hasTrainer()) { LoggerTools.logTrainer(this.scene, this.scene.currentBattle.waveIndex) @@ -1362,9 +1365,6 @@ export class EncounterPhase extends BattlePhase { LoggerTools.logPlayerTeam(this.scene) } LoggerTools.resetWaveActions(this.scene) - if (this.scene.lazyReloads && this.loaded) { - LoggerTools.flagReset(this.scene) - } if (this.scene.currentBattle.battleType === BattleType.WILD) { enemyField.forEach(enemyPokemon => { diff --git a/src/ui/arena-flyout.ts b/src/ui/arena-flyout.ts index 9c0a2e7c8ce..fbd67d9521a 100644 --- a/src/ui/arena-flyout.ts +++ b/src/ui/arena-flyout.ts @@ -9,6 +9,7 @@ import { BattleSceneEventType, TurnEndEvent } from "../events/battle-scene"; import { ArenaTagType } from "#enums/arena-tag-type"; import TimeOfDayWidget from "./time-of-day-widget"; import * as Utils from "../utils"; +import { getNatureDecrease, getNatureIncrease, getNatureName } from "#app/data/nature.js"; /** Enum used to differentiate {@linkcode Arena} effects */ enum ArenaEffectType { @@ -193,12 +194,40 @@ export default class ArenaFlyout extends Phaser.GameObjects.Container { this.flyoutTextEnemy.text = ""; } + public printIVs() { + var poke = (this.scene as BattleScene).getEnemyField() + this.flyoutTextPlayer.text = "" + this.flyoutTextField.text = "" + this.flyoutTextEnemy.text = "" + this.flyoutTextHeaderField.text = "Stats" + this.flyoutTextHeaderPlayer.text = "" + this.flyoutTextHeaderEnemy.text = "" + this.flyoutTextHeader.text = "IVs" + for (var i = 0; i < poke.length; i++) { + if (i == 1 || true) { + this.flyoutTextPlayer.text += poke[i].name + "\n" + this.flyoutTextEnemy.text += poke[i].getAbility().name + " / " + (poke[i].isBoss() ? poke[i].getPassiveAbility().name + " / " : "") + getNatureName(poke[i].nature) + (getNatureIncrease(poke[i].nature) != "" ? " (+" + getNatureIncrease(poke[i].nature) + " -" + getNatureDecrease(poke[i].nature) + ")" : "") + "\n\n\n" + } + this.flyoutTextPlayer.text += "HP: " + poke[i].ivs[0] + this.flyoutTextPlayer.text += ", Atk: " + poke[i].ivs[1] + this.flyoutTextPlayer.text += ", Def: " + poke[i].ivs[2] + this.flyoutTextPlayer.text += ", Sp.A: " + poke[i].ivs[3] + this.flyoutTextPlayer.text += ", Sp.D: " + poke[i].ivs[4] + this.flyoutTextPlayer.text += ", Speed: " + poke[i].ivs[5] + "\n\n" + } + } + /** Parses through all set Arena Effects and puts them into the proper {@linkcode Phaser.GameObjects.Text} object */ - private updateFieldText() { + public updateFieldText() { this.clearText(); this.fieldEffectInfo.sort((infoA, infoB) => infoA.duration - infoB.duration); + this.flyoutTextHeaderPlayer.text = "Player" + this.flyoutTextHeaderField.text = "Neutral" + this.flyoutTextHeaderEnemy.text = "Enemy" + this.flyoutTextHeader.text = "Active Battle Effects" + for (let i = 0; i < this.fieldEffectInfo.length; i++) { const fieldEffectInfo = this.fieldEffectInfo[i]; diff --git a/src/ui/battle-info.ts b/src/ui/battle-info.ts index 01446a58931..5d066cfb154 100644 --- a/src/ui/battle-info.ts +++ b/src/ui/battle-info.ts @@ -443,6 +443,11 @@ export default class BattleInfo extends Phaser.GameObjects.Container { ease: "Sine.easeInOut", alpha: visible ? 1 : 0 }); + if (visible) { + (this.scene as BattleScene).arenaFlyout.printIVs() + } else { + (this.scene as BattleScene).arenaFlyout.updateFieldText() + } } updateBossSegments(pokemon: EnemyPokemon): void {