mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-29 10:16:14 +00:00
[BUG] Fixes Sketch copying the first move used by the opponent instead of the last (#2759)
* Changes getMoveHistory to getLastXMoves to fix sketch copying first move used instead of last * Optimizes move search and early return * Reverts check for virtual moves
This commit is contained in:
parent
f7b53faae3
commit
cbc6005c57
@ -5169,21 +5169,18 @@ export class SketchAttr extends MoveEffectAttr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetMoves = target.getMoveHistory().filter(m => !m.virtual);
|
const targetMove = target.getMoveHistory().filter(m => !m.virtual).at(-1);
|
||||||
if (!targetMoves.length) {
|
if (!targetMove) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sketchedMove = allMoves[targetMoves[0].move];
|
const sketchedMove = allMoves[targetMove.move];
|
||||||
|
|
||||||
const sketchIndex = user.getMoveset().findIndex(m => m.moveId === move.id);
|
const sketchIndex = user.getMoveset().findIndex(m => m.moveId === move.id);
|
||||||
|
|
||||||
if (sketchIndex === -1) {
|
if (sketchIndex === -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.setMove(sketchIndex, sketchedMove.id);
|
user.setMove(sketchIndex, sketchedMove.id);
|
||||||
|
|
||||||
user.scene.queueMessage(i18next.t("moveTriggers:sketchedMove", {pokemonName: getPokemonNameWithAffix(user), moveName: sketchedMove.name}));
|
user.scene.queueMessage(i18next.t("moveTriggers:sketchedMove", {pokemonName: getPokemonNameWithAffix(user), moveName: sketchedMove.name}));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user