[Bug][P1] Fix trapping abilities crashing game on switch out (#6293)

Move trapped messages into a .then() statement
This commit is contained in:
Wlowscha 2025-08-19 02:30:12 +02:00 committed by GitHub
parent 5500f2ff8d
commit 3d9cb539c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -474,20 +474,21 @@ export class CommandPhase extends FieldPhase {
}
if (trappedAbMessages.length > 0) {
if (isSwitch) {
globalScene.ui.setMode(UiMode.MESSAGE);
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
globalScene.ui.showText(
trappedAbMessages[0],
null,
() => {
globalScene.ui.showText("", 0);
if (isSwitch) {
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
}
},
null,
true,
);
});
}
globalScene.ui.showText(
trappedAbMessages[0],
null,
() => {
globalScene.ui.showText("", 0);
if (isSwitch) {
globalScene.ui.setMode(UiMode.COMMAND, this.fieldIndex);
}
},
null,
true,
);
} else {
const trapTag = playerPokemon.getTag(TrappedTag);
const fairyLockTag = globalScene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER);