eslint done

This commit is contained in:
Greenlamp 2024-05-22 01:49:43 +02:00
parent 8e2506045d
commit 9a8b6047c8
15 changed files with 58 additions and 69 deletions

View File

@ -1,8 +1,8 @@
import Phaser from 'phaser'; import Phaser from 'phaser';
import UI, { Mode } from './ui/ui'; import UI from './ui/ui';
import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, TurnInitPhase, ReturnPhase, LevelCapPhase, ShowTrainerPhase, LoginPhase, MovePhase, TitlePhase, SwitchPhase } from './phases'; import { NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, TurnInitPhase, ReturnPhase, LevelCapPhase, ShowTrainerPhase, LoginPhase, MovePhase, TitlePhase, SwitchPhase } from './phases';
import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon'; import Pokemon, { PlayerPokemon, EnemyPokemon } from './field/pokemon';
import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies, speciesStarters } from './data/pokemon-species'; import PokemonSpecies, { PokemonSpeciesFilter, allSpecies, getPokemonSpecies, initSpecies } from './data/pokemon-species';
import * as Utils from './utils'; import * as Utils from './utils';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, overrideModifiers, overrideHeldItems } from './modifier/modifier'; import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier, FusePokemonModifier, PokemonFormChangeItemModifier, TerastallizeModifier, overrideModifiers, overrideHeldItems } from './modifier/modifier';
import { PokeballType } from './data/pokeball'; import { PokeballType } from './data/pokeball';
@ -12,7 +12,6 @@ import { initGameSpeed } from './system/game-speed';
import { Biome } from './data/enums/biome'; import { Biome } from './data/enums/biome';
import { Arena, ArenaBase } from './field/arena'; import { Arena, ArenaBase } from './field/arena';
import { GameData, PlayerGender } from './system/game-data'; import { GameData, PlayerGender } from './system/game-data';
import StarterSelectUiHandler from './ui/starter-select-ui-handler';
import { TextStyle, addTextObject } from './ui/text'; import { TextStyle, addTextObject } from './ui/text';
import { Moves } from './data/enums/moves'; import { Moves } from './data/enums/moves';
import { allMoves } from './data/move'; import { allMoves } from './data/move';
@ -20,7 +19,6 @@ import { initMoves } from './data/move';
import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from './modifier/modifier-type'; import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from './modifier/modifier-type';
import AbilityBar from './ui/ability-bar'; import AbilityBar from './ui/ability-bar';
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, applyAbAttrs, initAbilities } from './data/ability'; import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, applyAbAttrs, initAbilities } from './data/ability';
import { Abilities } from './data/enums/abilities';
import { allAbilities } from './data/ability'; import { allAbilities } from './data/ability';
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle'; import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
import { GameMode, GameModes, gameModes } from './game-mode'; import { GameMode, GameModes, gameModes } from './game-mode';
@ -33,9 +31,6 @@ import TrainerData from './system/trainer-data';
import SoundFade from 'phaser3-rex-plugins/plugins/soundfade'; import SoundFade from 'phaser3-rex-plugins/plugins/soundfade';
import { pokemonPrevolutions } from './data/pokemon-evolutions'; import { pokemonPrevolutions } from './data/pokemon-evolutions';
import PokeballTray from './ui/pokeball-tray'; import PokeballTray from './ui/pokeball-tray';
import { Setting, settingOptions } from './system/settings';
import SettingsUiHandler from './ui/settings-ui-handler';
import MessageUiHandler from './ui/message-ui-handler';
import { Species } from './data/enums/species'; import { Species } from './data/enums/species';
import InvertPostFX from './pipelines/invert'; import InvertPostFX from './pipelines/invert';
import { Achv, ModifierAchv, MoneyAchv, achvs } from './system/achv'; import { Achv, ModifierAchv, MoneyAchv, achvs } from './system/achv';
@ -653,7 +648,7 @@ export default class BattleScene extends SceneBase {
const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(ignoreOverride)); const icon = this.add.sprite(0, 0, pokemon.getIconAtlasKey(ignoreOverride));
icon.setFrame(pokemon.getIconId(true)); icon.setFrame(pokemon.getIconId(true));
// Temporary fix to show pokemon's default icon if variant icon doesn't exist // Temporary fix to show pokemon's default icon if variant icon doesn't exist
if (icon.frame.name != pokemon.getIconId(true)) { if (icon.frame.name !== pokemon.getIconId(true)) {
console.log(`${pokemon.name}'s variant icon does not exist. Replacing with default.`); console.log(`${pokemon.name}'s variant icon does not exist. Replacing with default.`);
const temp = pokemon.shiny; const temp = pokemon.shiny;
pokemon.shiny = false; pokemon.shiny = false;
@ -921,7 +916,7 @@ export default class BattleScene extends SceneBase {
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER || this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS; const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER || this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS;
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy()); this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
this.trySpreadPokerus(); this.trySpreadPokerus();
if (!isNewBiome && (newWaveIndex % 10) == 5) if (!isNewBiome && (newWaveIndex % 10) === 5)
this.arena.updatePoolsForTimeOfDay(); this.arena.updatePoolsForTimeOfDay();
if (resetArenaState) { if (resetArenaState) {
this.arena.removeAllTags(); this.arena.removeAllTags();
@ -1791,7 +1786,7 @@ export default class BattleScene extends SceneBase {
const modifierChance = this.gameMode.getEnemyModifierChance(isBoss); const modifierChance = this.gameMode.getEnemyModifierChance(isBoss);
let pokemonModifierChance = modifierChance; let pokemonModifierChance = modifierChance;
if (this.currentBattle.battleType === BattleType.TRAINER) if (this.currentBattle.battleType === BattleType.TRAINER)
pokemonModifierChance = Math.ceil(pokemonModifierChance * this.currentBattle.trainer.getPartyMemberModifierChanceMultiplier(i)); pokemonModifierChance = Math.ceil(pokemonModifierChance * this.currentBattle.trainer.getPartyMemberModifierChanceMultiplier(i)); // eslint-disable-line
let count = 0; let count = 0;
for (let c = 0; c < chances; c++) { for (let c = 0; c < chances; c++) {
if (!Utils.randSeedInt(modifierChance)) if (!Utils.randSeedInt(modifierChance))

View File

@ -10,7 +10,6 @@ import { GameMode } from './game-mode';
import { BattleSpec } from './enums/battle-spec'; import { BattleSpec } from './enums/battle-spec';
import { PlayerGender } from './system/game-data'; import { PlayerGender } from './system/game-data';
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from './modifier/modifier'; import { MoneyMultiplierModifier, PokemonHeldItemModifier } from './modifier/modifier';
import { MoneyAchv } from './system/achv';
import { PokeballType } from './data/pokeball'; import { PokeballType } from './data/pokeball';
export enum BattleType { export enum BattleType {
@ -221,7 +220,6 @@ export default class Battle {
randSeedInt(scene: BattleScene, range: integer, min: integer = 0): integer { randSeedInt(scene: BattleScene, range: integer, min: integer = 0): integer {
if (range <= 1) if (range <= 1)
return min; return min;
let ret: integer;
const tempRngCounter = scene.rngCounter; const tempRngCounter = scene.rngCounter;
const tempSeedOverride = scene.rngSeedOverride; const tempSeedOverride = scene.rngSeedOverride;
const state = Phaser.Math.RND.state(); const state = Phaser.Math.RND.state();
@ -233,7 +231,7 @@ export default class Battle {
} }
scene.rngCounter = this.rngCounter++; scene.rngCounter = this.rngCounter++;
scene.rngSeedOverride = this.battleSeed; scene.rngSeedOverride = this.battleSeed;
ret = Utils.randSeedInt(range, min); const ret = Utils.randSeedInt(range, min);
this.battleSeedState = Phaser.Math.RND.state(); this.battleSeedState = Phaser.Math.RND.state();
Phaser.Math.RND.state(state); Phaser.Math.RND.state(state);
scene.rngCounter = tempRngCounter; scene.rngCounter = tempRngCounter;

View File

@ -9,7 +9,7 @@ import { BattlerTag } from './battler-tags';
import { BattlerTagType } from './enums/battler-tag-type'; import { BattlerTagType } from './enums/battler-tag-type';
import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from './status-effect'; import { StatusEffect, getStatusEffectDescriptor, getStatusEffectHealText } from './status-effect';
import { Gender } from './gender'; import { Gender } from './gender';
import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, RecoilAttr, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, StatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr } from './move'; import Move, { AttackMove, MoveCategory, MoveFlags, MoveTarget, StatusMoveTypeImmunityAttr, FlinchAttr, OneHitKOAttr, HitHealAttr, StrengthSapHealAttr, allMoves, StatusMove, VariablePowerAttr, applyMoveAttrs, IncrementMovePriorityAttr } from './move';
import { ArenaTagSide, ArenaTrapTag } from './arena-tag'; import { ArenaTagSide, ArenaTrapTag } from './arena-tag';
import { ArenaTagType } from './enums/arena-tag-type'; import { ArenaTagType } from './enums/arena-tag-type';
import { Stat } from './pokemon-stat'; import { Stat } from './pokemon-stat';
@ -20,9 +20,7 @@ import { SpeciesFormChangeManualTrigger } from './pokemon-forms';
import { Abilities } from './enums/abilities'; import { Abilities } from './enums/abilities';
import i18next, { Localizable } from '#app/plugins/i18n.js'; import i18next, { Localizable } from '#app/plugins/i18n.js';
import { Command } from '../ui/command-ui-handler'; import { Command } from '../ui/command-ui-handler';
import Battle from '#app/battle.js'; import { getPokeballName } from './pokeball';
import { ability } from '#app/locales/en/ability.js';
import { PokeballType, getPokeballName } from './pokeball';
export class Ability implements Localizable { export class Ability implements Localizable {
public id: Abilities; public id: Abilities;
@ -453,7 +451,7 @@ export class PostDefendAbAttr extends AbAttr {
export class PostDefendDisguiseAbAttr extends PostDefendAbAttr { export class PostDefendDisguiseAbAttr extends PostDefendAbAttr {
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (pokemon.formIndex == 0 && pokemon.battleData.hitCount != 0 && (move.getMove().category == MoveCategory.SPECIAL || move.getMove().category == MoveCategory.PHYSICAL)) { if (pokemon.formIndex === 0 && pokemon.battleData.hitCount !== 0 && (move.getMove().category === MoveCategory.SPECIAL || move.getMove().category === MoveCategory.PHYSICAL)) {
const recoilDamage = Math.ceil((pokemon.getMaxHp() / 8) - attacker.turnData.damageDealt); const recoilDamage = Math.ceil((pokemon.getMaxHp() / 8) - attacker.turnData.damageDealt);
if (!recoilDamage) if (!recoilDamage)
@ -956,7 +954,7 @@ export class MoveTypeChangePowerMultiplierAbAttr extends VariableMoveTypeAbAttr
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
const type = (args[0] as Utils.IntegerHolder); const type = (args[0] as Utils.IntegerHolder);
if (type.value == this.matchType) { if (type.value === this.matchType) {
type.value = this.newType; type.value = this.newType;
(args[1] as Utils.NumberHolder).value *= this.powerMultiplier; (args[1] as Utils.NumberHolder).value *= this.powerMultiplier;
return true; return true;
@ -1181,7 +1179,7 @@ export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
} }
applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (pokemon != attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance && !pokemon.status) { if (pokemon !== attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance && !pokemon.status) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
return attacker.trySetStatus(effect, true, pokemon); return attacker.trySetStatus(effect, true, pokemon);
} }
@ -1211,7 +1209,7 @@ export class PostAttackApplyBattlerTagAbAttr extends PostAttackAbAttr {
} }
applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean { applyPostAttack(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (pokemon != attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance(attacker, pokemon, move) && !pokemon.status) { if (pokemon !== attacker && (!this.contactRequired || move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) && pokemon.randSeedInt(100) < this.chance(attacker, pokemon, move) && !pokemon.status) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
@ -2327,7 +2325,7 @@ export class FetchBallAbAttr extends PostTurnAbAttr {
*/ */
applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean { applyPostTurn(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
const lastUsed = pokemon.scene.currentBattle.lastUsedPokeball; const lastUsed = pokemon.scene.currentBattle.lastUsedPokeball;
if(lastUsed != null && pokemon.isPlayer) { if(lastUsed !== null && pokemon.isPlayer) {
pokemon.scene.pokeballCounts[lastUsed]++; pokemon.scene.pokeballCounts[lastUsed]++;
pokemon.scene.currentBattle.lastUsedPokeball = null; pokemon.scene.currentBattle.lastUsedPokeball = null;
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` found a\n${getPokeballName(lastUsed)}!`)); pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` found a\n${getPokeballName(lastUsed)}!`));
@ -3161,8 +3159,8 @@ export function initAbilities() {
new Ability(Abilities.TRUANT, 3) new Ability(Abilities.TRUANT, 3)
.attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false), .attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false),
new Ability(Abilities.HUSTLE, 3) new Ability(Abilities.HUSTLE, 3)
.attr(BattleStatMultiplierAbAttr, BattleStat.ATK, 1.5, (user, target, move) => move.category == MoveCategory.PHYSICAL) .attr(BattleStatMultiplierAbAttr, BattleStat.ATK, 1.5, (user, target, move) => move.category === MoveCategory.PHYSICAL)
.attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 0.8, (user, target, move) => move.category == MoveCategory.PHYSICAL), .attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 0.8, (user, target, move) => move.category === MoveCategory.PHYSICAL),
new Ability(Abilities.CUTE_CHARM, 3) new Ability(Abilities.CUTE_CHARM, 3)
.attr(PostDefendContactApplyTagChanceAbAttr, 30, BattlerTagType.INFATUATED), .attr(PostDefendContactApplyTagChanceAbAttr, 30, BattlerTagType.INFATUATED),
new Ability(Abilities.PLUS, 3) new Ability(Abilities.PLUS, 3)
@ -3599,7 +3597,7 @@ export function initAbilities() {
.attr(UnsuppressableAbilityAbAttr) .attr(UnsuppressableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr), .attr(NoFusionAbilityAbAttr),
new Ability(Abilities.DISGUISE, 7) new Ability(Abilities.DISGUISE, 7)
.attr(PreDefendMovePowerToOneAbAttr, (target, user, move) => target.formIndex == 0 && target.getAttackTypeEffectiveness(move.type, user) > 0) .attr(PreDefendMovePowerToOneAbAttr, (target, user, move) => target.formIndex === 0 && target.getAttackTypeEffectiveness(move.type, user) > 0)
.attr(PostSummonFormChangeAbAttr, p => p.battleData.hitCount === 0 ? 0 : 1) .attr(PostSummonFormChangeAbAttr, p => p.battleData.hitCount === 0 ? 0 : 1)
.attr(PostBattleInitFormChangeAbAttr, p => p.battleData.hitCount === 0 ? 0 : 1) .attr(PostBattleInitFormChangeAbAttr, p => p.battleData.hitCount === 0 ? 0 : 1)
.attr(PostDefendFormChangeAbAttr, p => p.battleData.hitCount === 0 ? 0 : 1) .attr(PostDefendFormChangeAbAttr, p => p.battleData.hitCount === 0 ? 0 : 1)

View File

@ -427,7 +427,9 @@ class StickyWebTag extends ArenaTrapTag {
onAdd(arena: Arena): void { onAdd(arena: Arena): void {
super.onAdd(arena); super.onAdd(arena);
// does not seem to be used anywhere
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const source = arena.scene.getPokemonById(this.sourceId); const source = arena.scene.getPokemonById(this.sourceId);
arena.scene.queueMessage(`A ${this.getMoveName()} has been laid out on the ground around the opposing team!`); arena.scene.queueMessage(`A ${this.getMoveName()} has been laid out on the ground around the opposing team!`);
} }

View File

@ -4,9 +4,8 @@ import { AttackMove, ChargeAttr, DelayedAttackAttr, MoveFlags, SelfStatusMove, a
import Pokemon from '../field/pokemon'; import Pokemon from '../field/pokemon';
import * as Utils from '../utils'; import * as Utils from '../utils';
import { BattlerIndex } from '../battle'; import { BattlerIndex } from '../battle';
import stringify, { Element } from 'json-stable-stringify'; import { Element } from 'json-stable-stringify';
import { Moves } from './enums/moves'; import { Moves } from './enums/moves';
import { getTypeRgb } from './type';
//import fs from 'vite-plugin-fs/browser'; //import fs from 'vite-plugin-fs/browser';
export enum AnimFrameTarget { export enum AnimFrameTarget {
@ -795,8 +794,7 @@ export abstract class BattleAnim {
const sprites = spriteCache[isUser ? AnimFrameTarget.USER : AnimFrameTarget.TARGET]; const sprites = spriteCache[isUser ? AnimFrameTarget.USER : AnimFrameTarget.TARGET];
const spriteSource = isUser ? userSprite : targetSprite; const spriteSource = isUser ? userSprite : targetSprite;
if ((isUser ? u : t) === sprites.length) { if ((isUser ? u : t) === sprites.length) {
let sprite: Phaser.GameObjects.Sprite; const sprite = scene.addPokemonSprite(isUser ? user : target, 0, 0, spriteSource.texture, spriteSource.frame.name, true);
sprite = scene.addPokemonSprite(isUser ? user : target, 0, 0, spriteSource.texture, spriteSource.frame.name, true);
[ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]); [ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]);
sprite.setPipelineData('spriteKey', (isUser ? user : target).getBattleSpriteKey()); sprite.setPipelineData('spriteKey', (isUser ? user : target).getBattleSpriteKey());
sprite.setPipelineData('shiny', (isUser ? user : target).shiny); sprite.setPipelineData('shiny', (isUser ? user : target).shiny);
@ -1151,6 +1149,8 @@ export async function populateAnims() {
} }
} }
// used in commented code
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const animReplacer = (k, v) => { const animReplacer = (k, v) => {
if (k === 'id' && !v) if (k === 'id' && !v)
return undefined; return undefined;
@ -1165,9 +1165,10 @@ export async function populateAnims() {
const animFrameProps = [ 'x', 'y', 'zoomX', 'zoomY', 'angle', 'mirror', 'visible', 'blendType', 'target', 'graphicFrame', 'opacity', 'color', 'tone', 'flash', 'locked', 'priority', 'focus' ]; const animFrameProps = [ 'x', 'y', 'zoomX', 'zoomY', 'angle', 'mirror', 'visible', 'blendType', 'target', 'graphicFrame', 'opacity', 'color', 'tone', 'flash', 'locked', 'priority', 'focus' ];
const propSets = [ animConfigProps, animFrameProps ]; const propSets = [ animConfigProps, animFrameProps ];
// used in commented code
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const animComparator = (a: Element, b: Element) => { const animComparator = (a: Element, b: Element) => {
let props: string[]; let props: string[];
const p = 0;
for (let p = 0; p < propSets.length; p++) { for (let p = 0; p < propSets.length; p++) {
props = propSets[p]; props = propSets[p];
const ai = props.indexOf(a.key); const ai = props.indexOf(a.key);

View File

@ -1,7 +1,6 @@
import { PokemonHealPhase, StatChangePhase } from '../phases'; import { PokemonHealPhase, StatChangePhase } from '../phases';
import { getPokemonMessage } from '../messages'; import { getPokemonMessage } from '../messages';
import Pokemon, { HitResult } from '../field/pokemon'; import Pokemon, { HitResult } from '../field/pokemon';
import { getBattleStatName } from './battle-stat';
import { BattleStat } from './battle-stat'; import { BattleStat } from './battle-stat';
import { BattlerTagType } from './enums/battler-tag-type'; import { BattlerTagType } from './enums/battler-tag-type';
import { getStatusEffectHealText } from './status-effect'; import { getStatusEffectHealText } from './status-effect';

View File

@ -7794,6 +7794,8 @@ export const biomeTrainerPools: BiomeTrainerPools = {
//outputPools(); //outputPools();
}); });
// used in a commented code
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function outputPools() { function outputPools() {
const pokemonOutput = {}; const pokemonOutput = {};
const trainerOutput = {}; const trainerOutput = {};

View File

@ -1,5 +1,3 @@
import { Type } from './type';
import * as Utils from '../utils';
import BattleScene from '../battle-scene'; import BattleScene from '../battle-scene';
import { Species } from './enums/species'; import { Species } from './enums/species';
import { getPokemonSpecies, speciesStarters } from './pokemon-species'; import { getPokemonSpecies, speciesStarters } from './pokemon-species';
@ -98,7 +96,6 @@ export function getLegendaryGachaSpeciesForTimestamp(scene: BattleScene, timesta
// 86400000 is the number of miliseconds in one day // 86400000 is the number of miliseconds in one day
const timeDate = new Date(timestamp); const timeDate = new Date(timestamp);
const dayDate = new Date(Date.UTC(timeDate.getUTCFullYear(), timeDate.getUTCMonth(), timeDate.getUTCDate()));
const dayTimestamp = timeDate.getTime(); // Timestamp of current week const dayTimestamp = timeDate.getTime(); // Timestamp of current week
const offset = Math.floor(Math.floor(dayTimestamp / 86400000) / legendarySpecies.length); // Cycle number const offset = Math.floor(Math.floor(dayTimestamp / 86400000) / legendarySpecies.length); // Cycle number
const index = Math.floor(dayTimestamp / 86400000) % legendarySpecies.length; // Index within cycle const index = Math.floor(dayTimestamp / 86400000) % legendarySpecies.length; // Index within cycle

View File

@ -1,6 +1,6 @@
import { Moves } from './enums/moves'; import { Moves } from './enums/moves';
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from './battle-anims'; import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from './battle-anims';
import { BattleEndPhase, MoveEffectPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase, ToggleDoublePositionPhase } from '../phases'; import { BattleEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from '../phases';
import { BattleStat, getBattleStatName } from './battle-stat'; import { BattleStat, getBattleStatName } from './battle-stat';
import { EncoreTag } from './battler-tags'; import { EncoreTag } from './battler-tags';
import { BattlerTagType } from './enums/battler-tag-type'; import { BattlerTagType } from './enums/battler-tag-type';
@ -12,7 +12,7 @@ import * as Utils from '../utils';
import { WeatherType } from './weather'; import { WeatherType } from './weather';
import { ArenaTagSide, ArenaTrapTag } from './arena-tag'; import { ArenaTagSide, ArenaTrapTag } from './arena-tag';
import { ArenaTagType } from './enums/arena-tag-type'; import { ArenaTagType } from './enums/arena-tag-type';
import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, NoTransformAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr, ReverseDrainAbAttr, FieldPreventExplosiveMovesAbAttr, ForceSwitchOutImmunityAbAttr, PreventBerryUseAbAttr, BlockItemTheftAbAttr } from './ability'; import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr, ReverseDrainAbAttr, FieldPreventExplosiveMovesAbAttr, ForceSwitchOutImmunityAbAttr, BlockItemTheftAbAttr } from './ability';
import { Abilities } from './enums/abilities'; import { Abilities } from './enums/abilities';
import { allAbilities } from './ability'; import { allAbilities } from './ability';
import { PokemonHeldItemModifier, BerryModifier, PreserveBerryModifier } from '../modifier/modifier'; import { PokemonHeldItemModifier, BerryModifier, PreserveBerryModifier } from '../modifier/modifier';
@ -25,7 +25,7 @@ import { ModifierPoolType } from '#app/modifier/modifier-type';
import { Command } from '../ui/command-ui-handler'; import { Command } from '../ui/command-ui-handler';
import { Biome } from './enums/biome'; import { Biome } from './enums/biome';
import i18next, { Localizable } from '../plugins/i18n'; import i18next, { Localizable } from '../plugins/i18n';
import { BerryType, BerryEffectFunc, getBerryEffectFunc } from './berry'; import { getBerryEffectFunc } from './berry';
export enum MoveCategory { export enum MoveCategory {
PHYSICAL, PHYSICAL,
@ -1296,7 +1296,7 @@ export class ChangeMultiHitTypeAttr extends MoveAttr {
export class WaterShurikenMultiHitTypeAttr extends ChangeMultiHitTypeAttr { export class WaterShurikenMultiHitTypeAttr extends ChangeMultiHitTypeAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.species.speciesId == Species.GRENINJA && user.hasAbility(Abilities.BATTLE_BOND) && user.formIndex == 2) { if (user.species.speciesId === Species.GRENINJA && user.hasAbility(Abilities.BATTLE_BOND) && user.formIndex === 2) {
(args[0] as Utils.IntegerHolder).value = MultiHitType._3; (args[0] as Utils.IntegerHolder).value = MultiHitType._3;
return true; return true;
} }
@ -1549,7 +1549,7 @@ export class StealEatBerryAttr extends EatBerryAttr {
const cancelled = new Utils.BooleanHolder(false); const cancelled = new Utils.BooleanHolder(false);
applyAbAttrs(BlockItemTheftAbAttr, target, cancelled); // check for abilities that block item theft applyAbAttrs(BlockItemTheftAbAttr, target, cancelled); // check for abilities that block item theft
if(cancelled.value == true) if(cancelled.value === true)
return false; return false;
const heldBerries = this.getTargetHeldBerries(target).filter(i => i.getTransferrable(false)); const heldBerries = this.getTargetHeldBerries(target).filter(i => i.getTransferrable(false));
@ -1557,7 +1557,7 @@ export class StealEatBerryAttr extends EatBerryAttr {
if (heldBerries.length) { // if the target has berries, pick a random berry and steal it if (heldBerries.length) { // if the target has berries, pick a random berry and steal it
this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)]; this.chosenBerry = heldBerries[user.randSeedInt(heldBerries.length)];
if (this.chosenBerry.stackCount == 1) // remove modifier if its the last berry if (this.chosenBerry.stackCount === 1) // remove modifier if its the last berry
target.scene.removeModifier(this.chosenBerry, !target.isPlayer()); target.scene.removeModifier(this.chosenBerry, !target.isPlayer());
target.scene.updateModifiers(target.isPlayer()); target.scene.updateModifiers(target.isPlayer());
@ -2643,7 +2643,7 @@ export class KnockOffPowerAttr extends VariablePowerAttr {
export class WaterShurikenPowerAttr extends VariablePowerAttr { export class WaterShurikenPowerAttr extends VariablePowerAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.species.speciesId == Species.GRENINJA && user.hasAbility(Abilities.BATTLE_BOND) && user.formIndex == 2) { if (user.species.speciesId === Species.GRENINJA && user.hasAbility(Abilities.BATTLE_BOND) && user.formIndex === 2) {
(args[0] as Utils.IntegerHolder).value = 20; (args[0] as Utils.IntegerHolder).value = 20;
return true; return true;
} }
@ -3838,7 +3838,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
const switchOutTarget = (this.user ? user : target); const switchOutTarget = (this.user ? user : target);
const player = switchOutTarget instanceof PlayerPokemon; const player = switchOutTarget instanceof PlayerPokemon;
if (!this.user && move.category == MoveCategory.STATUS && (target.hasAbilityWithAttr(ForceSwitchOutImmunityAbAttr) || target.isMax())) if (!this.user && move.category === MoveCategory.STATUS && (target.hasAbilityWithAttr(ForceSwitchOutImmunityAbAttr) || target.isMax()))
return false; return false;
if (!player && !user.scene.currentBattle.battleType) { if (!player && !user.scene.currentBattle.battleType) {
@ -3882,7 +3882,7 @@ export class RemoveTypeAttr extends MoveEffectAttr {
if (!super.apply(user, target, move, args)) if (!super.apply(user, target, move, args))
return false; return false;
if(user.isTerastallized && user.getTeraType() == this.removedType) // active tera types cannot be removed if(user.isTerastallized && user.getTeraType() === this.removedType) // active tera types cannot be removed
return false; return false;
const userTypes = user.getTypes(true); const userTypes = user.getTypes(true);
@ -6711,7 +6711,7 @@ export function initMoves() {
.bitingMove() .bitingMove()
.attr(RemoveScreensAttr), .attr(RemoveScreensAttr),
new AttackMove(Moves.STOMPING_TANTRUM, Type.GROUND, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 7) new AttackMove(Moves.STOMPING_TANTRUM, Type.GROUND, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 7)
.attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result == MoveResult.MISS || user.getLastXMoves(2)[1]?.result == MoveResult.FAIL ? 2 : 1), .attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result === MoveResult.MISS || user.getLastXMoves(2)[1]?.result === MoveResult.FAIL ? 2 : 1),
new AttackMove(Moves.SHADOW_BONE, Type.GHOST, MoveCategory.PHYSICAL, 85, 100, 10, 20, 0, 7) new AttackMove(Moves.SHADOW_BONE, Type.GHOST, MoveCategory.PHYSICAL, 85, 100, 10, 20, 0, 7)
.attr(StatChangeAttr, BattleStat.DEF, -1) .attr(StatChangeAttr, BattleStat.DEF, -1)
.makesContact(false), .makesContact(false),
@ -7270,7 +7270,7 @@ export function initMoves() {
.recklessMove(), .recklessMove(),
new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9) new AttackMove(Moves.LAST_RESPECTS, Type.GHOST, MoveCategory.PHYSICAL, 50, 100, 10, -1, 0, 9)
.attr(MovePowerMultiplierAttr, (user, target, move) => { .attr(MovePowerMultiplierAttr, (user, target, move) => {
return user.scene.getParty().reduce((acc, pokemonInParty) => acc + (pokemonInParty.status?.effect == StatusEffect.FAINT ? 1 : 0), return user.scene.getParty().reduce((acc, pokemonInParty) => acc + (pokemonInParty.status?.effect === StatusEffect.FAINT ? 1 : 0),
1,); 1,);
}) })
.makesContact(false), .makesContact(false),
@ -7472,7 +7472,7 @@ export function initMoves() {
.soundBased() .soundBased()
.partial(), .partial(),
new AttackMove(Moves.TEMPER_FLARE, Type.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9) new AttackMove(Moves.TEMPER_FLARE, Type.FIRE, MoveCategory.PHYSICAL, 75, 100, 10, -1, 0, 9)
.attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result == MoveResult.MISS || user.getLastXMoves(2)[1]?.result == MoveResult.FAIL ? 2 : 1), .attr(MovePowerMultiplierAttr, (user, target, move) => user.getLastXMoves(2)[1]?.result === MoveResult.MISS || user.getLastXMoves(2)[1]?.result === MoveResult.FAIL ? 2 : 1),
new AttackMove(Moves.SUPERCELL_SLAM, Type.ELECTRIC, MoveCategory.PHYSICAL, 100, 95, 15, -1, 0, 9) new AttackMove(Moves.SUPERCELL_SLAM, Type.ELECTRIC, MoveCategory.PHYSICAL, 100, 95, 15, -1, 0, 9)
.attr(MissEffectAttr, crashDamageFunc) .attr(MissEffectAttr, crashDamageFunc)
.attr(NoEffectAttr, crashDamageFunc) .attr(NoEffectAttr, crashDamageFunc)

View File

@ -1,5 +1,5 @@
import { Gender } from './gender'; import { Gender } from './gender';
import { AttackTypeBoosterModifier, FlinchChanceModifier } from '../modifier/modifier'; import { FlinchChanceModifier } from '../modifier/modifier';
import { Moves } from './enums/moves'; import { Moves } from './enums/moves';
import { PokeballType } from './pokeball'; import { PokeballType } from './pokeball';
import Pokemon from '../field/pokemon'; import Pokemon from '../field/pokemon';
@ -1254,7 +1254,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
new SpeciesEvolution(Species.CLOYSTER, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.LONG) new SpeciesEvolution(Species.CLOYSTER, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.LONG)
], ],
[Species.EXEGGCUTE]: [ [Species.EXEGGCUTE]: [
new SpeciesEvolution(Species.ALOLA_EXEGGUTOR, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition(p => p.scene.arena.biomeType === Biome.ISLAND || p.scene.arena.biomeType == Biome.BEACH), SpeciesWildEvolutionDelay.LONG), new SpeciesEvolution(Species.ALOLA_EXEGGUTOR, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition(p => p.scene.arena.biomeType === Biome.ISLAND || p.scene.arena.biomeType === Biome.BEACH), SpeciesWildEvolutionDelay.LONG),
new SpeciesEvolution(Species.EXEGGUTOR, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG) new SpeciesEvolution(Species.EXEGGUTOR, 1, EvolutionItem.LEAF_STONE, null, SpeciesWildEvolutionDelay.LONG)
], ],
[Species.TANGELA]: [ [Species.TANGELA]: [

View File

@ -231,10 +231,9 @@ export abstract class PokemonSpeciesForm {
const baseSpriteKey = `${showGenderDiffs ? 'female__' : ''}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ''}`; const baseSpriteKey = `${showGenderDiffs ? 'female__' : ''}${this.speciesId}${formSpriteKey ? `-${formSpriteKey}` : ''}`;
let variantSet: VariantSet;
let config = variantData; let config = variantData;
`${back ? 'back__' : ''}${baseSpriteKey}`.split('__').map(p => config ? config = config[p] : null); `${back ? 'back__' : ''}${baseSpriteKey}`.split('__').map(p => config ? config = config[p] : null);
variantSet = config as VariantSet; const variantSet = config as VariantSet;
return `${back ? 'back__' : ''}${shiny && (!variantSet || (!variant && !variantSet[variant || 0])) ? 'shiny__' : ''}${baseSpriteKey}${shiny && variantSet && variantSet[variant || 0] === 2 ? `_${variant + 1}` : ''}`; return `${back ? 'back__' : ''}${shiny && (!variantSet || (!variant && !variantSet[variant || 0])) ? 'shiny__' : ''}${baseSpriteKey}${shiny && variantSet && variantSet[variant || 0] === 2 ? `_${variant + 1}` : ''}`;
} }
@ -395,10 +394,9 @@ export abstract class PokemonSpeciesForm {
const useExpSprite = scene.experimentalSprites && scene.hasExpSprite(spriteKey); const useExpSprite = scene.experimentalSprites && scene.hasExpSprite(spriteKey);
if (useExpSprite) if (useExpSprite)
spritePath = `exp/${spritePath}`; spritePath = `exp/${spritePath}`;
let variantSet: VariantSet;
let config = variantData; let config = variantData;
spritePath.split('/').map(p => config ? config = config[p] : null); spritePath.split('/').map(p => config ? config = config[p] : null);
variantSet = config as VariantSet; const variantSet = config as VariantSet;
if (variantSet && variantSet[variant] === 1) { if (variantSet && variantSet[variant] === 1) {
const populateVariantColors = (key: string): Promise<void> => { const populateVariantColors = (key: string): Promise<void> => {
return new Promise(resolve => { return new Promise(resolve => {

View File

@ -19,6 +19,8 @@ interface TrainerNameConfigs {
[key: integer]: TrainerNameConfig [key: integer]: TrainerNameConfig
} }
// used in a commented code
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const trainerNameConfigs: TrainerNameConfigs = { const trainerNameConfigs: TrainerNameConfigs = {
[TrainerType.ACE_TRAINER]: new TrainerNameConfig(TrainerType.ACE_TRAINER), [TrainerType.ACE_TRAINER]: new TrainerNameConfig(TrainerType.ACE_TRAINER),
[TrainerType.ARTIST]: new TrainerNameConfig(TrainerType.ARTIST), [TrainerType.ARTIST]: new TrainerNameConfig(TrainerType.ARTIST),
@ -121,6 +123,8 @@ export const trainerNamePools = {
[TrainerType.HEX_MANIAC]: ['Kindra','Patricia','Tammy','Tasha','Valerie','Alaina','Kathleen','Leah','Makie','Sylvia','Anina','Arachna','Carrie','Desdemona','Josette','Luna','Melanie','Osanna','Raziah'], [TrainerType.HEX_MANIAC]: ['Kindra','Patricia','Tammy','Tasha','Valerie','Alaina','Kathleen','Leah','Makie','Sylvia','Anina','Arachna','Carrie','Desdemona','Josette','Luna','Melanie','Osanna','Raziah'],
}; };
// function used in a commented code
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function fetchAndPopulateTrainerNames(url: string, parser: DOMParser, trainerNames: Set<string>, femaleTrainerNames: Set<string>, forceFemale: boolean = false) { function fetchAndPopulateTrainerNames(url: string, parser: DOMParser, trainerNames: Set<string>, femaleTrainerNames: Set<string>, forceFemale: boolean = false) {
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
fetch(`https://bulbapedia.bulbagarden.net/wiki/${url}_(Trainer_class)`) fetch(`https://bulbapedia.bulbagarden.net/wiki/${url}_(Trainer_class)`)

View File

@ -17,7 +17,7 @@ import { initMoveAnim, loadMoveAnimAssets } from '../data/battle-anims';
import { Status, StatusEffect, getRandomStatus } from '../data/status-effect'; import { Status, StatusEffect, getRandomStatus } from '../data/status-effect';
import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEvolutionCondition, FusionSpeciesFormEvolution } from '../data/pokemon-evolutions'; import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEvolutionCondition, FusionSpeciesFormEvolution } from '../data/pokemon-evolutions';
import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from '../data/tms'; import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from '../data/tms';
import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchPhase, SwitchSummonPhase, ToggleDoublePositionPhase } from '../phases'; import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase, ToggleDoublePositionPhase } from '../phases';
import { BattleStat } from '../data/battle-stat'; import { BattleStat } from '../data/battle-stat';
import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, HighestStatBoostTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags'; import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, HighestStatBoostTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags';
import { BattlerTagType } from '../data/enums/battler-tag-type'; import { BattlerTagType } from '../data/enums/battler-tag-type';
@ -27,10 +27,10 @@ import { TempBattleStat } from '../data/temp-battle-stat';
import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag'; import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag';
import { ArenaTagType } from '../data/enums/arena-tag-type'; import { ArenaTagType } from '../data/enums/arena-tag-type';
import { Biome } from '../data/enums/biome'; import { Biome } from '../data/enums/biome';
import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr } from '../data/ability'; import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, DamageBoostAbAttr, IgnoreTypeStatusEffectImmunityAbAttr, ConditionalCritAbAttr } from '../data/ability';
import { Abilities } from '#app/data/enums/abilities'; import { Abilities } from '#app/data/enums/abilities';
import PokemonData from '../system/pokemon-data'; import PokemonData from '../system/pokemon-data';
import Battle, { BattlerIndex } from '../battle'; import { BattlerIndex } from '../battle';
import { BattleSpec } from '../enums/battle-spec'; import { BattleSpec } from '../enums/battle-spec';
import { Mode } from '../ui/ui'; import { Mode } from '../ui/ui';
import PartyUiHandler, { PartyOption, PartyUiMode } from '../ui/party-ui-handler'; import PartyUiHandler, { PartyOption, PartyUiMode } from '../ui/party-ui-handler';
@ -321,11 +321,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const populateVariantColors = (key: string, back: boolean = false): Promise<void> => { const populateVariantColors = (key: string, back: boolean = false): Promise<void> => {
return new Promise(resolve => { return new Promise(resolve => {
const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride).replace('variant/', '').replace(/_[1-3]$/, ''); const battleSpritePath = this.getBattleSpriteAtlasPath(back, ignoreOverride).replace('variant/', '').replace(/_[1-3]$/, '');
let variantSet: VariantSet;
let config = variantData; let config = variantData;
const useExpSprite = this.scene.experimentalSprites && this.scene.hasExpSprite(this.getBattleSpriteKey(back, ignoreOverride)); const useExpSprite = this.scene.experimentalSprites && this.scene.hasExpSprite(this.getBattleSpriteKey(back, ignoreOverride));
battleSpritePath.split('/').map(p => config ? config = config[p] : null); battleSpritePath.split('/').map(p => config ? config = config[p] : null);
variantSet = config as VariantSet; const variantSet = config as VariantSet;
if (variantSet && variantSet[this.variant] === 1) { if (variantSet && variantSet[this.variant] === 1) {
if (variantColorCache.hasOwnProperty(key)) if (variantColorCache.hasOwnProperty(key))
return resolve(); return resolve();
@ -778,7 +777,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (includeTeraType) { if (includeTeraType) {
const teraType = this.getTeraType(); const teraType = this.getTeraType();
if (teraType != Type.UNKNOWN) if (teraType !== Type.UNKNOWN)
types.push(teraType); types.push(teraType);
} }
@ -1611,7 +1610,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (!result) { if (!result) {
if (!typeMultiplier.value) if (!typeMultiplier.value)
result = move.id == Moves.SHEER_COLD ? HitResult.IMMUNE : HitResult.NO_EFFECT; result = move.id === Moves.SHEER_COLD ? HitResult.IMMUNE : HitResult.NO_EFFECT;
else { else {
const oneHitKo = new Utils.BooleanHolder(false); const oneHitKo = new Utils.BooleanHolder(false);
applyMoveAttrs(OneHitKOAttr, source, this, move, oneHitKo); applyMoveAttrs(OneHitKOAttr, source, this, move, oneHitKo);
@ -1913,7 +1912,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const scene = sceneOverride || this.scene; const scene = sceneOverride || this.scene;
const cry = this.getSpeciesForm().cry(scene, soundConfig); const cry = this.getSpeciesForm().cry(scene, soundConfig);
let duration = cry.totalDuration * 1000; let duration = cry.totalDuration * 1000;
if (this.fusionSpecies && this.getSpeciesForm() != this.getFusionSpeciesForm()) { if (this.fusionSpecies && this.getSpeciesForm() !== this.getFusionSpeciesForm()) {
let fusionCry = this.getFusionSpeciesForm().cry(scene, soundConfig, true); let fusionCry = this.getFusionSpeciesForm().cry(scene, soundConfig, true);
duration = Math.min(duration, fusionCry.totalDuration * 1000); duration = Math.min(duration, fusionCry.totalDuration * 1000);
fusionCry.destroy(); fusionCry.destroy();
@ -1932,11 +1931,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
faintCry(callback: Function): void { faintCry(callback: Function): void {
if (this.fusionSpecies && this.getSpeciesForm() != this.getFusionSpeciesForm()) if (this.fusionSpecies && this.getSpeciesForm() !== this.getFusionSpeciesForm())
return this.fusionFaintCry(callback); return this.fusionFaintCry(callback);
const key = this.getSpeciesForm().getCryKey(this.formIndex); const key = this.getSpeciesForm().getCryKey(this.formIndex);
let i = 0;
let rate = 0.85; let rate = 0.85;
const cry = this.scene.playSound(key, { rate: rate }) as AnySound; const cry = this.scene.playSound(key, { rate: rate }) as AnySound;
const sprite = this.getSprite(); const sprite = this.getSprite();

View File

@ -8,8 +8,7 @@ import { EnemyPokemon } from './pokemon';
import * as Utils from '../utils'; import * as Utils from '../utils';
import { PersistentModifier } from '../modifier/modifier'; import { PersistentModifier } from '../modifier/modifier';
import { trainerNamePools } from '../data/trainer-names'; import { trainerNamePools } from '../data/trainer-names';
import { ArenaTagType } from '#app/data/enums/arena-tag-type'; import { ArenaTagSide, ArenaTrapTag } from '#app/data/arena-tag';
import { ArenaTag, ArenaTagSide, ArenaTrapTag } from '#app/data/arena-tag';
import {getIsInitialized, initI18n} from '#app/plugins/i18n'; import {getIsInitialized, initI18n} from '#app/plugins/i18n';
import i18next from 'i18next'; import i18next from 'i18next';
@ -320,7 +319,6 @@ export default class Trainer extends Phaser.GameObjects.Container {
const partyMemberScores = nonFaintedPartyMembers.map(p => { const partyMemberScores = nonFaintedPartyMembers.map(p => {
const playerField = this.scene.getPlayerField(); const playerField = this.scene.getPlayerField();
let score = 0; let score = 0;
let ret: [integer, integer];
for (const playerPokemon of playerField) { for (const playerPokemon of playerField) {
score += p.getMatchupScore(playerPokemon); score += p.getMatchupScore(playerPokemon);
if (playerPokemon.species.legendary) if (playerPokemon.species.legendary)
@ -329,8 +327,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
score /= playerField.length; score /= playerField.length;
if (forSwitch && !p.isOnField()) if (forSwitch && !p.isOnField())
this.scene.arena.findTagsOnSide(t => t instanceof ArenaTrapTag, ArenaTagSide.ENEMY).map(t => score *= (t as ArenaTrapTag).getMatchupScoreMultiplier(p)); this.scene.arena.findTagsOnSide(t => t instanceof ArenaTrapTag, ArenaTagSide.ENEMY).map(t => score *= (t as ArenaTrapTag).getMatchupScoreMultiplier(p));
ret = [ party.indexOf(p), score ]; return [ party.indexOf(p), score ];
return ret;
}); });
return partyMemberScores; return partyMemberScores;

View File

@ -215,7 +215,7 @@ export class InputsController {
refreshGamepads(): void { refreshGamepads(): void {
// Sometimes, gamepads are undefined. For some reason. // Sometimes, gamepads are undefined. For some reason.
this.gamepads = this.scene.input.gamepad.gamepads.filter(function (el) { this.gamepads = this.scene.input.gamepad.gamepads.filter(function (el) {
return el != null; return el !== null;
}); });
for (const [index, thisGamepad] of this.gamepads.entries()) { for (const [index, thisGamepad] of this.gamepads.entries()) {