Select modifier phase tentatively working with new held items

This commit is contained in:
Wlowscha 2025-05-29 23:46:35 +02:00
parent b32400e81a
commit 77f8cd9643
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -13,6 +13,7 @@ import {
PokemonPpUpModifierType, PokemonPpUpModifierType,
ModifierPoolType, ModifierPoolType,
getPlayerModifierTypeOptions, getPlayerModifierTypeOptions,
PokemonHeldItemReward,
} from "#app/modifier/modifier-type"; } from "#app/modifier/modifier-type";
import type { Modifier } from "#app/modifier/modifier"; import type { Modifier } from "#app/modifier/modifier";
import { import {
@ -158,6 +159,9 @@ export class SelectModifierPhase extends BattlePhase {
private applyChosenModifier(modifierType: ModifierType, cost: number, modifierSelectCallback): boolean { private applyChosenModifier(modifierType: ModifierType, cost: number, modifierSelectCallback): boolean {
if (modifierType! instanceof PokemonModifierType) { if (modifierType! instanceof PokemonModifierType) {
//TODO: is the bang correct? //TODO: is the bang correct?
if (modifierType instanceof PokemonHeldItemReward) {
this.openGiveHeldItemMenu(modifierType, modifierSelectCallback);
}
if (modifierType instanceof FusePokemonModifierType) { if (modifierType instanceof FusePokemonModifierType) {
this.openFusionMenu(modifierType, cost, modifierSelectCallback); this.openFusionMenu(modifierType, cost, modifierSelectCallback);
} else { } else {
@ -231,6 +235,26 @@ export class SelectModifierPhase extends BattlePhase {
return true; return true;
} }
private openGiveHeldItemMenu(reward, modifierSelectCallback) {
const party = globalScene.getPlayerParty();
const partyUiMode = PartyUiMode.MODIFIER;
globalScene.ui.setModeWithoutClear(
UiMode.PARTY,
partyUiMode,
-1,
(slotIndex: number, _option: PartyOption) => {
if (slotIndex < 6) {
globalScene.ui.setMode(UiMode.MODIFIER_SELECT, this.isPlayer()).then(() => {
party[slotIndex].heldItemManager.addHeldItem(reward.itemId);
});
} else {
this.resetModifierSelect(modifierSelectCallback);
}
},
reward.selectFilter,
);
}
// Toggle reroll lock // Toggle reroll lock
private toggleRerollLock() { private toggleRerollLock() {
const rerollCost = this.getRerollCost(globalScene.lockModifierTiers); const rerollCost = this.getRerollCost(globalScene.lockModifierTiers);