Fix reload(?) and add IV menu

This commit is contained in:
RedstonewolfX 2024-07-12 21:33:28 -04:00
parent 4d95fd0ca2
commit 798b57eb4f
4 changed files with 59 additions and 4 deletions

View File

@ -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.

View File

@ -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 => {

View File

@ -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];

View File

@ -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 {