From 56be31e548d6cbf59e39209563716af10d53c730 Mon Sep 17 00:00:00 2001 From: frutescens Date: Tue, 19 Nov 2024 10:15:04 -0800 Subject: [PATCH] Removed Serene Grace factor from modifier. --- src/modifier/modifier.ts | 16 +--------------- src/test/abilities/serene_grace.test.ts | 19 ------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index a92105f1b94..7ab09482f4b 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -18,7 +18,6 @@ import type { VoucherType } from "#app/system/voucher"; import { Command } from "#app/ui/command-ui-handler"; import { addTextObject, TextStyle } from "#app/ui/text"; import { BooleanHolder, hslToHex, isNullOrUndefined, NumberHolder, toDmgValue } from "#app/utils"; -import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#enums/battler-tag-type"; import { BerryType } from "#enums/berry-type"; import { Moves } from "#enums/moves"; @@ -1624,18 +1623,6 @@ export class FlinchChanceModifier extends PokemonHeldItemModifier { return super.shouldApply(pokemon, flinched) && !!flinched; } - /** - * Checks for any chance modifying abilities - * @param pokemon - * @returns `2` if the pokemon involved has a Serene Grace-like ability | `1` if it does not - */ - getSecondaryChanceMultiplier(pokemon: Pokemon): number { - if (pokemon.hasAbility(Abilities.SERENE_GRACE)) { - return 2; - } - return 1; - } - /** * Applies {@linkcode FlinchChanceModifier} * @param pokemon the {@linkcode Pokemon} that holds the item @@ -1644,8 +1631,7 @@ export class FlinchChanceModifier extends PokemonHeldItemModifier { */ override apply(pokemon: Pokemon, flinched: BooleanHolder): boolean { // The check for pokemon.battleSummonData is to ensure that a crash doesn't occur when a Pokemon with King's Rock procs a flinch - const secondaryChanceMultiplier = pokemon.battleSummonData ? this.getSecondaryChanceMultiplier(pokemon) : 1; - if (!flinched.value && pokemon.randSeedInt(100) < (this.getStackCount() * secondaryChanceMultiplier * this.chance)) { + if (!flinched.value && pokemon.randSeedInt(100) < (this.getStackCount() * this.chance)) { flinched.value = true; return true; } diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index 6ba56d1a594..a19b5c82546 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -7,8 +7,6 @@ import Phaser from "phaser"; import { allMoves } from "#app/data/move"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { FlinchAttr } from "#app/data/move"; -import { FlinchChanceModifier } from "#app/modifier/modifier"; - describe("Abilities - Serene Grace", () => { let phaserGame: Phaser.Game; @@ -48,21 +46,4 @@ describe("Abilities - Serene Grace", () => { expect(airSlashFlinchAttr.getMoveChance).toHaveLastReturnedWith(60); }); - - it("Serene Grace should double the chance of King Rock's activating", async () => { - game.override - .startingHeldItems([{ name: "KINGS_ROCK", count: 1 }]); - - await game.classicMode.startBattle([ Species.SHUCKLE ]); - - const kingsRockInstance = game.scene.findModifier(m => m instanceof FlinchChanceModifier) as FlinchChanceModifier; - vi.spyOn(kingsRockInstance, "getSecondaryChanceMultiplier"); - - game.move.select(Moves.TACKLE); - await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]); - await game.move.forceHit(); - await game.phaseInterceptor.to("BerryPhase"); - - expect(kingsRockInstance.getSecondaryChanceMultiplier).toHaveLastReturnedWith(2); - }); });