diff --git a/src/phases/command-phase.ts b/src/phases/command-phase.ts index c870be6813f..c1d38815c2f 100644 --- a/src/phases/command-phase.ts +++ b/src/phases/command-phase.ts @@ -243,23 +243,30 @@ export class CommandPhase extends FieldPhase { this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.MESSAGE); } - this.scene.ui.showText( - i18next.t("battle:noEscapePokemon", { - pokemonName: trapTag && trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId) - ? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!) - : fairyLockTag && fairyLockTag.sourceId && this.scene.getPokemonById(fairyLockTag.sourceId) - ? getPokemonNameWithAffix(this.scene.getPokemonById(fairyLockTag.sourceId)!) - : "", - moveName: trapTag ? trapTag.getMoveName() : fairyLockTag ? fairyLockTag.getMoveName() : "", - escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee") - }), - null, - () => { - this.scene.ui.showText("", 0); - if (!isSwitch) { - this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); - } - }, null, true); + const showNoEscapeText = (tag: any) => { + this.scene.ui.showText( + i18next.t("battle:noEscapePokemon", { + pokemonName: tag.sourceId && this.scene.getPokemonById(tag.sourceId) ? getPokemonNameWithAffix(this.scene.getPokemonById(tag.sourceId)!) : "", + moveName: tag.getMoveName(), + escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee") + }), + null, + () => { + this.scene.ui.showText("", 0); + if (!isSwitch) { + this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); + } + }, + null, + true + ); + }; + + if (trapTag) { + showNoEscapeText(trapTag); + } else if (fairyLockTag) { + showNoEscapeText(fairyLockTag); + } } } break; diff --git a/src/test/moves/fairy_lock.test.ts b/src/test/moves/fairy_lock.test.ts index 49678dc32ba..ceb298ed0fe 100644 --- a/src/test/moves/fairy_lock.test.ts +++ b/src/test/moves/fairy_lock.test.ts @@ -33,7 +33,7 @@ describe("Moves - Fairy Lock", () => { .enemyMoveset([ Moves.SPLASH, Moves.U_TURN ]); }); - it("Applies Fairy Lock tag for one turn, then apply Trapped tag for one turn", async () => { + it("Applies Fairy Lock tag for two turns", async () => { await game.classicMode.startBattle([ Species.KLEFKI, Species.TYRUNT ]); const playerPokemon = game.scene.getPlayerField(); const enemyField = game.scene.getEnemyField();