Removed Serene Grace factor from modifier.
This commit is contained in:
parent
e9f4226939
commit
56be31e548
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue