Applied new modifier class.

This commit is contained in:
frutescens 2024-11-17 11:13:24 -08:00
parent 0e57ed03ff
commit 222bc8d428

View File

@ -766,11 +766,11 @@ export class MoveEffectModifier extends PokemonHeldItemModifier {
} }
shouldApply(pokemon?: Pokemon, ..._args: unknown[]): boolean { 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 { apply(pokemon: Pokemon, ...args: unknown[]): boolean {
return this.apply(pokemon); return this.apply(pokemon, args);
} }
getMaxHeldItemCount(pokemon?: Pokemon): number { getMaxHeldItemCount(pokemon?: Pokemon): number {
@ -1789,6 +1789,10 @@ export class HitHealModifier extends MoveEffectModifier {
return new HitHealModifier(this.type, this.pokemonId, this.stackCount); return new HitHealModifier(this.type, this.pokemonId, this.stackCount);
} }
override shouldApply(pokemon?: Pokemon, ...args: unknown[]): boolean {
return super.shouldApply(pokemon, ...args);
}
/** /**
* Applies {@linkcode HitHealModifier} * Applies {@linkcode HitHealModifier}
* @param pokemon The {@linkcode Pokemon} that holds the item * @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) { constructor(type: ModifierType, pokemonId: number, stackCount?: number) {
super(type, pokemonId, stackCount); super(type, pokemonId, stackCount);
} }
@ -3313,6 +3320,10 @@ export class ContactHeldItemTransferChanceModifier extends HeldItemTransferModif
return super.getArgs().concat(this.chance * 100); return super.getArgs().concat(this.chance * 100);
} }
shouldApply(pokemon?: Pokemon, ..._args: unknown[]): boolean {
return !pokemon?.hasAbility(Abilities.SHEER_FORCE, true);
}
getTransferredItemCount(): number { getTransferredItemCount(): number {
return Phaser.Math.RND.realInRange(0, 1) < (this.chance * this.getStackCount()) ? 1 : 0; return Phaser.Math.RND.realInRange(0, 1) < (this.chance * this.getStackCount()) ? 1 : 0;
} }