Skip to content

Commit

Permalink
Fix Encore
Browse files Browse the repository at this point in the history
Obviously, if the move isn't part of the moveset, it fails.
  • Loading branch information
Marty-D committed Apr 11, 2018
1 parent cdcf376 commit 9e1e05a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/moves.js
Expand Up @@ -4412,7 +4412,7 @@ let BattleMovedex = {
onStart: function (target) {
let noEncore = ['assist', 'copycat', 'encore', 'mefirst', 'metronome', 'mimic', 'mirrormove', 'naturepower', 'sketch', 'sleeptalk', 'struggle', 'transform'];
let moveIndex = target.lastMove ? target.moves.indexOf(target.lastMove.id) : -1;
if (!target.lastMove || target.lastMove.isZ || noEncore.includes(target.lastMove.id) || (target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0)) {
if (!target.lastMove || target.lastMove.isZ || noEncore.includes(target.lastMove.id) || !target.moveSlots[moveIndex] || target.moveSlots[moveIndex].pp <= 0) {
// it failed
delete target.volatiles['encore'];
return false;
Expand Down
2 changes: 1 addition & 1 deletion mods/gen2/moves.js
Expand Up @@ -189,7 +189,7 @@ exports.BattleMovedex = {
onStart: function (target) {
let noEncore = ['encore', 'metronome', 'mimic', 'mirrormove', 'sketch', 'sleeptalk', 'struggle', 'transform'];
let moveIndex = target.lastMove ? target.moves.indexOf(target.lastMove.id) : -1;
if (!target.lastMove || noEncore.includes(target.lastMove.id) || (target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0)) {
if (!target.lastMove || noEncore.includes(target.lastMove.id) || !target.moveSlots[moveIndex] || target.moveSlots[moveIndex].pp <= 0) {
// it failed
this.add('-fail', target);
delete target.volatiles['encore'];
Expand Down
2 changes: 1 addition & 1 deletion mods/gen3/moves.js
Expand Up @@ -224,7 +224,7 @@ exports.BattleMovedex = {
onStart: function (target) {
let noEncore = ['encore', 'mimic', 'mirrormove', 'sketch', 'struggle', 'transform'];
let moveIndex = target.lastMove ? target.moves.indexOf(target.lastMove.id) : -1;
if (!target.lastMove || noEncore.includes(target.lastMove.id) || (target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0)) {
if (!target.lastMove || noEncore.includes(target.lastMove.id) || !target.moveSlots[moveIndex] || target.moveSlots[moveIndex].pp <= 0) {
// it failed
this.add('-fail', target);
delete target.volatiles['encore'];
Expand Down
2 changes: 1 addition & 1 deletion mods/gen4/moves.js
Expand Up @@ -397,7 +397,7 @@ exports.BattleMovedex = {
onStart: function (target) {
let noEncore = ['encore', 'mimic', 'mirrormove', 'sketch', 'struggle', 'transform'];
let moveIndex = target.lastMove ? target.moves.indexOf(target.lastMove.id) : -1;
if (!target.lastMove || noEncore.includes(target.lastMove.id) || (target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0)) {
if (!target.lastMove || noEncore.includes(target.lastMove.id) || !target.moveSlots[moveIndex] || target.moveSlots[moveIndex].pp <= 0) {
// it failed
this.add('-fail', target);
delete target.volatiles['encore'];
Expand Down
2 changes: 1 addition & 1 deletion mods/gen6/moves.js
Expand Up @@ -62,7 +62,7 @@ exports.BattleMovedex = {
onStart: function (target) {
let noEncore = ['encore', 'mimic', 'mirrormove', 'sketch', 'struggle', 'transform'];
let moveIndex = target.lastMove ? target.moves.indexOf(target.lastMove.id) : -1;
if (!target.lastMove || noEncore.includes(target.lastMove.id) || (target.moveSlots[moveIndex] && target.moveSlots[moveIndex].pp <= 0)) {
if (!target.lastMove || noEncore.includes(target.lastMove.id) || !target.moveSlots[moveIndex] || target.moveSlots[moveIndex].pp <= 0) {
// it failed
delete target.volatiles['encore'];
return false;
Expand Down

0 comments on commit 9e1e05a

Please sign in to comment.