From fc1a9f02837af4ebd5aee428e80d886a7b158e17 Mon Sep 17 00:00:00 2001 From: thicco-catto <67873211+thicco-catto@users.noreply.github.com> Date: Wed, 1 May 2024 16:16:58 +0200 Subject: [PATCH] Select Move UI Shows PP (#372) * Select move UI shows PP * Removed testing forced max pp * PP only shows when using PP restoring items * Removed testing max pp again * Update src/phases.ts * Update src/ui/party-ui-handler.ts --------- Co-authored-by: Samuel H --- src/phases.ts | 5 +++-- src/ui/party-ui-handler.ts | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/phases.ts b/src/phases.ts index ceba555f2..ad2a7537d 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -19,7 +19,7 @@ import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } fr import { biomeLinks, getBiomeName } from "./data/biomes"; import { Biome } from "./data/enums/biome"; import { ModifierTier } from "./modifier/modifier-tier"; -import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type"; +import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, PokemonPpRestoreModifierType, PokemonPpUpModifierType, RememberMoveModifierType, TmModifierType, getDailyRunStarterModifiers, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptions, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags"; import { BattlerTagType } from "./data/enums/battler-tag-type"; @@ -4340,6 +4340,7 @@ export class SelectModifierPhase extends BattlePhase { const isMoveModifier = modifierType instanceof PokemonMoveModifierType; const isTmModifier = modifierType instanceof TmModifierType; const isRememberMoveModifier = modifierType instanceof RememberMoveModifierType; + const isPpRestoreModifier = modifierType instanceof PokemonPpRestoreModifierType; const partyUiMode = isMoveModifier ? PartyUiMode.MOVE_MODIFIER : isTmModifier ? PartyUiMode.TM_MODIFIER : isRememberMoveModifier ? PartyUiMode.REMEMBER_MOVE_MODIFIER @@ -4359,7 +4360,7 @@ export class SelectModifierPhase extends BattlePhase { }); } else this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)); - }, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId); + }, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined, tmMoveId, isPpRestoreModifier); } } else applyModifier(modifierType.newModifier()); diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 29a4037f1..35014fa70 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -90,6 +90,7 @@ export default class PartyUiHandler extends MessageUiHandler { private selectFilter: PokemonSelectFilter | PokemonModifierTransferSelectFilter; private moveSelectFilter: PokemonMoveSelectFilter; private tmMoveId: Moves; + private showMovePp: boolean; private iconAnimHandler: PokemonIconAnimHandler; @@ -185,6 +186,7 @@ export default class PartyUiHandler extends MessageUiHandler { ? args[4] as PokemonMoveSelectFilter : PartyUiHandler.FilterAllMoves; this.tmMoveId = args.length > 5 && args[5] ? args[5] : Moves.NONE; + this.showMovePp = args.length > 6 && args[6]; this.partyContainer.setVisible(true); this.partyBg.setTexture(`party_bg${this.scene.currentBattle.double ? '_double' : ''}`); @@ -663,7 +665,14 @@ export default class PartyUiHandler extends MessageUiHandler { case PartyOption.MOVE_2: case PartyOption.MOVE_3: case PartyOption.MOVE_4: - optionName = pokemon.moveset[option - PartyOption.MOVE_1].getName(); + const move = pokemon.moveset[option - PartyOption.MOVE_1]; + if(this.showMovePp) { + const maxPP = move.getMovePp(); + const currPP = maxPP - move.ppUsed; + optionName = `${move.getName()} ${currPP}/${maxPP}`; + } else { + optionName = move.getName(); + } break; default: if (formChangeItemModifiers && option >= PartyOption.FORM_CHANGE_ITEM) {