Ignore Illusion if the pokemon is the last slot in the party.
This commit is contained in:
parent
f985eefaa1
commit
64c2eb39c0
1 changed files with 7 additions and 0 deletions
|
@ -10398,12 +10398,19 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
|
|||
{
|
||||
struct Pokemon *party, *partnerMon;
|
||||
s32 i, id;
|
||||
u8 side, partyCount;
|
||||
|
||||
gBattleStruct->illusion[battlerId].set = 1;
|
||||
if (GetMonAbility(mon) != ABILITY_ILLUSION)
|
||||
return FALSE;
|
||||
|
||||
party = GetBattlerParty(battlerId);
|
||||
side = GetBattlerSide(battlerId);
|
||||
partyCount = side == B_SIDE_PLAYER ? gPlayerPartyCount : gEnemyPartyCount;
|
||||
|
||||
// If this pokemon is last in the party, ignore Illusion.
|
||||
if (&party[partyCount - 1] == mon)
|
||||
return FALSE;
|
||||
|
||||
if (IsBattlerAlive(BATTLE_PARTNER(battlerId)))
|
||||
partnerMon = &party[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]];
|
||||
|
|
Loading…
Reference in a new issue