parent
d5f8e9cc0e
commit
35a22d6e82
4 changed files with 9 additions and 9 deletions
|
@ -100,8 +100,8 @@ bool32 ShouldLowerEvasion(u32 battlerAtk, u32 battlerDef, u32 defAbility);
|
||||||
bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect);
|
bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect);
|
||||||
bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category);
|
bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category);
|
||||||
s32 AI_WhichMoveBetter(u32 move1, u32 move2, u32 battlerAtk, u32 battlerDef, s32 noOfHitsToKo);
|
s32 AI_WhichMoveBetter(u32 move1, u32 move2, u32 battlerAtk, u32 battlerDef, s32 noOfHitsToKo);
|
||||||
struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType);
|
struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType);
|
||||||
struct SimulatedDamage AI_CalcDamage(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType);
|
struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType);
|
||||||
bool32 AI_IsDamagedByRecoil(u32 battler);
|
bool32 AI_IsDamagedByRecoil(u32 battler);
|
||||||
u32 GetNoOfHitsToKO(u32 dmg, s32 hp);
|
u32 GetNoOfHitsToKO(u32 dmg, s32 hp);
|
||||||
u32 GetNoOfHitsToKOBattlerDmg(u32 dmg, u32 battlerDef);
|
u32 GetNoOfHitsToKOBattlerDmg(u32 dmg, u32 battlerDef);
|
||||||
|
|
|
@ -436,7 +436,7 @@ static void SetBattlerAiMovesData(struct AiLogicData *aiData, u32 battlerAtk, u3
|
||||||
//&& gMovesInfo[move].power != 0 /* we want to get effectiveness and accuracy of status moves */
|
//&& gMovesInfo[move].power != 0 /* we want to get effectiveness and accuracy of status moves */
|
||||||
&& !(aiData->moveLimitations[battlerAtk] & (1u << moveIndex)))
|
&& !(aiData->moveLimitations[battlerAtk] & (1u << moveIndex)))
|
||||||
{
|
{
|
||||||
dmg = AI_CalcDamage(battlerAtk, battlerDef, move, &effectiveness, TRUE, weather, rollType);
|
dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, TRUE, weather, rollType);
|
||||||
aiData->moveAccuracy[battlerAtk][battlerDef][moveIndex] = Ai_SetMoveAccuracy(aiData, battlerAtk, battlerDef, move);
|
aiData->moveAccuracy[battlerAtk][battlerDef][moveIndex] = Ai_SetMoveAccuracy(aiData, battlerAtk, battlerDef, move);
|
||||||
}
|
}
|
||||||
aiData->simulatedDmg[battlerAtk][battlerDef][moveIndex] = dmg;
|
aiData->simulatedDmg[battlerAtk][battlerDef][moveIndex] = dmg;
|
||||||
|
|
|
@ -158,7 +158,7 @@ static bool32 ShouldSwitchIfHasBadOdds(u32 battler)
|
||||||
playerMove = gBattleMons[opposingBattler].moves[i];
|
playerMove = gBattleMons[opposingBattler].moves[i];
|
||||||
if (playerMove != MOVE_NONE && gMovesInfo[playerMove].power != 0)
|
if (playerMove != MOVE_NONE && gMovesInfo[playerMove].power != 0)
|
||||||
{
|
{
|
||||||
damageTaken = AI_CalcDamage(opposingBattler, battler, playerMove, &effectiveness, FALSE, weather, DMG_ROLL_HIGHEST).expected;
|
damageTaken = AI_CalcDamage(playerMove, opposingBattler, battler, &effectiveness, FALSE, weather, DMG_ROLL_HIGHEST).expected;
|
||||||
if (damageTaken > maxDamageTaken)
|
if (damageTaken > maxDamageTaken)
|
||||||
maxDamageTaken = damageTaken;
|
maxDamageTaken = damageTaken;
|
||||||
}
|
}
|
||||||
|
|
|
@ -374,7 +374,7 @@ bool32 MovesWithCategoryUnusable(u32 attacker, u32 target, u32 category)
|
||||||
}
|
}
|
||||||
|
|
||||||
// To save computation time this function has 2 variants. One saves, sets and restores battlers, while the other doesn't.
|
// To save computation time this function has 2 variants. One saves, sets and restores battlers, while the other doesn't.
|
||||||
struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType)
|
struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, enum DamageRollType rollType)
|
||||||
{
|
{
|
||||||
struct SimulatedDamage dmg;
|
struct SimulatedDamage dmg;
|
||||||
|
|
||||||
|
@ -382,7 +382,7 @@ struct SimulatedDamage AI_CalcDamageSaveBattlers(u32 battlerAtk, u32 battlerDef,
|
||||||
SaveBattlerData(battlerDef);
|
SaveBattlerData(battlerDef);
|
||||||
SetBattlerData(battlerAtk);
|
SetBattlerData(battlerAtk);
|
||||||
SetBattlerData(battlerDef);
|
SetBattlerData(battlerDef);
|
||||||
dmg = AI_CalcDamage(battlerAtk, battlerDef, move, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA), rollType);
|
dmg = AI_CalcDamage(move, battlerAtk, battlerDef, typeEffectiveness, considerZPower, AI_GetWeather(AI_DATA), rollType);
|
||||||
RestoreBattlerData(battlerAtk);
|
RestoreBattlerData(battlerAtk);
|
||||||
RestoreBattlerData(battlerDef);
|
RestoreBattlerData(battlerDef);
|
||||||
return dmg;
|
return dmg;
|
||||||
|
@ -501,7 +501,7 @@ static inline s32 GetDamageByRollType(s32 dmg, enum DamageRollType rollType)
|
||||||
return DmgRoll(dmg);
|
return DmgRoll(dmg);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SimulatedDamage AI_CalcDamage(u32 battlerAtk, u32 battlerDef, u32 move, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType)
|
struct SimulatedDamage AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectiveness, bool32 considerZPower, u32 weather, enum DamageRollType rollType)
|
||||||
{
|
{
|
||||||
struct SimulatedDamage simDamage;
|
struct SimulatedDamage simDamage;
|
||||||
s32 moveType;
|
s32 moveType;
|
||||||
|
@ -3466,7 +3466,7 @@ s32 AI_CalcPartyMonDamage(u32 move, u32 battlerAtk, u32 battlerDef, struct Battl
|
||||||
AI_THINKING_STRUCT->saved[battlerAtk].saved = FALSE;
|
AI_THINKING_STRUCT->saved[battlerAtk].saved = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dmg = AI_CalcDamage(battlerAtk, battlerDef, move, &effectiveness, FALSE, AI_GetWeather(AI_DATA), rollType);
|
dmg = AI_CalcDamage(move, battlerAtk, battlerDef, &effectiveness, FALSE, AI_GetWeather(AI_DATA), rollType);
|
||||||
// restores original gBattleMon struct
|
// restores original gBattleMon struct
|
||||||
FreeRestoreBattleMons(savedBattleMons);
|
FreeRestoreBattleMons(savedBattleMons);
|
||||||
|
|
||||||
|
@ -3934,7 +3934,7 @@ bool32 ShouldUseZMove(u32 battlerAtk, u32 battlerDef, u32 chosenMove)
|
||||||
else if (!IS_MOVE_STATUS(chosenMove) && IS_MOVE_STATUS(zMove))
|
else if (!IS_MOVE_STATUS(chosenMove) && IS_MOVE_STATUS(zMove))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
dmg = AI_CalcDamageSaveBattlers(battlerAtk, battlerDef, chosenMove, &effectiveness, FALSE, DMG_ROLL_DEFAULT);
|
dmg = AI_CalcDamageSaveBattlers(chosenMove, battlerAtk, battlerDef, &effectiveness, FALSE, DMG_ROLL_DEFAULT);
|
||||||
|
|
||||||
if (!IS_MOVE_STATUS(chosenMove) && dmg.minimum >= gBattleMons[battlerDef].hp)
|
if (!IS_MOVE_STATUS(chosenMove) && dmg.minimum >= gBattleMons[battlerDef].hp)
|
||||||
return FALSE; // don't waste damaging z move if can otherwise faint target
|
return FALSE; // don't waste damaging z move if can otherwise faint target
|
||||||
|
|
Loading…
Reference in a new issue