Fixes minor wrong order in AI_CalcDamage and adds Tera Blast/Tera Storm (#5155)
* Fixes minor wrong order in AI_CalcDamage and adds Tera Blast/Tera Storm * update moveEffect * fix compile
This commit is contained in:
parent
e9c0784dc0
commit
28287fe80a
@ -519,12 +519,16 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
|
||||
{
|
||||
struct SimulatedDamage simDamage;
|
||||
s32 moveType;
|
||||
u32 moveEffect = gMovesInfo[move].effect;
|
||||
uq4_12_t effectivenessMultiplier;
|
||||
bool32 isDamageMoveUnusable = FALSE;
|
||||
bool32 toggledGimmick = FALSE;
|
||||
struct AiLogicData *aiData = AI_DATA;
|
||||
gBattleStruct->aiCalcInProgress = TRUE;
|
||||
|
||||
if (moveEffect == EFFECT_NATURE_POWER)
|
||||
move = GetNaturePowerMove(battlerAtk);
|
||||
|
||||
// Temporarily enable gimmicks for damage calcs if planned
|
||||
if (gBattleStruct->gimmick.usableGimmick[battlerAtk] && GetActiveGimmick(battlerAtk) == GIMMICK_NONE
|
||||
&& !(gBattleStruct->gimmick.usableGimmick[battlerAtk] == GIMMICK_Z_MOVE && !considerZPower))
|
||||
@ -537,12 +541,25 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
|
||||
SetActiveGimmick(battlerAtk, gBattleStruct->gimmick.usableGimmick[battlerAtk]);
|
||||
}
|
||||
|
||||
if (gMovesInfo[move].effect == EFFECT_PHOTON_GEYSER)
|
||||
gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(gBattlerAttacker) != gMovesInfo[gCurrentMove].category);
|
||||
else if (gMovesInfo[move].effect == EFFECT_SHELL_SIDE_ARM)
|
||||
gBattleStruct->swapDamageCategory = (gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] != gMovesInfo[gCurrentMove].category);
|
||||
else if (gMovesInfo[move].effect == EFFECT_NATURE_POWER)
|
||||
move = GetNaturePowerMove(battlerAtk);
|
||||
moveEffect = gMovesInfo[move].effect;
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_PHOTON_GEYSER:
|
||||
gBattleStruct->swapDamageCategory = (GetCategoryBasedOnStats(battlerAtk) == DAMAGE_CATEGORY_PHYSICAL);
|
||||
break;
|
||||
case EFFECT_SHELL_SIDE_ARM:
|
||||
if (gBattleStruct->shellSideArmCategory[battlerAtk][battlerDef] == DAMAGE_CATEGORY_PHYSICAL)
|
||||
gBattleStruct->swapDamageCategory = TRUE;
|
||||
break;
|
||||
case EFFECT_TERA_BLAST:
|
||||
if (GetActiveGimmick(battlerAtk) == GIMMICK_TERA)
|
||||
gBattleStruct->swapDamageCategory = GetCategoryBasedOnStats(battlerAtk) == DAMAGE_CATEGORY_PHYSICAL;
|
||||
break;
|
||||
case EFFECT_TERA_STARSTORM:
|
||||
if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_TERA && gBattleMons[gBattlerAttacker].species == SPECIES_TERAPAGOS_STELLAR)
|
||||
gBattleStruct->swapDamageCategory = GetCategoryBasedOnStats(battlerAtk) == DAMAGE_CATEGORY_PHYSICAL;
|
||||
break;
|
||||
}
|
||||
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
|
||||
@ -559,7 +576,7 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
|
||||
|
||||
ProteanTryChangeType(battlerAtk, aiData->abilities[battlerAtk], move, moveType);
|
||||
// Certain moves like Rollout calculate damage based on values which change during the move execution, but before calling dmg calc.
|
||||
switch (gMovesInfo[move].effect)
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_ROLLOUT:
|
||||
n = gDisableStructs[battlerAtk].rolloutTimer - 1;
|
||||
@ -606,7 +623,7 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
|
||||
else
|
||||
{
|
||||
s32 nonCritDmg = 0;
|
||||
if (gMovesInfo[move].effect == EFFECT_TRIPLE_KICK)
|
||||
if (moveEffect == EFFECT_TRIPLE_KICK)
|
||||
{
|
||||
for (gMultiHitCounter = gMovesInfo[move].strikeCount; gMultiHitCounter > 0; gMultiHitCounter--) // The global is used to simulate actual damage done
|
||||
{
|
||||
@ -630,7 +647,7 @@ struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u
|
||||
if (GetActiveGimmick(battlerAtk) != GIMMICK_Z_MOVE)
|
||||
{
|
||||
// Handle dynamic move damage
|
||||
switch (gMovesInfo[move].effect)
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_LEVEL_DAMAGE:
|
||||
simDamage.expected = simDamage.minimum = gBattleMons[battlerAtk].level * (aiData->abilities[battlerAtk] == ABILITY_PARENTAL_BOND ? 2 : 1);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user