Add shouldDynamax & shouldTerastal bits to TrainerMon (#4169)
This commit is contained in:
parent
d1b3d1c2c3
commit
de0f94406a
2 changed files with 7 additions and 2 deletions
|
@ -71,6 +71,8 @@ struct TrainerMon
|
||||||
bool8 isShiny : 1;
|
bool8 isShiny : 1;
|
||||||
u8 dynamaxLevel : 4;
|
u8 dynamaxLevel : 4;
|
||||||
bool8 gigantamaxFactor : 1;
|
bool8 gigantamaxFactor : 1;
|
||||||
|
bool8 shouldDynamax : 1;
|
||||||
|
bool8 shouldTerastal : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TRAINER_PARTY(partyArray) partyArray, .partySize = ARRAY_COUNT(partyArray)
|
#define TRAINER_PARTY(partyArray) partyArray, .partySize = ARRAY_COUNT(partyArray)
|
||||||
|
|
|
@ -547,6 +547,9 @@ static void OpponentHandleChooseMove(u32 battler)
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
u16 chosenMove = moveInfo->moves[chosenMoveId];
|
u16 chosenMove = moveInfo->moves[chosenMoveId];
|
||||||
|
bool32 isSecondTrainer = (GetBattlerPosition(battler) == B_POSITION_OPPONENT_RIGHT) && (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) && !BATTLE_TWO_VS_ONE_OPPONENT;
|
||||||
|
u16 trainerId = isSecondTrainer ? gTrainerBattleOpponent_B : gTrainerBattleOpponent_A;
|
||||||
|
const struct TrainerMon *party = gTrainers[trainerId].party;
|
||||||
|
|
||||||
if (GetBattlerMoveTargetType(battler, chosenMove) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
if (GetBattlerMoveTargetType(battler, chosenMove) & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
||||||
gBattlerTarget = battler;
|
gBattlerTarget = battler;
|
||||||
|
@ -564,8 +567,8 @@ static void OpponentHandleChooseMove(u32 battler)
|
||||||
// If opponent can Ultra Burst, do it.
|
// If opponent can Ultra Burst, do it.
|
||||||
else if (CanUltraBurst(battler))
|
else if (CanUltraBurst(battler))
|
||||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_ULTRA_BURST) | (gBattlerTarget << 8));
|
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_ULTRA_BURST) | (gBattlerTarget << 8));
|
||||||
// If opponent can Dynamax and is on final Pokemon, do it.
|
// If opponent can Dynamax and is allowed in the partydata, do it.
|
||||||
else if (CanDynamax(battler) && CountAIAliveNonEggMonsExcept(gBattlerPartyIndexes[battler]) == 0)
|
else if (CanDynamax(battler) && party[isSecondTrainer ? gBattlerPartyIndexes[battler] - MULTI_PARTY_SIZE : gBattlerPartyIndexes[battler]].shouldDynamax)
|
||||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_DYNAMAX) | (gBattlerTarget << 8));
|
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (RET_DYNAMAX) | (gBattlerTarget << 8));
|
||||||
else
|
else
|
||||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8));
|
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8));
|
||||||
|
|
Loading…
Reference in a new issue