mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
Compare commits
8 Commits
e9a7569cab
...
6506b78081
Author | SHA1 | Date | |
---|---|---|---|
|
6506b78081 | ||
|
4b70fab608 | ||
|
1ff2701964 | ||
|
1e306e25b5 | ||
|
43aa772603 | ||
|
b8367fdb8c | ||
|
6030dd6462 | ||
|
c353f54a42 |
10
src/@types/ui.ts
Normal file
10
src/@types/ui.ts
Normal 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;
|
||||
}
|
@ -51,7 +51,8 @@ import type { Phase } from "#app/phase";
|
||||
import { initGameSpeed } from "#app/system/game-speed";
|
||||
import { Arena, ArenaBase } from "#app/field/arena";
|
||||
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 { MusicPreference } from "#app/system/settings/settings";
|
||||
import {
|
||||
|
@ -306,13 +306,6 @@ export class BlockRecoilDamageAttr extends AbAttr {
|
||||
): void {
|
||||
cancelled.value = true;
|
||||
}
|
||||
|
||||
getTriggerMessage(pokemon: Pokemon, abilityName: string, ..._args: any[]) {
|
||||
return i18next.t("abilityTriggers:blockRecoilDamage", {
|
||||
pokemonName: getPokemonNameWithAffix(pokemon),
|
||||
abilityName: abilityName,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,6 +93,10 @@ import { ChargingMove, MoveAttrMap, MoveAttrString, MoveKindString, MoveClassMap
|
||||
import { applyMoveAttrs } from "./apply-attrs";
|
||||
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;
|
||||
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 {
|
||||
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)) {
|
||||
super();
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const message = typeof this.message === "string"
|
||||
? this.message as string
|
||||
: this.message(user, target, move);
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
|
||||
const message = typeof this.message === "function"
|
||||
? this.message(user, target, move)
|
||||
: this.message;
|
||||
|
||||
// TODO: Consider changing if/when MoveAttr `apply` return values become significant
|
||||
if (message) {
|
||||
globalScene.phaseManager.queueMessage(message, 500);
|
||||
return true;
|
||||
@ -11299,7 +11316,11 @@ export function initMoves() {
|
||||
.attr(ForceSwitchOutAttr, true, SwitchType.SHED_TAIL)
|
||||
.condition(failIfLastInPartyCondition),
|
||||
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),
|
||||
new SelfStatusMove(MoveId.TIDY_UP, PokemonType.NORMAL, -1, 10, -1, 0, 9)
|
||||
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPD ], 1, true)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { TextStyle } from "#app/ui/text";
|
||||
import type { TextStyle } from "#enums/text-style";
|
||||
|
||||
export class TextDisplay {
|
||||
speaker?: string;
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 { UiTheme } from "#enums/ui-theme";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
|
@ -751,7 +751,7 @@ export async function catchPokemon(
|
||||
UiMode.POKEDEX_PAGE,
|
||||
pokemon.species,
|
||||
pokemon.formIndex,
|
||||
attributes,
|
||||
[attributes],
|
||||
null,
|
||||
() => {
|
||||
globalScene.ui.setMode(UiMode.MESSAGE).then(() => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { UiTheme } from "#enums/ui-theme";
|
||||
import i18next from "i18next";
|
||||
|
@ -764,7 +764,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
readonly subLegendary: boolean;
|
||||
readonly legendary: boolean;
|
||||
readonly mythical: boolean;
|
||||
readonly species: string;
|
||||
public category: string;
|
||||
readonly growthRate: GrowthRate;
|
||||
/** The chance (as a decimal) for this Species to be male, or `null` for genderless species */
|
||||
readonly malePercent: number | null;
|
||||
@ -778,7 +778,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
subLegendary: boolean,
|
||||
legendary: boolean,
|
||||
mythical: boolean,
|
||||
species: string,
|
||||
category: string,
|
||||
type1: PokemonType,
|
||||
type2: PokemonType | null,
|
||||
height: number,
|
||||
@ -829,7 +829,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
this.subLegendary = subLegendary;
|
||||
this.legendary = legendary;
|
||||
this.mythical = mythical;
|
||||
this.species = species;
|
||||
this.category = category;
|
||||
this.growthRate = growthRate;
|
||||
this.malePercent = malePercent;
|
||||
this.genderDiffs = genderDiffs;
|
||||
@ -968,6 +968,7 @@ export default class PokemonSpecies extends PokemonSpeciesForm implements Locali
|
||||
|
||||
localize(): void {
|
||||
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 {
|
||||
|
42
src/enums/text-style.ts
Normal file
42
src/enums/text-style.ts
Normal 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];
|
@ -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 Pokemon from "./pokemon";
|
||||
import { HitResult } from "#enums/hit-result";
|
||||
|
@ -13,7 +13,8 @@ import Overrides from "#app/overrides";
|
||||
import { LearnMoveType } from "#enums/learn-move-type";
|
||||
import type { VoucherType } from "#app/system/voucher";
|
||||
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 { BattlerTagType } from "#enums/battler-tag-type";
|
||||
import { BerryType } from "#enums/berry-type";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { PlayerGender } from "#app/enums/player-gender";
|
||||
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";
|
||||
|
||||
export class EndCardPhase extends Phase {
|
||||
|
@ -668,6 +668,9 @@ export class MovePhase extends BattlePhase {
|
||||
}),
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,8 @@ import { globalScene } from "#app/global-scene";
|
||||
import type { BattlerIndex } from "#enums/battler-index";
|
||||
import { PERMANENT_STATS, Stat } from "#app/enums/stat";
|
||||
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 i18next from "i18next";
|
||||
import { PokemonPhase } from "./pokemon-phase";
|
||||
|
@ -245,6 +245,7 @@ export async function initI18n(): Promise<void> {
|
||||
"pokeball",
|
||||
"pokedexUiHandler",
|
||||
"pokemon",
|
||||
"pokemonCategory",
|
||||
"pokemonEvolutions",
|
||||
"pokemonForm",
|
||||
"pokemonInfo",
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { isNullOrUndefined } from "#app/utils/common";
|
||||
import i18next from "i18next";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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";
|
||||
|
||||
const barWidth = 118;
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 UiHandler from "./ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { Achv, getAchievementDescription } from "../system/achv";
|
||||
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";
|
||||
|
||||
export default class AchvBar extends Phaser.GameObjects.Container {
|
||||
|
@ -5,7 +5,8 @@ import { achvs, getAchievementDescription } from "#app/system/achv";
|
||||
import type { Voucher } from "#app/system/voucher";
|
||||
import { getVoucherTypeIcon, getVoucherTypeName, vouchers } from "#app/system/voucher";
|
||||
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 { addWindow } from "#app/ui/ui-theme";
|
||||
import { ScrollBar } from "#app/ui/scroll-bar";
|
||||
|
@ -4,7 +4,7 @@ import { formatText } from "#app/utils/common";
|
||||
import type { InputFieldConfig } from "./form-modal-ui-handler";
|
||||
import { FormModalUiHandler } from "./form-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 { globalScene } from "#app/global-scene";
|
||||
|
||||
|
@ -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 { ArenaTrapTag } from "#app/data/arena-tag";
|
||||
import { ArenaTagSide } from "#enums/arena-tag-side";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { fixedInt } from "#app/utils/common";
|
||||
import i18next from "i18next";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { globalScene } from "#app/global-scene";
|
||||
import type Move from "#app/data/moves/move";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { default as Pokemon } from "../../field/pokemon";
|
||||
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 { StatusEffect } from "#enums/status-effect";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
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 { Stat } from "#enums/stat";
|
||||
import i18next from "i18next";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 MessageUiHandler from "./message-ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import { addTextObject } from "./text";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
import i18next from "i18next";
|
||||
import { formatText } from "#app/utils/common";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { starterColors } from "#app/global-vars/starter-colors";
|
||||
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 { rgbHexToRgba } from "#app/utils/common";
|
||||
import type { SpeciesId } from "#enums/species-id";
|
||||
|
@ -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 UiHandler from "./ui-handler";
|
||||
import { addWindow } from "./ui-theme";
|
||||
|
@ -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 { UiMode } from "#enums/ui-mode";
|
||||
import UiHandler from "./ui-handler";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import i18next from "i18next";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
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 { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { ScrollBar } from "#app/ui/scroll-bar";
|
||||
import i18next from "i18next";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
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 { EggEventType } from "#app/events/egg";
|
||||
import type EggHatchSceneHandler from "./egg-hatch-scene-handler";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { getEnumValues, getEnumKeys, fixedInt, randSeedShuffle } from "#app/utils/common";
|
||||
import type { IEggOptions } from "../data/egg";
|
||||
@ -105,7 +106,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
|
||||
const gachaInfoContainer = globalScene.add.container(160, 46);
|
||||
|
||||
const currentLanguage = i18next.resolvedLanguage ?? "en";
|
||||
let gachaTextStyle = TextStyle.WINDOW_ALT;
|
||||
let gachaTextStyle: TextStyle = TextStyle.WINDOW_ALT;
|
||||
let gachaX = 4;
|
||||
let gachaY = 0;
|
||||
let pokemonIconX = -20;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
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 { addWindow } from "#app/ui/ui-theme";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { Button } from "#enums/buttons";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { InfoToggle } from "#app/battle-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 { PokemonType } from "#enums/pokemon-type";
|
||||
import { Command } from "#enums/command";
|
||||
@ -278,7 +279,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
|
||||
const ppPercentLeft = pp / maxPP;
|
||||
|
||||
//** 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) {
|
||||
ppColorStyle = TextStyle.MOVE_PP_HALF_FULL;
|
||||
} else if (ppPercentLeft > 0 && ppPercentLeft <= 0.25) {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import type { DropDown } from "./dropdown";
|
||||
import { DropDownType } from "./dropdown";
|
||||
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 { addWindow, WindowVariant } from "./ui-theme";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { addWindow, WindowVariant } from "./ui-theme";
|
||||
import i18next from "i18next";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { ModalUiHandler } from "./modal-ui-handler";
|
||||
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 type InputText from "phaser3-rex-plugins/plugins/inputtext";
|
||||
import { fixedInt } from "#app/utils/common";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 UiHandler from "#app/ui/ui-handler";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import i18next from "i18next";
|
||||
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";
|
||||
|
||||
export default class LoadingModalUiHandler extends ModalUiHandler {
|
||||
|
@ -4,7 +4,8 @@ import type { ModalConfig } from "./modal-ui-handler";
|
||||
import { fixedInt } from "#app/utils/common";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
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 type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { bypassLogin } from "#app/global-vars/bypass-login";
|
||||
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 { getEnumKeys, isLocal, fixedInt, sessionIdKey } from "#app/utils/common";
|
||||
import { isBeta } from "#app/utils/utility-vars";
|
||||
|
@ -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 UiHandler from "./ui-handler";
|
||||
import { WindowVariant, addWindow } from "./ui-theme";
|
||||
|
@ -2,7 +2,8 @@ import { globalScene } from "#app/global-scene";
|
||||
import type { ModifierTypeOption } from "../modifier/modifier-type";
|
||||
import { getPlayerShopModifierTypeOptionsForWave, TmModifierType } from "../modifier/modifier-type";
|
||||
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 { UiMode } from "#enums/ui-mode";
|
||||
import { LockModifierTiersModifier, PokemonHeldItemModifier, HealShopCostModifier } from "../modifier/modifier";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { InfoToggle } from "#app/battle-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 { getLocalizedSpriteKey, fixedInt } from "#app/utils/common";
|
||||
import type Move from "../data/moves/move";
|
||||
|
@ -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 UiHandler from "./ui-handler";
|
||||
import { Button } from "#enums/buttons";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
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";
|
||||
|
||||
export default class PartyExpBar extends Phaser.GameObjects.Container {
|
||||
|
@ -2,7 +2,8 @@ import type { PlayerPokemon, TurnMove } from "#app/field/pokemon";
|
||||
import type { PokemonMove } from "#app/data/moves/pokemon-move";
|
||||
import type Pokemon from "#app/field/pokemon";
|
||||
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 MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 { fixedInt } from "#app/utils/common";
|
||||
import i18next from "i18next";
|
||||
|
@ -2,7 +2,8 @@ import type { Variant } from "#app/sprites/variant";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { isNullOrUndefined } from "#app/utils/common";
|
||||
import type PokemonSpecies from "../data/pokemon-species";
|
||||
import { addTextObject, TextStyle } from "./text";
|
||||
import { addTextObject } from "./text";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
|
||||
interface SpeciesDetails {
|
||||
shiny?: boolean;
|
||||
|
@ -29,7 +29,8 @@ import { DexAttr } from "#enums/dex-attr";
|
||||
import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
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 { addWindow } from "#app/ui/ui-theme";
|
||||
import { Egg } from "#app/data/egg";
|
||||
@ -174,6 +175,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
private pokemonCaughtHatchedContainer: Phaser.GameObjects.Container;
|
||||
private pokemonCaughtCountText: Phaser.GameObjects.Text;
|
||||
private pokemonFormText: Phaser.GameObjects.Text;
|
||||
private pokemonCategoryText: Phaser.GameObjects.Text;
|
||||
private pokemonHatchedIcon: Phaser.GameObjects.Sprite;
|
||||
private pokemonHatchedCountText: Phaser.GameObjects.Text;
|
||||
private pokemonShinyIcons: Phaser.GameObjects.Sprite[];
|
||||
@ -409,6 +411,12 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonFormText.setOrigin(0, 0);
|
||||
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.setScale(0.5);
|
||||
this.starterSelectContainer.add(this.pokemonCaughtHatchedContainer);
|
||||
@ -2354,6 +2362,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonCaughtHatchedContainer.setVisible(true);
|
||||
this.pokemonCandyContainer.setVisible(false);
|
||||
this.pokemonFormText.setVisible(false);
|
||||
this.pokemonCategoryText.setVisible(false);
|
||||
|
||||
const defaultDexAttr = globalScene.gameData.getSpeciesDefaultDexAttr(species, true, true);
|
||||
const props = globalScene.gameData.getSpeciesDexAttrProps(species, defaultDexAttr);
|
||||
@ -2382,6 +2391,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonCaughtHatchedContainer.setVisible(false);
|
||||
this.pokemonCandyContainer.setVisible(false);
|
||||
this.pokemonFormText.setVisible(false);
|
||||
this.pokemonCategoryText.setVisible(false);
|
||||
|
||||
this.setSpeciesDetails(species!, {
|
||||
// TODO: is this bang correct?
|
||||
@ -2534,6 +2544,13 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
this.pokemonNameText.setText(species ? "???" : "");
|
||||
}
|
||||
|
||||
// Setting the category
|
||||
if (isFormCaught) {
|
||||
this.pokemonCategoryText.setText(species.category);
|
||||
} else {
|
||||
this.pokemonCategoryText.setText("");
|
||||
}
|
||||
|
||||
// Setting tint of the sprite
|
||||
if (isFormCaught) {
|
||||
this.species.loadAssets(female!, formIndex, shiny, variant as Variant, true).then(() => {
|
||||
|
@ -20,7 +20,8 @@ import { AbilityAttr } from "#enums/ability-attr";
|
||||
import { DexAttr } from "#enums/dex-attr";
|
||||
import MessageUiHandler from "#app/ui/message-ui-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 { SettingKeyboard } from "#app/system/settings/settings-keyboard";
|
||||
import { Passive as PassiveAttr } from "#enums/passive";
|
||||
|
@ -2,7 +2,8 @@ import PokemonInfoContainer from "#app/ui/pokemon-info-container";
|
||||
import { Gender } from "#app/data/gender";
|
||||
import { PokemonType } from "#enums/pokemon-type";
|
||||
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 { allMoves } from "#app/data/data-lists";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
|
@ -12,7 +12,8 @@ import { DexAttr } from "#enums/dex-attr";
|
||||
import { fixedInt, getShinyDescriptor } from "#app/utils/common";
|
||||
import ConfirmUiHandler from "./confirm-ui-handler";
|
||||
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";
|
||||
|
||||
interface LanguageSetting {
|
||||
|
@ -2,7 +2,8 @@ import type { InputFieldConfig } from "./form-modal-ui-handler";
|
||||
import { FormModalUiHandler } from "./form-modal-ui-handler";
|
||||
import type { ModalConfig } from "./modal-ui-handler";
|
||||
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 { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
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 { addWindow } from "./ui-theme";
|
||||
import { fixedInt, formatLargeNumber } from "#app/utils/common";
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { GameModes } from "#enums/game-modes";
|
||||
import UiHandler from "./ui-handler";
|
||||
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 { addWindow } from "./ui-theme";
|
||||
import { getPokeballAtlasKey } from "#app/data/pokeball";
|
||||
|
@ -8,7 +8,8 @@ import type { SessionSaveData } from "../system/game-data";
|
||||
import type PokemonData from "../system/pokemon-data";
|
||||
import { isNullOrUndefined, fixedInt, getPlayTimeString, formatLargeNumber } from "#app/utils/common";
|
||||
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 { addWindow } from "./ui-theme";
|
||||
import { RunDisplayMode } from "#app/ui/run-info-ui-handler";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { ModalConfig } 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";
|
||||
|
||||
export default class SessionReloadModalUiHandler extends ModalUiHandler {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import UiHandler from "../ui-handler";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
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 { NavigationManager } from "#app/ui/settings/navigationMenu";
|
||||
import i18next from "i18next";
|
||||
|
@ -2,7 +2,8 @@ import UiHandler from "#app/ui/ui-handler";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import type { InterfaceConfig } from "#app/inputs-controller";
|
||||
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 { getIconWithSettingName } from "#app/configs/inputs/configHandler";
|
||||
import NavigationMenu, { NavigationManager } from "#app/ui/settings/navigationMenu";
|
||||
|
@ -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 MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import { addWindow } from "#app/ui/ui-theme";
|
||||
|
@ -2,7 +2,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { Device } from "#enums/devices";
|
||||
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 i18next from "i18next";
|
||||
|
||||
|
@ -2,7 +2,8 @@ import AbstractBindingUiHandler from "./abstract-binding-ui-handler";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import { getKeyWithKeycode } from "#app/configs/inputs/configHandler";
|
||||
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 i18next from "i18next";
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
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 { Button } from "#enums/buttons";
|
||||
import i18next from "i18next";
|
||||
|
@ -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 {
|
||||
setSettingGamepad,
|
||||
|
@ -10,7 +10,8 @@ import {
|
||||
import { reverseValueToKeySetting, truncateString } from "#app/utils/common";
|
||||
import AbstractControlSettingsUiHandler from "#app/ui/settings/abstract-control-settings-ui-handler";
|
||||
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 { Device } from "#enums/devices";
|
||||
import { NavigationManager } from "#app/ui/settings/navigationMenu";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
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 {
|
||||
public species: PokemonSpecies;
|
||||
|
@ -35,7 +35,8 @@ import type { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"
|
||||
import MessageUiHandler from "#app/ui/message-ui-handler";
|
||||
import PokemonIconAnimHandler, { PokemonIconAnimMode } from "#app/ui/pokemon-icon-anim-handler";
|
||||
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 { addWindow } from "#app/ui/ui-theme";
|
||||
import { Egg } from "#app/data/egg";
|
||||
|
@ -1,5 +1,6 @@
|
||||
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 i18next from "i18next";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
|
@ -19,7 +19,8 @@ import { getStarterValueFriendshipCap, speciesStarterCosts } from "#app/data/bal
|
||||
import { argbFromRgba } from "@material/material-color-utilities";
|
||||
import { getTypeRgb } from "#app/data/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 { MoveCategory } from "#enums/MoveCategory";
|
||||
import { getPokeballAtlasKey } from "#app/data/pokeball";
|
||||
|
@ -6,52 +6,8 @@ import InputText from "phaser3-rex-plugins/plugins/inputtext";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import { ModifierTier } from "../enums/modifier-tier";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
|
||||
export enum TextStyle {
|
||||
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;
|
||||
}
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
import type { TextStyleOptions } from "#app/@types/ui";
|
||||
|
||||
export function addTextObject(
|
||||
x: number,
|
||||
@ -66,9 +22,10 @@ export function addTextObject(
|
||||
extraStyleOptions,
|
||||
);
|
||||
|
||||
const ret = globalScene.add.text(x, y, content, styleOptions);
|
||||
ret.setScale(scale);
|
||||
ret.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
const ret = globalScene.add
|
||||
.text(x, y, content, styleOptions)
|
||||
.setScale(scale)
|
||||
.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) {
|
||||
ret.setLineSpacing(scale * 30);
|
||||
}
|
||||
@ -90,8 +47,7 @@ export function setTextStyle(
|
||||
globalScene.uiTheme,
|
||||
extraStyleOptions,
|
||||
);
|
||||
obj.setScale(scale);
|
||||
obj.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
obj.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) {
|
||||
obj.setLineSpacing(scale * 30);
|
||||
}
|
||||
@ -116,8 +72,7 @@ export function addBBCodeTextObject(
|
||||
|
||||
const ret = new BBCodeText(globalScene, x, y, content, styleOptions as BBCodeText.TextStyle);
|
||||
globalScene.add.existing(ret);
|
||||
ret.setScale(scale);
|
||||
ret.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
ret.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
if (!(styleOptions as BBCodeText.TextStyle).lineSpacing) {
|
||||
ret.setLineSpacing(scale * 60);
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import OptionSelectUiHandler from "./settings/option-select-ui-handler";
|
||||
import { UiMode } from "#enums/ui-mode";
|
||||
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 i18next from "i18next";
|
||||
import { TimedEventDisplay } from "#app/timed-event-manager";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { globalScene } from "#app/global-scene";
|
||||
import type { TextStyle } from "./text";
|
||||
import type { TextStyle } from "#enums/text-style";
|
||||
import { getTextColor } from "./text";
|
||||
import type { UiMode } from "#enums/ui-mode";
|
||||
import type { Button } from "#enums/buttons";
|
||||
|
@ -15,7 +15,8 @@ import TargetSelectUiHandler from "./target-select-ui-handler";
|
||||
import SettingsUiHandler from "./settings/settings-ui-handler";
|
||||
import SettingsGamepadUiHandler from "./settings/settings-gamepad-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 MenuUiHandler from "./menu-ui-handler";
|
||||
import AchvsUiHandler from "./achvs-ui-handler";
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { ModalConfig } 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 { updateUserInfo } from "#app/account";
|
||||
import { sessionIdKey } from "#app/utils/common";
|
||||
|
@ -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 { SpeciesId } from "#enums/species-id";
|
||||
import { AbilityId } from "#app/enums/ability-id";
|
||||
import { WeatherType } from "#enums/weather-type";
|
||||
import GameManager from "#test/testUtils/gameManager";
|
||||
import i18next from "i18next";
|
||||
import Phaser from "phaser";
|
||||
//import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
describe("Moves - Chilly Reception", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
@ -25,95 +28,121 @@ describe("Moves - Chilly Reception", () => {
|
||||
game = new GameManager(phaserGame);
|
||||
game.override
|
||||
.battleStyle("single")
|
||||
.moveset([MoveId.CHILLY_RECEPTION, MoveId.SNOWSCAPE])
|
||||
.moveset([MoveId.CHILLY_RECEPTION, MoveId.SNOWSCAPE, MoveId.SPLASH, MoveId.METRONOME])
|
||||
.enemyMoveset(MoveId.SPLASH)
|
||||
.enemyAbility(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]);
|
||||
|
||||
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.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]);
|
||||
// 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);
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(game.scene.arena.weather?.weatherType).toBe(WeatherType.SNOW);
|
||||
|
||||
await game.phaseInterceptor.to("TurnInitPhase", false);
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
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.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]);
|
||||
|
||||
game.move.select(MoveId.CHILLY_RECEPTION);
|
||||
game.doSelectPartyPokemon(1);
|
||||
const [slowking, meowth] = game.scene.getPlayerParty();
|
||||
|
||||
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.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
|
||||
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);
|
||||
|
||||
// Bugcheck test for enemy AI bug
|
||||
it("check case - enemy not selecting chilly reception doesn't change weather", async () => {
|
||||
game.override.enemyMoveset([MoveId.CHILLY_RECEPTION, MoveId.TACKLE]);
|
||||
await game.classicMode.startBattle([SpeciesId.SLOWKING, SpeciesId.MEOWTH]);
|
||||
|
||||
game.move.select(MoveId.SPLASH);
|
||||
await game.move.selectEnemyMove(MoveId.TACKLE);
|
||||
await game.toEndOfTurn();
|
||||
|
||||
await game.phaseInterceptor.to("BerryPhase", false);
|
||||
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);
|
||||
expect(game.scene.arena.weather?.weatherType).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user