Fix modifier select screen transition issue
This commit is contained in:
parent
362a94c658
commit
29771cfa8e
|
@ -1863,16 +1863,17 @@ 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];
|
||||||
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true).then(success => {
|
this.scene.tryTransferHeldItemModifier(itemModifier, party[toSlotIndex], true).then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
|
this.scene.ui.setMode(Mode.MODIFIER_SELECT, typeOptions, modifierSelectCallback);
|
||||||
|
@ -1886,14 +1887,15 @@ 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])
|
||||||
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
: modifierType.newModifier(party[slotIndex], option - PartyOption.MOVE_1);
|
||||||
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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue