Transform updates AI_PARTY data (#3295)

* Cmd_transformdataexecution overwrite AI_PARTY data

* remove whitespace

* add RecordAllMoves

---------

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2023-09-23 04:44:30 -04:00 committed by GitHub
parent 662dd7d2c6
commit b77dec1234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,7 @@ bool32 BattlerHasAi(u32 battlerId);
bool32 IsAiBattlerAware(u32 battlerId);
void ClearBattlerMoveHistory(u8 battlerId);
void RecordLastUsedMoveBy(u32 battlerId, u32 move);
void RecordAllMoves(u32 battler);
void RecordKnownMove(u8 battlerId, u32 move);
void RecordAbilityBattle(u8 battlerId, u16 abilityId);
void ClearBattlerAbilityHistory(u8 battlerId);

View File

@ -507,6 +507,11 @@ void RecordKnownMove(u8 battlerId, u32 move)
}
}
void RecordAllMoves(u32 battler)
{
memcpy(AI_PARTY->mons[GetBattlerSide(battler)][gBattlerPartyIndexes[battler]].moves, gBattleMons[battler].moves, MAX_MON_MOVES * sizeof(u16));
}
void RecordAbilityBattle(u8 battlerId, u16 abilityId)
{
BATTLE_HISTORY->abilities[battlerId] = abilityId;

View File

@ -12439,7 +12439,7 @@ static void Cmd_transformdataexecution(void)
{
s32 i;
u8 *battleMonAttacker, *battleMonTarget;
gBattleMons[gBattlerAttacker].status2 |= STATUS2_TRANSFORMED;
gDisableStructs[gBattlerAttacker].disabledMove = MOVE_NONE;
gDisableStructs[gBattlerAttacker].disableTimer = 0;
@ -12464,7 +12464,11 @@ static void Cmd_transformdataexecution(void)
else
gBattleMons[gBattlerAttacker].pp[i] = 5;
}
// update AI knowledge
RecordAllMoves(gBattlerAttacker);
RecordAbilityBattle(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability);
BtlController_EmitResetActionMoveSelection(gBattlerAttacker, BUFFER_A, RESET_MOVE_SELECTION);
MarkBattlerForControllerExec(gBattlerAttacker);
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_TRANSFORMED;