From cb91464a4933c14f919a7ff671f00aecd6c8bed4 Mon Sep 17 00:00:00 2001 From: Marty-D Date: Mon, 2 Oct 2017 21:16:17 -0400 Subject: [PATCH] Update Encore --- data/moves.js | 4 ++-- mods/gen6/moves.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/data/moves.js b/data/moves.js index d992b15965..007c675ce8 100644 --- a/data/moves.js +++ b/data/moves.js @@ -4363,7 +4363,7 @@ exports.BattleMovedex = { accuracy: 100, basePower: 0, category: "Status", - desc: "For 3 turns, the target is forced to repeat its last move used. If the affected move runs out of PP, the effect ends. Fails if the target is already under this effect, if it has not made a move, if the move has 0 PP, or if the move is Encore, Mimic, Mirror Move, Sketch, Struggle, or Transform.", + desc: "For 3 turns, the target is forced to repeat its last move used. If the affected move runs out of PP, the effect ends. Fails if the target is already under this effect, if it has not made a move, if the move has 0 PP, or if the move is Assist, Copycat, Encore, Me First, Metronome, Mimic, Mirror Move, Nature Power, Sketch, Sleep Talk, Struggle, Transform, or a Z-Move.", shortDesc: "The target repeats its last move for 3 turns.", id: "encore", isViable: true, @@ -4376,7 +4376,7 @@ exports.BattleMovedex = { duration: 3, noCopy: true, // doesn't get copied by Z-Baton Pass onStart: function (target) { - let noEncore = {encore:1, mimic:1, mirrormove:1, sketch:1, struggle:1, transform:1}; + let noEncore = {assist:1, copycat:1, encore:1, mefirst:1, metronome:1, mimic:1, mirrormove:1, naturepower:1, sketch:1, sleeptalk:1, struggle:1, transform:1}; let moveIndex = target.moves.indexOf(target.lastMove); if (!target.lastMove || this.getMove(target.lastMove).isZ || noEncore[target.lastMove] || (target.moveset[moveIndex] && target.moveset[moveIndex].pp <= 0)) { // it failed diff --git a/mods/gen6/moves.js b/mods/gen6/moves.js index 7fff45b07e..db189dcfe6 100644 --- a/mods/gen6/moves.js +++ b/mods/gen6/moves.js @@ -54,6 +54,50 @@ exports.BattleMovedex = { }, }, }, + encore: { + inherit: true, + desc: "For 3 turns, the target is forced to repeat its last move used. If the affected move runs out of PP, the effect ends. Fails if the target is already under this effect, if it has not made a move, if the move has 0 PP, or if the move is Encore, Mimic, Mirror Move, Sketch, Struggle, or Transform.", + effect: { + duration: 3, + onStart: function (target) { + let noEncore = {encore:1, mimic:1, mirrormove:1, sketch:1, struggle:1, transform:1}; + let moveIndex = target.moves.indexOf(target.lastMove); + if (!target.lastMove || this.getMove(target.lastMove).isZ || noEncore[target.lastMove] || (target.moveset[moveIndex] && target.moveset[moveIndex].pp <= 0)) { + // it failed + delete target.volatiles['encore']; + return false; + } + this.effectData.move = target.lastMove; + this.add('-start', target, 'Encore'); + if (!this.willMove(target)) { + this.effectData.duration++; + } + }, + onOverrideDecision: function (pokemon, target, move) { + if (move.id !== this.effectData.move) return this.effectData.move; + }, + onResidualOrder: 13, + onResidual: function (target) { + if (target.moves.indexOf(target.lastMove) >= 0 && target.moveset[target.moves.indexOf(target.lastMove)].pp <= 0) { // early termination if you run out of PP + delete target.volatiles.encore; + this.add('-end', target, 'Encore'); + } + }, + onEnd: function (target) { + this.add('-end', target, 'Encore'); + }, + onDisableMove: function (pokemon) { + if (!this.effectData.move || !pokemon.hasMove(this.effectData.move)) { + return; + } + for (let i = 0; i < pokemon.moveset.length; i++) { + if (pokemon.moveset[i].id !== this.effectData.move) { + pokemon.disableMove(pokemon.moveset[i].id); + } + } + }, + }, + }, endure: { inherit: true, desc: "The user will survive attacks made by other Pokemon during this turn with at least 1 HP. This move has a 1/X chance of being successful, where X starts at 1 and triples each time this move is successfully used. X resets to 1 if this move fails or if the user's last move used is not Detect, Endure, King's Shield, Protect, Quick Guard, Spiky Shield, or Wide Guard. Fails if the user moves last this turn.",