Compare commits

...

8 Commits

Author SHA1 Message Date
Sirz Benjie
6506b78081
Merge b8367fdb8c into 4b70fab608 2025-06-20 02:47:45 -05:00
NightKev
4b70fab608
[Bug] Remove message for Rock Head activation (#6014) 2025-06-19 20:59:55 -07:00
lnuvy
1ff2701964
[Bug] Fix when using arrow keys in Pokédex after catching a Pokémon from mystery event (#6000)
fix: wrap setOverlayMode args in array to mystery-encounter

Co-authored-by: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com>
2025-06-19 20:45:54 -04:00
Bertie690
1e306e25b5
[Move] Fixed Chilly Reception displaying message when used virtually
https://github.com/pagefaultgames/pokerogue/pull/5843

* Fixed Chilly Reception displaying message when used virtually

* Fixed lack of message causing Chilly Reception to fail

* Fixed tests

* Reverted bool change + fixed test

* Fixed test
2025-06-19 17:14:05 -07:00
Madmadness65
43aa772603
[UI/UX] Add Pokémon category flavor text to Pokédex (#5957)
* Add Pokémon category flavor text to Pokédex

* Append `_category` to locale entry
2025-06-20 00:04:57 +00:00
Sirz Benjie
b8367fdb8c
Add necessary explicit types for TextStyle let vars 2025-06-15 13:56:08 -05:00
Sirz Benjie
6030dd6462
Cleanup text.ts file 2025-06-15 13:56:07 -05:00
Sirz Benjie
c353f54a42
Move TextStyle to enums, convert into const object 2025-06-15 13:56:04 -05:00
82 changed files with 343 additions and 204 deletions

10
src/@types/ui.ts Normal file
View File

@ -0,0 +1,10 @@
import type Phaser from "phaser";
import type InputText from "phaser3-rex-plugins/plugins/gameobjects/dom/inputtext/InputText";
export interface TextStyleOptions {
scale: number;
styleOptions: Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig;
shadowColor: string;
shadowXpos: number;
shadowYpos: number;
}

View File

@ -51,7 +51,8 @@ import type { Phase } from "#app/phase";
import { initGameSpeed } from "#app/system/game-speed"; import { initGameSpeed } from "#app/system/game-speed";
import { Arena, ArenaBase } from "#app/field/arena"; import { Arena, ArenaBase } from "#app/field/arena";
import { GameData } from "#app/system/game-data"; import { GameData } from "#app/system/game-data";
import { addTextObject, getTextColor, TextStyle } from "#app/ui/text"; import { addTextObject, getTextColor } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { allMoves } from "./data/data-lists"; import { allMoves } from "./data/data-lists";
import { MusicPreference } from "#app/system/settings/settings"; import { MusicPreference } from "#app/system/settings/settings";
import { import {

View File

@ -306,13 +306,6 @@ export class BlockRecoilDamageAttr extends AbAttr {
): void { ): void {
cancelled.value = true; cancelled.value = true;
} }
getTriggerMessage(pokemon: Pokemon, abilityName: string, ..._args: any[]) {
return i18next.t("abilityTriggers:blockRecoilDamage", {
pokemonName: getPokemonNameWithAffix(pokemon),
abilityName: abilityName,
});
}
} }
/** /**

View File

@ -93,6 +93,10 @@ import { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap
import { applyMoveAttrs } from "./apply-attrs"; import { applyMoveAttrs } from "./apply-attrs";
import { frenzyMissFunc, getMoveTargets } from "./move-utils"; import { frenzyMissFunc, getMoveTargets } from "./move-utils";
/**
* A function used to conditionally determine execution of a given {@linkcode MoveAttr}.
* Conventionally returns `true` for success and `false` for failure.
*/
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean; type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
export type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean; export type UserMoveConditionFunc = (user: Pokemon, move: Move) => boolean;
@ -1390,18 +1394,31 @@ export class BeakBlastHeaderAttr extends AddBattlerTagHeaderAttr {
} }
} }
/**
* Attribute to display a message before a move is executed.
*/
export class PreMoveMessageAttr extends MoveAttr { export class PreMoveMessageAttr extends MoveAttr {
private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string); /** The message to display or a function returning one */
private message: string | ((user: Pokemon, target: Pokemon, move: Move) => string | undefined);
/**
* Create a new {@linkcode PreMoveMessageAttr} to display a message before move execution.
* @param message - The message to display before move use, either as a string or a function producing one.
* @remarks
* If {@linkcode message} evaluates to an empty string (`''`), no message will be displayed
* (though the move will still succeed).
*/
constructor(message: string | ((user: Pokemon, target: Pokemon, move: Move) => string)) { constructor(message: string | ((user: Pokemon, target: Pokemon, move: Move) => string)) {
super(); super();
this.message = message; this.message = message;
} }
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
const message = typeof this.message === "string" const message = typeof this.message === "function"
? this.message as string ? this.message(user, target, move)
: this.message(user, target, move); : this.message;
// TODO: Consider changing if/when MoveAttr `apply` return values become significant
if (message) { if (message) {
globalScene.phaseManager.queueMessage(message, 500); globalScene.phaseManager.queueMessage(message, 500);
return true; return true;
@ -11299,7 +11316,11 @@ export function initMoves() {
.attr(ForceSwitchOutAttr, true, SwitchType.SHED_TAIL) .attr(ForceSwitchOutAttr, true, SwitchType.SHED_TAIL)
.condition(failIfLastInPartyCondition), .condition(failIfLastInPartyCondition),
new SelfStatusMove(MoveId.CHILLY_RECEPTION, PokemonType.ICE, -1, 10, -1, 0, 9) new SelfStatusMove(MoveId.CHILLY_RECEPTION, PokemonType.ICE, -1, 10, -1, 0, 9)
.attr(PreMoveMessageAttr, (user, move) => i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(user) })) .attr(PreMoveMessageAttr, (user, _target, _move) =>
// Don't display text if current move phase is follow up (ie move called indirectly)
isVirtual((globalScene.phaseManager.getCurrentPhase() as MovePhase).useMode)
? ""
: i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(user) }))
.attr(ChillyReceptionAttr, true), .attr(ChillyReceptionAttr, true),
new SelfStatusMove(MoveId.TIDY_UP, PokemonType.NORMAL, -1, 10, -1, 0, 9) new SelfStatusMove(MoveId.TIDY_UP, PokemonType.NORMAL, -1, 10, -1, 0, 9)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPD ], 1, true) .attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPD ], 1, true)

View File

