Multibattle Partner AI Flags and 2vs1 battler3 AI Flags fix (#7378)
This commit is contained in:
parent
a92f432daf
commit
14a7fc58ad
@ -198,9 +198,16 @@ extern const struct FollowerMsgInfo gFollowerCuriousMessages[];
|
||||
extern const struct FollowerMsgInfo gFollowerMusicMessages[];
|
||||
extern const struct FollowerMsgInfo gFollowerPoisonedMessages[];
|
||||
|
||||
static inline bool8 IsPartnerTrainerId(u16 trainerId)
|
||||
{
|
||||
if (trainerId >= TRAINER_PARTNER(PARTNER_NONE) && trainerId < TRAINER_PARTNER(PARTNER_COUNT))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline u16 SanitizeTrainerId(u16 trainerId)
|
||||
{
|
||||
if (trainerId >= TRAINERS_COUNT)
|
||||
if (trainerId >= TRAINERS_COUNT && !IsPartnerTrainerId(trainerId))
|
||||
return TRAINER_NONE;
|
||||
return trainerId;
|
||||
}
|
||||
@ -212,7 +219,10 @@ static inline const struct Trainer *GetTrainerStructFromId(u16 trainerId)
|
||||
sanitizedTrainerId = SanitizeTrainerId(trainerId);
|
||||
enum DifficultyLevel difficulty = GetTrainerDifficultyLevel(sanitizedTrainerId);
|
||||
|
||||
return &gTrainers[difficulty][sanitizedTrainerId];
|
||||
if (IsPartnerTrainerId(trainerId))
|
||||
return &gBattlePartners[difficulty][sanitizedTrainerId - TRAINER_PARTNER(PARTNER_NONE)];
|
||||
else
|
||||
return &gTrainers[difficulty][sanitizedTrainerId];
|
||||
}
|
||||
|
||||
static inline const enum TrainerClassID GetTrainerClassFromId(u16 trainerId)
|
||||
|
||||
@ -251,7 +251,7 @@ void BattleAI_SetupFlags(void)
|
||||
else
|
||||
{
|
||||
gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_LEFT] = GetAiFlags(TRAINER_BATTLE_PARAM.opponentA);
|
||||
if (TRAINER_BATTLE_PARAM.opponentB != 0)
|
||||
if (TRAINER_BATTLE_PARAM.opponentB != 0 && TRAINER_BATTLE_PARAM.opponentB != 0xFFFF)
|
||||
gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_RIGHT] = GetAiFlags(TRAINER_BATTLE_PARAM.opponentB);
|
||||
else
|
||||
gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_RIGHT] = gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_LEFT];
|
||||
@ -259,7 +259,7 @@ void BattleAI_SetupFlags(void)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
{
|
||||
gAiThinkingStruct->aiFlags[B_POSITION_PLAYER_RIGHT] = GetAiFlags(gPartnerTrainerId - TRAINER_PARTNER(PARTNER_NONE));
|
||||
gAiThinkingStruct->aiFlags[B_POSITION_PLAYER_RIGHT] = GetAiFlags(gPartnerTrainerId);
|
||||
}
|
||||
else if (IsDoubleBattle() && IsAiVsAiBattle())
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user