Applied various review comments 0.5

This commit is contained in:
Bertie690 2025-09-12 23:59:46 -04:00
parent 3aaf2184c3
commit ff2c706dd4
5 changed files with 47 additions and 23 deletions

View File

@ -173,6 +173,7 @@ export class BattleScene extends SceneBase {
public sessionPlayTime: number | null = null; public sessionPlayTime: number | null = null;
public lastSavePlayTime: number | null = null; public lastSavePlayTime: number | null = null;
// TODO: move these settings into a settings helper object
public masterVolume = 0.5; public masterVolume = 0.5;
public bgmVolume = 1; public bgmVolume = 1;
public fieldVolume = 1; public fieldVolume = 1;

View File

@ -1,4 +1,4 @@
/** Defines the speed of gaining experience. */ /** Enum regulating the speed of EXP bar animations. */
export enum ExpGainsSpeed { export enum ExpGainsSpeed {
/** The normal speed. */ /** The normal speed. */
DEFAULT, DEFAULT,

View File

@ -58,9 +58,7 @@ describe("Abilities - Mimicry", () => {
expect(playerPokemon.getTypes()).toEqual([PokemonType.PSYCHIC]); expect(playerPokemon.getTypes()).toEqual([PokemonType.PSYCHIC]);
if (game.scene.arena.terrain) { game.scene.arena.terrain!.turnsLeft = 1;
game.scene.arena.terrain.turnsLeft = 1;
}
game.move.use(MoveId.SPLASH); game.move.use(MoveId.SPLASH);
await game.move.forceEnemyMove(MoveId.SPLASH); await game.move.forceEnemyMove(MoveId.SPLASH);

View File

@ -27,22 +27,41 @@ describe("Abilities - Screen Cleaner", () => {
.battleStyle("single") .battleStyle("single")
.ability(AbilityId.SCREEN_CLEANER) .ability(AbilityId.SCREEN_CLEANER)
.enemySpecies(SpeciesId.SHUCKLE) .enemySpecies(SpeciesId.SHUCKLE)
.weather(WeatherType.HAIL); .weather(WeatherType.SNOW);
}); });
// TODO: Screen cleaner doesn't remove both sides' tags if both players have them // TODO: Screen cleaner doesn't remove both sides' tags if both players have them (as do a LOT of other things)
it.todo.each([ it.todo.each([
{ name: "Reflect", tagType: ArenaTagType.REFLECT }, { name: "Reflect", tagType: ArenaTagType.REFLECT },
{ name: "Light Screen", tagType: ArenaTagType.LIGHT_SCREEN }, { name: "Light Screen", tagType: ArenaTagType.LIGHT_SCREEN },
{ name: "Aurora Veil", tagType: ArenaTagType.AURORA_VEIL }, { name: "Aurora Veil", tagType: ArenaTagType.AURORA_VEIL },
])("should remove $name from both sides of the field on entrance", async ({ tagType }) => { ])("should remove all instances of $name on entrance", async ({ tagType }) => {
game.scene.arena.addTag(tagType, 0, 0, 0, ArenaTagSide.PLAYER); game.scene.arena.addTag(tagType, 0, 0, 0, ArenaTagSide.PLAYER);
game.scene.arena.addTag(tagType, 0, 0, 0, ArenaTagSide.ENEMY); game.scene.arena.addTag(tagType, 0, 0, 0, ArenaTagSide.ENEMY);
game.scene.arena.addTag(tagType, 0, 0, 0, ArenaTagSide.BOTH);
expect(game).toHaveArenaTag(tagType); expect(game).toHaveArenaTag(tagType);
await game.classicMode.startBattle([SpeciesId.SLOWKING]); await game.classicMode.startBattle([SpeciesId.SLOWKING]);
const slowking = game.field.getPlayerPokemon(); const slowking = game.field.getPlayerPokemon();
expect(slowking).toHaveAbilityApplied(AbilityId.SCREEN_CLEANER); expect(slowking).toHaveAbilityApplied(AbilityId.SCREEN_CLEANER);
expect(game).not.toHaveArenaTag(tagType); expect(game).not.toHaveArenaTag(tagType);
}); });
it("should remove all tag types at once", async () => {
game.scene.arena.addTag(ArenaTagType.REFLECT, 0, 0, 0);
game.scene.arena.addTag(ArenaTagType.LIGHT_SCREEN, 0, 0, 0);
game.scene.arena.addTag(ArenaTagType.AURORA_VEIL, 0, 0, 0);
expect(game).toHaveArenaTag(ArenaTagType.REFLECT);
expect(game).toHaveArenaTag(ArenaTagType.LIGHT_SCREEN);
expect(game).toHaveArenaTag(ArenaTagType.AURORA_VEIL);
await game.classicMode.startBattle([SpeciesId.SLOWKING]);
const slowking = game.field.getPlayerPokemon();
expect(slowking).toHaveAbilityApplied(AbilityId.SCREEN_CLEANER);
expect(game).not.toHaveArenaTag(ArenaTagType.REFLECT);
expect(game).not.toHaveArenaTag(ArenaTagType.LIGHT_SCREEN);
expect(game).not.toHaveArenaTag(ArenaTagType.AURORA_VEIL);
});
}); });

