diff --git a/include/battle.h b/include/battle.h old mode 100644 new mode 100755 index 15b37d62c8..05328fa845 --- a/include/battle.h +++ b/include/battle.h @@ -1249,4 +1249,9 @@ static inline bool32 IsBattlerInvalidForSpreadMove(u32 battlerAtk, u32 battlerDe || (battlerDef == BATTLE_PARTNER(battlerAtk) && (moveTarget == MOVE_TARGET_BOTH)); } +static inline u32 GetChosenMoveFromPosition(u32 battler) +{ + return gBattleMons[battler].moves[gBattleStruct->chosenMovePositions[battler]]; +} + #endif // GUARD_BATTLE_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d0bee7dd4a..112e0dc566 100755 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -11519,6 +11519,13 @@ static void Cmd_trysetencore(void) { gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i]; gDisableStructs[gBattlerTarget].encoredMovePos = i; + + // If the target's selected move is not the same as the move being Encored into, + // the target will select a random opposing target + // Redirection such as Follow Me is already covered in HandleAction_UseMove of battle_util.c + if (gDisableStructs[gBattlerTarget].encoredMove != GetChosenMoveFromPosition(gBattlerTarget)) + gBattleStruct->moveTarget[gBattlerTarget] = SetRandomTarget(gBattlerTarget); + // Encore always lasts 3 turns, but we need to account for a scenario where Encore changes the move during the same turn. if (HasBattlerActedThisTurn(gBattlerTarget)) gDisableStructs[gBattlerTarget].encoreTimer = 4;