Fix modifier select screen transition issue

pull/1/head
Flashfyre 2023-04-22 11:46:52 -04:00
parent 362a94c658
commit 29771cfa8e
3 changed files with 22 additions and 20 deletions

View File

@ -1863,16 +1863,17 @@ export class SelectModifierPhase extends BattlePhase {
} else if (cursor >= typeOptions.length) {
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => {
if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
this.scene.ui.setMode(Mode.MODIFIER_SELECT);
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
const itemModifier = itemModifiers[itemIndex];
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true).then(success => {
if (success) {
this.scene.ui.clearText();
this.scene.ui.setMode(Mode.MESSAGE);
} else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
this.scene.ui.setMode(Mode.MODIFIER_SELECT).then(() => {
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
const itemModifier = itemModifiers[itemIndex];
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true).then(success => {
if (success) {
this.scene.ui.clearText();
this.scene.ui.setMode(Mode.MESSAGE);
} else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
});
});
} else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
@ -1886,14 +1887,15 @@ export class SelectModifierPhase extends BattlePhase {
const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
this.scene.ui.setModeWithoutClear(Mode.PARTY, !isMoveModifier ? PartyUiMode.MODIFIER : PartyUiMode.MOVE_MODIFIER, (slotIndex: integer, option: PartyOption) => {
if (slotIndex < 6) {
this.scene.ui.setMode(Mode.MODIFIER_SELECT);
const modifierType = typeOptions[cursor].type;
const modifier = !isMoveModifier
? modifierType.newModifier(party[slotIndex])
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
this.scene.addModifier(modifier, true).then(() => super.end());
this.scene.ui.clearText();
this.scene.ui.setMode(Mode.MESSAGE);
this.scene.ui.setMode(Mode.MODIFIER_SELECT).then(() => {
const modifierType = typeOptions[cursor].type;
const modifier = !isMoveModifier
? modifierType.newModifier(party[slotIndex])
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
this.scene.addModifier(modifier, true).then(() => super.end());
this.scene.ui.clearText();
this.scene.ui.setMode(Mode.MESSAGE);
});
} else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined);

View File

@ -212,7 +212,7 @@ export default class ModifierSelectUiHandler extends AwaitableUiHandler {
targets: this.options,
scale: 0.01,
duration: 250,
ease: 'Elastic.easeIn',
ease: 'Cubic.easeIn',
onComplete: () => {
this.options.forEach(o => o.destroy());
this.options.splice(0, this.options.length);

View File

@ -14,7 +14,7 @@ import EvolutionSceneHandler from './evolution-scene-handler';
import BiomeSelectUiHandler from './biome-select-ui-handler';
export enum Mode {
MESSAGE = 0,
MESSAGE,
COMMAND,
FIGHT,
BALL,