From 045fe4560980ea53a7763c2ebc8c584bb1ef3f53 Mon Sep 17 00:00:00 2001 From: Ivo Julca Date: Sat, 3 Aug 2019 02:32:25 -0500 Subject: [PATCH] Linked: Make 2nd move autotarget when needed --- data/mods/linked/scripts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/mods/linked/scripts.js b/data/mods/linked/scripts.js index b1ab781151..1b990c6e1e 100644 --- a/data/mods/linked/scripts.js +++ b/data/mods/linked/scripts.js @@ -286,7 +286,9 @@ exports.BattleScripts = { // @ts-ignore let linkedMoves = action.linked; for (let i = linkedMoves.length - 1; i >= 0; i--) { - let pseudoAction = {choice: 'move', priority: action.priority, speed: action.speed, pokemon: action.pokemon, targetLoc: action.targetLoc, moveid: linkedMoves[i].id, move: linkedMoves[i], mega: action.mega}; + const isValidTarget = this.validTargetLoc(action.targetLoc, action.pokemon, linkedMoves[i].target); + const targetLoc = isValidTarget ? action.targetLoc : this.resolveTarget(action.pokemon, linkedMoves[i]); + let pseudoAction = {choice: 'move', priority: action.priority, speed: action.speed, pokemon: action.pokemon, targetLoc: targetLoc, moveid: linkedMoves[i].id, move: linkedMoves[i], mega: action.mega}; // @ts-ignore this.queue.unshift(pseudoAction); }