Merge branch 'beta' into move-use-type
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 5.5 KiB |
@ -32,11 +32,10 @@ describe("{{description}}", () => {
|
|||||||
.enemyLevel(100);
|
.enemyLevel(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should do X", async () => {
|
it("should do XYZ", async () => {
|
||||||
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
await game.classicMode.startBattle([SpeciesId.FEEBAS]);
|
||||||
|
|
||||||
game.move.use(MoveId.SPLASH);
|
game.move.use(MoveId.SPLASH);
|
||||||
|
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(true).toBe(true);
|
expect(true).toBe(true);
|
||||||
|
13
src/enums/confirm-ui-mode.ts
Normal file
@ -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];
|
@ -12,6 +12,7 @@ import { UiMode } from "#enums/ui-mode";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
|
import { ConfirmUiMode } from "#enums/confirm-ui-mode";
|
||||||
import { LearnMoveType } from "#enums/learn-move-type";
|
import { LearnMoveType } from "#enums/learn-move-type";
|
||||||
|
|
||||||
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
||||||
@ -163,6 +164,10 @@ export class LearnMovePhase extends PlayerPartyMemberPokemonPhase {
|
|||||||
globalScene.ui.setMode(this.messageMode);
|
globalScene.ui.setMode(this.messageMode);
|
||||||
this.replaceMoveCheck(move, pokemon);
|
this.replaceMoveCheck(move, pokemon);
|
||||||
},
|
},
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
ConfirmUiMode.DEFAULT_NO,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,19 +174,7 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
party[this.slotIndex] = this.lastPokemon;
|
party[this.slotIndex] = this.lastPokemon;
|
||||||
party[this.fieldIndex] = switchedInPokemon;
|
party[this.fieldIndex] = switchedInPokemon;
|
||||||
const showTextAndSummon = () => {
|
const showTextAndSummon = () => {
|
||||||
globalScene.ui.showText(
|
globalScene.ui.showText(this.getSendOutText(switchedInPokemon));
|
||||||
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(),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If this switch is passing a Substitute, make the switched Pokemon matches the returned Pokemon's state as it left.
|
* 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.
|
* Otherwise, clear any persisting tags on the returned Pokemon.
|
||||||
@ -265,4 +253,32 @@ export class SwitchSummonPhase extends SummonPhase {
|
|||||||
queuePostSummon(): void {
|
queuePostSummon(): void {
|
||||||
globalScene.phaseManager.unshiftNew("PostSummonPhase", this.getPokemon().getBattlerIndex());
|
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(),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,11 @@ import { UiMode } from "#enums/ui-mode";
|
|||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { Button } from "#enums/buttons";
|
import { Button } from "#enums/buttons";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
|
import { ConfirmUiMode } from "#enums/confirm-ui-mode";
|
||||||
|
|
||||||
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
export default class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
|
||||||
|
private confirmUiMode: ConfirmUiMode;
|
||||||
|
|
||||||
public static readonly windowWidth: number = 48;
|
public static readonly windowWidth: number = 48;
|
||||||
|
|
||||||
private switchCheck: boolean;
|
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.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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,10 @@ describe("Learn Move Phase", () => {
|
|||||||
game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
|
game.onNextPrompt("LearnMovePhase", UiMode.CONFIRM, () => {
|
||||||
game.scene.ui.processInput(Button.ACTION);
|
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);
|
await game.phaseInterceptor.to(LearnMovePhase);
|
||||||
|
|
||||||
const levelReq = bulbasaur.getLevelMoves(5)[0][0];
|
const levelReq = bulbasaur.getLevelMoves(5)[0][0];
|
||||||
|