diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index e0d308c55fb..5e5246269a3 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -732,10 +732,11 @@ export abstract class PokemonHeldItemModifier extends PersistentModifier { if (!pokemon.getLastXMoves()[0]) { return 1; } - const sheerForceAffected = pokemon.hasAbility(Abilities.SHEER_FORCE, true); + const sheerForceAffected = allMoves[pokemon.getLastXMoves()[0].move].chance >= 0 && pokemon.hasAbility(Abilities.SHEER_FORCE); + if (sheerForceAffected) { return 0; - } else if (pokemon.hasAbility(Abilities.SERENE_GRACE, true)) { + } else if (pokemon.hasAbility(Abilities.SERENE_GRACE)) { return 2; } return 1; @@ -1367,7 +1368,6 @@ export class SpeciesStatBoosterModifier extends StatBoosterModifier { /** * Modifier used for held items that apply critical-hit stage boost(s). - * Example: Scope Lens * @extends PokemonHeldItemModifier * @see {@linkcode apply} */ @@ -1403,10 +1403,7 @@ export class CritBoosterModifier extends PokemonHeldItemModifier { * @param critStage {@linkcode NumberHolder} that holds the resulting critical-hit level * @returns always `true` */ - override apply(pokemon: Pokemon, critStage: NumberHolder): boolean { - if (super.getSecondaryChanceMultiplier(pokemon) === 0) { - return false; - } + override apply(_pokemon: Pokemon, critStage: NumberHolder): boolean { critStage.value += this.stageIncrement; return true; } @@ -1419,7 +1416,6 @@ export class CritBoosterModifier extends PokemonHeldItemModifier { /** * Modifier used for held items that apply critical-hit stage boost(s) * if the holder is of a specific {@linkcode Species}. - * Example: Leek-FarFetch'd line * @extends CritBoosterModifier * @see {@linkcode shouldApply} */ @@ -1453,7 +1449,7 @@ export class SpeciesCritBoosterModifier extends CritBoosterModifier { * @returns `true` if the critical-hit level can be incremented, false otherwise */ override shouldApply(pokemon: Pokemon, critStage: NumberHolder): boolean { - return super.shouldApply(pokemon, critStage) && super.getSecondaryChanceMultiplier(pokemon) !== 0 && (this.species.includes(pokemon.getSpeciesForm(true).speciesId) || (pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId))); + return super.shouldApply(pokemon, critStage) && (this.species.includes(pokemon.getSpeciesForm(true).speciesId) || (pokemon.isFusion() && this.species.includes(pokemon.getFusionSpeciesForm(true).speciesId))); } } @@ -1754,9 +1750,6 @@ export class TurnStatusEffectModifier extends PokemonHeldItemModifier { } } -/** - * Modifier class associated with items like Shell Bell - */ export class HitHealModifier extends PokemonHeldItemModifier { constructor(type: ModifierType, pokemonId: number, stackCount?: number) { super(type, pokemonId, stackCount); @@ -1776,14 +1769,12 @@ export class HitHealModifier extends PokemonHeldItemModifier { * @returns `true` if the {@linkcode Pokemon} was healed */ override apply(pokemon: Pokemon): boolean { - if (this.getSecondaryChanceMultiplier(pokemon) === 0) { - return false; - } if (pokemon.turnData.totalDamageDealt && !pokemon.isFullHp()) { const scene = pokemon.scene; scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.getBattlerIndex(), toDmgValue(pokemon.turnData.totalDamageDealt / 8) * this.stackCount, i18next.t("modifier:hitHealApply", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), typeName: this.type.name }), true)); } + return true; } @@ -2625,9 +2616,6 @@ export class PokemonNatureWeightModifier extends PokemonHeldItemModifier { } } -/** - * This class is associated with accuracy-boosting held items such as Wide Lens. - */ export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier { public override type: PokemonMoveAccuracyBoosterModifierType; private accuracyAmount: number; @@ -2669,10 +2657,7 @@ export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier * @param moveAccuracy {@linkcode NumberHolder} holding the move accuracy boost * @returns always `true` */ - override apply(pokemon: Pokemon, moveAccuracy: NumberHolder): boolean { - if (super.getSecondaryChanceMultiplier(pokemon)) { - return false; - } + override apply(_pokemon: Pokemon, moveAccuracy: NumberHolder): boolean { moveAccuracy.value = Math.min(moveAccuracy.value + this.accuracyAmount * this.getStackCount(), 100); return true; @@ -2683,9 +2668,6 @@ export class PokemonMoveAccuracyBoosterModifier extends PokemonHeldItemModifier } } -/** - * This class is associated with items like Multi-Lens - */ export class PokemonMultiHitModifier extends PokemonHeldItemModifier { public override type: PokemonMultiHitModifierType; @@ -2710,9 +2692,6 @@ export class PokemonMultiHitModifier extends PokemonHeldItemModifier { * @returns always `true` */ override apply(pokemon: Pokemon, moveId: Moves, count: NumberHolder | null = null, damageMultiplier: NumberHolder | null = null): boolean { - if (super.getSecondaryChanceMultiplier(pokemon) === 0) { - return false; - } const move = allMoves[moveId]; /** * The move must meet Parental Bond's restrictions for this item @@ -2880,9 +2859,6 @@ export class MoneyMultiplierModifier extends PersistentModifier { } } -/** - * Class associated with items like Golden Punch - */ export class DamageMoneyRewardModifier extends PokemonHeldItemModifier { constructor(type: ModifierType, pokemonId: number, stackCount?: number) { super(type, pokemonId, stackCount); @@ -2903,9 +2879,6 @@ export class DamageMoneyRewardModifier extends PokemonHeldItemModifier { * @returns always `true` */ override apply(pokemon: Pokemon, multiplier: NumberHolder): boolean { - if (super.getSecondaryChanceMultiplier(pokemon) === 0) { - return false; - } const battleScene = pokemon.scene; const moneyAmount = new NumberHolder(Math.floor(multiplier.value * (0.5 * this.getStackCount()))); battleScene.applyModifiers(MoneyMultiplierModifier, true, moneyAmount); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index e8908fc0586..51824d21fbe 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -153,23 +153,5 @@ describe("Abilities - Sheer Force", () => { expect(formKeyStart).toBe(playerPokemon?.getFormKey()); }); - it("Sheer Force should disable healing from Shell Bell", async () => { - game.override - .ability(Abilities.SHEER_FORCE) - .moveset([ Moves.TACKLE ]) - .enemySpecies(Species.GEODUDE) - .enemyMoveset([ Moves.TACKLE ]) - .startingHeldItems([{ name: "SHELL_BELL", count: 1 }]); - - await game.classicMode.startBattle([ Species.SHUCKLE ]); - const playerPokemon = game.scene.getPlayerPokemon(); - game.move.select(Moves.TACKLE); - await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]); - await game.phaseInterceptor.to("MoveEndPhase"); - const postAttackHp = playerPokemon?.hp; - await game.phaseInterceptor.to("TurnEndPhase"); - expect(playerPokemon?.hp).toBe(postAttackHp); - }); - //TODO King's Rock Interaction Unit Test });