Prevents proc from self-targeted stat reductions, like superpower

This commit is contained in:
shayebeadlingkl 2024-04-14 14:05:41 -04:00
parent 83a59fb513
commit 7559701d8b
2 changed files with 6 additions and 6 deletions

View File

@ -386,7 +386,7 @@ export class PostDefendAbAttr extends AbAttr {
}
export class PostStatChangeAbAttr extends AbAttr {
applyPostStatChange(pokemon: Pokemon, statsChanged: BattleStat[], levelChanged: integer, args: any[]): boolean | Promise<boolean> {
applyPostStatChange(pokemon: Pokemon, statsChanged: BattleStat[], levelChanged: integer, selfTarget: boolean, args: any[]): boolean | Promise<boolean> {
return false;
}
}
@ -633,8 +633,8 @@ export class PostStatChangeStatChangeAbAttr extends PostStatChangeAbAttr {
this.levels = levels;
}
applyPostStatChange(pokemon: Pokemon, statsChanged: BattleStat[], levelsChanged: integer, args: any[]): boolean {
if (this.condition(pokemon, statsChanged, levelsChanged)) {
applyPostStatChange(pokemon: Pokemon, statsChanged: BattleStat[], levelsChanged: integer, selfTarget: boolean, args: any[]): boolean {
if (this.condition(pokemon, statsChanged, levelsChanged) && !selfTarget) {
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, (pokemon).getBattlerIndex(), true, this.statsToChange, this.levels));
return true;
}
@ -2033,8 +2033,8 @@ export function applyPreStatChangeAbAttrs(attrType: { new(...args: any[]): PreSt
}
export function applyPostStatChangeAbAttrs(attrType: { new(...args: any[]): PostStatChangeAbAttr },
pokemon: Pokemon, stats: BattleStat[], levels: integer, ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PostStatChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostStatChange(pokemon, stats, levels, args), args);
pokemon: Pokemon, stats: BattleStat[], levels: integer, selfTarget: boolean, ...args: any[]): Promise<void> {
return applyAbAttrsInternal<PostStatChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPostStatChange(pokemon, stats, levels, selfTarget, args), args);
}
export function applyPreSetStatusAbAttrs(attrType: { new(...args: any[]): PreSetStatusAbAttr },

View File

@ -2632,7 +2632,7 @@ export class StatChangePhase extends PokemonPhase {
for (let stat of filteredStats)
pokemon.summonData.battleStats[stat] = Math.max(Math.min(pokemon.summonData.battleStats[stat] + levels.value, 6), -6);
applyPostStatChangeAbAttrs(PostStatChangeAbAttr, pokemon, filteredStats, this.levels)
applyPostStatChangeAbAttrs(PostStatChangeAbAttr, pokemon, filteredStats, this.levels, this.selfTarget)
this.end();
};