Merge branch 'beta' into cgsrf

This commit is contained in:
Madmadness65 2025-03-30 01:12:58 -05:00 committed by GitHub
commit 871a014fe0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 3270 additions and 1364 deletions

3905
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,41 +29,41 @@
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "1.9.4", "@biomejs/biome": "1.9.4",
"@eslint/js": "^9.3.0", "@eslint/js": "^9.23.0",
"@hpcc-js/wasm": "^2.18.0", "@hpcc-js/wasm": "^2.22.4",
"@stylistic/eslint-plugin-ts": "^2.6.0-beta.0", "@stylistic/eslint-plugin-ts": "^4.1.0",
"@types/jsdom": "^21.1.7", "@types/jsdom": "^21.1.7",
"@types/node": "^20.12.13", "@types/node": "^20.12.13",
"@typescript-eslint/eslint-plugin": "^8.0.0-alpha.54", "@typescript-eslint/eslint-plugin": "^8.28.0",
"@typescript-eslint/parser": "^8.0.0-alpha.54", "@typescript-eslint/parser": "^8.28.0",
"@vitest/coverage-istanbul": "^3.0.9", "@vitest/coverage-istanbul": "^3.0.9",
"dependency-cruiser": "^16.3.10", "dependency-cruiser": "^16.3.10",
"eslint": "^9.7.0", "eslint": "^9.23.0",
"eslint-plugin-import-x": "^4.2.1", "eslint-plugin-import-x": "^4.9.4",
"inquirer": "^11.0.2", "inquirer": "^12.4.2",
"jsdom": "^24.0.0", "jsdom": "^26.0.0",
"lefthook": "^1.6.12", "lefthook": "^1.11.5",
"msw": "^2.4.9", "msw": "^2.7.3",
"phaser3spectorjs": "^0.0.8", "phaser3spectorjs": "^0.0.8",
"typedoc": "^0.26.4", "typedoc": "^0.28.1",
"typescript": "^5.5.3", "typescript": "^5.8.2",
"typescript-eslint": "^8.0.0-alpha.54", "typescript-eslint": "^8.28.0",
"vite": "^5.4.14", "vite": "^6.2.0",
"vite-tsconfig-paths": "^4.3.2", "vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.0.9", "vitest": "^3.0.9",
"vitest-canvas-mock": "^0.3.3" "vitest-canvas-mock": "^0.3.3"
}, },
"dependencies": { "dependencies": {
"@material/material-color-utilities": "^0.2.7", "@material/material-color-utilities": "^0.2.7",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"i18next": "^23.11.1", "i18next": "^24.2.2",
"i18next-browser-languagedetector": "^7.2.1", "i18next-browser-languagedetector": "^8.0.4",
"i18next-http-backend": "^2.6.1", "i18next-http-backend": "^3.0.2",
"i18next-korean-postposition-processor": "^1.0.0", "i18next-korean-postposition-processor": "^1.0.0",
"json-stable-stringify": "^1.1.0", "json-stable-stringify": "^1.2.0",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"phaser": "^3.70.0", "phaser": "^3.88.2",
"phaser3-rex-plugins": "^1.1.84" "phaser3-rex-plugins": "^1.80.14"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=20.0.0"

@ -1 +1 @@
Subproject commit cae82762eab25f928500b73e0e9a3e7df1ae6bbe Subproject commit e599780a369f87a96ab0469a8908cea86628145f

View File

@ -57,6 +57,9 @@ export class Ability implements Localizable {
public generation: number; public generation: number;
public isBypassFaint: boolean; public isBypassFaint: boolean;
public isIgnorable: boolean; public isIgnorable: boolean;
public isSuppressable = true;
public isCopiable = true;
public isReplaceable = true;
public attrs: AbAttr[]; public attrs: AbAttr[];
public conditions: AbAttrCondition[]; public conditions: AbAttrCondition[];
@ -68,9 +71,16 @@ export class Ability implements Localizable {
this.attrs = []; this.attrs = [];
this.conditions = []; this.conditions = [];
this.isSuppressable = true;
this.isCopiable = true;
this.isReplaceable = true;
this.localize(); this.localize();
} }
public get isSwappable(): boolean {
return this.isCopiable && this.isReplaceable;
}
localize(): void { localize(): void {
const i18nKey = Abilities[this.id].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join("") as string; const i18nKey = Abilities[this.id].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join("") as string;
@ -121,6 +131,21 @@ export class Ability implements Localizable {
return this; 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 { condition(condition: AbAttrCondition): Ability {
this.conditions.push(condition); this.conditions.push(condition);
@ -1138,7 +1163,7 @@ export class PostDefendAbilitySwapAbAttr extends PostDefendAbAttr {
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean { 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) return move.checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon)
&& !attacker.getAbility().hasAttr(UnswappableAbilityAbAttr) && !move.hitsSubstitute(attacker, pokemon); && attacker.getAbility().isSwappable && !move.hitsSubstitute(attacker, pokemon);
} }
override applyPostDefend(pokemon: Pokemon, _passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, _hitResult: HitResult, args: any[]): void { override applyPostDefend(pokemon: Pokemon, _passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, _hitResult: HitResult, args: any[]): void {
@ -1163,7 +1188,7 @@ export class PostDefendAbilityGiveAbAttr extends PostDefendAbAttr {
} }
override canApplyPostDefend(pokemon: Pokemon, passive: boolean, simulated: boolean, attacker: Pokemon, move: Move, hitResult: HitResult | null, args: any[]): boolean { 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); && !attacker.getAbility().hasAttr(PostDefendAbilityGiveAbAttr) && !move.hitsSubstitute(attacker, pokemon);
} }
@ -2159,7 +2184,7 @@ export class CopyFaintedAllyAbilityAbAttr extends PostKnockOutAbAttr {
} }
override canApplyPostKnockOut(pokemon: Pokemon, passive: boolean, simulated: boolean, knockedOut: Pokemon, args: any[]): boolean { 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 { override applyPostKnockOut(pokemon: Pokemon, passive: boolean, simulated: boolean, knockedOut: Pokemon, args: any[]): void {
@ -2606,7 +2631,7 @@ export class PostSummonCopyAbilityAbAttr extends PostSummonAbAttr {
} }
if ( if (
target!.getAbility().hasAttr(UncopiableAbilityAbAttr) && !target!.getAbility().isCopiable &&
// Wonder Guard is normally uncopiable so has the attribute, but Trace specifically can copy it // 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) !(pokemon.hasAbility(Abilities.TRACE) && target!.getAbility().id === Abilities.WONDER_GUARD)
) { ) {
@ -3204,6 +3229,7 @@ export class ConfusionOnStatusEffectAbAttr extends PostAttackAbAttr {
} }
export class PreSetStatusAbAttr extends AbAttr { export class PreSetStatusAbAttr extends AbAttr {
/** Return whether the ability attribute can be applied */
canApplyPreSetStatus( canApplyPreSetStatus(
pokemon: Pokemon, pokemon: Pokemon,
passive: boolean, passive: boolean,
@ -3228,7 +3254,7 @@ export class PreSetStatusAbAttr extends AbAttr {
* Provides immunity to status effects to specified targets. * Provides immunity to status effects to specified targets.
*/ */
export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr { export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
private immuneEffects: StatusEffect[]; protected immuneEffects: StatusEffect[];
/** /**
* @param immuneEffects - The status effects to which the Pokémon is immune. * @param immuneEffects - The status effects to which the Pokémon is immune.
@ -3282,6 +3308,92 @@ export class StatusEffectImmunityAbAttr extends PreSetStatusEffectImmunityAbAttr
*/ */
export class UserFieldStatusEffectImmunityAbAttr extends PreSetStatusEffectImmunityAbAttr { } export class UserFieldStatusEffectImmunityAbAttr extends PreSetStatusEffectImmunityAbAttr { }
/**
* Conditionally provides immunity to status effects to the user's field.
*
* Used by {@linkcode Abilities.FLOWER_VEIL | Flower Veil}.
* @extends UserFieldStatusEffectImmunityAbAttr
*
*/
export class ConditionalUserFieldStatusEffectImmunityAbAttr extends UserFieldStatusEffectImmunityAbAttr {
/**
* The condition for the field immunity to be applied.
* @param target The target of the status effect
* @param source The source of the status effect
*/
protected condition: (target: Pokemon, source: Pokemon | null) => boolean;
/**
* Evaluate the condition to determine if the {@linkcode ConditionalUserFieldStatusEffectImmunityAbAttr} can be applied.
* @param pokemon The pokemon with the ability
* @param passive unused
* @param simulated Whether the ability is being simulated
* @param effect The status effect being applied
* @param cancelled Holds whether the status effect was cancelled by a prior effect
* @param args `Args[0]` is the target of the status effect, `Args[1]` is the source.
* @returns Whether the ability can be applied to cancel the status effect.
*/
override canApplyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: Utils.BooleanHolder, args: [Pokemon, Pokemon | null, ...any]): boolean {
return (!cancelled.value && effect !== StatusEffect.FAINT && this.immuneEffects.length < 1 || this.immuneEffects.includes(effect)) && this.condition(args[0], args[1]);
}
constructor(condition: (target: Pokemon, source: Pokemon | null) => boolean, ...immuneEffects: StatusEffect[]) {
super(...immuneEffects);
this.condition = condition;
}
}
/**
* Conditionally provides immunity to stat drop effects to the user's field.
*
* Used by {@linkcode Abilities.FLOWER_VEIL | Flower Veil}.
*/
export class ConditionalUserFieldProtectStatAbAttr extends PreStatStageChangeAbAttr {
/** {@linkcode BattleStat} to protect or `undefined` if **all** {@linkcode BattleStat} are protected */
protected protectedStat?: BattleStat;
/** If the method evaluates to true, the stat will be protected. */
protected condition: (target: Pokemon) => boolean;
constructor(condition: (target: Pokemon) => boolean, protectedStat?: BattleStat) {
super();
this.condition = condition;
}
/**
* Determine whether the {@linkcode ConditionalUserFieldProtectStatAbAttr} can be applied.
* @param pokemon The pokemon with the ability
* @param passive unused
* @param simulated Unused
* @param stat The stat being affected
* @param cancelled Holds whether the stat change was already prevented.
* @param args Args[0] is the target pokemon of the stat change.
* @returns
*/
override canApplyPreStatStageChange(pokemon: Pokemon, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: [Pokemon, ...any]): boolean {
const target = args[0];
if (!target) {
return false;
}
return !cancelled.value && (Utils.isNullOrUndefined(this.protectedStat) || stat === this.protectedStat) && this.condition(target);
}
/**
* Apply the {@linkcode ConditionalUserFieldStatusEffectImmunityAbAttr} to an interaction
* @param _pokemon The pokemon the stat change is affecting (unused)
* @param _passive unused
* @param _simulated unused
* @param stat The stat being affected
* @param cancelled Will be set to true if the stat change is prevented
* @param _args unused
*/
override applyPreStatStageChange(_pokemon: Pokemon, _passive: boolean, _simulated: boolean, _stat: BattleStat, cancelled: Utils.BooleanHolder, _args: any[]): void {
cancelled.value = true;
}
}
export class PreApplyBattlerTagAbAttr extends AbAttr { export class PreApplyBattlerTagAbAttr extends AbAttr {
canApplyPreApplyBattlerTag( canApplyPreApplyBattlerTag(
pokemon: Pokemon, pokemon: Pokemon,
@ -3308,8 +3420,8 @@ export class PreApplyBattlerTagAbAttr extends AbAttr {
* Provides immunity to BattlerTags {@linkcode BattlerTag} to specified targets. * Provides immunity to BattlerTags {@linkcode BattlerTag} to specified targets.
*/ */
export class PreApplyBattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr { export class PreApplyBattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
private immuneTagTypes: BattlerTagType[]; protected immuneTagTypes: BattlerTagType[];
private battlerTag: BattlerTag; protected battlerTag: BattlerTag;
constructor(immuneTagTypes: BattlerTagType | BattlerTagType[]) { constructor(immuneTagTypes: BattlerTagType | BattlerTagType[]) {
super(true); super(true);
@ -3320,7 +3432,7 @@ export class PreApplyBattlerTagImmunityAbAttr extends PreApplyBattlerTagAbAttr {
override canApplyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): boolean { override canApplyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): boolean {
this.battlerTag = tag; this.battlerTag = tag;
return this.immuneTagTypes.includes(tag.tagType); return !cancelled.value && this.immuneTagTypes.includes(tag.tagType);
} }
override applyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): void { override applyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: any[]): void {
@ -3348,6 +3460,30 @@ export class BattlerTagImmunityAbAttr extends PreApplyBattlerTagImmunityAbAttr {
*/ */
export class UserFieldBattlerTagImmunityAbAttr extends PreApplyBattlerTagImmunityAbAttr { } export class UserFieldBattlerTagImmunityAbAttr extends PreApplyBattlerTagImmunityAbAttr { }
export class ConditionalUserFieldBattlerTagImmunityAbAttr extends UserFieldBattlerTagImmunityAbAttr {
private condition: (target: Pokemon) => boolean;
/**
* Determine whether the {@linkcode ConditionalUserFieldBattlerTagImmunityAbAttr} can be applied by passing the target pokemon to the condition.
* @param pokemon The pokemon owning the ability
* @param passive unused
* @param simulated whether the ability is being simulated (unused)
* @param tag The {@linkcode BattlerTag} being applied
* @param cancelled Holds whether the tag was previously cancelled (unused)
* @param args Args[0] is the target that the tag is attempting to be applied to
* @returns Whether the ability can be used to cancel the battler tag
*/
override canApplyPreApplyBattlerTag(pokemon: Pokemon, passive: boolean, simulated: boolean, tag: BattlerTag, cancelled: Utils.BooleanHolder, args: [Pokemon, ...any]): boolean {
return super.canApplyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args) && this.condition(args[0]);
}
constructor(condition: (target: Pokemon) => boolean, immuneTagTypes: BattlerTagType | BattlerTagType[]) {
super(immuneTagTypes);
this.condition = condition;
}
}
export class BlockCritAbAttr extends AbAttr { export class BlockCritAbAttr extends AbAttr {
constructor() { constructor() {
super(false); super(false);
@ -4868,24 +5004,6 @@ export class InfiltratorAbAttr extends AbAttr {
*/ */
export class ReflectStatusMoveAbAttr 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 { export class NoTransformAbilityAbAttr extends AbAttr {
constructor() { constructor() {
super(false); super(false);
@ -5856,19 +5974,20 @@ export function applyPreLeaveFieldAbAttrs(
); );
} }
export function applyPreStatStageChangeAbAttrs( export function applyPreStatStageChangeAbAttrs<T extends PreStatStageChangeAbAttr > (
attrType: Constructor<PreStatStageChangeAbAttr>, attrType: Constructor<T>,
pokemon: Pokemon | null, pokemon: Pokemon | null,
stat: BattleStat, stat: BattleStat,
cancelled: Utils.BooleanHolder, cancelled: Utils.BooleanHolder,
simulated = false, simulated = false,
...args: any[] ...args: any[]
): void { ): void {
applyAbAttrsInternal<PreStatStageChangeAbAttr>( applyAbAttrsInternal<T>(
attrType, attrType,
pokemon, pokemon,
(attr, passive) => attr.applyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args), (attr, passive) => attr.applyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args),
(attr, passive) => attr.canApplyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args), args, (attr, passive) => attr.canApplyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args),
args,
simulated, simulated,
); );
} }
@ -5921,7 +6040,8 @@ export function applyPreApplyBattlerTagAbAttrs(
attrType, attrType,
pokemon, pokemon,
(attr, passive) => attr.applyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args), (attr, passive) => attr.applyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args),
(attr, passive) => attr.canApplyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args), args, (attr, passive) => attr.canApplyPreApplyBattlerTag(pokemon, passive, simulated, tag, cancelled, args),
args,
simulated, simulated,
); );
} }
@ -5938,7 +6058,8 @@ export function applyPreWeatherEffectAbAttrs(
attrType, attrType,
pokemon, pokemon,
(attr, passive) => attr.applyPreWeatherEffect(pokemon, passive, simulated, weather, cancelled, args), (attr, passive) => attr.applyPreWeatherEffect(pokemon, passive, simulated, weather, cancelled, args),
(attr, passive) => attr.canApplyPreWeatherEffect(pokemon, passive, simulated, weather, cancelled, args), args, (attr, passive) => attr.canApplyPreWeatherEffect(pokemon, passive, simulated, weather, cancelled, args),
args,
simulated, simulated,
); );
} }
@ -6224,8 +6345,7 @@ export function initAbilities() {
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.WONDER_GUARD, 3) new Ability(Abilities.WONDER_GUARD, 3)
.attr(NonSuperEffectiveImmunityAbAttr) .attr(NonSuperEffectiveImmunityAbAttr)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr)
.ignorable(), .ignorable(),
new Ability(Abilities.LEVITATE, 3) new Ability(Abilities.LEVITATE, 3)
.attr(AttackTypeImmunityAbAttr, PokemonType.GROUND, (pokemon: Pokemon) => !pokemon.getTag(GroundedTag) && !globalScene.arena.getTag(ArenaTagType.GRAVITY)) .attr(AttackTypeImmunityAbAttr, PokemonType.GROUND, (pokemon: Pokemon) => !pokemon.getTag(GroundedTag) && !globalScene.arena.getTag(ArenaTagType.GRAVITY))
@ -6259,7 +6379,7 @@ export function initAbilities() {
.ignorable(), .ignorable(),
new Ability(Abilities.TRACE, 3) new Ability(Abilities.TRACE, 3)
.attr(PostSummonCopyAbilityAbAttr) .attr(PostSummonCopyAbilityAbAttr)
.attr(UncopiableAbilityAbAttr), .uncopiable(),
new Ability(Abilities.HUGE_POWER, 3) new Ability(Abilities.HUGE_POWER, 3)
.attr(StatMultiplierAbAttr, Stat.ATK, 2), .attr(StatMultiplierAbAttr, Stat.ATK, 2),
new Ability(Abilities.POISON_POINT, 3) new Ability(Abilities.POISON_POINT, 3)
@ -6312,7 +6432,7 @@ export function initAbilities() {
.ignorable(), .ignorable(),
new Ability(Abilities.PICKUP, 3) new Ability(Abilities.PICKUP, 3)
.attr(PostBattleLootAbAttr) .attr(PostBattleLootAbAttr)
.attr(UnsuppressableAbilityAbAttr), .unsuppressable(),
new Ability(Abilities.TRUANT, 3) new Ability(Abilities.TRUANT, 3)
.attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false), .attr(PostSummonAddBattlerTagAbAttr, BattlerTagType.TRUANT, 1, false),
new Ability(Abilities.HUSTLE, 3) new Ability(Abilities.HUSTLE, 3)
@ -6325,7 +6445,8 @@ export function initAbilities() {
new Ability(Abilities.MINUS, 3) 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), .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) new Ability(Abilities.FORECAST, 3)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.unreplaceable()
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(PostSummonFormChangeByWeatherAbAttr, Abilities.FORECAST) .attr(PostSummonFormChangeByWeatherAbAttr, Abilities.FORECAST)
.attr(PostWeatherChangeFormChangeAbAttr, Abilities.FORECAST, [ WeatherType.NONE, WeatherType.SANDSTORM, WeatherType.STRONG_WINDS, WeatherType.FOG ]), .attr(PostWeatherChangeFormChangeAbAttr, Abilities.FORECAST, [ WeatherType.NONE, WeatherType.SANDSTORM, WeatherType.STRONG_WINDS, WeatherType.FOG ]),
@ -6505,25 +6626,26 @@ export function initAbilities() {
.attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SNOW), .attr(PostBiomeChangeWeatherChangeAbAttr, WeatherType.SNOW),
new Ability(Abilities.HONEY_GATHER, 4) new Ability(Abilities.HONEY_GATHER, 4)
.attr(MoneyAbAttr) .attr(MoneyAbAttr)
.attr(UnsuppressableAbilityAbAttr), .unsuppressable(),
new Ability(Abilities.FRISK, 4) new Ability(Abilities.FRISK, 4)
.attr(FriskAbAttr), .attr(FriskAbAttr),
new Ability(Abilities.RECKLESS, 4) new Ability(Abilities.RECKLESS, 4)
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.RECKLESS_MOVE), 1.2), .attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.RECKLESS_MOVE), 1.2),
new Ability(Abilities.MULTITYPE, 4) new Ability(Abilities.MULTITYPE, 4)
.attr(UncopiableAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(UnswappableAbilityAbAttr) .uncopiable()
.attr(UnsuppressableAbilityAbAttr) .unsuppressable()
.attr(NoFusionAbilityAbAttr), .unreplaceable(),
new Ability(Abilities.FLOWER_GIFT, 4) 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.ATK, 1.5)
.conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), StatMultiplierAbAttr, Stat.SPDEF, 1.5) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), StatMultiplierAbAttr, Stat.SPDEF, 1.5)
.conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), AllyStatMultiplierAbAttr, Stat.ATK, 1.5) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), AllyStatMultiplierAbAttr, Stat.ATK, 1.5)
.conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), AllyStatMultiplierAbAttr, Stat.SPDEF, 1.5) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY || WeatherType.HARSH_SUN), AllyStatMultiplierAbAttr, Stat.SPDEF, 1.5)
.attr(UncopiableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(PostSummonFormChangeByWeatherAbAttr, Abilities.FLOWER_GIFT) .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 ]) .attr(PostWeatherChangeFormChangeAbAttr, Abilities.FLOWER_GIFT, [ WeatherType.NONE, WeatherType.SANDSTORM, WeatherType.STRONG_WINDS, WeatherType.FOG, WeatherType.HAIL, WeatherType.HEAVY_RAIN, WeatherType.SNOW, WeatherType.RAIN ])
.uncopiable()
.unreplaceable()
.ignorable(), .ignorable(),
new Ability(Abilities.BAD_DREAMS, 4) new Ability(Abilities.BAD_DREAMS, 4)
.attr(PostTurnHurtIfSleepingAbAttr), .attr(PostTurnHurtIfSleepingAbAttr),
@ -6605,12 +6727,11 @@ export function initAbilities() {
return Utils.isNullOrUndefined(movePhase); return Utils.isNullOrUndefined(movePhase);
}, 1.3), }, 1.3),
new Ability(Abilities.ILLUSION, 5) new Ability(Abilities.ILLUSION, 5)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr)
.unimplemented(), .unimplemented(),
new Ability(Abilities.IMPOSTER, 5) new Ability(Abilities.IMPOSTER, 5)
.attr(PostSummonTransformAbAttr) .attr(PostSummonTransformAbAttr)
.attr(UncopiableAbilityAbAttr), .uncopiable(),
new Ability(Abilities.INFILTRATOR, 5) new Ability(Abilities.INFILTRATOR, 5)
.attr(InfiltratorAbAttr) .attr(InfiltratorAbAttr)
.partial(), // does not bypass Mist .partial(), // does not bypass Mist
@ -6652,10 +6773,10 @@ export function initAbilities() {
.attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostBattleInitFormChangeAbAttr, () => 0)
.attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 1 : 0) .attr(PostSummonFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 1 : 0)
.attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 1 : 0) .attr(PostTurnFormChangeAbAttr, p => p.getHpRatio() <= 0.5 ? 1 : 0)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.VICTORY_STAR, 5) new Ability(Abilities.VICTORY_STAR, 5)
.attr(StatMultiplierAbAttr, Stat.ACC, 1.1) .attr(StatMultiplierAbAttr, Stat.ACC, 1.1)
@ -6670,8 +6791,19 @@ export function initAbilities() {
.attr(UserFieldBattlerTagImmunityAbAttr, [ BattlerTagType.INFATUATED, BattlerTagType.TAUNT, BattlerTagType.DISABLED, BattlerTagType.TORMENT, BattlerTagType.HEAL_BLOCK ]) .attr(UserFieldBattlerTagImmunityAbAttr, [ BattlerTagType.INFATUATED, BattlerTagType.TAUNT, BattlerTagType.DISABLED, BattlerTagType.TORMENT, BattlerTagType.HEAL_BLOCK ])
.ignorable(), .ignorable(),
new Ability(Abilities.FLOWER_VEIL, 6) new Ability(Abilities.FLOWER_VEIL, 6)
.ignorable() .attr(ConditionalUserFieldStatusEffectImmunityAbAttr, (target: Pokemon, source: Pokemon | null) => {
.unimplemented(), return source ? target.getTypes().includes(PokemonType.GRASS) && target.id !== source.id : false;
})
.attr(ConditionalUserFieldBattlerTagImmunityAbAttr,
(target: Pokemon) => {
return target.getTypes().includes(PokemonType.GRASS);
},
[ BattlerTagType.DROWSY ],
)
.attr(ConditionalUserFieldProtectStatAbAttr, (target: Pokemon) => {
return target.getTypes().includes(PokemonType.GRASS);
})
.ignorable(),
new Ability(Abilities.CHEEK_POUCH, 6) new Ability(Abilities.CHEEK_POUCH, 6)
.attr(HealFromBerryUseAbAttr, 1 / 3), .attr(HealFromBerryUseAbAttr, 1 / 3),
new Ability(Abilities.PROTEAN, 6) new Ability(Abilities.PROTEAN, 6)
@ -6697,10 +6829,10 @@ export function initAbilities() {
.ignorable() .ignorable()
.partial(), // Mold Breaker ally should not be affected by Sweet Veil .partial(), // Mold Breaker ally should not be affected by Sweet Veil
new Ability(Abilities.STANCE_CHANGE, 6) new Ability(Abilities.STANCE_CHANGE, 6)
.attr(UncopiableAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(UnswappableAbilityAbAttr) .uncopiable()
.attr(UnsuppressableAbilityAbAttr) .unreplaceable()
.attr(NoFusionAbilityAbAttr), .unsuppressable(),
new Ability(Abilities.GALE_WINGS, 6) new Ability(Abilities.GALE_WINGS, 6)
.attr(ChangeMovePriorityAbAttr, (pokemon, move) => pokemon.isFullHp() && pokemon.getMoveType(move) === PokemonType.FLYING, 1), .attr(ChangeMovePriorityAbAttr, (pokemon, move) => pokemon.isFullHp() && pokemon.getMoveType(move) === PokemonType.FLYING, 1),
new Ability(Abilities.MEGA_LAUNCHER, 6) new Ability(Abilities.MEGA_LAUNCHER, 6)
@ -6765,11 +6897,11 @@ export function initAbilities() {
.attr(PostTurnFormChangeAbAttr, p => p.formIndex % 7 + (p.getHpRatio() <= 0.5 ? 7 : 0)) .attr(PostTurnFormChangeAbAttr, p => p.formIndex % 7 + (p.getHpRatio() <= 0.5 ? 7 : 0))
.conditionalAttr(p => p.formIndex !== 7, StatusEffectImmunityAbAttr) .conditionalAttr(p => p.formIndex !== 7, StatusEffectImmunityAbAttr)
.conditionalAttr(p => p.formIndex !== 7, BattlerTagImmunityAbAttr, BattlerTagType.DROWSY) .conditionalAttr(p => p.formIndex !== 7, BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.STAKEOUT, 7) new Ability(Abilities.STAKEOUT, 7)
.attr(MovePowerBoostAbAttr, (user, target, move) => !!target?.turnData.switchedInThisTurn, 2), .attr(MovePowerBoostAbAttr, (user, target, move) => !!target?.turnData.switchedInThisTurn, 2),
@ -6800,15 +6932,12 @@ export function initAbilities() {
.attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostBattleInitFormChangeAbAttr, () => 0)
.attr(PostSummonFormChangeAbAttr, p => p.level < 20 || p.getHpRatio() <= 0.25 ? 0 : 1) .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(PostTurnFormChangeAbAttr, p => p.level < 20 || p.getHpRatio() <= 0.25 ? 0 : 1)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.DISGUISE, 7) new Ability(Abilities.DISGUISE, 7)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
// Add BattlerTagType.DISGUISE if the pokemon is in its disguised form // Add BattlerTagType.DISGUISE if the pokemon is in its disguised form
@ -6818,15 +6947,18 @@ export function initAbilities() {
(pokemon, abilityName) => i18next.t("abilityTriggers:disguiseAvoidedDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }), (pokemon, abilityName) => i18next.t("abilityTriggers:disguiseAvoidedDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }),
(pokemon) => Utils.toDmgValue(pokemon.getMaxHp() / 8)) (pokemon) => Utils.toDmgValue(pokemon.getMaxHp() / 8))
.attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostBattleInitFormChangeAbAttr, () => 0)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint() .bypassFaint()
.ignorable(), .ignorable(),
new Ability(Abilities.BATTLE_BOND, 7) new Ability(Abilities.BATTLE_BOND, 7)
.attr(PostVictoryFormChangeAbAttr, () => 2) .attr(PostVictoryFormChangeAbAttr, () => 2)
.attr(PostBattleInitFormChangeAbAttr, () => 1) .attr(PostBattleInitFormChangeAbAttr, () => 1)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.POWER_CONSTRUCT, 7) new Ability(Abilities.POWER_CONSTRUCT, 7)
.conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostBattleInitFormChangeAbAttr, () => 2) .conditionalAttr(pokemon => pokemon.formIndex === 2 || pokemon.formIndex === 4, PostBattleInitFormChangeAbAttr, () => 2)
@ -6835,20 +6967,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 === 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, 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) .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) .attr(NoFusionAbilityAbAttr)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.CORROSION, 7) new Ability(Abilities.CORROSION, 7)
.attr(IgnoreTypeStatusEffectImmunityAbAttr, [ StatusEffect.POISON, StatusEffect.TOXIC ], [ PokemonType.STEEL, PokemonType.POISON ]) .attr(IgnoreTypeStatusEffectImmunityAbAttr, [ StatusEffect.POISON, StatusEffect.TOXIC ], [ PokemonType.STEEL, PokemonType.POISON ])
.edgeCase(), // Should poison itself with toxic orb. .edgeCase(), // Should poison itself with toxic orb.
new Ability(Abilities.COMATOSE, 7) new Ability(Abilities.COMATOSE, 7)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(StatusEffectImmunityAbAttr, ...getNonVolatileStatusEffects()) .attr(StatusEffectImmunityAbAttr, ...getNonVolatileStatusEffects())
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY), .attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
.uncopiable()
.unreplaceable()
.unsuppressable(),
new Ability(Abilities.QUEENLY_MAJESTY, 7) new Ability(Abilities.QUEENLY_MAJESTY, 7)
.attr(FieldPriorityMoveImmunityAbAttr) .attr(FieldPriorityMoveImmunityAbAttr)
.ignorable(), .ignorable(),
@ -6872,10 +7004,10 @@ export function initAbilities() {
.attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false), .attr(PostDefendStatStageChangeAbAttr, (target, user, move) => move.hasFlag(MoveFlags.MAKES_CONTACT), Stat.SPD, -1, false),
new Ability(Abilities.RECEIVER, 7) new Ability(Abilities.RECEIVER, 7)
.attr(CopyFaintedAllyAbilityAbAttr) .attr(CopyFaintedAllyAbilityAbAttr)
.attr(UncopiableAbilityAbAttr), .uncopiable(),
new Ability(Abilities.POWER_OF_ALCHEMY, 7) new Ability(Abilities.POWER_OF_ALCHEMY, 7)
.attr(CopyFaintedAllyAbilityAbAttr) .attr(CopyFaintedAllyAbilityAbAttr)
.attr(UncopiableAbilityAbAttr), .uncopiable(),
new Ability(Abilities.BEAST_BOOST, 7) new Ability(Abilities.BEAST_BOOST, 7)
.attr(PostVictoryStatStageChangeAbAttr, p => { .attr(PostVictoryStatStageChangeAbAttr, p => {
let highestStat: EffectiveStat; let highestStat: EffectiveStat;
@ -6890,10 +7022,10 @@ export function initAbilities() {
return highestStat!; return highestStat!;
}, 1), }, 1),
new Ability(Abilities.RKS_SYSTEM, 7) new Ability(Abilities.RKS_SYSTEM, 7)
.attr(UncopiableAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(UnswappableAbilityAbAttr) .uncopiable()
.attr(UnsuppressableAbilityAbAttr) .unreplaceable()
.attr(NoFusionAbilityAbAttr), .unsuppressable(),
new Ability(Abilities.ELECTRIC_SURGE, 7) new Ability(Abilities.ELECTRIC_SURGE, 7)
.attr(PostSummonTerrainChangeAbAttr, TerrainType.ELECTRIC) .attr(PostSummonTerrainChangeAbAttr, TerrainType.ELECTRIC)
.attr(PostBiomeChangeTerrainChangeAbAttr, TerrainType.ELECTRIC), .attr(PostBiomeChangeTerrainChangeAbAttr, TerrainType.ELECTRIC),
@ -6939,11 +7071,11 @@ export function initAbilities() {
* @see {@linkcode GulpMissileTagAttr} and {@linkcode GulpMissileTag} for Gulp Missile implementation * @see {@linkcode GulpMissileTagAttr} and {@linkcode GulpMissileTag} for Gulp Missile implementation
*/ */
new Ability(Abilities.GULP_MISSILE, 8) new Ability(Abilities.GULP_MISSILE, 8)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(UncopiableAbilityAbAttr) .unsuppressable()
.attr(UnswappableAbilityAbAttr) .uncopiable()
.unreplaceable()
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.STALWART, 8) new Ability(Abilities.STALWART, 8)
.attr(BlockRedirectAbAttr), .attr(BlockRedirectAbAttr),
@ -6966,9 +7098,6 @@ export function initAbilities() {
new Ability(Abilities.RIPEN, 8) new Ability(Abilities.RIPEN, 8)
.attr(DoubleBerryEffectAbAttr), .attr(DoubleBerryEffectAbAttr),
new Ability(Abilities.ICE_FACE, 8) new Ability(Abilities.ICE_FACE, 8)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(UnsuppressableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
// Add BattlerTagType.ICE_FACE if the pokemon is in ice face form // Add BattlerTagType.ICE_FACE if the pokemon is in ice face form
@ -6981,6 +7110,9 @@ export function initAbilities() {
(target, user, move) => move.category === MoveCategory.PHYSICAL && !!target.getTag(BattlerTagType.ICE_FACE), 0, BattlerTagType.ICE_FACE, (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 })) (pokemon, abilityName) => i18next.t("abilityTriggers:iceFaceAvoidedDamage", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), abilityName: abilityName }))
.attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostBattleInitFormChangeAbAttr, () => 0)
.uncopiable()
.unreplaceable()
.unsuppressable()
.bypassFaint() .bypassFaint()
.ignorable(), .ignorable(),
new Ability(Abilities.POWER_SPOT, 8) new Ability(Abilities.POWER_SPOT, 8)
@ -7003,8 +7135,7 @@ export function initAbilities() {
new Ability(Abilities.NEUTRALIZING_GAS, 8) new Ability(Abilities.NEUTRALIZING_GAS, 8)
.attr(PostSummonAddArenaTagAbAttr, true, ArenaTagType.NEUTRALIZING_GAS, 0) .attr(PostSummonAddArenaTagAbAttr, true, ArenaTagType.NEUTRALIZING_GAS, 0)
.attr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr) .attr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.bypassFaint(), .bypassFaint(),
new Ability(Abilities.PASTEL_VEIL, 8) new Ability(Abilities.PASTEL_VEIL, 8)
@ -7014,11 +7145,11 @@ export function initAbilities() {
new Ability(Abilities.HUNGER_SWITCH, 8) new Ability(Abilities.HUNGER_SWITCH, 8)
.attr(PostTurnFormChangeAbAttr, p => p.getFormKey() ? 0 : 1) .attr(PostTurnFormChangeAbAttr, p => p.getFormKey() ? 0 : 1)
.attr(PostTurnFormChangeAbAttr, p => p.getFormKey() ? 1 : 0) .attr(PostTurnFormChangeAbAttr, p => p.getFormKey() ? 1 : 0)
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.condition((pokemon) => !pokemon.isTerastallized), .condition((pokemon) => !pokemon.isTerastallized)
.uncopiable()
.unreplaceable(),
new Ability(Abilities.QUICK_DRAW, 8) new Ability(Abilities.QUICK_DRAW, 8)
.attr(BypassSpeedChanceAbAttr, 30), .attr(BypassSpeedChanceAbAttr, 30),
new Ability(Abilities.UNSEEN_FIST, 8) new Ability(Abilities.UNSEEN_FIST, 8)
@ -7037,16 +7168,16 @@ export function initAbilities() {
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAsOneGlastrier", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })) .attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAsOneGlastrier", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
.attr(PreventBerryUseAbAttr) .attr(PreventBerryUseAbAttr)
.attr(PostVictoryStatStageChangeAbAttr, Stat.ATK, 1) .attr(PostVictoryStatStageChangeAbAttr, Stat.ATK, 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(UnsuppressableAbilityAbAttr), .unsuppressable(),
new Ability(Abilities.AS_ONE_SPECTRIER, 8) new Ability(Abilities.AS_ONE_SPECTRIER, 8)
.attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAsOneSpectrier", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) })) .attr(PostSummonMessageAbAttr, (pokemon: Pokemon) => i18next.t("abilityTriggers:postSummonAsOneSpectrier", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }))
.attr(PreventBerryUseAbAttr) .attr(PreventBerryUseAbAttr)
.attr(PostVictoryStatStageChangeAbAttr, Stat.SPATK, 1) .attr(PostVictoryStatStageChangeAbAttr, Stat.SPATK, 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(UnsuppressableAbilityAbAttr), .unsuppressable(),
new Ability(Abilities.LINGERING_AROMA, 9) new Ability(Abilities.LINGERING_AROMA, 9)
.attr(PostDefendAbilityGiveAbAttr, Abilities.LINGERING_AROMA) .attr(PostDefendAbilityGiveAbAttr, Abilities.LINGERING_AROMA)
.bypassFaint(), .bypassFaint(),
@ -7081,9 +7212,9 @@ export function initAbilities() {
new Ability(Abilities.WIND_POWER, 9) new Ability(Abilities.WIND_POWER, 9)
.attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.hasFlag(MoveFlags.WIND_MOVE), BattlerTagType.CHARGED), .attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.hasFlag(MoveFlags.WIND_MOVE), BattlerTagType.CHARGED),
new Ability(Abilities.ZERO_TO_HERO, 9) new Ability(Abilities.ZERO_TO_HERO, 9)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(UnsuppressableAbilityAbAttr) .unsuppressable()
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.attr(PostBattleInitFormChangeAbAttr, () => 0) .attr(PostBattleInitFormChangeAbAttr, () => 0)
@ -7092,22 +7223,20 @@ export function initAbilities() {
new Ability(Abilities.COMMANDER, 9) new Ability(Abilities.COMMANDER, 9)
.attr(CommanderAbAttr) .attr(CommanderAbAttr)
.attr(DoubleBattleChanceAbAttr) .attr(DoubleBattleChanceAbAttr)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.edgeCase(), // Encore, Frenzy, and other non-`TURN_END` tags don't lapse correctly on the commanding Pokemon. .edgeCase(), // Encore, Frenzy, and other non-`TURN_END` tags don't lapse correctly on the commanding Pokemon.
new Ability(Abilities.ELECTROMORPHOSIS, 9) new Ability(Abilities.ELECTROMORPHOSIS, 9)
.attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattlerTagType.CHARGED), .attr(PostDefendApplyBattlerTagAbAttr, (target, user, move) => move.category !== MoveCategory.STATUS, BattlerTagType.CHARGED),
new Ability(Abilities.PROTOSYNTHESIS, 9) new Ability(Abilities.PROTOSYNTHESIS, 9)
.conditionalAttr(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN), PostSummonAddBattlerTagAbAttr, BattlerTagType.PROTOSYNTHESIS, 0, true) .conditionalAttr(getWeatherCondition(WeatherType.SUNNY, WeatherType.HARSH_SUN), PostSummonAddBattlerTagAbAttr, BattlerTagType.PROTOSYNTHESIS, 0, true)
.attr(PostWeatherChangeAddBattlerTagAttr, BattlerTagType.PROTOSYNTHESIS, 0, WeatherType.SUNNY, WeatherType.HARSH_SUN) .attr(PostWeatherChangeAddBattlerTagAttr, BattlerTagType.PROTOSYNTHESIS, 0, WeatherType.SUNNY, WeatherType.HARSH_SUN)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr), .attr(NoTransformAbilityAbAttr),
new Ability(Abilities.QUARK_DRIVE, 9) new Ability(Abilities.QUARK_DRIVE, 9)
.conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), PostSummonAddBattlerTagAbAttr, BattlerTagType.QUARK_DRIVE, 0, true) .conditionalAttr(getTerrainCondition(TerrainType.ELECTRIC), PostSummonAddBattlerTagAbAttr, BattlerTagType.QUARK_DRIVE, 0, true)
.attr(PostTerrainChangeAddBattlerTagAttr, BattlerTagType.QUARK_DRIVE, 0, TerrainType.ELECTRIC) .attr(PostTerrainChangeAddBattlerTagAttr, BattlerTagType.QUARK_DRIVE, 0, TerrainType.ELECTRIC)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr), .attr(NoTransformAbilityAbAttr),
new Ability(Abilities.GOOD_AS_GOLD, 9) 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)) .attr(MoveImmunityAbAttr, (pokemon, attacker, move) => pokemon !== attacker && move.category === MoveCategory.STATUS && ![ MoveTarget.ENEMY_SIDE, MoveTarget.BOTH_SIDES, MoveTarget.USER_SIDE ].includes(move.moveTarget))
@ -7171,45 +7300,45 @@ export function initAbilities() {
.attr(PostAttackApplyStatusEffectAbAttr, false, 30, StatusEffect.TOXIC), .attr(PostAttackApplyStatusEffectAbAttr, false, 30, StatusEffect.TOXIC),
new Ability(Abilities.EMBODY_ASPECT_TEAL, 9) new Ability(Abilities.EMBODY_ASPECT_TEAL, 9)
.attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPD ], 1) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPD ], 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable() // TODO is this true?
.attr(NoTransformAbilityAbAttr), .attr(NoTransformAbilityAbAttr),
new Ability(Abilities.EMBODY_ASPECT_WELLSPRING, 9) new Ability(Abilities.EMBODY_ASPECT_WELLSPRING, 9)
.attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPDEF ], 1) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.SPDEF ], 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(NoTransformAbilityAbAttr), .attr(NoTransformAbilityAbAttr),
new Ability(Abilities.EMBODY_ASPECT_HEARTHFLAME, 9) new Ability(Abilities.EMBODY_ASPECT_HEARTHFLAME, 9)
.attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.ATK ], 1) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.ATK ], 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(NoTransformAbilityAbAttr), .attr(NoTransformAbilityAbAttr),
new Ability(Abilities.EMBODY_ASPECT_CORNERSTONE, 9) new Ability(Abilities.EMBODY_ASPECT_CORNERSTONE, 9)
.attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.DEF ], 1) .attr(PostTeraFormChangeStatChangeAbAttr, [ Stat.DEF ], 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(NoTransformAbilityAbAttr), .attr(NoTransformAbilityAbAttr),
new Ability(Abilities.TERA_SHIFT, 9) new Ability(Abilities.TERA_SHIFT, 9)
.attr(PostSummonFormChangeAbAttr, p => p.getFormKey() ? 0 : 1) .attr(PostSummonFormChangeAbAttr, p => p.getFormKey() ? 0 : 1)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.attr(UnsuppressableAbilityAbAttr) .unsuppressable()
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr), .attr(NoFusionAbilityAbAttr),
new Ability(Abilities.TERA_SHELL, 9) new Ability(Abilities.TERA_SHELL, 9)
.attr(FullHpResistTypeAbAttr) .attr(FullHpResistTypeAbAttr)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.ignorable(), .ignorable(),
new Ability(Abilities.TERAFORM_ZERO, 9) 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(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(ClearTerrainAbAttr, [ TerrainType.MISTY, TerrainType.ELECTRIC, TerrainType.GRASSY, TerrainType.PSYCHIC ])
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable()
.condition(getOncePerBattleCondition(Abilities.TERAFORM_ZERO)), .condition(getOncePerBattleCondition(Abilities.TERAFORM_ZERO)),
new Ability(Abilities.POISON_PUPPETEER, 9) new Ability(Abilities.POISON_PUPPETEER, 9)
.attr(UncopiableAbilityAbAttr) .uncopiable()
.attr(UnswappableAbilityAbAttr) .unreplaceable() // TODO is this true?
.attr(ConfusionOnStatusEffectAbAttr, StatusEffect.POISON, StatusEffect.TOXIC) .attr(ConfusionOnStatusEffectAbAttr, StatusEffect.POISON, StatusEffect.TOXIC)
); );
} }

