fix protect struct fields being set during ai calcs

This commit is contained in:
ghoulslash 2021-10-13 10:11:02 -04:00
parent e66820e646
commit 5108d173fc
2 changed files with 6 additions and 1 deletions

View File

@ -209,7 +209,11 @@ u8 BattleAI_ChooseMoveOrAction(void)
ret = ChooseMoveOrAction_Singles();
else
ret = ChooseMoveOrAction_Doubles();
// Clear protect structures, some flags may be set during AI calcs
// e.g. pranksterElevated from GetMovePriority
memset(&gProtectStructs[gActiveBattler], 0, sizeof(struct ProtectStruct));
gCurrentMove = savedCurrentMove;
return ret;
}

View File

@ -3097,6 +3097,7 @@ void FaintClearSetData(void)
gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0;
gProtectStructs[gActiveBattler].statRaised = 0;
gProtectStructs[gActiveBattler].statFell = 0;
gProtectStructs[gActiveBattler].pranksterElevated = 0;
gDisableStructs[gActiveBattler].isFirstTurn = 2;