From 222bc8d42875485742ba8bd38fa5e9b978bbd53a Mon Sep 17 00:00:00 2001 From: frutescens Date: Sun, 17 Nov 2024 11:13:24 -0800 Subject: [PATCH] Applied new modifier class. --- src/modifier/modifier.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/modifier/modifier.ts b/src/modifier/modifier.ts index c2d863c2306..69973986c7d 100644 --- a/src/modifier/modifier.ts +++ b/src/modifier/modifier.ts @@ -766,11 +766,11 @@ export class MoveEffectModifier extends PokemonHeldItemModifier { } shouldApply(pokemon?: Pokemon, ..._args: unknown[]): boolean { - return pokemon?.hasAbility(Abilities.SHEER_FORCE, true) ?? false; + return !pokemon?.hasAbility(Abilities.SHEER_FORCE, true); } - apply(pokemon: Pokemon): boolean { - return this.apply(pokemon); + apply(pokemon: Pokemon, ...args: unknown[]): boolean { + return this.apply(pokemon, args); } getMaxHeldItemCount(pokemon?: Pokemon): number { @@ -1789,6 +1789,10 @@ export class HitHealModifier extends MoveEffectModifier { return new HitHealModifier(this.type, this.pokemonId, this.stackCount); } + override shouldApply(pokemon?: Pokemon, ...args: unknown[]): boolean { + return super.shouldApply(pokemon, ...args); + } + /** * Applies {@linkcode HitHealModifier} * @param pokemon The {@linkcode Pokemon} that holds the item @@ -2877,7 +2881,10 @@ export class MoneyMultiplierModifier extends PersistentModifier { } } -export class DamageMoneyRewardModifier extends PokemonHeldItemModifier { +/** + * Modifier class for items like Golden Punch + */ +export class DamageMoneyRewardModifier extends MoveEffectModifier { constructor(type: ModifierType, pokemonId: number, stackCount?: number) { super(type, pokemonId, stackCount); } @@ -3313,6 +3320,10 @@ export class ContactHeldItemTransferChanceModifier extends HeldItemTransferModif return super.getArgs().concat(this.chance * 100); } + shouldApply(pokemon?: Pokemon, ..._args: unknown[]): boolean { + return !pokemon?.hasAbility(Abilities.SHEER_FORCE, true); + } + getTransferredItemCount(): number { return Phaser.Math.RND.realInRange(0, 1) < (this.chance * this.getStackCount()) ? 1 : 0; }