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.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;

View File

@ -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();