Remove ability display from abilities that shouldn't have it

This commit is contained in:
Dean 2025-02-21 12:32:38 -08:00
parent 77c37f6cd7
commit 5413332818

View File

@ -200,6 +200,10 @@ export abstract class AbAttr {
} }
export class BlockRecoilDamageAttr extends AbAttr { export class BlockRecoilDamageAttr extends AbAttr {
constructor() {
super(false);
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void { override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void {
cancelled.value = true; cancelled.value = true;
} }
@ -335,6 +339,9 @@ export class BlockItemTheftAbAttr extends AbAttr {
} }
export class StabBoostAbAttr extends AbAttr { export class StabBoostAbAttr extends AbAttr {
constructor() {
super(false);
}
override canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { override canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
return (args[0] as Utils.NumberHolder).value > 1; return (args[0] as Utils.NumberHolder).value > 1;
@ -349,8 +356,8 @@ export class ReceivedMoveDamageMultiplierAbAttr extends PreDefendAbAttr {
protected condition: PokemonDefendCondition; protected condition: PokemonDefendCondition;
private damageMultiplier: number; private damageMultiplier: number;
constructor(condition: PokemonDefendCondition, damageMultiplier: number) { constructor(condition: PokemonDefendCondition, damageMultiplier: number, showAbility: boolean = true) {
super(); super(showAbility);
this.condition = condition; this.condition = condition;
this.damageMultiplier = damageMultiplier; this.damageMultiplier = damageMultiplier;
@ -390,7 +397,7 @@ export class AlliedFieldDamageReductionAbAttr extends PreDefendAbAttr {
export class ReceivedTypeDamageMultiplierAbAttr extends ReceivedMoveDamageMultiplierAbAttr { export class ReceivedTypeDamageMultiplierAbAttr extends ReceivedMoveDamageMultiplierAbAttr {
constructor(moveType: Type, damageMultiplier: number) { constructor(moveType: Type, damageMultiplier: number) {
super((target, user, move) => user.getMoveType(move) === moveType, damageMultiplier); super((target, user, move) => user.getMoveType(move) === moveType, damageMultiplier, false);
} }
} }
@ -405,7 +412,7 @@ export class TypeImmunityAbAttr extends PreDefendAbAttr {
private condition: AbAttrCondition | null; private condition: AbAttrCondition | null;
constructor(immuneType: Type | null, condition?: AbAttrCondition) { constructor(immuneType: Type | null, condition?: AbAttrCondition) {
super(); super(true);
this.immuneType = immuneType; this.immuneType = immuneType;
this.condition = condition ?? null; this.condition = condition ?? null;
@ -595,8 +602,15 @@ export class FullHpResistTypeAbAttr extends PreDefendAbAttr {
} }
export class PostDefendAbAttr extends AbAttr { export class PostDefendAbAttr extends AbAttr {
canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean { canApplyPostDefend(
return false; pokemon: Pokemon,
passive: boolean,
simulated: boolean,
attacker: Pokemon,
move: Move,
hitResult: HitResult | null,
args: any[]): boolean {
return true;
} }
applyPostDefend( applyPostDefend(
@ -672,6 +686,10 @@ export class MoveImmunityAbAttr extends PreDefendAbAttr {
*/ */
export class WonderSkinAbAttr extends PreDefendAbAttr { export class WonderSkinAbAttr extends PreDefendAbAttr {
constructor() {
super(false);
}
override canApplyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder | null, args: any[]): boolean { override canApplyPreDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, cancelled: Utils.BooleanHolder | null, args: any[]): boolean {
const moveAccuracy = args[0] as Utils.NumberHolder; const moveAccuracy = args[0] as Utils.NumberHolder;
return move.category === MoveCategory.STATUS && moveAccuracy.value >= 50; return move.category === MoveCategory.STATUS && moveAccuracy.value >= 50;
@ -893,7 +911,7 @@ export class PostDefendContactApplyStatusEffectAbAttr extends PostDefendAbAttr {
private effects: StatusEffect[]; private effects: StatusEffect[];
constructor(chance: number, ...effects: StatusEffect[]) { constructor(chance: number, ...effects: StatusEffect[]) {
super(); super(true);
this.chance = chance; this.chance = chance;
this.effects = effects; this.effects = effects;
@ -1189,7 +1207,7 @@ export class MoveEffectChanceMultiplierAbAttr extends AbAttr {
private chanceMultiplier: number; private chanceMultiplier: number;
constructor(chanceMultiplier: number) { constructor(chanceMultiplier: number) {
super(true); super(false);
this.chanceMultiplier = chanceMultiplier; this.chanceMultiplier = chanceMultiplier;
} }
@ -1296,7 +1314,7 @@ export class MoveTypeChangeAbAttr extends PreAttackAbAttr {
private powerMultiplier: number, private powerMultiplier: number,
private condition?: PokemonAttackCondition private condition?: PokemonAttackCondition
) { ) {
super(true); super(false);
} }
override canApplyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon | null, move: Move, args: any[]): boolean { override canApplyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon | null, move: Move, args: any[]): boolean {
@ -1414,7 +1432,7 @@ export class DamageBoostAbAttr extends PreAttackAbAttr {
private condition: PokemonAttackCondition; private condition: PokemonAttackCondition;
constructor(damageMultiplier: number, condition: PokemonAttackCondition) { constructor(damageMultiplier: number, condition: PokemonAttackCondition) {
super(true); super(false);
this.damageMultiplier = damageMultiplier; this.damageMultiplier = damageMultiplier;
this.condition = condition; this.condition = condition;
} }
@ -1458,7 +1476,7 @@ export class MovePowerBoostAbAttr extends VariableMovePowerAbAttr {
export class MoveTypePowerBoostAbAttr extends MovePowerBoostAbAttr { export class MoveTypePowerBoostAbAttr extends MovePowerBoostAbAttr {
constructor(boostedType: Type, powerMultiplier?: number) { constructor(boostedType: Type, powerMultiplier?: number) {
super((pokemon, defender, move) => pokemon?.getMoveType(move) === boostedType, powerMultiplier || 1.5); super((pokemon, defender, move) => pokemon?.getMoveType(move) === boostedType, powerMultiplier || 1.5, false);
} }
} }
@ -1782,7 +1800,7 @@ export class PostAttackApplyStatusEffectAbAttr extends PostAttackAbAttr {
return false; return false;
} }
applyPostAttackAfterMoveTypeCheck(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): void { applyPostAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): void {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
attacker.trySetStatus(effect, true, pokemon); attacker.trySetStatus(effect, true, pokemon);
} }
@ -1801,17 +1819,23 @@ export class PostAttackApplyBattlerTagAbAttr extends PostAttackAbAttr {
constructor(contactRequired: boolean, chance: (user: Pokemon, target: Pokemon, move: Move) => number, ...effects: BattlerTagType[]) { constructor(contactRequired: boolean, chance: (user: Pokemon, target: Pokemon, move: Move) => number, ...effects: BattlerTagType[]) {
super(); super(undefined, false);
this.contactRequired = contactRequired; this.contactRequired = contactRequired;
this.chance = chance; this.chance = chance;
this.effects = effects; this.effects = effects;
} }
applyPostAttackAfterMoveTypeCheck(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): void { override canApplyPostAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean {
/**Battler tags inflicted by abilities post attacking are also considered additional effects.*/ /**Battler tags inflicted by abilities post attacking are also considered additional effects.*/
if (!attacker.hasAbilityWithAttr(IgnoreMoveEffectsAbAttr) && pokemon !== attacker && (!this.contactRequired || move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) return super.canApplyPostAttack(pokemon, passive, simulated, attacker, move, hitResult, args) &&
&& pokemon.randSeedInt(100) < this.chance(attacker, pokemon, move) && !pokemon.status && !simulated) { !attacker.hasAbilityWithAttr(IgnoreMoveEffectsAbAttr) && pokemon !== attacker &&
(!this.contactRequired || move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)) &&
pokemon.randSeedInt(100) < this.chance(attacker, pokemon, move) && !pokemon.status;
}
override applyPostAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult, args: any[]): void {
if (!simulated) {
const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)]; const effect = this.effects.length === 1 ? this.effects[0] : this.effects[pokemon.randSeedInt(this.effects.length)];
attacker.addTag(effect); attacker.addTag(effect);
} }
@ -2708,8 +2732,8 @@ export class CommanderAbAttr extends AbAttr {
} }
export class PreSwitchOutAbAttr extends AbAttr { export class PreSwitchOutAbAttr extends AbAttr {
constructor() { constructor(showAbility: boolean = true) {
super(true); super(showAbility);
} }
canApplyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { canApplyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
@ -2720,6 +2744,10 @@ export class PreSwitchOutAbAttr extends AbAttr {
} }
export class PreSwitchOutResetStatusAbAttr extends PreSwitchOutAbAttr { export class PreSwitchOutResetStatusAbAttr extends PreSwitchOutAbAttr {
constructor() {
super(false);
}
override canApplyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { override canApplyPreSwitchOut(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
return !Utils.isNullOrUndefined(pokemon.status); return !Utils.isNullOrUndefined(pokemon.status);
} }
@ -3137,7 +3165,7 @@ export class PreApplyBattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
private battlerTag: BattlerTag; private battlerTag: BattlerTag;
constructor(immuneTagTypes: BattlerTagType | BattlerTagType[]) { constructor(immuneTagTypes: BattlerTagType | BattlerTagType[]) {
super(); super(true);
this.immuneTagTypes = Array.isArray(immuneTagTypes) ? immuneTagTypes : [ immuneTagTypes ]; this.immuneTagTypes = Array.isArray(immuneTagTypes) ? immuneTagTypes : [ immuneTagTypes ];
} }
@ -3174,12 +3202,19 @@ export class BattlerTagImmunityAbAttr extends PreApplyBattlerTagImmunityAbAttr {
export class UserFieldBattlerTagImmunityAbAttr extends PreApplyBattlerTagImmunityAbAttr { } export class UserFieldBattlerTagImmunityAbAttr extends PreApplyBattlerTagImmunityAbAttr { }
export class BlockCritAbAttr extends AbAttr { export class BlockCritAbAttr extends AbAttr {
constructor() {
super(false);
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void { override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void {
(args[0] as Utils.BooleanHolder).value = true; (args[0] as Utils.BooleanHolder).value = true;
} }
} }
export class BonusCritAbAttr extends AbAttr { export class BonusCritAbAttr extends AbAttr {
constructor() {
super(false);
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void { override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void {
(args[0] as Utils.BooleanHolder).value = true; (args[0] as Utils.BooleanHolder).value = true;
} }
@ -3189,7 +3224,7 @@ export class MultCritAbAttr extends AbAttr {
public multAmount: number; public multAmount: number;
constructor(multAmount: number) { constructor(multAmount: number) {
super(true); super(false);
this.multAmount = multAmount; this.multAmount = multAmount;
} }
@ -3214,7 +3249,7 @@ export class ConditionalCritAbAttr extends AbAttr {
private condition: PokemonAttackCondition; private condition: PokemonAttackCondition;
constructor(condition: PokemonAttackCondition, checkUser?: Boolean) { constructor(condition: PokemonAttackCondition, checkUser?: Boolean) {
super(); super(false);
this.condition = condition; this.condition = condition;
} }
@ -3237,6 +3272,10 @@ export class ConditionalCritAbAttr extends AbAttr {
} }
export class BlockNonDirectDamageAbAttr extends AbAttr { export class BlockNonDirectDamageAbAttr extends AbAttr {
constructor() {
super(false);
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void { override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void {
cancelled.value = true; cancelled.value = true;
} }
@ -3295,7 +3334,7 @@ export class ChangeMovePriorityAbAttr extends AbAttr {
* @param {number} changeAmount the amount of priority added or subtracted * @param {number} changeAmount the amount of priority added or subtracted
*/ */
constructor(moveFunc: (pokemon: Pokemon, move: Move) => boolean, changeAmount: number) { constructor(moveFunc: (pokemon: Pokemon, move: Move) => boolean, changeAmount: number) {
super(true); super(false);
this.moveFunc = moveFunc; this.moveFunc = moveFunc;
this.changeAmount = changeAmount; this.changeAmount = changeAmount;
@ -3339,7 +3378,7 @@ export class BlockWeatherDamageAttr extends PreWeatherDamageAbAttr {
private weatherTypes: WeatherType[]; private weatherTypes: WeatherType[];
constructor(...weatherTypes: WeatherType[]) { constructor(...weatherTypes: WeatherType[]) {
super(); super(false);
this.weatherTypes = weatherTypes; this.weatherTypes = weatherTypes;
} }
@ -3357,7 +3396,7 @@ export class SuppressWeatherEffectAbAttr extends PreWeatherEffectAbAttr {
public affectsImmutable: boolean; public affectsImmutable: boolean;
constructor(affectsImmutable?: boolean) { constructor(affectsImmutable?: boolean) {
super(); super(true);
this.affectsImmutable = !!affectsImmutable; this.affectsImmutable = !!affectsImmutable;
} }
@ -4136,7 +4175,7 @@ export class PostItemLostAbAttr extends AbAttr {
export class PostItemLostApplyBattlerTagAbAttr extends PostItemLostAbAttr { export class PostItemLostApplyBattlerTagAbAttr extends PostItemLostAbAttr {
private tagType: BattlerTagType; private tagType: BattlerTagType;
constructor(tagType: BattlerTagType) { constructor(tagType: BattlerTagType) {
super(true); super(false);
this.tagType = tagType; this.tagType = tagType;
} }
@ -4158,7 +4197,7 @@ export class StatStageChangeMultiplierAbAttr extends AbAttr {
private multiplier: number; private multiplier: number;
constructor(multiplier: number) { constructor(multiplier: number) {
super(true); super(false);
this.multiplier = multiplier; this.multiplier = multiplier;
} }
@ -4333,6 +4372,10 @@ export class ArenaTrapAbAttr extends CheckTrappedAbAttr {
} }
export class MaxMultiHitAbAttr extends AbAttr { export class MaxMultiHitAbAttr extends AbAttr {
constructor() {
super(false);
}
override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void { override apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): void {
(args[0] as Utils.NumberHolder).value = 0; (args[0] as Utils.NumberHolder).value = 0;
} }
@ -4418,7 +4461,7 @@ export class PostFaintContactDamageAbAttr extends PostFaintAbAttr {
private damageRatio: number; private damageRatio: number;
constructor(damageRatio: number) { constructor(damageRatio: number) {
super(); super(true);
this.damageRatio = damageRatio; this.damageRatio = damageRatio;
} }
@ -4514,7 +4557,7 @@ export class ReduceStatusEffectDurationAbAttr extends AbAttr {
private statusEffect: StatusEffect; private statusEffect: StatusEffect;
constructor(statusEffect: StatusEffect) { constructor(statusEffect: StatusEffect) {
super(true); super(false);
this.statusEffect = statusEffect; this.statusEffect = statusEffect;
} }
@ -4591,7 +4634,7 @@ export class WeightMultiplierAbAttr extends AbAttr {
private multiplier: number; private multiplier: number;
constructor(multiplier: number) { constructor(multiplier: number) {
super(); super(false);
this.multiplier = multiplier; this.multiplier = multiplier;
} }
@ -4654,6 +4697,9 @@ export class IgnoreProtectOnContactAbAttr extends AbAttr { }
* Allows the source's moves to bypass the effects of opposing Light Screen, Reflect, Aurora Veil, Safeguard, Mist, and Substitute. * Allows the source's moves to bypass the effects of opposing Light Screen, Reflect, Aurora Veil, Safeguard, Mist, and Substitute.
*/ */
export class InfiltratorAbAttr extends AbAttr { export class InfiltratorAbAttr extends AbAttr {
constructor() {
super(false);
}
override canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean { override canApply(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
return args[0] instanceof Utils.BooleanHolder; return args[0] instanceof Utils.BooleanHolder;
@ -4715,7 +4761,7 @@ export class IgnoreTypeImmunityAbAttr extends AbAttr {
private allowedMoveTypes: Type[]; private allowedMoveTypes: Type[];
constructor(defenderType: Type, allowedMoveTypes: Type[]) { constructor(defenderType: Type, allowedMoveTypes: Type[]) {
super(true); super(false);
this.defenderType = defenderType; this.defenderType = defenderType;
this.allowedMoveTypes = allowedMoveTypes; this.allowedMoveTypes = allowedMoveTypes;
} }
@ -4737,7 +4783,7 @@ export class IgnoreTypeStatusEffectImmunityAbAttr extends AbAttr {
private defenderType: Type[]; private defenderType: Type[];
constructor(statusEffect: StatusEffect[], defenderType: Type[]) { constructor(statusEffect: StatusEffect[], defenderType: Type[]) {
super(true); super(false);
this.statusEffect = statusEffect; this.statusEffect = statusEffect;
this.defenderType = defenderType; this.defenderType = defenderType;