From bdaf3e994880c8c736de31d1ec50a4ae3f561980 Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 21 Mar 2025 21:51:34 -0700 Subject: [PATCH] Change suppress/replace/copy flags --- src/data/ability.ts | 221 ++++++++++++++++++++--------------------- src/data/moves/move.ts | 17 ++-- src/field/pokemon.ts | 5 +- 3 files changed, 119 insertions(+), 124 deletions(-) diff --git a/src/data/ability.ts b/src/data/ability.ts index 5bf02cabf6c..3af141f06ee 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -57,6 +57,9 @@ export class Ability implements Localizable { public generation: number; public isBypassFaint: boolean; public isIgnorable: boolean; + public isSuppressable: boolean; + public isCopiable: boolean; + public isReplaceable: boolean; public attrs: AbAttr[]; public conditions: AbAttrCondition[]; @@ -68,6 +71,10 @@ export class Ability implements Localizable { this.attrs = []; this.conditions = []; + this.isSuppressable = true; + this.isCopiable = true; + this.isReplaceable = true; + this.localize(); } @@ -121,6 +128,21 @@ export class Ability implements Localizable { return this; } + unsuppressable(): Ability { + this.isSuppressable = false; + return this; + } + + uncopiable(): Ability { + this.isCopiable = false; + return this; + } + + unreplaceable(): Ability { + this.isReplaceable = false; + return this; + } + condition(condition: AbAttrCondition): Ability { this.conditions.push(condition); @@ -1138,7 +1160,7 @@ export class PostDefendAbilitySwapAbAttr extends PostDefendAbAttr { override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean { return move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) - && !attacker.getAbility().hasAttr(UnswappableAbilityAbAttr) && !move.hitsSubstitute(attacker, pokemon); + && attacker.getAbility().isReplaceable && attacker.getAbility().isCopiable && !move.hitsSubstitute(attacker, pokemon); } override applyPostDefend(pokemon: Pokemon, _passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, _hitResult: HitResult, args: any[]): void { @@ -1163,7 +1185,7 @@ export class PostDefendAbilityGiveAbAttr extends PostDefendAbAttr { } override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean { - return move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && !attacker.getAbility().hasAttr(UnsuppressableAbilityAbAttr) + return move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && attacker.getAbility().isSuppressable && !attacker.getAbility().hasAttr(PostDefendAbilityGiveAbAttr) && !move.hitsSubstitute(attacker, pokemon); } @@ -2103,7 +2125,7 @@ export class CopyFaintedAllyAbilityAbAttr extends PostKnockOutAbAttr { } override canApplyPostKnockOut(pokemon: Pokemon, passive: boolean, simulated: boolean, knockedOut: Pokemon, args: any[]): boolean { - return pokemon.isPlayer() === knockedOut.isPlayer() && !knockedOut.getAbility().hasAttr(UncopiableAbilityAbAttr); + return pokemon.isPlayer() === knockedOut.isPlayer() && knockedOut.getAbility().isCopiable; } override applyPostKnockOut(pokemon: Pokemon, passive: boolean, simulated: boolean, knockedOut: Pokemon, args: any[]): void { @@ -2550,7 +2572,7 @@ export class PostSummonCopyAbilityAbAttr extends PostSummonAbAttr { } if ( - target!.getAbility().hasAttr(UncopiableAbilityAbAttr) && + !target!.getAbility().isCopiable && // Wonder Guard is normally uncopiable so has the attribute, but Trace specifically can copy it !(pokemon.hasAbility(Abilities.TRACE) && target!.getAbility().id === Abilities.WONDER_GUARD) ) { @@ -4812,24 +4834,6 @@ export class InfiltratorAbAttr extends AbAttr { */ export class ReflectStatusMoveAbAttr extends AbAttr { } -export class UncopiableAbilityAbAttr extends AbAttr { - constructor() { - super(false); - } -} - -export class UnsuppressableAbilityAbAttr extends AbAttr { - constructor() { - super(false); - } -} - -export class UnswappableAbilityAbAttr extends AbAttr { - constructor() { - super(false); - } -} - export class NoTransformAbilityAbAttr extends AbAttr { constructor() { super(false); @@ -6143,8 +6147,7 @@ export function initAbilities() { .bypassFaint(), new Ability(Abilities.WONDER_GUARD, 3) .attr(NonSuperEffectiveImmunityAbAttr) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() .ignorable(), new Ability(Abilities.LEVITATE, 3) .attr(AttackTypeImmunityAbAttr, PokemonType.GROUND, (pokemon: Pokemon) => !pokemon.getTag(GroundedTag) && !globalScene.arena.getTag(ArenaTagType.GRAVITY)) @@ -6178,7 +6181,7 @@ export function initAbilities() { .ignorable(), new Ability(Abilities.TRACE, 3) .attr(PostSummonCopyAbilityAbAttr) - .attr(UncopiableAbilityAbAttr), + .uncopiable(), new Ability(Abilities.HUGE_POWER, 3) .attr(StatMultiplierAbAttr, Stat.ATK, 2), new Ability(Abilities.POISON_POINT, 3) @@ -6231,7 +6234,7 @@ export function initAbilities() { .ignorable(), new Ability(Abilities.PICKUP, 3) .attr(PostBattleLootAbAttr) - .attr(UnsuppressableAbilityAbAttr), + .unsuppressable(), new Ability(Abilities.TRUANT, 3) .attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false), new Ability(Abilities.HUSTLE, 3) @@ -6244,7 +6247,7 @@ export function initAbilities() { new Ability(Abilities.MINUS, 3) .conditionalAttr(p => globalScene.currentBattle.double && [ Abilities.PLUS, Abilities.MINUS ].some(a => p.getAlly().hasAbility(a)), StatMultiplierAbAttr, Stat.SPATK, 1.5), new Ability(Abilities.FORECAST, 3) - .attr(UncopiableAbilityAbAttr) + .uncopiable() .attr(NoFusionAbilityAbAttr) .attr(PostSummonFormChangeByWeatherAbAttr, Abilities.FORECAST) .attr(PostWeatherChangeFormChangeAbAttr, Abilities.FORECAST, [ WeatherType.NONE, WeatherType.SANDSTORM, WeatherType.STRONG_WINDS, WeatherType.FOG ]), @@ -6424,20 +6427,20 @@ export function initAbilities() { .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SNOW), new Ability(Abilities.HONEY_GATHER, 4) .attr(MoneyAbAttr) - .attr(UnsuppressableAbilityAbAttr), + .unsuppressable(), new Ability(Abilities.FRISK, 4) .attr(FriskAbAttr), new Ability(Abilities.RECKLESS, 4) .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.RECKLESS_MOVE), 1.2), new Ability(Abilities.MULTITYPE, 4) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) - .attr(NoFusionAbilityAbAttr), + .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unsuppressable() + .unreplaceable(), new Ability(Abilities.FLOWER_GIFT, 4) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), StatMultiplierAbAttr, Stat.ATK, 1.5) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), StatMultiplierAbAttr, Stat.SPDEF, 1.5) - .attr(UncopiableAbilityAbAttr) + .uncopiable() .attr(NoFusionAbilityAbAttr) .attr(PostSummonFormChangeByWeatherAbAttr, Abilities.FLOWER_GIFT) .attr(PostWeatherChangeFormChangeAbAttr, Abilities.FLOWER_GIFT, [ WeatherType.NONE, WeatherType.SANDSTORM, WeatherType.STRONG_WINDS, WeatherType.FOG, WeatherType.HAIL, WeatherType.HEAVY_RAIN, WeatherType.SNOW, WeatherType.RAIN ]) @@ -6523,12 +6526,11 @@ export function initAbilities() { return Utils.isNullOrUndefined(movePhase); }, 1.3), new Ability(Abilities.ILLUSION, 5) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() .unimplemented(), new Ability(Abilities.IMPOSTER, 5) .attr(PostSummonTransformAbAttr) - .attr(UncopiableAbilityAbAttr), + .uncopiable(), new Ability(Abilities.INFILTRATOR, 5) .attr(InfiltratorAbAttr) .partial(), // does not bypass Mist @@ -6570,10 +6572,10 @@ export function initAbilities() { .attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 1 : 0) .attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 1 : 0) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint(), new Ability(Abilities.VICTORY_STAR, 5) .attr(StatMultiplierAbAttr, Stat.ACC, 1.1) @@ -6615,10 +6617,10 @@ export function initAbilities() { .ignorable() .partial(), // Mold Breaker ally should not be affected by Sweet Veil new Ability(Abilities.STANCE_CHANGE, 6) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) - .attr(NoFusionAbilityAbAttr), + .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable(), new Ability(Abilities.GALE_WINGS, 6) .attr(ChangeMovePriorityAbAttr, (pokemon, move) => pokemon.isFullHp() && pokemon.getMoveType(move) === PokemonType.FLYING, 1), new Ability(Abilities.MEGA_LAUNCHER, 6) @@ -6683,11 +6685,11 @@ export function initAbilities() { .attr(PostTurnFormChangeAbAttr, p => p.formIndex % 7 + (p.getHpRatio() <= 0.5 ? 7 : 0)) .conditionalAttr(p => p.formIndex !== 7, StatusEffectImmunityAbAttr) .conditionalAttr(p => p.formIndex !== 7, BattlerTagImmunityAbAttr, BattlerTagType.DROWSY) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoFusionAbilityAbAttr) .attr(NoTransformAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint(), new Ability(Abilities.STAKEOUT, 7) .attr(MovePowerBoostAbAttr, (user, target, move) => !!target?.turnData.switchedInThisTurn, 2), @@ -6718,15 +6720,12 @@ export function initAbilities() { .attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostSummonFormChangeAbAttr, p => p.level < 20 || p.getHpRatio() <= 0.25 ? 0 : 1) .attr(PostTurnFormChangeAbAttr, p => p.level < 20 || p.getHpRatio() <= 0.25 ? 0 : 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint(), new Ability(Abilities.DISGUISE, 7) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr) // Add BattlerTagType.DISGUISE if the pokemon is in its disguised form @@ -6736,15 +6735,18 @@ export function initAbilities() { (pokemon, abilityName) => i18next.t("abilityTriggers:disguiseAvoidedDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }), (pokemon) => Utils.toDmgValue(pokemon.getMaxHp() / 8)) .attr(PostBattleInitFormChangeAbAttr, () => 0) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint() .ignorable(), new Ability(Abilities.BATTLE_BOND, 7) .attr(PostVictoryFormChangeAbAttr, () => 2) .attr(PostBattleInitFormChangeAbAttr, () => 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint(), new Ability(Abilities.POWER_CONSTRUCT, 7) .conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostBattleInitFormChangeAbAttr, () => 2) @@ -6753,20 +6755,20 @@ export function initAbilities() { .conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "complete" ? 4 : 2) .conditionalAttr(pokemon => pokemon.formIndex === 3 || pokemon.formIndex === 5, PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "10-complete" ? 5 : 3) .conditionalAttr(pokemon => pokemon.formIndex === 3 || pokemon.formIndex === 5, PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 || p.getFormKey() === "10-complete" ? 5 : 3) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint(), new Ability(Abilities.CORROSION, 7) .attr(IgnoreTypeStatusEffectImmunityAbAttr, [ StatusEffect.POISON, StatusEffect.TOXIC ], [ PokemonType.STEEL, PokemonType.POISON ]) .edgeCase(), // Should poison itself with toxic orb. new Ability(Abilities.COMATOSE, 7) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(StatusEffectImmunityAbAttr, ...getNonVolatileStatusEffects()) - .attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY), + .attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY) + .uncopiable() + .unreplaceable() + .unsuppressable(), new Ability(Abilities.QUEENLY_MAJESTY, 7) .attr(FieldPriorityMoveImmunityAbAttr) .ignorable(), @@ -6790,10 +6792,10 @@ export function initAbilities() { .attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false), new Ability(Abilities.RECEIVER, 7) .attr(CopyFaintedAllyAbilityAbAttr) - .attr(UncopiableAbilityAbAttr), + .uncopiable(), new Ability(Abilities.POWER_OF_ALCHEMY, 7) .attr(CopyFaintedAllyAbilityAbAttr) - .attr(UncopiableAbilityAbAttr), + .uncopiable(), new Ability(Abilities.BEAST_BOOST, 7) .attr(PostVictoryStatStageChangeAbAttr, p => { let highestStat: EffectiveStat; @@ -6808,10 +6810,10 @@ export function initAbilities() { return highestStat!; }, 1), new Ability(Abilities.RKS_SYSTEM, 7) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) - .attr(NoFusionAbilityAbAttr), + .attr(NoFusionAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable(), new Ability(Abilities.ELECTRIC_SURGE, 7) .attr(PostSummonTerrainChangeAbAttr, TerrainType.ELECTRIC) .attr(PostBiomeChangeTerrainChangeAbAttr, TerrainType.ELECTRIC), @@ -6857,11 +6859,11 @@ export function initAbilities() { * @see {@linkcode GulpMissileTagAttr} and {@linkcode GulpMissileTag} for Gulp Missile implementation */ new Ability(Abilities.GULP_MISSILE, 8) - .attr(UnsuppressableAbilityAbAttr) .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .unsuppressable() + .uncopiable() + .unreplaceable() .bypassFaint(), new Ability(Abilities.STALWART, 8) .attr(BlockRedirectAbAttr), @@ -6884,9 +6886,6 @@ export function initAbilities() { new Ability(Abilities.RIPEN, 8) .attr(DoubleBerryEffectAbAttr), new Ability(Abilities.ICE_FACE, 8) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr) // Add BattlerTagType.ICE_FACE if the pokemon is in ice face form @@ -6899,6 +6898,9 @@ export function initAbilities() { (target, user, move) => move.category === MoveCategory.PHYSICAL && !!target.getTag(BattlerTagType.ICE_FACE), 0, BattlerTagType.ICE_FACE, (pokemon, abilityName) => i18next.t("abilityTriggers:iceFaceAvoidedDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName })) .attr(PostBattleInitFormChangeAbAttr, () => 0) + .uncopiable() + .unreplaceable() + .unsuppressable() .bypassFaint() .ignorable(), new Ability(Abilities.POWER_SPOT, 8) @@ -6921,8 +6923,7 @@ export function initAbilities() { new Ability(Abilities.NEUTRALIZING_GAS, 8) .attr(PostSummonAddArenaTagAbAttr, true, ArenaTagType.NEUTRALIZING_GAS, 0) .attr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() .attr(NoTransformAbilityAbAttr) .bypassFaint(), new Ability(Abilities.PASTEL_VEIL, 8) @@ -6932,11 +6933,11 @@ export function initAbilities() { new Ability(Abilities.HUNGER_SWITCH, 8) .attr(PostTurnFormChangeAbAttr, p => p.getFormKey() ? 0 : 1) .attr(PostTurnFormChangeAbAttr, p => p.getFormKey() ? 1 : 0) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr) - .condition((pokemon) => !pokemon.isTerastallized), + .condition((pokemon) => !pokemon.isTerastallized) + .uncopiable() + .unreplaceable(), new Ability(Abilities.QUICK_DRAW, 8) .attr(BypassSpeedChanceAbAttr, 30), new Ability(Abilities.UNSEEN_FIST, 8) @@ -6955,16 +6956,16 @@ export function initAbilities() { .attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAsOneGlastrier", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })) .attr(PreventBerryUseAbAttr) .attr(PostVictoryStatStageChangeAbAttr, Stat.ATK, 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr), + .uncopiable() + .unreplaceable() + .unsuppressable(), new Ability(Abilities.AS_ONE_SPECTRIER, 8) .attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAsOneSpectrier", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })) .attr(PreventBerryUseAbAttr) .attr(PostVictoryStatStageChangeAbAttr, Stat.SPATK, 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr), + .uncopiable() + .unreplaceable() + .unsuppressable(), new Ability(Abilities.LINGERING_AROMA, 9) .attr(PostDefendAbilityGiveAbAttr, Abilities.LINGERING_AROMA) .bypassFaint(), @@ -6999,9 +7000,9 @@ export function initAbilities() { new Ability(Abilities.WIND_POWER, 9) .attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.hasFlag(MoveFlags.WIND_MOVE), BattlerTagType.CHARGED), new Ability(Abilities.ZERO_TO_HERO, 9) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr) .attr(PostBattleInitFormChangeAbAttr, () => 0) @@ -7010,22 +7011,20 @@ export function initAbilities() { new Ability(Abilities.COMMANDER, 9) .attr(CommanderAbAttr) .attr(DoubleBattleChanceAbAttr) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() .edgeCase(), // Encore, Frenzy, and other non-`TURN_END` tags don't lapse correctly on the commanding Pokemon. new Ability(Abilities.ELECTROMORPHOSIS, 9) .attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattlerTagType.CHARGED), new Ability(Abilities.PROTOSYNTHESIS, 9) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN), PostSummonAddBattlerTagAbAttr, BattlerTagType.PROTOSYNTHESIS, 0, true) .attr(PostWeatherChangeAddBattlerTagAttr, BattlerTagType.PROTOSYNTHESIS, 0, WeatherType.SUNNY, WeatherType.HARSH_SUN) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() .attr(NoTransformAbilityAbAttr), new Ability(Abilities.QUARK_DRIVE, 9) .conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), PostSummonAddBattlerTagAbAttr, BattlerTagType.QUARK_DRIVE, 0, true) .attr(PostTerrainChangeAddBattlerTagAttr, BattlerTagType.QUARK_DRIVE, 0, TerrainType.ELECTRIC) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() .attr(NoTransformAbilityAbAttr), new Ability(Abilities.GOOD_AS_GOLD, 9) .attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.category === MoveCategory.STATUS && ![ MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES, MoveTarget.USER_SIDE ].includes(move.moveTarget)) @@ -7089,45 +7088,45 @@ export function initAbilities() { .attr(PostAttackApplyStatusEffectAbAttr, false, 30, StatusEffect.TOXIC), new Ability(Abilities.EMBODY_ASPECT_TEAL, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPD ], 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() // TODO is this true? .attr(NoTransformAbilityAbAttr), new Ability(Abilities.EMBODY_ASPECT_WELLSPRING, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPDEF ], 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() .attr(NoTransformAbilityAbAttr), new Ability(Abilities.EMBODY_ASPECT_HEARTHFLAME, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.ATK ], 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() .attr(NoTransformAbilityAbAttr), new Ability(Abilities.EMBODY_ASPECT_CORNERSTONE, 9) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.DEF ], 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() .attr(NoTransformAbilityAbAttr), new Ability(Abilities.TERA_SHIFT, 9) .attr(PostSummonFormChangeAbAttr, p => p.getFormKey() ? 0 : 1) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) - .attr(UnsuppressableAbilityAbAttr) + .uncopiable() + .unreplaceable() + .unsuppressable() .attr(NoTransformAbilityAbAttr) .attr(NoFusionAbilityAbAttr), new Ability(Abilities.TERA_SHELL, 9) .attr(FullHpResistTypeAbAttr) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() .ignorable(), new Ability(Abilities.TERAFORM_ZERO, 9) .attr(ClearWeatherAbAttr, [ WeatherType.SUNNY, WeatherType.RAIN, WeatherType.SANDSTORM, WeatherType.HAIL, WeatherType.SNOW, WeatherType.FOG, WeatherType.HEAVY_RAIN, WeatherType.HARSH_SUN, WeatherType.STRONG_WINDS ]) .attr(ClearTerrainAbAttr, [ TerrainType.MISTY, TerrainType.ELECTRIC, TerrainType.GRASSY, TerrainType.PSYCHIC ]) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() .condition(getOncePerBattleCondition(Abilities.TERAFORM_ZERO)), new Ability(Abilities.POISON_PUPPETEER, 9) - .attr(UncopiableAbilityAbAttr) - .attr(UnswappableAbilityAbAttr) + .uncopiable() + .unreplaceable() // TODO is this true? .attr(ConfusionOnStatusEffectAbAttr, StatusEffect.POISON, StatusEffect.TOXIC) ); } diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 2fe02dbf587..c6311bb2c90 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -64,9 +64,6 @@ import { PostDamageForceSwitchAbAttr, PostItemLostAbAttr, ReverseDrainAbAttr, - UncopiableAbilityAbAttr, - UnsuppressableAbilityAbAttr, - UnswappableAbilityAbAttr, UserFieldMoveTypePowerBoostAbAttr, VariableMovePowerAbAttr, WonderSkinAbAttr, @@ -6746,7 +6743,7 @@ export class RandomMoveAttr extends CallMoveAttr { * This function exists solely to allow tests to override the randomly selected move by mocking this function. */ public getMoveOverride(): Moves | null { - return null; + return Moves.HOLD_HANDS; } /** @@ -7383,7 +7380,7 @@ export class AbilityChangeAttr extends MoveEffectAttr { } getCondition(): MoveConditionFunc { - return (user, target, move) => !(this.selfTarget ? user : target).getAbility().hasAttr(UnswappableAbilityAbAttr) && (this.selfTarget ? user : target).getAbility().id !== this.ability; + return (user, target, move) => (this.selfTarget ? user : target).getAbility().isReplaceable && (this.selfTarget ? user : target).getAbility().id !== this.ability; } } @@ -7415,9 +7412,9 @@ export class AbilityCopyAttr extends MoveEffectAttr { getCondition(): MoveConditionFunc { return (user, target, move) => { - let ret = !target.getAbility().hasAttr(UncopiableAbilityAbAttr) && !user.getAbility().hasAttr(UnswappableAbilityAbAttr); + let ret = target.getAbility().isCopiable && user.getAbility().isReplaceable; if (this.copyToPartner && globalScene.currentBattle?.double) { - ret = ret && (!user.getAlly().hp || !user.getAlly().getAbility().hasAttr(UnswappableAbilityAbAttr)); + ret = ret && (!user.getAlly().hp || user.getAlly().getAbility().isReplaceable); } else { ret = ret && user.getAbility().id !== target.getAbility().id; } @@ -7446,7 +7443,7 @@ export class AbilityGiveAttr extends MoveEffectAttr { } getCondition(): MoveConditionFunc { - return (user, target, move) => !user.getAbility().hasAttr(UncopiableAbilityAbAttr) && !target.getAbility().hasAttr(UnswappableAbilityAbAttr) && user.getAbility().id !== target.getAbility().id; + return (user, target, move) => user.getAbility().isCopiable && target.getAbility().isReplaceable && user.getAbility().id !== target.getAbility().id; } } @@ -7469,7 +7466,7 @@ export class SwitchAbilitiesAttr extends MoveEffectAttr { } getCondition(): MoveConditionFunc { - return (user, target, move) => !user.getAbility().hasAttr(UnswappableAbilityAbAttr) && !target.getAbility().hasAttr(UnswappableAbilityAbAttr); + return (user, target, move) => [user, target].every(pkmn => pkmn.getAbility().isReplaceable && pkmn.getAbility().isCopiable); } } @@ -7499,7 +7496,7 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr { /** Causes the effect to fail when the target's ability is unsupressable or already suppressed. */ getCondition(): MoveConditionFunc { - return (user, target, move) => !target.getAbility().hasAttr(UnsuppressableAbilityAbAttr) && !target.summonData.abilitySuppressed; + return (user, target, move) => target.getAbility().isSuppressable && !target.summonData.abilitySuppressed; } } diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index a7532685bea..d5d5319a860 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -161,7 +161,6 @@ import { applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, - UnsuppressableAbilityAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, @@ -2166,7 +2165,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } if ( this.summonData?.abilitySuppressed && - !ability.hasAttr(UnsuppressableAbilityAbAttr) + ability.isSuppressable ) { return false; } @@ -2189,7 +2188,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { // (Balance decided that the other ability of a neutralizing gas pokemon should not be neutralized) // If the ability itself is neutralizing gas, don't suppress it (handled through arena tag) const unsuppressable = - ability.hasAttr(UnsuppressableAbilityAbAttr) || + !ability.isSuppressable || thisAbilitySuppressing || (hasSuppressingAbility && !suppressAbilitiesTag.shouldApplyToSelf()); if (!unsuppressable) {