mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Support for multi battles where Trainer has only one mon (#2670)
This commit is contained in:
parent
6c7f5881e4
commit
ae80d545c5
@ -228,9 +228,11 @@ static void Intro_DelayAndEnd(void)
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 TwoIntroMons(u32 battlerId) // Double battle with both player pokemon active.
|
||||
static bool32 TwoIntroMons(u32 battlerId) // Double battle with both opponent pokemon active.
|
||||
{
|
||||
return (IsDoubleBattle() && IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]]));
|
||||
return (IsDoubleBattle()
|
||||
&& IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[battlerId]])
|
||||
&& IsValidForBattle(&gEnemyParty[gBattlerPartyIndexes[BATTLE_PARTNER(battlerId)]]));
|
||||
}
|
||||
|
||||
static void Intro_WaitForShinyAnimAndHealthbox(void)
|
||||
@ -1969,7 +1971,7 @@ static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite)
|
||||
|
||||
static void Task_StartSendOutAnim(u8 taskId)
|
||||
{
|
||||
u8 savedActiveBank = gActiveBattler;
|
||||
u8 savedActiveBattler = gActiveBattler;
|
||||
|
||||
gActiveBattler = gTasks[taskId].data[0];
|
||||
if ((!TwoIntroMons(gActiveBattler) || (gBattleTypeFlags & BATTLE_TYPE_MULTI)) && !BATTLE_TWO_VS_ONE_OPPONENT)
|
||||
@ -1977,7 +1979,7 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
}
|
||||
else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))
|
||||
else if ((gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) || (BATTLE_TWO_VS_ONE_OPPONENT && !TwoIntroMons(gActiveBattler)))
|
||||
{
|
||||
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
|
||||
StartSendOutAnim(gActiveBattler, FALSE);
|
||||
@ -1992,7 +1994,7 @@ static void Task_StartSendOutAnim(u8 taskId)
|
||||
gActiveBattler ^= BIT_FLANK;
|
||||
}
|
||||
gBattlerControllerFuncs[gActiveBattler] = Intro_TryShinyAnimShowHealthbox;
|
||||
gActiveBattler = savedActiveBank;
|
||||
gActiveBattler = savedActiveBattler;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
|
@ -690,12 +690,17 @@ static void InitLastUsedBallAssets(void)
|
||||
}
|
||||
|
||||
// This function is here to cover a specific case - one player's mon in a 2 vs 1 double battle. In this scenario - display singles layout.
|
||||
// The same goes for a 2 vs 1 where opponent has only one pokemon.
|
||||
u32 WhichBattleCoords(u32 battlerId) // 0 - singles, 1 - doubles
|
||||
{
|
||||
if (GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT
|
||||
&& gPlayerPartyCount == 1
|
||||
&& !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
return 0;
|
||||
else if (GetBattlerPosition(battlerId) == B_POSITION_OPPONENT_LEFT
|
||||
&& gEnemyPartyCount == 1
|
||||
&& !(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))
|
||||
return 0;
|
||||
else
|
||||
return IsDoubleBattle();
|
||||
}
|
||||
|
@ -594,6 +594,7 @@ static void CB2_InitBattleInternal(void)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && !BATTLE_TWO_VS_ONE_OPPONENT)
|
||||
CreateNPCTrainerParty(&gEnemyParty[PARTY_SIZE / 2], gTrainerBattleOpponent_B, FALSE);
|
||||
SetWildMonHeldItem();
|
||||
CalculateEnemyPartyCount();
|
||||
}
|
||||
|
||||
gMain.inBattle = TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user