mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 16:02:20 +02:00
Add Eerie Spell
This commit is contained in:
parent
14cc639654
commit
c00ccca3fc
@ -3322,13 +3322,30 @@ export class CopyMoveAttr extends OverrideMoveEffectAttr {
|
||||
}
|
||||
|
||||
export class ReducePpMoveAttr extends MoveEffectAttr {
|
||||
public reduction: integer
|
||||
public causesMoveToFail: boolean
|
||||
|
||||
constructor(reduction: integer, causesMoveToFail: boolean) {
|
||||
super(false, MoveEffectTrigger.POST_APPLY);
|
||||
|
||||
this.reduction = reduction;
|
||||
this.causesMoveToFail = causesMoveToFail;
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
// Null checks can be skipped due to condition function
|
||||
const lastMove = target.getLastXMoves().find(() => true);
|
||||
if (!lastMove) {
|
||||
return false;
|
||||
}
|
||||
const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move);
|
||||
const lastPpUsed = movesetMove.ppUsed;
|
||||
movesetMove.ppUsed = Math.min(movesetMove.ppUsed + 4, movesetMove.getMovePp());
|
||||
user.scene.queueMessage(`It reduced the PP of ${getPokemonMessage(target, `'s\n${movesetMove.getName()} by ${movesetMove.ppUsed - lastPpUsed}!`)}`);
|
||||
if (!lastMove || lastPpUsed < 1) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
movesetMove.ppUsed = Math.min(movesetMove.ppUsed + this.reduction, movesetMove.getMovePp());
|
||||
user.scene.queueMessage(`It reduced the PP of ${getPokemonMessage(target, `'s\n${movesetMove.getName()} by ${movesetMove.ppUsed - lastPpUsed}!`)}`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -3340,6 +3357,7 @@ export class ReducePpMoveAttr extends MoveEffectAttr {
|
||||
const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move);
|
||||
return !!movesetMove?.getPpRatio();
|
||||
}
|
||||
if (!this.causesMoveToFail) {return true;}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
@ -4213,7 +4231,7 @@ export function initMoves() {
|
||||
new AttackMove(Moves.REVERSAL, Type.FIGHTING, MoveCategory.PHYSICAL, -1, 100, 15, -1, 0, 2)
|
||||
.attr(LowHpPowerAttr),
|
||||
new StatusMove(Moves.SPITE, Type.GHOST, 100, 10, -1, 0, 2)
|
||||
.attr(ReducePpMoveAttr),
|
||||
.attr(ReducePpMoveAttr, 4, true),
|
||||
new AttackMove(Moves.POWDER_SNOW, Type.ICE, MoveCategory.SPECIAL, 40, 100, 25, 10, 0, 2)
|
||||
.attr(StatusEffectAttr, StatusEffect.FREEZE)
|
||||
.target(MoveTarget.ALL_NEAR_ENEMIES),
|
||||
@ -5966,7 +5984,7 @@ export function initMoves() {
|
||||
.target(MoveTarget.ALL_NEAR_ENEMIES),
|
||||
new AttackMove(Moves.EERIE_SPELL, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 5, 100, 0, 8)
|
||||
.soundBased()
|
||||
.partial(),
|
||||
.attr(ReducePpMoveAttr, 3, false),
|
||||
new AttackMove(Moves.DIRE_CLAW, Type.POISON, MoveCategory.PHYSICAL, 80, 100, 15, 50, 0, 8)
|
||||
.attr(StatusEffectAttr, StatusEffect.POISON)
|
||||
.attr(StatusEffectAttr, StatusEffect.PARALYSIS)
|
||||
|
Loading…
Reference in New Issue
Block a user