mirror of
https://github.com/pret/pokeemerald.git
synced 2026-06-02 22:05:46 -05:00
AI gimmick check changed from checking trainer data to a BattleStruct field (#6478)
Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
parent
10412e1a47
commit
a36f838d76
|
|
@ -838,6 +838,9 @@ struct BattleStruct
|
|||
u8 trainerSlideSpriteIds[MAX_BATTLERS_COUNT];
|
||||
u8 embodyAspectBoost[NUM_BATTLE_SIDES];
|
||||
u16 savedMove; // backup current move for mid-turn switching, e.g. Red Card
|
||||
u16 opponentMonCanTera:6;
|
||||
u16 opponentMonCanDynamax:6;
|
||||
u16 padding:4;
|
||||
};
|
||||
|
||||
// The palaceFlags member of struct BattleStruct contains 1 flag per move to indicate which moves the AI should consider,
|
||||
|
|
|
|||
|
|
@ -79,13 +79,9 @@ bool32 ShouldTrainerBattlerUseGimmick(u32 battler, enum Gimmick gimmick)
|
|||
// Check the trainer party data to see if a gimmick is intended.
|
||||
else
|
||||
{
|
||||
bool32 isSecondTrainer = (GetBattlerPosition(battler) == B_POSITION_OPPONENT_RIGHT) && (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !BATTLE_TWO_VS_ONE_OPPONENT;
|
||||
u16 trainerId = isSecondTrainer ? TRAINER_BATTLE_PARAM.opponentB : TRAINER_BATTLE_PARAM.opponentA;
|
||||
const struct TrainerMon *mon = &GetTrainerPartyFromId(trainerId)[isSecondTrainer ? gBattlerPartyIndexes[battler] - MULTI_PARTY_SIZE : gBattlerPartyIndexes[battler]];
|
||||
|
||||
if (gimmick == GIMMICK_TERA && mon->teraType != TYPE_NONE)
|
||||
if (gimmick == GIMMICK_TERA && gBattleStruct->opponentMonCanTera & 1 << gBattlerPartyIndexes[battler])
|
||||
return TRUE;
|
||||
if (gimmick == GIMMICK_DYNAMAX && mon->shouldUseDynamax)
|
||||
if (gimmick == GIMMICK_DYNAMAX && gBattleStruct->opponentMonCanDynamax & 1 << gBattlerPartyIndexes[battler])
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1964,6 +1964,8 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer
|
|||
if (partyData[monIndex].dynamaxLevel > 0)
|
||||
{
|
||||
u32 data = partyData[monIndex].dynamaxLevel;
|
||||
if (partyData[monIndex].shouldUseDynamax)
|
||||
gBattleStruct->opponentMonCanDynamax |= 1 << i;
|
||||
SetMonData(&party[i], MON_DATA_DYNAMAX_LEVEL, &data);
|
||||
}
|
||||
if (partyData[monIndex].gigantamaxFactor)
|
||||
|
|
@ -1973,6 +1975,7 @@ u8 CreateNPCTrainerPartyFromTrainer(struct Pokemon *party, const struct Trainer
|
|||
}
|
||||
if (partyData[monIndex].teraType > 0)
|
||||
{
|
||||
gBattleStruct->opponentMonCanTera |= 1 << i;
|
||||
u32 data = partyData[monIndex].teraType;
|
||||
SetMonData(&party[i], MON_DATA_TERA_TYPE, &data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user