View File

@ -4,7 +4,6 @@ import { MoveFlags } from "#enums/MoveFlags";
import type Pokemon from "../field/pokemon"; import type Pokemon from "../field/pokemon";
import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils"; import { type nil, getFrameMs, getEnumKeys, getEnumValues, animationFileName } from "../utils";
import type { BattlerIndex } from "../battle"; import type { BattlerIndex } from "../battle";
import type { Element } from "json-stable-stringify";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { SubstituteTag } from "./battler-tags"; import { SubstituteTag } from "./battler-tags";
import { isNullOrUndefined } from "../utils"; import { isNullOrUndefined } from "../utils";
@ -1731,10 +1730,12 @@ export async function populateAnims() {
let props: string[]; let props: string[];
for (let p = 0; p < propSets.length; p++) { for (let p = 0; p < propSets.length; p++) {
props = propSets[p]; props = propSets[p];
// @ts-ignore TODO
const ai = props.indexOf(a.key); const ai = props.indexOf(a.key);
if (ai === -1) { if (ai === -1) {
continue; continue;
} }
// @ts-ignore TODO
const bi = props.indexOf(b.key); const bi = props.indexOf(b.key);
return ai < bi ? -1 : ai > bi ? 1 : 0; return ai < bi ? -1 : ai > bi ? 1 : 0;

View File

@ -5,6 +5,7 @@ import {
BlockNonDirectDamageAbAttr, BlockNonDirectDamageAbAttr,
FlinchEffectAbAttr, FlinchEffectAbAttr,
ProtectStatAbAttr, ProtectStatAbAttr,
ConditionalUserFieldProtectStatAbAttr,
ReverseDrainAbAttr, ReverseDrainAbAttr,
} from "#app/data/ability"; } from "#app/data/ability";
import { ChargeAnim, CommonAnim, CommonBattleAnim, MoveChargeAnim } from "#app/data/battle-anims"; import { ChargeAnim, CommonAnim, CommonBattleAnim, MoveChargeAnim } from "#app/data/battle-anims";
@ -3024,6 +3025,7 @@ export class MysteryEncounterPostSummonTag extends BattlerTag {
if (lapseType === BattlerTagLapseType.CUSTOM) { if (lapseType === BattlerTagLapseType.CUSTOM) {
const cancelled = new BooleanHolder(false); const cancelled = new BooleanHolder(false);
applyAbAttrs(ProtectStatAbAttr, pokemon, cancelled); applyAbAttrs(ProtectStatAbAttr, pokemon, cancelled);
applyAbAttrs(ConditionalUserFieldProtectStatAbAttr, pokemon, cancelled, false, pokemon);
if (!cancelled.value) { if (!cancelled.value) {
if (pokemon.mysteryEncounterBattleEffects) { if (pokemon.mysteryEncounterBattleEffects) {
pokemon.mysteryEncounterBattleEffects(pokemon); pokemon.mysteryEncounterBattleEffects(pokemon);

View File

@ -64,9 +64,6 @@ import {
PostDamageForceSwitchAbAttr, PostDamageForceSwitchAbAttr,
PostItemLostAbAttr, PostItemLostAbAttr,
ReverseDrainAbAttr, ReverseDrainAbAttr,
UncopiableAbilityAbAttr,
UnsuppressableAbilityAbAttr,
UnswappableAbilityAbAttr,
UserFieldMoveTypePowerBoostAbAttr, UserFieldMoveTypePowerBoostAbAttr,
VariableMovePowerAbAttr, VariableMovePowerAbAttr,
WonderSkinAbAttr, WonderSkinAbAttr,
@ -7383,7 +7380,7 @@ export class AbilityChangeAttr extends MoveEffectAttr {
} }
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return (user, target, move) => !(this.selfTarget ? user : target).getAbility().hasAttr(UnsuppressableAbilityAbAttr) && (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 { getCondition(): MoveConditionFunc {
return (user, target, move) => { return (user, target, move) => {
let ret = !target.getAbility().hasAttr(UncopiableAbilityAbAttr) && !user.getAbility().hasAttr(UnsuppressableAbilityAbAttr); let ret = target.getAbility().isCopiable && user.getAbility().isReplaceable;
if (this.copyToPartner && globalScene.currentBattle?.double) { if (this.copyToPartner && globalScene.currentBattle?.double) {
ret = ret && (!user.getAlly().hp || !user.getAlly().getAbility().hasAttr(UnsuppressableAbilityAbAttr)); ret = ret && (!user.getAlly().hp || user.getAlly().getAbility().isReplaceable);
} else { } else {
ret = ret && user.getAbility().id !== target.getAbility().id; ret = ret && user.getAbility().id !== target.getAbility().id;
} }
@ -7446,7 +7443,7 @@ export class AbilityGiveAttr extends MoveEffectAttr {
} }
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return (user, target, move) => !user.getAbility().hasAttr(UncopiableAbilityAbAttr) && !target.getAbility().hasAttr(UnsuppressableAbilityAbAttr) && 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 { getCondition(): MoveConditionFunc {
return (user, target, move) => !user.getAbility().hasAttr(UnswappableAbilityAbAttr) && !target.getAbility().hasAttr(UnswappableAbilityAbAttr); return (user, target, move) => [user, target].every(pkmn => pkmn.getAbility().isSwappable);
} }
} }
@ -7499,7 +7496,7 @@ export class SuppressAbilitiesAttr extends MoveEffectAttr {
/** Causes the effect to fail when the target's ability is unsupressable or already suppressed. */ /** Causes the effect to fail when the target's ability is unsupressable or already suppressed. */
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return (user, target, move) => !target.getAbility().hasAttr(UnsuppressableAbilityAbAttr) && !target.summonData.abilitySuppressed; return (user, target, move) => target.getAbility().isSuppressable && !target.summonData.abilitySuppressed;
} }
} }
@ -8692,7 +8689,7 @@ export function initMoves() {
new SelfStatusMove(Moves.REST, PokemonType.PSYCHIC, -1, 5, -1, 0, 1) new SelfStatusMove(Moves.REST, PokemonType.PSYCHIC, -1, 5, -1, 0, 1)
.attr(StatusEffectAttr, StatusEffect.SLEEP, true, 3, true) .attr(StatusEffectAttr, StatusEffect.SLEEP, true, 3, true)
.attr(HealAttr, 1, true) .attr(HealAttr, 1, true)
.condition((user, target, move) => !user.isFullHp() && user.canSetStatus(StatusEffect.SLEEP, true, true)) .condition((user, target, move) => !user.isFullHp() && user.canSetStatus(StatusEffect.SLEEP, true, true, user))
.triageMove(), .triageMove(),
new AttackMove(Moves.ROCK_SLIDE, PokemonType.ROCK, MoveCategory.PHYSICAL, 75, 90, 10, 30, 0, 1) new AttackMove(Moves.ROCK_SLIDE, PokemonType.ROCK, MoveCategory.PHYSICAL, 75, 90, 10, 30, 0, 1)
.attr(FlinchAttr) .attr(FlinchAttr)

View File

@ -161,7 +161,6 @@ import {
applyPreAttackAbAttrs, applyPreAttackAbAttrs,
applyPreDefendAbAttrs, applyPreDefendAbAttrs,
applyPreSetStatusAbAttrs, applyPreSetStatusAbAttrs,
UnsuppressableAbilityAbAttr,
NoFusionAbilityAbAttr, NoFusionAbilityAbAttr,
MultCritAbAttr, MultCritAbAttr,
IgnoreTypeImmunityAbAttr, IgnoreTypeImmunityAbAttr,
@ -2174,7 +2173,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
if ( if (
this.summonData?.abilitySuppressed && this.summonData?.abilitySuppressed &&
!ability.hasAttr(UnsuppressableAbilityAbAttr) ability.isSuppressable
) { ) {
return false; return false;
} }
@ -2197,7 +2196,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) // (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) // If the ability itself is neutralizing gas, don't suppress it (handled through arena tag)
const unsuppressable = const unsuppressable =
ability.hasAttr(UnsuppressableAbilityAbAttr) || !ability.isSuppressable ||
thisAbilitySuppressing || thisAbilitySuppressing ||
(hasSuppressingAbility && !suppressAbilitiesTag.shouldApplyToSelf()); (hasSuppressingAbility && !suppressAbilitiesTag.shouldApplyToSelf());
if (!unsuppressable) { if (!unsuppressable) {
@ -4761,6 +4760,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
stubTag, stubTag,
cancelled, cancelled,
true, true,
this,
), ),
); );
@ -4788,18 +4788,25 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
newTag, newTag,
cancelled, cancelled,
); );
if (cancelled.value) {
return false;
}
const userField = this.getAlliedField(); for (const pokemon of this.getAlliedField()) {
userField.forEach(pokemon =>
applyPreApplyBattlerTagAbAttrs( applyPreApplyBattlerTagAbAttrs(
UserFieldBattlerTagImmunityAbAttr, UserFieldBattlerTagImmunityAbAttr,
pokemon, pokemon,
newTag, newTag,
cancelled, cancelled,
), false,
); this
);
if (cancelled.value) {
return false;
}
}
if (!cancelled.value && newTag.canAdd(this)) { if (newTag.canAdd(this)) {
this.summonData.tags.push(newTag); this.summonData.tags.push(newTag);
newTag.onAdd(this); newTag.onAdd(this);
@ -5443,17 +5450,22 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
cancelled, cancelled,
quiet, quiet,
); );
if (cancelled.value) {
return false;
}
const userField = this.getAlliedField(); for (const pokemon of this.getAlliedField()) {
userField.forEach(pokemon =>
applyPreSetStatusAbAttrs( applyPreSetStatusAbAttrs(
UserFieldStatusEffectImmunityAbAttr, UserFieldStatusEffectImmunityAbAttr,
pokemon, pokemon,
effect, effect,
cancelled, cancelled,
quiet, quiet, this, sourcePokemon,
), )
); if (cancelled.value) {
break;
}
}
if (cancelled.value) { if (cancelled.value) {
return false; return false;

View File

@ -4,6 +4,7 @@ import {
applyAbAttrs, applyAbAttrs,
applyPostStatStageChangeAbAttrs, applyPostStatStageChangeAbAttrs,
applyPreStatStageChangeAbAttrs, applyPreStatStageChangeAbAttrs,
ConditionalUserFieldProtectStatAbAttr,
PostStatStageChangeAbAttr, PostStatStageChangeAbAttr,
ProtectStatAbAttr, ProtectStatAbAttr,
ReflectStatStageChangeAbAttr, ReflectStatStageChangeAbAttr,
@ -151,6 +152,25 @@ export class StatStageChangePhase extends PokemonPhase {
if (!cancelled.value && !this.selfTarget && stages.value < 0) { if (!cancelled.value && !this.selfTarget && stages.value < 0) {
applyPreStatStageChangeAbAttrs(ProtectStatAbAttr, pokemon, stat, cancelled, simulate); applyPreStatStageChangeAbAttrs(ProtectStatAbAttr, pokemon, stat, cancelled, simulate);
applyPreStatStageChangeAbAttrs(
ConditionalUserFieldProtectStatAbAttr,
pokemon,
stat,
cancelled,
simulate,
pokemon,
);
const ally = pokemon.getAlly();
if (ally) {
applyPreStatStageChangeAbAttrs(
ConditionalUserFieldProtectStatAbAttr,
ally,
stat,
cancelled,
simulate,
pokemon,
);
}
/** Potential stat reflection due to Mirror Armor, does not apply to Octolock end of turn effect */ /** Potential stat reflection due to Mirror Armor, does not apply to Octolock end of turn effect */
if ( if (

View File

@ -177,26 +177,6 @@ describe("Abilities - Flower Gift", () => {
await testRevertFormAgainstAbility(game, Abilities.CLOUD_NINE); await testRevertFormAgainstAbility(game, Abilities.CLOUD_NINE);
}); });
it("reverts to Overcast Form when the Pokémon loses Flower Gift, changes form under Harsh Sunlight/Sunny when it regains it", async () => {
game.override.enemyMoveset([Moves.SKILL_SWAP]).weather(WeatherType.HARSH_SUN);
game.override.moveset([Moves.SKILL_SWAP]);
await game.classicMode.startBattle([Species.CHERRIM]);
const cherrim = game.scene.getPlayerPokemon()!;
game.move.select(Moves.SKILL_SWAP);
await game.phaseInterceptor.to("TurnStartPhase");
expect(cherrim.formIndex).toBe(SUNSHINE_FORM);
await game.phaseInterceptor.to("MoveEndPhase");
expect(cherrim.formIndex).toBe(OVERCAST_FORM);
await game.phaseInterceptor.to("MoveEndPhase");
expect(cherrim.formIndex).toBe(SUNSHINE_FORM);
});
it("reverts to Overcast Form when the Flower Gift is suppressed, changes form under Harsh Sunlight/Sunny when it regains it", async () => { it("reverts to Overcast Form when the Flower Gift is suppressed, changes form under Harsh Sunlight/Sunny when it regains it", async () => {
game.override.enemyMoveset([Moves.GASTRO_ACID]).weather(WeatherType.HARSH_SUN); game.override.enemyMoveset([Moves.GASTRO_ACID]).weather(WeatherType.HARSH_SUN);

View File

@ -0,0 +1,166 @@
import { BattlerIndex } from "#app/battle";
import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import { Stat } from "#enums/stat";
import { StatusEffect } from "#enums/status-effect";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { allMoves } from "#app/data/moves/move";
import { BattlerTagType } from "#enums/battler-tag-type";
import { allAbilities } from "#app/data/ability";
describe("Abilities - Flower Veil", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.moveset([Moves.SPLASH])
.enemySpecies(Species.BULBASAUR)
.ability(Abilities.FLOWER_VEIL)
.battleType("single")
.disableCrits()
.enemySpecies(Species.MAGIKARP)
.enemyAbility(Abilities.BALL_FETCH)
.enemyMoveset(Moves.SPLASH);
});
/***********************************************
* Tests for proper handling of status effects *
***********************************************/
it("should not prevent any source of self-inflicted status conditions", async () => {
game.override
.enemyMoveset([Moves.TACKLE, Moves.SPLASH])
.moveset([Moves.REST, Moves.SPLASH])
.startingHeldItems([{ name: "FLAME_ORB" }]);
await game.classicMode.startBattle([Species.BULBASAUR]);
const user = game.scene.getPlayerPokemon()!;
game.move.select(Moves.REST);
await game.forceEnemyMove(Moves.TACKLE);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.toNextTurn();
expect(user.status?.effect).toBe(StatusEffect.SLEEP);
// remove sleep status so we can get burn from the orb
user.resetStatus();
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.SPLASH);
await game.toNextTurn();
expect(user.status?.effect).toBe(StatusEffect.BURN);
});
it("should prevent drowsiness from yawn for a grass user and its grass allies", async () => {
game.override.enemyMoveset([Moves.YAWN]).moveset([Moves.SPLASH]).battleType("double");
await game.classicMode.startBattle([Species.BULBASAUR, Species.BULBASAUR]);
// Clear the ability of the ally to isolate the test
const ally = game.scene.getPlayerField()[1]!;
vi.spyOn(ally, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.YAWN, BattlerIndex.PLAYER);
await game.forceEnemyMove(Moves.YAWN, BattlerIndex.PLAYER_2);
await game.phaseInterceptor.to("BerryPhase");
const user = game.scene.getPlayerPokemon()!;
expect(user.getTag(BattlerTagType.DROWSY)).toBeFalsy();
expect(ally.getTag(BattlerTagType.DROWSY)).toBeFalsy();
});
it("should prevent status conditions from moves like Thunder Wave for a grass user and its grass allies", async () => {
game.override.enemyMoveset([Moves.THUNDER_WAVE]).moveset([Moves.SPLASH]).battleType("double");
vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100);
await game.classicMode.startBattle([Species.BULBASAUR]);
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.THUNDER_WAVE);
await game.toNextTurn();
expect(game.scene.getPlayerPokemon()!.status).toBeUndefined();
vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockClear();
});
it("should not prevent status conditions for a non-grass user and its non-grass allies", async () => {
game.override.enemyMoveset([Moves.THUNDER_WAVE]).moveset([Moves.SPLASH]).battleType("double");
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
const [user, ally] = game.scene.getPlayerField();
vi.spyOn(allMoves[Moves.THUNDER_WAVE], "accuracy", "get").mockReturnValue(100);
// Clear the ally ability to isolate the test
vi.spyOn(ally, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH);
await game.forceEnemyMove(Moves.THUNDER_WAVE, BattlerIndex.PLAYER);
await game.forceEnemyMove(Moves.THUNDER_WAVE, BattlerIndex.PLAYER_2);
await game.phaseInterceptor.to("BerryPhase");
expect(user.status?.effect).toBe(StatusEffect.PARALYSIS);
expect(ally.status?.effect).toBe(StatusEffect.PARALYSIS);
});
/*******************************************
* Tests for proper handling of stat drops *
*******************************************/
it("should prevent the status drops from enemies for the a grass user and its grass allies", async () => {
game.override.enemyMoveset([Moves.GROWL]).moveset([Moves.SPLASH]).battleType("double");
await game.classicMode.startBattle([Species.BULBASAUR, Species.BULBASAUR]);
const [user, ally] = game.scene.getPlayerField();
// Clear the ally ability to isolate the test
vi.spyOn(ally, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("BerryPhase");
expect(user.getStatStage(Stat.ATK)).toBe(0);
expect(ally.getStatStage(Stat.ATK)).toBe(0);
});
it("should not prevent status drops for a non-grass user and its non-grass allies", async () => {
game.override.enemyMoveset([Moves.GROWL]).moveset([Moves.SPLASH]).battleType("double");
await game.classicMode.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
const [user, ally] = game.scene.getPlayerField();
// Clear the ally ability to isolate the test
vi.spyOn(ally, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
game.move.select(Moves.SPLASH);
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("BerryPhase");
expect(user.getStatStage(Stat.ATK)).toBe(-2);
expect(ally.getStatStage(Stat.ATK)).toBe(-2);
});
it("should not prevent self-inflicted stat drops from moves like Close Combat for a user or its allies", async () => {
game.override.moveset([Moves.CLOSE_COMBAT]).battleType("double");
await game.classicMode.startBattle([Species.BULBASAUR, Species.BULBASAUR]);
const [user, ally] = game.scene.getPlayerField();
// Clear the ally ability to isolate the test
vi.spyOn(ally, "getAbility").mockReturnValue(allAbilities[Abilities.BALL_FETCH]);
game.move.select(Moves.CLOSE_COMBAT, 0, BattlerIndex.ENEMY);
game.move.select(Moves.CLOSE_COMBAT, 1, BattlerIndex.ENEMY_2);
await game.phaseInterceptor.to("BerryPhase");
expect(user.getStatStage(Stat.DEF)).toBe(-1);
expect(user.getStatStage(Stat.SPDEF)).toBe(-1);
expect(ally.getStatStage(Stat.DEF)).toBe(-1);
expect(ally.getStatStage(Stat.SPDEF)).toBe(-1);
});
it("should prevent the drops while retaining the boosts from spicy extract", async () => {
game.override.enemyMoveset([Moves.SPICY_EXTRACT]).moveset([Moves.SPLASH]);
await game.classicMode.startBattle([Species.BULBASAUR]);
const user = game.scene.getPlayerPokemon()!;
game.move.select(Moves.SPLASH);
await game.phaseInterceptor.to("BerryPhase");
expect(user.getStatStage(Stat.ATK)).toBe(2);
expect(user.getStatStage(Stat.DEF)).toBe(0);
});
});

View File

@ -210,37 +210,6 @@ describe("Abilities - Forecast", () => {
expect(game.scene.getEnemyPokemon()?.formIndex).not.toBe(RAINY_FORM); expect(game.scene.getEnemyPokemon()?.formIndex).not.toBe(RAINY_FORM);
}); });
it("reverts to Normal Form when Castform loses Forecast, changes form to match the weather when it regains it", async () => {
game.override
.moveset([Moves.SKILL_SWAP, Moves.WORRY_SEED, Moves.SPLASH])
.weather(WeatherType.RAIN)
.battleType("double");
await game.startBattle([Species.CASTFORM, Species.FEEBAS]);
const castform = game.scene.getPlayerField()[0];
expect(castform.formIndex).toBe(RAINY_FORM);
game.move.select(Moves.SKILL_SWAP, 0, BattlerIndex.PLAYER_2);
game.move.select(Moves.SKILL_SWAP, 1, BattlerIndex.PLAYER);
await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to("MoveEndPhase");
expect(castform.formIndex).toBe(NORMAL_FORM);
await game.phaseInterceptor.to("MoveEndPhase");
expect(castform.formIndex).toBe(RAINY_FORM);
await game.toNextTurn();
game.move.select(Moves.SPLASH);
game.move.select(Moves.WORRY_SEED, 1, BattlerIndex.PLAYER);
await game.setTurnOrder([BattlerIndex.PLAYER_2, BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2]);
await game.phaseInterceptor.to("MoveEndPhase");
expect(castform.formIndex).toBe(NORMAL_FORM);
});
it("reverts to Normal Form when Forecast is suppressed, changes form to match the weather when it regains it", async () => { it("reverts to Normal Form when Forecast is suppressed, changes form to match the weather when it regains it", async () => {
game.override.enemyMoveset([Moves.GASTRO_ACID]).weather(WeatherType.RAIN); game.override.enemyMoveset([Moves.GASTRO_ACID]).weather(WeatherType.RAIN);
await game.startBattle([Species.CASTFORM, Species.PIKACHU]); await game.startBattle([Species.CASTFORM, Species.PIKACHU]);

View File

@ -64,4 +64,15 @@ describe("Test Ability Swapping", () => {
expect(game.scene.getPlayerPokemon()?.getStatStage(Stat.ATK)).toBe(1); // would be 2 if passive activated again expect(game.scene.getPlayerPokemon()?.getStatStage(Stat.ATK)).toBe(1); // would be 2 if passive activated again
}); });
// Pickup and Honey Gather are special cases as they're the only abilities to be Unsuppressable but not Unswappable
it("should be able to swap pickup", async () => {
game.override.ability(Abilities.PICKUP).enemyAbility(Abilities.INTIMIDATE).moveset(Moves.ROLE_PLAY);
await game.classicMode.startBattle([Species.FEEBAS]);
game.move.select(Moves.ROLE_PLAY);
await game.phaseInterceptor.to("BerryPhase");
expect(game.scene.getEnemyPokemon()?.getStatStage(Stat.ATK)).toBe(-1);
});
}); });