Apply Biome and fix some suppression comments

This commit is contained in:
NightKev 2025-06-17 13:06:50 -07:00
parent 694f629879
commit 280be34e7f
28 changed files with 60 additions and 68 deletions

View File

@ -3237,7 +3237,7 @@ export default class BattleScene extends SceneBase {
(!this.gameData.achvUnlocks.hasOwnProperty(achv.id) || Overrides.ACHIEVEMENTS_REUNLOCK_OVERRIDE) &&
achv.validate(args)
) {
this.gameData.achvUnlocks[achv.id] = new Date().getTime();
this.gameData.achvUnlocks[achv.id] = Date.now();
this.ui.achvBar.showAchv(achv);
if (vouchers.hasOwnProperty(achv.id)) {
this.validateVoucher(vouchers[achv.id]);
@ -3250,7 +3250,7 @@ export default class BattleScene extends SceneBase {
validateVoucher(voucher: Voucher, args?: unknown[]): boolean {
if (!this.gameData.voucherUnlocks.hasOwnProperty(voucher.id) && voucher.validate(args)) {
this.gameData.voucherUnlocks[voucher.id] = new Date().getTime();
this.gameData.voucherUnlocks[voucher.id] = Date.now();
this.ui.achvBar.showAchv(voucher);
this.gameData.voucherCounts[voucher.voucherType]++;
return true;

View File

@ -346,7 +346,7 @@ abstract class AnimTimedBgEvent extends AnimTimedEvent {
}
class AnimTimedUpdateBgEvent extends AnimTimedBgEvent {
// biome-ignore lint/correctness/noUnusedVariables: seems intentional
// biome-ignore lint/correctness/noUnusedFunctionParameters: seems intentional
execute(moveAnim: MoveAnim, priority?: number): number {
const tweenProps = {};
if (this.bgX !== undefined) {
@ -423,7 +423,7 @@ export function initCommonAnims(): Promise<void> {
const commonAnimId = commonAnimIds[ca];
commonAnimFetches.push(
globalScene
.cachedFetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/\_/g, "-")}.json`)
.cachedFetch(`./battle-anims/common-${commonAnimNames[ca].toLowerCase().replace(/_/g, "-")}.json`)
.then(response => response.json())
.then(cas => commonAnims.set(commonAnimId, new AnimConfig(cas))),
);
@ -535,7 +535,7 @@ export async function initEncounterAnims(encounterAnim: EncounterAnim | Encounte
}
encounterAnimFetches.push(
globalScene
.cachedFetch(`./battle-anims/encounter-${encounterAnimNames[anim].toLowerCase().replace(/\_/g, "-")}.json`)
.cachedFetch(`./battle-anims/encounter-${encounterAnimNames[anim].toLowerCase().replace(/_/g, "-")}.json`)
.then(response => response.json())
.then(cas => encounterAnims.set(anim, new AnimConfig(cas))),
);
@ -559,7 +559,7 @@ export function initMoveChargeAnim(chargeAnim: ChargeAnim): Promise<void> {
} else {
chargeAnims.set(chargeAnim, null);
globalScene
.cachedFetch(`./battle-anims/${ChargeAnim[chargeAnim].toLowerCase().replace(/\_/g, "-")}.json`)
.cachedFetch(`./battle-anims/${ChargeAnim[chargeAnim].toLowerCase().replace(/_/g, "-")}.json`)
.then(response => response.json())
.then(ca => {
if (Array.isArray(ca)) {
@ -1405,15 +1405,15 @@ export class EncounterBattleAnim extends BattleAnim {
export async function populateAnims() {
const commonAnimNames = getEnumKeys(CommonAnim).map(k => k.toLowerCase());
const commonAnimMatchNames = commonAnimNames.map(k => k.replace(/\_/g, ""));
const commonAnimMatchNames = commonAnimNames.map(k => k.replace(/_/g, ""));
const commonAnimIds = getEnumValues(CommonAnim) as CommonAnim[];
const chargeAnimNames = getEnumKeys(ChargeAnim).map(k => k.toLowerCase());
const chargeAnimMatchNames = chargeAnimNames.map(k => k.replace(/\_/g, " "));
const chargeAnimMatchNames = chargeAnimNames.map(k => k.replace(/_/g, " "));
const chargeAnimIds = getEnumValues(ChargeAnim) as ChargeAnim[];
const commonNamePattern = /name: (?:Common:)?(Opp )?(.*)/;
const moveNameToId = {};
for (const move of getEnumValues(MoveId).slice(1)) {
const moveName = MoveId[move].toUpperCase().replace(/\_/g, "");
const moveName = MoveId[move].toUpperCase().replace(/_/g, "");
moveNameToId[moveName] = move;
}
@ -1469,7 +1469,7 @@ export async function populateAnims() {
const frameData = framesData[fd];
const focusFramesData = frameData.split(" - - ");
for (let tf = 0; tf < focusFramesData.length; tf++) {
const values = focusFramesData[tf].replace(/ {6}\- /g, "").split("\n");
const values = focusFramesData[tf].replace(/ {6}- /g, "").split("\n");
const targetFrame = new AnimFrame(
Number.parseFloat(values[0]),
Number.parseFloat(values[1]),
@ -1516,7 +1516,7 @@ export async function populateAnims() {
.replace(/[a-z]+: ! '', /gi, "")
.replace(/name: (.*?),/, 'name: "$1",')
.replace(
/flashColor: !ruby\/object:Color { alpha: ([\d\.]+), blue: ([\d\.]+), green: ([\d\.]+), red: ([\d\.]+)}/,
/flashColor: !ruby\/object:Color { alpha: ([\d.]+), blue: ([\d.]+), green: ([\d.]+), red: ([\d.]+)}/,
"flashRed: $4, flashGreen: $3, flashBlue: $2, flashAlpha: $1",
);
const frameIndex = Number.parseInt(/frame: (\d+)/.exec(timingData)![1]); // TODO: is the bang correct?

View File

@ -175,7 +175,7 @@ export class Egg {
this._sourceType = eggOptions?.sourceType ?? undefined;
this._hatchWaves = eggOptions?.hatchWaves ?? this.getEggTierDefaultHatchWaves();
this._timestamp = eggOptions?.timestamp ?? new Date().getTime();
this._timestamp = eggOptions?.timestamp ?? Date.now();
// First roll shiny and variant so we can filter if species with an variant exist
this._isShiny = eggOptions?.isShiny ?? (Overrides.EGG_SHINY_OVERRIDE || this.rollShiny());
@ -255,7 +255,7 @@ export class Egg {
// Sets the hidden ability if a hidden ability exists and
// the override is set or the egg hits the chance
let abilityIndex: number | undefined = undefined;
let abilityIndex: number | undefined;
const sameSpeciesEggHACheck =
this._sourceType === EggSourceType.SAME_SPECIES_EGG && !randSeedInt(SAME_SPECIES_EGG_HA_RATE);
const gachaEggHACheck = !(this._sourceType === EggSourceType.SAME_SPECIES_EGG) && !randSeedInt(GACHA_EGG_HA_RATE);

View File

@ -96,8 +96,8 @@ export function getPokemonSpeciesForm(species: SpeciesId, formIndex: number): Po
}
export function getFusedSpeciesName(speciesAName: string, speciesBName: string): string {
const fragAPattern = /([a-z]{2}.*?[aeiou(?:y$)\-\']+)(.*?)$/i;
const fragBPattern = /([a-z]{2}.*?[aeiou(?:y$)\-\'])(.*?)$/i;
const fragAPattern = /([a-z]{2}.*?[aeiou(?:y$)\-']+)(.*?)$/i;
const fragBPattern = /([a-z]{2}.*?[aeiou(?:y$)\-'])(.*?)$/i;
const [speciesAPrefixMatch, speciesBPrefixMatch] = [speciesAName, speciesBName].map(n => /^(?:[^ ]+) /.exec(n));
const [speciesAPrefix, speciesBPrefix] = [speciesAPrefixMatch, speciesBPrefixMatch].map(m => (m ? m[0] : ""));
@ -134,7 +134,7 @@ export function getFusedSpeciesName(speciesAName: string, speciesBName: string):
if (fragBMatch) {
const lastCharA = fragA.slice(fragA.length - 1);
const prevCharB = fragBMatch[1].slice(fragBMatch.length - 1);
fragB = (/[\-']/.test(prevCharB) ? prevCharB : "") + fragBMatch[2] || prevCharB;
fragB = (/[-']/.test(prevCharB) ? prevCharB : "") + fragBMatch[2] || prevCharB;
if (lastCharA === fragB[0]) {
if (/[aiu]/.test(lastCharA)) {
fragB = fragB.slice(1);
@ -379,7 +379,7 @@ export abstract class PokemonSpeciesForm {
}
getSpriteAtlasPath(female: boolean, formIndex?: number, shiny?: boolean, variant?: number, back?: boolean): string {
const spriteId = this.getSpriteId(female, formIndex, shiny, variant, back).replace(/\_{2}/g, "/");
const spriteId = this.getSpriteId(female, formIndex, shiny, variant, back).replace(/_{2}/g, "/");
return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`;
}
@ -478,8 +478,8 @@ export abstract class PokemonSpeciesForm {
case SpeciesId.DUDUNSPARCE:
break;
case SpeciesId.ZACIAN:
// biome-ignore lint/suspicious/noFallthroughSwitchClause: Intentionally falls through
case SpeciesId.ZAMAZENTA:
// biome-ignore lint/suspicious/noFallthroughSwitchClause: Falls through
if (formSpriteKey.startsWith("behemoth")) {
formSpriteKey = "crowned";
}

View File

@ -335,7 +335,7 @@ export class TrainerConfig {
if (doubleEncounterBgm) {
this.doubleEncounterBgm =
typeof doubleEncounterBgm === "number"
? TrainerType[doubleEncounterBgm].toString().replace(/\_/g, " ").toLowerCase()
? TrainerType[doubleEncounterBgm].toString().replace(/_/g, " ").toLowerCase()
: doubleEncounterBgm;
}
return this;

View File

@ -898,12 +898,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
getSpriteAtlasPath(ignoreOverride?: boolean): string {
const spriteId = this.getSpriteId(ignoreOverride).replace(/\_{2}/g, "/");
const spriteId = this.getSpriteId(ignoreOverride).replace(/_{2}/g, "/");
return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`;
}
getBattleSpriteAtlasPath(back?: boolean, ignoreOverride?: boolean): string {
const spriteId = this.getBattleSpriteId(back, ignoreOverride).replace(/\_{2}/g, "/");
const spriteId = this.getBattleSpriteId(back, ignoreOverride).replace(/_{2}/g, "/");
return `${/_[1-3]$/.test(spriteId) ? "variant/" : ""}${spriteId}`;
}
@ -977,7 +977,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
getFusionBattleSpriteAtlasPath(back?: boolean, ignoreOverride?: boolean): string {
return this.getFusionBattleSpriteId(back, ignoreOverride).replace(/\_{2}/g, "/");
return this.getFusionBattleSpriteId(back, ignoreOverride).replace(/_{2}/g, "/");
}
getIconAtlasKey(ignoreOverride = false, useIllusion = true): string {
@ -2880,7 +2880,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
);
};
let fusionOverride: PokemonSpecies | undefined = undefined;
let fusionOverride: PokemonSpecies | undefined;
if (forStarter && this.isPlayer() && Overrides.STARTER_FUSION_SPECIES_OVERRIDE) {
fusionOverride = getPokemonSpecies(Overrides.STARTER_FUSION_SPECIES_OVERRIDE);

View File

@ -70,20 +70,20 @@ const repeatInputDelayMillis = 250;
* providing a unified interface for all input-related interactions.
*/
export class InputsController {
private gamepads: Array<Phaser.Input.Gamepad.Gamepad> = new Array();
private gamepads: Array<Phaser.Input.Gamepad.Gamepad> = [];
public events: Phaser.Events.EventEmitter;
private buttonLock: Button[] = new Array();
private buttonLock: Button[] = [];
private interactions: Map<Button, Map<string, boolean>> = new Map();
private configs: Map<string, InterfaceConfig> = new Map();
public gamepadSupport = true;
public selectedDevice;
private disconnectedGamepads: Array<string> = new Array();
private disconnectedGamepads: Array<string> = [];
public lastSource = "keyboard";
private inputInterval: NodeJS.Timeout[] = new Array();
private inputInterval: NodeJS.Timeout[] = [];
private touchControls: TouchControl;
public moveTouchControlsHandler: MoveTouchControlsHandler;

View File

@ -299,7 +299,7 @@ export class GameOverPhase extends BattlePhase {
battleType: globalScene.currentBattle.battleType,
trainer: globalScene.currentBattle.trainer ? new TrainerData(globalScene.currentBattle.trainer) : null,
gameVersion: globalScene.game.config.gameVersion,
timestamp: new Date().getTime(),
timestamp: Date.now(),
challenges: globalScene.gameMode.challenges.map(c => new ChallengeData(c)),
mysteryEncounterType: globalScene.currentBattle.mysteryEncounter?.encounterType ?? -1,
mysteryEncounterSaveData: globalScene.mysteryEncounterSaveData,

View File

@ -33,7 +33,7 @@ export abstract class ApiBase {
* @param dataType The data-type of the {@linkcode bodyData}.
*/
protected async doPost<D = undefined>(path: string, bodyData?: D, dataType: DataType = "json") {
let body: string | undefined = undefined;
let body: string | undefined;
const headers: HeadersInit = {};
if (bodyData) {

View File

@ -9,7 +9,7 @@ import type BattleScene from "#app/battle-scene";
// Regex patterns
/** Regex matching double underscores */
const DUNDER_REGEX = /\_{2}/g;
const DUNDER_REGEX = /_{2}/g;
/**
* Calculate the sprite ID from a pokemon form.

View File

@ -1,6 +1,6 @@
import { expSpriteKeys } from "#app/sprites/sprite-keys";
const expKeyRegex = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(\-.*?)?(?:_[1-3])?$/;
const expKeyRegex = /^pkmn__?(back__)?(shiny__)?(female__)?(\d+)(-.*?)?(?:_[1-3])?$/;
export function hasExpSprite(key: string): boolean {
const keyMatch = expKeyRegex.exec(key);

View File

@ -39,7 +39,7 @@ import { setSettingGamepad, SettingGamepad, settingGamepadDefaults } from "#app/
import type { SettingKeyboard } from "#app/system/settings/settings-keyboard";
import { setSettingKeyboard } from "#app/system/settings/settings-keyboard";
import { TagAddedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";
// biome-ignore lint/style/noNamespaceImport: Something weird is going on here and I don't want to touch it
// biome-ignore lint/performance/noNamespaceImport: Something weird is going on here and I don't want to touch it
import * as Modifier from "#app/modifier/modifier";
import { StatusEffect } from "#enums/status-effect";
import ChallengeData from "#app/system/challenge-data";
@ -300,7 +300,7 @@ export class GameData {
voucherCounts: this.voucherCounts,
eggs: this.eggs.map(e => new EggData(e)),
gameVersion: globalScene.game.config.gameVersion,
timestamp: new Date().getTime(),
timestamp: Date.now(),
eggPity: this.eggPity.slice(0),
unlockPity: this.unlockPity.slice(0),
};
@ -930,7 +930,7 @@ export class GameData {
? new TrainerData(globalScene.currentBattle.trainer)
: null,
gameVersion: globalScene.game.config.gameVersion,
timestamp: new Date().getTime(),
timestamp: Date.now(),
challenges: globalScene.gameMode.challenges.map(c => new ChallengeData(c)),
mysteryEncounterType: globalScene.currentBattle.mysteryEncounter?.encounterType ?? -1,
mysteryEncounterSaveData: globalScene.mysteryEncounterSaveData,

View File

@ -48,23 +48,23 @@ export const settingsMigrators: Readonly<SettingsSaveMigrator[]> = [settingsMigr
// import * as vA_B_C from "./versions/vA_B_C";
// --- v1.0.4 (and below) PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience (TODO: make this a file-wide ignore when Biome supports those)
// biome-ignore lint/performance/noNamespaceImport: Convenience (TODO: make this a file-wide ignore when Biome supports those)
import * as v1_0_4 from "./versions/v1_0_4";
// --- v1.7.0 PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience
// biome-ignore lint/performance/noNamespaceImport: Convenience
import * as v1_7_0 from "./versions/v1_7_0";
// --- v1.8.3 PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience
// biome-ignore lint/performance/noNamespaceImport: Convenience
import * as v1_8_3 from "./versions/v1_8_3";
// --- v1.9.0 PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience
// biome-ignore lint/performance/noNamespaceImport: Convenience
import * as v1_9_0 from "./versions/v1_9_0";
// --- v1.10.0 PATCHES --- //
// biome-ignore lint/style/noNamespaceImport: Convenience
// biome-ignore lint/performance/noNamespaceImport: Convenience
import * as v1_10_0 from "./versions/v1_10_0";
/** Current game version */

View File

@ -6,8 +6,8 @@ const repeatInputDelayMillis = 250;
export default class TouchControl {
events: EventEmitter;
private buttonLock: string[] = new Array();
private inputInterval: NodeJS.Timeout[] = new Array();
private buttonLock: string[] = [];
private inputInterval: NodeJS.Timeout[] = [];
/** Whether touch controls are disabled */
private disabled = false;
/** Whether the last touch event has finished before disabling */
@ -208,7 +208,7 @@ export function isMobile(): boolean {
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
a,
) ||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
a.substr(0, 4),
)
) {

View File

@ -176,12 +176,12 @@ export class UiInputs {
return;
}
switch (globalScene.ui?.getMode()) {
// biome-ignore lint/suspicious/noFallthroughSwitchClause: falls through to show menu overlay
case UiMode.MESSAGE: {
const messageHandler = globalScene.ui.getHandler<MessageUiHandler>();
if (!messageHandler.pendingPrompt || messageHandler.isTextAnimationInProgress()) {
return;
}
// biome-ignore lint/suspicious/noFallthroughSwitchClause: falls through to show menu overlay
}
case UiMode.TITLE:
case UiMode.COMMAND:

View File

@ -52,7 +52,7 @@ export default class BattleFlyout extends Phaser.GameObjects.Container {
/** The array of {@linkcode Phaser.GameObjects.Text} objects which are drawn on the flyout */
private flyoutText: Phaser.GameObjects.Text[] = new Array(4);
/** The array of {@linkcode MoveInfo} used to track moves for the {@linkcode Pokemon} linked to the flyout */
private moveInfo: MoveInfo[] = new Array();
private moveInfo: MoveInfo[] = [];
/** Current state of the flyout's visibility */
public flyoutVisible = false;

View File

@ -625,7 +625,7 @@ export default class EggGachaUiHandler extends MessageUiHandler {
const infoContainer = this.gachaInfoContainers[gachaType];
switch (gachaType as GachaType) {
case GachaType.LEGENDARY: {
const species = getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(new Date().getTime()));
const species = getPokemonSpecies(getLegendaryGachaSpeciesForTimestamp(Date.now()));
const pokemonIcon = infoContainer.getAt(1) as Phaser.GameObjects.Sprite;
pokemonIcon.setTexture(species.getIconAtlasKey(), species.getIconId(false));
break;

View File

@ -591,9 +591,9 @@ export default class MysteryEncounterUiHandler extends UiHandler {
// Auto-color options green/blue for good/bad by looking for (+)/(-)
if (text) {
const primaryStyleString = [...text.match(new RegExp(/\[color=[^\[]*\]\[shadow=[^\[]*\]/i))!][0];
const primaryStyleString = [...text.match(new RegExp(/\[color=[^[]*\]\[shadow=[^[]*\]/i))!][0];
text = text.replace(
/(\(\+\)[^\(\[]*)/gi,
/(\(\+\)[^([]*)/gi,
substring =>
"[/color][/shadow]" +
getBBCodeFrag(substring, TextStyle.SUMMARY_GREEN) +
@ -601,7 +601,7 @@ export default class MysteryEncounterUiHandler extends UiHandler {
primaryStyleString,
);
text = text.replace(
/(\(\-\)[^\(\[]*)/gi,
/(\(-\)[^([]*)/gi,
substring =>
"[/color][/shadow]" +
getBBCodeFrag(substring, TextStyle.SUMMARY_BLUE) +

View File

@ -19,7 +19,7 @@ import { PokemonType } from "#enums/pokemon-type";
import { TypeColor, TypeShadow } from "#app/enums/color";
import { getNatureStatMultiplier, getNatureName } from "../data/nature";
import { getVariantTint } from "#app/sprites/variant";
// biome-ignore lint/style/noNamespaceImport: See `src/system/game-data.ts`
// biome-ignore lint/performance/noNamespaceImport: See `src/system/game-data.ts`
import * as Modifier from "#app/modifier/modifier";
import type { SpeciesId } from "#enums/species-id";
import { PlayerGender } from "#enums/player-gender";

View File

@ -2,7 +2,7 @@ import i18next from "i18next";
import { globalScene } from "#app/global-scene";
import { Button } from "#enums/buttons";
import { GameMode } from "../game-mode";
// biome-ignore lint/style/noNamespaceImport: See `src/system/game-data.ts`
// biome-ignore lint/performance/noNamespaceImport: See `src/system/game-data.ts`
import * as Modifier from "#app/modifier/modifier";
import type { SessionSaveData } from "../system/game-data";
import type PokemonData from "../system/pokemon-data";

View File

@ -209,7 +209,7 @@ export default abstract class AbstractControlSettingsUiHandler extends UiHandler
settingFiltered.forEach((setting, s) => {
// Convert the setting key from format 'Key_Name' to 'Key name' for display.
const settingName = setting.replace(/\_/g, " ");
const settingName = setting.replace(/_/g, " ");
// Create and add a text object for the setting name to the scene.
const isLock = this.settingBlacklisted.includes(this.setting[setting]);

View File

@ -16,7 +16,7 @@ export class NavigationManager {
private static instance: NavigationManager;
public modes: UiMode[];
public selectedMode: UiMode = UiMode.SETTINGS;
public navigationMenus: NavigationMenu[] = new Array<NavigationMenu>();
public navigationMenus: NavigationMenu[] = [];
public labels: string[];
/**
@ -105,7 +105,7 @@ export class NavigationManager {
export default class NavigationMenu extends Phaser.GameObjects.Container {
private navigationIcons: InputsIcons;
protected headerTitles: Phaser.GameObjects.Text[] = new Array<Phaser.GameObjects.Text>();
protected headerTitles: Phaser.GameObjects.Text[] = [] as Phaser.GameObjects.Text[];
/**
* Creates an instance of NavigationMenu.

View File

@ -300,7 +300,7 @@ export function getTextWithColors(
): string {
// Apply primary styling before anything else
let text = getBBCodeFrag(content, primaryStyle, uiTheme) + "[/color][/shadow]";
const primaryStyleString = [...text.match(new RegExp(/\[color=[^\[]*\]\[shadow=[^\[]*\]/i))!][0];
const primaryStyleString = [...text.match(new RegExp(/\[color=[^[]*\]\[shadow=[^[]*\]/i))!][0];
/* For money text displayed in game windows, we can't use the default {@linkcode TextStyle.MONEY}
* or it will look wrong in legacy mode because of the different window background color
@ -320,7 +320,7 @@ export function getTextWithColors(
});
// Remove extra style block at the end
return text.replace(/\[color=[^\[]*\]\[shadow=[^\[]*\]\[\/color\]\[\/shadow\]/gi, "");
return text.replace(/\[color=[^[]*\]\[shadow=[^[]*\]\[\/color\]\[\/shadow\]/gi, "");
}
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: This is a giant switch which is the best option.

View File

@ -10,7 +10,7 @@ export const MissingTextureKey = "__MISSING";
export function toReadableString(str: string): string {
return str
.replace(/\_/g, " ")
.replace(/_/g, " ")
.split(" ")
.map(s => `${s.slice(0, 1)}${s.slice(1).toLowerCase()}`)
.join(" ");
@ -583,7 +583,7 @@ export function isBetween(num: number, min: number, max: number): boolean {
* @param move the move for which the animation filename is needed
*/
export function animationFileName(move: MoveId): string {
return MoveId[move].toLowerCase().replace(/\_/g, "-");
return MoveId[move].toLowerCase().replace(/_/g, "-");
}
/**

View File

@ -2,7 +2,7 @@ import { isBeta } from "./utility-vars";
export function setCookie(cName: string, cValue: string): void {
const expiration = new Date();
expiration.setTime(new Date().getTime() + 3600000 * 24 * 30 * 3 /*7*/);
expiration.setTime(Date.now() + 3600000 * 24 * 30 * 3 /*7*/);
document.cookie = `${cName}=${cValue};Secure;SameSite=Strict;Domain=${window.location.hostname};Path=/;Expires=${expiration.toUTCString()}`;
}

View File

@ -1,4 +1,4 @@
// biome-ignore lint/style/noNamespaceImport: Necessary for mocks
// biome-ignore lint/performance/noNamespaceImport: Necessary for mocks
import * as EncounterPhaseUtils from "#app/data/mystery-encounters/utils/encounter-phase-utils";
import { Status } from "#app/data/status-effect";
import { CommandPhase } from "#app/phases/command-phase";

View File

@ -15,15 +15,9 @@ import { vi } from "vitest";
import { version } from "../../package.json";
import { MockGameObjectCreator } from "./mocks/mockGameObjectCreator";
import { MockTimedEventManager } from "./mocks/mockTimedEventManager";
import InputManager = Phaser.Input.InputManager;
import KeyboardManager = Phaser.Input.Keyboard.KeyboardManager;
import KeyboardPlugin = Phaser.Input.Keyboard.KeyboardPlugin;
import GamepadPlugin = Phaser.Input.Gamepad.GamepadPlugin;
import EventEmitter = Phaser.Events.EventEmitter;
import UpdateList = Phaser.GameObjects.UpdateList;
import { PokedexMonContainer } from "#app/ui/pokedex-mon-container";
import MockContainer from "./mocks/mocksContainer/mockContainer";
// biome-ignore lint/style/noNamespaceImport: Necessary in order to mock the var
// biome-ignore lint/performance/noNamespaceImport: Necessary in order to mock the var
import * as bypassLoginModule from "#app/global-vars/bypass-login";
window.URL.createObjectURL = (blob: Blob) => {

View File

@ -1,8 +1,6 @@
import MockContainer from "#test/testUtils/mocks/mocksContainer/mockContainer";
export class MockImage extends MockContainer {
private texture;
constructor(textureManager, x, y, texture) {
super(textureManager, x, y);
this.texture = texture;