Correct mechanics when trying to use a 0 PP move

There are two cases where a pokemon might attempt to execute a move
with zero PP:

- a move which had PP when selected, but whose PP was subsequently
  reduced to 0 by Spite; and

- a case where a pokemon has multiple copies of the same move, in
  which case it will always be possible to select the move, but it
  will not be executed if it has 0 PP.

Attempting to use a move with zero PP should not succeed.
This commit is contained in:
Cathy J. Fitzpatrick 2013-06-11 02:15:26 -06:00
parent 837f6a69ac
commit 0aadcf0243

View File

@ -34,8 +34,10 @@ exports.BattleScripts = {
pokemon.lastDamage = 0;
var lockedMove = this.runEvent('LockMove', pokemon);
if (lockedMove === true) lockedMove = false;
if (!lockedMove) {
pokemon.deductPP(move, null, target);
if (!lockedMove && !pokemon.deductPP(move, null, target)) {
this.add('cant', pokemon, 'nopp', move);
this.clearActiveMove(true);
return;
}
pokemon.moveUsed(move);
this.useMove(move, pokemon, target, sourceEffect);