mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
Apply Biome unsafe fixes
This commit is contained in:
parent
69ed6258b2
commit
b62391ee82
@ -138,7 +138,6 @@
|
||||
"useObjectSpread": "info",
|
||||
"useNumericSeparators": "off", // TODO: enable?
|
||||
"useIterableCallbackReturn": "warn",
|
||||
"useSingleJsDocAsterisk": "warn",
|
||||
"noShadow": "warn"
|
||||
}
|
||||
}
|
||||
|
@ -595,13 +595,13 @@ function parseEggMoves(content: string): void {
|
||||
const cols = line.split(",").slice(0, 5);
|
||||
const moveNames = allMoves.map(m => m.name.replace(/ \([A-Z]\)$/, "").toLowerCase());
|
||||
const enumSpeciesName = cols[0].toUpperCase().replace(/[ -]/g, "_");
|
||||
const species = speciesValues[speciesNames.findIndex(s => s === enumSpeciesName)];
|
||||
const species = speciesValues[speciesNames.indexOf(enumSpeciesName)];
|
||||
|
||||
const eggMoves: MoveId[] = [];
|
||||
|
||||
for (let m = 0; m < 4; m++) {
|
||||
const moveName = cols[m + 1].trim();
|
||||
const moveIndex = moveName !== "N/A" ? moveNames.findIndex(mn => mn === moveName.toLowerCase()) : -1;
|
||||
const moveIndex = moveName !== "N/A" ? moveNames.indexOf(moveName.toLowerCase()) : -1;
|
||||
eggMoves.push(moveIndex > -1 ? moveIndex as MoveId : MoveId.NONE);
|
||||
|
||||
if (moveIndex === -1) {
|
||||
|
@ -524,7 +524,7 @@ export class Egg {
|
||||
/**
|
||||
* Rolls whether the egg is shiny or not.
|
||||
* @returns `true` if the egg is shiny
|
||||
**/
|
||||
*/
|
||||
private rollShiny(): boolean {
|
||||
let shinyChance = GACHA_DEFAULT_SHINY_RATE;
|
||||
switch (this._sourceType) {
|
||||
|
@ -16,7 +16,7 @@ import type Move from "./move";
|
||||
* @see {@linkcode getMovePp} - returns amount of PP a move currently has.
|
||||
* @see {@linkcode getPpRatio} - returns the current PP amount / max PP amount.
|
||||
* @see {@linkcode getName} - returns name of {@linkcode Move}.
|
||||
**/
|
||||
*/
|
||||
export class PokemonMove {
|
||||
public moveId: MoveId;
|
||||
public ppUsed: number;
|
||||
|
@ -569,7 +569,7 @@ export abstract class PokemonSpeciesForm {
|
||||
const rootSpeciesId = this.getRootSpeciesId();
|
||||
for (const moveId of moveset) {
|
||||
if (speciesEggMoves.hasOwnProperty(rootSpeciesId)) {
|
||||
const eggMoveIndex = speciesEggMoves[rootSpeciesId].findIndex(m => m === moveId);
|
||||
const eggMoveIndex = speciesEggMoves[rootSpeciesId].indexOf(moveId);
|
||||
if (eggMoveIndex > -1 && eggMoves & (1 << eggMoveIndex)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ export class TrainerConfig {
|
||||
* @param {string} [nameFemale] The name of the female trainer. If 'Ivy', a localized name will be assigned.
|
||||
* @param {TrainerType | string} [femaleEncounterBgm] The encounter BGM for the female trainer, which can be a TrainerType or a string.
|
||||
* @returns {TrainerConfig} The updated TrainerConfig instance.
|
||||
**/
|
||||
*/
|
||||
setHasGenders(nameFemale?: string, femaleEncounterBgm?: TrainerType | string): TrainerConfig {
|
||||
// If the female name is 'Ivy' (the rival), assign a localized name.
|
||||
if (nameFemale === "Ivy") {
|
||||
@ -540,7 +540,7 @@ export class TrainerConfig {
|
||||
* @param {SpeciesId | SpeciesId[]} signatureSpecies The signature species for the evil team leader.
|
||||
* @param specialtyType The specialty Type of the admin, if they have one
|
||||
* @returns {TrainerConfig} The updated TrainerConfig instance.
|
||||
* **/
|
||||
*/
|
||||
initForEvilTeamAdmin(
|
||||
title: string,
|
||||
poolName: EvilTeam,
|
||||
@ -581,7 +581,7 @@ export class TrainerConfig {
|
||||
* Initializes the trainer configuration for a Stat Trainer, as part of the Trainer's Test Mystery Encounter.
|
||||
* @param _isMale Whether the stat trainer is Male or Female (for localization of the title).
|
||||
* @returns {TrainerConfig} The updated TrainerConfig instance.
|
||||
**/
|
||||
*/
|
||||
initForStatTrainer(_isMale = false): TrainerConfig {
|
||||
if (!getIsInitialized()) {
|
||||
initI18n();
|
||||
@ -608,7 +608,7 @@ export class TrainerConfig {
|
||||
* @param {PokemonType} specialtyType The specialty type for the evil team Leader.
|
||||
* @param boolean Whether or not this is the rematch fight
|
||||
* @returns {TrainerConfig} The updated TrainerConfig instance.
|
||||
* **/
|
||||
*/
|
||||
initForEvilTeamLeader(
|
||||
title: string,
|
||||
signatureSpecies: (SpeciesId | SpeciesId[])[],
|
||||
@ -651,7 +651,7 @@ export class TrainerConfig {
|
||||
* @param ignoreMinTeraWave Whether the Gym Leader always uses Tera (true), or only Teras after {@linkcode GYM_LEADER_TERA_WAVE} (false). Defaults to false.
|
||||
* @param teraSlot Optional, sets the party member in this slot to Terastallize. Wraps based on party size.
|
||||
* @returns {TrainerConfig} The updated TrainerConfig instance.
|
||||
* **/
|
||||
*/
|
||||
initForGymLeader(
|
||||
signatureSpecies: (SpeciesId | SpeciesId[])[],
|
||||
isMale: boolean,
|
||||
@ -709,7 +709,7 @@ export class TrainerConfig {
|
||||
* @param specialtyType - The specialty type for the Elite Four member.
|
||||
* @param teraSlot - Optional, sets the party member in this slot to Terastallize.
|
||||
* @returns The updated TrainerConfig instance.
|
||||
**/
|
||||
*/
|
||||
initForEliteFour(
|
||||
signatureSpecies: (SpeciesId | SpeciesId[])[],
|
||||
isMale: boolean,
|
||||
@ -765,7 +765,7 @@ export class TrainerConfig {
|
||||
* @param {SpeciesId | SpeciesId[]} signatureSpecies The signature species for the Champion.
|
||||
* @param isMale Whether the Champion is Male or Female (for localization of the title).
|
||||
* @returns {TrainerConfig} The updated TrainerConfig instance.
|
||||
**/
|
||||
*/
|
||||
initForChampion(isMale: boolean): TrainerConfig {
|
||||
// Check if the internationalization (i18n) system is initialized.
|
||||
if (!getIsInitialized()) {
|
||||
@ -815,7 +815,7 @@ export class TrainerConfig {
|
||||
* @param {TrainerSlot} trainerSlot - The slot to determine which title to use. Defaults to TrainerSlot.NONE.
|
||||
* @param {TrainerVariant} variant - The variant of the trainer to determine the specific title.
|
||||
* @returns {string} - The title of the trainer.
|
||||
**/
|
||||
*/
|
||||
getTitle(trainerSlot: TrainerSlot = TrainerSlot.NONE, variant: TrainerVariant): string {
|
||||
const ret = this.name;
|
||||
|
||||
|
@ -5314,10 +5314,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
|
||||
for (let sc = 0; sc < spriteColors.length; sc++) {
|
||||
const delta = Math.min(...paletteDeltas[sc]);
|
||||
const paletteIndex = Math.min(
|
||||
paletteDeltas[sc].findIndex(pd => pd === delta),
|
||||
fusionPalette.length - 1,
|
||||
);
|
||||
const paletteIndex = Math.min(paletteDeltas[sc].indexOf(delta), fusionPalette.length - 1);
|
||||
if (delta < 255) {
|
||||
const ratio = easeFunc(delta / 255);
|
||||
const color = [0, 0, 0, fusionSpriteColors[sc][3]];
|
||||
|
@ -158,7 +158,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||
* @param {TrainerSlot} trainerSlot - The slot to determine which name to use. Defaults to TrainerSlot.NONE.
|
||||
* @param {boolean} includeTitle - Whether to include the title in the returned name. Defaults to false.
|
||||
* @returns {string} - The formatted name of the trainer.
|
||||
**/
|
||||
*/
|
||||
getName(trainerSlot: TrainerSlot = TrainerSlot.NONE, includeTitle = false): string {
|
||||
// Get the base title based on the trainer slot and variant.
|
||||
let name = this.config.getTitle(trainerSlot, this.variant);
|
||||
|
@ -100,7 +100,7 @@ import { UnlockPhase } from "#app/phases/unlock-phase";
|
||||
import { VictoryPhase } from "#app/phases/victory-phase";
|
||||
import { WeatherEffectPhase } from "#app/phases/weather-effect-phase";
|
||||
|
||||
/**
|
||||
/*
|
||||
* Manager for phases used by battle scene.
|
||||
*
|
||||
* *This file must not be imported or used directly. The manager is exclusively used by the battle scene and is not intended for external use.*
|
||||
|
@ -696,12 +696,9 @@ export class MoveEffectPhase extends PokemonPhase {
|
||||
* @param target - The {@linkcode Pokemon} to be removed
|
||||
*/
|
||||
protected removeTarget(target: Pokemon): void {
|
||||
const targetIndex = this.targets.findIndex(ind => ind === target.getBattlerIndex());
|
||||
const targetIndex = this.targets.indexOf(target.getBattlerIndex());
|
||||
if (targetIndex !== -1) {
|
||||
this.targets.splice(
|
||||
this.targets.findIndex(ind => ind === target.getBattlerIndex()),
|
||||
1,
|
||||
);
|
||||
this.targets.splice(this.targets.indexOf(target.getBattlerIndex()), 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2057,7 +2057,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
}
|
||||
let newSpecies: PokemonSpecies;
|
||||
if (this.filteredIndices) {
|
||||
const index = this.filteredIndices.findIndex(id => id === this.species.speciesId);
|
||||
const index = this.filteredIndices.indexOf(this.species.speciesId);
|
||||
const newIndex = index <= 0 ? this.filteredIndices.length - 1 : index - 1;
|
||||
newSpecies = getPokemonSpecies(this.filteredIndices[newIndex]);
|
||||
} else {
|
||||
@ -2096,7 +2096,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
|
||||
}
|
||||
let newSpecies: PokemonSpecies;
|
||||
if (this.filteredIndices) {
|
||||
const index = this.filteredIndices.findIndex(id => id === this.species.speciesId);
|
||||
const index = this.filteredIndices.indexOf(this.species.speciesId);
|
||||
const newIndex = index >= this.filteredIndices.length - 1 ? 0 : index + 1;
|
||||
newSpecies = getPokemonSpecies(this.filteredIndices[newIndex]);
|
||||
} else {
|
||||
|
@ -1389,7 +1389,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||
const fitsMoves = fitsMove1 && fitsMove2;
|
||||
|
||||
if (fitsEggMove1 && !fitsLevelMove1) {
|
||||
const em1 = eggMoves.findIndex(name => name === selectedMove1);
|
||||
const em1 = eggMoves.indexOf(selectedMove1);
|
||||
if ((starterData.eggMoves & (1 << em1)) === 0) {
|
||||
data.eggMove1 = false;
|
||||
} else {
|
||||
@ -1399,7 +1399,7 @@ export default class PokedexUiHandler extends MessageUiHandler {
|
||||
data.tmMove1 = true;
|
||||
}
|
||||
if (fitsEggMove2 && !fitsLevelMove2) {
|
||||
const em2 = eggMoves.findIndex(name => name === selectedMove2);
|
||||
const em2 = eggMoves.indexOf(selectedMove2);
|
||||
if ((starterData.eggMoves & (1 << em2)) === 0) {
|
||||
data.eggMove2 = false;
|
||||
} else {
|
||||
|
@ -117,7 +117,7 @@ export default class SummaryUiHandler extends UiHandler {
|
||||
|
||||
private pokemon: PlayerPokemon | null;
|
||||
private playerParty: boolean;
|
||||
/**This is set to false when checking the summary of a freshly caught Pokemon as it is not part of a player's party yet but still needs to display its items**/
|
||||
/**This is set to false when checking the summary of a freshly caught Pokemon as it is not part of a player's party yet but still needs to display its items*/
|
||||
private newMove: Move | null;
|
||||
private moveSelectFunction: Function | null;
|
||||
private transitioning: boolean;
|
||||
|
@ -40,7 +40,7 @@ describe("Abilities - Mycelium Might", () => {
|
||||
* https://bulbapedia.bulbagarden.net/wiki/Mycelium_Might_(Ability)
|
||||
* https://bulbapedia.bulbagarden.net/wiki/Priority
|
||||
* https://www.smogon.com/forums/threads/scarlet-violet-battle-mechanics-research.3709545/page-24
|
||||
**/
|
||||
*/
|
||||
|
||||
it("will move last in its priority bracket and ignore protective abilities", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.REGIELEKI]);
|
||||
|
@ -35,7 +35,7 @@ describe("Abilities - Stall", () => {
|
||||
* References:
|
||||
* https://bulbapedia.bulbagarden.net/wiki/Stall_(Ability)
|
||||
* https://bulbapedia.bulbagarden.net/wiki/Priority
|
||||
**/
|
||||
*/
|
||||
|
||||
it("Pokemon with Stall should move last in its priority bracket regardless of speed", async () => {
|
||||
await game.classicMode.startBattle([SpeciesId.SHUCKLE]);
|
||||
|
Loading…
Reference in New Issue
Block a user