halfway to manual eslint fix

This commit is contained in:
Greenlamp 2024-05-22 01:33:00 +02:00
parent 28ada389e3
commit 8e2506045d
13 changed files with 32 additions and 37 deletions

View File

@ -13,7 +13,7 @@ import { LoadingScene } from './loading-scene';
// Catch global errors and display them in an alert so users can report the issue.
window.onerror = function (message, source, lineno, colno, error) {
console.error(error);
const errorString = `Received unhandled error. Open browser console and click OK to see details.\nError: ${message}\nSource: ${source}\nLine: ${lineno}\nColumn: ${colno}\nStack: ${error.stack}`;
// const errorString = `Received unhandled error. Open browser console and click OK to see details.\nError: ${message}\nSource: ${source}\nLine: ${lineno}\nColumn: ${colno}\nStack: ${error.stack}`;
//alert(errorString);
// Avoids logging the error a second time.
return true;
@ -21,7 +21,7 @@ window.onerror = function (message, source, lineno, colno, error) {
// Catch global promise rejections and display them in an alert so users can report the issue.
window.addEventListener('unhandledrejection', (event) => {
const errorString = `Received unhandled promise rejection. Open browser console and click OK to see details.\nReason: ${event.reason}`;
// const errorString = `Received unhandled promise rejection. Open browser console and click OK to see details.\nReason: ${event.reason}`;
console.error(event.reason);
//alert(errorString);
});

View File

@ -1431,13 +1431,13 @@ let modifierPoolThresholds = {};
let ignoredPoolIndexes = {};
let dailyStarterModifierPoolThresholds = {};
let ignoredDailyStarterPoolIndexes = {};
let ignoredDailyStarterPoolIndexes = {}; // eslint-disable-line @typescript-eslint/no-unused-vars
let enemyModifierPoolThresholds = {};
let enemyIgnoredPoolIndexes = {};
let enemyIgnoredPoolIndexes = {}; // eslint-disable-line @typescript-eslint/no-unused-vars
let enemyBuffModifierPoolThresholds = {};
let enemyBuffIgnoredPoolIndexes = {};
let enemyBuffIgnoredPoolIndexes = {}; // eslint-disable-line @typescript-eslint/no-unused-vars
export function getModifierPoolForType(poolType: ModifierPoolType): ModifierPool {
let pool: ModifierPool;

View File

@ -1,12 +1,12 @@
import BattleScene, { AnySound, bypassLogin, startingWave } from './battle-scene';
import BattleScene, { bypassLogin } from './battle-scene';
import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from './field/pokemon';
import * as Utils from './utils';
import { Moves } from './data/enums/moves';
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, BypassRedirectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr, SacrificialAttr, IncrementMovePriorityAttr } from './data/move';
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, BypassRedirectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr, IncrementMovePriorityAttr } from './data/move';
import { Mode } from './ui/ui';
import { Command } from './ui/command-ui-handler';
import { Stat } from './data/pokemon-stat';
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, FusePokemonModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems, BypassSpeedChanceModifier } from './modifier/modifier';
import { BerryModifier, ContactHeldItemTransferChanceModifier, EnemyAttackStatusEffectChanceModifier, EnemyPersistentModifier, EnemyStatusEffectHealChanceModifier, EnemyTurnHealModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, Modifier, MultipleParticipantExpBonusModifier, PersistentModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier, MoneyMultiplierModifier, MoneyInterestModifier, IvScannerModifier, LapsingPokemonHeldItemModifier, PokemonMultiHitModifier, PokemonMoveAccuracyBoosterModifier, overrideModifiers, overrideHeldItems, BypassSpeedChanceModifier } from './modifier/modifier';
import PartyUiHandler, { PartyOption, PartyUiMode } from './ui/party-ui-handler';
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from './data/pokeball';
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from './data/battle-anims';
@ -37,7 +37,7 @@ import { BattleType, BattlerIndex, TurnCommand } from './battle';
import { BattleSpec } from './enums/battle-spec';
import { Species } from './data/enums/species';
import { HealAchv, LevelAchv, achvs } from './system/achv';
import { TrainerConfig, TrainerSlot, trainerConfigs } from './data/trainer-config';
import { TrainerSlot, trainerConfigs } from './data/trainer-config';
import { TrainerType } from './data/enums/trainer-type';
import { EggHatchPhase } from './egg-hatch-phase';
import { Egg } from './data/egg';
@ -55,7 +55,7 @@ import { OptionSelectConfig, OptionSelectItem } from './ui/abstact-option-select
import { SaveSlotUiMode } from './ui/save-slot-select-ui-handler';
import { fetchDailyRunSeed, getDailyRunStarters } from './data/daily-run';
import { GameModes, gameModes } from './game-mode';
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm, speciesStarters } from './data/pokemon-species';
import PokemonSpecies, { getPokemonSpecies, speciesStarters } from './data/pokemon-species';
import i18next from './plugins/i18n';
import { Abilities } from './data/enums/abilities';
import * as Overrides from './overrides';
@ -2274,7 +2274,7 @@ export class MovePhase extends BattlePhase {
//Check if this move is immune to being redirected, and restore its target to the intended target if it is.
if ((this.pokemon.hasAbilityWithAttr(BlockRedirectAbAttr) || this.move.getMove().getAttrs(BypassRedirectAttr).length)) {
//If an ability prevented this move from being redirected, display its ability pop up.
if ((this.pokemon.hasAbilityWithAttr(BlockRedirectAbAttr) && !this.move.getMove().getAttrs(BypassRedirectAttr).length) && oldTarget != moveTarget.value) {
if ((this.pokemon.hasAbilityWithAttr(BlockRedirectAbAttr) && !this.move.getMove().getAttrs(BypassRedirectAttr).length) && oldTarget !== moveTarget.value) {
this.scene.unshiftPhase(new ShowAbilityPhase(this.scene, this.pokemon.getBattlerIndex(), this.pokemon.getPassiveAbility().hasAttr(BlockRedirectAbAttr)));
}
moveTarget.value = oldTarget;
@ -2366,7 +2366,7 @@ export class MovePhase extends BattlePhase {
success = false;
else if (success && this.scene.arena.isMoveTerrainCancelled(this.pokemon, this.targets, this.move.getMove())) {
success = false;
if (failedText == null)
if (failedText === null)
failedText = getTerrainBlockMessage(targets[0], this.scene.arena.terrain.terrainType);
}
if (success)
@ -3647,7 +3647,7 @@ export class GameOverPhase extends BattlePhase {
for (const pokemon of this.scene.getParty()) {
this.awardRibbon(pokemon);
if (pokemon.species.getRootSpeciesId() != pokemon.species.getRootSpeciesId(true)) {
if (pokemon.species.getRootSpeciesId() !== pokemon.species.getRootSpeciesId(true)) {
this.awardRibbon(pokemon, true);
}
}
@ -3884,9 +3884,8 @@ export class ExpPhase extends PlayerPartyMemberPokemonPhase {
exp.value = Math.floor(exp.value);
this.scene.ui.showText(i18next.t('battle:expGain', { pokemonName: pokemon.name, exp: exp.value }), null, () => {
const lastLevel = pokemon.level;
let newLevel: integer;
pokemon.addExp(exp.value);
newLevel = pokemon.level;
const newLevel = pokemon.level;
if (newLevel > lastLevel)
this.scene.unshiftPhase(new LevelUpPhase(this.scene, this.partyMemberIndex, lastLevel, newLevel));
pokemon.updateInfo().then(() => this.end());
@ -3912,9 +3911,8 @@ export class ShowPartyExpBarPhase extends PlayerPartyMemberPokemonPhase {
exp.value = Math.floor(exp.value);
const lastLevel = pokemon.level;
let newLevel: integer;
pokemon.addExp(exp.value);
newLevel = pokemon.level;
const newLevel = pokemon.level;
if (newLevel > lastLevel)
this.scene.unshiftPhase(new LevelUpPhase(this.scene, this.partyMemberIndex, lastLevel, newLevel));
this.scene.unshiftPhase(new HidePartyExpBarPhase(this.scene));

View File

@ -1,5 +1,5 @@
import BattleScene from '../battle-scene';
import { variantColorCache, variantData } from '#app/data/variant';
import { variantColorCache } from '#app/data/variant';
import Pokemon from '../field/pokemon';
import Trainer from '../field/trainer';
import FieldSpritePipeline from './field-sprite';

View File

@ -603,7 +603,7 @@ export class GameData {
score: scene.score,
waveIndex: scene.currentBattle.waveIndex,
battleType: scene.currentBattle.battleType,
trainer: scene.currentBattle.battleType == BattleType.TRAINER ? new TrainerData(scene.currentBattle.trainer) : null,
trainer: scene.currentBattle.battleType === BattleType.TRAINER ? new TrainerData(scene.currentBattle.trainer) : null,
gameVersion: scene.game.config.gameVersion,
timestamp: new Date().getTime()
} as SessionSaveData;
@ -790,7 +790,7 @@ export class GameData {
const seed = sessionData.seed;
let daily: string[] = [];
if (sessionData.gameMode == GameModes.DAILY) {
if (sessionData.gameMode === GameModes.DAILY) {
if (localStorage.hasOwnProperty('daily')) {
daily = JSON.parse(atob(localStorage.getItem('daily')));
if (daily.includes(seed)) {

View File

@ -1,6 +1,5 @@
import BattleScene from '../battle-scene';
import { TrainerType } from '../data/enums/trainer-type';
import { ModifierTier } from '../modifier/modifier-tier';
import { Achv, AchvTier, achvs } from './achv';
import i18next from '../plugins/i18n';

View File

@ -48,12 +48,12 @@ function simulateKeyboardEvent(eventType, button, buttonMap) {
* @param {string} key Key to simulate
* @param {object} buttonMap Map of buttons to key objects
*/
function simulateKeyboardInput(key, buttonMap) {
simulateKeyboardEvent('keydown', key, buttonMap);
window.setTimeout(() => {
simulateKeyboardEvent('keyup', key, buttonMap);
}, 100);
}
// function simulateKeyboardInput(key, buttonMap) {
// simulateKeyboardEvent('keydown', key, buttonMap);
// window.setTimeout(() => {
// simulateKeyboardEvent('keyup', key, buttonMap);
// }, 100);
// }
/**
* Bind a node by a specific key to simulate on touch

View File

@ -3,8 +3,7 @@ import { Mode } from './ui';
import PokemonIconAnimHandler, { PokemonIconAnimMode } from './pokemon-icon-anim-handler';
import { TextStyle, addTextObject } from './text';
import MessageUiHandler from './message-ui-handler';
import { EGG_SEED, Egg, GachaType, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from '../data/egg';
import * as Utils from '../utils';
import { Egg, getEggGachaTypeDescriptor, getEggHatchWavesMessage, getEggDescriptor } from '../data/egg';
import { addWindow } from './ui-theme';
import {Button} from '../enums/buttons';
import i18next from '../plugins/i18n';

View File

@ -1,5 +1,5 @@
import BattleScene from '../battle-scene';
import { TextStyle, addTextObject, getTextColor } from './text';
import { TextStyle, addTextObject } from './text';
import { Mode } from './ui';
import UiHandler from './ui-handler';
import { addWindow } from './ui-theme';

View File

@ -1842,7 +1842,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}
checkIconId(icon: Phaser.GameObjects.Sprite, species: PokemonSpecies, female, formIndex, shiny, variant) {
if (icon.frame.name != species.getIconId(female, formIndex, shiny, variant)) {
if (icon.frame.name !== species.getIconId(female, formIndex, shiny, variant)) {
console.log(`${species.name}'s variant icon does not exist. Replacing with default.`);
icon.setTexture(species.getIconAtlasKey(formIndex, false, variant));
icon.setFrame(species.getIconId(female, formIndex, false, variant));

View File

@ -3,10 +3,10 @@ import { Mode } from './ui';
import UiHandler from './ui-handler';
import * as Utils from '../utils';
import { PlayerPokemon } from '../field/pokemon';
import { default as PokemonSpecies, PokemonSpeciesForm, SpeciesFormKey, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm, getStarterValueFriendshipCap, speciesStarters, starterPassiveAbilities } from '../data/pokemon-species';
import { getStarterValueFriendshipCap, speciesStarters } from '../data/pokemon-species';
import { argbFromRgba } from '@material/material-color-utilities';
import { Type, getTypeRgb } from '../data/type';
import { TextStyle, addBBCodeTextObject, addTextObject, getBBCodeFrag, getTextColor } from './text';
import { TextStyle, addBBCodeTextObject, addTextObject, getBBCodeFrag } from './text';
import Move, { MoveCategory } from '../data/move';
import { getPokeballAtlasKey } from '../data/pokeball';
import { getGenderColor, getGenderSymbol } from '../data/gender';
@ -796,7 +796,7 @@ export default class SummaryUiHandler extends UiHandler {
const natureStatMultiplier = getNatureStatMultiplier(this.pokemon.getNature(), s);
const statLabel = addTextObject(this.scene, 27 + 115 * colIndex + (colIndex == 1 ? 5 : 0), 56 + 16 * rowIndex, statName, natureStatMultiplier === 1 ? TextStyle.SUMMARY : natureStatMultiplier > 1 ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY_BLUE);
const statLabel = addTextObject(this.scene, 27 + 115 * colIndex + (colIndex === 1 ? 5 : 0), 56 + 16 * rowIndex, statName, natureStatMultiplier === 1 ? TextStyle.SUMMARY : natureStatMultiplier > 1 ? TextStyle.SUMMARY_PINK : TextStyle.SUMMARY_BLUE);
statLabel.setOrigin(0.5, 0);
statsContainer.add(statLabel);

View File

@ -85,7 +85,6 @@ export function addTextInputObject(scene: Phaser.Scene, x: number, y: number, wi
function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle): [ Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig, string, integer ] {
const lang = i18next.language;
let shadowColor: string;
let shadowXpos = 4;
let shadowYpos = 5;
@ -138,7 +137,7 @@ function getTextStyleOptions(style: TextStyle, uiTheme: UiTheme, extraStyleOptio
break;
}
shadowColor = getTextColor(style, true, uiTheme);
const shadowColor = getTextColor(style, true, uiTheme);
if (extraStyleOptions) {
if (extraStyleOptions.fontSize) {

View File

@ -1,6 +1,6 @@
import BattleScene from '../battle-scene';
import { TextStyle, getTextColor } from './text';
import UI, { Mode } from './ui';
import { Mode } from './ui';
import {Button} from '../enums/buttons';
export default abstract class UiHandler {