mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +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;
|
||||
}
|
||||
|
||||
const targetMoves = target.getMoveHistory().filter(m => !m.virtual);
|
||||
if (!targetMoves.length) {
|
||||
const targetMove = target.getMoveHistory().filter(m => !m.virtual).at(-1);
|
||||
if (!targetMove) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const sketchedMove = allMoves[targetMoves[0].move];
|
||||
|
||||
const sketchedMove = allMoves[targetMove.move];
|
||||
const sketchIndex = user.getMoveset().findIndex(m => m.moveId === move.id);
|
||||
|
||||
if (sketchIndex === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
user.setMove(sketchIndex, sketchedMove.id);
|
||||
|
||||
user.scene.queueMessage(i18next.t("moveTriggers:sketchedMove", {pokemonName: getPokemonNameWithAffix(user), moveName: sketchedMove.name}));
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user