mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 23:32:19 +02:00
Update preStatStageChange
This commit is contained in:
parent
e65ae7dfe4
commit
fa00a744f1
@ -2792,6 +2792,10 @@ export class PreSwitchOutFormChangeAbAttr extends PreSwitchOutAbAttr {
|
||||
}
|
||||
|
||||
export class PreStatStageChangeAbAttr extends AbAttr {
|
||||
willSucceedPreStatStageChange(pokemon: Pokemon | null, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
applyPreStatStageChange(pokemon: Pokemon | null, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
@ -2810,6 +2814,10 @@ export class ProtectStatAbAttr extends PreStatStageChangeAbAttr {
|
||||
this.protectedStat = protectedStat;
|
||||
}
|
||||
|
||||
willSucceedPreStatStageChange(pokemon: Pokemon | null, passive: boolean, simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
return Utils.isNullOrUndefined(this.protectedStat) || stat === this.protectedStat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the {@linkcode ProtectedStatAbAttr} to an interaction
|
||||
* @param _pokemon
|
||||
@ -2821,12 +2829,8 @@ export class ProtectStatAbAttr extends PreStatStageChangeAbAttr {
|
||||
* @returns true if the stat is protected, false otherwise
|
||||
*/
|
||||
applyPreStatStageChange(_pokemon: Pokemon, _passive: boolean, _simulated: boolean, stat: BattleStat, cancelled: Utils.BooleanHolder, _args: any[]): boolean {
|
||||
if (Utils.isNullOrUndefined(this.protectedStat) || stat === this.protectedStat) {
|
||||
cancelled.value = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
cancelled.value = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
getTriggerMessage(pokemon: Pokemon, abilityName: string, ..._args: any[]): string {
|
||||
@ -5322,7 +5326,8 @@ export function applyPreSwitchOutAbAttrs(attrType: Constructor<PreSwitchOutAbAtt
|
||||
|
||||
export function applyPreStatStageChangeAbAttrs(attrType: Constructor<PreStatStageChangeAbAttr>,
|
||||
pokemon: Pokemon | null, stat: BattleStat, cancelled: Utils.BooleanHolder, simulated: boolean = false, ...args: any[]): Promise<void> {
|
||||
return applyAbAttrsInternal<PreStatStageChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args), args, false, simulated);
|
||||
return applyAbAttrsInternal<PreStatStageChangeAbAttr>(attrType, pokemon, (attr, passive) => attr.applyPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args),
|
||||
(attr, passive) => attr.willSucceedPreStatStageChange(pokemon, passive, simulated, stat, cancelled, args), args, false, simulated);
|
||||
}
|
||||
|
||||
export function applyPostStatStageChangeAbAttrs(attrType: Constructor<PostStatStageChangeAbAttr>,
|
||||
|
Loading…
Reference in New Issue
Block a user