Add AI flag AI_FLAG_KNOW_OPPONENT_PARTY to know all species in party (#8290)
This commit is contained in:
parent
7ad4d1a809
commit
8c2d31b792
@ -38,6 +38,7 @@
|
||||
#define AI_FLAG_ASSUME_STAB AI_FLAG(28) // AI knows player's STAB moves, but nothing else. Restricted version of AI_FLAG_OMNISCIENT.
|
||||
#define AI_FLAG_ASSUME_STATUS_MOVES AI_FLAG(29) // AI has a chance to know certain non-damaging moves, and also Fake Out and Super Fang. Restricted version of AI_FLAG_OMNISCIENT.
|
||||
#define AI_FLAG_ATTACKS_PARTNER AI_FLAG(30) // AI specific to double battles; AI can deliberately attack its 'partner.'
|
||||
#define AI_FLAG_KNOW_OPPONENT_PARTY AI_FLAG(31) // AI knows all the species in the player's party, but not moves/items/abilities unless they've been seen.
|
||||
|
||||
// The following options are enough to have a basic/smart trainer. Any other addtion could make the trainer worse/better depending on the flag
|
||||
#define AI_FLAG_BASIC_TRAINER (AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY)
|
||||
|
||||
@ -447,6 +447,7 @@ void Ai_InitPartyStruct(void)
|
||||
{
|
||||
u32 i;
|
||||
bool32 isOmniscient = (gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_LEFT] & AI_FLAG_OMNISCIENT) || (gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_RIGHT] & AI_FLAG_OMNISCIENT);
|
||||
bool32 hasPartyKnowledge = (gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_LEFT] & AI_FLAG_KNOW_OPPONENT_PARTY) || (gAiThinkingStruct->aiFlags[B_POSITION_OPPONENT_RIGHT] & AI_FLAG_KNOW_OPPONENT_PARTY);
|
||||
struct Pokemon *mon;
|
||||
|
||||
gAiPartyData->count[B_SIDE_PLAYER] = CalculatePlayerPartyCount();
|
||||
@ -467,13 +468,16 @@ void Ai_InitPartyStruct(void)
|
||||
// Find fainted mons
|
||||
for (i = 0; i < gAiPartyData->count[B_SIDE_PLAYER]; i++)
|
||||
{
|
||||
mon = &gPlayerParty[i];
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_HP) == 0)
|
||||
gAiPartyData->mons[B_SIDE_PLAYER][i].isFainted = TRUE;
|
||||
|
||||
if (isOmniscient || hasPartyKnowledge)
|
||||
gAiPartyData->mons[B_SIDE_PLAYER][i].species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
|
||||
if (isOmniscient)
|
||||
{
|
||||
u32 j;
|
||||
mon = &gPlayerParty[i];
|
||||
gAiPartyData->mons[B_SIDE_PLAYER][i].item = GetMonData(mon, MON_DATA_HELD_ITEM);
|
||||
gAiPartyData->mons[B_SIDE_PLAYER][i].heldEffect = GetItemHoldEffect(gAiPartyData->mons[B_SIDE_PLAYER][i].item);
|
||||
gAiPartyData->mons[B_SIDE_PLAYER][i].ability = GetMonAbility(mon);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user