Merge branch 'beta' into arena-trap-tests

This commit is contained in:
Sirz Benjie 2025-08-07 18:58:36 -06:00 committed by GitHub
commit 56770c0875
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
340 changed files with 3945 additions and 2905 deletions

@ -1 +1 @@
Subproject commit 7898c0018a70601a6ead76c9dd497ff966cc2e2a Subproject commit fa35780fed762017c89d1e9ece8a2779dff56c4d

View File

@ -15,3 +15,10 @@ export interface AccountRegisterRequest {
username: string; username: string;
password: string; password: string;
} }
export interface AccountChangePwRequest {
password: string;
}
export interface AccountChangePwResponse {
success: boolean;
}

View File

@ -16,7 +16,7 @@ export type * from "#moves/move";
* Map of move subclass names to their respective classes. * Map of move subclass names to their respective classes.
* Does not include the ChargeMove subclasses. For that, use `ChargingMoveClassMap`. * Does not include the ChargeMove subclasses. For that, use `ChargingMoveClassMap`.
* *
* @privateremarks * @privateRemarks
* The `never` field (`declare private _: never`) in some classes is necessary * The `never` field (`declare private _: never`) in some classes is necessary
* to ensure typescript does not improperly narrow a failed `is` guard to `never`. * to ensure typescript does not improperly narrow a failed `is` guard to `never`.
* *

View File

