diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 19f8dad862e..71f4dc7b9f6 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -230,7 +230,7 @@ export default class BattleScene extends SceneBase { private fieldOverlay: Phaser.GameObjects.Rectangle; private shopOverlay: Phaser.GameObjects.Rectangle; private shopOverlayShown: boolean = false; - private shopOverlayOpacity: number = .80; + private shopOverlayOpacity: number = .8; public modifiers: PersistentModifier[]; private enemyModifiers: PersistentModifier[]; @@ -1056,7 +1056,7 @@ export default class BattleScene extends SceneBase { playerField.forEach(p => applyAbAttrs(DoubleBattleChanceAbAttr, p, null, doubleChance)); doubleTrainer = !Utils.randSeedInt(doubleChance.value); // Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance - if (trainerConfigs[trainerType].trainerTypeDouble && !(trainerType === TrainerType.TATE || trainerType === TrainerType.LIZA)) { + if (trainerConfigs[trainerType].trainerTypeDouble && ![ TrainerType.TATE, TrainerType.LIZA ].includes(trainerType)) { doubleTrainer = false; } } diff --git a/src/battle.ts b/src/battle.ts index b8df7635472..b6ae5354e5a 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -294,7 +294,7 @@ export default class Battle { if (pokemon.species.speciesId === Species.TAPU_KOKO || pokemon.species.speciesId === Species.TAPU_LELE || pokemon.species.speciesId === Species.TAPU_BULU || pokemon.species.speciesId === Species.TAPU_FINI) { return "battle_legendary_tapu"; } - if (pokemon.species.speciesId === Species.COSMOG || pokemon.species.speciesId === Species.COSMOEM || pokemon.species.speciesId === Species.SOLGALEO || pokemon.species.speciesId === Species.LUNALA) { + if ([ Species.COSMOG, Species.COSMOEM, Species.SOLGALEO, Species.LUNALA ].includes(pokemon.species.speciesId)) { return "battle_legendary_sol_lun"; } if (pokemon.species.speciesId === Species.NECROZMA) { @@ -308,7 +308,7 @@ export default class Battle { return "battle_legendary_ultra_nec"; } } - if (pokemon.species.speciesId === Species.NIHILEGO || pokemon.species.speciesId === Species.BUZZWOLE || pokemon.species.speciesId === Species.PHEROMOSA || pokemon.species.speciesId === Species.XURKITREE || pokemon.species.speciesId === Species.CELESTEELA || pokemon.species.speciesId === Species.KARTANA || pokemon.species.speciesId === Species.GUZZLORD || pokemon.species.speciesId === Species.POIPOLE || pokemon.species.speciesId === Species.NAGANADEL || pokemon.species.speciesId === Species.STAKATAKA || pokemon.species.speciesId === Species.BLACEPHALON) { + if ([ Species.NIHILEGO, Species.BUZZWOLE, Species.PHEROMOSA, Species.XURKITREE, Species.CELESTEELA, Species.KARTANA, Species.GUZZLORD, Species.POIPOLE, Species.NAGANADEL, Species.STAKATAKA, Species.BLACEPHALON ].includes(pokemon.species.speciesId)) { return "battle_legendary_ub"; } if (pokemon.species.speciesId === Species.ZACIAN || pokemon.species.speciesId === Species.ZAMAZENTA) { diff --git a/src/data/ability.ts b/src/data/ability.ts index 40461f72e97..af97151f4b0 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -286,7 +286,7 @@ export class BlockItemTheftAbAttr extends AbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]) { return i18next.t("abilityTriggers:blockItemTheft", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName }); } } @@ -405,7 +405,7 @@ export class TypeImmunityHealAbAttr extends TypeImmunityAbAttr { if (!simulated) { const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(), - Math.max(Math.floor(pokemon.getMaxHp() / 4), 1), i18next.t("abilityTriggers:typeImmunityHeal", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName}), true)); + Math.max(Math.floor(pokemon.getMaxHp() / 4), 1), i18next.t("abilityTriggers:typeImmunityHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }), true)); } } return true; @@ -485,7 +485,7 @@ export class NonSuperEffectiveImmunityAbAttr extends TypeImmunityAbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:nonSuperEffectiveImmunity", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName }); } } @@ -777,7 +777,7 @@ export class PostDefendTypeChangeAbAttr extends PostDefendAbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:postDefendTypeChange", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName, typeName: i18next.t(`pokemonInfo:Type.${Type[pokemon.getTypes(true)[0]]}`) }); } @@ -901,7 +901,7 @@ export class PostDefendContactDamageAbAttr extends PostDefendAbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:postDefendContactDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName }); } } @@ -999,7 +999,7 @@ export class PostDefendAbilityGiveAbAttr extends PostDefendAbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:postDefendAbilityGive", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName }); } } @@ -1083,9 +1083,8 @@ export class MoveEffectChanceMultiplierAbAttr extends AbAttr { * [1]: {@linkcode Moves } Move used by the ability user. */ apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean { - //Disable showAbility during getTargetBenefitScore - const showAbility = args[4]; - this.showAbility = showAbility; + // Disable showAbility during getTargetBenefitScore + this.showAbility = args[4]; if ((args[0] as Utils.NumberHolder).value <= 0 || (args[1] as Move).id === Moves.ORDER_UP) { return false; } @@ -1797,7 +1796,7 @@ export class IntimidateImmunityAbAttr extends AbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:intimidateImmunity", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName }); } } @@ -2354,8 +2353,8 @@ export class ProtectStatAbAttr extends PreStatChangeAbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:protectStat", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, - statName: this.protectedStat !== undefined ? getBattleStatName(this.protectedStat) : "stats", // TODO : Change "stats" to i18next.t("battle:stats") after PR#2600 merged to 'main' + abilityName, + statName: this.protectedStat !== undefined ? getBattleStatName(this.protectedStat) : i18next.t("battle:stats") }); } } @@ -2421,12 +2420,12 @@ export class StatusEffectImmunityAbAttr extends PreSetStatusAbAttr { return this.immuneEffects.length ? i18next.t("abilityTriggers:statusEffectImmunityWithName", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName, statusEffectName: getStatusEffectDescriptor(args[0] as StatusEffect) }) : i18next.t("abilityTriggers:statusEffectImmunity", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName }); } } @@ -2458,7 +2457,7 @@ export class BattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr { getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { return i18next.t("abilityTriggers:battlerTagImmunity", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), - abilityName: abilityName, + abilityName, battlerTagName: (args[0] as BattlerTag).getDescriptor() }); } @@ -2844,7 +2843,7 @@ export class PostWeatherLapseHealAbAttr extends PostWeatherLapseAbAttr { const scene = pokemon.scene; const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(), - Math.max(Math.floor(pokemon.getMaxHp() / (16 / this.healFactor)), 1), i18next.t("abilityTriggers:postWeatherLapseHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }), true)); + Math.max(Math.floor(pokemon.getMaxHp() / (16 / this.healFactor)), 1), i18next.t("abilityTriggers:postWeatherLapseHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }), true)); return true; } @@ -2864,7 +2863,7 @@ export class PostWeatherLapseDamageAbAttr extends PostWeatherLapseAbAttr { applyPostWeatherLapse(pokemon: Pokemon, passive: boolean, weather: Weather, args: any[]): boolean { const scene = pokemon.scene; const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; - scene.queueMessage(i18next.t("abilityTriggers:postWeatherLapseDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName })); + scene.queueMessage(i18next.t("abilityTriggers:postWeatherLapseDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName })); pokemon.damageAndUpdate(Math.ceil(pokemon.getMaxHp() / (16 / this.damageFactor)), HitResult.OTHER); return true; } @@ -2938,7 +2937,7 @@ export class PostTurnStatusHealAbAttr extends PostTurnAbAttr { const scene = pokemon.scene; const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(), - Math.max(Math.floor(pokemon.getMaxHp() / 8), 1), i18next.t("abilityTriggers:poisonHeal", { pokemonName: getPokemonNameWithAffix(pokemon), abilityName: abilityName}), true)); + Math.max(Math.floor(pokemon.getMaxHp() / 8), 1), i18next.t("abilityTriggers:poisonHeal", { pokemonName: getPokemonNameWithAffix(pokemon), abilityName }), true)); return true; } } @@ -3031,10 +3030,11 @@ export class PostTurnLootAbAttr extends PostTurnAbAttr { ) as BerryModifier | undefined; if (!berryModifier) { + const newBerry = new BerryModifier(chosenBerry, pokemon.id, chosenBerryType, 1); if (pokemon.isPlayer()) { - pokemon.scene.addModifier(new BerryModifier(chosenBerry, pokemon.id, chosenBerryType, 1)); + pokemon.scene.addModifier(newBerry); } else { - pokemon.scene.addEnemyModifier(new BerryModifier(chosenBerry, pokemon.id, chosenBerryType, 1)); + pokemon.scene.addEnemyModifier(newBerry); } } else if (berryModifier.stackCount < berryModifier.getMaxHeldItemCount(pokemon)) { berryModifier.stackCount++; @@ -3095,7 +3095,7 @@ export class PostTurnHealAbAttr extends PostTurnAbAttr { const scene = pokemon.scene; const abilityName = (!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name; scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(), - Math.max(Math.floor(pokemon.getMaxHp() / 16), 1), i18next.t("abilityTriggers:postTurnHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }), true)); + Math.max(Math.floor(pokemon.getMaxHp() / 16), 1), i18next.t("abilityTriggers:postTurnHeal", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }), true)); return true; } @@ -3347,7 +3347,7 @@ export class HealFromBerryUseAbAttr extends AbAttr { pokemon.scene, pokemon.getBattlerIndex(), Math.max(Math.floor(pokemon.getMaxHp() * this.healPercent), 1), - i18next.t("abilityTriggers:healFromBerryUse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }), + i18next.t("abilityTriggers:healFromBerryUse", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }), true ) ); @@ -3422,7 +3422,7 @@ export class ArenaTrapAbAttr extends CheckTrappedAbAttr { } getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { - return i18next.t("abilityTriggers:arenaTrap", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }); + return i18next.t("abilityTriggers:arenaTrap", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }); } } @@ -3540,7 +3540,7 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr { } getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { - return i18next.t("abilityTriggers:postFaintContactDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }); + return i18next.t("abilityTriggers:postFaintContactDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }); } } @@ -3560,7 +3560,7 @@ export class PostFaintHPDamageAbAttr extends PostFaintAbAttr { } getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { - return i18next.t("abilityTriggers:postFaintHpDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }); + return i18next.t("abilityTriggers:postFaintHpDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName }); } } @@ -3918,7 +3918,7 @@ export class IceFaceBlockPhysicalAbAttr extends ReceivedMoveDamageMultiplierAbAt * @returns {string} - The trigger message. */ getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string { - return i18next.t("abilityTriggers:iceFaceAvoidedDamage", { pokemonName: getPokemonNameWithAffix(pokemon), abilityName: abilityName }); + return i18next.t("abilityTriggers:iceFaceAvoidedDamage", { pokemonName: getPokemonNameWithAffix(pokemon), abilityName }); } } @@ -3993,7 +3993,7 @@ async function applyAbAttrsInternal( pokemon.scene.setPhaseQueueSplice(); let result = applyFunc(attr, passive); - // TODO Remove this when promises get reworked PR#924 + // TODO Remove this when promises get reworked if (result instanceof Promise) { result = await result; } diff --git a/src/data/battle-stat.ts b/src/data/battle-stat.ts index 47f52b46d94..d70e6655f8c 100644 --- a/src/data/battle-stat.ts +++ b/src/data/battle-stat.ts @@ -1,4 +1,4 @@ -import i18next, {ParseKeys} from "i18next"; +import i18next, { ParseKeys } from "i18next"; export enum BattleStat { ATK, @@ -32,7 +32,7 @@ export function getBattleStatName(stat: BattleStat) { } } -export function getBattleStatLevelChangeDescription(pokemonNameWithAffix: string, stats: string, levels: integer, up: boolean, count: integer = 1) { +export function getBattleStatLevelChangeDescription(pokemonNameWithAffix: string, stats: string, levels: integer, up: boolean, count: number = 1) { const stringKey = (() => { if (up) { switch (levels) { diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 2755fd0bbbe..97c42fed514 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -31,14 +31,14 @@ export enum BattlerTagLapseType { export class BattlerTag { public tagType: BattlerTagType; - public lapseType: BattlerTagLapseType[]; + public lapseTypes: BattlerTagLapseType[]; public turnCount: number; public sourceMove: Moves; public sourceId?: number; constructor(tagType: BattlerTagType, lapseType: BattlerTagLapseType | BattlerTagLapseType[], turnCount: number, sourceMove: Moves, sourceId?: number) { this.tagType = tagType; - this.lapseType = typeof lapseType === "number" ? [ lapseType ] : lapseType; + this.lapseTypes = Array.isArray(lapseType) ? lapseType : [ lapseType ]; this.turnCount = turnCount; this.sourceMove = sourceMove; this.sourceId = sourceId; @@ -650,8 +650,7 @@ export class OctolockTag extends TrappedTag { } canAdd(pokemon: Pokemon): boolean { - const isOctolocked = pokemon.getTag(BattlerTagType.OCTOLOCK); - return !isOctolocked; + return !pokemon.getTag(BattlerTagType.OCTOLOCK); } lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { @@ -1628,8 +1627,8 @@ export class StockpilingTag extends BattlerTag { super.loadTag(source); this.stockpiledCount = source.stockpiledCount || 0; this.statChangeCounts = { - [BattleStat.DEF]: source.statChangeCounts?.[BattleStat.DEF] || 0, - [BattleStat.SPDEF]: source.statChangeCounts?.[BattleStat.SPDEF] || 0, + [ BattleStat.DEF ]: source.statChangeCounts?.[ BattleStat.DEF ] ?? 0, + [ BattleStat.SPDEF ]: source.statChangeCounts?.[ BattleStat.SPDEF ] ?? 0, }; } diff --git a/src/data/challenge.ts b/src/data/challenge.ts index ad8c312bdf6..701183e1733 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -17,6 +17,9 @@ import { Gender } from "./gender"; import { pokemonEvolutions } from "./pokemon-evolutions"; import { pokemonFormChanges } from "./pokemon-forms"; +/** A constant for the default max cost of the starting party before a run */ +const DEFAULT_PARTY_MAX_COST = 10; + /** * An enum for all the challenge types. The parameter entries on these describe the * parameters to use when calling the applyChallenges function. @@ -689,11 +692,11 @@ export class LowerStarterMaxCostChallenge extends Challenge { if (overrideValue === undefined) { overrideValue = this.value; } - return (10 - overrideValue).toString(); + return (DEFAULT_PARTY_MAX_COST - overrideValue).toString(); } applyStarterChoice(pokemon: PokemonSpecies, valid: Utils.BooleanHolder): boolean { - if (speciesStarters[pokemon.speciesId] > 10 - this.value) { + if (speciesStarters[pokemon.speciesId] > DEFAULT_PARTY_MAX_COST - this.value) { valid.value = false; return true; } @@ -723,7 +726,7 @@ export class LowerStarterPointsChallenge extends Challenge { if (overrideValue === undefined) { overrideValue = this.value; } - return (10 - overrideValue).toString(); + return (DEFAULT_PARTY_MAX_COST - overrideValue).toString(); } applyStarterPoints(points: Utils.NumberHolder): boolean { diff --git a/src/data/move.ts b/src/data/move.ts index a2b879a388b..8616c4caf9b 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5825,7 +5825,7 @@ export class ResistLastMoveTypeAttr extends MoveEffectAttr { getCondition(): MoveConditionFunc { return (user, target, move) => { const moveHistory = target.getLastXMoves(); - return !!moveHistory.length; + return moveHistory.length !== 0; }; } } @@ -8691,8 +8691,8 @@ export function initMoves() { new AttackMove(Moves.MALIGNANT_CHAIN, Type.POISON, MoveCategory.SPECIAL, 100, 100, 5, 50, 0, 9) .attr(StatusEffectAttr, StatusEffect.TOXIC) ); - allMoves.map(m=>{ - if (m.getAttrs(StatChangeAttr).some(a=> a.selfTarget && a.levels < 0)) { + allMoves.map(m => { + if (m.getAttrs(StatChangeAttr).some(a => a.selfTarget && a.levels < 0)) { selfStatLowerMoves.push(m.id); } }); diff --git a/src/data/pokemon-forms.ts b/src/data/pokemon-forms.ts index d6fe12a8186..7391a92005f 100644 --- a/src/data/pokemon-forms.ts +++ b/src/data/pokemon-forms.ts @@ -138,7 +138,7 @@ export class SpeciesFormChange { public formKey: string; public trigger: SpeciesFormChangeTrigger; public quiet: boolean; - public conditions: SpeciesFormChangeCondition[]; + public readonly conditions: SpeciesFormChangeCondition[]; constructor(speciesId: Species, preFormKey: string, evoFormKey: string, trigger: SpeciesFormChangeTrigger, quiet: boolean = false, ...conditions: SpeciesFormChangeCondition[]) { this.speciesId = speciesId; @@ -378,7 +378,7 @@ export function getSpeciesFormChangeMessage(pokemon: Pokemon, formChange: Specie /** * Gives a condition for form changing checking if a species is registered as caught in the player's dex data. * Used for fusion forms such as Kyurem and Necrozma. - * @param species + * @param species {@linkcode Species} * @returns A {@linkcode SpeciesFormChangeCondition} checking if that species is registered as caught */ function getSpeciesDependentFormChangeCondition(species: Species): SpeciesFormChangeCondition { diff --git a/src/data/terrain.ts b/src/data/terrain.ts index 507557eaf9f..d0b2fb53d3e 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -61,7 +61,7 @@ export class Terrain { const priority = new Utils.IntegerHolder(move.priority); applyAbAttrs(IncrementMovePriorityAbAttr, user, null, move, priority); // Cancels move if the move has positive priority and targets a Pokemon grounded on the Psychic Terrain - return priority.value > 0 && user.getOpponents().filter(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()).length > 0; + return priority.value > 0 && user.getOpponents().some(o => targets.includes(o.getBattlerIndex()) && o.isGrounded()); } } diff --git a/src/data/type.ts b/src/data/type.ts index cf3bc85ab48..1330eb83f4b 100644 --- a/src/data/type.ts +++ b/src/data/type.ts @@ -505,7 +505,7 @@ export function getTypeDamageMultiplier(attackType: integer, defType: integer): * Retrieve the types resisting a given type * @returns An array populated with Types, or an empty array if no resistances exist (Unknown or Stellar type) */ -export function getTypeResistances(type: integer): Type[] { +export function getTypeResistances(type: number): Type[] { switch (type) { case Type.NORMAL: return [Type.ROCK, Type.STEEL, Type.GHOST]; diff --git a/src/field/arena.ts b/src/field/arena.ts index 7d1046986a5..efbcdcd6727 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -638,7 +638,9 @@ export class Arena { } } - /** Clears terrain and arena tags when entering new biome or trainer battle. */ + /** + * Clears terrain and arena tags when entering new biome or trainer battle. + */ resetArenaEffects(): void { this.trySetTerrain(TerrainType.NONE, false, true); this.removeAllTags(); diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index f630cc16a48..7f6c8d11e31 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1241,14 +1241,12 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } const immuneTags = this.findTags(tag => tag instanceof TypeImmuneTag && tag.immuneType === moveType); - immuneTags.forEach(tag => { - if (move !== undefined) { - const hitsTagAttrs = move.getAttrs(HitsTagAttr).filter(attr => attr.tagType === tag.tagType); - if (hitsTagAttrs.length === 0) { - multiplier = 0; - } + for (const tag of immuneTags) { + if (move && !move.getAttrs(HitsTagAttr).some(attr => attr.tagType === tag.tagType)) { + multiplier = 0; + break; } - }); + } return multiplier; } @@ -1949,7 +1947,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } const targetCount = getMoveTargets(source, move.id).targets.length; - const targetMultiplier = targetCount > 1 ? 0.75 : 1; + const targetMultiplier = targetCount > 1 ? 0.75 : 1; // 25% damage debuff on multi-target hits (even if it's immune) applyMoveAttrs(VariableAtkAttr, source, this, move, sourceAtk); applyMoveAttrs(VariableDefAttr, source, this, move, targetDef); @@ -2282,7 +2280,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { lapseTags(lapseType: BattlerTagLapseType): void { const tags = this.summonData.tags; - tags.filter(t => lapseType === BattlerTagLapseType.FAINT || ((t.lapseType.some(lType => lType === lapseType)) && !(t.lapse(this, lapseType)))).forEach(t => { + tags.filter(t => lapseType === BattlerTagLapseType.FAINT || ((t.lapseTypes.some(lType => lType === lapseType)) && !(t.lapse(this, lapseType)))).forEach(t => { t.onRemove(this); tags.splice(tags.indexOf(t), 1); }); diff --git a/src/modifier/modifier-type.ts b/src/modifier/modifier-type.ts index fb2264fab8f..78af578c312 100644 --- a/src/modifier/modifier-type.ts +++ b/src/modifier/modifier-type.ts @@ -572,7 +572,7 @@ export class PokemonLevelIncrementModifierType extends PokemonModifierType { if (hasCandyJar) { levels += hasCandyJar.stackCount; } - return i18next.t("modifierType:ModifierType.PokemonLevelIncrementModifierType.description", {levels }); + return i18next.t("modifierType:ModifierType.PokemonLevelIncrementModifierType.description", { levels }); } } @@ -1569,7 +1569,7 @@ const modifierPool: ModifierPool = { p => !p.getHeldItems().some(i => i instanceof Modifiers.PokemonResetNegativeStatStageModifier && i.stackCount >= i.getMaxHeldItemCount(p)) && (checkedAbilities.some(a => p.hasAbility(a, false, true)) || p.getMoveset(true).some(m => selfStatLowerMoves.includes(m.moveId)))).length; // If a party member has one of the above moves or abilities and doesn't have max herbs, the herb will appear more frequently - return 3*(weightMultiplier? 2: 1)+(weightMultiplier? weightMultiplier-1: 0); + return 3 * (weightMultiplier ? 2: 1) + (weightMultiplier ? weightMultiplier - 1 : 0); }, 10), new WeightedModifierType(modifierTypes.REVIVER_SEED, 4), new WeightedModifierType(modifierTypes.CANDY_JAR, 5), diff --git a/src/phases.ts b/src/phases.ts index 15fd1975d1c..ceefc34ba17 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1588,8 +1588,6 @@ export class SwitchSummonPhase extends SummonPhase { } } - // if doReturn === False OR slotIndex !== -1 (slotIndex is valid) and the pokemon doesn't exist/is false - // then switchAndSummon(), manually pick pokemon to switch into if (!this.doReturn || (this.slotIndex !== -1 && !(this.player ? this.scene.getParty() : this.scene.getEnemyParty())[this.slotIndex])) { if (this.player) { return this.switchAndSummon(); @@ -3321,7 +3319,7 @@ export class StatChangePhase extends PokemonPhase { applyPostStatChangeAbAttrs(PostStatChangeAbAttr, pokemon, filteredStats, this.levels, this.selfTarget); - //Look for any other stat change phases; if this is the last one, do White Herb check + // Look for any other stat change phases; if this is the last one, do White Herb check const existingPhase = this.scene.findPhase(p => p instanceof StatChangePhase && p.battlerIndex === this.battlerIndex); if (!(existingPhase instanceof StatChangePhase)) { // Apply White Herb if needed