mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Select modifier phase tentatively working with new held items
This commit is contained in:
parent
b32400e81a
commit
77f8cd9643
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user