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 <flashfireex@gmail.com>
pull/379/head
thicco-catto 2024-05-01 16:16:58 +02:00 committed by GitHub
parent 3b09e176a2
commit fc1a9f0283
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View File

@ -19,7 +19,7 @@ import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } fr
import { biomeLinks, getBiomeName } from "./data/biomes"; import { biomeLinks, getBiomeName } from "./data/biomes";
import { Biome } from "./data/enums/biome"; import { Biome } from "./data/enums/biome";
import { ModifierTier } from "./modifier/modifier-tier"; 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 SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags"; import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags";
import { BattlerTagType } from "./data/enums/battler-tag-type"; import { BattlerTagType } from "./data/enums/battler-tag-type";
@ -4340,6 +4340,7 @@ export class SelectModifierPhase extends BattlePhase {
const isMoveModifier = modifierType instanceof PokemonMoveModifierType; const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
const isTmModifier = modifierType instanceof TmModifierType; const isTmModifier = modifierType instanceof TmModifierType;
const isRememberMoveModifier = modifierType instanceof RememberMoveModifierType; const isRememberMoveModifier = modifierType instanceof RememberMoveModifierType;
const isPpRestoreModifier = modifierType instanceof PokemonPpRestoreModifierType;
const partyUiMode = isMoveModifier ? PartyUiMode.MOVE_MODIFIER const partyUiMode = isMoveModifier ? PartyUiMode.MOVE_MODIFIER
: isTmModifier ? PartyUiMode.TM_MODIFIER : isTmModifier ? PartyUiMode.TM_MODIFIER
: isRememberMoveModifier ? PartyUiMode.REMEMBER_MOVE_MODIFIER : isRememberMoveModifier ? PartyUiMode.REMEMBER_MOVE_MODIFIER
@ -4359,7 +4360,7 @@ export class SelectModifierPhase extends BattlePhase {
}); });
} else } else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, this.isPlayer(), typeOptions, modifierSelectCallback, this.getRerollCost(typeOptions, this.scene.lockModifierTiers)); 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 } else
applyModifier(modifierType.newModifier()); applyModifier(modifierType.newModifier());

View File

@ -90,6 +90,7 @@ export default class PartyUiHandler extends MessageUiHandler {
private selectFilter: PokemonSelectFilter | PokemonModifierTransferSelectFilter; private selectFilter: PokemonSelectFilter | PokemonModifierTransferSelectFilter;
private moveSelectFilter: PokemonMoveSelectFilter; private moveSelectFilter: PokemonMoveSelectFilter;
private tmMoveId: Moves; private tmMoveId: Moves;
private showMovePp: boolean;
private iconAnimHandler: PokemonIconAnimHandler; private iconAnimHandler: PokemonIconAnimHandler;
@ -185,6 +186,7 @@ export default class PartyUiHandler extends MessageUiHandler {
? args[4] as PokemonMoveSelectFilter ? args[4] as PokemonMoveSelectFilter
: PartyUiHandler.FilterAllMoves; : PartyUiHandler.FilterAllMoves;
this.tmMoveId = args.length > 5 && args[5] ? args[5] : Moves.NONE; this.tmMoveId = args.length > 5 && args[5] ? args[5] : Moves.NONE;
this.showMovePp = args.length > 6 && args[6];
this.partyContainer.setVisible(true); this.partyContainer.setVisible(true);
this.partyBg.setTexture(`party_bg${this.scene.currentBattle.double ? '_double' : ''}`); 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_2:
case PartyOption.MOVE_3: case PartyOption.MOVE_3:
case PartyOption.MOVE_4: 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; break;
default: default:
if (formChangeItemModifiers && option >= PartyOption.FORM_CHANGE_ITEM) { if (formChangeItemModifiers && option >= PartyOption.FORM_CHANGE_ITEM) {