@ -242,8 +242,8 @@ export class BattleScene extends SceneBase {
public battleStyle: BattleStyle = BattleStyle.SWITCH; public battleStyle: BattleStyle = BattleStyle.SWITCH;
/** /**
* Defines whether or not to show type effectiveness hints * Defines whether or not to show type effectiveness hints
* - true: No hints * - true: Show hints for moves
* - false: Show hints for moves * - false: No hints
*/ */
public typeHints = false; public typeHints = false;
@ -478,8 +478,8 @@ export class BattleScene extends SceneBase {
this.uiContainer = uiContainer; this.uiContainer = uiContainer;
const overlayWidth = this.game.canvas.width / 6; const overlayWidth = this.scaledCanvas.width;
const overlayHeight = this.game.canvas.height / 6 - 48; const overlayHeight = this.scaledCanvas.height - 48;
this.fieldOverlay = this.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242); this.fieldOverlay = this.add.rectangle(0, overlayHeight * -1 - 48, overlayWidth, overlayHeight, 0x424242);
this.fieldOverlay.setName("rect-field-overlay"); this.fieldOverlay.setName("rect-field-overlay");
this.fieldOverlay.setOrigin(0, 0); this.fieldOverlay.setOrigin(0, 0);
@ -537,34 +537,29 @@ export class BattleScene extends SceneBase {
this.candyBar.setup(); this.candyBar.setup();
this.fieldUI.add(this.candyBar); this.fieldUI.add(this.candyBar);
this.biomeWaveText = addTextObject( this.biomeWaveText = addTextObject(this.scaledCanvas.width - 2, 0, startingWave.toString(), TextStyle.BATTLE_INFO);
this.game.canvas.width / 6 - 2,
0,
startingWave.toString(),
TextStyle.BATTLE_INFO,
);
this.biomeWaveText.setName("text-biome-wave"); this.biomeWaveText.setName("text-biome-wave");
this.biomeWaveText.setOrigin(1, 0.5); this.biomeWaveText.setOrigin(1, 0.5);
this.fieldUI.add(this.biomeWaveText); this.fieldUI.add(this.biomeWaveText);
this.moneyText = addTextObject(this.game.canvas.width / 6 - 2, 0, "", TextStyle.MONEY); this.moneyText = addTextObject(this.scaledCanvas.width - 2, 0, "", TextStyle.MONEY);
this.moneyText.setName("text-money"); this.moneyText.setName("text-money");
this.moneyText.setOrigin(1, 0.5); this.moneyText.setOrigin(1, 0.5);
this.fieldUI.add(this.moneyText); this.fieldUI.add(this.moneyText);
this.scoreText = addTextObject(this.game.canvas.width / 6 - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" }); this.scoreText = addTextObject(this.scaledCanvas.width - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.scoreText.setName("text-score"); this.scoreText.setName("text-score");
this.scoreText.setOrigin(1, 0.5); this.scoreText.setOrigin(1, 0.5);
this.fieldUI.add(this.scoreText); this.fieldUI.add(this.scoreText);
this.luckText = addTextObject(this.game.canvas.width / 6 - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" }); this.luckText = addTextObject(this.scaledCanvas.width - 2, 0, "", TextStyle.PARTY, { fontSize: "54px" });
this.luckText.setName("text-luck"); this.luckText.setName("text-luck");
this.luckText.setOrigin(1, 0.5); this.luckText.setOrigin(1, 0.5);
this.luckText.setVisible(false); this.luckText.setVisible(false);
this.fieldUI.add(this.luckText); this.fieldUI.add(this.luckText);
this.luckLabelText = addTextObject( this.luckLabelText = addTextObject(
this.game.canvas.width / 6 - 2, this.scaledCanvas.width - 2,
0, 0,
i18next.t("common:luckIndicator"), i18next.t("common:luckIndicator"),
TextStyle.PARTY, TextStyle.PARTY,
@ -586,10 +581,7 @@ export class BattleScene extends SceneBase {
this.spriteSparkleHandler = new PokemonSpriteSparkleHandler(); this.spriteSparkleHandler = new PokemonSpriteSparkleHandler();
this.spriteSparkleHandler.setup(); this.spriteSparkleHandler.setup();
this.pokemonInfoContainer = new PokemonInfoContainer( this.pokemonInfoContainer = new PokemonInfoContainer(this.scaledCanvas.width + 52, -this.scaledCanvas.height + 66);
this.game.canvas.width / 6 + 52,
-(this.game.canvas.height / 6) + 66,
);
this.pokemonInfoContainer.setup(); this.pokemonInfoContainer.setup();
this.fieldUI.add(this.pokemonInfoContainer); this.fieldUI.add(this.pokemonInfoContainer);
@ -2054,7 +2046,7 @@ export class BattleScene extends SceneBase {
} else { } else {
this.luckText.setTint(0xffef5c, 0x47ff69, 0x6b6bff, 0xff6969); this.luckText.setTint(0xffef5c, 0x47ff69, 0x6b6bff, 0xff6969);
} }
this.luckLabelText.setX(this.game.canvas.width / 6 - 2 - (this.luckText.displayWidth + 2)); this.luckLabelText.setX(this.scaledCanvas.width - 2 - (this.luckText.displayWidth + 2));
this.tweens.add({ this.tweens.add({
targets: labels, targets: labels,
duration: duration, duration: duration,
@ -2088,7 +2080,7 @@ export class BattleScene extends SceneBase {
const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible()).length; const enemyModifierCount = this.enemyModifiers.filter(m => m.isIconVisible()).length;
const biomeWaveTextHeight = this.biomeWaveText.getBottomLeft().y - this.biomeWaveText.getTopLeft().y; const biomeWaveTextHeight = this.biomeWaveText.getBottomLeft().y - this.biomeWaveText.getTopLeft().y;
this.biomeWaveText.setY( this.biomeWaveText.setY(
-(this.game.canvas.height / 6) + -this.scaledCanvas.height +
(enemyModifierCount ? (enemyModifierCount <= 12 ? 15 : 24) : 0) + (enemyModifierCount ? (enemyModifierCount <= 12 ? 15 : 24) : 0) +
biomeWaveTextHeight / 2, biomeWaveTextHeight / 2,
); );
@ -2100,7 +2092,7 @@ export class BattleScene extends SceneBase {
const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15; const offsetY = (this.scoreText.visible ? this.scoreText : this.moneyText).y + 15;
this.partyExpBar.setY(offsetY); this.partyExpBar.setY(offsetY);
this.candyBar.setY(offsetY + 15); this.candyBar.setY(offsetY + 15);
this.ui?.achvBar.setY(this.game.canvas.height / 6 + offsetY); this.ui?.achvBar.setY(this.scaledCanvas.height + offsetY);
} }
/** /**

View File

@ -1284,7 +1284,7 @@ export class PostDefendContactApplyTagChanceAbAttr extends PostDefendAbAttr {
/** /**
* Set stat stages when the user gets hit by a critical hit * Set stat stages when the user gets hit by a critical hit
* *
* @privateremarks * @privateRemarks
* It is the responsibility of the caller to ensure that this ability attribute is only applied * It is the responsibility of the caller to ensure that this ability attribute is only applied
* when the user has been hit by a critical hit; such an event is not checked here. * when the user has been hit by a critical hit; such an event is not checked here.
* *
@ -1768,7 +1768,7 @@ export interface AddSecondStrikeAbAttrParams extends Omit<AugmentMoveInteraction
/** /**
* Class for abilities that add additional strikes to single-target moves. * Class for abilities that add additional strikes to single-target moves.
* Used by {@linkcode Moves.PARENTAL_BOND | Parental Bond}. * Used by {@linkcode MoveId.PARENTAL_BOND | Parental Bond}.
*/ */
export class AddSecondStrikeAbAttr extends PreAttackAbAttr { export class AddSecondStrikeAbAttr extends PreAttackAbAttr {
/** /**
@ -2043,7 +2043,7 @@ export class AllyStatMultiplierAbAttr extends AbAttr {
/** /**
* @param stat - The stat being modified * @param stat - The stat being modified
* @param multipler - The multiplier to apply to the stat * @param multiplier - The multiplier to apply to the stat
* @param ignorable - Whether the multiplier can be ignored by mold breaker-like moves and abilities * @param ignorable - Whether the multiplier can be ignored by mold breaker-like moves and abilities
*/ */
constructor(stat: BattleStat, multiplier: number, ignorable = true) { constructor(stat: BattleStat, multiplier: number, ignorable = true) {
@ -6444,23 +6444,23 @@ export class PostDamageForceSwitchAbAttr extends PostDamageAbAttr {
public override canApply({ pokemon, source, damage }: PostDamageAbAttrParams): boolean { public override canApply({ pokemon, source, damage }: PostDamageAbAttrParams): boolean {
const moveHistory = pokemon.getMoveHistory(); const moveHistory = pokemon.getMoveHistory();
// Will not activate when the Pokémon's HP is lowered by cutting its own HP // Will not activate when the Pokémon's HP is lowered by cutting its own HP
const fordbiddenAttackingMoves = [MoveId.BELLY_DRUM, MoveId.SUBSTITUTE, MoveId.CURSE, MoveId.PAIN_SPLIT]; const forbiddenAttackingMoves = [MoveId.BELLY_DRUM, MoveId.SUBSTITUTE, MoveId.CURSE, MoveId.PAIN_SPLIT];
if (moveHistory.length > 0) { if (moveHistory.length > 0) {
const lastMoveUsed = moveHistory[moveHistory.length - 1]; const lastMoveUsed = moveHistory[moveHistory.length - 1];
if (fordbiddenAttackingMoves.includes(lastMoveUsed.move)) { if (forbiddenAttackingMoves.includes(lastMoveUsed.move)) {
return false; return false;
} }
} }
// Dragon Tail and Circle Throw switch out Pokémon before the Ability activates. // Dragon Tail and Circle Throw switch out Pokémon before the Ability activates.
const fordbiddenDefendingMoves = [MoveId.DRAGON_TAIL, MoveId.CIRCLE_THROW]; const forbiddenDefendingMoves = [MoveId.DRAGON_TAIL, MoveId.CIRCLE_THROW];
if (source) { if (source) {
const enemyMoveHistory = source.getMoveHistory(); const enemyMoveHistory = source.getMoveHistory();
if (enemyMoveHistory.length > 0) { if (enemyMoveHistory.length > 0) {
const enemyLastMoveUsed = enemyMoveHistory[enemyMoveHistory.length - 1]; const enemyLastMoveUsed = enemyMoveHistory[enemyMoveHistory.length - 1];
// Will not activate if the Pokémon's HP falls below half while it is in the air during Sky Drop. // Will not activate if the Pokémon's HP falls below half while it is in the air during Sky Drop.
if ( if (
fordbiddenDefendingMoves.includes(enemyLastMoveUsed.move) || forbiddenDefendingMoves.includes(enemyLastMoveUsed.move) ||
(enemyLastMoveUsed.move === MoveId.SKY_DROP && enemyLastMoveUsed.result === MoveResult.OTHER) (enemyLastMoveUsed.move === MoveId.SKY_DROP && enemyLastMoveUsed.result === MoveResult.OTHER)
) { ) {
return false; return false;

View File

@ -1641,10 +1641,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [], [BiomePoolTier.BOSS]: []
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.PLAINS]: { [BiomeId.PLAINS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.TWINS ], [BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.TWINS ],
@ -1652,10 +1649,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CILAN, TrainerType.CHILI, TrainerType.CRESS, TrainerType.CHEREN ], [BiomePoolTier.BOSS]: [ TrainerType.CILAN, TrainerType.CHILI, TrainerType.CRESS, TrainerType.CHEREN ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.GRASS]: { [BiomeId.GRASS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.SCHOOL_KID ], [BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.SCHOOL_KID ],
@ -1663,10 +1657,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.ERIKA ], [BiomePoolTier.BOSS]: [ TrainerType.ERIKA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.TALL_GRASS]: { [BiomeId.TALL_GRASS]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1674,10 +1665,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.GARDENIA, TrainerType.VIOLA, TrainerType.BRASSIUS ], [BiomePoolTier.BOSS]: [ TrainerType.GARDENIA, TrainerType.VIOLA, TrainerType.BRASSIUS ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.METROPOLIS]: { [BiomeId.METROPOLIS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.CLERK, TrainerType.CYCLIST, TrainerType.OFFICER, TrainerType.WAITER ], [BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.CLERK, TrainerType.CYCLIST, TrainerType.OFFICER, TrainerType.WAITER ],
@ -1685,10 +1673,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.ARTIST, TrainerType.RICH_KID ], [BiomePoolTier.RARE]: [ TrainerType.ARTIST, TrainerType.RICH_KID ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.WHITNEY, TrainerType.NORMAN, TrainerType.IONO, TrainerType.LARRY ], [BiomePoolTier.BOSS]: [ TrainerType.WHITNEY, TrainerType.NORMAN, TrainerType.IONO, TrainerType.LARRY ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.FOREST]: { [BiomeId.FOREST]: {
[BiomePoolTier.COMMON]: [ TrainerType.RANGER ], [BiomePoolTier.COMMON]: [ TrainerType.RANGER ],
@ -1696,10 +1681,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BUGSY, TrainerType.BURGH, TrainerType.KATY ], [BiomePoolTier.BOSS]: [ TrainerType.BUGSY, TrainerType.BURGH, TrainerType.KATY ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SEA]: { [BiomeId.SEA]: {
[BiomePoolTier.COMMON]: [ TrainerType.SAILOR, TrainerType.SWIMMER ], [BiomePoolTier.COMMON]: [ TrainerType.SAILOR, TrainerType.SWIMMER ],
@ -1707,10 +1689,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MARLON ], [BiomePoolTier.BOSS]: [ TrainerType.MARLON ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SWAMP]: { [BiomeId.SWAMP]: {
[BiomePoolTier.COMMON]: [ TrainerType.PARASOL_LADY ], [BiomePoolTier.COMMON]: [ TrainerType.PARASOL_LADY ],
@ -1718,10 +1697,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.JANINE, TrainerType.ROXIE ], [BiomePoolTier.BOSS]: [ TrainerType.JANINE, TrainerType.ROXIE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.BEACH]: { [BiomeId.BEACH]: {
[BiomePoolTier.COMMON]: [ TrainerType.FISHERMAN, TrainerType.SAILOR ], [BiomePoolTier.COMMON]: [ TrainerType.FISHERMAN, TrainerType.SAILOR ],
@ -1729,10 +1705,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MISTY, TrainerType.KOFU ], [BiomePoolTier.BOSS]: [ TrainerType.MISTY, TrainerType.KOFU ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.LAKE]: { [BiomeId.LAKE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.FISHERMAN, TrainerType.PARASOL_LADY ], [BiomePoolTier.COMMON]: [ TrainerType.BREEDER, TrainerType.FISHERMAN, TrainerType.PARASOL_LADY ],
@ -1740,21 +1713,15 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.RARE]: [ TrainerType.BLACK_BELT ],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CRASHER_WAKE ], [BiomePoolTier.BOSS]: [ TrainerType.CRASHER_WAKE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SEABED]: { [BiomeId.SEABED]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [ TrainerType.SWIMMER ],
[BiomePoolTier.UNCOMMON]: [], [BiomePoolTier.UNCOMMON]: [],
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.JUAN ], [BiomePoolTier.BOSS]: [ TrainerType.JUAN ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.MOUNTAIN]: { [BiomeId.MOUNTAIN]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.BLACK_BELT, TrainerType.HIKER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.BLACK_BELT, TrainerType.HIKER ],
@ -1762,10 +1729,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.FALKNER, TrainerType.WINONA, TrainerType.SKYLA ], [BiomePoolTier.BOSS]: [ TrainerType.FALKNER, TrainerType.WINONA, TrainerType.SKYLA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.BADLANDS]: { [BiomeId.BADLANDS]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ],
@ -1773,10 +1737,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CLAY, TrainerType.GRANT ], [BiomePoolTier.BOSS]: [ TrainerType.CLAY, TrainerType.GRANT ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.CAVE]: { [BiomeId.CAVE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.HIKER ],
@ -1784,10 +1745,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BROCK, TrainerType.ROXANNE, TrainerType.ROARK ], [BiomePoolTier.BOSS]: [ TrainerType.BROCK, TrainerType.ROXANNE, TrainerType.ROARK ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.DESERT]: { [BiomeId.DESERT]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.SCIENTIST ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.SCIENTIST ],
@ -1795,10 +1753,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.GORDIE ], [BiomePoolTier.BOSS]: [ TrainerType.GORDIE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.ICE_CAVE]: { [BiomeId.ICE_CAVE]: {
[BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ],
@ -1806,10 +1761,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.PRYCE, TrainerType.BRYCEN, TrainerType.WULFRIC, TrainerType.GRUSHA ], [BiomePoolTier.BOSS]: [ TrainerType.PRYCE, TrainerType.BRYCEN, TrainerType.WULFRIC, TrainerType.GRUSHA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.MEADOW]: { [BiomeId.MEADOW]: {
[BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.MUSICIAN, TrainerType.PARASOL_LADY ], [BiomePoolTier.COMMON]: [ TrainerType.BEAUTY, TrainerType.MUSICIAN, TrainerType.PARASOL_LADY ],
@ -1817,10 +1769,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.LENORA, TrainerType.MILO ], [BiomePoolTier.BOSS]: [ TrainerType.LENORA, TrainerType.MILO ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.POWER_PLANT]: { [BiomeId.POWER_PLANT]: {
[BiomePoolTier.COMMON]: [ TrainerType.GUITARIST, TrainerType.WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.GUITARIST, TrainerType.WORKER ],
@ -1828,10 +1777,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.VOLKNER, TrainerType.ELESA, TrainerType.CLEMONT ], [BiomePoolTier.BOSS]: [ TrainerType.VOLKNER, TrainerType.ELESA, TrainerType.CLEMONT ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.VOLCANO]: { [BiomeId.VOLCANO]: {
[BiomePoolTier.COMMON]: [ TrainerType.FIREBREATHER ], [BiomePoolTier.COMMON]: [ TrainerType.FIREBREATHER ],
@ -1839,10 +1785,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BLAINE, TrainerType.FLANNERY, TrainerType.KABU ], [BiomePoolTier.BOSS]: [ TrainerType.BLAINE, TrainerType.FLANNERY, TrainerType.KABU ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.GRAVEYARD]: { [BiomeId.GRAVEYARD]: {
[BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC ], [BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC ],
@ -1850,10 +1793,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MORTY, TrainerType.ALLISTER, TrainerType.RYME ], [BiomePoolTier.BOSS]: [ TrainerType.MORTY, TrainerType.ALLISTER, TrainerType.RYME ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.DOJO]: { [BiomeId.DOJO]: {
[BiomePoolTier.COMMON]: [ TrainerType.BLACK_BELT ], [BiomePoolTier.COMMON]: [ TrainerType.BLACK_BELT ],
@ -1861,10 +1801,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.BRAWLY, TrainerType.MAYLENE, TrainerType.KORRINA, TrainerType.BEA ], [BiomePoolTier.BOSS]: [ TrainerType.BRAWLY, TrainerType.MAYLENE, TrainerType.KORRINA, TrainerType.BEA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.FACTORY]: { [BiomeId.FACTORY]: {
[BiomePoolTier.COMMON]: [ TrainerType.WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.WORKER ],
@ -1872,10 +1809,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.JASMINE, TrainerType.BYRON ], [BiomePoolTier.BOSS]: [ TrainerType.JASMINE, TrainerType.BYRON ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.RUINS]: { [BiomeId.RUINS]: {
[BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC, TrainerType.SCIENTIST ], [BiomePoolTier.COMMON]: [ TrainerType.PSYCHIC, TrainerType.SCIENTIST ],
@ -1883,10 +1817,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.SABRINA, TrainerType.TATE, TrainerType.LIZA, TrainerType.TULIP ], [BiomePoolTier.BOSS]: [ TrainerType.SABRINA, TrainerType.TATE, TrainerType.LIZA, TrainerType.TULIP ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.WASTELAND]: { [BiomeId.WASTELAND]: {
[BiomePoolTier.COMMON]: [ TrainerType.VETERAN ], [BiomePoolTier.COMMON]: [ TrainerType.VETERAN ],
@ -1894,10 +1825,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CLAIR, TrainerType.DRAYDEN, TrainerType.RAIHAN ], [BiomePoolTier.BOSS]: [ TrainerType.CLAIR, TrainerType.DRAYDEN, TrainerType.RAIHAN ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.ABYSS]: { [BiomeId.ABYSS]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1905,10 +1833,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.MARNIE ], [BiomePoolTier.BOSS]: [ TrainerType.MARNIE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SPACE]: { [BiomeId.SPACE]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1916,10 +1841,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.OLYMPIA ], [BiomePoolTier.BOSS]: [ TrainerType.OLYMPIA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.CONSTRUCTION_SITE]: { [BiomeId.CONSTRUCTION_SITE]: {
[BiomePoolTier.COMMON]: [ TrainerType.OFFICER, TrainerType.WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.OFFICER, TrainerType.WORKER ],
@ -1927,10 +1849,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.LT_SURGE, TrainerType.CHUCK, TrainerType.WATTSON ], [BiomePoolTier.BOSS]: [ TrainerType.LT_SURGE, TrainerType.CHUCK, TrainerType.WATTSON ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.JUNGLE]: { [BiomeId.JUNGLE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.RANGER ], [BiomePoolTier.COMMON]: [ TrainerType.BACKPACKER, TrainerType.RANGER ],
@ -1938,10 +1857,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.RAMOS ], [BiomePoolTier.BOSS]: [ TrainerType.RAMOS ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.FAIRY_CAVE]: { [BiomeId.FAIRY_CAVE]: {
[BiomePoolTier.COMMON]: [ TrainerType.BEAUTY ], [BiomePoolTier.COMMON]: [ TrainerType.BEAUTY ],
@ -1949,10 +1865,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.VALERIE, TrainerType.OPAL, TrainerType.BEDE ], [BiomePoolTier.BOSS]: [ TrainerType.VALERIE, TrainerType.OPAL, TrainerType.BEDE ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.TEMPLE]: { [BiomeId.TEMPLE]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -1960,10 +1873,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.FANTINA ], [BiomePoolTier.BOSS]: [ TrainerType.FANTINA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SLUM]: { [BiomeId.SLUM]: {
[BiomePoolTier.COMMON]: [ TrainerType.BIKER, TrainerType.OFFICER, TrainerType.ROUGHNECK ], [BiomePoolTier.COMMON]: [ TrainerType.BIKER, TrainerType.OFFICER, TrainerType.ROUGHNECK ],
@ -1971,10 +1881,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.PIERS ], [BiomePoolTier.BOSS]: [ TrainerType.PIERS ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.SNOWY_FOREST]: { [BiomeId.SNOWY_FOREST]: {
[BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ], [BiomePoolTier.COMMON]: [ TrainerType.SNOW_WORKER ],
@ -1982,10 +1889,7 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.CANDICE, TrainerType.MELONY ], [BiomePoolTier.BOSS]: [ TrainerType.CANDICE, TrainerType.MELONY ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.ISLAND]: { [BiomeId.ISLAND]: {
[BiomePoolTier.COMMON]: [ TrainerType.RICH_KID ], [BiomePoolTier.COMMON]: [ TrainerType.RICH_KID ],
@ -1993,21 +1897,15 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.NESSA ], [BiomePoolTier.BOSS]: [ TrainerType.NESSA ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.LABORATORY]: { [BiomeId.LABORATORY]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [ TrainerType.SCIENTIST ],
[BiomePoolTier.UNCOMMON]: [], [BiomePoolTier.UNCOMMON]: [],
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [ TrainerType.GIOVANNI ], [BiomePoolTier.BOSS]: [ TrainerType.GIOVANNI ]
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
}, },
[BiomeId.END]: { [BiomeId.END]: {
[BiomePoolTier.COMMON]: [], [BiomePoolTier.COMMON]: [],
@ -2015,13 +1913,9 @@ export const biomeTrainerPools: BiomeTrainerPools = {
[BiomePoolTier.RARE]: [], [BiomePoolTier.RARE]: [],
[BiomePoolTier.SUPER_RARE]: [], [BiomePoolTier.SUPER_RARE]: [],
[BiomePoolTier.ULTRA_RARE]: [], [BiomePoolTier.ULTRA_RARE]: [],
[BiomePoolTier.BOSS]: [], [BiomePoolTier.BOSS]: []
[BiomePoolTier.BOSS_RARE]: [],
[BiomePoolTier.BOSS_SUPER_RARE]: [],
[BiomePoolTier.BOSS_ULTRA_RARE]: []
} }
}; };
export function initBiomes() { export function initBiomes() {
const pokemonBiomes = [ const pokemonBiomes = [
[ SpeciesId.BULBASAUR, PokemonType.GRASS, PokemonType.POISON, [ [ SpeciesId.BULBASAUR, PokemonType.GRASS, PokemonType.POISON, [

View File

@ -2055,7 +2055,7 @@ export class TruantTag extends AbilityBattlerTag {
const lastMove = pokemon.getLastXMoves()[0]; const lastMove = pokemon.getLastXMoves()[0];
if (!lastMove || lastMove.move === MoveId.NONE) { if (!lastMove || lastMove.move === MoveId.NONE) {
// Don't interrupt move if last move was `Moves.NONE` OR no prior move was found // Don't interrupt move if last move was `MoveId.NONE` OR no prior move was found
return true; return true;
} }
@ -2115,8 +2115,8 @@ export class SlowStartTag extends AbilityBattlerTag {
export class HighestStatBoostTag extends AbilityBattlerTag { export class HighestStatBoostTag extends AbilityBattlerTag {
public declare readonly tagType: HighestStatBoostTagType; public declare readonly tagType: HighestStatBoostTagType;
public stat: Stat; public stat: EffectiveStat = Stat.ATK;
public multiplier: number; public multiplier = 1.3;
constructor(tagType: HighestStatBoostTagType, ability: AbilityId) { constructor(tagType: HighestStatBoostTagType, ability: AbilityId) {
super(tagType, ability, BattlerTagLapseType.CUSTOM, 1); super(tagType, ability, BattlerTagLapseType.CUSTOM, 1);
@ -2128,28 +2128,28 @@ export class HighestStatBoostTag extends AbilityBattlerTag {
*/ */
public override loadTag<T extends this>(source: BaseBattlerTag & Pick<T, "tagType" | "stat" | "multiplier">): void { public override loadTag<T extends this>(source: BaseBattlerTag & Pick<T, "tagType" | "stat" | "multiplier">): void {
super.loadTag(source); super.loadTag(source);
this.stat = source.stat as Stat; this.stat = source.stat;
this.multiplier = source.multiplier; this.multiplier = source.multiplier;
} }
onAdd(pokemon: Pokemon): void { onAdd(pokemon: Pokemon): void {
super.onAdd(pokemon); super.onAdd(pokemon);
let highestStat: EffectiveStat; const highestStat = EFFECTIVE_STATS.reduce(
EFFECTIVE_STATS.map(s => (curr: [EffectiveStat, number], stat: EffectiveStat) => {
pokemon.getEffectiveStat(s, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true), const value = pokemon.getEffectiveStat(stat, undefined, undefined, true, true, true, false, true, true);
).reduce((highestValue: number, value: number, i: number) => { if (value > curr[1]) {
if (value > highestValue) { curr[0] = stat;
highestStat = EFFECTIVE_STATS[i]; curr[1] = value;
return value; }
} return curr;
return highestValue; },
}, 0); [Stat.ATK, 0],
)[0];
highestStat = highestStat!; // tell TS compiler it's defined!
this.stat = highestStat; this.stat = highestStat;
this.multiplier = this.stat === Stat.SPD ? 1.5 : 1.3; this.multiplier = highestStat === Stat.SPD ? 1.5 : 1.3;
globalScene.phaseManager.queueMessage( globalScene.phaseManager.queueMessage(
i18next.t("battlerTags:highestStatBoostOnAdd", { i18next.t("battlerTags:highestStatBoostOnAdd", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
@ -2614,7 +2614,7 @@ export class IceFaceBlockDamageTag extends FormBlockDamageTag {
*/ */
export class CommandedTag extends SerializableBattlerTag { export class CommandedTag extends SerializableBattlerTag {
public override readonly tagType = BattlerTagType.COMMANDED; public override readonly tagType = BattlerTagType.COMMANDED;
public readonly tatsugiriFormKey: string; public readonly tatsugiriFormKey: string = "curly";
constructor(sourceId: number) { constructor(sourceId: number) {
super(BattlerTagType.COMMANDED, BattlerTagLapseType.CUSTOM, 0, MoveId.NONE, sourceId); super(BattlerTagType.COMMANDED, BattlerTagLapseType.CUSTOM, 0, MoveId.NONE, sourceId);
@ -2668,7 +2668,7 @@ export class StockpilingTag extends SerializableBattlerTag {
super(BattlerTagType.STOCKPILING, BattlerTagLapseType.CUSTOM, 1, sourceMove); super(BattlerTagType.STOCKPILING, BattlerTagLapseType.CUSTOM, 1, sourceMove);
} }
private onStatStagesChanged: StatStageChangeCallback = (_, statsChanged, statChanges) => { private onStatStagesChanged(_: Pokemon | null, statsChanged: BattleStat[], statChanges: number[]) {
const defChange = statChanges[statsChanged.indexOf(Stat.DEF)] ?? 0; const defChange = statChanges[statsChanged.indexOf(Stat.DEF)] ?? 0;
const spDefChange = statChanges[statsChanged.indexOf(Stat.SPDEF)] ?? 0; const spDefChange = statChanges[statsChanged.indexOf(Stat.SPDEF)] ?? 0;
@ -2678,7 +2678,11 @@ export class StockpilingTag extends SerializableBattlerTag {
if (spDefChange) { if (spDefChange) {
this.statChangeCounts[Stat.SPDEF]++; this.statChangeCounts[Stat.SPDEF]++;
} }
};
// Removed during bundling; used to ensure this method's signature retains parity
// with the `StatStageChangeCallback` type.
this.onStatStagesChanged satisfies StatStageChangeCallback;
}
public override loadTag( public override loadTag(
source: BaseBattlerTag & Pick<StockpilingTag, "tagType" | "stockpiledCount" | "statChangeCounts">, source: BaseBattlerTag & Pick<StockpilingTag, "tagType" | "stockpiledCount" | "statChangeCounts">,
@ -2718,7 +2722,7 @@ export class StockpilingTag extends SerializableBattlerTag {
true, true,
false, false,
true, true,
this.onStatStagesChanged, this.onStatStagesChanged.bind(this),
); );
} }
} }

View File

@ -1,29 +1,26 @@
import type { FixedBattleConfig } from "#app/battle"; import type { FixedBattleConfig } from "#app/battle";
import { getRandomTrainerFunc } from "#app/battle"; import { getRandomTrainerFunc } from "#app/battle";
import { defaultStarterSpecies } from "#app/constants"; import { defaultStarterSpecies } from "#app/constants";
import { globalScene } from "#app/global-scene";
import { pokemonEvolutions } from "#balance/pokemon-evolutions";
import { speciesStarterCosts } from "#balance/starters"; import { speciesStarterCosts } from "#balance/starters";
import { pokemonFormChanges } from "#data/pokemon-forms";
import type { PokemonSpecies } from "#data/pokemon-species"; import type { PokemonSpecies } from "#data/pokemon-species";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";
import { ChallengeType } from "#enums/challenge-type";
import { Challenges } from "#enums/challenges"; import { Challenges } from "#enums/challenges";
import { TypeColor, TypeShadow } from "#enums/color"; import { TypeColor, TypeShadow } from "#enums/color";
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
import { ModifierTier } from "#enums/modifier-tier"; import { ModifierTier } from "#enums/modifier-tier";
import type { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import type { MoveSourceType } from "#enums/move-source-type"; import type { MoveSourceType } from "#enums/move-source-type";
import { Nature } from "#enums/nature"; import { Nature } from "#enums/nature";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { TrainerType } from "#enums/trainer-type"; import { TrainerType } from "#enums/trainer-type";
import { TrainerVariant } from "#enums/trainer-variant"; import { TrainerVariant } from "#enums/trainer-variant";
import type { Pokemon } from "#field/pokemon"; import type { EnemyPokemon, PlayerPokemon, Pokemon } from "#field/pokemon";
import { Trainer } from "#field/trainer"; import { Trainer } from "#field/trainer";
import type { ModifierTypeOption } from "#modifiers/modifier-type";
import { PokemonMove } from "#moves/pokemon-move"; import { PokemonMove } from "#moves/pokemon-move";
import type { DexAttrProps, GameData } from "#system/game-data"; import type { DexAttrProps, GameData } from "#system/game-data";
import { BooleanHolder, isBetween, type NumberHolder, randSeedItem } from "#utils/common"; import { type BooleanHolder, isBetween, type NumberHolder, randSeedItem } from "#utils/common";
import { deepCopy } from "#utils/data"; import { deepCopy } from "#utils/data";
import { getPokemonSpecies, getPokemonSpeciesForm } from "#utils/pokemon-utils"; import { getPokemonSpecies, getPokemonSpeciesForm } from "#utils/pokemon-utils";
import { toCamelCase, toSnakeCase } from "#utils/strings"; import { toCamelCase, toSnakeCase } from "#utils/strings";
@ -341,6 +338,83 @@ export abstract class Challenge {
applyFlipStat(_pokemon: Pokemon, _baseStats: number[]) { applyFlipStat(_pokemon: Pokemon, _baseStats: number[]) {
return false; return false;
} }
/**
* An apply function for PARTY_HEAL. Derived classes should alter this.
* @param _status - Whether party healing is enabled or not
* @returns Whether this function did anything
*/
applyPartyHeal(_status: BooleanHolder): boolean {
return false;
}
/**
* An apply function for SHOP. Derived classes should alter this.
* @param _status - Whether the shop is or is not available after a wave
* @returns Whether this function did anything
*/
applyShop(_status: BooleanHolder) {
return false;
}
/**
* An apply function for POKEMON_ADD_TO_PARTY. Derived classes should alter this.
* @param _pokemon - The pokemon being caught
* @param _status - Whether the pokemon can be added to the party or not
* @return Whether this function did anything
*/
applyPokemonAddToParty(_pokemon: EnemyPokemon, _status: BooleanHolder): boolean {
return false;
}
/**
* An apply function for POKEMON_FUSION. Derived classes should alter this.
* @param _pokemon - The pokemon being checked
* @param _status - Whether the selected pokemon is allowed to fuse or not
* @returns Whether this function did anything
*/
applyPokemonFusion(_pokemon: PlayerPokemon, _status: BooleanHolder): boolean {
return false;
}
/**
* An apply function for POKEMON_MOVE. Derived classes should alter this.
* @param _moveId - The {@linkcode MoveId} being checked
* @param _status - A {@linkcode BooleanHolder} containing the move's usability status
* @returns Whether this function did anything
*/
applyPokemonMove(_moveId: MoveId, _status: BooleanHolder): boolean {
return false;
}
/**
* An apply function for SHOP_ITEM. Derived classes should alter this.
* @param _shopItem - The item being checked
* @param _status - Whether the item should be added to the shop or not
* @returns Whether this function did anything
*/
applyShopItem(_shopItem: ModifierTypeOption | null, _status: BooleanHolder): boolean {
return false;
}
/**
* An apply function for WAVE_REWARD. Derived classes should alter this.
* @param _reward - The reward being checked
* @param _status - Whether the reward should be added to the reward options or not
* @returns Whether this function did anything
*/
applyWaveReward(_reward: ModifierTypeOption | null, _status: BooleanHolder): boolean {
return false;
}
/**
* An apply function for PREVENT_REVIVE. Derived classes should alter this.
* @param _status - Whether fainting is a permanent status or not
* @returns Whether this function did anything
*/
applyPreventRevive(_status: BooleanHolder): boolean {
return false;
}
} }
type ChallengeCondition = (data: GameData) => boolean; type ChallengeCondition = (data: GameData) => boolean;
@ -864,208 +938,108 @@ export class LowerStarterPointsChallenge extends Challenge {
} }
/** /**
* Apply all challenges that modify starter choice. * Implements a No Support challenge
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE
* @param pokemon {@link PokemonSpecies} The pokemon to check the validity of.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @returns True if any challenge was successfully applied.
*/ */
export function applyChallenges( export class LimitedSupportChallenge extends Challenge {
challengeType: ChallengeType.STARTER_CHOICE, constructor() {
pokemon: PokemonSpecies, super(Challenges.LIMITED_SUPPORT, 3);
valid: BooleanHolder, }
dexAttr: DexAttrProps,
): boolean;
/**
* Apply all challenges that modify available total starter points.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_POINTS
* @param points {@link NumberHolder} The amount of points you have available.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(challengeType: ChallengeType.STARTER_POINTS, points: NumberHolder): boolean;
/**
* Apply all challenges that modify the cost of a starter.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_COST
* @param species {@link SpeciesId} The pokemon to change the cost of.
* @param points {@link NumberHolder} The cost of the pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.STARTER_COST,
species: SpeciesId,
cost: NumberHolder,
): boolean;
/**
* Apply all challenges that modify a starter after selection.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_MODIFY
* @param pokemon {@link Pokemon} The starter pokemon to modify.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(challengeType: ChallengeType.STARTER_MODIFY, pokemon: Pokemon): boolean;
/**
* Apply all challenges that what pokemon you can have in battle.
* @param challengeType {@link ChallengeType} ChallengeType.POKEMON_IN_BATTLE
* @param pokemon {@link Pokemon} The pokemon to check the validity of.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.POKEMON_IN_BATTLE,
pokemon: Pokemon,
valid: BooleanHolder,
): boolean;
/**
* Apply all challenges that modify what fixed battles there are.
* @param challengeType {@link ChallengeType} ChallengeType.FIXED_BATTLES
* @param waveIndex {@link Number} The current wave index.
* @param battleConfig {@link FixedBattleConfig} The battle config to modify.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.FIXED_BATTLES,
waveIndex: number,
battleConfig: FixedBattleConfig,
): boolean;
/**
* Apply all challenges that modify type effectiveness.
* @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS
* @param effectiveness {@linkcode NumberHolder} The current effectiveness of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: NumberHolder): boolean;
/**
* Apply all challenges that modify what level AI are.
* @param challengeType {@link ChallengeType} ChallengeType.AI_LEVEL
* @param level {@link NumberHolder} The generated level of the pokemon.
* @param levelCap {@link Number} The maximum level cap for the current wave.
* @param isTrainer {@link Boolean} Whether this is a trainer pokemon.
* @param isBoss {@link Boolean} Whether this is a non-trainer boss pokemon.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.AI_LEVEL,
level: NumberHolder,
levelCap: number,
isTrainer: boolean,
isBoss: boolean,
): boolean;
/**
* Apply all challenges that modify how many move slots the AI has.
* @param challengeType {@link ChallengeType} ChallengeType.AI_MOVE_SLOTS
* @param pokemon {@link Pokemon} The pokemon being considered.
* @param moveSlots {@link NumberHolder} The amount of move slots.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.AI_MOVE_SLOTS,
pokemon: Pokemon,
moveSlots: NumberHolder,
): boolean;
/**
* Apply all challenges that modify whether a pokemon has its passive.
* @param challengeType {@link ChallengeType} ChallengeType.PASSIVE_ACCESS
* @param pokemon {@link Pokemon} The pokemon to modify.
* @param hasPassive {@link BooleanHolder} Whether it has its passive.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.PASSIVE_ACCESS,
pokemon: Pokemon,
hasPassive: BooleanHolder,
): boolean;
/**
* Apply all challenges that modify the game modes settings.
* @param challengeType {@link ChallengeType} ChallengeType.GAME_MODE_MODIFY
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(challengeType: ChallengeType.GAME_MODE_MODIFY): boolean;
/**
* Apply all challenges that modify what level a pokemon can access a move.
* @param challengeType {@link ChallengeType} ChallengeType.MOVE_ACCESS
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link MoveId} The move in question.
* @param level {@link NumberHolder} The level threshold for access.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.MOVE_ACCESS,
pokemon: Pokemon,
moveSource: MoveSourceType,
move: MoveId,
level: NumberHolder,
): boolean;
/**
* Apply all challenges that modify what weight a pokemon gives to move generation
* @param challengeType {@link ChallengeType} ChallengeType.MOVE_WEIGHT
* @param pokemon {@link Pokemon} What pokemon would learn the move.
* @param moveSource {@link MoveSourceType} What source the pokemon would get the move from.
* @param move {@link MoveId} The move in question.
* @param weight {@link NumberHolder} The weight of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(
challengeType: ChallengeType.MOVE_WEIGHT,
pokemon: Pokemon,
moveSource: MoveSourceType,
move: MoveId,
weight: NumberHolder,
): boolean;
export function applyChallenges(challengeType: ChallengeType.FLIP_STAT, pokemon: Pokemon, baseStats: number[]): boolean; override applyPartyHeal(status: BooleanHolder): boolean {
if (status.value) {
export function applyChallenges(challengeType: ChallengeType, ...args: any[]): boolean { status.value = this.value === 2;
let ret = false; return true;
globalScene.gameMode.challenges.forEach(c => {
if (c.value !== 0) {
switch (challengeType) {
case ChallengeType.STARTER_CHOICE:
ret ||= c.applyStarterChoice(args[0], args[1], args[2]);
break;
case ChallengeType.STARTER_POINTS:
ret ||= c.applyStarterPoints(args[0]);
break;
case ChallengeType.STARTER_COST:
ret ||= c.applyStarterCost(args[0], args[1]);
break;
case ChallengeType.STARTER_MODIFY:
ret ||= c.applyStarterModify(args[0]);
break;
case ChallengeType.POKEMON_IN_BATTLE:
ret ||= c.applyPokemonInBattle(args[0], args[1]);
break;
case ChallengeType.FIXED_BATTLES:
ret ||= c.applyFixedBattle(args[0], args[1]);
break;
case ChallengeType.TYPE_EFFECTIVENESS:
ret ||= c.applyTypeEffectiveness(args[0]);
break;
case ChallengeType.AI_LEVEL:
ret ||= c.applyLevelChange(args[0], args[1], args[2], args[3]);
break;
case ChallengeType.AI_MOVE_SLOTS:
ret ||= c.applyMoveSlot(args[0], args[1]);
break;
case ChallengeType.PASSIVE_ACCESS:
ret ||= c.applyPassiveAccess(args[0], args[1]);
break;
case ChallengeType.GAME_MODE_MODIFY:
ret ||= c.applyGameModeModify();
break;
case ChallengeType.MOVE_ACCESS:
ret ||= c.applyMoveAccessLevel(args[0], args[1], args[2], args[3]);
break;
case ChallengeType.MOVE_WEIGHT:
ret ||= c.applyMoveWeight(args[0], args[1], args[2], args[3]);
break;
case ChallengeType.FLIP_STAT:
ret ||= c.applyFlipStat(args[0], args[1]);
break;
}
} }
}); return false;
return ret; }
override applyShop(status: BooleanHolder): boolean {
if (status.value) {
status.value = this.value === 1;
return true;
}
return false;
}
static override loadChallenge(source: LimitedSupportChallenge | any): LimitedSupportChallenge {
const newChallenge = new LimitedSupportChallenge();
newChallenge.value = source.value;
newChallenge.severity = source.severity;
return newChallenge;
}
}
/**
* Implements a Limited Catch challenge
*/
export class LimitedCatchChallenge extends Challenge {
constructor() {
super(Challenges.LIMITED_CATCH, 1);
}
override applyPokemonAddToParty(pokemon: EnemyPokemon, status: BooleanHolder): boolean {
if (status.value) {
status.value = pokemon.metWave % 10 === 1;
return true;
}
return false;
}
static override loadChallenge(source: LimitedCatchChallenge | any): LimitedCatchChallenge {
const newChallenge = new LimitedCatchChallenge();
newChallenge.value = source.value;
newChallenge.severity = source.severity;
return newChallenge;
}
}
/**
* Implements a Permanent Faint challenge
*/
export class HardcoreChallenge extends Challenge {
constructor() {
super(Challenges.HARDCORE, 1);
}
override applyPokemonFusion(pokemon: PlayerPokemon, status: BooleanHolder): boolean {
if (!status.value) {
status.value = pokemon.isFainted();
return true;
}
return false;
}
override applyShopItem(shopItem: ModifierTypeOption | null, status: BooleanHolder): boolean {
status.value = shopItem?.type.group !== "revive";
return true;
}
override applyWaveReward(reward: ModifierTypeOption | null, status: BooleanHolder): boolean {
return this.applyShopItem(reward, status);
}
override applyPokemonMove(moveId: MoveId, status: BooleanHolder) {
if (status.value) {
status.value = moveId !== MoveId.REVIVAL_BLESSING;
return true;
}
return false;
}
override applyPreventRevive(status: BooleanHolder): boolean {
if (!status.value) {
status.value = true;
return true;
}
return false;
}
static override loadChallenge(source: HardcoreChallenge | any): HardcoreChallenge {
const newChallenge = new HardcoreChallenge();
newChallenge.value = source.value;
newChallenge.severity = source.severity;
return newChallenge;
}
} }
/** /**
@ -1089,6 +1063,12 @@ export function copyChallenge(source: Challenge | any): Challenge {
return InverseBattleChallenge.loadChallenge(source); return InverseBattleChallenge.loadChallenge(source);
case Challenges.FLIP_STAT: case Challenges.FLIP_STAT:
return FlipStatChallenge.loadChallenge(source); return FlipStatChallenge.loadChallenge(source);
case Challenges.LIMITED_CATCH:
return LimitedCatchChallenge.loadChallenge(source);
case Challenges.LIMITED_SUPPORT:
return LimitedSupportChallenge.loadChallenge(source);
case Challenges.HARDCORE:
return HardcoreChallenge.loadChallenge(source);
} }
throw new Error("Unknown challenge copied"); throw new Error("Unknown challenge copied");
} }
@ -1097,87 +1077,13 @@ export const allChallenges: Challenge[] = [];
export function initChallenges() { export function initChallenges() {
allChallenges.push( allChallenges.push(
new FreshStartChallenge(),
new HardcoreChallenge(),
new LimitedCatchChallenge(),
new LimitedSupportChallenge(),
new SingleGenerationChallenge(), new SingleGenerationChallenge(),
new SingleTypeChallenge(), new SingleTypeChallenge(),
new FreshStartChallenge(),
new InverseBattleChallenge(), new InverseBattleChallenge(),
new FlipStatChallenge(), new FlipStatChallenge(),
); );
} }
/**
* Apply all challenges to the given starter (and form) to check its validity.
* Differs from {@linkcode checkSpeciesValidForChallenge} which only checks form changes.
* @param species - The {@linkcode PokemonSpecies} to check the validity of.
* @param dexAttr - The {@linkcode DexAttrProps | dex attributes} of the species, including its form index.
* @param soft - If `true`, allow it if it could become valid through evolution or form change.
* @returns `true` if the species is considered valid.
*/
export function checkStarterValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
if (!soft) {
const isValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
return isValidForChallenge.value;
}
// We check the validity of every evolution and form change, and require that at least one is valid
const speciesToCheck = [species.speciesId];
while (speciesToCheck.length) {
const checking = speciesToCheck.pop();
// Linter complains if we don't handle this
if (!checking) {
return false;
}
const checkingSpecies = getPokemonSpecies(checking);
if (checkSpeciesValidForChallenge(checkingSpecies, props, true)) {
return true;
}
if (checking && pokemonEvolutions.hasOwnProperty(checking)) {
pokemonEvolutions[checking].forEach(e => {
// Form check to deal with cases such as Basculin -> Basculegion
// TODO: does this miss anything if checking forms of a stage 2 Pokémon?
if (!e?.preFormKey || e.preFormKey === species.forms[props.formIndex].formKey) {
speciesToCheck.push(e.speciesId);
}
});
}
}
return false;
}
/**
* Apply all challenges to the given species (and form) to check its validity.
* Differs from {@linkcode checkStarterValidForChallenge} which also checks evolutions.
* @param species - The {@linkcode PokemonSpecies} to check the validity of.
* @param dexAttr - The {@linkcode DexAttrProps | dex attributes} of the species, including its form index.
* @param soft - If `true`, allow it if it could become valid through a form change.
* @returns `true` if the species is considered valid.
*/
function checkSpeciesValidForChallenge(species: PokemonSpecies, props: DexAttrProps, soft: boolean) {
const isValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isValidForChallenge, props);
if (!soft || !pokemonFormChanges.hasOwnProperty(species.speciesId)) {
return isValidForChallenge.value;
}
// If the form in props is valid, return true before checking other form changes
if (soft && isValidForChallenge.value) {
return true;
}
const result = pokemonFormChanges[species.speciesId].some(f1 => {
// Exclude form changes that require the mon to be on the field to begin with
if (!("item" in f1.trigger)) {
return false;
}
return species.forms.some((f2, formIndex) => {
if (f1.formKey === f2.formKey) {
const formProps = { ...props, formIndex };
const isFormValidForChallenge = new BooleanHolder(true);
applyChallenges(ChallengeType.STARTER_CHOICE, species, isFormValidForChallenge, formProps);
return isFormValidForChallenge.value;
}
return false;
});
});
return result;
}

View File

@ -256,7 +256,7 @@ export const noAbilityTypeOverrideMoves: ReadonlySet<MoveId> = new Set([
MoveId.HIDDEN_POWER, MoveId.HIDDEN_POWER,
]); ]);
/** Set of all moves that cannot be copied by {@linkcode Moves.SKETCH}. */ /** Set of all moves that cannot be copied by {@linkcode MoveId.SKETCH}. */
export const invalidSketchMoves: ReadonlySet<MoveId> = new Set([ export const invalidSketchMoves: ReadonlySet<MoveId> = new Set([
MoveId.NONE, MoveId.NONE,
MoveId.CHATTER, MoveId.CHATTER,
@ -270,7 +270,7 @@ export const invalidSketchMoves: ReadonlySet<MoveId> = new Set([
MoveId.BREAKNECK_BLITZ__SPECIAL, MoveId.BREAKNECK_BLITZ__SPECIAL,
]); ]);
/** Set of all moves that cannot be locked into by {@linkcode Moves.ENCORE}. */ /** Set of all moves that cannot be locked into by {@linkcode MoveId.ENCORE}. */
export const invalidEncoreMoves: ReadonlySet<MoveId> = new Set([ export const invalidEncoreMoves: ReadonlySet<MoveId> = new Set([
MoveId.MIMIC, MoveId.MIMIC,
MoveId.MIRROR_MOVE, MoveId.MIRROR_MOVE,

View File

@ -22,7 +22,6 @@ import {
TypeBoostTag, TypeBoostTag,
} from "#data/battler-tags"; } from "#data/battler-tags";
import { getBerryEffectFunc } from "#data/berry"; import { getBerryEffectFunc } from "#data/berry";
import { applyChallenges } from "#data/challenge";
import { allAbilities, allMoves } from "#data/data-lists"; import { allAbilities, allMoves } from "#data/data-lists";
import { SpeciesFormChangeRevertWeatherFormTrigger } from "#data/form-change-triggers"; import { SpeciesFormChangeRevertWeatherFormTrigger } from "#data/form-change-triggers";
import { DelayedAttackTag } from "#data/positional-tags/positional-tag"; import { DelayedAttackTag } from "#data/positional-tags/positional-tag";
@ -93,6 +92,7 @@ import { BooleanHolder, type Constructor, isNullOrUndefined, NumberHolder, randS
import { getEnumValues } from "#utils/enums"; import { getEnumValues } from "#utils/enums";
import { toTitleCase } from "#utils/strings"; import { toTitleCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
import { applyChallenges } from "#utils/challenge-utils";
/** /**
* A function used to conditionally determine execution of a given {@linkcode MoveAttr}. * A function used to conditionally determine execution of a given {@linkcode MoveAttr}.
@ -124,7 +124,7 @@ export abstract class Move implements Localizable {
/** /**
* Check if the move is of the given subclass without requiring `instanceof`. * Check if the move is of the given subclass without requiring `instanceof`.
* *
* Does _not_ work for {@linkcode ChargingAttackMove} and {@linkcode ChargingSelfStatusMove} subclasses. For those, * ! Does _not_ work for {@linkcode ChargingAttackMove} and {@linkcode ChargingSelfStatusMove} subclasses. For those,
* use {@linkcode isChargingMove} instead. * use {@linkcode isChargingMove} instead.
* *
* @param moveKind - The string name of the move to check against * @param moveKind - The string name of the move to check against
@ -2587,7 +2587,7 @@ export class PsychoShiftEffectAttr extends MoveEffectAttr {
} }
/** /**
* Applies the effect of {@linkcode Moves.PSYCHO_SHIFT} to its target. * Applies the effect of {@linkcode MoveId.PSYCHO_SHIFT} to its target.
* Psycho Shift takes the user's status effect and passes it onto the target. * Psycho Shift takes the user's status effect and passes it onto the target.
* The user is then healed after the move has been successfully executed. * The user is then healed after the move has been successfully executed.
* @param user - The {@linkcode Pokemon} using the move * @param user - The {@linkcode Pokemon} using the move
@ -2927,7 +2927,7 @@ export class HealStatusEffectAttr extends MoveEffectAttr {
/** /**
* Attribute to add the {@linkcode BattlerTagType.BYPASS_SLEEP | BYPASS_SLEEP Battler Tag} for 1 turn to the user before move use. * Attribute to add the {@linkcode BattlerTagType.BYPASS_SLEEP | BYPASS_SLEEP Battler Tag} for 1 turn to the user before move use.
* Used by {@linkcode Moves.SNORE} and {@linkcode Moves.SLEEP_TALK}. * Used by {@linkcode MoveId.SNORE} and {@linkcode MoveId.SLEEP_TALK}.
*/ */
// TODO: Should this use a battler tag? // TODO: Should this use a battler tag?
// TODO: Give this `userSleptOrComatoseCondition` by default // TODO: Give this `userSleptOrComatoseCondition` by default
@ -5912,20 +5912,21 @@ export class ProtectAttr extends AddBattlerTagAttr {
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return ((user, target, move): boolean => { return ((user, target, move): boolean => {
let timesUsed = 0; let timesUsed = 0;
const moveHistory = user.getLastXMoves();
let turnMove: TurnMove | undefined;
while (moveHistory.length) { for (const turnMove of user.getLastXMoves(-1).slice()) {
turnMove = moveHistory.shift(); if (
if (!allMoves[turnMove?.move ?? MoveId.NONE].hasAttr("ProtectAttr") || turnMove?.result !== MoveResult.SUCCESS) { // Quick & Wide guard increment the Protect counter without using it for fail chance
!(allMoves[turnMove.move].hasAttr("ProtectAttr") ||
[MoveId.QUICK_GUARD, MoveId.WIDE_GUARD].includes(turnMove.move)) ||
turnMove.result !== MoveResult.SUCCESS
) {
break; break;
} }
timesUsed++;
timesUsed++
} }
if (timesUsed) {
return !user.randBattleSeedInt(Math.pow(3, timesUsed)); return timesUsed === 0 || user.randBattleSeedInt(Math.pow(3, timesUsed)) === 0;
}
return true;
}); });
} }
} }
@ -6905,13 +6906,19 @@ export class RandomMoveAttr extends CallMoveAttr {
* @param move Move being used * @param move Move being used
* @param args Unused * @param args Unused
*/ */
override apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { override apply(user: Pokemon, target: Pokemon, _move: Move, args: any[]): boolean {
// TODO: Move this into the constructor to avoid constructing this every call
const moveIds = getEnumValues(MoveId).map(m => !this.invalidMoves.has(m) && !allMoves[m].name.endsWith(" (N)") ? m : MoveId.NONE); const moveIds = getEnumValues(MoveId).map(m => !this.invalidMoves.has(m) && !allMoves[m].name.endsWith(" (N)") ? m : MoveId.NONE);
let moveId: MoveId = MoveId.NONE; let moveId: MoveId = MoveId.NONE;
const moveStatus = new BooleanHolder(true);
do { do {
moveId = this.getMoveOverride() ?? moveIds[user.randBattleSeedInt(moveIds.length)]; moveId = this.getMoveOverride() ?? moveIds[user.randBattleSeedInt(moveIds.length)];
moveStatus.value = moveId !== MoveId.NONE;
if (user.isPlayer()) {
applyChallenges(ChallengeType.POKEMON_MOVE, moveId, moveStatus);
}
} }
while (moveId === MoveId.NONE); while (!moveStatus.value);
return super.apply(user, target, allMoves[moveId], args); return super.apply(user, target, allMoves[moveId], args);
} }
} }
@ -7139,7 +7146,7 @@ export class CopyMoveAttr extends CallMoveAttr {
/** /**
* Attribute used for moves that cause the target to repeat their last used move. * Attribute used for moves that cause the target to repeat their last used move.
* *
* Used by {@linkcode Moves.INSTRUCT | Instruct}. * Used by {@linkcode MoveId.INSTRUCT | Instruct}.
* @see [Instruct on Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Instruct_(move)) * @see [Instruct on Bulbapedia](https://bulbapedia.bulbagarden.net/wiki/Instruct_(move))
*/ */
export class RepeatMoveAttr extends MoveEffectAttr { export class RepeatMoveAttr extends MoveEffectAttr {
@ -7402,7 +7409,7 @@ const targetMoveCopiableCondition: MoveConditionFunc = (user, target, move) => {
/** /**
* Attribute to temporarily copy the last move in the target's moveset. * Attribute to temporarily copy the last move in the target's moveset.
* Used by {@linkcode Moves.MIMIC}. * Used by {@linkcode MoveId.MIMIC}.
*/ */
export class MovesetCopyMoveAttr extends OverrideMoveEffectAttr { export class MovesetCopyMoveAttr extends OverrideMoveEffectAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
@ -7966,7 +7973,7 @@ export class VariableTargetAttr extends MoveAttr {
/** /**
* Attribute to cause the target to move immediately after the user. * Attribute to cause the target to move immediately after the user.
* *
* Used by {@linkcode Moves.AFTER_YOU}. * Used by {@linkcode MoveId.AFTER_YOU}.
*/ */
export class AfterYouAttr extends MoveEffectAttr { export class AfterYouAttr extends MoveEffectAttr {
/** /**
@ -10887,7 +10894,7 @@ export function initMoves() {
.attr(MovePowerMultiplierAttr, (_user, target) => target.turnData.acted ? 1 : 2) .attr(MovePowerMultiplierAttr, (_user, target) => target.turnData.acted ? 1 : 2)
.bitingMove(), .bitingMove(),
new StatusMove(MoveId.COURT_CHANGE, PokemonType.NORMAL, 100, 10, -1, 0, 8) new StatusMove(MoveId.COURT_CHANGE, PokemonType.NORMAL, 100, 10, -1, 0, 8)
.attr(SwapArenaTagsAttr, [ ArenaTagType.AURORA_VEIL, ArenaTagType.LIGHT_SCREEN, ArenaTagType.MIST, ArenaTagType.REFLECT, ArenaTagType.SPIKES, ArenaTagType.STEALTH_ROCK, ArenaTagType.STICKY_WEB, ArenaTagType.TAILWIND, ArenaTagType.TOXIC_SPIKES ]), .attr(SwapArenaTagsAttr, [ ArenaTagType.AURORA_VEIL, ArenaTagType.LIGHT_SCREEN, ArenaTagType.MIST, ArenaTagType.REFLECT, ArenaTagType.SPIKES, ArenaTagType.STEALTH_ROCK, ArenaTagType.STICKY_WEB, ArenaTagType.TAILWIND, ArenaTagType.TOXIC_SPIKES, ArenaTagType.SAFEGUARD, ArenaTagType.FIRE_GRASS_PLEDGE, ArenaTagType.WATER_FIRE_PLEDGE, ArenaTagType.GRASS_WATER_PLEDGE ]),
/* Unused */ /* Unused */
new AttackMove(MoveId.MAX_FLARE, PokemonType.FIRE, MoveCategory.PHYSICAL, 10, -1, 10, -1, 0, 8) new AttackMove(MoveId.MAX_FLARE, PokemonType.FIRE, MoveCategory.PHYSICAL, 10, -1, 10, -1, 0, 8)
.target(MoveTarget.NEAR_ENEMY) .target(MoveTarget.NEAR_ENEMY)

View File

@ -1,8 +1,10 @@
import { allMoves } from "#data/data-lists"; import { allMoves } from "#data/data-lists";
import type { MoveId } from "#enums/move-id"; import { ChallengeType } from "#enums/challenge-type";
import { MoveId } from "#enums/move-id";
import type { Pokemon } from "#field/pokemon"; import type { Pokemon } from "#field/pokemon";
import type { Move } from "#moves/move"; import type { Move } from "#moves/move";
import { toDmgValue } from "#utils/common"; import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, toDmgValue } from "#utils/common";
/** /**
* Wrapper class for the {@linkcode Move} class for Pokemon to interact with. * Wrapper class for the {@linkcode Move} class for Pokemon to interact with.
@ -45,16 +47,18 @@ export class PokemonMove {
* @returns Whether this {@linkcode PokemonMove} can be selected by this Pokemon. * @returns Whether this {@linkcode PokemonMove} can be selected by this Pokemon.
*/ */
isUsable(pokemon: Pokemon, ignorePp = false, ignoreRestrictionTags = false): boolean { isUsable(pokemon: Pokemon, ignorePp = false, ignoreRestrictionTags = false): boolean {
const move = this.getMove();
// TODO: Add Sky Drop's 1 turn stall // TODO: Add Sky Drop's 1 turn stall
if (this.moveId && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)) { const usability = new BooleanHolder(
return false; !move.name.endsWith(" (N)") &&
(ignorePp || this.ppUsed < this.getMovePp() || move.pp === -1) &&
// TODO: Review if the `MoveId.NONE` check is even necessary anymore
!(this.moveId !== MoveId.NONE && !ignoreRestrictionTags && pokemon.isMoveRestricted(this.moveId, pokemon)),
);
if (pokemon.isPlayer()) {
applyChallenges(ChallengeType.POKEMON_MOVE, move.id, usability);
} }
return usability.value;
if (this.getMove().name.endsWith(" (N)")) {
return false;
}
return ignorePp || this.ppUsed < this.getMovePp() || this.getMove().pp === -1;
} }
getMove(): Move { getMove(): Move {

View File

@ -63,12 +63,12 @@ export const ATrainersTestEncounter: MysteryEncounter = MysteryEncounterBuilder.
break; break;
case 3: case 3:
trainerType = TrainerType.MIRA; trainerType = TrainerType.MIRA;
spriteKeys = getSpriteKeysFromSpecies(SpeciesId.ALAKAZAM, false, 1); spriteKeys = getSpriteKeysFromSpecies(SpeciesId.ALAKAZAM);
trainerNameKey = "mira"; trainerNameKey = "mira";
break; break;
case 4: case 4:
trainerType = TrainerType.RILEY; trainerType = TrainerType.RILEY;
spriteKeys = getSpriteKeysFromSpecies(SpeciesId.LUCARIO, false, 1); spriteKeys = getSpriteKeysFromSpecies(SpeciesId.LUCARIO);
trainerNameKey = "riley"; trainerNameKey = "riley";
break; break;
default: default:
@ -164,8 +164,8 @@ export const ATrainersTestEncounter: MysteryEncounter = MysteryEncounterBuilder.
encounter.setDialogueToken("eggType", i18next.t(`${namespace}:eggTypes.epic`)); encounter.setDialogueToken("eggType", i18next.t(`${namespace}:eggTypes.epic`));
setEncounterRewards( setEncounterRewards(
{ {
guaranteedModifierTypeFuncs: [modifierTypes.SACRED_ASH], guaranteedModifierTypeFuncs: [modifierTypes.RELIC_GOLD],
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ULTRA], guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE],
fillRemaining: true, fillRemaining: true,
}, },
[eggOptions], [eggOptions],

View File

@ -46,7 +46,7 @@ import {
} from "#mystery-encounters/mystery-encounter-requirements"; } from "#mystery-encounters/mystery-encounter-requirements";
import { getRandomPartyMemberFunc, trainerConfigs } from "#trainers/trainer-config"; import { getRandomPartyMemberFunc, trainerConfigs } from "#trainers/trainer-config";
import { TrainerPartyCompoundTemplate, TrainerPartyTemplate } from "#trainers/trainer-party-template"; import { TrainerPartyCompoundTemplate, TrainerPartyTemplate } from "#trainers/trainer-party-template";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { MoveInfoOverlay } from "#ui/move-info-overlay"; import { MoveInfoOverlay } from "#ui/move-info-overlay";
import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#utils/common"; import { isNullOrUndefined, randSeedInt, randSeedShuffle } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
@ -715,15 +715,13 @@ function doBugTypeMoveTutor(): Promise<void> {
const moveOptions = globalScene.currentBattle.mysteryEncounter!.misc.moveTutorOptions; const moveOptions = globalScene.currentBattle.mysteryEncounter!.misc.moveTutorOptions;
await showEncounterDialogue(`${namespace}:battle_won`, `${namespace}:speaker`); await showEncounterDialogue(`${namespace}:battle_won`, `${namespace}:speaker`);
const overlayScale = 1;
const moveInfoOverlay = new MoveInfoOverlay({ const moveInfoOverlay = new MoveInfoOverlay({
delayVisibility: false, delayVisibility: false,
scale: overlayScale,
onSide: true, onSide: true,
right: true, right: true,
x: 1, x: 1,
y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1, y: -MoveInfoOverlay.getHeight(true) - 1,
width: globalScene.game.canvas.width / 6 - 2, width: globalScene.scaledCanvas.width - 2,
}); });
globalScene.ui.add(moveInfoOverlay); globalScene.ui.add(moveInfoOverlay);

View File

@ -45,7 +45,7 @@ import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option";
import { trainerConfigs } from "#trainers/trainer-config"; import { trainerConfigs } from "#trainers/trainer-config";
import { TrainerPartyCompoundTemplate, TrainerPartyTemplate } from "#trainers/trainer-party-template"; import { TrainerPartyCompoundTemplate, TrainerPartyTemplate } from "#trainers/trainer-party-template";
import type { OptionSelectConfig } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectConfig } from "#ui/abstract-option-select-ui-handler";
import { randSeedInt, randSeedShuffle } from "#utils/common"; import { randSeedInt, randSeedShuffle } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -37,7 +37,7 @@ import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encou
import { MoveRequirement } from "#mystery-encounters/mystery-encounter-requirements"; import { MoveRequirement } from "#mystery-encounters/mystery-encounter-requirements";
import { DANCING_MOVES } from "#mystery-encounters/requirement-groups"; import { DANCING_MOVES } from "#mystery-encounters/requirement-groups";
import { PokemonData } from "#system/pokemon-data"; import { PokemonData } from "#system/pokemon-data";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -23,12 +23,8 @@ const namespace = "mysteryEncounters/darkDeal";
/** Exclude Ultra Beasts (inludes Cosmog/Solgaleo/Lunala/Necrozma), Paradox (includes Miraidon/Koraidon), Eternatus, and Mythicals */ /** Exclude Ultra Beasts (inludes Cosmog/Solgaleo/Lunala/Necrozma), Paradox (includes Miraidon/Koraidon), Eternatus, and Mythicals */
const excludedBosses = [ const excludedBosses = [
SpeciesId.NECROZMA,
SpeciesId.COSMOG,
SpeciesId.COSMOEM,
SpeciesId.SOLGALEO,
SpeciesId.LUNALA,
SpeciesId.ETERNATUS, SpeciesId.ETERNATUS,
/** UBs */
SpeciesId.NIHILEGO, SpeciesId.NIHILEGO,
SpeciesId.BUZZWOLE, SpeciesId.BUZZWOLE,
SpeciesId.PHEROMOSA, SpeciesId.PHEROMOSA,
@ -40,6 +36,12 @@ const excludedBosses = [
SpeciesId.NAGANADEL, SpeciesId.NAGANADEL,
SpeciesId.STAKATAKA, SpeciesId.STAKATAKA,
SpeciesId.BLACEPHALON, SpeciesId.BLACEPHALON,
SpeciesId.COSMOG,
SpeciesId.COSMOEM,
SpeciesId.SOLGALEO,
SpeciesId.LUNALA,
SpeciesId.NECROZMA,
/** Paradox */
SpeciesId.GREAT_TUSK, SpeciesId.GREAT_TUSK,
SpeciesId.SCREAM_TAIL, SpeciesId.SCREAM_TAIL,
SpeciesId.BRUTE_BONNET, SpeciesId.BRUTE_BONNET,
@ -47,10 +49,10 @@ const excludedBosses = [
SpeciesId.SLITHER_WING, SpeciesId.SLITHER_WING,
SpeciesId.SANDY_SHOCKS, SpeciesId.SANDY_SHOCKS,
SpeciesId.ROARING_MOON, SpeciesId.ROARING_MOON,
SpeciesId.KORAIDON,
SpeciesId.WALKING_WAKE, SpeciesId.WALKING_WAKE,
SpeciesId.GOUGING_FIRE, SpeciesId.GOUGING_FIRE,
SpeciesId.RAGING_BOLT, SpeciesId.RAGING_BOLT,
SpeciesId.KORAIDON,
SpeciesId.IRON_TREADS, SpeciesId.IRON_TREADS,
SpeciesId.IRON_BUNDLE, SpeciesId.IRON_BUNDLE,
SpeciesId.IRON_HANDS, SpeciesId.IRON_HANDS,
@ -58,22 +60,23 @@ const excludedBosses = [
SpeciesId.IRON_MOTH, SpeciesId.IRON_MOTH,
SpeciesId.IRON_THORNS, SpeciesId.IRON_THORNS,
SpeciesId.IRON_VALIANT, SpeciesId.IRON_VALIANT,
SpeciesId.MIRAIDON,
SpeciesId.IRON_LEAVES, SpeciesId.IRON_LEAVES,
SpeciesId.IRON_BOULDER, SpeciesId.IRON_BOULDER,
SpeciesId.IRON_CROWN, SpeciesId.IRON_CROWN,
SpeciesId.MIRAIDON,
/** Mythical */
SpeciesId.MEW, SpeciesId.MEW,
SpeciesId.CELEBI, SpeciesId.CELEBI,
SpeciesId.DEOXYS,
SpeciesId.JIRACHI, SpeciesId.JIRACHI,
SpeciesId.DARKRAI, SpeciesId.DEOXYS,
SpeciesId.PHIONE, SpeciesId.PHIONE,
SpeciesId.MANAPHY, SpeciesId.MANAPHY,
SpeciesId.ARCEUS, SpeciesId.DARKRAI,
SpeciesId.SHAYMIN, SpeciesId.SHAYMIN,
SpeciesId.ARCEUS,
SpeciesId.VICTINI, SpeciesId.VICTINI,
SpeciesId.MELOETTA,
SpeciesId.KELDEO, SpeciesId.KELDEO,
SpeciesId.MELOETTA,
SpeciesId.GENESECT, SpeciesId.GENESECT,
SpeciesId.DIANCIE, SpeciesId.DIANCIE,
SpeciesId.HOOPA, SpeciesId.HOOPA,
@ -81,9 +84,9 @@ const excludedBosses = [
SpeciesId.MAGEARNA, SpeciesId.MAGEARNA,
SpeciesId.MARSHADOW, SpeciesId.MARSHADOW,
SpeciesId.ZERAORA, SpeciesId.ZERAORA,
SpeciesId.ZARUDE,
SpeciesId.MELTAN, SpeciesId.MELTAN,
SpeciesId.MELMETAL, SpeciesId.MELMETAL,
SpeciesId.ZARUDE,
SpeciesId.PECHARUNT, SpeciesId.PECHARUNT,
]; ];

View File

@ -33,7 +33,7 @@ import {
MoneyRequirement, MoneyRequirement,
} from "#mystery-encounters/mystery-encounter-requirements"; } from "#mystery-encounters/mystery-encounter-requirements";
import i18next from "#plugins/i18n"; import i18next from "#plugins/i18n";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { randSeedItem } from "#utils/common"; import { randSeedItem } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";

View File

@ -18,7 +18,7 @@ import {
import type { MysteryEncounter } from "#mystery-encounters/mystery-encounter"; import type { MysteryEncounter } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter"; import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import i18next from "i18next"; import i18next from "i18next";
/** i18n namespace for the encounter */ /** i18n namespace for the encounter */

View File

@ -42,7 +42,7 @@ import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encou
import { PartySizeRequirement } from "#mystery-encounters/mystery-encounter-requirements"; import { PartySizeRequirement } from "#mystery-encounters/mystery-encounter-requirements";
import { PokemonData } from "#system/pokemon-data"; import { PokemonData } from "#system/pokemon-data";
import { MusicPreference } from "#system/settings"; import { MusicPreference } from "#system/settings";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { isNullOrUndefined, NumberHolder, randInt, randSeedInt, randSeedItem, randSeedShuffle } from "#utils/common"; import { isNullOrUndefined, NumberHolder, randInt, randSeedInt, randSeedItem, randSeedShuffle } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import i18next from "i18next"; import i18next from "i18next";
@ -564,14 +564,14 @@ function generateTradeOption(alreadyUsedSpecies: PokemonSpecies[], originalBst?:
function showTradeBackground() { function showTradeBackground() {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
const tradeContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); const tradeContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
tradeContainer.setName("Trade Background"); tradeContainer.setName("Trade Background");
const flyByStaticBg = globalScene.add.rectangle( const flyByStaticBg = globalScene.add.rectangle(
0, 0,
0, 0,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6, globalScene.scaledCanvas.height,
0, 0,
); );
flyByStaticBg.setName("Black Background"); flyByStaticBg.setName("Black Background");

View File

@ -52,37 +52,6 @@ class BreederSpeciesEvolution {
} }
const POOL_1_POKEMON: (SpeciesId | BreederSpeciesEvolution)[][] = [ const POOL_1_POKEMON: (SpeciesId | BreederSpeciesEvolution)[][] = [
[SpeciesId.MUNCHLAX, new BreederSpeciesEvolution(SpeciesId.SNORLAX, SECOND_STAGE_EVOLUTION_WAVE)],
[
SpeciesId.HAPPINY,
new BreederSpeciesEvolution(SpeciesId.CHANSEY, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.BLISSEY, FINAL_STAGE_EVOLUTION_WAVE),
],
[
SpeciesId.MAGBY,
new BreederSpeciesEvolution(SpeciesId.MAGMAR, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.MAGMORTAR, FINAL_STAGE_EVOLUTION_WAVE),
],
[
SpeciesId.ELEKID,
new BreederSpeciesEvolution(SpeciesId.ELECTABUZZ, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.ELECTIVIRE, FINAL_STAGE_EVOLUTION_WAVE),
],
[SpeciesId.RIOLU, new BreederSpeciesEvolution(SpeciesId.LUCARIO, SECOND_STAGE_EVOLUTION_WAVE)],
[
SpeciesId.BUDEW,
new BreederSpeciesEvolution(SpeciesId.ROSELIA, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.ROSERADE, FINAL_STAGE_EVOLUTION_WAVE),
],
[SpeciesId.TOXEL, new BreederSpeciesEvolution(SpeciesId.TOXTRICITY, SECOND_STAGE_EVOLUTION_WAVE)],
[
SpeciesId.MIME_JR,
new BreederSpeciesEvolution(SpeciesId.GALAR_MR_MIME, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.MR_RIME, FINAL_STAGE_EVOLUTION_WAVE),
],
];
const POOL_2_POKEMON: (SpeciesId | BreederSpeciesEvolution)[][] = [
[ [
SpeciesId.PICHU, SpeciesId.PICHU,
new BreederSpeciesEvolution(SpeciesId.PIKACHU, FIRST_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.PIKACHU, FIRST_STAGE_EVOLUTION_WAVE),
@ -93,24 +62,63 @@ const POOL_2_POKEMON: (SpeciesId | BreederSpeciesEvolution)[][] = [
new BreederSpeciesEvolution(SpeciesId.PIKACHU, FIRST_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.PIKACHU, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.ALOLA_RAICHU, FINAL_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.ALOLA_RAICHU, FINAL_STAGE_EVOLUTION_WAVE),
], ],
[SpeciesId.SMOOCHUM, new BreederSpeciesEvolution(SpeciesId.JYNX, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.TYROGUE, new BreederSpeciesEvolution(SpeciesId.HITMONLEE, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.TYROGUE, new BreederSpeciesEvolution(SpeciesId.HITMONCHAN, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.TYROGUE, new BreederSpeciesEvolution(SpeciesId.HITMONTOP, SECOND_STAGE_EVOLUTION_WAVE)],
[ [
SpeciesId.IGGLYBUFF, SpeciesId.IGGLYBUFF,
new BreederSpeciesEvolution(SpeciesId.JIGGLYPUFF, FIRST_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.JIGGLYPUFF, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.WIGGLYTUFF, FINAL_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.WIGGLYTUFF, FINAL_STAGE_EVOLUTION_WAVE),
], ],
[
SpeciesId.TOGEPI,
new BreederSpeciesEvolution(SpeciesId.TOGETIC, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.TOGEKISS, FINAL_STAGE_EVOLUTION_WAVE),
],
[SpeciesId.TYROGUE, new BreederSpeciesEvolution(SpeciesId.HITMONLEE, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.TYROGUE, new BreederSpeciesEvolution(SpeciesId.HITMONCHAN, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.TYROGUE, new BreederSpeciesEvolution(SpeciesId.HITMONTOP, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.SMOOCHUM, new BreederSpeciesEvolution(SpeciesId.JYNX, FIRST_STAGE_EVOLUTION_WAVE)],
[ [
SpeciesId.AZURILL, SpeciesId.AZURILL,
new BreederSpeciesEvolution(SpeciesId.MARILL, FIRST_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.MARILL, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.AZUMARILL, FINAL_STAGE_EVOLUTION_WAVE), new BreederSpeciesEvolution(SpeciesId.AZUMARILL, FINAL_STAGE_EVOLUTION_WAVE),
], ],
[SpeciesId.WYNAUT, new BreederSpeciesEvolution(SpeciesId.WOBBUFFET, SECOND_STAGE_EVOLUTION_WAVE)], [
SpeciesId.BUDEW,
new BreederSpeciesEvolution(SpeciesId.ROSELIA, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.ROSERADE, FINAL_STAGE_EVOLUTION_WAVE),
],
[SpeciesId.CHINGLING, new BreederSpeciesEvolution(SpeciesId.CHIMECHO, SECOND_STAGE_EVOLUTION_WAVE)], [SpeciesId.CHINGLING, new BreederSpeciesEvolution(SpeciesId.CHIMECHO, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.BONSLY, new BreederSpeciesEvolution(SpeciesId.SUDOWOODO, SECOND_STAGE_EVOLUTION_WAVE)], [SpeciesId.BONSLY, new BreederSpeciesEvolution(SpeciesId.SUDOWOODO, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.MIME_JR, new BreederSpeciesEvolution(SpeciesId.MR_MIME, SECOND_STAGE_EVOLUTION_WAVE)],
[
SpeciesId.MIME_JR,
new BreederSpeciesEvolution(SpeciesId.GALAR_MR_MIME, SECOND_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.MR_RIME, FINAL_STAGE_EVOLUTION_WAVE),
],
[
SpeciesId.HAPPINY,
new BreederSpeciesEvolution(SpeciesId.CHANSEY, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.BLISSEY, FINAL_STAGE_EVOLUTION_WAVE),
],
[SpeciesId.MANTYKE, new BreederSpeciesEvolution(SpeciesId.MANTINE, SECOND_STAGE_EVOLUTION_WAVE)], [SpeciesId.MANTYKE, new BreederSpeciesEvolution(SpeciesId.MANTINE, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.TOXEL, new BreederSpeciesEvolution(SpeciesId.TOXTRICITY, SECOND_STAGE_EVOLUTION_WAVE)],
];
const POOL_2_POKEMON: (SpeciesId | BreederSpeciesEvolution)[][] = [
[SpeciesId.DITTO],
[
SpeciesId.ELEKID,
new BreederSpeciesEvolution(SpeciesId.ELECTABUZZ, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.ELECTIVIRE, FINAL_STAGE_EVOLUTION_WAVE),
],
[
SpeciesId.MAGBY,
new BreederSpeciesEvolution(SpeciesId.MAGMAR, FIRST_STAGE_EVOLUTION_WAVE),
new BreederSpeciesEvolution(SpeciesId.MAGMORTAR, FINAL_STAGE_EVOLUTION_WAVE),
],
[SpeciesId.WYNAUT, new BreederSpeciesEvolution(SpeciesId.WOBBUFFET, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.MUNCHLAX, new BreederSpeciesEvolution(SpeciesId.SNORLAX, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.RIOLU, new BreederSpeciesEvolution(SpeciesId.LUCARIO, SECOND_STAGE_EVOLUTION_WAVE)],
[SpeciesId.AUDINO],
]; ];
/** /**
@ -502,7 +510,7 @@ function getPartyConfig(): EnemyPartyConfig {
shiny: true, shiny: true,
variant: 1, variant: 1,
nature: Nature.MODEST, nature: Nature.MODEST,
moveSet: [MoveId.MOONBLAST, MoveId.MYSTICAL_FIRE, MoveId.ICE_BEAM, MoveId.THUNDERBOLT], moveSet: [MoveId.DAZZLING_GLEAM, MoveId.MYSTICAL_FIRE, MoveId.ICE_BEAM, MoveId.THUNDERBOLT], // Make this one have an item gimmick when we have more items/finish implementations
ivs: [31, 31, 31, 31, 31, 31], ivs: [31, 31, 31, 31, 31, 31],
}, },
{ {
@ -515,7 +523,7 @@ function getPartyConfig(): EnemyPartyConfig {
shiny: true, shiny: true,
variant: 2, variant: 2,
nature: Nature.BOLD, nature: Nature.BOLD,
moveSet: [MoveId.TRI_ATTACK, MoveId.STORED_POWER, MoveId.TAKE_HEART, MoveId.MOONLIGHT], moveSet: [MoveId.TRI_ATTACK, MoveId.STORED_POWER, MoveId.CALM_MIND, MoveId.MOONLIGHT],
ivs: [31, 31, 31, 31, 31, 31], ivs: [31, 31, 31, 31, 31, 31],
}, },
); );

View File

@ -27,7 +27,7 @@ import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option";
import { PokemonData } from "#system/pokemon-data"; import { PokemonData } from "#system/pokemon-data";
import type { HeldModifierConfig } from "#types/held-modifier-config"; import type { HeldModifierConfig } from "#types/held-modifier-config";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { isNullOrUndefined, randSeedShuffle } from "#utils/common"; import { isNullOrUndefined, randSeedShuffle } from "#utils/common";
import { getEnumValues } from "#utils/enums"; import { getEnumValues } from "#utils/enums";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -13,8 +13,9 @@ import { HitHealModifier, PokemonHeldItemModifier, TurnHealModifier } from "#mod
import type { PokemonHeldItemModifierType } from "#modifiers/modifier-type"; import type { PokemonHeldItemModifierType } from "#modifiers/modifier-type";
import { PokemonMove } from "#moves/pokemon-move"; import { PokemonMove } from "#moves/pokemon-move";
import { showEncounterText } from "#mystery-encounters/encounter-dialogue-utils"; import { showEncounterText } from "#mystery-encounters/encounter-dialogue-utils";
import type { EnemyPartyConfig, EnemyPokemonConfig } from "#mystery-encounters/encounter-phase-utils";
import { import {
type EnemyPartyConfig,
type EnemyPokemonConfig,
generateModifierType, generateModifierType,
initBattleWithEnemyConfig, initBattleWithEnemyConfig,
leaveEncounterWithoutBattle, leaveEncounterWithoutBattle,
@ -23,8 +24,7 @@ import {
transitionMysteryEncounterIntroVisuals, transitionMysteryEncounterIntroVisuals,
} from "#mystery-encounters/encounter-phase-utils"; } from "#mystery-encounters/encounter-phase-utils";
import { applyModifierTypeToPlayerPokemon } from "#mystery-encounters/encounter-pokemon-utils"; import { applyModifierTypeToPlayerPokemon } from "#mystery-encounters/encounter-pokemon-utils";
import type { MysteryEncounter } from "#mystery-encounters/mystery-encounter"; import { type MysteryEncounter, MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterBuilder } from "#mystery-encounters/mystery-encounter";
import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option"; import { MysteryEncounterOptionBuilder } from "#mystery-encounters/mystery-encounter-option";
import i18next from "#plugins/i18n"; import i18next from "#plugins/i18n";
import { randSeedInt } from "#utils/common"; import { randSeedInt } from "#utils/common";
@ -200,7 +200,8 @@ export const TrashToTreasureEncounter: MysteryEncounter = MysteryEncounterBuilde
const encounter = globalScene.currentBattle.mysteryEncounter!; const encounter = globalScene.currentBattle.mysteryEncounter!;
setEncounterRewards({ setEncounterRewards({
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.GREAT], guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS],
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.GREAT],
fillRemaining: true, fillRemaining: true,
}); });
encounter.startOfBattleEffects.push( encounter.startOfBattleEffects.push(

View File

@ -47,6 +47,7 @@ const namespace = "mysteryEncounters/weirdDream";
/** Exclude Ultra Beasts, Paradox, Eternatus, and all legendary/mythical/trio pokemon that are below 570 BST */ /** Exclude Ultra Beasts, Paradox, Eternatus, and all legendary/mythical/trio pokemon that are below 570 BST */
const EXCLUDED_TRANSFORMATION_SPECIES = [ const EXCLUDED_TRANSFORMATION_SPECIES = [
SpeciesId.ARCEUS,
SpeciesId.ETERNATUS, SpeciesId.ETERNATUS,
/** UBs */ /** UBs */
SpeciesId.NIHILEGO, SpeciesId.NIHILEGO,
@ -82,20 +83,19 @@ const EXCLUDED_TRANSFORMATION_SPECIES = [
SpeciesId.IRON_BOULDER, SpeciesId.IRON_BOULDER,
SpeciesId.IRON_CROWN, SpeciesId.IRON_CROWN,
/** These are banned so they don't appear in the < 570 BST pool */ /** These are banned so they don't appear in the < 570 BST pool */
SpeciesId.PHIONE,
SpeciesId.TYPE_NULL,
SpeciesId.COSMOG, SpeciesId.COSMOG,
SpeciesId.COSMOEM,
SpeciesId.MELTAN, SpeciesId.MELTAN,
SpeciesId.KUBFU, SpeciesId.KUBFU,
SpeciesId.COSMOEM,
SpeciesId.POIPOLE,
SpeciesId.TERAPAGOS,
SpeciesId.TYPE_NULL,
SpeciesId.CALYREX,
SpeciesId.NAGANADEL,
SpeciesId.URSHIFU, SpeciesId.URSHIFU,
SpeciesId.CALYREX,
SpeciesId.OGERPON, SpeciesId.OGERPON,
SpeciesId.OKIDOGI, SpeciesId.OKIDOGI,
SpeciesId.MUNKIDORI, SpeciesId.MUNKIDORI,
SpeciesId.FEZANDIPITI, SpeciesId.FEZANDIPITI,
SpeciesId.TERAPAGOS,
]; ];
const SUPER_LEGENDARY_BST_THRESHOLD = 600; const SUPER_LEGENDARY_BST_THRESHOLD = 600;
@ -226,6 +226,7 @@ export const WeirdDreamEncounter: MysteryEncounter = MysteryEncounterBuilder.wit
modifierTypes.MINT, modifierTypes.MINT,
modifierTypes.MINT, modifierTypes.MINT,
modifierTypes.MINT, modifierTypes.MINT,
modifierTypes.MINT,
], ],
fillRemaining: false, fillRemaining: false,
}); });
@ -648,15 +649,15 @@ function getTransformedSpecies(
} }
function doShowDreamBackground() { function doShowDreamBackground() {
const transformationContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); const transformationContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
transformationContainer.name = "Dream Background"; transformationContainer.name = "Dream Background";
// In case it takes a bit for video to load // In case it takes a bit for video to load
const transformationStaticBg = globalScene.add.rectangle( const transformationStaticBg = globalScene.add.rectangle(
0, 0,
0, 0,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6, globalScene.scaledCanvas.height,
0, 0,
); );
transformationStaticBg.setName("Black Background"); transformationStaticBg.setName("Black Background");

View File

@ -156,7 +156,7 @@ export class MysteryEncounterOption implements IMysteryEncounterOption {
return true; return true;
} }
console.log( console.log(
"Mystery Encounter Edge Case: Requirement not met due to primay pokemon overlapping with support pokemon. There's no valid primary pokemon left.", "Mystery Encounter Edge Case: Requirement not met due to primary pokemon overlapping with support pokemon. There's no valid primary pokemon left.",
); );
return false; return false;
} }

View File

@ -576,7 +576,7 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
*/ */
/** /**
* @statif Defines the type of encounter which is used as an identifier, should be tied to a unique MysteryEncounterType * @static Defines the type of encounter which is used as an identifier, should be tied to a unique MysteryEncounterType
* NOTE: if new functions are added to {@linkcode MysteryEncounter} class * NOTE: if new functions are added to {@linkcode MysteryEncounter} class
* @param encounterType * @param encounterType
* @returns this * @returns this
@ -605,7 +605,7 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
} }
/** /**
* Defines an option + phasefor the encounter. * Defines an option + phase for the encounter.
* Use for easy/streamlined options. * Use for easy/streamlined options.
* There should be at least 2 options defined and no more than 4. * There should be at least 2 options defined and no more than 4.
* If complex use {@linkcode MysteryEncounterBuilder.withOption} * If complex use {@linkcode MysteryEncounterBuilder.withOption}
@ -627,7 +627,7 @@ export class MysteryEncounterBuilder implements Partial<IMysteryEncounter> {
} }
/** /**
* Defines an option + phasefor the encounter. * Defines an option + phase for the encounter.
* Use for easy/streamlined options. * Use for easy/streamlined options.
* There should be at least 2 options defined and no more than 4. * There should be at least 2 options defined and no more than 4.
* If complex use {@linkcode MysteryEncounterBuilder.withOption} * If complex use {@linkcode MysteryEncounterBuilder.withOption}

View File

@ -6,7 +6,7 @@ import { isNullOrUndefined } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
/** /**
* Will inject all relevant dialogue tokens that exist in the {@linkcode BattlegScene.currentBattle.mysteryEncounter.dialogueTokens}, into i18n text. * Will inject all relevant dialogue tokens that exist in the {@linkcode globalScene.currentBattle.mysteryEncounter.dialogueTokens}, into i18n text.
* Also adds BBCodeText fragments for colored text, if applicable * Also adds BBCodeText fragments for colored text, if applicable
* @param keyOrString * @param keyOrString
* @param primaryStyle Can define a text style to be applied to the entire string. Must be defined for BBCodeText styles to be applied correctly * @param primaryStyle Can define a text style to be applied to the entire string. Must be defined for BBCodeText styles to be applied correctly

View File

@ -46,7 +46,7 @@ import type { PokemonData } from "#system/pokemon-data";
import type { TrainerConfig } from "#trainers/trainer-config"; import type { TrainerConfig } from "#trainers/trainer-config";
import { trainerConfigs } from "#trainers/trainer-config"; import { trainerConfigs } from "#trainers/trainer-config";
import type { HeldModifierConfig } from "#types/held-modifier-config"; import type { HeldModifierConfig } from "#types/held-modifier-config";
import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import type { PartyOption, PokemonSelectFilter } from "#ui/party-ui-handler"; import type { PartyOption, PokemonSelectFilter } from "#ui/party-ui-handler";
import { PartyUiMode } from "#ui/party-ui-handler"; import { PartyUiMode } from "#ui/party-ui-handler";
import { coerceArray, isNullOrUndefined, randomString, randSeedInt, randSeedItem } from "#utils/common"; import { coerceArray, isNullOrUndefined, randomString, randSeedInt, randSeedItem } from "#utils/common";

View File

@ -13,6 +13,7 @@ import { CustomPokemonData } from "#data/pokemon-data";
import type { PokemonSpecies } from "#data/pokemon-species"; import type { PokemonSpecies } from "#data/pokemon-species";
import { getStatusEffectCatchRateMultiplier } from "#data/status-effect"; import { getStatusEffectCatchRateMultiplier } from "#data/status-effect";
import type { AbilityId } from "#enums/ability-id"; import type { AbilityId } from "#enums/ability-id";
import { ChallengeType } from "#enums/challenge-type";
import { PlayerGender } from "#enums/player-gender"; import { PlayerGender } from "#enums/player-gender";
import type { PokeballType } from "#enums/pokeball"; import type { PokeballType } from "#enums/pokeball";
import type { PokemonType } from "#enums/pokemon-type"; import type { PokemonType } from "#enums/pokemon-type";
@ -33,7 +34,8 @@ import { achvs } from "#system/achv";
import type { PartyOption } from "#ui/party-ui-handler"; import type { PartyOption } from "#ui/party-ui-handler";
import { PartyUiMode } from "#ui/party-ui-handler"; import { PartyUiMode } from "#ui/party-ui-handler";
import { SummaryUiMode } from "#ui/summary-ui-handler"; import { SummaryUiMode } from "#ui/summary-ui-handler";
import { isNullOrUndefined, randSeedInt } from "#utils/common"; import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, isNullOrUndefined, randSeedInt } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import i18next from "i18next"; import i18next from "i18next";
@ -706,6 +708,13 @@ export async function catchPokemon(
}); });
}; };
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => { Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
const addStatus = new BooleanHolder(true);
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
if (!addStatus.value) {
removePokemon();
end();
return;
}
if (globalScene.getPlayerParty().length === 6) { if (globalScene.getPlayerParty().length === 6) {
const promptRelease = () => { const promptRelease = () => {
globalScene.ui.showText( globalScene.ui.showText(

View File

@ -162,6 +162,7 @@ export class PokemonSummonData {
if (key === "speciesForm" || key === "fusionSpeciesForm") { if (key === "speciesForm" || key === "fusionSpeciesForm") {
this[key] = deserializePokemonSpeciesForm(value); this[key] = deserializePokemonSpeciesForm(value);
continue;
} }
if (key === "illusion" && typeof value === "object") { if (key === "illusion" && typeof value === "object") {
@ -182,6 +183,7 @@ export class PokemonSummonData {
} }
} }
this[key] = illusionData as IllusionData; this[key] = illusionData as IllusionData;
continue;
} }
if (key === "moveset") { if (key === "moveset") {
@ -251,7 +253,6 @@ export class PokemonTempSummonData {
* Only currently used for positioning the battle cursor. * Only currently used for positioning the battle cursor.
*/ */
turnCount = 1; turnCount = 1;
/** /**
* The number of turns this pokemon has spent in the active position since the start of the wave * The number of turns this pokemon has spent in the active position since the start of the wave
* without switching out. * without switching out.

View File

@ -65,5 +65,45 @@ export enum ChallengeType {
/** /**
* Modifies what the pokemon stats for Flip Stat Mode. * Modifies what the pokemon stats for Flip Stat Mode.
*/ */
FLIP_STAT FLIP_STAT,
/**
* Challenges which conditionally enable or disable automatic party healing during biome transitions
* @see {@linkcode Challenge.applyPartyHealAvailability}
*/
PARTY_HEAL,
/**
* Challenges which conditionally enable or disable the shop
* @see {@linkcode Challenge.applyShopAvailability}
*/
SHOP,
/**
* Challenges which validate whether a pokemon can be added to the player's party or not
* @see {@linkcode Challenge.applyCatchAvailability}
*/
POKEMON_ADD_TO_PARTY,
/**
* Challenges which validate whether a pokemon is allowed to fuse or not
* @see {@linkcode Challenge.applyFusionAvailability}
*/
POKEMON_FUSION,
/**
* Challenges which validate whether particular moves can or cannot be used
* @see {@linkcode Challenge.applyMoveAvailability}
*/
POKEMON_MOVE,
/**
* Challenges which validate whether particular items are or are not sold in the shop
* @see {@linkcode Challenge.applyShopItems}
*/
SHOP_ITEM,
/**
* Challenges which validate whether particular items will be given as a reward after a wave
* @see {@linkcode Challenge.applyWaveRewards}
*/
WAVE_REWARD,
/**
* Challenges which prevent recovery from fainting
* @see {@linkcode Challenge.applyPermanentFaint}
*/
PREVENT_REVIVE,
} }

View File

@ -6,4 +6,7 @@ export enum Challenges {
FRESH_START, FRESH_START,
INVERSE_BATTLE, INVERSE_BATTLE,
FLIP_STAT, FLIP_STAT,
LIMITED_CATCH,
LIMITED_SUPPORT,
HARDCORE,
} }

View File

@ -43,5 +43,6 @@ export enum UiMode {
TEST_DIALOGUE, TEST_DIALOGUE,
AUTO_COMPLETE, AUTO_COMPLETE,
ADMIN, ADMIN,
MYSTERY_ENCOUNTER MYSTERY_ENCOUNTER,
CHANGE_PASSWORD_FORM,
} }

View File

@ -145,7 +145,7 @@ export class Arena {
? BiomePoolTier.BOSS_SUPER_RARE ? BiomePoolTier.BOSS_SUPER_RARE
: BiomePoolTier.BOSS_ULTRA_RARE; : BiomePoolTier.BOSS_ULTRA_RARE;
console.log(BiomePoolTier[tier]); console.log(BiomePoolTier[tier]);
while (!this.pokemonPool[tier].length) { while (!this.pokemonPool[tier]?.length) {
console.log(`Downgraded rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`); console.log(`Downgraded rarity tier from ${BiomePoolTier[tier]} to ${BiomePoolTier[tier - 1]}`);
tier--; tier--;
} }

View File

@ -30,7 +30,7 @@ export class DamageNumberHandler {
const baseScale = target.getSpriteScale() / 6; const baseScale = target.getSpriteScale() / 6;
const damageNumber = addTextObject( const damageNumber = addTextObject(
target.x, target.x,
-(globalScene.game.canvas.height / 6) + target.y - target.getSprite().height / 2, -globalScene.scaledCanvas.height + target.y - target.getSprite().height / 2,
formatStat(amount, true), formatStat(amount, true),
TextStyle.SUMMARY, TextStyle.SUMMARY,
); );

View File

@ -39,7 +39,6 @@ import {
TrappedTag, TrappedTag,
TypeImmuneTag, TypeImmuneTag,
} from "#data/battler-tags"; } from "#data/battler-tags";
import { applyChallenges } from "#data/challenge";
import { allAbilities, allMoves } from "#data/data-lists"; import { allAbilities, allMoves } from "#data/data-lists";
import { getLevelTotalExp } from "#data/exp"; import { getLevelTotalExp } from "#data/exp";
import { import {
@ -148,6 +147,7 @@ import { EnemyBattleInfo } from "#ui/enemy-battle-info";
import type { PartyOption } from "#ui/party-ui-handler"; import type { PartyOption } from "#ui/party-ui-handler";
import { PartyUiHandler, PartyUiMode } from "#ui/party-ui-handler"; import { PartyUiHandler, PartyUiMode } from "#ui/party-ui-handler";
import { PlayerBattleInfo } from "#ui/player-battle-info"; import { PlayerBattleInfo } from "#ui/player-battle-info";
import { applyChallenges } from "#utils/challenge-utils";
import { import {
BooleanHolder, BooleanHolder,
type Constructor, type Constructor,
@ -725,7 +725,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* Load all assets needed for this Pokemon's use in battle * Load all assets needed for this Pokemon's use in battle
* @param ignoreOverride - Whether to ignore overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `true` * @param ignoreOverride - Whether to ignore overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `true`
* @param useIllusion - Whether to consider this pokemon's active illusion; default `false` * @param useIllusion - Whether to consider this pokemon's active illusion; default `false`
* @returns A promise that resolves once all the corresponding assets have been loaded. * @returns A promise that resolves once all the corresponding assets have been loaded.
*/ */
@ -1032,7 +1032,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* Return this Pokemon's {@linkcode PokemonSpeciesForm | SpeciesForm}. * Return this Pokemon's {@linkcode PokemonSpeciesForm | SpeciesForm}.
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* and overrides `useIllusion`. * and overrides `useIllusion`.
* @param useIllusion - Whether to consider this Pokemon's illusion if present; default `false`. * @param useIllusion - Whether to consider this Pokemon's illusion if present; default `false`.
* @returns This Pokemon's {@linkcode PokemonSpeciesForm}. * @returns This Pokemon's {@linkcode PokemonSpeciesForm}.
@ -1088,7 +1088,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* Return the {@linkcode PokemonSpeciesForm | SpeciesForm} of this Pokemon's fusion counterpart. * Return the {@linkcode PokemonSpeciesForm | SpeciesForm} of this Pokemon's fusion counterpart.
* @param ignoreOverride - Whether to ignore species overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore species overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @param useIllusion - Whether to consider the species of this Pokemon's illusion; default `false` * @param useIllusion - Whether to consider the species of this Pokemon's illusion; default `false`
* @returns The {@linkcode PokemonSpeciesForm} of this Pokemon's fusion counterpart. * @returns The {@linkcode PokemonSpeciesForm} of this Pokemon's fusion counterpart.
*/ */
@ -1659,7 +1659,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* Return this Pokemon's {@linkcode Gender}. * Return this Pokemon's {@linkcode Gender}.
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @param useIllusion - Whether to consider this pokemon's illusion if present; default `false` * @param useIllusion - Whether to consider this pokemon's illusion if present; default `false`
* @returns the {@linkcode Gender} of this {@linkcode Pokemon}. * @returns the {@linkcode Gender} of this {@linkcode Pokemon}.
*/ */
@ -1675,7 +1675,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* Return this Pokemon's fusion's {@linkcode Gender}. * Return this Pokemon's fusion's {@linkcode Gender}.
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @param useIllusion - Whether to consider this pokemon's illusion if present; default `false` * @param useIllusion - Whether to consider this pokemon's illusion if present; default `false`
* @returns The {@linkcode Gender} of this {@linkcode Pokemon}'s fusion. * @returns The {@linkcode Gender} of this {@linkcode Pokemon}'s fusion.
*/ */
@ -1817,12 +1817,10 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* Return all the {@linkcode PokemonMove}s that make up this Pokemon's moveset. * Return all the {@linkcode PokemonMove}s that make up this Pokemon's moveset.
* Takes into account player/enemy moveset overrides (which will also override PP count). * Takes into account player/enemy moveset overrides (which will also override PP count).
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @returns An array of {@linkcode PokemonMove}, as described above. * @returns An array of {@linkcode PokemonMove}, as described above.
*/ */
getMoveset(ignoreOverride = false): PokemonMove[] { getMoveset(ignoreOverride = false): PokemonMove[] {
const ret = !ignoreOverride && this.summonData.moveset ? this.summonData.moveset : this.moveset;
// Overrides moveset based on arrays specified in overrides.ts // Overrides moveset based on arrays specified in overrides.ts
let overrideArray: MoveId | Array<MoveId> = this.isPlayer() let overrideArray: MoveId | Array<MoveId> = this.isPlayer()
? Overrides.MOVESET_OVERRIDE ? Overrides.MOVESET_OVERRIDE
@ -1838,7 +1836,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
}); });
} }
return ret; return !ignoreOverride && this.summonData.moveset ? this.summonData.moveset : this.moveset;
} }
/** /**
@ -1885,7 +1883,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* Evaluate and return this Pokemon's typing. * Evaluate and return this Pokemon's typing.
* @param includeTeraType - Whether to use this Pokemon's tera type if Terastallized; default `false` * @param includeTeraType - Whether to use this Pokemon's tera type if Terastallized; default `false`
* @param forDefend - Whether this Pokemon is currently receiving an attack; default `false` * @param forDefend - Whether this Pokemon is currently receiving an attack; default `false`
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @param useIllusion - Whether to consider this Pokemon's illusion if present; default `false` * @param useIllusion - Whether to consider this Pokemon's illusion if present; default `false`
* @returns An array of {@linkcode PokemonType}s corresponding to this Pokemon's typing (real or percieved). * @returns An array of {@linkcode PokemonType}s corresponding to this Pokemon's typing (real or percieved).
*/ */
@ -2008,7 +2006,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* @param type - The {@linkcode PokemonType} to check * @param type - The {@linkcode PokemonType} to check
* @param includeTeraType - Whether to use this Pokemon's tera type if Terastallized; default `true` * @param includeTeraType - Whether to use this Pokemon's tera type if Terastallized; default `true`
* @param forDefend - Whether this Pokemon is currently receiving an attack; default `false` * @param forDefend - Whether this Pokemon is currently receiving an attack; default `false`
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @returns Whether this Pokemon is of the specified type. * @returns Whether this Pokemon is of the specified type.
*/ */
public isOfType(type: PokemonType, includeTeraType = true, forDefend = false, ignoreOverride = false): boolean { public isOfType(type: PokemonType, includeTeraType = true, forDefend = false, ignoreOverride = false): boolean {
@ -2021,7 +2019,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* Should rarely be called directly in favor of {@linkcode hasAbility} or {@linkcode hasAbilityWithAttr}, * Should rarely be called directly in favor of {@linkcode hasAbility} or {@linkcode hasAbilityWithAttr},
* both of which check both ability slots and account for suppression. * both of which check both ability slots and account for suppression.
* @see {@linkcode hasAbility} and {@linkcode hasAbilityWithAttr} are the intended ways to check abilities in most cases * @see {@linkcode hasAbility} and {@linkcode hasAbilityWithAttr} are the intended ways to check abilities in most cases
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @returns The non-passive {@linkcode Ability} of this Pokemon. * @returns The non-passive {@linkcode Ability} of this Pokemon.
*/ */
public getAbility(ignoreOverride = false): Ability { public getAbility(ignoreOverride = false): Ability {
@ -2203,7 +2201,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* Accounts for all the various effects which can disable or modify abilities. * Accounts for all the various effects which can disable or modify abilities.
* @param ability - The {@linkcode Abilities | Ability} to check for * @param ability - The {@linkcode Abilities | Ability} to check for
* @param canApply - Whether to check if the ability is currently active; default `true` * @param canApply - Whether to check if the ability is currently active; default `true`
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @returns Whether this {@linkcode Pokemon} has the given ability * @returns Whether this {@linkcode Pokemon} has the given ability
*/ */
public hasAbility(ability: AbilityId, canApply = true, ignoreOverride = false): boolean { public hasAbility(ability: AbilityId, canApply = true, ignoreOverride = false): boolean {
@ -2218,7 +2216,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* Accounts for all the various effects which can disable or modify abilities. * Accounts for all the various effects which can disable or modify abilities.
* @param attrType - The {@linkcode AbAttr | attribute} to check for * @param attrType - The {@linkcode AbAttr | attribute} to check for
* @param canApply - Whether to check if the ability is currently active; default `true` * @param canApply - Whether to check if the ability is currently active; default `true`
* @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode Moves.TRANSFORM | Transform}; default `false` * @param ignoreOverride - Whether to ignore any overrides caused by {@linkcode MoveId.TRANSFORM | Transform}; default `false`
* @returns Whether this Pokemon has an ability with the given {@linkcode AbAttr}. * @returns Whether this Pokemon has an ability with the given {@linkcode AbAttr}.
*/ */
public hasAbilityWithAttr(attrType: AbAttrString, canApply = true, ignoreOverride = false): boolean { public hasAbilityWithAttr(attrType: AbAttrString, canApply = true, ignoreOverride = false): boolean {
@ -4047,7 +4045,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* @param damage integer * @param damage integer
* @param ignoreSegments boolean, not currently used * @param ignoreSegments boolean, not currently used
* @param preventEndure used to update damage if endure or sturdy * @param preventEndure used to update damage if endure or sturdy
* @param ignoreFaintPhas flag on whether to add FaintPhase if pokemon after applying damage faints * @param ignoreFaintPhase flag on whether to add FaintPhase if pokemon after applying damage faints
* @returns integer representing damage dealt * @returns integer representing damage dealt
*/ */
damage(damage: number, _ignoreSegments = false, preventEndure = false, ignoreFaintPhase = false): number { damage(damage: number, _ignoreSegments = false, preventEndure = false, ignoreFaintPhase = false): number {
@ -4468,7 +4466,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
* Return the most recently executed {@linkcode TurnMove} this {@linkcode Pokemon} has used that is: * Return the most recently executed {@linkcode TurnMove} this {@linkcode Pokemon} has used that is:
* - Not {@linkcode MoveId.NONE} * - Not {@linkcode MoveId.NONE}
* - Non-virtual ({@linkcode MoveUseMode | useMode} < {@linkcode MoveUseMode.INDIRECT}) * - Non-virtual ({@linkcode MoveUseMode | useMode} < {@linkcode MoveUseMode.INDIRECT})
* @param ignoreStruggle - Whether to additionally ignore {@linkcode Moves.STRUGGLE}; default `false` * @param ignoreStruggle - Whether to additionally ignore {@linkcode MoveId.STRUGGLE}; default `false`
* @param ignoreFollowUp - Whether to ignore moves with a use type of {@linkcode MoveUseMode.FOLLOW_UP} * @param ignoreFollowUp - Whether to ignore moves with a use type of {@linkcode MoveUseMode.FOLLOW_UP}
* (e.g. ones called by Copycat/Mirror Move); default `true`. * (e.g. ones called by Copycat/Mirror Move); default `true`.
* @returns The last move this Pokemon has used satisfying the aforementioned conditions, * @returns The last move this Pokemon has used satisfying the aforementioned conditions,
@ -4560,8 +4558,17 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
} }
const key = this.species.getCryKey(this.formIndex); const key = this.species.getCryKey(this.formIndex);
let rate = 0.85; const crySoundConfig = { rate: 0.85, detune: 0 };
const cry = globalScene.playSound(key, { rate: rate }) as AnySound; if (this.isPlayer()) {
// If fainting is permanent, emphasize impact
const preventRevive = new BooleanHolder(false);
applyChallenges(ChallengeType.PREVENT_REVIVE, preventRevive);
if (preventRevive.value) {
crySoundConfig.detune = -100;
crySoundConfig.rate = 0.7;
}
}
const cry = globalScene.playSound(key, crySoundConfig) as AnySound;
if (!cry || globalScene.fieldVolume === 0) { if (!cry || globalScene.fieldVolume === 0) {
callback(); callback();
return; return;
@ -4580,7 +4587,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
delay: fixedInt(delay), delay: fixedInt(delay),
repeat: -1, repeat: -1,
callback: () => { callback: () => {
frameThreshold = sprite.anims.msPerFrame / rate; frameThreshold = sprite.anims.msPerFrame / crySoundConfig.rate;
frameProgress += delay; frameProgress += delay;
while (frameProgress > frameThreshold) { while (frameProgress > frameThreshold) {
if (sprite.anims.duration) { if (sprite.anims.duration) {
@ -4590,8 +4597,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
frameProgress -= frameThreshold; frameProgress -= frameThreshold;
} }
if (cry && !cry.pendingRemove) { if (cry && !cry.pendingRemove) {
rate *= 0.99; cry.setRate(crySoundConfig.rate * 0.99);
cry.setRate(rate);
} else { } else {
faintCryTimer?.destroy(); faintCryTimer?.destroy();
faintCryTimer = null; faintCryTimer = null;
@ -5096,6 +5102,7 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
*/ */
resetWaveData(): void { resetWaveData(): void {
this.waveData = new PokemonWaveData(); this.waveData = new PokemonWaveData();
this.tempSummonData.waveTurnCount = 1;
} }
resetTera(): void { resetTera(): void {
@ -5199,38 +5206,38 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
} }
} }
updateFusionPalette(ignoreOveride?: boolean): void { updateFusionPalette(ignoreOverride?: boolean): void {
if (!this.getFusionSpeciesForm(ignoreOveride)) { if (!this.getFusionSpeciesForm(ignoreOverride)) {
[this.getSprite(), this.getTintSprite()] [this.getSprite(), this.getTintSprite()]
.filter(s => !!s) .filter(s => !!s)
.map(s => { .map(s => {
s.pipelineData[`spriteColors${ignoreOveride && this.summonData.speciesForm ? "Base" : ""}`] = []; s.pipelineData[`spriteColors${ignoreOverride && this.summonData.speciesForm ? "Base" : ""}`] = [];
s.pipelineData[`fusionSpriteColors${ignoreOveride && this.summonData.speciesForm ? "Base" : ""}`] = []; s.pipelineData[`fusionSpriteColors${ignoreOverride && this.summonData.speciesForm ? "Base" : ""}`] = [];
}); });
return; return;
} }
const speciesForm = this.getSpeciesForm(ignoreOveride); const speciesForm = this.getSpeciesForm(ignoreOverride);
const fusionSpeciesForm = this.getFusionSpeciesForm(ignoreOveride); const fusionSpeciesForm = this.getFusionSpeciesForm(ignoreOverride);
const spriteKey = speciesForm.getSpriteKey( const spriteKey = speciesForm.getSpriteKey(
this.getGender(ignoreOveride) === Gender.FEMALE, this.getGender(ignoreOverride) === Gender.FEMALE,
speciesForm.formIndex, speciesForm.formIndex,
this.shiny, this.shiny,
this.variant, this.variant,
); );
const backSpriteKey = speciesForm const backSpriteKey = speciesForm
.getSpriteKey(this.getGender(ignoreOveride) === Gender.FEMALE, speciesForm.formIndex, this.shiny, this.variant) .getSpriteKey(this.getGender(ignoreOverride) === Gender.FEMALE, speciesForm.formIndex, this.shiny, this.variant)
.replace("pkmn__", "pkmn__back__"); .replace("pkmn__", "pkmn__back__");
const fusionSpriteKey = fusionSpeciesForm.getSpriteKey( const fusionSpriteKey = fusionSpeciesForm.getSpriteKey(
this.getFusionGender(ignoreOveride) === Gender.FEMALE, this.getFusionGender(ignoreOverride) === Gender.FEMALE,
fusionSpeciesForm.formIndex, fusionSpeciesForm.formIndex,
this.fusionShiny, this.fusionShiny,
this.fusionVariant, this.fusionVariant,
); );
const fusionBackSpriteKey = fusionSpeciesForm const fusionBackSpriteKey = fusionSpeciesForm
.getSpriteKey( .getSpriteKey(
this.getFusionGender(ignoreOveride) === Gender.FEMALE, this.getFusionGender(ignoreOverride) === Gender.FEMALE,
fusionSpeciesForm.formIndex, fusionSpeciesForm.formIndex,
this.fusionShiny, this.fusionShiny,
this.fusionVariant, this.fusionVariant,
@ -5515,8 +5522,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
[this.getSprite(), this.getTintSprite()] [this.getSprite(), this.getTintSprite()]
.filter(s => !!s) .filter(s => !!s)
.map(s => { .map(s => {
s.pipelineData[`spriteColors${ignoreOveride && this.summonData.speciesForm ? "Base" : ""}`] = spriteColors; s.pipelineData[`spriteColors${ignoreOverride && this.summonData.speciesForm ? "Base" : ""}`] = spriteColors;
s.pipelineData[`fusionSpriteColors${ignoreOveride && this.summonData.speciesForm ? "Base" : ""}`] = s.pipelineData[`fusionSpriteColors${ignoreOverride && this.summonData.speciesForm ? "Base" : ""}`] =
fusionSpriteColors; fusionSpriteColors;
}); });

View File

@ -2,8 +2,7 @@ import { FixedBattleConfig } from "#app/battle";
import { CHALLENGE_MODE_MYSTERY_ENCOUNTER_WAVES, CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants"; import { CHALLENGE_MODE_MYSTERY_ENCOUNTER_WAVES, CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import Overrides from "#app/overrides"; import Overrides from "#app/overrides";
import type { Challenge } from "#data/challenge"; import { allChallenges, type Challenge, copyChallenge } from "#data/challenge";
import { allChallenges, applyChallenges, copyChallenge } from "#data/challenge";
import { getDailyStartingBiome } from "#data/daily-run"; import { getDailyStartingBiome } from "#data/daily-run";
import { allSpecies } from "#data/data-lists"; import { allSpecies } from "#data/data-lists";
import type { PokemonSpecies } from "#data/pokemon-species"; import type { PokemonSpecies } from "#data/pokemon-species";
@ -14,7 +13,8 @@ import { GameModes } from "#enums/game-modes";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import type { Arena } from "#field/arena"; import type { Arena } from "#field/arena";
import { classicFixedBattles, type FixedBattleConfigs } from "#trainers/fixed-battle-configs"; import { classicFixedBattles, type FixedBattleConfigs } from "#trainers/fixed-battle-configs";
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#utils/common"; import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, isNullOrUndefined, randSeedInt, randSeedItem } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
interface GameModeConfig { interface GameModeConfig {
@ -311,6 +311,16 @@ export class GameMode implements GameModeConfig {
return this.battleConfig[waveIndex]; return this.battleConfig[waveIndex];
} }
/**
* Check if the current game mode has the shop enabled or not
* @returns Whether the shop is available in the current mode
*/
public getShopStatus(): boolean {
const status = new BooleanHolder(!this.hasNoShop);
applyChallenges(ChallengeType.SHOP, status);
return status.value;
}
getClearScoreBonus(): number { getClearScoreBonus(): number {
switch (this.modeId) { switch (this.modeId) {
case GameModes.CLASSIC: case GameModes.CLASSIC:

View File

@ -14,6 +14,7 @@ import { pokemonFormChanges, SpeciesFormChangeCondition } from "#data/pokemon-fo
import { getStatusEffectDescriptor } from "#data/status-effect"; import { getStatusEffectDescriptor } from "#data/status-effect";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { BerryType } from "#enums/berry-type"; import { BerryType } from "#enums/berry-type";
import { ChallengeType } from "#enums/challenge-type";
import { FormChangeItem } from "#enums/form-change-item"; import { FormChangeItem } from "#enums/form-change-item";
import { ModifierPoolType } from "#enums/modifier-pool-type"; import { ModifierPoolType } from "#enums/modifier-pool-type";
import { ModifierTier } from "#enums/modifier-tier"; import { ModifierTier } from "#enums/modifier-tier";
@ -104,7 +105,7 @@ import {
TempExtraModifierModifier, TempExtraModifierModifier,
TempStatStageBoosterModifier, TempStatStageBoosterModifier,
TerastallizeAccessModifier, TerastallizeAccessModifier,
TerrastalizeModifier, TerastallizeModifier,
TmModifier, TmModifier,
TurnHealModifier, TurnHealModifier,
TurnHeldItemTransferModifier, TurnHeldItemTransferModifier,
@ -116,7 +117,16 @@ import type { ModifierTypeFunc, WeightedModifierTypeWeightFunc } from "#types/mo
import type { PokemonMoveSelectFilter, PokemonSelectFilter } from "#ui/party-ui-handler"; import type { PokemonMoveSelectFilter, PokemonSelectFilter } from "#ui/party-ui-handler";
import { PartyUiHandler } from "#ui/party-ui-handler"; import { PartyUiHandler } from "#ui/party-ui-handler";
import { getModifierTierTextTint } from "#ui/text"; import { getModifierTierTextTint } from "#ui/text";
import { formatMoney, isNullOrUndefined, NumberHolder, padInt, randSeedInt, randSeedItem } from "#utils/common"; import { applyChallenges } from "#utils/challenge-utils";
import {
BooleanHolder,
formatMoney,
isNullOrUndefined,
NumberHolder,
padInt,
randSeedInt,
randSeedItem,
} from "#utils/common";
import { getEnumKeys, getEnumValues } from "#utils/enums"; import { getEnumKeys, getEnumValues } from "#utils/enums";
import { getModifierPoolForType, getModifierType } from "#utils/modifier-utils"; import { getModifierPoolForType, getModifierType } from "#utils/modifier-utils";
import i18next from "i18next"; import i18next from "i18next";
@ -421,7 +431,7 @@ export class TerastallizeModifierType extends PokemonModifierType {
super( super(
"", "",
`${PokemonType[teraType].toLowerCase()}_tera_shard`, `${PokemonType[teraType].toLowerCase()}_tera_shard`,
(type, args) => new TerrastalizeModifier(type as TerastallizeModifierType, (args[0] as Pokemon).id, teraType), (type, args) => new TerastallizeModifier(type as TerastallizeModifierType, (args[0] as Pokemon).id, teraType),
(pokemon: PlayerPokemon) => { (pokemon: PlayerPokemon) => {
if ( if (
[pokemon.species.speciesId, pokemon.fusionSpecies?.speciesId].filter( [pokemon.species.speciesId, pokemon.fusionSpecies?.speciesId].filter(
@ -533,7 +543,9 @@ export class PokemonReviveModifierType extends PokemonHpRestoreModifierType {
); );
this.selectFilter = (pokemon: PlayerPokemon) => { this.selectFilter = (pokemon: PlayerPokemon) => {
if (pokemon.hp) { const selectStatus = new BooleanHolder(pokemon.hp !== 0);
applyChallenges(ChallengeType.PREVENT_REVIVE, selectStatus);
if (selectStatus.value) {
return PartyUiHandler.NoEffectMessage; return PartyUiHandler.NoEffectMessage;
} }
return null; return null;
@ -1011,6 +1023,7 @@ class AllPokemonFullReviveModifierType extends AllPokemonFullHpRestoreModifierTy
"modifierType:ModifierType.AllPokemonFullReviveModifierType", "modifierType:ModifierType.AllPokemonFullReviveModifierType",
(_type, _args) => new PokemonHpRestoreModifier(this, -1, 0, 100, false, true), (_type, _args) => new PokemonHpRestoreModifier(this, -1, 0, 100, false, true),
); );
this.group = "revive";
} }
} }
@ -1262,7 +1275,9 @@ export class FusePokemonModifierType extends PokemonModifierType {
iconImage, iconImage,
(_type, args) => new FusePokemonModifier(this, (args[0] as PlayerPokemon).id, (args[1] as PlayerPokemon).id), (_type, args) => new FusePokemonModifier(this, (args[0] as PlayerPokemon).id, (args[1] as PlayerPokemon).id),
(pokemon: PlayerPokemon) => { (pokemon: PlayerPokemon) => {
if (pokemon.isFusion()) { const selectStatus = new BooleanHolder(pokemon.isFusion());
applyChallenges(ChallengeType.POKEMON_FUSION, pokemon, selectStatus);
if (selectStatus.value) {
return PartyUiHandler.NoEffectMessage; return PartyUiHandler.NoEffectMessage;
} }
return null; return null;
@ -2574,11 +2589,15 @@ function getModifierTypeOptionWithRetry(
): ModifierTypeOption { ): ModifierTypeOption {
allowLuckUpgrades = allowLuckUpgrades ?? true; allowLuckUpgrades = allowLuckUpgrades ?? true;
let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades); let candidate = getNewModifierTypeOption(party, ModifierPoolType.PLAYER, tier, undefined, 0, allowLuckUpgrades);
const candidateValidity = new BooleanHolder(true);
applyChallenges(ChallengeType.WAVE_REWARD, candidate, candidateValidity);
let r = 0; let r = 0;
while ( while (
existingOptions.length && (existingOptions.length &&
++r < retryCount && ++r < retryCount &&
existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group).length existingOptions.filter(o => o.type.name === candidate?.type.name || o.type.group === candidate?.type.group)
.length) ||
!candidateValidity.value
) { ) {
candidate = getNewModifierTypeOption( candidate = getNewModifierTypeOption(
party, party,
@ -2588,6 +2607,7 @@ function getModifierTypeOptionWithRetry(
0, 0,
allowLuckUpgrades, allowLuckUpgrades,
); );
applyChallenges(ChallengeType.WAVE_REWARD, candidate, candidateValidity);
} }
return candidate!; return candidate!;
} }
@ -2648,7 +2668,15 @@ export function getPlayerShopModifierTypeOptionsForWave(waveIndex: number, baseC
[new ModifierTypeOption(modifierTypeInitObj.FULL_RESTORE(), 0, baseCost * 2.25)], [new ModifierTypeOption(modifierTypeInitObj.FULL_RESTORE(), 0, baseCost * 2.25)],
[new ModifierTypeOption(modifierTypeInitObj.SACRED_ASH(), 0, baseCost * 10)], [new ModifierTypeOption(modifierTypeInitObj.SACRED_ASH(), 0, baseCost * 10)],
]; ];
return options.slice(0, Math.ceil(Math.max(waveIndex + 10, 0) / 30)).flat();
return options
.slice(0, Math.ceil(Math.max(waveIndex + 10, 0) / 30))
.flat()
.filter(shopItem => {
const status = new BooleanHolder(true);
applyChallenges(ChallengeType.SHOP_ITEM, shopItem, status);
return status.value;
});
} }
export function getEnemyBuffModifierForWave( export function getEnemyBuffModifierForWave(

View File

@ -2073,7 +2073,7 @@ export abstract class ConsumablePokemonModifier extends ConsumableModifier {
} }
} }
export class TerrastalizeModifier extends ConsumablePokemonModifier { export class TerastallizeModifier extends ConsumablePokemonModifier {
public declare type: TerastallizeModifierType; public declare type: TerastallizeModifierType;
public teraType: PokemonType; public teraType: PokemonType;
@ -2084,9 +2084,9 @@ export class TerrastalizeModifier extends ConsumablePokemonModifier {
} }
/** /**
* Checks if {@linkcode TerrastalizeModifier} should be applied * Checks if {@linkcode TerastallizeModifier} should be applied
* @param playerPokemon The {@linkcode PlayerPokemon} that consumes the item * @param playerPokemon The {@linkcode PlayerPokemon} that consumes the item
* @returns `true` if the {@linkcode TerrastalizeModifier} should be applied * @returns `true` if the {@linkcode TerastallizeModifier} should be applied
*/ */
override shouldApply(playerPokemon?: PlayerPokemon): boolean { override shouldApply(playerPokemon?: PlayerPokemon): boolean {
return ( return (
@ -2098,7 +2098,7 @@ export class TerrastalizeModifier extends ConsumablePokemonModifier {
} }
/** /**
* Applies {@linkcode TerrastalizeModifier} * Applies {@linkcode TerastallizeModifier}
* @param pokemon The {@linkcode PlayerPokemon} that consumes the item * @param pokemon The {@linkcode PlayerPokemon} that consumes the item
* @returns `true` if hp was restored * @returns `true` if hp was restored
*/ */
@ -3875,7 +3875,7 @@ const ModifierClassMap = Object.freeze({
ResetNegativeStatStageModifier, ResetNegativeStatStageModifier,
FieldEffectModifier, FieldEffectModifier,
ConsumablePokemonModifier, ConsumablePokemonModifier,
TerrastalizeModifier, TerastallizeModifier,
PokemonHpRestoreModifier, PokemonHpRestoreModifier,
PokemonStatusHealModifier, PokemonStatusHealModifier,
ConsumablePokemonMoveModifier, ConsumablePokemonMoveModifier,

View File

@ -11,7 +11,7 @@ export abstract class Phase {
/** /**
* The string name of the phase, used to identify the phase type for {@linkcode is} * The string name of the phase, used to identify the phase type for {@linkcode is}
* *
* @privateremarks * @privateRemarks
* *
* When implementing a phase, you must set the `phaseName` property to the name of the phase. * When implementing a phase, you must set the `phaseName` property to the name of the phase.
*/ */

View File

@ -12,6 +12,7 @@ import {
} from "#data/pokeball"; } from "#data/pokeball";
import { getStatusEffectCatchRateMultiplier } from "#data/status-effect"; import { getStatusEffectCatchRateMultiplier } from "#data/status-effect";
import { BattlerIndex } from "#enums/battler-index"; import { BattlerIndex } from "#enums/battler-index";
import { ChallengeType } from "#enums/challenge-type";
import type { PokeballType } from "#enums/pokeball"; import type { PokeballType } from "#enums/pokeball";
import { StatusEffect } from "#enums/status-effect"; import { StatusEffect } from "#enums/status-effect";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
@ -23,6 +24,8 @@ import { achvs } from "#system/achv";
import type { PartyOption } from "#ui/party-ui-handler"; import type { PartyOption } from "#ui/party-ui-handler";
import { PartyUiMode } from "#ui/party-ui-handler"; import { PartyUiMode } from "#ui/party-ui-handler";
import { SummaryUiMode } from "#ui/summary-ui-handler"; import { SummaryUiMode } from "#ui/summary-ui-handler";
import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
// TODO: Refactor and split up to allow for overriding capture chance // TODO: Refactor and split up to allow for overriding capture chance
@ -287,6 +290,13 @@ export class AttemptCapturePhase extends PokemonPhase {
}); });
}; };
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => { Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
const addStatus = new BooleanHolder(true);
applyChallenges(ChallengeType.POKEMON_ADD_TO_PARTY, pokemon, addStatus);
if (!addStatus.value) {
removePokemon();
end();
return;
}
if (globalScene.getPlayerParty().length === PLAYER_PARTY_MAX_SIZE) { if (globalScene.getPlayerParty().length === PLAYER_PARTY_MAX_SIZE) {
const promptRelease = () => { const promptRelease = () => {
globalScene.ui.showText( globalScene.ui.showText(

View File

@ -58,12 +58,6 @@ export class BattleEndPhase extends BattlePhase {
globalScene.phaseManager.unshiftNew("GameOverPhase", true); globalScene.phaseManager.unshiftNew("GameOverPhase", true);
} }
for (const pokemon of globalScene.getField()) {
if (pokemon) {
pokemon.tempSummonData.waveTurnCount = 1;
}
}
for (const pokemon of globalScene.getPokemonAllowedInBattle()) { for (const pokemon of globalScene.getPokemonAllowedInBattle()) {
applyAbAttrs("PostBattleAbAttr", { pokemon, victory: this.isVictory }); applyAbAttrs("PostBattleAbAttr", { pokemon, victory: this.isVictory });
} }

View File

@ -9,6 +9,7 @@ import { ArenaTagType } from "#enums/arena-tag-type";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { BiomeId } from "#enums/biome-id"; import { BiomeId } from "#enums/biome-id";
import { ChallengeType } from "#enums/challenge-type";
import { Command } from "#enums/command"; import { Command } from "#enums/command";
import { FieldPosition } from "#enums/field-position"; import { FieldPosition } from "#enums/field-position";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
@ -21,6 +22,8 @@ import type { MoveTargetSet } from "#moves/move";
import { getMoveTargets } from "#moves/move-utils"; import { getMoveTargets } from "#moves/move-utils";
import { FieldPhase } from "#phases/field-phase"; import { FieldPhase } from "#phases/field-phase";
import type { TurnMove } from "#types/turn-move"; import type { TurnMove } from "#types/turn-move";
import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
export class CommandPhase extends FieldPhase { export class CommandPhase extends FieldPhase {
@ -109,7 +112,7 @@ export class CommandPhase extends FieldPhase {
* Clear out all unusable moves in front of the currently acting pokemon's move queue. * Clear out all unusable moves in front of the currently acting pokemon's move queue.
*/ */
// TODO: Refactor move queue handling to ensure that this method is not necessary. // TODO: Refactor move queue handling to ensure that this method is not necessary.
private clearUnusuableMoves(): void { private clearUnusableMoves(): void {
const playerPokemon = this.getPokemon(); const playerPokemon = this.getPokemon();
const moveQueue = playerPokemon.getMoveQueue(); const moveQueue = playerPokemon.getMoveQueue();
if (moveQueue.length === 0) { if (moveQueue.length === 0) {
@ -140,7 +143,7 @@ export class CommandPhase extends FieldPhase {
* @returns Whether a queued move was successfully set to be executed. * @returns Whether a queued move was successfully set to be executed.
*/ */
private tryExecuteQueuedMove(): boolean { private tryExecuteQueuedMove(): boolean {
this.clearUnusuableMoves(); this.clearUnusableMoves();
const playerPokemon = globalScene.getPlayerField()[this.fieldIndex]; const playerPokemon = globalScene.getPlayerField()[this.fieldIndex];
const moveQueue = playerPokemon.getMoveQueue(); const moveQueue = playerPokemon.getMoveQueue();
@ -210,16 +213,27 @@ export class CommandPhase extends FieldPhase {
const move = user.getMoveset()[cursor]; const move = user.getMoveset()[cursor];
globalScene.ui.setMode(UiMode.MESSAGE); globalScene.ui.setMode(UiMode.MESSAGE);
// Decides between a Disabled, Not Implemented, or No PP translation message // Set the translation key for why the move cannot be selected
const errorMessage = user.isMoveRestricted(move.moveId, user) let cannotSelectKey: string;
? user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId) const moveStatus = new BooleanHolder(true);
: move.getName().endsWith(" (N)") applyChallenges(ChallengeType.POKEMON_MOVE, move.moveId, moveStatus);
? "battle:moveNotImplemented" if (!moveStatus.value) {
: "battle:moveNoPP"; cannotSelectKey = "battle:moveCannotUseChallenge";
} else if (move.getPpRatio() === 0) {
cannotSelectKey = "battle:moveNoPP";
} else if (move.getName().endsWith(" (N)")) {
cannotSelectKey = "battle:moveNotImplemented";
} else if (user.isMoveRestricted(move.moveId, user)) {
cannotSelectKey = user.getRestrictingTag(move.moveId, user)!.selectionDeniedText(user, move.moveId);
} else {
// TODO: Consider a message that signals a being unusable for an unknown reason
cannotSelectKey = "";
}
const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator const moveName = move.getName().replace(" (N)", ""); // Trims off the indicator
globalScene.ui.showText( globalScene.ui.showText(
i18next.t(errorMessage, { moveName: moveName }), i18next.t(cannotSelectKey, { moveName: moveName }),
null, null,
() => { () => {
globalScene.ui.clearText(); globalScene.ui.clearText();

View File

@ -148,9 +148,9 @@ export class EggHatchPhase extends Phase {
this.eggHatchOverlay = globalScene.add.rectangle( this.eggHatchOverlay = globalScene.add.rectangle(
0, 0,
-globalScene.game.canvas.height / 6, -globalScene.scaledCanvas.height,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6, globalScene.scaledCanvas.height,
0xffffff, 0xffffff,
); );
this.eggHatchOverlay.setOrigin(0, 0); this.eggHatchOverlay.setOrigin(0, 0);

View File

@ -25,8 +25,8 @@ export class EndCardPhase extends Phase {
globalScene.field.add(this.endCard); globalScene.field.add(this.endCard);
this.text = addTextObject( this.text = addTextObject(
globalScene.game.canvas.width / 12, globalScene.scaledCanvas.width / 2,
globalScene.game.canvas.height / 6 - 16, globalScene.scaledCanvas.height - 16,
i18next.t("battle:congratulations"), i18next.t("battle:congratulations"),
TextStyle.SUMMARY, TextStyle.SUMMARY,
{ fontSize: "128px" }, { fontSize: "128px" },

View File

@ -90,16 +90,16 @@ export class EvolutionPhase extends Phase {
.setVisible(false); .setVisible(false);
this.evolutionBgOverlay = globalScene.add this.evolutionBgOverlay = globalScene.add
.rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6, 0x262626) .rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height, 0x262626)
.setOrigin(0) .setOrigin(0)
.setAlpha(0); .setAlpha(0);
this.evolutionContainer.add([this.evolutionBaseBg, this.evolutionBgOverlay, this.evolutionBg]); this.evolutionContainer.add([this.evolutionBaseBg, this.evolutionBgOverlay, this.evolutionBg]);
this.evolutionOverlay = globalScene.add.rectangle( this.evolutionOverlay = globalScene.add.rectangle(
0, 0,
-globalScene.game.canvas.height / 6, -globalScene.scaledCanvas.height,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6 - 48, globalScene.scaledCanvas.height - 48,
0xffffff, 0xffffff,
); );
this.evolutionOverlay.setOrigin(0).setAlpha(0); this.evolutionOverlay.setOrigin(0).setAlpha(0);

View File

@ -649,7 +649,6 @@ export class MovePhase extends BattlePhase {
* Displays the move's usage text to the player as applicable for the move being used. * Displays the move's usage text to the player as applicable for the move being used.
*/ */
public showMoveText(): void { public showMoveText(): void {
// No text for Moves.NONE, recharging/2-turn moves or interrupted moves
if ( if (
this.move.moveId === MoveId.NONE || this.move.moveId === MoveId.NONE ||
this.pokemon.getTag(BattlerTagType.RECHARGING) || this.pokemon.getTag(BattlerTagType.RECHARGING) ||
@ -658,7 +657,6 @@ export class MovePhase extends BattlePhase {
return; return;
} }
// Play message for magic coat reflection
// TODO: This should be done by the move... // TODO: This should be done by the move...
globalScene.phaseManager.queueMessage( globalScene.phaseManager.queueMessage(
i18next.t(isReflected(this.useMode) ? "battle:magicCoatActivated" : "battle:useMove", { i18next.t(isReflected(this.useMode) ? "battle:magicCoatActivated" : "battle:useMove", {

View File

@ -1,6 +1,8 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { ChallengeType } from "#enums/challenge-type";
import { BattlePhase } from "#phases/battle-phase"; import { BattlePhase } from "#phases/battle-phase";
import { fixedInt } from "#utils/common"; import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, fixedInt } from "#utils/common";
export class PartyHealPhase extends BattlePhase { export class PartyHealPhase extends BattlePhase {
public readonly phaseName = "PartyHealPhase"; public readonly phaseName = "PartyHealPhase";
@ -20,7 +22,14 @@ export class PartyHealPhase extends BattlePhase {
globalScene.fadeOutBgm(1000, false); globalScene.fadeOutBgm(1000, false);
} }
globalScene.ui.fadeOut(1000).then(() => { globalScene.ui.fadeOut(1000).then(() => {
const preventRevive = new BooleanHolder(false);
applyChallenges(ChallengeType.PREVENT_REVIVE, preventRevive);
for (const pokemon of globalScene.getPlayerParty()) { for (const pokemon of globalScene.getPlayerParty()) {
// Prevent reviving fainted pokemon during certain challenges
if (pokemon.isFainted() && preventRevive.value) {
continue;
}
pokemon.hp = pokemon.getMaxHp(); pokemon.hp = pokemon.getMaxHp();
pokemon.resetStatus(true, false, false, true); pokemon.resetStatus(true, false, false, true);
for (const move of pokemon.moveset) { for (const move of pokemon.moveset) {

View File

@ -1,11 +1,13 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { biomeLinks, getBiomeName } from "#balance/biomes"; import { biomeLinks, getBiomeName } from "#balance/biomes";
import { BiomeId } from "#enums/biome-id"; import { BiomeId } from "#enums/biome-id";
import { ChallengeType } from "#enums/challenge-type";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { MapModifier, MoneyInterestModifier } from "#modifiers/modifier"; import { MapModifier, MoneyInterestModifier } from "#modifiers/modifier";
import { BattlePhase } from "#phases/battle-phase"; import { BattlePhase } from "#phases/battle-phase";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { randSeedInt } from "#utils/common"; import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, randSeedInt } from "#utils/common";
export class SelectBiomePhase extends BattlePhase { export class SelectBiomePhase extends BattlePhase {
public readonly phaseName = "SelectBiomePhase"; public readonly phaseName = "SelectBiomePhase";
@ -20,7 +22,11 @@ export class SelectBiomePhase extends BattlePhase {
const setNextBiome = (nextBiome: BiomeId) => { const setNextBiome = (nextBiome: BiomeId) => {
if (nextWaveIndex % 10 === 1) { if (nextWaveIndex % 10 === 1) {
globalScene.applyModifiers(MoneyInterestModifier, true); globalScene.applyModifiers(MoneyInterestModifier, true);
globalScene.phaseManager.unshiftNew("PartyHealPhase", false); const healStatus = new BooleanHolder(true);
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
if (healStatus.value) {
globalScene.phaseManager.unshiftNew("PartyHealPhase", false);
}
} }
globalScene.phaseManager.unshiftNew("SwitchBiomePhase", nextBiome); globalScene.phaseManager.unshiftNew("SwitchBiomePhase", nextBiome);
this.end(); this.end();

View File

@ -1,7 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import Overrides from "#app/overrides"; import Overrides from "#app/overrides";
import { Phase } from "#app/phase"; import { Phase } from "#app/phase";
import { applyChallenges } from "#data/challenge";
import { SpeciesFormChangeMoveLearnedTrigger } from "#data/form-change-triggers"; import { SpeciesFormChangeMoveLearnedTrigger } from "#data/form-change-triggers";
import { Gender } from "#data/gender"; import { Gender } from "#data/gender";
import { ChallengeType } from "#enums/challenge-type"; import { ChallengeType } from "#enums/challenge-type";
@ -10,6 +9,7 @@ import { UiMode } from "#enums/ui-mode";
import { overrideHeldItems, overrideModifiers } from "#modifiers/modifier"; import { overrideHeldItems, overrideModifiers } from "#modifiers/modifier";
import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler"; import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler";
import type { Starter } from "#ui/starter-select-ui-handler"; import type { Starter } from "#ui/starter-select-ui-handler";
import { applyChallenges } from "#utils/challenge-utils";
import { isNullOrUndefined } from "#utils/common"; import { isNullOrUndefined } from "#utils/common";
import { getPokemonSpecies } from "#utils/pokemon-utils"; import { getPokemonSpecies } from "#utils/pokemon-utils";
import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade";

View File

@ -16,7 +16,7 @@ import type { Modifier } from "#modifiers/modifier";
import { getDailyRunStarterModifiers, regenerateModifierPoolThresholds } from "#modifiers/modifier-type"; import { getDailyRunStarterModifiers, regenerateModifierPoolThresholds } from "#modifiers/modifier-type";
import type { SessionSaveData } from "#system/game-data"; import type { SessionSaveData } from "#system/game-data";
import { vouchers } from "#system/voucher"; import { vouchers } from "#system/voucher";
import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler"; import { SaveSlotUiMode } from "#ui/save-slot-select-ui-handler";
import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#utils/common"; import { isLocal, isLocalServerConnected, isNullOrUndefined } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -3,10 +3,13 @@ import { globalScene } from "#app/global-scene";
import { modifierTypes } from "#data/data-lists"; import { modifierTypes } from "#data/data-lists";
import { BattleType } from "#enums/battle-type"; import { BattleType } from "#enums/battle-type";
import type { BattlerIndex } from "#enums/battler-index"; import type { BattlerIndex } from "#enums/battler-index";
import { ChallengeType } from "#enums/challenge-type";
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
import type { CustomModifierSettings } from "#modifiers/modifier-type"; import type { CustomModifierSettings } from "#modifiers/modifier-type";
import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils"; import { handleMysteryEncounterVictory } from "#mystery-encounters/encounter-phase-utils";
import { PokemonPhase } from "#phases/pokemon-phase"; import { PokemonPhase } from "#phases/pokemon-phase";
import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder } from "#utils/common";
export class VictoryPhase extends PokemonPhase { export class VictoryPhase extends PokemonPhase {
public readonly phaseName = "VictoryPhase"; public readonly phaseName = "VictoryPhase";
@ -63,7 +66,9 @@ export class VictoryPhase extends PokemonPhase {
break; break;
} }
} }
if (globalScene.currentBattle.waveIndex % 10) { const healStatus = new BooleanHolder(globalScene.currentBattle.waveIndex % 10 === 0);
applyChallenges(ChallengeType.PARTY_HEAL, healStatus);
if (!healStatus.value) {
globalScene.phaseManager.pushNew( globalScene.phaseManager.pushNew(
"SelectModifierPhase", "SelectModifierPhase",
undefined, undefined,

View File

@ -1,6 +1,7 @@
import { ApiBase } from "#api/api-base"; import { ApiBase } from "#api/api-base";
import { SESSION_ID_COOKIE_NAME } from "#app/constants"; import { SESSION_ID_COOKIE_NAME } from "#app/constants";
import type { import type {
AccountChangePwRequest,
AccountInfoResponse, AccountInfoResponse,
AccountLoginRequest, AccountLoginRequest,
AccountLoginResponse, AccountLoginResponse,
@ -95,4 +96,19 @@ export class PokerogueAccountApi extends ApiBase {
removeCookie(SESSION_ID_COOKIE_NAME); // we are always clearing the cookie. removeCookie(SESSION_ID_COOKIE_NAME); // we are always clearing the cookie.
} }
public async changePassword(changePwData: AccountChangePwRequest) {
try {
const response = await this.doPost("/account/changepw", changePwData, "form-urlencoded");
if (response.ok) {
return null;
}
console.warn("Change password failed!", response.status, response.statusText);
return response.text();
} catch (err) {
console.warn("Change password failed!", err);
}
return "Unknown error!";
}
} }

View File

@ -5,6 +5,7 @@ import {
FlipStatChallenge, FlipStatChallenge,
FreshStartChallenge, FreshStartChallenge,
InverseBattleChallenge, InverseBattleChallenge,
LimitedCatchChallenge,
SingleGenerationChallenge, SingleGenerationChallenge,
SingleTypeChallenge, SingleTypeChallenge,
} from "#data/challenge"; } from "#data/challenge";
@ -922,6 +923,19 @@ export const achvs = {
c.value > 0 && c.value > 0 &&
globalScene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0), globalScene.gameMode.challenges.some(c => c.id === Challenges.INVERSE_BATTLE && c.value > 0),
).setSecret(), ).setSecret(),
// TODO: Decide on icon
NUZLOCKE: new ChallengeAchv(
"NUZLOCKE",
"",
"NUZLOCKE.description",
"leaf_stone",
100,
c =>
c instanceof LimitedCatchChallenge &&
c.value > 0 &&
globalScene.gameMode.challenges.some(c => c.id === Challenges.HARDCORE && c.value > 0) &&
globalScene.gameMode.challenges.some(c => c.id === Challenges.FRESH_START && c.value > 0),
),
BREEDERS_IN_SPACE: new Achv("BREEDERS_IN_SPACE", "", "BREEDERS_IN_SPACE.description", "moon_stone", 50).setSecret(), BREEDERS_IN_SPACE: new Achv("BREEDERS_IN_SPACE", "", "BREEDERS_IN_SPACE.description", "moon_stone", 50).setSecret(),
}; };

View File

@ -11,7 +11,6 @@ import { speciesEggMoves } from "#balance/egg-moves";
import { pokemonPrevolutions } from "#balance/pokemon-evolutions"; import { pokemonPrevolutions } from "#balance/pokemon-evolutions";
import { speciesStarterCosts } from "#balance/starters"; import { speciesStarterCosts } from "#balance/starters";
import { ArenaTrapTag } from "#data/arena-tag"; import { ArenaTrapTag } from "#data/arena-tag";
import { applyChallenges } from "#data/challenge";
import { allMoves, allSpecies } from "#data/data-lists"; import { allMoves, allSpecies } from "#data/data-lists";
import type { Egg } from "#data/egg"; import type { Egg } from "#data/egg";
import { pokemonFormChanges } from "#data/pokemon-forms"; import { pokemonFormChanges } from "#data/pokemon-forms";
@ -63,6 +62,7 @@ import { VoucherType, vouchers } from "#system/voucher";
import { trainerConfigs } from "#trainers/trainer-config"; import { trainerConfigs } from "#trainers/trainer-config";
import type { DexData, DexEntry } from "#types/dex-data"; import type { DexData, DexEntry } from "#types/dex-data";
import { RUN_HISTORY_LIMIT } from "#ui/run-history-ui-handler"; import { RUN_HISTORY_LIMIT } from "#ui/run-history-ui-handler";
import { applyChallenges } from "#utils/challenge-utils";
import { executeIf, fixedInt, isLocal, NumberHolder, randInt, randSeedItem } from "#utils/common"; import { executeIf, fixedInt, isLocal, NumberHolder, randInt, randSeedItem } from "#utils/common";
import { decrypt, encrypt } from "#utils/data"; import { decrypt, encrypt } from "#utils/data";
import { getEnumKeys } from "#utils/enums"; import { getEnumKeys } from "#utils/enums";

View File

@ -144,7 +144,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole
handler: () => changeGamepadHandler(g), handler: () => changeGamepadHandler(g),
})), })),
{ {
label: i18next.t("settings:cancelContollerChoice"), label: i18next.t("settings:cancelControllerChoice"),
handler: cancelHandler, handler: cancelHandler,
}, },
], ],

View File

@ -653,7 +653,7 @@ export class TimedEventDisplay extends Phaser.GameObjects.Container {
console.log(this.event.bannerKey); console.log(this.event.bannerKey);
const padding = 5; const padding = 5;
const showTimer = this.event.eventType !== EventType.NO_TIMER_DISPLAY; const showTimer = this.event.eventType !== EventType.NO_TIMER_DISPLAY;
const yPosition = globalScene.game.canvas.height / 6 - padding - (showTimer ? 10 : 0) - (this.event.yOffset ?? 0); const yPosition = globalScene.scaledCanvas.height - padding - (showTimer ? 10 : 0) - (this.event.yOffset ?? 0);
this.banner = new Phaser.GameObjects.Image(globalScene, this.availableWidth / 2, yPosition - padding, key); this.banner = new Phaser.GameObjects.Image(globalScene, this.availableWidth / 2, yPosition - padding, key);
this.banner.setName("img-event-banner"); this.banner.setName("img-event-banner");
this.banner.setOrigin(0.5, 1); this.banner.setOrigin(0.5, 1);

View File

@ -66,7 +66,7 @@ export abstract class AbstractOptionSelectUiHandler extends UiHandler {
setup() { setup() {
const ui = this.getUi(); const ui = this.getUi();
this.optionSelectContainer = globalScene.add.container(globalScene.game.canvas.width / 6 - 1, -48); this.optionSelectContainer = globalScene.add.container(globalScene.scaledCanvas.width - 1, -48);
this.optionSelectContainer.setName(`option-select-${this.mode ? UiMode[this.mode] : "UNKNOWN"}`); this.optionSelectContainer.setName(`option-select-${this.mode ? UiMode[this.mode] : "UNKNOWN"}`);
this.optionSelectContainer.setVisible(false); this.optionSelectContainer.setVisible(false);
ui.add(this.optionSelectContainer); ui.add(this.optionSelectContainer);
@ -135,7 +135,7 @@ export abstract class AbstractOptionSelectUiHandler extends UiHandler {
this.optionSelectText.setName("text-option-select"); this.optionSelectText.setName("text-option-select");
this.optionSelectTextContainer.add(this.optionSelectText); this.optionSelectTextContainer.add(this.optionSelectText);
this.optionSelectContainer.setPosition( this.optionSelectContainer.setPosition(
globalScene.game.canvas.width / 6 - 1 - (this.config?.xOffset || 0), globalScene.scaledCanvas.width - 1 - (this.config?.xOffset || 0),
-48 + (this.config?.yOffset || 0), -48 + (this.config?.yOffset || 0),
); );
this.optionSelectBg.width = Math.max(this.optionSelectText.displayWidth + 24, this.getWindowWidth()); this.optionSelectBg.width = Math.max(this.optionSelectText.displayWidth + 24, this.getWindowWidth());

View File

@ -21,7 +21,7 @@ export class AchvBar extends Phaser.GameObjects.Container {
public shown: boolean; public shown: boolean;
constructor() { constructor() {
super(globalScene, globalScene.game.canvas.width / 6, 0); super(globalScene, globalScene.scaledCanvas.width, 0);
this.playerGender = globalScene.gameData.gender; this.playerGender = globalScene.gameData.gender;
} }
@ -118,7 +118,7 @@ export class AchvBar extends Phaser.GameObjects.Container {
globalScene.tweens.add({ globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6 - this.bg.width / 2, x: globalScene.scaledCanvas.width - this.bg.width / 2,
duration: 500, duration: 500,
ease: "Sine.easeOut", ease: "Sine.easeOut",
}); });
@ -136,7 +136,7 @@ export class AchvBar extends Phaser.GameObjects.Container {
globalScene.tweens.add({ globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6, x: globalScene.scaledCanvas.width,
duration: 500, duration: 500,
ease: "Sine.easeIn", ease: "Sine.easeIn",
onComplete: () => { onComplete: () => {

View File

@ -72,9 +72,9 @@ export class AchvsUiHandler extends MessageUiHandler {
const ui = this.getUi(); const ui = this.getUi();
/** Width of the global canvas / 6 */ /** Width of the global canvas / 6 */
const WIDTH = globalScene.game.canvas.width / 6; const WIDTH = globalScene.scaledCanvas.width;
/** Height of the global canvas / 6 */ /** Height of the global canvas / 6 */
const HEIGHT = globalScene.game.canvas.height / 6; const HEIGHT = globalScene.scaledCanvas.height;
this.mainContainer = globalScene.add.container(1, -HEIGHT + 1); this.mainContainer = globalScene.add.container(1, -HEIGHT + 1);

View File

@ -36,7 +36,7 @@ interface ArenaEffectInfo {
/** The enum string representation of the effect */ /** The enum string representation of the effect */
name: string; name: string;
/** {@linkcode ArenaEffectType} type of effect */ /** {@linkcode ArenaEffectType} type of effect */
effecType: ArenaEffectType; effectType: ArenaEffectType;
/** The maximum duration set by the effect */ /** The maximum duration set by the effect */
maxDuration: number; maxDuration: number;
@ -246,7 +246,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
// Creates a proxy object to decide which text object needs to be updated // Creates a proxy object to decide which text object needs to be updated
let textObject: Phaser.GameObjects.Text; let textObject: Phaser.GameObjects.Text;
switch (fieldEffectInfo.effecType) { switch (fieldEffectInfo.effectType) {
case ArenaEffectType.PLAYER: case ArenaEffectType.PLAYER:
textObject = this.flyoutTextPlayer; textObject = this.flyoutTextPlayer;
break; break;
@ -300,7 +300,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
const existingTrapTagIndex = isArenaTrapTag const existingTrapTagIndex = isArenaTrapTag
? this.fieldEffectInfo.findIndex( ? this.fieldEffectInfo.findIndex(
e => tagAddedEvent.arenaTagType === e.tagType && arenaEffectType === e.effecType, e => tagAddedEvent.arenaTagType === e.tagType && arenaEffectType === e.effectType,
) )
: -1; : -1;
let name: string = getFieldEffectText(ArenaTagType[tagAddedEvent.arenaTagType]); let name: string = getFieldEffectText(ArenaTagType[tagAddedEvent.arenaTagType]);
@ -318,7 +318,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
this.fieldEffectInfo.push({ this.fieldEffectInfo.push({
name, name,
effecType: arenaEffectType, effectType: arenaEffectType,
maxDuration: tagAddedEvent.duration, maxDuration: tagAddedEvent.duration,
duration: tagAddedEvent.duration, duration: tagAddedEvent.duration,
tagType: tagAddedEvent.arenaTagType, tagType: tagAddedEvent.arenaTagType,
@ -353,7 +353,7 @@ export class ArenaFlyout extends Phaser.GameObjects.Container {
? WeatherType[fieldEffectChangedEvent.newWeatherType] ? WeatherType[fieldEffectChangedEvent.newWeatherType]
: TerrainType[fieldEffectChangedEvent.newTerrainType], : TerrainType[fieldEffectChangedEvent.newTerrainType],
), ),
effecType: effectType:
fieldEffectChangedEvent instanceof WeatherChangedEvent ? ArenaEffectType.WEATHER : ArenaEffectType.TERRAIN, fieldEffectChangedEvent instanceof WeatherChangedEvent ? ArenaEffectType.WEATHER : ArenaEffectType.TERRAIN,
maxDuration: fieldEffectChangedEvent.duration, maxDuration: fieldEffectChangedEvent.duration,
duration: fieldEffectChangedEvent.duration, duration: fieldEffectChangedEvent.duration,

View File

@ -1,6 +1,6 @@
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { AbstractOptionSelectUiHandler } from "#ui/abstact-option-select-ui-handler"; import { AbstractOptionSelectUiHandler } from "#ui/abstract-option-select-ui-handler";
export class AutoCompleteUiHandler extends AbstractOptionSelectUiHandler { export class AutoCompleteUiHandler extends AbstractOptionSelectUiHandler {
modalContainer: Phaser.GameObjects.Container; modalContainer: Phaser.GameObjects.Container;

View File

@ -37,7 +37,7 @@ export class BallUiHandler extends UiHandler {
const optionsText = addTextObject(0, 0, optionsTextContent, TextStyle.WINDOW, { align: "right", maxLines: 6 }); const optionsText = addTextObject(0, 0, optionsTextContent, TextStyle.WINDOW, { align: "right", maxLines: 6 });
const optionsTextWidth = optionsText.displayWidth; const optionsTextWidth = optionsText.displayWidth;
this.pokeballSelectContainer = globalScene.add.container( this.pokeballSelectContainer = globalScene.add.container(
globalScene.game.canvas.width / 6 - 51 - Math.max(64, optionsTextWidth), globalScene.scaledCanvas.width - 51 - Math.max(64, optionsTextWidth),
-49, -49,
); );
this.pokeballSelectContainer.setVisible(false); this.pokeballSelectContainer.setVisible(false);

View File

@ -16,7 +16,6 @@ interface BaseStatsOverlaySettings {
const HEIGHT = 120; const HEIGHT = 120;
const BORDER = 8; const BORDER = 8;
const GLOBAL_SCALE = 6;
const shortStats = ["HP", "ATK", "DEF", "SPATK", "SPDEF", "SPD"]; const shortStats = ["HP", "ATK", "DEF", "SPATK", "SPDEF", "SPD"];
export class BaseStatsOverlay extends Phaser.GameObjects.Container implements InfoToggle { export class BaseStatsOverlay extends Phaser.GameObjects.Container implements InfoToggle {
@ -109,7 +108,7 @@ export class BaseStatsOverlay extends Phaser.GameObjects.Container implements In
// width of this element // width of this element
static getWidth(_scale: number): number { static getWidth(_scale: number): number {
return globalScene.game.canvas.width / GLOBAL_SCALE / 2; return globalScene.scaledCanvas.width / 2;
} }
// height of this element // height of this element

View File

@ -39,7 +39,7 @@ export class PlayerBattleInfo extends BattleInfo {
statOverflow: 1, statOverflow: 1,
}, },
}; };
super(Math.floor(globalScene.game.canvas.width / 6) - 10, -72, true, posParams); super(Math.floor(globalScene.scaledCanvas.width) - 10, -72, true, posParams);
this.hpNumbersContainer = globalScene.add.container(-15, 10).setName("container_hp"); this.hpNumbersContainer = globalScene.add.container(-15, 10).setName("container_hp");
@ -198,11 +198,11 @@ export class PlayerBattleInfo extends BattleInfo {
this.lastLevelCapped = isLevelCapped; this.lastLevelCapped = isLevelCapped;
if (this.lastExp !== pokemon.exp || this.lastLevel !== pokemon.level) { if (this.lastExp !== pokemon.exp || this.lastLevel !== pokemon.level) {
const durationMultipler = Math.max( const durationMultiplier = Math.max(
Phaser.Tweens.Builders.GetEaseFunction("Cubic.easeIn")(1 - Math.min(pokemon.level - this.lastLevel, 10) / 10), Phaser.Tweens.Builders.GetEaseFunction("Cubic.easeIn")(1 - Math.min(pokemon.level - this.lastLevel, 10) / 10),
0.1, 0.1,
); );
await this.updatePokemonExp(pokemon, false, durationMultipler); await this.updatePokemonExp(pokemon, false, durationMultiplier);
} else if (isLevelCapped !== oldLevelCapped) { } else if (isLevelCapped !== oldLevelCapped) {
this.setLevel(pokemon.level); this.setLevel(pokemon.level);
} }

View File

@ -94,7 +94,7 @@ export class BattleMessageUiHandler extends MessageUiHandler {
this.levelUpStatsContainer = levelUpStatsContainer; this.levelUpStatsContainer = levelUpStatsContainer;
const levelUpStatsLabelsContent = addTextObject(globalScene.game.canvas.width / 6 - 73, -94, "", TextStyle.WINDOW, { const levelUpStatsLabelsContent = addTextObject(globalScene.scaledCanvas.width - 73, -94, "", TextStyle.WINDOW, {
maxLines: 6, maxLines: 6,
}); });
let levelUpStatsLabelText = ""; let levelUpStatsLabelText = "";
@ -106,7 +106,7 @@ export class BattleMessageUiHandler extends MessageUiHandler {
levelUpStatsLabelsContent.x -= levelUpStatsLabelsContent.displayWidth; levelUpStatsLabelsContent.x -= levelUpStatsLabelsContent.displayWidth;
const levelUpStatsBg = addWindow( const levelUpStatsBg = addWindow(
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
-100, -100,
80 + levelUpStatsLabelsContent.displayWidth, 80 + levelUpStatsLabelsContent.displayWidth,
100, 100,
@ -117,7 +117,7 @@ export class BattleMessageUiHandler extends MessageUiHandler {
levelUpStatsContainer.add(levelUpStatsLabelsContent); levelUpStatsContainer.add(levelUpStatsLabelsContent);
const levelUpStatsIncrContent = addTextObject( const levelUpStatsIncrContent = addTextObject(
globalScene.game.canvas.width / 6 - 50, globalScene.scaledCanvas.width - 50,
-94, -94,
"+\n+\n+\n+\n+\n+", "+\n+\n+\n+\n+\n+",
TextStyle.WINDOW, TextStyle.WINDOW,
@ -128,7 +128,7 @@ export class BattleMessageUiHandler extends MessageUiHandler {
this.levelUpStatsIncrContent = levelUpStatsIncrContent; this.levelUpStatsIncrContent = levelUpStatsIncrContent;
const levelUpStatsValuesContent = addBBCodeTextObject( const levelUpStatsValuesContent = addBBCodeTextObject(
globalScene.game.canvas.width / 6 - 7, globalScene.scaledCanvas.width - 7,
-94, -94,
"", "",
TextStyle.WINDOW, TextStyle.WINDOW,

View File

@ -19,7 +19,7 @@ export class CandyBar extends Phaser.GameObjects.Container {
public shown: boolean; public shown: boolean;
constructor() { constructor() {
super(globalScene, globalScene.game.canvas.width / 6, -(globalScene.game.canvas.height / 6) + 15); super(globalScene, globalScene.scaledCanvas.width, -globalScene.scaledCanvas.height + 15);
} }
setup(): void { setup(): void {
@ -80,7 +80,7 @@ export class CandyBar extends Phaser.GameObjects.Container {
this.tween = globalScene.tweens.add({ this.tween = globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6 - (this.bg.width - 5), x: globalScene.scaledCanvas.width - (this.bg.width - 5),
duration: 500, duration: 500,
ease: "Sine.easeOut", ease: "Sine.easeOut",
onComplete: () => { onComplete: () => {
@ -111,7 +111,7 @@ export class CandyBar extends Phaser.GameObjects.Container {
this.tween = globalScene.tweens.add({ this.tween = globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6, x: globalScene.scaledCanvas.width,
duration: 500, duration: 500,
ease: "Sine.easeIn", ease: "Sine.easeIn",
onComplete: () => { onComplete: () => {

View File

@ -58,11 +58,11 @@ export class GameChallengesUiHandler extends UiHandler {
this.widestTextBox = 0; this.widestTextBox = 0;
this.challengesContainer = globalScene.add.container(1, -(globalScene.game.canvas.height / 6) + 1); this.challengesContainer = globalScene.add.container(1, -globalScene.scaledCanvas.height + 1);
this.challengesContainer.setName("challenges"); this.challengesContainer.setName("challenges");
this.challengesContainer.setInteractive( this.challengesContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
@ -79,7 +79,7 @@ export class GameChallengesUiHandler extends UiHandler {
this.challengesContainer.add(bgOverlay); this.challengesContainer.add(bgOverlay);
// TODO: Change this back to /9 when adding in difficulty // TODO: Change this back to /9 when adding in difficulty
const headerBg = addWindow(0, 0, globalScene.game.canvas.width / 6, 24); const headerBg = addWindow(0, 0, globalScene.scaledCanvas.width, 24);
headerBg.setName("window-header-bg"); headerBg.setName("window-header-bg");
headerBg.setOrigin(0, 0); headerBg.setOrigin(0, 0);

View File

@ -0,0 +1,124 @@
import { globalScene } from "#app/global-scene";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import { UiMode } from "#enums/ui-mode";
import type { InputFieldConfig } from "#ui/form-modal-ui-handler";
import { FormModalUiHandler } from "#ui/form-modal-ui-handler";
import type { ModalConfig } from "#ui/modal-ui-handler";
import i18next from "i18next";
export class ChangePasswordFormUiHandler extends FormModalUiHandler {
private readonly ERR_PASSWORD: string = "invalid password";
private readonly ERR_ACCOUNT_EXIST: string = "account doesn't exist";
private readonly ERR_PASSWORD_MISMATCH: string = "password doesn't match";
constructor(mode: UiMode | null = null) {
super(mode);
}
setup(): void {
super.setup();
}
override getModalTitle(_config?: ModalConfig): string {
return i18next.t("menu:changePassword");
}
override getWidth(_config?: ModalConfig): number {
return 160;
}
override getMargin(_config?: ModalConfig): [number, number, number, number] {
return [0, 0, 48, 0];
}
override getButtonLabels(_config?: ModalConfig): string[] {
return [i18next.t("settings:buttonSubmit"), i18next.t("menu:cancel")];
}
override getReadableErrorMessage(error: string): string {
const colonIndex = error?.indexOf(":");
if (colonIndex > 0) {
error = error.slice(0, colonIndex);
}
switch (error) {
case this.ERR_PASSWORD:
return i18next.t("menu:invalidRegisterPassword");
case this.ERR_ACCOUNT_EXIST:
return i18next.t("menu:accountNonExistent");
case this.ERR_PASSWORD_MISMATCH:
return i18next.t("menu:passwordNotMatchingConfirmPassword");
}
return super.getReadableErrorMessage(error);
}
override getInputFieldConfigs(): InputFieldConfig[] {
const inputFieldConfigs: InputFieldConfig[] = [];
inputFieldConfigs.push({
label: i18next.t("menu:password"),
isPassword: true,
});
inputFieldConfigs.push({
label: i18next.t("menu:confirmPassword"),
isPassword: true,
});
return inputFieldConfigs;
}
override show(args: [ModalConfig, ...any]): boolean {
if (super.show(args)) {
const config = args[0];
const originalSubmitAction = this.submitAction;
this.submitAction = () => {
if (globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
// Prevent overlapping overrides on action modification
this.submitAction = originalSubmitAction;
this.sanitizeInputs();
globalScene.ui.setMode(UiMode.LOADING, { buttonActions: [] });
const onFail = (error: string | null) => {
globalScene.ui.setMode(UiMode.CHANGE_PASSWORD_FORM, Object.assign(config, { errorMessage: error?.trim() }));
globalScene.ui.playError();
};
const [passwordInput, confirmPasswordInput] = this.inputs;
if (!passwordInput?.text) {
return onFail(this.getReadableErrorMessage("invalid password"));
}
if (passwordInput.text !== confirmPasswordInput.text) {
return onFail(this.ERR_PASSWORD_MISMATCH);
}
pokerogueApi.account.changePassword({ password: passwordInput.text }).then(error => {
if (!error && originalSubmitAction) {
globalScene.ui.playSelect();
originalSubmitAction();
// Only clear inputs if the action was successful
for (const input of this.inputs) {
input.setText("");
}
} else {
onFail(error);
}
});
}
};
// Upon pressing cancel, the inputs should be cleared
const originalCancelAction = this.cancelAction;
this.cancelAction = () => {
globalScene.ui.playSelect();
for (const input of this.inputs) {
input.setText("");
}
originalCancelAction?.();
};
return true;
}
return false;
}
override clear() {
super.clear();
this.setMouseCursorStyle("default"); //reset cursor
}
}

View File

@ -10,7 +10,7 @@ export class CharSprite extends Phaser.GameObjects.Container {
public shown: boolean; public shown: boolean;
constructor() { constructor() {
super(globalScene, globalScene.game.canvas.width / 6 + 32, -42); super(globalScene, globalScene.scaledCanvas.width + 32, -42);
} }
setup(): void { setup(): void {
@ -49,7 +49,7 @@ export class CharSprite extends Phaser.GameObjects.Container {
globalScene.tweens.add({ globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6 - 102, x: globalScene.scaledCanvas.width - 102,
duration: 750, duration: 750,
ease: "Cubic.easeOut", ease: "Cubic.easeOut",
onComplete: () => { onComplete: () => {
@ -95,7 +95,7 @@ export class CharSprite extends Phaser.GameObjects.Container {
globalScene.tweens.add({ globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6 + 32, x: globalScene.scaledCanvas.width + 32,
duration: 750, duration: 750,
ease: "Cubic.easeIn", ease: "Cubic.easeIn",
onComplete: () => { onComplete: () => {

View File

@ -42,7 +42,7 @@ export class CommandUiHandler extends UiHandler {
ui.add(this.commandsContainer); ui.add(this.commandsContainer);
this.teraButton = globalScene.add.sprite(-32, 15, "button_tera"); this.teraButton = globalScene.add.sprite(-32, 15, "button_tera");
this.teraButton.setName("terrastallize-button"); this.teraButton.setName("terastallize-button");
this.teraButton.setScale(1.3); this.teraButton.setScale(1.3);
this.teraButton.setFrame("fire"); this.teraButton.setFrame("fire");
this.teraButton.setPipeline(globalScene.spritePipeline, { this.teraButton.setPipeline(globalScene.spritePipeline, {

View File

@ -1,8 +1,8 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import type { OptionSelectConfig } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectConfig } from "#ui/abstract-option-select-ui-handler";
import { AbstractOptionSelectUiHandler } from "#ui/abstact-option-select-ui-handler"; import { AbstractOptionSelectUiHandler } from "#ui/abstract-option-select-ui-handler";
import i18next from "i18next"; import i18next from "i18next";
export class ConfirmUiHandler extends AbstractOptionSelectUiHandler { export class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
@ -69,7 +69,7 @@ export class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
const xOffset = args.length >= 7 && args[6] !== null ? (args[6] as number) : 0; const xOffset = args.length >= 7 && args[6] !== null ? (args[6] as number) : 0;
const yOffset = args.length >= 8 && args[7] !== null ? (args[7] as number) : 0; const yOffset = args.length >= 8 && args[7] !== null ? (args[7] as number) : 0;
this.optionSelectContainer.setPosition(globalScene.game.canvas.width / 6 - 1 + xOffset, -48 + yOffset); this.optionSelectContainer.setPosition(globalScene.scaledCanvas.width - 1 + xOffset, -48 + yOffset);
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0); this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);
return true; return true;
@ -103,7 +103,7 @@ export class ConfirmUiHandler extends AbstractOptionSelectUiHandler {
const xOffset = args.length >= 4 && args[3] !== null ? (args[3] as number) : 0; const xOffset = args.length >= 4 && args[3] !== null ? (args[3] as number) : 0;
const yOffset = args.length >= 5 && args[4] !== null ? (args[4] as number) : 0; const yOffset = args.length >= 5 && args[4] !== null ? (args[4] as number) : 0;
this.optionSelectContainer.setPosition(globalScene.game.canvas.width / 6 - 1 + xOffset, -48 + yOffset); this.optionSelectContainer.setPosition(globalScene.scaledCanvas.width - 1 + xOffset, -48 + yOffset);
this.setCursor(this.switchCheck ? this.switchCheckCursor : 0); this.setCursor(this.switchCheck ? this.switchCheckCursor : 0);

View File

@ -174,7 +174,7 @@ export class EggGachaUiHandler extends MessageUiHandler {
const ui = this.getUi(); const ui = this.getUi();
this.eggGachaContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6).setVisible(false); this.eggGachaContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height).setVisible(false);
ui.add(this.eggGachaContainer); ui.add(this.eggGachaContainer);
const bg = globalScene.add.nineslice(0, 0, "default_bg", undefined, 320, 180, 0, 0, 16, 0).setOrigin(0); const bg = globalScene.add.nineslice(0, 0, "default_bg", undefined, 320, 180, 0, 0, 16, 0).setOrigin(0);
@ -212,7 +212,7 @@ export class EggGachaUiHandler extends MessageUiHandler {
this.eggGachaOptionSelectBg = addWindow(0, 0, eggGachaOptionSelectWidth, 16 + 576 * this.scale).setOrigin(1); this.eggGachaOptionSelectBg = addWindow(0, 0, eggGachaOptionSelectWidth, 16 + 576 * this.scale).setOrigin(1);
this.eggGachaOptionsContainer = globalScene.add this.eggGachaOptionsContainer = globalScene.add
.container(globalScene.game.canvas.width / 6, 148) .container(globalScene.scaledCanvas.width, 148)
.add(this.eggGachaOptionSelectBg); .add(this.eggGachaOptionSelectBg);
this.eggGachaContainer.add(this.eggGachaOptionsContainer); this.eggGachaContainer.add(this.eggGachaOptionsContainer);
@ -278,7 +278,7 @@ export class EggGachaUiHandler extends MessageUiHandler {
this.eggGachaContainer.add(this.eggGachaOptionsContainer); this.eggGachaContainer.add(this.eggGachaOptionsContainer);
for (const voucher of getEnumValues(VoucherType)) { for (const voucher of getEnumValues(VoucherType)) {
const container = globalScene.add.container(globalScene.game.canvas.width / 6 - 56 * voucher, 0); const container = globalScene.add.container(globalScene.scaledCanvas.width - 56 * voucher, 0);
const bg = addWindow(0, 0, 56, 22).setOrigin(1, 0); const bg = addWindow(0, 0, 56, 22).setOrigin(1, 0);
container.add(bg); container.add(bg);

View File

@ -19,7 +19,7 @@ export class EggHatchSceneHandler extends UiHandler {
} }
setup() { setup() {
this.eggHatchContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); this.eggHatchContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
globalScene.fieldUI.add(this.eggHatchContainer); globalScene.fieldUI.add(this.eggHatchContainer);
const eggLightraysAnimFrames = globalScene.anims.generateFrameNames("egg_lightrays", { start: 0, end: 3 }); const eggLightraysAnimFrames = globalScene.anims.generateFrameNames("egg_lightrays", { start: 0, end: 3 });

View File

@ -36,11 +36,11 @@ export class EggListUiHandler extends MessageUiHandler {
setup() { setup() {
const ui = this.getUi(); const ui = this.getUi();
this.eggListContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6).setVisible(false); this.eggListContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height).setVisible(false);
ui.add(this.eggListContainer); ui.add(this.eggListContainer);
const bgColor = globalScene.add const bgColor = globalScene.add
.rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6, 0x006860) .rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height, 0x006860)
.setOrigin(0); .setOrigin(0);
const eggListBg = globalScene.add.image(0, 0, "egg_list_bg").setOrigin(0); const eggListBg = globalScene.add.image(0, 0, "egg_list_bg").setOrigin(0);
@ -69,9 +69,7 @@ export class EggListUiHandler extends MessageUiHandler {
.withUpdateGridCallBack(() => this.updateEggIcons()) .withUpdateGridCallBack(() => this.updateEggIcons())
.withUpdateSingleElementCallback((i: number) => this.setEggDetails(i)); .withUpdateSingleElementCallback((i: number) => this.setEggDetails(i));
this.eggListMessageBoxContainer = globalScene.add this.eggListMessageBoxContainer = globalScene.add.container(0, globalScene.scaledCanvas.height).setVisible(false);
.container(0, globalScene.game.canvas.height / 6)
.setVisible(false);
const eggListMessageBox = addWindow(1, -1, 318, 28).setOrigin(0, 1); const eggListMessageBox = addWindow(1, -1, 318, 28).setOrigin(0, 1);
this.eggListMessageBoxContainer.add(eggListMessageBox); this.eggListMessageBoxContainer.add(eggListMessageBox);

View File

@ -59,11 +59,11 @@ export class EggSummaryUiHandler extends MessageUiHandler {
setup() { setup() {
const ui = this.getUi(); const ui = this.getUi();
this.summaryContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); this.summaryContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
this.summaryContainer.setVisible(false); this.summaryContainer.setVisible(false);
ui.add(this.summaryContainer); ui.add(this.summaryContainer);
this.eggHatchContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); this.eggHatchContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
this.eggHatchContainer.setVisible(false); this.eggHatchContainer.setVisible(false);
ui.add(this.eggHatchContainer); ui.add(this.eggHatchContainer);
@ -92,7 +92,7 @@ export class EggSummaryUiHandler extends MessageUiHandler {
iconContainerX + numCols * iconSize, iconContainerX + numCols * iconSize,
iconContainerY + 3, iconContainerY + 3,
4, 4,
globalScene.game.canvas.height / 6 - 20, globalScene.scaledCanvas.height - 20,
numRows, numRows,
); );
this.summaryContainer.add(scrollBar); this.summaryContainer.add(scrollBar);

View File

@ -22,7 +22,7 @@ export class EvolutionSceneHandler extends MessageUiHandler {
const ui = this.getUi(); const ui = this.getUi();
this.evolutionContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); this.evolutionContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
const messageBg = globalScene.add.sprite(0, 0, "bg", globalScene.windowType).setOrigin(0, 1).setVisible(false); const messageBg = globalScene.add.sprite(0, 0, "bg", globalScene.windowType).setOrigin(0, 1).setVisible(false);

View File

@ -105,15 +105,13 @@ export class FightUiHandler extends UiHandler implements InfoToggle {
]); ]);
// prepare move overlay // prepare move overlay
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay({ this.moveInfoOverlay = new MoveInfoOverlay({
delayVisibility: true, delayVisibility: true,
scale: overlayScale,
onSide: true, onSide: true,
right: true, right: true,
x: 0, x: 0,
y: -MoveInfoOverlay.getHeight(overlayScale, true), y: -MoveInfoOverlay.getHeight(true),
width: globalScene.game.canvas.width / 6 + 4, width: globalScene.scaledCanvas.width + 4,
hideEffectBox: true, hideEffectBox: true,
hideBg: true, hideBg: true,
}); });

View File

@ -62,7 +62,7 @@ export class FilterText extends Phaser.GameObjects.Container {
this.dialogueMessageBox = addWindow( this.dialogueMessageBox = addWindow(
-this.textPadding, -this.textPadding,
0, 0,
globalScene.game.canvas.width / 6 + this.textPadding * 2, globalScene.scaledCanvas.width + this.textPadding * 2,
49, 49,
false, false,
false, false,

View File

@ -19,6 +19,7 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
protected inputs: InputText[]; protected inputs: InputText[];
protected errorMessage: Phaser.GameObjects.Text; protected errorMessage: Phaser.GameObjects.Text;
protected submitAction: Function | null; protected submitAction: Function | null;
protected cancelAction: (() => void) | null;
protected tween: Phaser.Tweens.Tween; protected tween: Phaser.Tweens.Tween;
protected formLabels: Phaser.GameObjects.Text[]; protected formLabels: Phaser.GameObjects.Text[];
@ -126,22 +127,37 @@ export abstract class FormModalUiHandler extends ModalUiHandler {
}); });
} }
show(args: any[]): boolean { override show(args: any[]): boolean {
if (super.show(args)) { if (super.show(args)) {
this.inputContainers.map(ic => ic.setVisible(true)); this.inputContainers.map(ic => ic.setVisible(true));
const config = args[0] as FormModalConfig; const config = args[0] as FormModalConfig;
this.submitAction = config.buttonActions.length ? config.buttonActions[0] : null; this.submitAction = config.buttonActions.length ? config.buttonActions[0] : null;
this.cancelAction = config.buttonActions[1] ?? null;
if (this.buttonBgs.length) { // #region: Override button pointerDown
this.buttonBgs[0].off("pointerdown"); // Override the pointerDown event for the buttonBgs to call the `submitAction` and `cancelAction`
this.buttonBgs[0].on("pointerdown", () => { // properties that we set above, allowing their behavior to change after this method terminates
if (this.submitAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) { // Some subclasses use this to add behavior to the submit and cancel action
this.submitAction();
this.buttonBgs[0].off("pointerdown");
this.buttonBgs[0].on("pointerdown", () => {
if (this.submitAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
this.submitAction();
}
});
const cancelBg = this.buttonBgs[1];
if (cancelBg) {
cancelBg.off("pointerdown");
cancelBg.on("pointerdown", () => {
// The seemingly redundant cancelAction check is intentionally left in as a defensive programming measure
if (this.cancelAction && globalScene.tweens.getTweensOf(this.modalContainer).length === 0) {
this.cancelAction();
} }
}); });
} }
//#endregion: Override pointerDown events
this.modalContainer.y += 24; this.modalContainer.y += 24;
this.modalContainer.setAlpha(0); this.modalContainer.setAlpha(0);

View File

@ -2,7 +2,7 @@ import { pokerogueApi } from "#api/pokerogue-api";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle } from "#enums/text-style"; import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import type { InputFieldConfig } from "#ui/form-modal-ui-handler"; import type { InputFieldConfig } from "#ui/form-modal-ui-handler";
import { FormModalUiHandler } from "#ui/form-modal-ui-handler"; import { FormModalUiHandler } from "#ui/form-modal-ui-handler";
import type { ModalConfig } from "#ui/modal-ui-handler"; import type { ModalConfig } from "#ui/modal-ui-handler";
@ -49,7 +49,7 @@ export class LoginFormUiHandler extends FormModalUiHandler {
private buildExternalPartyContainer() { private buildExternalPartyContainer() {
this.externalPartyContainer = globalScene.add.container(0, 0); this.externalPartyContainer = globalScene.add.container(0, 0);
this.externalPartyContainer.setInteractive( this.externalPartyContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 12, globalScene.game.canvas.height / 12), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width / 2, globalScene.scaledCanvas.height / 2),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
this.externalPartyTitle = addTextObject(0, 4, "", TextStyle.SETTINGS_LABEL); this.externalPartyTitle = addTextObject(0, 4, "", TextStyle.SETTINGS_LABEL);

View File

@ -7,7 +7,7 @@ import { Button } from "#enums/buttons";
import { GameDataType } from "#enums/game-data-type"; import { GameDataType } from "#enums/game-data-type";
import { TextStyle } from "#enums/text-style"; import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectConfig, OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { AdminMode, getAdminModeName } from "#ui/admin-ui-handler"; import { AdminMode, getAdminModeName } from "#ui/admin-ui-handler";
import type { AwaitableUiHandler } from "#ui/awaitable-ui-handler"; import type { AwaitableUiHandler } from "#ui/awaitable-ui-handler";
import { BgmBar } from "#ui/bgm-bar"; import { BgmBar } from "#ui/bgm-bar";
@ -96,10 +96,10 @@ export class MenuUiHandler extends MessageUiHandler {
ui.bgmBar = this.bgmBar; ui.bgmBar = this.bgmBar;
this.menuContainer = globalScene.add.container(1, -(globalScene.game.canvas.height / 6) + 1); this.menuContainer = globalScene.add.container(1, -globalScene.scaledCanvas.height + 1);
this.menuContainer.setName("menu"); this.menuContainer.setName("menu");
this.menuContainer.setInteractive( this.menuContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
@ -146,10 +146,10 @@ export class MenuUiHandler extends MessageUiHandler {
this.scale = getTextStyleOptions(TextStyle.WINDOW, globalScene.uiTheme).scale; this.scale = getTextStyleOptions(TextStyle.WINDOW, globalScene.uiTheme).scale;
this.menuBg = addWindow( this.menuBg = addWindow(
globalScene.game.canvas.width / 6 - (this.optionSelectText.displayWidth + 25), globalScene.scaledCanvas.width - (this.optionSelectText.displayWidth + 25),
0, 0,
this.optionSelectText.displayWidth + 19 + 24 * this.scale, this.optionSelectText.displayWidth + 19 + 24 * this.scale,
globalScene.game.canvas.height / 6 - 2, globalScene.scaledCanvas.height - 2,
); );
this.menuBg.setOrigin(0, 0); this.menuBg.setOrigin(0, 0);
@ -174,7 +174,7 @@ export class MenuUiHandler extends MessageUiHandler {
this.dialogueMessageBox = addWindow( this.dialogueMessageBox = addWindow(
-this.textPadding, -this.textPadding,
0, 0,
globalScene.game.canvas.width / 6 + this.textPadding * 2, globalScene.scaledCanvas.width + this.textPadding * 2,
49, 49,
false, false,
false, false,
@ -311,6 +311,17 @@ export class MenuUiHandler extends MessageUiHandler {
}, },
keepOpen: true, keepOpen: true,
}, },
{
// Note: i18n key is under `menu`, not `menuUiHandler` to avoid duplication
label: i18next.t("menu:changePassword"),
handler: () => {
ui.setOverlayMode(UiMode.CHANGE_PASSWORD_FORM, {
buttonActions: [() => ui.revertMode(), () => ui.revertMode()],
});
return true;
},
keepOpen: true,
},
{ {
label: i18next.t("menuUiHandler:consentPreferences"), label: i18next.t("menuUiHandler:consentPreferences"),
handler: () => { handler: () => {

View File

@ -7,7 +7,7 @@ import { UiHandler } from "#ui/ui-handler";
import { addWindow, WindowVariant } from "#ui/ui-theme"; import { addWindow, WindowVariant } from "#ui/ui-theme";
export interface ModalConfig { export interface ModalConfig {
buttonActions: Function[]; buttonActions: ((...args: any[]) => any)[];
} }
export abstract class ModalUiHandler extends UiHandler { export abstract class ModalUiHandler extends UiHandler {
@ -46,7 +46,7 @@ export abstract class ModalUiHandler extends UiHandler {
this.modalContainer = globalScene.add.container(0, 0); this.modalContainer = globalScene.add.container(0, 0);
this.modalContainer.setInteractive( this.modalContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
@ -105,8 +105,8 @@ export abstract class ModalUiHandler extends UiHandler {
const overlay = globalScene.add.rectangle( const overlay = globalScene.add.rectangle(
(this.getWidth() + marginLeft + marginRight) / 2, (this.getWidth() + marginLeft + marginRight) / 2,
(this.getHeight() + marginTop + marginBottom) / 2, (this.getHeight() + marginTop + marginBottom) / 2,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6, globalScene.scaledCanvas.height,
0, 0,
); );
overlay.setOrigin(0.5, 0.5); overlay.setOrigin(0.5, 0.5);
@ -159,8 +159,8 @@ export abstract class ModalUiHandler extends UiHandler {
const width = this.getWidth(config); const width = this.getWidth(config);
const height = this.getHeight(config); const height = this.getHeight(config);
this.modalContainer.setPosition( this.modalContainer.setPosition(
(globalScene.game.canvas.width / 6 - (width + (marginRight - marginLeft))) / 2, (globalScene.scaledCanvas.width - (width + (marginRight - marginLeft))) / 2,
(-globalScene.game.canvas.height / 6 - (height + (marginBottom - marginTop))) / 2, (-globalScene.scaledCanvas.height - (height + (marginBottom - marginTop))) / 2,
); );
this.modalBg.setSize(width, height); this.modalBg.setSize(width, height);

View File

@ -86,10 +86,7 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
transferButtonText.setOrigin(1, 0); transferButtonText.setOrigin(1, 0);
this.transferButtonContainer.add(transferButtonText); this.transferButtonContainer.add(transferButtonText);
this.checkButtonContainer = globalScene.add.container( this.checkButtonContainer = globalScene.add.container(globalScene.scaledCanvas.width - 1, OPTION_BUTTON_YPOSITION);
globalScene.game.canvas.width / 6 - 1,
OPTION_BUTTON_YPOSITION,
);
this.checkButtonContainer.setName("use-btn"); this.checkButtonContainer.setName("use-btn");
this.checkButtonContainer.setVisible(false); this.checkButtonContainer.setVisible(false);
ui.add(this.checkButtonContainer); ui.add(this.checkButtonContainer);
@ -129,8 +126,8 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
this.lockRarityButtonContainer.add(this.lockRarityButtonText); this.lockRarityButtonContainer.add(this.lockRarityButtonText);
this.continueButtonContainer = globalScene.add.container( this.continueButtonContainer = globalScene.add.container(
globalScene.game.canvas.width / 12, globalScene.scaledCanvas.width / 2,
-(globalScene.game.canvas.height / 12), -(globalScene.scaledCanvas.height / 2),
); );
this.continueButtonContainer.setVisible(false); this.continueButtonContainer.setVisible(false);
ui.add(this.continueButtonContainer); ui.add(this.continueButtonContainer);
@ -146,15 +143,13 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
this.continueButtonContainer.add(continueButtonText); this.continueButtonContainer.add(continueButtonText);
// prepare move overlay // prepare move overlay
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay({ this.moveInfoOverlay = new MoveInfoOverlay({
delayVisibility: true, delayVisibility: true,
scale: overlayScale,
onSide: true, onSide: true,
right: true, right: true,
x: 1, x: 1,
y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1, y: -MoveInfoOverlay.getHeight(true) - 1,
width: globalScene.game.canvas.width / 6 - 2, width: globalScene.scaledCanvas.width - 2,
}); });
ui.add(this.moveInfoOverlay); ui.add(this.moveInfoOverlay);
// register the overlay to receive toggle events // register the overlay to receive toggle events
@ -209,20 +204,20 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
this.updateRerollCostText(); this.updateRerollCostText();
const typeOptions = args[1] as ModifierTypeOption[]; const typeOptions = args[1] as ModifierTypeOption[];
const removeHealShop = globalScene.gameMode.hasNoShop; const hasShop = globalScene.gameMode.getShopStatus();
const baseShopCost = new NumberHolder(globalScene.getWaveMoneyAmount(1)); const baseShopCost = new NumberHolder(globalScene.getWaveMoneyAmount(1));
globalScene.applyModifier(HealShopCostModifier, true, baseShopCost); globalScene.applyModifier(HealShopCostModifier, true, baseShopCost);
const shopTypeOptions = !removeHealShop const shopTypeOptions = hasShop
? getPlayerShopModifierTypeOptionsForWave(globalScene.currentBattle.waveIndex, baseShopCost.value) ? getPlayerShopModifierTypeOptionsForWave(globalScene.currentBattle.waveIndex, baseShopCost.value)
: []; : [];
const optionsYOffset = const optionsYOffset =
shopTypeOptions.length > SHOP_OPTIONS_ROW_LIMIT ? -SINGLE_SHOP_ROW_YOFFSET : -DOUBLE_SHOP_ROW_YOFFSET; shopTypeOptions.length > SHOP_OPTIONS_ROW_LIMIT ? -SINGLE_SHOP_ROW_YOFFSET : -DOUBLE_SHOP_ROW_YOFFSET;
for (let m = 0; m < typeOptions.length; m++) { for (let m = 0; m < typeOptions.length; m++) {
const sliceWidth = globalScene.game.canvas.width / 6 / (typeOptions.length + 2); const sliceWidth = globalScene.scaledCanvas.width / (typeOptions.length + 2);
const option = new ModifierOption( const option = new ModifierOption(
sliceWidth * (m + 1) + sliceWidth * 0.5, sliceWidth * (m + 1) + sliceWidth * 0.5,
-globalScene.game.canvas.height / 12 + optionsYOffset, -globalScene.scaledCanvas.height / 2 + optionsYOffset,
typeOptions[m], typeOptions[m],
); );
option.setScale(0.5); option.setScale(0.5);
@ -243,10 +238,10 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
row ? SHOP_OPTIONS_ROW_LIMIT : 0, row ? SHOP_OPTIONS_ROW_LIMIT : 0,
row ? undefined : SHOP_OPTIONS_ROW_LIMIT, row ? undefined : SHOP_OPTIONS_ROW_LIMIT,
); );
const sliceWidth = globalScene.game.canvas.width / 6 / (rowOptions.length + 2); const sliceWidth = globalScene.scaledCanvas.width / (rowOptions.length + 2);
const option = new ModifierOption( const option = new ModifierOption(
sliceWidth * (col + 1) + sliceWidth * 0.5, sliceWidth * (col + 1) + sliceWidth * 0.5,
-globalScene.game.canvas.height / 12 - globalScene.game.canvas.height / 32 - (42 - (28 * row - 1)), -globalScene.scaledCanvas.height / 2 - globalScene.game.canvas.height / 32 - (42 - (28 * row - 1)),
shopTypeOptions[m], shopTypeOptions[m],
); );
option.setScale(0.375); option.setScale(0.375);
@ -370,7 +365,7 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
if (globalScene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) { if (globalScene.shopCursorTarget === ShopCursorTarget.CHECK_TEAM) {
this.setRowCursor(0); this.setRowCursor(0);
this.setCursor(2); this.setCursor(2);
} else if (globalScene.shopCursorTarget === ShopCursorTarget.SHOP && globalScene.gameMode.hasNoShop) { } else if (globalScene.shopCursorTarget === ShopCursorTarget.SHOP && !hasShop) {
this.setRowCursor(ShopCursorTarget.REWARDS); this.setRowCursor(ShopCursorTarget.REWARDS);
this.setCursor(0); this.setCursor(0);
} else { } else {
@ -558,27 +553,27 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler {
// Continue button when no shop items // Continue button when no shop items
this.cursorObj.setScale(1.25); this.cursorObj.setScale(1.25);
this.cursorObj.setPosition( this.cursorObj.setPosition(
globalScene.game.canvas.width / 18 + 23, globalScene.scaledCanvas.width / 3 + 23,
-globalScene.game.canvas.height / 12 - -globalScene.scaledCanvas.height / 2 -
(this.shopOptionsRows.length > 1 ? SINGLE_SHOP_ROW_YOFFSET - 2 : DOUBLE_SHOP_ROW_YOFFSET - 2), (this.shopOptionsRows.length > 1 ? SINGLE_SHOP_ROW_YOFFSET - 2 : DOUBLE_SHOP_ROW_YOFFSET - 2),
); );
ui.showText(i18next.t("modifierSelectUiHandler:continueNextWaveDescription")); ui.showText(i18next.t("modifierSelectUiHandler:continueNextWaveDescription"));
return ret; return ret;
} }
const sliceWidth = globalScene.game.canvas.width / 6 / (options.length + 2); const sliceWidth = globalScene.scaledCanvas.width / (options.length + 2);
if (this.rowCursor < 2) { if (this.rowCursor < 2) {
// Cursor on free items // Cursor on free items
this.cursorObj.setPosition( this.cursorObj.setPosition(
sliceWidth * (cursor + 1) + sliceWidth * 0.5 - 20, sliceWidth * (cursor + 1) + sliceWidth * 0.5 - 20,
-globalScene.game.canvas.height / 12 - -globalScene.scaledCanvas.height / 2 -
(this.shopOptionsRows.length > 1 ? SINGLE_SHOP_ROW_YOFFSET - 2 : DOUBLE_SHOP_ROW_YOFFSET - 2), (this.shopOptionsRows.length > 1 ? SINGLE_SHOP_ROW_YOFFSET - 2 : DOUBLE_SHOP_ROW_YOFFSET - 2),
); );
} else { } else {
// Cursor on paying items // Cursor on paying items
this.cursorObj.setPosition( this.cursorObj.setPosition(
sliceWidth * (cursor + 1) + sliceWidth * 0.5 - 16, sliceWidth * (cursor + 1) + sliceWidth * 0.5 - 16,
-globalScene.game.canvas.height / 12 - -globalScene.scaledCanvas.height / 2 -
globalScene.game.canvas.height / 32 - globalScene.game.canvas.height / 32 -
(-14 + 28 * (this.rowCursor - (this.shopOptionsRows.length - 1))), (-14 + 28 * (this.rowCursor - (this.shopOptionsRows.length - 1))),
); );
@ -848,7 +843,7 @@ class ModifierOption extends Phaser.GameObjects.Container {
/** /**
* Start the tweens responsible for animating the option's appearance * Start the tweens responsible for animating the option's appearance
* *
* @privateremarks * @privateRemarks
* This method is unusual. It "returns" (one via the actual return, one by via appending to the `promiseHolder` * This method is unusual. It "returns" (one via the actual return, one by via appending to the `promiseHolder`
* parameter) two promises. The promise returned by the method resolves once the option's appearance animations have * parameter) two promises. The promise returned by the method resolves once the option's appearance animations have
* completed, and is meant to allow callers to synchronize with the completion of the option's appearance animations. * completed, and is meant to allow callers to synchronize with the completion of the option's appearance animations.

View File

@ -10,17 +10,24 @@ import { fixedInt, getLocalizedSpriteKey } from "#utils/common";
import i18next from "i18next"; import i18next from "i18next";
export interface MoveInfoOverlaySettings { export interface MoveInfoOverlaySettings {
delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later. /**
scale?: number; // scale the box? A scale of 0.5 is recommended * If true, showing the overlay will only set it to active and populate the fields
top?: boolean; // should the effect box be on top? * and the handler using this field has to manually call `setVisible` later.
right?: boolean; // should the effect box be on the right? */
onSide?: boolean; // should the effect be on the side? ignores top argument if true delayVisibility?: boolean;
//location and width of the component; unaffected by scaling /** Whether the effect box should be on top */
top?: boolean;
/** Whether the effect box should be on the right */
right?: boolean;
/** Whether the effect box should be on the side. Overrides the `top` param if `true`. */
onSide?: boolean;
/** `x` position of the component, unaffected by scaling */
x?: number; x?: number;
/** `y` position of the component, unaffected by scaling */
y?: number; y?: number;
/** Default is always half the screen, regardless of scale */ /** Width of the component, unaffected by scaling. Defaults to half the screen width. */
width?: number; width?: number;
/** Determines whether to display the small secondary box */ /** Whether to display the small secondary box */
hideEffectBox?: boolean; hideEffectBox?: boolean;
hideBg?: boolean; hideBg?: boolean;
} }
@ -54,12 +61,11 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf
options.top = false; options.top = false;
} }
super(globalScene, options?.x, options?.y); super(globalScene, options?.x, options?.y);
const scale = options?.scale || 1; // set up the scale this.setScale(1);
this.setScale(scale);
this.options = options || {}; this.options = options || {};
// prepare the description box // prepare the description box
const width = (options?.width || MoveInfoOverlay.getWidth(scale)) / scale; // divide by scale as we always want this to be half a window wide const width = options?.width || MoveInfoOverlay.getWidth(); // we always want this to be half a window wide
this.descBg = addWindow( this.descBg = addWindow(
options?.onSide && !options?.right ? EFF_WIDTH : 0, options?.onSide && !options?.right ? EFF_WIDTH : 0,
options?.top ? EFF_HEIGHT : 0, options?.top ? EFF_HEIGHT : 0,
@ -88,19 +94,19 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf
y: options?.y || 0, y: options?.y || 0,
}; };
if (maskPointOrigin.x < 0) { if (maskPointOrigin.x < 0) {
maskPointOrigin.x += globalScene.game.canvas.width / GLOBAL_SCALE; maskPointOrigin.x += globalScene.scaledCanvas.width;
} }
if (maskPointOrigin.y < 0) { if (maskPointOrigin.y < 0) {
maskPointOrigin.y += globalScene.game.canvas.height / GLOBAL_SCALE; maskPointOrigin.y += globalScene.scaledCanvas.height;
} }
const moveDescriptionTextMaskRect = globalScene.make.graphics(); const moveDescriptionTextMaskRect = globalScene.make.graphics();
moveDescriptionTextMaskRect.fillStyle(0xff0000); moveDescriptionTextMaskRect.fillStyle(0xff0000);
moveDescriptionTextMaskRect.fillRect( moveDescriptionTextMaskRect.fillRect(
maskPointOrigin.x + ((options?.onSide && !options?.right ? EFF_WIDTH : 0) + BORDER) * scale, maskPointOrigin.x + ((options?.onSide && !options?.right ? EFF_WIDTH : 0) + BORDER),
maskPointOrigin.y + ((options?.top ? EFF_HEIGHT : 0) + BORDER - 2) * scale, maskPointOrigin.y + ((options?.top ? EFF_HEIGHT : 0) + BORDER - 2),
width - ((options?.onSide ? EFF_WIDTH : 0) - BORDER * 2) * scale, width - ((options?.onSide ? EFF_WIDTH : 0) - BORDER * 2),
(DESC_HEIGHT - (BORDER - 2) * 2) * scale, DESC_HEIGHT - (BORDER - 2) * 2,
); );
moveDescriptionTextMaskRect.setScale(6); moveDescriptionTextMaskRect.setScale(6);
const moveDescriptionTextMask = this.createGeometryMask(moveDescriptionTextMaskRect); const moveDescriptionTextMask = this.createGeometryMask(moveDescriptionTextMaskRect);
@ -233,12 +239,12 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf
} }
// width of this element // width of this element
static getWidth(_scale: number): number { static getWidth(): number {
return globalScene.game.canvas.width / GLOBAL_SCALE / 2; return globalScene.scaledCanvas.width / 2;
} }
// height of this element // height of this element
static getHeight(scale: number, onSide?: boolean): number { static getHeight(onSide?: boolean): number {
return (onSide ? Math.max(EFF_HEIGHT, DESC_HEIGHT) : EFF_HEIGHT + DESC_HEIGHT) * scale; return onSide ? Math.max(EFF_HEIGHT, DESC_HEIGHT) : EFF_HEIGHT + DESC_HEIGHT;
} }
} }

View File

@ -471,7 +471,7 @@ export class MysteryEncounterUiHandler extends UiHandler {
// View Party Button // View Party Button
const viewPartyText = addBBCodeTextObject( const viewPartyText = addBBCodeTextObject(
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
-24, -24,
getBBCodeFrag(i18next.t("mysteryEncounterMessages:view_party_button"), TextStyle.PARTY), getBBCodeFrag(i18next.t("mysteryEncounterMessages:view_party_button"), TextStyle.PARTY),
TextStyle.PARTY, TextStyle.PARTY,

View File

@ -14,7 +14,7 @@ export class PartyExpBar extends Phaser.GameObjects.Container {
public shown: boolean; public shown: boolean;
constructor() { constructor() {
super(globalScene, globalScene.game.canvas.width / 6, -(globalScene.game.canvas.height / 6) + 15); super(globalScene, globalScene.scaledCanvas.width, -globalScene.scaledCanvas.height + 15);
} }
setup(): void { setup(): void {
@ -66,7 +66,7 @@ export class PartyExpBar extends Phaser.GameObjects.Container {
this.tween = globalScene.tweens.add({ this.tween = globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6 - (this.bg.width - 5), x: globalScene.scaledCanvas.width - (this.bg.width - 5),
duration: 500 / Math.pow(2, globalScene.expGainsSpeed), duration: 500 / Math.pow(2, globalScene.expGainsSpeed),
ease: "Sine.easeOut", ease: "Sine.easeOut",
onComplete: () => { onComplete: () => {
@ -92,7 +92,7 @@ export class PartyExpBar extends Phaser.GameObjects.Container {
this.tween = globalScene.tweens.add({ this.tween = globalScene.tweens.add({
targets: this, targets: this,
x: globalScene.game.canvas.width / 6, x: globalScene.scaledCanvas.width,
duration: 500, duration: 500,
ease: "Sine.easeIn", ease: "Sine.easeIn",
onComplete: () => { onComplete: () => {

View File

@ -1,7 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { getPokemonNameWithAffix } from "#app/messages"; import { getPokemonNameWithAffix } from "#app/messages";
import { pokemonEvolutions } from "#balance/pokemon-evolutions"; import { pokemonEvolutions } from "#balance/pokemon-evolutions";
import { applyChallenges } from "#data/challenge";
import { allMoves } from "#data/data-lists"; import { allMoves } from "#data/data-lists";
import { SpeciesFormChangeItemTrigger } from "#data/form-change-triggers"; import { SpeciesFormChangeItemTrigger } from "#data/form-change-triggers";
import { Gender, getGenderColor, getGenderSymbol } from "#data/gender"; import { Gender, getGenderColor, getGenderSymbol } from "#data/gender";
@ -26,6 +25,7 @@ import { MoveInfoOverlay } from "#ui/move-info-overlay";
import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/pokemon-icon-anim-handler"; import { PokemonIconAnimHandler, PokemonIconAnimMode } from "#ui/pokemon-icon-anim-handler";
import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text"; import { addBBCodeTextObject, addTextObject, getTextColor } from "#ui/text";
import { addWindow } from "#ui/ui-theme"; import { addWindow } from "#ui/ui-theme";
import { applyChallenges } from "#utils/challenge-utils";
import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common"; import { BooleanHolder, getLocalizedSpriteKey, randInt } from "#utils/common";
import { toTitleCase } from "#utils/strings"; import { toTitleCase } from "#utils/strings";
import i18next from "i18next"; import i18next from "i18next";
@ -311,7 +311,7 @@ export class PartyUiHandler extends MessageUiHandler {
this.partyCancelButton = partyCancelButton; this.partyCancelButton = partyCancelButton;
this.optionsContainer = globalScene.add.container(globalScene.game.canvas.width / 6 - 1, -1); this.optionsContainer = globalScene.add.container(globalScene.scaledCanvas.width - 1, -1);
partyContainer.add(this.optionsContainer); partyContainer.add(this.optionsContainer);
this.iconAnimHandler = new PokemonIconAnimHandler(); this.iconAnimHandler = new PokemonIconAnimHandler();
@ -323,14 +323,12 @@ export class PartyUiHandler extends MessageUiHandler {
this.partyDiscardModeButton = partyDiscardModeButton; this.partyDiscardModeButton = partyDiscardModeButton;
// prepare move overlay. in case it appears to be too big, set the overlayScale to .5 // prepare move overlay
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay({ this.moveInfoOverlay = new MoveInfoOverlay({
scale: overlayScale,
top: true, top: true,
x: 1, x: 1,
y: -MoveInfoOverlay.getHeight(overlayScale) - 1, y: -MoveInfoOverlay.getHeight() - 1,
width: globalScene.game.canvas.width / 12 - 30, width: globalScene.scaledCanvas.width / 2 - 30,
}); });
ui.add(this.moveInfoOverlay); ui.add(this.moveInfoOverlay);
@ -827,6 +825,11 @@ export class PartyUiHandler extends MessageUiHandler {
globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeItemTrigger, false, true); globalScene.triggerPokemonFormChange(pokemon, SpeciesFormChangeItemTrigger, false, true);
} }
// This is processed before the filter result since releasing does not depend on status.
if (option === PartyOption.RELEASE) {
return this.processReleaseOption(pokemon);
}
// If the pokemon is filtered out for this option, we cannot continue // If the pokemon is filtered out for this option, we cannot continue
const filterResult = this.getFilterResult(option, pokemon); const filterResult = this.getFilterResult(option, pokemon);
if (filterResult) { if (filterResult) {
@ -850,10 +853,6 @@ export class PartyUiHandler extends MessageUiHandler {
// PartyUiMode.POST_BATTLE_SWITCH (SEND_OUT) // PartyUiMode.POST_BATTLE_SWITCH (SEND_OUT)
// These are the options that need a callback // These are the options that need a callback
if (option === PartyOption.RELEASE) {
return this.processReleaseOption(pokemon);
}
if (this.partyUiMode === PartyUiMode.SPLICE) { if (this.partyUiMode === PartyUiMode.SPLICE) {
if (option === PartyOption.SPLICE) { if (option === PartyOption.SPLICE) {
(this.selectCallback as PartyModifierSpliceSelectCallback)(this.transferCursor, this.cursor); (this.selectCallback as PartyModifierSpliceSelectCallback)(this.transferCursor, this.cursor);

View File

@ -10,7 +10,7 @@ export class PokeballTray extends Phaser.GameObjects.Container {
public shown: boolean; public shown: boolean;
constructor(player: boolean) { constructor(player: boolean) {
super(globalScene, player ? globalScene.game.canvas.width / 6 : 0, player ? -72 : -144); super(globalScene, player ? globalScene.scaledCanvas.width : 0, player ? -72 : -144);
this.player = player; this.player = player;
} }
@ -36,7 +36,7 @@ export class PokeballTray extends Phaser.GameObjects.Container {
.map((_, i) => .map((_, i) =>
globalScene.add.sprite( globalScene.add.sprite(
(this.player ? -83 : 76) + (this.player ? -83 : 76) +
(globalScene.game.canvas.width / 6) * (this.player ? -1 : 1) + globalScene.scaledCanvas.width * (this.player ? -1 : 1) +
10 * i * (this.player ? 1 : -1), 10 * i * (this.player ? 1 : -1),
-8, -8,
"pb_tray_ball", "pb_tray_ball",
@ -67,7 +67,7 @@ export class PokeballTray extends Phaser.GameObjects.Container {
this.bg.alpha = 1; this.bg.alpha = 1;
this.balls.forEach((ball, b) => { this.balls.forEach((ball, b) => {
ball.x += (globalScene.game.canvas.width / 6 + 104) * (this.player ? 1 : -1); ball.x += (globalScene.scaledCanvas.width + 104) * (this.player ? 1 : -1);
let ballFrame = "ball"; let ballFrame = "ball";
if (b >= party.length) { if (b >= party.length) {
ballFrame = "empty"; ballFrame = "empty";
@ -115,7 +115,7 @@ export class PokeballTray extends Phaser.GameObjects.Container {
this.balls.forEach((ball, b) => { this.balls.forEach((ball, b) => {
globalScene.tweens.add({ globalScene.tweens.add({
targets: ball, targets: ball,
x: `${this.player ? "-" : "+"}=${globalScene.game.canvas.width / 6}`, x: `${this.player ? "-" : "+"}=${globalScene.scaledCanvas.width}`,
duration: 250, duration: 250,
delay: b * 100, delay: b * 100,
ease: "Sine.easeIn", ease: "Sine.easeIn",

View File

@ -7,7 +7,6 @@ import { fixedInt } from "#utils/common";
export interface PokedexInfoOverlaySettings { export interface PokedexInfoOverlaySettings {
delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later. delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later.
scale?: number; // scale the box? A scale of 0.5 is recommended
//location and width of the component; unaffected by scaling //location and width of the component; unaffected by scaling
x?: number; x?: number;
y?: number; y?: number;
@ -36,17 +35,15 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements
private maskPointOriginX: number; private maskPointOriginX: number;
private maskPointOriginY: number; private maskPointOriginY: number;
public scale: number;
public width: number; public width: number;
constructor(options?: PokedexInfoOverlaySettings) { constructor(options?: PokedexInfoOverlaySettings) {
super(globalScene, options?.x, options?.y); super(globalScene, options?.x, options?.y);
this.scale = options?.scale || 1; // set up the scale this.setScale(1);
this.setScale(this.scale);
this.options = options || {}; this.options = options || {};
// prepare the description box // prepare the description box
this.width = (options?.width || PokedexInfoOverlay.getWidth(this.scale)) / this.scale; // divide by scale as we always want this to be half a window wide this.width = options?.width || PokedexInfoOverlay.getWidth(); // we always want this to be half a window wide
this.descBg = addWindow(0, 0, this.width, DESC_HEIGHT); this.descBg = addWindow(0, 0, this.width, DESC_HEIGHT);
this.descBg.setOrigin(0, 0); this.descBg.setOrigin(0, 0);
this.add(this.descBg); this.add(this.descBg);
@ -61,19 +58,19 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements
this.maskPointOriginY = options?.y || 0; this.maskPointOriginY = options?.y || 0;
if (this.maskPointOriginX < 0) { if (this.maskPointOriginX < 0) {
this.maskPointOriginX += globalScene.game.canvas.width / GLOBAL_SCALE; this.maskPointOriginX += globalScene.scaledCanvas.width;
} }
if (this.maskPointOriginY < 0) { if (this.maskPointOriginY < 0) {
this.maskPointOriginY += globalScene.game.canvas.height / GLOBAL_SCALE; this.maskPointOriginY += globalScene.scaledCanvas.height;
} }
this.textMaskRect = globalScene.make.graphics(); this.textMaskRect = globalScene.make.graphics();
this.textMaskRect.fillStyle(0xff0000); this.textMaskRect.fillStyle(0xff0000);
this.textMaskRect.fillRect( this.textMaskRect.fillRect(
this.maskPointOriginX + BORDER * this.scale, this.maskPointOriginX + BORDER,
this.maskPointOriginY + (BORDER - 2) * this.scale, this.maskPointOriginY + (BORDER - 2),
this.width - BORDER * 2 * this.scale, this.width - BORDER * 2,
(DESC_HEIGHT - (BORDER - 2) * 2) * this.scale, DESC_HEIGHT - (BORDER - 2) * 2,
); );
this.textMaskRect.setScale(6); this.textMaskRect.setScale(6);
const textMask = this.createGeometryMask(this.textMaskRect); const textMask = this.createGeometryMask(this.textMaskRect);
@ -111,10 +108,10 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements
this.textMaskRect.clear(); this.textMaskRect.clear();
this.textMaskRect.fillStyle(0xff0000); this.textMaskRect.fillStyle(0xff0000);
this.textMaskRect.fillRect( this.textMaskRect.fillRect(
this.maskPointOriginX + BORDER * this.scale, this.maskPointOriginX + BORDER,
this.maskPointOriginY + (BORDER - 2) * this.scale + (48 - newHeight), this.maskPointOriginY + (BORDER - 2) + (48 - newHeight),
this.width - BORDER * 2 * this.scale, this.width - BORDER * 2,
(newHeight - (BORDER - 2) * 2) * this.scale, newHeight - (BORDER - 2) * 2,
); );
const updatedMask = this.createGeometryMask(this.textMaskRect); const updatedMask = this.createGeometryMask(this.textMaskRect);
this.desc.setMask(updatedMask); this.desc.setMask(updatedMask);
@ -167,12 +164,12 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements
} }
// width of this element // width of this element
static getWidth(_scale: number): number { static getWidth(): number {
return globalScene.game.canvas.width / GLOBAL_SCALE / 2; return globalScene.scaledCanvas.width / 2;
} }
// height of this element // height of this element
static getHeight(scale: number, _onSide?: boolean): number { static getHeight(): number {
return DESC_HEIGHT * scale; return DESC_HEIGHT;
} }
} }

View File

@ -46,7 +46,7 @@ import { getVariantIcon, getVariantTint } from "#sprites/variant";
import type { StarterAttributes } from "#system/game-data"; import type { StarterAttributes } from "#system/game-data";
import { SettingKeyboard } from "#system/settings-keyboard"; import { SettingKeyboard } from "#system/settings-keyboard";
import type { DexEntry } from "#types/dex-data"; import type { DexEntry } from "#types/dex-data";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { BaseStatsOverlay } from "#ui/base-stats-overlay"; import { BaseStatsOverlay } from "#ui/base-stats-overlay";
import { MessageUiHandler } from "#ui/message-ui-handler"; import { MessageUiHandler } from "#ui/message-ui-handler";
import { MoveInfoOverlay } from "#ui/move-info-overlay"; import { MoveInfoOverlay } from "#ui/move-info-overlay";
@ -299,15 +299,15 @@ export class PokedexPageUiHandler extends MessageUiHandler {
const langSettingKey = Object.keys(languageSettings).find(lang => currentLanguage.includes(lang)) ?? "en"; const langSettingKey = Object.keys(languageSettings).find(lang => currentLanguage.includes(lang)) ?? "en";
const textSettings = languageSettings[langSettingKey]; const textSettings = languageSettings[langSettingKey];
this.starterSelectContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); this.starterSelectContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
this.starterSelectContainer.setVisible(false); this.starterSelectContainer.setVisible(false);
ui.add(this.starterSelectContainer); ui.add(this.starterSelectContainer);
const bgColor = globalScene.add.rectangle( const bgColor = globalScene.add.rectangle(
0, 0,
0, 0,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6, globalScene.scaledCanvas.height,
0x006860, 0x006860,
); );
bgColor.setOrigin(0, 0); bgColor.setOrigin(0, 0);
@ -602,7 +602,7 @@ export class PokedexPageUiHandler extends MessageUiHandler {
this.filterInstructionsContainer.setVisible(true); this.filterInstructionsContainer.setVisible(true);
this.starterSelectContainer.add(this.filterInstructionsContainer); this.starterSelectContainer.add(this.filterInstructionsContainer);
this.starterSelectMessageBoxContainer = globalScene.add.container(0, globalScene.game.canvas.height / 6); this.starterSelectMessageBoxContainer = globalScene.add.container(0, globalScene.scaledCanvas.height);
this.starterSelectMessageBoxContainer.setVisible(false); this.starterSelectMessageBoxContainer.setVisible(false);
this.starterSelectContainer.add(this.starterSelectMessageBoxContainer); this.starterSelectContainer.add(this.starterSelectMessageBoxContainer);
@ -629,7 +629,7 @@ export class PokedexPageUiHandler extends MessageUiHandler {
this.menuContainer = globalScene.add.container(-130, 0); this.menuContainer = globalScene.add.container(-130, 0);
this.menuContainer.setName("menu"); this.menuContainer.setName("menu");
this.menuContainer.setInteractive( this.menuContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
@ -659,10 +659,10 @@ export class PokedexPageUiHandler extends MessageUiHandler {
this.scale = getTextStyleOptions(TextStyle.WINDOW, globalScene.uiTheme).scale; this.scale = getTextStyleOptions(TextStyle.WINDOW, globalScene.uiTheme).scale;
this.menuBg = addWindow( this.menuBg = addWindow(
globalScene.game.canvas.width / 6 - 83, globalScene.scaledCanvas.width - 83,
0, 0,
this.optionSelectText.displayWidth + 19 + 24 * this.scale, this.optionSelectText.displayWidth + 19 + 24 * this.scale,
globalScene.game.canvas.height / 6 - 2, globalScene.scaledCanvas.height - 2,
); );
this.menuBg.setOrigin(0, 0); this.menuBg.setOrigin(0, 0);
@ -682,19 +682,16 @@ export class PokedexPageUiHandler extends MessageUiHandler {
this.menuContainer.bringToTop(this.baseStatsOverlay); this.menuContainer.bringToTop(this.baseStatsOverlay);
// add the info overlay last to be the top most ui element and prevent the IVs from overlaying this // add the info overlay last to be the top most ui element and prevent the IVs from overlaying this
const overlayScale = 1;
this.moveInfoOverlay = new MoveInfoOverlay({ this.moveInfoOverlay = new MoveInfoOverlay({
scale: overlayScale,
top: true, top: true,
x: 1, x: 1,
y: globalScene.game.canvas.height / 6 - MoveInfoOverlay.getHeight(overlayScale) - 29, y: globalScene.scaledCanvas.height - MoveInfoOverlay.getHeight() - 29,
}); });
this.starterSelectContainer.add(this.moveInfoOverlay); this.starterSelectContainer.add(this.moveInfoOverlay);
this.infoOverlay = new PokedexInfoOverlay({ this.infoOverlay = new PokedexInfoOverlay({
scale: overlayScale,
x: 1, x: 1,
y: globalScene.game.canvas.height / 6 - PokedexInfoOverlay.getHeight(overlayScale) - 29, y: globalScene.scaledCanvas.height - PokedexInfoOverlay.getHeight() - 29,
}); });
this.starterSelectContainer.add(this.infoOverlay); this.starterSelectContainer.add(this.infoOverlay);
@ -1103,7 +1100,7 @@ export class PokedexPageUiHandler extends MessageUiHandler {
this.starterSelectMessageBoxContainer.setY(0); this.starterSelectMessageBoxContainer.setY(0);
this.message.setY(4); this.message.setY(4);
} else { } else {
this.starterSelectMessageBoxContainer.setY(globalScene.game.canvas.height / 6); this.starterSelectMessageBoxContainer.setY(globalScene.scaledCanvas.height);
this.starterSelectMessageBox.setOrigin(0, 1); this.starterSelectMessageBox.setOrigin(0, 1);
this.message.setY(singleLine ? -22 : -37); this.message.setY(singleLine ? -22 : -37);
} }

View File

@ -1,7 +1,7 @@
import { allAbilities, allMoves, allSpecies } from "#data/data-lists"; import { allAbilities, allMoves, allSpecies } from "#data/data-lists";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import type { PlayerPokemon } from "#field/pokemon"; import type { PlayerPokemon } from "#field/pokemon";
import type { OptionSelectItem } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
import { FilterTextRow } from "#ui/filter-text"; import { FilterTextRow } from "#ui/filter-text";
import type { InputFieldConfig } from "#ui/form-modal-ui-handler"; import type { InputFieldConfig } from "#ui/form-modal-ui-handler";
import { FormModalUiHandler } from "#ui/form-modal-ui-handler"; import { FormModalUiHandler } from "#ui/form-modal-ui-handler";

View File

@ -33,7 +33,7 @@ import { getVariantIcon, getVariantTint } from "#sprites/variant";
import type { DexAttrProps, StarterAttributes } from "#system/game-data"; import type { DexAttrProps, StarterAttributes } from "#system/game-data";
import { SettingKeyboard } from "#system/settings-keyboard"; import { SettingKeyboard } from "#system/settings-keyboard";
import type { DexEntry } from "#types/dex-data"; import type { DexEntry } from "#types/dex-data";
import type { OptionSelectConfig } from "#ui/abstact-option-select-ui-handler"; import type { OptionSelectConfig } from "#ui/abstract-option-select-ui-handler";
import { DropDown, DropDownLabel, DropDownOption, DropDownState, DropDownType, SortCriteria } from "#ui/dropdown"; import { DropDown, DropDownLabel, DropDownOption, DropDownState, DropDownType, SortCriteria } from "#ui/dropdown";
import { FilterBar } from "#ui/filter-bar"; import { FilterBar } from "#ui/filter-bar";
import { FilterText, FilterTextRow } from "#ui/filter-text"; import { FilterText, FilterTextRow } from "#ui/filter-text";
@ -245,15 +245,15 @@ export class PokedexUiHandler extends MessageUiHandler {
const langSettingKey = Object.keys(languageSettings).find(lang => currentLanguage.includes(lang)) ?? "en"; const langSettingKey = Object.keys(languageSettings).find(lang => currentLanguage.includes(lang)) ?? "en";
const textSettings = languageSettings[langSettingKey]; const textSettings = languageSettings[langSettingKey];
this.starterSelectContainer = globalScene.add.container(0, -globalScene.game.canvas.height / 6); this.starterSelectContainer = globalScene.add.container(0, -globalScene.scaledCanvas.height);
this.starterSelectContainer.setVisible(false); this.starterSelectContainer.setVisible(false);
ui.add(this.starterSelectContainer); ui.add(this.starterSelectContainer);
const bgColor = globalScene.add.rectangle( const bgColor = globalScene.add.rectangle(
0, 0,
0, 0,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
globalScene.game.canvas.height / 6, globalScene.scaledCanvas.height,
0x006860, 0x006860,
); );
bgColor.setOrigin(0, 0); bgColor.setOrigin(0, 0);
@ -544,7 +544,7 @@ export class PokedexUiHandler extends MessageUiHandler {
this.type2Icon.setOrigin(0, 0); this.type2Icon.setOrigin(0, 0);
this.starterSelectContainer.add(this.type2Icon); this.starterSelectContainer.add(this.type2Icon);
this.starterSelectMessageBoxContainer = globalScene.add.container(0, globalScene.game.canvas.height / 6); this.starterSelectMessageBoxContainer = globalScene.add.container(0, globalScene.scaledCanvas.height);
this.starterSelectMessageBoxContainer.setVisible(false); this.starterSelectMessageBoxContainer.setVisible(false);
this.starterSelectContainer.add(this.starterSelectMessageBoxContainer); this.starterSelectContainer.add(this.starterSelectMessageBoxContainer);
@ -784,7 +784,7 @@ export class PokedexUiHandler extends MessageUiHandler {
this.starterSelectMessageBoxContainer.setY(0); this.starterSelectMessageBoxContainer.setY(0);
this.message.setY(4); this.message.setY(4);
} else { } else {
this.starterSelectMessageBoxContainer.setY(globalScene.game.canvas.height / 6); this.starterSelectMessageBoxContainer.setY(globalScene.scaledCanvas.height);
this.starterSelectMessageBox.setOrigin(0, 1); this.starterSelectMessageBox.setOrigin(0, 1);
this.message.setY(singleLine ? -22 : -37); this.message.setY(singleLine ? -22 : -37);
} }

View File

@ -54,14 +54,14 @@ export class RunHistoryUiHandler extends MessageUiHandler {
const loadSessionBg = globalScene.add.rectangle( const loadSessionBg = globalScene.add.rectangle(
0, 0,
0, 0,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
-globalScene.game.canvas.height / 6, -globalScene.scaledCanvas.height,
0x006860, 0x006860,
); );
loadSessionBg.setOrigin(0, 0); loadSessionBg.setOrigin(0, 0);
this.runSelectContainer.add(loadSessionBg); this.runSelectContainer.add(loadSessionBg);
this.runContainerInitialY = -globalScene.game.canvas.height / 6 + 8; this.runContainerInitialY = -globalScene.scaledCanvas.height + 8;
this.runsContainer = globalScene.add.container(8, this.runContainerInitialY); this.runsContainer = globalScene.add.container(8, this.runContainerInitialY);
this.runSelectContainer.add(this.runsContainer); this.runSelectContainer.add(this.runsContainer);

View File

@ -74,7 +74,7 @@ export class RunInfoUiHandler extends UiHandler {
} }
override async setup() { override async setup() {
this.runContainer = globalScene.add.container(1, -(globalScene.game.canvas.height / 6) + 1); this.runContainer = globalScene.add.container(1, -globalScene.scaledCanvas.height + 1);
// The import of the modifiersModule is loaded here to sidestep async/await issues. // The import of the modifiersModule is loaded here to sidestep async/await issues.
this.modifiersModule = Modifier; this.modifiersModule = Modifier;
this.runContainer.setVisible(false); this.runContainer.setVisible(false);
@ -120,7 +120,7 @@ export class RunInfoUiHandler extends UiHandler {
// Creates Header and adds to this.runContainer // Creates Header and adds to this.runContainer
this.addHeader(); this.addHeader();
this.statsBgWidth = (globalScene.game.canvas.width / 6 - 2) / 3; this.statsBgWidth = (globalScene.scaledCanvas.width - 2) / 3;
// Creates Run Result Container // Creates Run Result Container
this.runResultContainer = globalScene.add.container(0, 24); this.runResultContainer = globalScene.add.container(0, 24);
@ -147,7 +147,7 @@ export class RunInfoUiHandler extends UiHandler {
this.showParty(true); this.showParty(true);
this.runContainer.setInteractive( this.runContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
this.getUi().bringToTop(this.runContainer); this.getUi().bringToTop(this.runContainer);
@ -174,7 +174,7 @@ export class RunInfoUiHandler extends UiHandler {
* It does not check if the run has any PokemonHeldItemModifiers though. * It does not check if the run has any PokemonHeldItemModifiers though.
*/ */
private addHeader() { private addHeader() {
const headerBg = addWindow(0, 0, globalScene.game.canvas.width / 6 - 2, 24); const headerBg = addWindow(0, 0, globalScene.scaledCanvas.width - 2, 24);
headerBg.setOrigin(0, 0); headerBg.setOrigin(0, 0);
this.runContainer.add(headerBg); this.runContainer.add(headerBg);
if (this.runInfo.modifiers.length !== 0) { if (this.runInfo.modifiers.length !== 0) {
@ -702,11 +702,11 @@ export class RunInfoUiHandler extends UiHandler {
rules.push(i18next.t("challenges:inverseBattle.shortName")); rules.push(i18next.t("challenges:inverseBattle.shortName"));
break; break;
default: { default: {
const localisationKey = Challenges[this.runInfo.challenges[i].id] const localizationKey = Challenges[this.runInfo.challenges[i].id]
.split("_") .split("_")
.map((f, i) => (i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase())) .map((f, i) => (i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()))
.join(""); .join("");
rules.push(i18next.t(`challenges:${localisationKey}.name`)); rules.push(i18next.t(`challenges:${localizationKey}.name`));
break; break;
} }
} }
@ -723,7 +723,7 @@ export class RunInfoUiHandler extends UiHandler {
private parsePartyInfo(): void { private parsePartyInfo(): void {
const party = this.runInfo.party; const party = this.runInfo.party;
const currentLanguage = i18next.resolvedLanguage ?? "en"; const currentLanguage = i18next.resolvedLanguage ?? "en";
const windowHeight = (globalScene.game.canvas.height / 6 - 23) / 6; const windowHeight = (globalScene.scaledCanvas.height - 23) / 6;
party.forEach((p: PokemonData, i: number) => { party.forEach((p: PokemonData, i: number) => {
const pokemonInfoWindow = new RoundRectangle(globalScene, 0, 14, this.statsBgWidth * 2 + 10, windowHeight - 2, 3); const pokemonInfoWindow = new RoundRectangle(globalScene, 0, 14, this.statsBgWidth * 2 + 10, windowHeight - 2, 3);
@ -971,8 +971,8 @@ export class RunInfoUiHandler extends UiHandler {
endCard.setOrigin(0); endCard.setOrigin(0);
endCard.setScale(0.5); endCard.setScale(0.5);
const text = addTextObject( const text = addTextObject(
globalScene.game.canvas.width / 12, globalScene.scaledCanvas.width / 2,
globalScene.game.canvas.height / 6 - 16, globalScene.scaledCanvas.height - 16,
i18next.t("battle:congratulations"), i18next.t("battle:congratulations"),
TextStyle.SUMMARY, TextStyle.SUMMARY,
{ fontSize: "128px" }, { fontSize: "128px" },

View File

@ -54,14 +54,14 @@ export class SaveSlotSelectUiHandler extends MessageUiHandler {
const loadSessionBg = globalScene.add.rectangle( const loadSessionBg = globalScene.add.rectangle(
0, 0,
0, 0,
globalScene.game.canvas.width / 6, globalScene.scaledCanvas.width,
-globalScene.game.canvas.height / 6, -globalScene.scaledCanvas.height,
0x006860, 0x006860,
); );
loadSessionBg.setOrigin(0, 0); loadSessionBg.setOrigin(0, 0);
this.saveSlotSelectContainer.add(loadSessionBg); this.saveSlotSelectContainer.add(loadSessionBg);
this.sessionSlotsContainerInitialY = -globalScene.game.canvas.height / 6 + 8; this.sessionSlotsContainerInitialY = -globalScene.scaledCanvas.height + 8;
this.sessionSlotsContainer = globalScene.add.container(8, this.sessionSlotsContainerInitialY); this.sessionSlotsContainer = globalScene.add.container(8, this.sessionSlotsContainerInitialY);
this.saveSlotSelectContainer.add(this.sessionSlotsContainer); this.saveSlotSelectContainer.add(this.sessionSlotsContainer);
@ -401,7 +401,7 @@ class SessionSlot extends Phaser.GameObjects.Container {
const gameModeLabel = addTextObject( const gameModeLabel = addTextObject(
8, 8,
5, 5,
`${GameMode.getModeName(data.gameMode) || i18next.t("gameMode:unkown")} - ${i18next.t("saveSlotSelectUiHandler:wave")} ${data.waveIndex}`, `${GameMode.getModeName(data.gameMode) || i18next.t("gameMode:unknown")} - ${i18next.t("saveSlotSelectUiHandler:wave")} ${data.waveIndex}`,
TextStyle.WINDOW, TextStyle.WINDOW,
); );
this.add(gameModeLabel); this.add(gameModeLabel);

View File

@ -8,7 +8,7 @@ export class SavingIconHandler extends Phaser.GameObjects.Container {
private shown: boolean; private shown: boolean;
constructor() { constructor() {
super(globalScene, globalScene.game.canvas.width / 6 - 4, globalScene.game.canvas.height / 6 - 4); super(globalScene, globalScene.scaledCanvas.width - 4, globalScene.scaledCanvas.height - 4);
} }
setup(): void { setup(): void {

View File

@ -8,7 +8,7 @@ import { UiHandler } from "#ui/ui-handler";
import { addWindow } from "#ui/ui-theme"; import { addWindow } from "#ui/ui-theme";
import i18next from "i18next"; import i18next from "i18next";
type CancelFn = (succes?: boolean) => boolean; type CancelFn = (success?: boolean) => boolean;
/** /**
* Abstract class for handling UI elements related to button bindings. * Abstract class for handling UI elements related to button bindings.
@ -73,8 +73,8 @@ export abstract class AbstractBindingUiHandler extends UiHandler {
// Setup backgrounds and text objects for UI. // Setup backgrounds and text objects for UI.
this.titleBg = addWindow( this.titleBg = addWindow(
globalScene.game.canvas.width / 6 - this.getWindowWidth(), globalScene.scaledCanvas.width - this.getWindowWidth(),
-(globalScene.game.canvas.height / 6) + 28 + 21, -globalScene.scaledCanvas.height + 28 + 21,
this.getWindowWidth(), this.getWindowWidth(),
24, 24,
); );
@ -82,8 +82,8 @@ export abstract class AbstractBindingUiHandler extends UiHandler {
this.optionSelectContainer.add(this.titleBg); this.optionSelectContainer.add(this.titleBg);
this.actionBg = addWindow( this.actionBg = addWindow(
globalScene.game.canvas.width / 6 - this.getWindowWidth(), globalScene.scaledCanvas.width - this.getWindowWidth(),
-(globalScene.game.canvas.height / 6) + this.getWindowHeight() + 28 + 21 + 21, -globalScene.scaledCanvas.height + this.getWindowHeight() + 28 + 21 + 21,
this.getWindowWidth(), this.getWindowWidth(),
24, 24,
); );
@ -102,8 +102,8 @@ export abstract class AbstractBindingUiHandler extends UiHandler {
this.optionSelectContainer.add(this.timerText); this.optionSelectContainer.add(this.timerText);
this.optionSelectBg = addWindow( this.optionSelectBg = addWindow(
globalScene.game.canvas.width / 6 - this.getWindowWidth(), globalScene.scaledCanvas.width - this.getWindowWidth(),
-(globalScene.game.canvas.height / 6) + this.getWindowHeight() + 28, -globalScene.scaledCanvas.height + this.getWindowHeight() + 28,
this.getWindowWidth(), this.getWindowWidth(),
this.getWindowHeight(), this.getWindowHeight(),
); );

View File

@ -96,11 +96,11 @@ export abstract class AbstractControlSettingsUiHandler extends UiHandler {
const ui = this.getUi(); const ui = this.getUi();
this.navigationIcons = {}; this.navigationIcons = {};
this.settingsContainer = globalScene.add.container(1, -(globalScene.game.canvas.height / 6) + 1); this.settingsContainer = globalScene.add.container(1, -globalScene.scaledCanvas.height + 1);
this.settingsContainer.setName(`settings-${this.titleSelected}`); this.settingsContainer.setName(`settings-${this.titleSelected}`);
this.settingsContainer.setInteractive( this.settingsContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
@ -109,15 +109,15 @@ export abstract class AbstractControlSettingsUiHandler extends UiHandler {
this.optionsBg = addWindow( this.optionsBg = addWindow(
0, 0,
this.navigationContainer.height, this.navigationContainer.height,
globalScene.game.canvas.width / 6 - 2, globalScene.scaledCanvas.width - 2,
globalScene.game.canvas.height / 6 - 16 - this.navigationContainer.height - 2, globalScene.scaledCanvas.height - 16 - this.navigationContainer.height - 2,
); );
this.optionsBg.setOrigin(0, 0); this.optionsBg.setOrigin(0, 0);
this.actionsBg = addWindow( this.actionsBg = addWindow(
0, 0,
globalScene.game.canvas.height / 6 - this.navigationContainer.height, globalScene.scaledCanvas.height - this.navigationContainer.height,
globalScene.game.canvas.width / 6 - 2, globalScene.scaledCanvas.width - 2,
22, 22,
); );
this.actionsBg.setOrigin(0, 0); this.actionsBg.setOrigin(0, 0);
@ -597,7 +597,7 @@ export abstract class AbstractControlSettingsUiHandler extends UiHandler {
// Check if the cursor object exists, if not, create it. // Check if the cursor object exists, if not, create it.
if (!this.cursorObj) { if (!this.cursorObj) {
const cursorWidth = globalScene.game.canvas.width / 6 - (this.scrollBar.visible ? 16 : 10); const cursorWidth = globalScene.scaledCanvas.width - (this.scrollBar.visible ? 16 : 10);
this.cursorObj = globalScene.add.nineslice(0, 0, "summary_moves_cursor", undefined, cursorWidth, 16, 1, 1, 1, 1); this.cursorObj = globalScene.add.nineslice(0, 0, "summary_moves_cursor", undefined, cursorWidth, 16, 1, 1, 1, 1);
this.cursorObj.setOrigin(0, 0); // Set the origin to the top-left corner. this.cursorObj.setOrigin(0, 0); // Set the origin to the top-left corner.
this.optionsContainer.add(this.cursorObj); // Add the cursor to the options container. this.optionsContainer.add(this.cursorObj); // Add the cursor to the options container.

View File

@ -56,10 +56,10 @@ export class AbstractSettingsUiHandler extends MessageUiHandler {
setup() { setup() {
const ui = this.getUi(); const ui = this.getUi();
this.settingsContainer = globalScene.add.container(1, -(globalScene.game.canvas.height / 6) + 1); this.settingsContainer = globalScene.add.container(1, -globalScene.scaledCanvas.height + 1);
this.settingsContainer.setName(`settings-${this.title}`); this.settingsContainer.setName(`settings-${this.title}`);
this.settingsContainer.setInteractive( this.settingsContainer.setInteractive(
new Phaser.Geom.Rectangle(0, 0, globalScene.game.canvas.width / 6, globalScene.game.canvas.height / 6 - 20), new Phaser.Geom.Rectangle(0, 0, globalScene.scaledCanvas.width, globalScene.scaledCanvas.height - 20),
Phaser.Geom.Rectangle.Contains, Phaser.Geom.Rectangle.Contains,
); );
@ -70,16 +70,16 @@ export class AbstractSettingsUiHandler extends MessageUiHandler {
this.optionsBg = addWindow( this.optionsBg = addWindow(
0, 0,
this.navigationContainer.height, this.navigationContainer.height,
globalScene.game.canvas.width / 6 - 2, globalScene.scaledCanvas.width - 2,
globalScene.game.canvas.height / 6 - 16 - this.navigationContainer.height - 2, globalScene.scaledCanvas.height - 16 - this.navigationContainer.height - 2,
); );
this.optionsBg.setName("window-options-bg"); this.optionsBg.setName("window-options-bg");
this.optionsBg.setOrigin(0, 0); this.optionsBg.setOrigin(0, 0);
const actionsBg = addWindow( const actionsBg = addWindow(
0, 0,
globalScene.game.canvas.height / 6 - this.navigationContainer.height, globalScene.scaledCanvas.height - this.navigationContainer.height,
globalScene.game.canvas.width / 6 - 2, globalScene.scaledCanvas.width - 2,
22, 22,
); );
actionsBg.setOrigin(0, 0); actionsBg.setOrigin(0, 0);
@ -375,7 +375,7 @@ export class AbstractSettingsUiHandler extends MessageUiHandler {
const ret = super.setCursor(cursor); const ret = super.setCursor(cursor);
if (!this.cursorObj) { if (!this.cursorObj) {
const cursorWidth = globalScene.game.canvas.width / 6 - (this.scrollBar.visible ? 16 : 10); const cursorWidth = globalScene.scaledCanvas.width - (this.scrollBar.visible ? 16 : 10);
this.cursorObj = globalScene.add.nineslice(0, 0, "summary_moves_cursor", undefined, cursorWidth, 16, 1, 1, 1, 1); this.cursorObj = globalScene.add.nineslice(0, 0, "summary_moves_cursor", undefined, cursorWidth, 16, 1, 1, 1, 1);
this.cursorObj.setOrigin(0, 0); this.cursorObj.setOrigin(0, 0);
this.optionsContainer.add(this.cursorObj); this.optionsContainer.add(this.cursorObj);

View File

@ -124,7 +124,7 @@ export class NavigationMenu extends Phaser.GameObjects.Container {
*/ */
setup() { setup() {
const navigationManager = NavigationManager.getInstance(); const navigationManager = NavigationManager.getInstance();
const headerBg = addWindow(0, 0, globalScene.game.canvas.width / 6 - 2, 24); const headerBg = addWindow(0, 0, globalScene.scaledCanvas.width - 2, 24);
headerBg.setOrigin(0, 0); headerBg.setOrigin(0, 0);
this.add(headerBg); this.add(headerBg);
this.width = headerBg.width; this.width = headerBg.width;

Some files were not shown because too many files have changed in this diff Show More