diff --git a/src/battle-scene.ts b/src/battle-scene.ts index 0d321c0a240..25723999510 100644 --- a/src/battle-scene.ts +++ b/src/battle-scene.ts @@ -15,7 +15,7 @@ import { TextStyle, addTextObject, getTextColor } from "./ui/text"; import { allMoves } from "./data/move"; import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getModifierType, getPartyLuckValue, modifierTypes } from "./modifier/modifier-type"; import AbilityBar from "./ui/ability-bar"; -import { BlockItemTheftAbAttr, BonusItemChance, DoubleBattleChanceAbAttr, ChangeMovePriorityAbAttr, PostBattleInitAbAttr, applyAbAttrs, applyPostBattleInitAbAttrs } from "./data/ability"; +import { BlockItemTheftAbAttr, BonusItemChanceAbAttr, DoubleBattleChanceAbAttr, ChangeMovePriorityAbAttr, PostBattleInitAbAttr, applyAbAttrs, applyPostBattleInitAbAttrs } from "./data/ability"; import { allAbilities } from "./data/ability"; import Battle, { BattleType, FixedBattleConfig } from "./battle"; import { GameMode, GameModes, getGameMode } from "./game-mode"; @@ -2467,7 +2467,7 @@ export default class BattleScene extends SceneBase { const difficultyWaveIndex = this.gameMode.getWaveForDifficulty(this.currentBattle.waveIndex); const isFinalBoss = this.gameMode.isWaveFinal(this.currentBattle.waveIndex); let chances = Math.ceil(difficultyWaveIndex / 10); - if (this.getPlayerPokemon().getAbility().hasAttr(BonusItemChance) || this.getPlayerPokemon().getPassiveAbility().hasAttr(BonusItemChance)) { + if (this.getPlayerPokemon()?.getAbility().hasAttr(BonusItemChanceAbAttr) || this.getPlayerPokemon()?.getPassiveAbility().hasAttr(BonusItemChanceAbAttr)) { chances += Math.floor(chances * 1.2); } if (isFinalBoss) { diff --git a/src/data/ability.ts b/src/data/ability.ts index 816d5cdb776..a6b19f8c919 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2794,12 +2794,12 @@ export class BonusCritAbAttr extends AbAttr { * If an ability has this tag, it will increase the chance of items by 20%. * This is used in battle-scene.ts in generateEnemyModifiers. */ -export class BonusItemChance extends AbAttr { +export class BonusItemChanceAbAttr extends AbAttr { constructor() { super(false); } - apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise { + apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder | null, args: any[]): boolean | Promise { return true; } } @@ -4817,7 +4817,7 @@ export function initAbilities() { .attr(PostFaintUnsuppressedWeatherFormChangeAbAttr) .bypassFaint(), new Ability(Abilities.COMPOUND_EYES, 3) - .attr(BonusItemChance) + .attr(BonusItemChanceAbAttr) .attr(StatMultiplierAbAttr, Stat.ACC, 1.3), new Ability(Abilities.INSOMNIA, 3) .attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP) @@ -5103,7 +5103,7 @@ export function initAbilities() { .attr(MoveAbilityBypassAbAttr), new Ability(Abilities.SUPER_LUCK, 4) .attr(BonusCritAbAttr) - .attr(BonusItemChance), + .attr(BonusItemChanceAbAttr), new Ability(Abilities.AFTERMATH, 4) .attr(PostFaintContactDamageAbAttr, 4) .bypassFaint(),