Fix modifier select screen transition issue

This commit is contained in:
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,7 +1863,7 @@ export class SelectModifierPhase extends BattlePhase {
} else if (cursor >= typeOptions.length) { } else if (cursor >= typeOptions.length) {
this.scene.ui.setModeWithoutClear(Mode.PARTY, PartyUiMode.MODIFIER_TRANSFER, (fromSlotIndex: integer, itemIndex: integer, toSlotIndex: integer) => { 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) { if (toSlotIndex !== undefined && fromSlotIndex < 6 && toSlotIndex < 6 && fromSlotIndex !== toSlotIndex && itemIndex > -1) {
this.scene.ui.setMode(Mode.MODIFIER_SELECT); this.scene.ui.setMode(Mode.MODIFIER_SELECT).then(() => {
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
&& (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[]; && (m as PokemonHeldItemModifier).pokemonId === party[fromSlotIndex].id) as PokemonHeldItemModifier[];
const itemModifier = itemModifiers[itemIndex]; const itemModifier = itemModifiers[itemIndex];
@ -1874,6 +1874,7 @@ export class SelectModifierPhase extends BattlePhase {
} else } else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback); this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
}); });
});
} else } else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback); this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
}, PartyUiHandler.FilterItemMaxStacks); }, PartyUiHandler.FilterItemMaxStacks);
@ -1886,7 +1887,7 @@ export class SelectModifierPhase extends BattlePhase {
const isMoveModifier = modifierType instanceof PokemonMoveModifierType; const isMoveModifier = modifierType instanceof PokemonMoveModifierType;
this.scene.ui.setModeWithoutClear(Mode.PARTY, !isMoveModifier ? PartyUiMode.MODIFIER : PartyUiMode.MOVE_MODIFIER, (slotIndex: integer, option: PartyOption) => { this.scene.ui.setModeWithoutClear(Mode.PARTY, !isMoveModifier ? PartyUiMode.MODIFIER : PartyUiMode.MOVE_MODIFIER, (slotIndex: integer, option: PartyOption) => {
if (slotIndex < 6) { if (slotIndex < 6) {
this.scene.ui.setMode(Mode.MODIFIER_SELECT); this.scene.ui.setMode(Mode.MODIFIER_SELECT).then(() => {
const modifierType = typeOptions[cursor].type; const modifierType = typeOptions[cursor].type;
const modifier = !isMoveModifier const modifier = !isMoveModifier
? modifierType.newModifier(party[slotIndex]) ? modifierType.newModifier(party[slotIndex])
@ -1894,6 +1895,7 @@ export class SelectModifierPhase extends BattlePhase {
this.scene.addModifier(modifier, true).then(() => super.end()); this.scene.addModifier(modifier, true).then(() => super.end());
this.scene.ui.clearText(); this.scene.ui.clearText();
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
});
} else } else
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback); this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
}, pokemonModifierType.selectFilter, modifierType instanceof PokemonMoveModifierType ? (modifierType as PokemonMoveModifierType).moveSelectFilter : undefined); }, 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, targets: this.options,
scale: 0.01, scale: 0.01,
duration: 250, duration: 250,
ease: 'Elastic.easeIn', ease: 'Cubic.easeIn',
onComplete: () => { onComplete: () => {
this.options.forEach(o => o.destroy()); this.options.forEach(o => o.destroy());
this.options.splice(0, this.options.length); 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'; import BiomeSelectUiHandler from './biome-select-ui-handler';
export enum Mode { export enum Mode {
MESSAGE = 0, MESSAGE,
COMMAND, COMMAND,
FIGHT, FIGHT,
BALL, BALL,