Add Pressure consequences

pull/816/head
hayuna 2024-05-14 15:30:39 +02:00 committed by GitHub
parent e5b5448606
commit 3b17136b03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -1915,8 +1915,15 @@ export class LessPPMorePowerAttr extends VariablePowerAttr {
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const ppMax = move.pp;
const ppUsed = user.moveset.find((m) => m.moveId === move.id).ppUsed;
const ppRemains = ppMax - ppUsed;
let ppUsed = user.moveset.find((m) => m.moveId === move.id).ppUsed;
if(target.hasAbility(Abilities.PRESSURE)) {
ppUsed += 1;
}
let ppRemains = ppMax - ppUsed;
if(ppRemains < 0) ppRemains = 0;
const power = args[0] as Utils.NumberHolder;
switch (ppRemains) {