pull/274/merge
lucfd 2024-05-02 18:55:59 -04:00 committed by GitHub
commit 60c1b96593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 2 deletions

View File

@ -2018,6 +2018,29 @@ export class PresentPowerAttr extends VariablePowerAttr {
}
}
export class ConditionalHealAttr extends VariablePowerAttr {
private callback: (user: Pokemon, target: Pokemon, move: Move) => boolean;
private healRatio: number;
constructor(callback: (user: Pokemon, target: Pokemon, move: Move) => boolean, healRatio: number = 0.5) {
super();
this.callback = callback;
this.healRatio = healRatio;
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (this.callback(user, target, move)) {
(args[0] as Utils.NumberHolder).value = 0;
target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(),
Math.max(Math.floor(target.getMaxHp() * this.healRatio), 1), getPokemonMessage(target, ' regained\nhealth!'), true));
return true;
}
return false;
}
}
export class VariableAtkAttr extends MoveAttr {
constructor() {
super();
@ -5616,8 +5639,8 @@ export function initMoves() {
new AttackMove(Moves.THROAT_CHOP, Type.DARK, MoveCategory.PHYSICAL, 80, 100, 15, 100, 0, 7)
.partial(),
new AttackMove(Moves.POLLEN_PUFF, Type.BUG, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
.ballBombMove()
.partial(),
.attr(ConditionalHealAttr, (user, target, move) => (!user.isPlayer() && !target.isPlayer()) || (user.isPlayer() && target.isPlayer()) ? true : false, 0.5)
.ballBombMove(),
new AttackMove(Moves.ANCHOR_SHOT, Type.STEEL, MoveCategory.PHYSICAL, 80, 100, 20, -1, 0, 7)
.attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, false, 1),
new StatusMove(Moves.PSYCHIC_TERRAIN, Type.PSYCHIC, -1, 10, -1, 0, 7)