[Misc] Adding Type, Current HP, Max HP, & Status to updateGameInfo() (#4756)

* Adding to window.gameInfo

Added
type -> not working
currentHP -> not working
maxHP
status

* Adding to updateGameInfo()

* Update pokemon.ts

* Modifying battle-scene.ts

Added code to get Form and Tera Type
Typo fixed in pokemon.ts

* Output type names/etc instead of numbers

---------

Co-authored-by: ThePsychedelicSeal <trevorlrichfield@gmail.com>
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
This commit is contained in:
ThePsychedelicSeal 2024-11-06 09:42:39 -07:00 committed by GitHub
parent 6b7efb444b
commit 9dae28f264
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 5 deletions

View File

@ -38,7 +38,7 @@ import PokemonData from "#app/system/pokemon-data";
import { Nature } from "#app/data/nature";
import { FormChangeItem, pokemonFormChanges, SpeciesFormChange, SpeciesFormChangeManualTrigger, SpeciesFormChangeTimeOfDayTrigger, SpeciesFormChangeTrigger } from "#app/data/pokemon-forms";
import { FormChangePhase } from "#app/phases/form-change-phase";
import { getTypeRgb } from "#app/data/type";
import { getTypeRgb, Type } from "#app/data/type";
import PokemonSpriteSparkleHandler from "#app/field/pokemon-sprite-sparkle-handler";
import CharSprite from "#app/ui/char-sprite";
import DamageNumberHandler from "#app/field/damage-number-handler";
@ -98,6 +98,7 @@ import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
import { ExpGainsSpeed } from "#enums/exp-gains-speed";
import { BattlerTagType } from "#enums/battler-tag-type";
import { FRIENDSHIP_GAIN_FROM_BATTLE } from "#app/data/balance/starters";
import { StatusEffect } from "#enums/status-effect";
export const bypassLogin = import.meta.env.VITE_BYPASS_LOGIN === "1";
@ -2982,12 +2983,21 @@ export default class BattleScene extends SceneBase {
updateGameInfo(): void {
const gameInfo = {
playTime: this.sessionPlayTime ? this.sessionPlayTime : 0,
playTime: this.sessionPlayTime ?? 0,
gameMode: this.currentBattle ? this.gameMode.getName() : "Title",
biome: this.currentBattle ? getBiomeName(this.arena.biomeType) : "",
wave: this.currentBattle?.waveIndex || 0,
party: this.party ? this.party.map(p => {
return { name: p.name, level: p.level };
wave: this.currentBattle?.waveIndex ?? 0,
party: this.party ? this.party.map((p) => {
return {
name: p.name,
form: p.getFormKey(),
types: p.getTypes().map((type) => Type[type]),
teraType: p.getTeraType() !== Type.UNKNOWN ? Type[p.getTeraType()] : "",
level: p.level,
currentHP: p.hp,
maxHP: p.getMaxHp(),
status: p.status?.effect ? StatusEffect[p.status.effect] : ""
};
}) : [],
modeChain: this.ui?.getModeChain() ?? [],
};

View File

@ -32,6 +32,8 @@ export class CommandPhase extends FieldPhase {
start() {
super.start();
this.scene.updateGameInfo();
const commandUiHandler = this.scene.ui.handlers[Mode.COMMAND];
if (commandUiHandler) {
if (this.scene.currentBattle.turn === 1 || commandUiHandler.getCursor() === Command.POKEMON) {