pull/816/merge
hayuna 2024-05-15 12:47:41 -05:00 committed by GitHub
commit 33e225d2be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 40 additions and 1 deletions

View File

@ -2012,6 +2012,45 @@ export class VariablePowerAttr extends MoveAttr {
}
}
export class LessPPMorePowerAttr extends VariablePowerAttr {
/**
* Power up moves when less PP user has
* @param user Pokemon that used the move
* @param target The target of the move
* @param move Move with this attribute
* @param args Utils.NumberHolder for calculating power
* @returns true if the function succeeds
*/
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const ppMax = move.pp;
let ppUsed = user.moveset.find((m) => m.moveId === move.id).ppUsed;
let ppRemains = ppMax - ppUsed;
if(ppRemains < 0) ppRemains = 0;
const power = args[0] as Utils.NumberHolder;
switch (ppRemains) {
case 0:
power.value = 200;
break;
case 1:
power.value = 80;
break;
case 2:
power.value = 60;
break;
case 3:
power.value = 50;
break;
default:
power.value = 40;
break;
}
return true;
}
}
export class MovePowerMultiplierAttr extends VariablePowerAttr {
private powerMultiplierFunc: (user: Pokemon, target: Pokemon, move: Move) => number;
@ -5412,7 +5451,7 @@ export function initMoves() {
),
new AttackMove(Moves.TRUMP_CARD, Type.NORMAL, MoveCategory.SPECIAL, -1, -1, 5, -1, 0, 4)
.makesContact()
.unimplemented(),
.attr(LessPPMorePowerAttr),
new StatusMove(Moves.HEAL_BLOCK, Type.PSYCHIC, 100, 15, -1, 0, 4)
.target(MoveTarget.ALL_NEAR_ENEMIES)
.unimplemented(),