Tera Shell AI calcs (#4742)

* Tera Shell AI calcs

* agbcc
This commit is contained in:
Alex 2024-06-08 20:56:20 +02:00 committed by GitHub
parent 78f1da4131
commit d83f90d51f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View File

@ -718,6 +718,7 @@ struct BattleStruct
} multiBuffer;
u8 wishPerishSongState;
u8 wishPerishSongBattlerId;
u8 aiCalcInProgress:1;
u8 overworldWeatherDone:1;
u8 startingStatusDone:1;
u8 isAtkCancelerForCalledMove:1; // Certain cases in atk canceler should only be checked once, when the original move is called, however others need to be checked the twice.

View File

@ -500,6 +500,7 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
bool32 toggledDynamax = FALSE;
bool32 toggledTera = FALSE;
struct AiLogicData *aiData = AI_DATA;
gBattleStruct->aiCalcInProgress = TRUE;
// Temporarily enable Z-Moves for damage calcs
if (considerZPower && IsViableZMove(battlerAtk, move))
@ -650,6 +651,7 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
// convert multiper to AI_EFFECTIVENESS_xX
*typeEffectiveness = AI_GetEffectiveness(effectivenessMultiplier);
gBattleStruct->aiCalcInProgress = FALSE;
gBattleStruct->swapDamageCategory = FALSE;
gBattleStruct->zmove.active = FALSE;
gBattleStruct->zmove.baseMoves[battlerAtk] = MOVE_NONE;

View File

@ -10172,7 +10172,7 @@ static inline void MulByTypeEffectiveness(uq4_12_t *modifier, u32 move, u32 move
mod = UQ_4_12(1.0);
}
if (gBattleStruct->distortedTypeMatchups & gBitTable[battlerDef])
if (gBattleStruct->distortedTypeMatchups & gBitTable[battlerDef] || (gBattleStruct->aiCalcInProgress && ShouldTeraShellDistortTypeMatchups(move, battlerDef)))
{
mod = UQ_4_12(0.5);
if (recordAbilities)