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,23 +243,30 @@ 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);
} }
this.scene.ui.showText( const showNoEscapeText = (tag: any) => {
i18next.t("battle:noEscapePokemon", { this.scene.ui.showText(
pokemonName: trapTag && trapTag.sourceId && this.scene.getPokemonById(trapTag.sourceId) i18next.t("battle:noEscapePokemon", {
? getPokemonNameWithAffix(this.scene.getPokemonById(trapTag.sourceId)!) pokemonName: tag.sourceId && this.scene.getPokemonById(tag.sourceId) ? getPokemonNameWithAffix(this.scene.getPokemonById(tag.sourceId)!) : "",
: fairyLockTag && fairyLockTag.sourceId && this.scene.getPokemonById(fairyLockTag.sourceId) moveName: tag.getMoveName(),
? getPokemonNameWithAffix(this.scene.getPokemonById(fairyLockTag.sourceId)!) escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee")
: "", }),
moveName: trapTag ? trapTag.getMoveName() : fairyLockTag ? fairyLockTag.getMoveName() : "", null,
escapeVerb: isSwitch ? i18next.t("battle:escapeVerbSwitch") : i18next.t("battle:escapeVerbFlee") () => {
}), this.scene.ui.showText("", 0);
null, if (!isSwitch) {
() => { this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
this.scene.ui.showText("", 0); }
if (!isSwitch) { },
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();