updated nested ternary, changed test name

This commit is contained in:
muscode13 2024-11-03 14:35:14 -06:00
parent 93a543c3a1
commit 8019d15e6d
2 changed files with 25 additions and 18 deletions

View File

@ -243,14 +243,11 @@ export class CommandPhase extends FieldPhase {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
this.scene.ui.setMode(Mode.MESSAGE); this.scene.ui.setMode(Mode.MESSAGE);
} }
const showNoEscapeText = (tag: any) => {
this.scene.ui.showText( this.scene.ui.showText(
i18next.t("battle:noEscapePokemon", { i18next.t("battle:noEscapePokemon", {
pokemonName: trapTag && trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId) pokemonName: tag.sourceId && this.scene.getPokemonById(tag.sourceId) ? getPokemonNameWithAffix(this.scene.getPokemonById(tag.sourceId)!) : "",
? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!) moveName: tag.getMoveName(),
: 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") escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee")
}), }),
null, null,
@ -259,7 +256,17 @@ export class CommandPhase extends FieldPhase {
if (!isSwitch) { if (!isSwitch) {
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex); this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
} }
}, null, true); },
null,
true
);
};
if (trapTag) {
showNoEscapeText(trapTag);
} else if (fairyLockTag) {
showNoEscapeText(fairyLockTag);
}
} }
} }
break; break;

View File

@ -33,7 +33,7 @@ describe("Moves - Fairy Lock", () => {
.enemyMoveset([ Moves.SPLASH, Moves.U_TURN ]); .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 ]); await game.classicMode.startBattle([ Species.KLEFKI, Species.TYRUNT ]);
const playerPokemon = game.scene.getPlayerField(); const playerPokemon = game.scene.getPlayerField();
const enemyField = game.scene.getEnemyField(); const enemyField = game.scene.getEnemyField();