Add Eerie Spell

This commit is contained in:
Ice 2024-04-29 23:21:13 -05:00
parent 14cc639654
commit c00ccca3fc

View File

@ -3322,13 +3322,30 @@ export class CopyMoveAttr extends OverrideMoveEffectAttr {
} }
export class ReducePpMoveAttr extends MoveEffectAttr { 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 { 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); const lastMove = target.getLastXMoves().find(() => true);
if (!lastMove) {
return false;
}
const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move); const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move);
const lastPpUsed = movesetMove.ppUsed; const lastPpUsed = movesetMove.ppUsed;
movesetMove.ppUsed = Math.min(movesetMove.ppUsed + 4, movesetMove.getMovePp()); if (!lastMove || lastPpUsed < 1) {
user.scene.queueMessage(`It reduced the PP of ${getPokemonMessage(target, `'s\n${movesetMove.getName()} by ${movesetMove.ppUsed - lastPpUsed}!`)}`); 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; return true;
} }
@ -3340,6 +3357,7 @@ export class ReducePpMoveAttr extends MoveEffectAttr {
const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move); const movesetMove = target.getMoveset().find(m => m.moveId === lastMove.move);
return !!movesetMove?.getPpRatio(); return !!movesetMove?.getPpRatio();
} }
if (!this.causesMoveToFail) {return true;}
return false; return false;
}; };
} }
@ -4213,7 +4231,7 @@ export function initMoves() {
new AttackMove(Moves.REVERSAL, Type.FIGHTING, MoveCategory.PHYSICAL, -1, 100, 15, -1, 0, 2) new AttackMove(Moves.REVERSAL, Type.FIGHTING, MoveCategory.PHYSICAL, -1, 100, 15, -1, 0, 2)
.attr(LowHpPowerAttr), .attr(LowHpPowerAttr),
new StatusMove(Moves.SPITE, Type.GHOST, 100, 10, -1, 0, 2) 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) new AttackMove(Moves.POWDER_SNOW, Type.ICE, MoveCategory.SPECIAL, 40, 100, 25, 10, 0, 2)
.attr(StatusEffectAttr, StatusEffect.FREEZE) .attr(StatusEffectAttr, StatusEffect.FREEZE)
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
@ -5966,7 +5984,7 @@ export function initMoves() {
.target(MoveTarget.ALL_NEAR_ENEMIES), .target(MoveTarget.ALL_NEAR_ENEMIES),
new AttackMove(Moves.EERIE_SPELL, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 5, 100, 0, 8) new AttackMove(Moves.EERIE_SPELL, Type.PSYCHIC, MoveCategory.SPECIAL, 80, 100, 5, 100, 0, 8)
.soundBased() .soundBased()
.partial(), .attr(ReducePpMoveAttr, 3, false),
new AttackMove(Moves.DIRE_CLAW, Type.POISON, MoveCategory.PHYSICAL, 80, 100, 15, 50, 0, 8) new AttackMove(Moves.DIRE_CLAW, Type.POISON, MoveCategory.PHYSICAL, 80, 100, 15, 50, 0, 8)
.attr(StatusEffectAttr, StatusEffect.POISON) .attr(StatusEffectAttr, StatusEffect.POISON)
.attr(StatusEffectAttr, StatusEffect.PARALYSIS) .attr(StatusEffectAttr, StatusEffect.PARALYSIS)