@ -1,4 +1,4 @@
import type { TextStyle } from "#app/ui/text"; import type { TextStyle } from "#enums/text-style";
export class TextDisplay { export class TextDisplay {
speaker?: string; speaker?: string;

View File

@ -1,5 +1,5 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type { TextStyle } from "#app/ui/text"; import type { TextStyle } from "#enums/text-style";
import { getTextWithColors } from "#app/ui/text"; import { getTextWithColors } from "#app/ui/text";
import { UiTheme } from "#enums/ui-theme"; import { UiTheme } from "#enums/ui-theme";
import { isNullOrUndefined } from "#app/utils/common"; import { isNullOrUndefined } from "#app/utils/common";

View File

@ -751,7 +751,7 @@ export async function catchPokemon(
UiMode.POKEDEX_PAGE, UiMode.POKEDEX_PAGE,
pokemon.species, pokemon.species,
pokemon.formIndex, pokemon.formIndex,
attributes, [attributes],
null, null,
() => { () => {
globalScene.ui.setMode(UiMode.MESSAGE).then(() => { globalScene.ui.setMode(UiMode.MESSAGE).then(() => {

View File

@ -1,5 +1,6 @@
import { toReadableString } from "#app/utils/common"; import { toReadableString } from "#app/utils/common";
import { TextStyle, getBBCodeFrag } from "../ui/text"; import { getBBCodeFrag } from "../ui/text";
import { TextStyle } from "#enums/text-style";
import { Nature } from "#enums/nature"; import { Nature } from "#enums/nature";
import { UiTheme } from "#enums/ui-theme"; import { UiTheme } from "#enums/ui-theme";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -764,7 +764,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
readonly subLegendary: boolean; readonly subLegendary: boolean;
readonly legendary: boolean; readonly legendary: boolean;
readonly mythical: boolean; readonly mythical: boolean;
readonly species: string; public category: string;
readonly growthRate: GrowthRate; readonly growthRate: GrowthRate;
/** The chance (as a decimal) for this Species to be male, or `null` for genderless species */ /** The chance (as a decimal) for this Species to be male, or `null` for genderless species */
readonly malePercent: number | null; readonly malePercent: number | null;
@ -778,7 +778,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
subLegendary: boolean, subLegendary: boolean,
legendary: boolean, legendary: boolean,
mythical: boolean, mythical: boolean,
species: string, category: string,
type1: PokemonType, type1: PokemonType,
type2: PokemonType | null, type2: PokemonType | null,
height: number, height: number,
@ -829,7 +829,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
this.subLegendary = subLegendary; this.subLegendary = subLegendary;
this.legendary = legendary; this.legendary = legendary;
this.mythical = mythical; this.mythical = mythical;
this.species = species; this.category = category;
this.growthRate = growthRate; this.growthRate = growthRate;
this.malePercent = malePercent; this.malePercent = malePercent;
this.genderDiffs = genderDiffs; this.genderDiffs = genderDiffs;
@ -968,6 +968,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
localize(): void { localize(): void {
this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`); this.name = i18next.t(`pokemon:${SpeciesId[this.speciesId].toLowerCase()}`);
this.category = i18next.t(`pokemonCategory:${SpeciesId[this.speciesId].toLowerCase()}_category`);
} }
getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId { getWildSpeciesForLevel(level: number, allowEvolving: boolean, isBoss: boolean, gameMode: GameMode): SpeciesId {

42
src/enums/text-style.ts Normal file
View File

@ -0,0 +1,42 @@
export const TextStyle = Object.freeze({
MESSAGE: 1,
WINDOW: 2,
WINDOW_ALT: 3,
BATTLE_INFO: 4,
PARTY: 5,
PARTY_RED: 6,
SUMMARY: 7,
SUMMARY_ALT: 8,
SUMMARY_RED: 9,
SUMMARY_BLUE: 10,
SUMMARY_PINK: 11,
SUMMARY_GOLD: 12,
SUMMARY_GRAY: 13,
SUMMARY_GREEN: 14,
MONEY: 15, // Money default styling (pale yellow)
/** Money displayed in Windows (needs different colors based on theme) */
MONEY_WINDOW: 16,
STATS_LABEL: 17,
STATS_VALUE: 18,
SETTINGS_VALUE: 19,
SETTINGS_LABEL: 20,
SETTINGS_SELECTED: 21,
SETTINGS_LOCKED: 22,
TOOLTIP_TITLE: 23,
TOOLTIP_CONTENT: 24,
MOVE_INFO_CONTENT: 25,
MOVE_PP_FULL: 26,
MOVE_PP_HALF_FULL: 27,
MOVE_PP_NEAR_EMPTY: 28,
MOVE_PP_EMPTY: 29,
SMALLER_WINDOW_ALT: 30,
BGM_BAR: 31,
PERFECT_IV: 32,
/** Default style for choices in ME */
ME_OPTION_DEFAULT: 33,
/** Style for choices with special requirements in ME */
ME_OPTION_SPECIAL: 34,
SHADOW_TEXT: 35
})
export type TextStyle = typeof TextStyle[keyof typeof TextStyle];

View File

@ -1,4 +1,5 @@
import { TextStyle, addTextObject } from "../ui/text"; import { addTextObject } from "../ui/text";
import { TextStyle } from "#enums/text-style";
import type { DamageResult } from "./pokemon"; import type { DamageResult } from "./pokemon";
import type Pokemon from "./pokemon"; import type Pokemon from "./pokemon";
import { HitResult } from "#enums/hit-result"; import { HitResult } from "#enums/hit-result";

View File

@ -13,7 +13,8 @@ import Overrides from "#app/overrides";
import { LearnMoveType } from "#enums/learn-move-type"; import { LearnMoveType } from "#enums/learn-move-type";
import type { VoucherType } from "#app/system/voucher"; import type { VoucherType } from "#app/system/voucher";
import { Command } from "#enums/command"; import { Command } from "#enums/command";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, randSeedFloat, toDmgValue } from "#app/utils/common"; import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, randSeedFloat, toDmgValue } from "#app/utils/common";
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";

View File

@ -1,7 +1,8 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { PlayerGender } from "#app/enums/player-gender"; import { PlayerGender } from "#app/enums/player-gender";
import { Phase } from "#app/phase"; import { Phase } from "#app/phase";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import i18next from "i18next"; import i18next from "i18next";
export class EndCardPhase extends Phase { export class EndCardPhase extends Phase {

View File

@ -668,6 +668,9 @@ export class MovePhase extends BattlePhase {
}), }),
500, 500,
); );
// Moves with pre-use messages (Magnitude, Chilly Reception, Fickle Beam, etc.) always display their messages even on failure
// TODO: This assumes single target for message funcs - is this sustainable?
applyMoveAttrs("PreMoveMessageAttr", this.pokemon, this.pokemon.getOpponents(false)[0], this.move.getMove()); applyMoveAttrs("PreMoveMessageAttr", this.pokemon, this.pokemon.getOpponents(false)[0], this.move.getMove());
} }

View File

@ -2,7 +2,8 @@ import { globalScene } from "#app/global-scene";
import type { BattlerIndex } from "#enums/battler-index"; import type { BattlerIndex } from "#enums/battler-index";
import { PERMANENT_STATS, Stat } from "#app/enums/stat"; import { PERMANENT_STATS, Stat } from "#app/enums/stat";
import { getPokemonNameWithAffix } from "#app/messages"; import { getPokemonNameWithAffix } from "#app/messages";
import { getTextColor, TextStyle } from "#app/ui/text"; import { getTextColor } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import i18next from "i18next"; import i18next from "i18next";
import { PokemonPhase } from "./pokemon-phase"; import { PokemonPhase } from "./pokemon-phase";

View File

@ -245,6 +245,7 @@ export async function initI18n(): Promise<void> {
"pokeball", "pokeball",
"pokedexUiHandler", "pokedexUiHandler",
"pokemon", "pokemon",
"pokemonCategory",
"pokemonEvolutions", "pokemonEvolutions",
"pokemonForm", "pokemonForm",
"pokemonInfo", "pokemonInfo",

View File

@ -1,5 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import type { nil } from "#app/utils/common"; import type { nil } from "#app/utils/common";
import { isNullOrUndefined } from "#app/utils/common"; import { isNullOrUndefined } from "#app/utils/common";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,5 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import i18next from "i18next"; import i18next from "i18next";
const barWidth = 118; const barWidth = 118;

View File

@ -1,5 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle, addBBCodeTextObject, getTextColor, getTextStyleOptions } from "./text"; import { addBBCodeTextObject, getTextColor, getTextStyleOptions } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,7 +1,8 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { Achv, getAchievementDescription } from "../system/achv"; import { Achv, getAchievementDescription } from "../system/achv";
import { Voucher } from "../system/voucher"; import { Voucher } from "../system/voucher";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { PlayerGender } from "#enums/player-gender"; import type { PlayerGender } from "#enums/player-gender";
export default class AchvBar extends Phaser.GameObjects.Container { export default class AchvBar extends Phaser.GameObjects.Container {

View File

@ -5,7 +5,8 @@ import { achvs, getAchievementDescription } from "#app/system/achv";
import type { Voucher } from "#app/system/voucher"; import type { Voucher } from "#app/system/voucher";
import { getVoucherTypeIcon, getVoucherTypeName, vouchers } from "#app/system/voucher"; import { getVoucherTypeIcon, getVoucherTypeName, vouchers } from "#app/system/voucher";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { ScrollBar } from "#app/ui/scroll-bar"; import { ScrollBar } from "#app/ui/scroll-bar";

View File

@ -4,7 +4,7 @@ import { formatText } from "#app/utils/common";
import type { InputFieldConfig } from "./form-modal-ui-handler"; import type { InputFieldConfig } from "./form-modal-ui-handler";
import { FormModalUiHandler } from "./form-modal-ui-handler"; import { FormModalUiHandler } from "./form-modal-ui-handler";
import type { ModalConfig } from "./modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler";
import { TextStyle } from "./text"; import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -1,4 +1,5 @@
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { ArenaTrapTag } from "#app/data/arena-tag"; import { ArenaTrapTag } from "#app/data/arena-tag";
import { ArenaTagSide } from "#enums/arena-tag-side"; import { ArenaTagSide } from "#enums/arena-tag-side";

View File

@ -1,5 +1,6 @@
import { getPokeballName } from "../data/pokeball"; import { getPokeballName } from "../data/pokeball";
import { addTextObject, getTextStyleOptions, TextStyle } from "./text"; import { addTextObject, getTextStyleOptions } from "./text";
import { TextStyle } from "#enums/text-style";
import { Command } from "#enums/command"; import { Command } from "#enums/command";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";

View File

@ -1,5 +1,6 @@
import type { InfoToggle } from "../battle-scene"; import type { InfoToggle } from "../battle-scene";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { fixedInt } from "#app/utils/common"; import { fixedInt } from "#app/utils/common";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,5 +1,6 @@
import type { EnemyPokemon, default as Pokemon } from "../field/pokemon"; import type { EnemyPokemon, default as Pokemon } from "../field/pokemon";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { fixedInt } from "#app/utils/common"; import { fixedInt } from "#app/utils/common";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type Move from "#app/data/moves/move"; import type Move from "#app/data/moves/move";

View File

@ -1,6 +1,7 @@
import type { default as Pokemon } from "../../field/pokemon"; import type { default as Pokemon } from "../../field/pokemon";
import { getLocalizedSpriteKey, fixedInt, getShinyDescriptor } from "#app/utils/common"; import { getLocalizedSpriteKey, fixedInt, getShinyDescriptor } from "#app/utils/common";
import { addTextObject, TextStyle } from "../text"; import { addTextObject } from "../text";
import { TextStyle } from "#enums/text-style";
import { getGenderSymbol, getGenderColor, Gender } from "../../data/gender"; import { getGenderSymbol, getGenderColor, Gender } from "../../data/gender";
import { StatusEffect } from "#enums/status-effect"; import { StatusEffect } from "#enums/status-effect";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -1,6 +1,7 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import BattleFlyout from "../battle-flyout"; import BattleFlyout from "../battle-flyout";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { addWindow, WindowVariant } from "#app/ui/ui-theme"; import { addWindow, WindowVariant } from "#app/ui/ui-theme";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,5 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "./text"; import { addBBCodeTextObject, addTextObject, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,4 +1,5 @@
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import i18next from "i18next"; import i18next from "i18next";
import { formatText } from "#app/utils/common"; import { formatText } from "#app/utils/common";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -1,6 +1,7 @@
import { starterColors } from "#app/global-vars/starter-colors"; import { starterColors } from "#app/global-vars/starter-colors";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { argbFromRgba } from "@material/material-color-utilities"; import { argbFromRgba } from "@material/material-color-utilities";
import { rgbHexToRgba } from "#app/utils/common"; import { rgbHexToRgba } from "#app/utils/common";
import type { SpeciesId } from "#enums/species-id"; import type { SpeciesId } from "#enums/species-id";

View File

@ -1,4 +1,5 @@
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";

View File

@ -1,4 +1,5 @@
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import PartyUiHandler, { PartyUiMode } from "./party-ui-handler"; import PartyUiHandler, { PartyUiMode } from "./party-ui-handler";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";

View File

@ -1,7 +1,8 @@
import i18next from "i18next"; import i18next from "i18next";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { getEnumKeys, executeIf } from "#app/utils/common"; import { getEnumKeys, executeIf } from "#app/utils/common";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api";

View File

@ -1,5 +1,6 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { addWindow, WindowVariant } from "./ui-theme"; import { addWindow, WindowVariant } from "./ui-theme";
import { ScrollBar } from "#app/ui/scroll-bar"; import { ScrollBar } from "#app/ui/scroll-bar";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,6 +1,7 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { EggCountChangedEvent } from "#app/events/egg"; import type { EggCountChangedEvent } from "#app/events/egg";
import { EggEventType } from "#app/events/egg"; import { EggEventType } from "#app/events/egg";
import type EggHatchSceneHandler from "./egg-hatch-scene-handler"; import type EggHatchSceneHandler from "./egg-hatch-scene-handler";

View File

@ -1,5 +1,6 @@
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { TextStyle, addTextObject, getEggTierTextTint, getTextStyleOptions } from "./text"; import { addTextObject, getEggTierTextTint, getTextStyleOptions } from "./text";
import { TextStyle } from "#enums/text-style";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils/common"; import { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils/common";
import type { IEggOptions } from "../data/egg"; import type { IEggOptions } from "../data/egg";
@ -105,7 +106,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
const gachaInfoContainer = globalScene.add.container(160, 46); const gachaInfoContainer = globalScene.add.container(160, 46);
const currentLanguage = i18next.resolvedLanguage ?? "en"; const currentLanguage = i18next.resolvedLanguage ?? "en";
let gachaTextStyle = TextStyle.WINDOW_ALT; let gachaTextStyle: TextStyle = TextStyle.WINDOW_ALT;
let gachaX = 4; let gachaX = 4;
let gachaY = 0; let gachaY = 0;
let pokemonIconX = -20; let pokemonIconX = -20;

View File

@ -1,6 +1,7 @@
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
import { TextStyle, addTextObject } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";

View File

@ -1,5 +1,6 @@
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -1,6 +1,7 @@
import type { InfoToggle } from "#app/battle-scene"; import type { InfoToggle } from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { getTypeDamageMultiplierColor } from "#app/data/type"; import { getTypeDamageMultiplierColor } from "#app/data/type";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { Command } from "#enums/command"; import { Command } from "#enums/command";
@ -278,7 +279,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
const ppPercentLeft = pp / maxPP; const ppPercentLeft = pp / maxPP;
//** Determines TextStyle according to percentage of PP remaining */ //** Determines TextStyle according to percentage of PP remaining */
let ppColorStyle = TextStyle.MOVE_PP_FULL; let ppColorStyle: TextStyle = TextStyle.MOVE_PP_FULL;
if (ppPercentLeft > 0.25 && ppPercentLeft <= 0.5) { if (ppPercentLeft > 0.25 && ppPercentLeft <= 0.5) {
ppColorStyle = TextStyle.MOVE_PP_HALF_FULL; ppColorStyle = TextStyle.MOVE_PP_HALF_FULL;
} else if (ppPercentLeft > 0 && ppPercentLeft <= 0.25) { } else if (ppPercentLeft > 0 && ppPercentLeft <= 0.25) {

View File

@ -1,7 +1,8 @@
import type { DropDown } from "./dropdown"; import type { DropDown } from "./dropdown";
import { DropDownType } from "./dropdown"; import { DropDownType } from "./dropdown";
import type { StarterContainer } from "./starter-container"; import type { StarterContainer } from "./starter-container";
import { addTextObject, getTextColor, TextStyle } from "./text"; import { addTextObject, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiTheme } from "#enums/ui-theme"; import type { UiTheme } from "#enums/ui-theme";
import { addWindow, WindowVariant } from "./ui-theme"; import { addWindow, WindowVariant } from "./ui-theme";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -1,5 +1,6 @@
import type { StarterContainer } from "./starter-container"; import type { StarterContainer } from "./starter-container";
import { addTextObject, getTextColor, TextStyle } from "./text"; import { addTextObject, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiTheme } from "#enums/ui-theme"; import type { UiTheme } from "#enums/ui-theme";
import { addWindow, WindowVariant } from "./ui-theme"; import { addWindow, WindowVariant } from "./ui-theme";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,7 +1,8 @@
import type { ModalConfig } from "./modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler";
import { ModalUiHandler } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { TextStyle, addTextInputObject, addTextObject } from "./text"; import { addTextInputObject, addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";
import type InputText from "phaser3-rex-plugins/plugins/inputtext"; import type InputText from "phaser3-rex-plugins/plugins/inputtext";
import { fixedInt } from "#app/utils/common"; import { fixedInt } from "#app/utils/common";

View File

@ -1,5 +1,6 @@
import Phaser from "phaser"; import Phaser from "phaser";
import { TextStyle, addTextObject } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import UiHandler from "#app/ui/ui-handler"; import UiHandler from "#app/ui/ui-handler";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";

View File

@ -1,6 +1,7 @@
import i18next from "i18next"; import i18next from "i18next";
import { ModalUiHandler } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
export default class LoadingModalUiHandler extends ModalUiHandler { export default class LoadingModalUiHandler extends ModalUiHandler {

View File

@ -4,7 +4,8 @@ import type { ModalConfig } from "./modal-ui-handler";
import { fixedInt } from "#app/utils/common"; import { fixedInt } from "#app/utils/common";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import i18next from "i18next"; import i18next from "i18next";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api";

View File

@ -1,6 +1,7 @@
import { bypassLogin } from "#app/global-vars/bypass-login"; import { bypassLogin } from "#app/global-vars/bypass-login";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject, getTextStyleOptions } from "./text"; import { addTextObject, getTextStyleOptions } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { getEnumKeys, isLocal, fixedInt, sessionIdKey } from "#app/utils/common"; import { getEnumKeys, isLocal, fixedInt, sessionIdKey } from "#app/utils/common";
import { isBeta } from "#app/utils/utility-vars"; import { isBeta } from "#app/utils/utility-vars";

View File

@ -1,4 +1,5 @@
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { WindowVariant, addWindow } from "./ui-theme"; import { WindowVariant, addWindow } from "./ui-theme";

View File

@ -2,7 +2,8 @@ import { globalScene } from "#app/global-scene";
import type { ModifierTypeOption } from "../modifier/modifier-type"; import type { ModifierTypeOption } from "../modifier/modifier-type";
import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "../modifier/modifier-type"; import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "../modifier/modifier-type";
import { getPokeballAtlasKey } from "#app/data/pokeball"; import { getPokeballAtlasKey } from "#app/data/pokeball";
import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor, TextStyle } from "./text"; import { addTextObject, getTextStyleOptions, getModifierTierTextTint, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import AwaitableUiHandler from "./awaitable-ui-handler"; import AwaitableUiHandler from "./awaitable-ui-handler";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { LockModifierTiersModifier, PokemonHeldItemModifier, HealShopCostModifier } from "../modifier/modifier"; import { LockModifierTiersModifier, PokemonHeldItemModifier, HealShopCostModifier } from "../modifier/modifier";

View File

@ -1,6 +1,7 @@
import type { InfoToggle } from "#app/battle-scene"; import type { InfoToggle } from "#app/battle-scene";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { getLocalizedSpriteKey, fixedInt } from "#app/utils/common"; import { getLocalizedSpriteKey, fixedInt } from "#app/utils/common";
import type Move from "../data/moves/move"; import type Move from "../data/moves/move";

View File

@ -1,4 +1,5 @@
import { addBBCodeTextObject, getBBCodeFrag, TextStyle } from "./text"; import { addBBCodeTextObject, getBBCodeFrag } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";

View File

@ -1,6 +1,7 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type Pokemon from "../field/pokemon"; import type Pokemon from "../field/pokemon";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import i18next from "i18next"; import i18next from "i18next";
export default class PartyExpBar extends Phaser.GameObjects.Container { export default class PartyExpBar extends Phaser.GameObjects.Container {

View File

@ -2,7 +2,8 @@ import type { PlayerPokemon, TurnMove } from "#app/field/pokemon";
import type { PokemonMove } from "#app/data/moves/pokemon-move"; import type { PokemonMove } from "#app/data/moves/pokemon-move";
import type Pokemon from "#app/field/pokemon"; import type Pokemon from "#app/field/pokemon";
import { MoveResult } from "#enums/move-result"; import { MoveResult } from "#enums/move-result";
import { addBBCodeTextObject, addTextObject, getTextColor, TextStyle } from "#app/ui/text"; import { addBBCodeTextObject, addTextObject, getTextColor } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { Command } from "#enums/command"; import { Command } from "#enums/command";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";

View File

@ -1,5 +1,6 @@
import type { InfoToggle } from "../battle-scene"; import type { InfoToggle } from "../battle-scene";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { fixedInt } from "#app/utils/common"; import { fixedInt } from "#app/utils/common";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -2,7 +2,8 @@ import type { Variant } from "#app/sprites/variant";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { isNullOrUndefined } from "#app/utils/common"; import { isNullOrUndefined } from "#app/utils/common";
import type PokemonSpecies from "../data/pokemon-species"; import type PokemonSpecies from "../data/pokemon-species";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
interface SpeciesDetails { interface SpeciesDetails {
shiny?: boolean; shiny?: boolean;

View File

@ -29,7 +29,8 @@ import { DexAttr } from "#enums/dex-attr";
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { StatsContainer } from "#app/ui/stats-container"; import { StatsContainer } from "#app/ui/stats-container";
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions } from "#app/ui/text"; import { addBBCodeTextObject, addTextObject, getTextColor, getTextStyleOptions } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { Egg } from "#app/data/egg"; import { Egg } from "#app/data/egg";
@ -174,6 +175,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
private pokemonCaughtHatchedContainer: Phaser.GameObjects.Container; private pokemonCaughtHatchedContainer: Phaser.GameObjects.Container;
private pokemonCaughtCountText: Phaser.GameObjects.Text; private pokemonCaughtCountText: Phaser.GameObjects.Text;
private pokemonFormText: Phaser.GameObjects.Text; private pokemonFormText: Phaser.GameObjects.Text;
private pokemonCategoryText: Phaser.GameObjects.Text;
private pokemonHatchedIcon: Phaser.GameObjects.Sprite; private pokemonHatchedIcon: Phaser.GameObjects.Sprite;
private pokemonHatchedCountText: Phaser.GameObjects.Text; private pokemonHatchedCountText: Phaser.GameObjects.Text;
private pokemonShinyIcons: Phaser.GameObjects.Sprite[]; private pokemonShinyIcons: Phaser.GameObjects.Sprite[];
@ -409,6 +411,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonFormText.setOrigin(0, 0); this.pokemonFormText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonFormText); this.starterSelectContainer.add(this.pokemonFormText);
this.pokemonCategoryText = addTextObject(100, 18, "Category", TextStyle.WINDOW_ALT, {
fontSize: "42px",
});
this.pokemonCategoryText.setOrigin(1, 0);
this.starterSelectContainer.add(this.pokemonCategoryText);
this.pokemonCaughtHatchedContainer = globalScene.add.container(2, 25); this.pokemonCaughtHatchedContainer = globalScene.add.container(2, 25);
this.pokemonCaughtHatchedContainer.setScale(0.5); this.pokemonCaughtHatchedContainer.setScale(0.5);
this.starterSelectContainer.add(this.pokemonCaughtHatchedContainer); this.starterSelectContainer.add(this.pokemonCaughtHatchedContainer);
@ -2354,6 +2362,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonCaughtHatchedContainer.setVisible(true); this.pokemonCaughtHatchedContainer.setVisible(true);
this.pokemonCandyContainer.setVisible(false); this.pokemonCandyContainer.setVisible(false);
this.pokemonFormText.setVisible(false); this.pokemonFormText.setVisible(false);
this.pokemonCategoryText.setVisible(false);
const defaultDexAttr = globalScene.gameData.getSpeciesDefaultDexAttr(species, true, true); const defaultDexAttr = globalScene.gameData.getSpeciesDefaultDexAttr(species, true, true);
const props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr); const props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
@ -2382,6 +2391,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonCaughtHatchedContainer.setVisible(false); this.pokemonCaughtHatchedContainer.setVisible(false);
this.pokemonCandyContainer.setVisible(false); this.pokemonCandyContainer.setVisible(false);
this.pokemonFormText.setVisible(false); this.pokemonFormText.setVisible(false);
this.pokemonCategoryText.setVisible(false);
this.setSpeciesDetails(species!, { this.setSpeciesDetails(species!, {
// TODO: is this bang correct? // TODO: is this bang correct?
@ -2534,6 +2544,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.pokemonNameText.setText(species ? "???" : ""); this.pokemonNameText.setText(species ? "???" : "");
} }
// Setting the category
if (isFormCaught) {
this.pokemonCategoryText.setText(species.category);
} else {
this.pokemonCategoryText.setText("");
}
// Setting tint of the sprite // Setting tint of the sprite
if (isFormCaught) { if (isFormCaught) {
this.species.loadAssets(female!, formIndex, shiny, variant as Variant, true).then(() => { this.species.loadAssets(female!, formIndex, shiny, variant as Variant, true).then(() => {

View File

@ -20,7 +20,8 @@ import { AbilityAttr } from "#enums/ability-attr";
import { DexAttr } from "#enums/dex-attr"; import { DexAttr } from "#enums/dex-attr";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
import { TextStyle, addTextObject } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { SettingKeyboard } from "#app/system/settings/settings-keyboard"; import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
import { Passive as PassiveAttr } from "#enums/passive"; import { Passive as PassiveAttr } from "#enums/passive";

View File

@ -2,7 +2,8 @@ import PokemonInfoContainer from "#app/ui/pokemon-info-container";
import { Gender } from "#app/data/gender"; import { Gender } from "#app/data/gender";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { rgbHexToRgba, padInt } from "#app/utils/common"; import { rgbHexToRgba, padInt } from "#app/utils/common";
import { TextStyle, addTextObject } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { speciesEggMoves } from "#app/data/balance/egg-moves"; import { speciesEggMoves } from "#app/data/balance/egg-moves";
import { allMoves } from "#app/data/data-lists"; import { allMoves } from "#app/data/data-lists";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";

View File

@ -12,7 +12,8 @@ import { DexAttr } from "#enums/dex-attr";
import { fixedInt, getShinyDescriptor } from "#app/utils/common"; import { fixedInt, getShinyDescriptor } from "#app/utils/common";
import ConfirmUiHandler from "./confirm-ui-handler"; import ConfirmUiHandler from "./confirm-ui-handler";
import { StatsContainer } from "./stats-container"; import { StatsContainer } from "./stats-container";
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; import { addBBCodeTextObject, addTextObject, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
interface LanguageSetting { interface LanguageSetting {

View File

@ -2,7 +2,8 @@ import type { InputFieldConfig } from "./form-modal-ui-handler";
import { FormModalUiHandler } from "./form-modal-ui-handler"; import { FormModalUiHandler } from "./form-modal-ui-handler";
import type { ModalConfig } from "./modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import i18next from "i18next"; import i18next from "i18next";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -1,6 +1,7 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { GameModes } from "#enums/game-modes"; import { GameModes } from "#enums/game-modes";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { fixedInt, formatLargeNumber } from "#app/utils/common"; import { fixedInt, formatLargeNumber } from "#app/utils/common";

View File

@ -1,7 +1,8 @@
import { GameModes } from "#enums/game-modes"; import { GameModes } from "#enums/game-modes";
import UiHandler from "./ui-handler"; import UiHandler from "./ui-handler";
import type { SessionSaveData } from "../system/game-data"; import type { SessionSaveData } from "../system/game-data";
import { TextStyle, addTextObject, addBBCodeTextObject, getTextColor } from "./text"; import { addTextObject, addBBCodeTextObject, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { getPokeballAtlasKey } from "#app/data/pokeball"; import { getPokeballAtlasKey } from "#app/data/pokeball";

View File

@ -8,7 +8,8 @@ import type { SessionSaveData } from "../system/game-data";
import type PokemonData from "../system/pokemon-data"; import type PokemonData from "../system/pokemon-data";
import { isNullOrUndefined, fixedInt, getPlayTimeString, formatLargeNumber } from "#app/utils/common"; import { isNullOrUndefined, fixedInt, getPlayTimeString, formatLargeNumber } from "#app/utils/common";
import MessageUiHandler from "./message-ui-handler"; import MessageUiHandler from "./message-ui-handler";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { addWindow } from "./ui-theme"; import { addWindow } from "./ui-theme";
import { RunDisplayMode } from "#app/ui/run-info-ui-handler"; import { RunDisplayMode } from "#app/ui/run-info-ui-handler";

View File

@ -1,6 +1,7 @@
import type { ModalConfig } from "./modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler";
import { ModalUiHandler } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
export default class SessionReloadModalUiHandler extends ModalUiHandler { export default class SessionReloadModalUiHandler extends ModalUiHandler {

View File

@ -1,7 +1,8 @@
import UiHandler from "../ui-handler"; import UiHandler from "../ui-handler";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { addWindow } from "../ui-theme"; import { addWindow } from "../ui-theme";
import { addTextObject, TextStyle } from "../text"; import { addTextObject } from "../text";
import { TextStyle } from "#enums/text-style";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { NavigationManager } from "#app/ui/settings/navigationMenu"; import { NavigationManager } from "#app/ui/settings/navigationMenu";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -2,7 +2,8 @@ import UiHandler from "#app/ui/ui-handler";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import type { InterfaceConfig } from "#app/inputs-controller"; import type { InterfaceConfig } from "#app/inputs-controller";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { ScrollBar } from "#app/ui/scroll-bar"; import { ScrollBar } from "#app/ui/scroll-bar";
import { getIconWithSettingName } from "#app/configs/inputs/configHandler"; import { getIconWithSettingName } from "#app/configs/inputs/configHandler";
import NavigationMenu, { NavigationManager } from "#app/ui/settings/navigationMenu"; import NavigationMenu, { NavigationManager } from "#app/ui/settings/navigationMenu";

View File

@ -1,4 +1,5 @@
import { TextStyle, addTextObject } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";

View File

@ -2,7 +2,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { Device } from "#enums/devices"; import { Device } from "#enums/devices";
import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler"; import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -2,7 +2,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { getKeyWithKeycode } from "#app/configs/inputs/configHandler"; import { getKeyWithKeycode } from "#app/configs/inputs/configHandler";
import { Device } from "#enums/devices"; import { Device } from "#enums/devices";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,7 +1,8 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import type { InputsIcons } from "#app/ui/settings/abstract-control-settings-ui-handler"; import type { InputsIcons } from "#app/ui/settings/abstract-control-settings-ui-handler";
import { addTextObject, setTextStyle, TextStyle } from "#app/ui/text"; import { addTextObject, setTextStyle } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import i18next from "i18next"; import i18next from "i18next";

View File

@ -1,4 +1,5 @@
import { addTextObject, TextStyle } from "../text"; import { addTextObject } from "../text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { import {
setSettingGamepad, setSettingGamepad,

View File

@ -10,7 +10,8 @@ import {
import { reverseValueToKeySetting, truncateString } from "#app/utils/common"; import { reverseValueToKeySetting, truncateString } from "#app/utils/common";
import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler"; import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler";
import type { InterfaceConfig } from "#app/inputs-controller"; import type { InterfaceConfig } from "#app/inputs-controller";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { deleteBind } from "#app/configs/inputs/configHandler"; import { deleteBind } from "#app/configs/inputs/configHandler";
import { Device } from "#enums/devices"; import { Device } from "#enums/devices";
import { NavigationManager } from "#app/ui/settings/navigationMenu"; import { NavigationManager } from "#app/ui/settings/navigationMenu";

View File

@ -1,6 +1,7 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type PokemonSpecies from "../data/pokemon-species"; import type PokemonSpecies from "../data/pokemon-species";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
export class StarterContainer extends Phaser.GameObjects.Container { export class StarterContainer extends Phaser.GameObjects.Container {
public species: PokemonSpecies; public species: PokemonSpecies;

View File

@ -35,7 +35,8 @@ import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"
import MessageUiHandler from "#app/ui/message-ui-handler"; import MessageUiHandler from "#app/ui/message-ui-handler";
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler"; import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
import { StatsContainer } from "#app/ui/stats-container"; import { StatsContainer } from "#app/ui/stats-container";
import { TextStyle, addBBCodeTextObject, addTextObject } from "#app/ui/text"; import { addBBCodeTextObject, addTextObject } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { addWindow } from "#app/ui/ui-theme"; import { addWindow } from "#app/ui/ui-theme";
import { Egg } from "#app/data/egg"; import { Egg } from "#app/data/egg";

View File

@ -1,5 +1,6 @@
import type BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText"; import type BBCodeText from "phaser3-rex-plugins/plugins/gameobjects/tagtext/bbcodetext/BBCodeText";
import { TextStyle, addBBCodeTextObject, addTextObject, getTextColor } from "./text"; import { addBBCodeTextObject, addTextObject, getTextColor } from "./text";
import { TextStyle } from "#enums/text-style";
import { PERMANENT_STATS, getStatKey } from "#app/enums/stat"; import { PERMANENT_STATS, getStatKey } from "#app/enums/stat";
import i18next from "i18next"; import i18next from "i18next";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";

View File

@ -19,7 +19,8 @@ import { getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/bal
import { argbFromRgba } from "@material/material-color-utilities"; import { argbFromRgba } from "@material/material-color-utilities";
import { getTypeRgb } from "#app/data/type"; import { getTypeRgb } from "#app/data/type";
import { PokemonType } from "#enums/pokemon-type"; import { PokemonType } from "#enums/pokemon-type";
import { TextStyle, addBBCodeTextObject, addTextObject, getBBCodeFrag } from "#app/ui/text"; import { addBBCodeTextObject, addTextObject, getBBCodeFrag } from "#app/ui/text";
import { TextStyle } from "#enums/text-style";
import type Move from "#app/data/moves/move"; import type Move from "#app/data/moves/move";
import { MoveCategory } from "#enums/MoveCategory"; import { MoveCategory } from "#enums/MoveCategory";
import { getPokeballAtlasKey } from "#app/data/pokeball"; import { getPokeballAtlasKey } from "#app/data/pokeball";

View File

@ -6,52 +6,8 @@ import InputText from "phaser3-rex-plugins/plugins/inputtext";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { ModifierTier } from "../enums/modifier-tier"; import { ModifierTier } from "../enums/modifier-tier";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import { TextStyle } from "#enums/text-style";
export enum TextStyle { import type { TextStyleOptions } from "#app/@types/ui";
MESSAGE,
WINDOW,
WINDOW_ALT,
BATTLE_INFO,
PARTY,
PARTY_RED,
SUMMARY,
SUMMARY_ALT,
SUMMARY_RED,
SUMMARY_BLUE,
SUMMARY_PINK,
SUMMARY_GOLD,
SUMMARY_GRAY,
SUMMARY_GREEN,
MONEY, // Money default styling (pale yellow)
MONEY_WINDOW, // Money displayed in Windows (needs different colors based on theme)
STATS_LABEL,
STATS_VALUE,
SETTINGS_VALUE,
SETTINGS_LABEL,
SETTINGS_SELECTED,
SETTINGS_LOCKED,
TOOLTIP_TITLE,
TOOLTIP_CONTENT,
MOVE_INFO_CONTENT,
MOVE_PP_FULL,
MOVE_PP_HALF_FULL,
MOVE_PP_NEAR_EMPTY,
MOVE_PP_EMPTY,
SMALLER_WINDOW_ALT,
BGM_BAR,
PERFECT_IV,
ME_OPTION_DEFAULT, // Default style for choices in ME
ME_OPTION_SPECIAL, // Style for choices with special requirements in ME
SHADOW_TEXT, // To obscure unavailable options
}
export interface TextStyleOptions {
scale: number;
styleOptions: Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig;
shadowColor: string;
shadowXpos: number;
shadowYpos: number;
}
export function addTextObject( export function addTextObject(
x: number, x: number,
@ -66,9 +22,10 @@ export function addTextObject(
extraStyleOptions, extraStyleOptions,
); );
const ret = globalScene.add.text(x, y, content, styleOptions); const ret = globalScene.add
ret.setScale(scale); .text(x, y, content, styleOptions)
ret.setShadow(shadowXpos, shadowYpos, shadowColor); .setScale(scale)
.setShadow(shadowXpos, shadowYpos, shadowColor);
if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) { if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) {
ret.setLineSpacing(scale * 30); ret.setLineSpacing(scale * 30);
} }
@ -90,8 +47,7 @@ export function setTextStyle(
globalScene.uiTheme, globalScene.uiTheme,
extraStyleOptions, extraStyleOptions,
); );
obj.setScale(scale); obj.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor);
obj.setShadow(shadowXpos, shadowYpos, shadowColor);
if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) { if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) {
obj.setLineSpacing(scale * 30); obj.setLineSpacing(scale * 30);
} }
@ -116,8 +72,7 @@ export function addBBCodeTextObject(
const ret = new BBCodeText(globalScene, x, y, content, styleOptions as BBCodeText.TextStyle); const ret = new BBCodeText(globalScene, x, y, content, styleOptions as BBCodeText.TextStyle);
globalScene.add.existing(ret); globalScene.add.existing(ret);
ret.setScale(scale); ret.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor);
ret.setShadow(shadowXpos, shadowYpos, shadowColor);
if (!(styleOptions as BBCodeText.TextStyle).lineSpacing) { if (!(styleOptions as BBCodeText.TextStyle).lineSpacing) {
ret.setLineSpacing(scale * 60); ret.setLineSpacing(scale * 60);
} }

View File

@ -1,7 +1,8 @@
import OptionSelectUiHandler from "./settings/option-select-ui-handler"; import OptionSelectUiHandler from "./settings/option-select-ui-handler";
import { UiMode } from "#enums/ui-mode"; import { UiMode } from "#enums/ui-mode";
import { fixedInt, randInt, randItem } from "#app/utils/common"; import { fixedInt, randInt, randItem } from "#app/utils/common";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import { getSplashMessages } from "../data/splash-messages"; import { getSplashMessages } from "../data/splash-messages";
import i18next from "i18next"; import i18next from "i18next";
import { TimedEventDisplay } from "#app/timed-event-manager"; import { TimedEventDisplay } from "#app/timed-event-manager";

View File

@ -1,5 +1,5 @@
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import type { TextStyle } from "./text"; import type { TextStyle } from "#enums/text-style";
import { getTextColor } from "./text"; import { getTextColor } from "./text";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import type { Button } from "#enums/buttons"; import type { Button } from "#enums/buttons";

View File

@ -15,7 +15,8 @@ import TargetSelectUiHandler from "./target-select-ui-handler";
import SettingsUiHandler from "./settings/settings-ui-handler"; import SettingsUiHandler from "./settings/settings-ui-handler";
import SettingsGamepadUiHandler from "./settings/settings-gamepad-ui-handler"; import SettingsGamepadUiHandler from "./settings/settings-gamepad-ui-handler";
import GameChallengesUiHandler from "./challenges-select-ui-handler"; import GameChallengesUiHandler from "./challenges-select-ui-handler";
import { TextStyle, addTextObject } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import AchvBar from "./achv-bar"; import AchvBar from "./achv-bar";
import MenuUiHandler from "./menu-ui-handler"; import MenuUiHandler from "./menu-ui-handler";
import AchvsUiHandler from "./achvs-ui-handler"; import AchvsUiHandler from "./achvs-ui-handler";

View File

@ -1,6 +1,7 @@
import type { ModalConfig } from "./modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler";
import { ModalUiHandler } from "./modal-ui-handler"; import { ModalUiHandler } from "./modal-ui-handler";
import { addTextObject, TextStyle } from "./text"; import { addTextObject } from "./text";
import { TextStyle } from "#enums/text-style";
import type { UiMode } from "#enums/ui-mode"; import type { UiMode } from "#enums/ui-mode";
import { updateUserInfo } from "#app/account"; import { updateUserInfo } from "#app/account";
import { sessionIdKey } from "#app/utils/common"; import { sessionIdKey } from "#app/utils/common";

View File

@ -1,11 +1,14 @@
import { AbilityId } from "#enums/ability-id"; import { RandomMoveAttr } from "#app/data/moves/move";
import { MoveResult } from "#enums/move-result";
import { getPokemonNameWithAffix } from "#app/messages";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import { SpeciesId } from "#enums/species-id"; import { SpeciesId } from "#enums/species-id";
import { AbilityId } from "#app/enums/ability-id";
import { WeatherType } from "#enums/weather-type"; import { WeatherType } from "#enums/weather-type";
import GameManager from "#test/testUtils/gameManager"; import GameManager from "#test/testUtils/gameManager";
import i18next from "i18next";
import Phaser from "phaser"; import Phaser from "phaser";
//import { TurnInitPhase } from "#app/phases/turn-init-phase"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Chilly Reception", () => { describe("Moves - Chilly Reception", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -25,95 +28,121 @@ describe("Moves - Chilly Reception", () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override game.override
.battleStyle("single") .battleStyle("single")
.moveset([MoveId.CHILLY_RECEPTION, MoveId.SNOWSCAPE]) .moveset([MoveId.CHILLY_RECEPTION, MoveId.SNOWSCAPE, MoveId.SPLASH, MoveId.METRONOME])
.enemyMoveset(MoveId.SPLASH) .enemyMoveset(MoveId.SPLASH)
.enemyAbility(AbilityId.BALL_FETCH) .enemyAbility(AbilityId.BALL_FETCH)
.ability(AbilityId.BALL_FETCH); .ability(AbilityId.BALL_FETCH);
}); });
it("should still change the weather if user can't switch out", async () => { it("should display message before use, switch the user out and change the weather to snow", async () => {
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
const [slowking, meowth] = game.scene.getPlayerParty();
game.move.select(MoveId.CHILLY_RECEPTION);
game.doSelectPartyPokemon(1);
await game.toEndOfTurn();
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.scene.getPlayerPokemon()).toBe(meowth);
expect(slowking.isOnField()).toBe(false);
expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
expect(game.textInterceptor.logs).toContain(
i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(slowking) }),
);
});
it("should still change weather if user can't switch out", async () => {
await game.classicMode.startBattle([SpeciesId.SLOWKING]); await game.classicMode.startBattle([SpeciesId.SLOWKING]);
game.move.select(MoveId.CHILLY_RECEPTION); game.move.select(MoveId.CHILLY_RECEPTION);
await game.toEndOfTurn();
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase");
expect(game.scene.getPlayerPokemon()?.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
}); });
it("should switch out even if it's snowing", async () => { it("should still switch out even if weather cannot be changed", async () => {
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]); await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
// first turn set up snow with snowscape, try chilly reception on second turn
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SNOW);
const [slowking, meowth] = game.scene.getPlayerParty();
game.move.select(MoveId.SNOWSCAPE); game.move.select(MoveId.SNOWSCAPE);
await game.phaseInterceptor.to("BerryPhase", false); await game.toNextTurn();
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
await game.phaseInterceptor.to("TurnInitPhase", false);
game.move.select(MoveId.CHILLY_RECEPTION); game.move.select(MoveId.CHILLY_RECEPTION);
game.doSelectPartyPokemon(1); game.doSelectPartyPokemon(1);
// TODO: Uncomment lines once wimp out PR fixes force switches to not reset summon data immediately
// await game.phaseInterceptor.to("SwitchSummonPhase", false);
// expect(slowking.getLastXMoves()[0].result).toBe(MoveResult.SUCCESS);
await game.toEndOfTurn();
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MEOWTH); expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
expect(game.scene.getPlayerPokemon()).toBe(meowth);
expect(slowking.isOnField()).toBe(false);
}); });
it("happy case - switch out and weather changes", async () => { // Source: https://replay.pokemonshowdown.com/gen9ou-2367532550
it("should fail (while still displaying message) if neither weather change nor switch out succeeds", async () => {
await game.classicMode.startBattle([SpeciesId.SLOWKING]);
expect(game.scene.arena.weather?.weatherType).not.toBe(WeatherType.SNOW);
const slowking = game.scene.getPlayerPokemon()!;
game.move.select(MoveId.SNOWSCAPE);
await game.toNextTurn();
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
game.move.select(MoveId.CHILLY_RECEPTION);
game.doSelectPartyPokemon(1);
await game.toEndOfTurn();
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.phaseInterceptor.log).not.toContain("SwitchSummonPhase");
expect(game.scene.getPlayerPokemon()).toBe(slowking);
expect(slowking.getLastXMoves()[0].result).toBe(MoveResult.FAIL);
expect(game.textInterceptor.logs).toContain(
i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(slowking) }),
);
});
it("should succeed without message if called indirectly", async () => {
vi.spyOn(RandomMoveAttr.prototype, "getMoveOverride").mockReturnValue(MoveId.CHILLY_RECEPTION);
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]); await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
game.move.select(MoveId.CHILLY_RECEPTION); const [slowking, meowth] = game.scene.getPlayerParty();
game.doSelectPartyPokemon(1);
game.move.select(MoveId.METRONOME);
game.doSelectPartyPokemon(1);
await game.toEndOfTurn();
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW); expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.scene.getPlayerField()[0].species.speciesId).toBe(SpeciesId.MEOWTH); expect(game.scene.getPlayerPokemon()).toBe(meowth);
expect(slowking.isOnField()).toBe(false);
expect(game.phaseInterceptor.log).toContain("SwitchSummonPhase");
expect(game.textInterceptor.logs).not.toContain(
i18next.t("moveTriggers:chillyReception", { pokemonName: getPokemonNameWithAffix(slowking) }),
);
}); });
// enemy uses another move and weather doesn't change // Bugcheck test for enemy AI bug
it("check case - enemy not selecting chilly reception doesn't change weather ", async () => { it("check case - enemy not selecting chilly reception doesn't change weather", async () => {
game.override.battleStyle("single").enemyMoveset([MoveId.CHILLY_RECEPTION, MoveId.TACKLE]).moveset(MoveId.SPLASH); game.override.enemyMoveset([MoveId.CHILLY_RECEPTION, MoveId.TACKLE]);
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]); await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
game.move.select(MoveId.SPLASH); game.move.select(MoveId.SPLASH);
await game.move.selectEnemyMove(MoveId.TACKLE); await game.move.selectEnemyMove(MoveId.TACKLE);
await game.toEndOfTurn();
await game.phaseInterceptor.to("BerryPhase", false); expect(game.scene.arena.weather?.weatherType).toBeUndefined();
expect(game.scene.arena.weather?.weatherType).toBe(undefined);
});
it("enemy trainer - expected behavior ", async () => {
game.override
.battleStyle("single")
.startingWave(8)
.enemyMoveset(MoveId.CHILLY_RECEPTION)
.enemySpecies(SpeciesId.MAGIKARP)
.moveset([MoveId.SPLASH, MoveId.THUNDERBOLT]);
await game.classicMode.startBattle([SpeciesId.JOLTEON]);
const RIVAL_MAGIKARP1 = game.scene.getEnemyPokemon()?.id;
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
expect(game.scene.getEnemyPokemon()?.id !== RIVAL_MAGIKARP1);
await game.phaseInterceptor.to("TurnInitPhase", false);
game.move.select(MoveId.SPLASH);
// second chilly reception should still switch out
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
await game.phaseInterceptor.to("TurnInitPhase", false);
expect(game.scene.getEnemyPokemon()?.id === RIVAL_MAGIKARP1);
game.move.select(MoveId.THUNDERBOLT);
// enemy chilly recep move should fail: it's snowing and no option to switch out
// no crashing
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
await game.phaseInterceptor.to("TurnInitPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
game.move.select(MoveId.SPLASH);
await game.phaseInterceptor.to("BerryPhase", false);
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
}); });
}); });