From 580d03972e9fce603b65d45ee56714a0842de5ff Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 8 Sep 2024 22:31:05 -0700 Subject: [PATCH] Add `simulated` support --- src/data/ability.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 343183ba2b8..0073306eb4b 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -1761,7 +1761,7 @@ export class PostSetStatusAbAttr extends AbAttr { * @param args Set of unique arguments needed by this attribute. * @returns `true` if application of the ability succeeds. */ - applyPostSetStatus(pokemon: Pokemon, sourcePokemon: Pokemon | null = null, passive: boolean, effect: StatusEffect, args: any[]) : boolean | Promise { + applyPostSetStatus(pokemon: Pokemon, sourcePokemon: Pokemon | null = null, passive: boolean, effect: StatusEffect, simulated: boolean, args: any[]) : boolean | Promise { return false; } } @@ -1782,7 +1782,7 @@ export class SynchronizeStatusAbAttr extends PostSetStatusAbAttr { * @param args Set of unique arguments needed by this attribute. * @returns `true` if application of the ability succeeds. */ - override applyPostSetStatus(pokemon: Pokemon, sourcePokemon: Pokemon | null = null, passive: boolean, effect: StatusEffect, args: any[]): boolean { + override applyPostSetStatus(pokemon: Pokemon, sourcePokemon: Pokemon | null = null, passive: boolean, effect: StatusEffect, simulated:boolean, args: any[]): boolean { /** Synchronizable statuses */ const syncStatuses = new Set([ StatusEffect.BURN, @@ -1792,7 +1792,9 @@ export class SynchronizeStatusAbAttr extends PostSetStatusAbAttr { ]); if (sourcePokemon && syncStatuses.has(effect)) { - sourcePokemon.trySetStatus(effect, true, pokemon); + if (!simulated) { + sourcePokemon.trySetStatus(effect, true, pokemon); + } return true; } @@ -4663,8 +4665,8 @@ export function applyStatMultiplierAbAttrs(attrType: Constructor(attrType, pokemon, (attr, passive) => attr.applyStatStage(pokemon, passive, simulated, stat, statValue, args), args); } export function applyPostSetStatusAbAttrs(attrType: Constructor, - pokemon: Pokemon, effect: StatusEffect, sourcePokemon?: Pokemon | null, ...args: any[]): Promise { - return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyPostSetStatus(pokemon, sourcePokemon, passive, effect, args), args); + pokemon: Pokemon, effect: StatusEffect, sourcePokemon?: Pokemon | null, simulated: boolean = false, ...args: any[]): Promise { + return applyAbAttrsInternal(attrType, pokemon, (attr, passive) => attr.applyPostSetStatus(pokemon, sourcePokemon, passive, effect, simulated, args), args); } /**