View File

@ -9,8 +9,7 @@ import { getEnumStr } from "#test/test-utils/string-utils";
import chalk from "chalk"; import chalk from "chalk";
/** /**
* Helper to handle settings for tests * Helper to handle changing game settings for tests.
* @todo Why does this exist
*/ */
export class SettingsHelper extends GameManagerHelper { export class SettingsHelper extends GameManagerHelper {
constructor(game: GameManager) { constructor(game: GameManager) {
@ -19,6 +18,9 @@ export class SettingsHelper extends GameManagerHelper {
this.initDefaultSettings(); this.initDefaultSettings();
} }
/**
* Initialize default settings upon starting a new test case.
*/
private initDefaultSettings(): void { private initDefaultSettings(): void {
this.game.scene.gameSpeed = 5; this.game.scene.gameSpeed = 5;
this.game.scene.moveAnimations = false; this.game.scene.moveAnimations = false;
@ -33,42 +35,46 @@ export class SettingsHelper extends GameManagerHelper {
} }
/** /**
* Change the battle style to Switch or Set mode (tests default to {@linkcode BattleStyle.SET}) * Change the current {@linkcode BattleStyle}.
* @param style - The {@linkcode BattleStyle} to set * @param style - The `BattleStyle` to set
* @returns `this`
*/ */
battleStyle(style: BattleStyle): this { public battleStyle(style: BattleStyle): this {
this.game.scene.battleStyle = style; this.game.scene.battleStyle = style;
this.log(`Battle Style set to BattleStyle.${getEnumStr(BattleStyle, style)}!`); this.log(`Battle Style set to ${getEnumStr(BattleStyle, style)}!`);
return this; return this;
} }
/** /**
* Disable/Enable type hints settings * Toggle the availability of type hints.
* @param enable - Whether to enable or disable type hints. * @param enable - Whether to enable or disable type hints
* @returns `this` * @returns `this`
*/ */
typeHints(enable: boolean): this { public typeHints(enable: boolean): this {
this.game.scene.typeHints = enable; this.game.scene.typeHints = enable;
this.log(`Type Hints ${enable ? "enabled" : "disabled"}!`); this.log(`Type Hints ${enable ? "enabled" : "disabled"}!`);
return this; return this;
} }
/** /**
* Change the player gender * Change the player character's selected gender.
* @param gender - The {@linkcode PlayerGender} to set * @param gender - The {@linkcode PlayerGender} to set
* @returns `this`
*/ */
playerGender(gender: PlayerGender) { public playerGender(gender: PlayerGender): this {
this.game.scene.gameData.gender = gender; this.game.scene.gameData.gender = gender;
this.log(`Gender set to PlayerGender.${getEnumStr(PlayerGender, gender)}!`); this.log(`Gender set to ${getEnumStr(PlayerGender, gender)}!`);
return this;
} }
/** /**
* Change the exp gains speed * Change the current {@linkcode ExpGainsSpeed}.
* @param speed - the {@linkcode ExpGainsSpeed} to set * @param speed - The speed to set
* @returns `this`
*/ */
expGainsSpeed(speed: ExpGainsSpeed) { public expGainsSpeed(speed: ExpGainsSpeed): this {
this.game.scene.expGainsSpeed = speed; this.game.scene.expGainsSpeed = speed;
this.log(`Exp Gains Speed set to ExpGainsSpeed.${getEnumStr(ExpGainsSpeed, speed)}!`); this.log(`EXP Gain bar speed set to ${getEnumStr(ExpGainsSpeed, speed)}!`);
return this; return this;
} }