diff --git a/src/phases/select-modifier-phase.ts b/src/phases/select-modifier-phase.ts index 9bd75ac85c4..bf5cad31cdd 100644 --- a/src/phases/select-modifier-phase.ts +++ b/src/phases/select-modifier-phase.ts @@ -13,6 +13,7 @@ import { PokemonPpUpModifierType, ModifierPoolType, getPlayerModifierTypeOptions, + PokemonHeldItemReward, } from "#app/modifier/modifier-type"; import type { Modifier } from "#app/modifier/modifier"; import { @@ -158,6 +159,9 @@ export class SelectModifierPhase extends BattlePhase { private applyChosenModifier(modifierType: ModifierType, cost: number, modifierSelectCallback): boolean { if (modifierType! instanceof PokemonModifierType) { //TODO: is the bang correct? + if (modifierType instanceof PokemonHeldItemReward) { + this.openGiveHeldItemMenu(modifierType, modifierSelectCallback); + } if (modifierType instanceof FusePokemonModifierType) { this.openFusionMenu(modifierType, cost, modifierSelectCallback); } else { @@ -231,6 +235,26 @@ export class SelectModifierPhase extends BattlePhase { 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 private toggleRerollLock() { const rerollCost = this.getRerollCost(globalScene.lockModifierTiers);