diff --git a/public/images/types_ca.png b/public/images/types_ca.png index e85c84ed9c9..a1c295d7b9b 100644 Binary files a/public/images/types_ca.png and b/public/images/types_ca.png differ diff --git a/public/images/types_es-ES.png b/public/images/types_es-ES.png index 8a321e515c4..3596b7f6a0a 100644 Binary files a/public/images/types_es-ES.png and b/public/images/types_es-ES.png differ diff --git a/public/images/types_es-MX.png b/public/images/types_es-MX.png index 134a68258cc..ad159a7c6bb 100644 Binary files a/public/images/types_es-MX.png and b/public/images/types_es-MX.png differ diff --git a/public/images/types_pt-BR.png b/public/images/types_pt-BR.png index 88e3dd98e9d..71bb1471ff2 100644 Binary files a/public/images/types_pt-BR.png and b/public/images/types_pt-BR.png differ diff --git a/public/images/types_ru.png b/public/images/types_ru.png index 571e162e8dc..1e0615f721f 100644 Binary files a/public/images/types_ru.png and b/public/images/types_ru.png differ diff --git a/public/images/types_tr.png b/public/images/types_tr.png index 8b644f1041c..93eae27caa0 100644 Binary files a/public/images/types_tr.png and b/public/images/types_tr.png differ diff --git a/public/images/types_zh-CN.png b/public/images/types_zh-CN.png index a1a41a663fd..e1927ad9d3b 100644 Binary files a/public/images/types_zh-CN.png and b/public/images/types_zh-CN.png differ diff --git a/scripts/create-test/test-boilerplate.ts b/scripts/create-test/test-boilerplate.ts index 337b5269c3c..40912be6c5f 100644 --- a/scripts/create-test/test-boilerplate.ts +++ b/scripts/create-test/test-boilerplate.ts @@ -32,11 +32,10 @@ describe("{{description}}", () => { .enemyLevel(100); }); - it("should do X", async () => { + it("should do XYZ", async () => { await game.classicMode.startBattle([SpeciesId.FEEBAS]); game.move.use(MoveId.SPLASH); - await game.toEndOfTurn(); expect(true).toBe(true); diff --git a/src/enums/confirm-ui-mode.ts b/src/enums/confirm-ui-mode.ts new file mode 100644 index 00000000000..46bc42374cd --- /dev/null +++ b/src/enums/confirm-ui-mode.ts @@ -0,0 +1,13 @@ +// biome-ignore lint/correctness/noUnusedImports: Used in tsdoc +import type ConfirmUiHandler from "#app/ui/confirm-ui-handler"; + +/** + * Used by {@linkcode ConfirmUiHandler} to determine whether the cursor should start on Yes or No + */ +export const ConfirmUiMode = Object.freeze({ + /** Start cursor on Yes */ + DEFAULT_YES: 1, + /** Start cursor on No */ + DEFAULT_NO: 2 +}); +export type ConfirmUiMode = typeof ConfirmUiMode[keyof typeof ConfirmUiMode]; \ No newline at end of file diff --git a/src/phases/learn-move-phase.ts b/src/phases/learn-move-phase.ts index e24efa63b5a..e197f876d76 100644 --- a/src/phases/learn-move-phase.ts +++ b/src/phases/learn-move-phase.ts @@ -12,6 +12,7 @@ import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase"; import type Pokemon from "#app/field/pokemon"; +import { ConfirmUiMode } from "#enums/confirm-ui-mode"; import { LearnMoveType } from "#enums/learn-move-type"; export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { @@ -163,6 +164,10 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase { globalScene.ui.setMode(this.messageMode); this.replaceMoveCheck(move, pokemon); }, + false, + 0, + 0, + ConfirmUiMode.DEFAULT_NO, ); } diff --git a/src/phases/switch-summon-phase.ts b/src/phases/switch-summon-phase.ts index f6395397920..71136be0c93 100644 --- a/src/phases/switch-summon-phase.ts +++ b/src/phases/switch-summon-phase.ts @@ -174,19 +174,7 @@ export class SwitchSummonPhase extends SummonPhase { party[this.slotIndex] = this.lastPokemon; party[this.fieldIndex] = switchedInPokemon; const showTextAndSummon = () => { - globalScene.ui.showText( - this.player - ? i18next.t("battle:playerGo", { - pokemonName: getPokemonNameWithAffix(switchedInPokemon), - }) - : i18next.t("battle:trainerGo", { - trainerName: globalScene.currentBattle.trainer?.getName( - !(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER, - ), - pokemonName: this.getPokemon().getNameToRender(), - }), - ); - + globalScene.ui.showText(this.getSendOutText(switchedInPokemon)); /** * If this switch is passing a Substitute, make the switched Pokemon matches the returned Pokemon's state as it left. * Otherwise, clear any persisting tags on the returned Pokemon. @@ -265,4 +253,32 @@ export class SwitchSummonPhase extends SummonPhase { queuePostSummon(): void { globalScene.phaseManager.unshiftNew("PostSummonPhase", this.getPokemon().getBattlerIndex()); } + + /** + * Get the text to be displayed when a pokemon is forced to switch and leave the field. + * @param switchedInPokemon - The Pokemon having newly been sent in. + * @returns The text to display. + */ + private getSendOutText(switchedInPokemon: Pokemon): string { + if (this.switchType === SwitchType.FORCE_SWITCH) { + // "XYZ was dragged out!" + return i18next.t("battle:pokemonDraggedOut", { + pokemonName: getPokemonNameWithAffix(switchedInPokemon), + }); + } + if (this.player) { + // "Go! XYZ!" + return i18next.t("battle:playerGo", { + pokemonName: getPokemonNameWithAffix(switchedInPokemon), + }); + } + + // "Trainer sent out XYZ!" + return i18next.t("battle:trainerGo", { + trainerName: globalScene.currentBattle.trainer?.getName( + !(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER, + ), + pokemonName: this.getPokemon().getNameToRender(), + }); + } } diff --git a/src/ui/confirm-ui-handler.ts b/src/ui/confirm-ui-handler.ts index 7b5ca3d7e63..37fd50ca671 100644 --- a/src/ui/confirm-ui-handler.ts +++ b/src/ui/confirm-ui-handler.ts @@ -4,8 +4,11 @@ import { UiMode } from "#enums/ui-mode"; import i18next from "i18next"; import { Button } from "#enums/buttons"; import { globalScene } from "#app/global-scene"; +import { ConfirmUiMode } from "#enums/confirm-ui-mode"; export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler { + private confirmUiMode: ConfirmUiMode; + public static readonly windowWidth: number = 48; private switchCheck: boolean; @@ -105,7 +108,16 @@ export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler { this.optionSelectContainer.setPosition(globalScene.game.canvas.width / 6 - 1 + xOffset, -48 + yOffset); - this.setCursor(this.switchCheck ? this.switchCheckCursor : 0); + this.confirmUiMode = args.length >= 6 ? (args[5] as ConfirmUiMode) : ConfirmUiMode.DEFAULT_YES; + + switch (this.confirmUiMode) { + case ConfirmUiMode.DEFAULT_YES: + this.setCursor(this.switchCheck ? this.switchCheckCursor : 0); + break; + case ConfirmUiMode.DEFAULT_NO: + this.setCursor(this.switchCheck ? this.switchCheckCursor : 1); + break; + } return true; } diff --git a/test/phases/learn-move-phase.test.ts b/test/phases/learn-move-phase.test.ts index 88b8187069b..05dbf71d1f4 100644 --- a/test/phases/learn-move-phase.test.ts +++ b/test/phases/learn-move-phase.test.ts @@ -92,6 +92,10 @@ describe("Learn Move Phase", () => { game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { game.scene.ui.processInput(Button.ACTION); }); + game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => { + game.scene.ui.setCursor(0); + game.scene.ui.processInput(Button.ACTION); + }); await game.phaseInterceptor.to(LearnMovePhase); const levelReq = bulbasaur.getLevelMoves(5)[0][0];