Linked: Make 2nd move autotarget when needed

This commit is contained in:
Ivo Julca 2019-08-03 02:32:25 -05:00
parent 3021826112
commit 045fe45609

View File

@ -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);
}