mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-23 22:18:34 +01:00
Fix some moves hitting the user
This commit is contained in:
parent
77842b0376
commit
770a57bec7
@ -4652,14 +4652,23 @@ void HandleAction_RunBattleScript(void) // identical to RunBattleScriptCommands
|
|||||||
|
|
||||||
u32 SetRandomTarget(u32 battlerId)
|
u32 SetRandomTarget(u32 battlerId)
|
||||||
{
|
{
|
||||||
|
u32 target;
|
||||||
static const u8 targets[2][2] =
|
static const u8 targets[2][2] =
|
||||||
{
|
{
|
||||||
[B_SIDE_PLAYER] = {B_POSITION_OPPONENT_LEFT, B_POSITION_OPPONENT_RIGHT},
|
[B_SIDE_PLAYER] = {B_POSITION_OPPONENT_LEFT, B_POSITION_OPPONENT_RIGHT},
|
||||||
[B_SIDE_OPPONENT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT},
|
[B_SIDE_OPPONENT] = {B_POSITION_PLAYER_LEFT, B_POSITION_PLAYER_RIGHT},
|
||||||
};
|
};
|
||||||
u32 target = GetBattlerAtPosition(targets[GetBattlerSide(battlerId)][Random() % 2]);
|
|
||||||
if (!IsBattlerAlive(target))
|
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||||
target ^= BIT_FLANK;
|
{
|
||||||
|
target = GetBattlerAtPosition(targets[GetBattlerSide(battlerId)][Random() % 2]);
|
||||||
|
if (!IsBattlerAlive(target))
|
||||||
|
target ^= BIT_FLANK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = GetBattlerAtPosition(targets[GetBattlerSide(battlerId)][0]);
|
||||||
|
}
|
||||||
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user