Fixed an issue related to same turn Encore targeting (#8230)
Co-authored-by: LinathanZel <LinathanZel@github.com>
This commit is contained in:
parent
db9460c670
commit
8c83a25676
5
include/battle.h
Normal file → Executable file
5
include/battle.h
Normal file → Executable file
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user