Changes target TURN_DAMAGED and MAX_HP to inlines (#5822)
This commit is contained in:
parent
3b594e2f38
commit
a2aba3f86a
7 changed files with 98 additions and 90 deletions
|
@ -869,10 +869,6 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER
|
|||
#define IS_MOVE_STATUS(move)(gMovesInfo[move].category == DAMAGE_CATEGORY_STATUS)
|
||||
#define IS_MOVE_RECOIL(move)(gMovesInfo[move].recoil > 0 || gMovesInfo[move].effect == EFFECT_RECOIL_IF_MISS)
|
||||
|
||||
#define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
|
||||
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0) || (gBattleStruct->enduredDamage & (1u << gBattlerTarget)))
|
||||
#define BATTLER_TURN_DAMAGED(battlerId) ((gSpecialStatuses[battlerId].physicalDmg != 0 || gSpecialStatuses[battlerId].specialDmg != 0) || (gBattleStruct->enduredDamage & (1u << battler)))
|
||||
|
||||
/* Checks if 'battlerId' is any of the types.
|
||||
* Passing multiple types is more efficient than calling this multiple
|
||||
* times with one type because it shares the 'GetBattlerTypes' result. */
|
||||
|
@ -1196,6 +1192,18 @@ extern bool8 gLastUsedBallMenuPresent;
|
|||
extern u8 gPartyCriticalHits[PARTY_SIZE];
|
||||
extern u8 gCategoryIconSpriteId;
|
||||
|
||||
static inline bool32 IsBattlerTurnDamaged(u32 battler)
|
||||
{
|
||||
return gSpecialStatuses[battler].physicalDmg != 0
|
||||
|| gSpecialStatuses[battler].specialDmg != 0
|
||||
|| gBattleStruct->enduredDamage & (1u << battler);
|
||||
}
|
||||
|
||||
static inline bool32 IsBattlerAtMaxHp(u32 battler)
|
||||
{
|
||||
return gBattleMons[battler].hp == gBattleMons[battler].maxHP;
|
||||
}
|
||||
|
||||
static inline u32 GetBattlerPosition(u32 battler)
|
||||
{
|
||||
return gBattlerPositions[battler];
|
||||
|
|
|
@ -44,7 +44,7 @@ void RestoreBattlerData(u32 battlerId);
|
|||
u32 GetAIChosenMove(u32 battlerId);
|
||||
u32 GetTotalBaseStat(u32 species);
|
||||
bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler);
|
||||
bool32 AtMaxHp(u32 battler);
|
||||
bool32 AI_BattlerAtMaxHp(u32 battler);
|
||||
u32 GetHealthPercentage(u32 battler);
|
||||
bool32 IsBattlerTrapped(u32 battler, bool32 switching);
|
||||
s32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler2, u32 moveConsidered);
|
||||
|
|
|
@ -1663,7 +1663,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (AtMaxHp(battlerAtk))
|
||||
if (AI_BattlerAtMaxHp(battlerAtk))
|
||||
ADJUST_SCORE(-10);
|
||||
else if (aiData->hpPercents[battlerAtk] >= 80)
|
||||
ADJUST_SCORE(-5); // do it if nothing better
|
||||
|
@ -1802,7 +1802,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
case EFFECT_RESTORE_HP:
|
||||
case EFFECT_SOFTBOILED:
|
||||
case EFFECT_ROOST:
|
||||
if (AtMaxHp(battlerAtk))
|
||||
if (AI_BattlerAtMaxHp(battlerAtk))
|
||||
ADJUST_SCORE(-10);
|
||||
else if (aiData->hpPercents[battlerAtk] >= 90)
|
||||
ADJUST_SCORE(-9); //No point in healing, but should at least do it if nothing better
|
||||
|
@ -1812,7 +1812,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
case EFFECT_MOONLIGHT:
|
||||
if ((AI_GetWeather(aiData) & (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_HAIL | B_WEATHER_SNOW | B_WEATHER_FOG)))
|
||||
ADJUST_SCORE(-3);
|
||||
else if (AtMaxHp(battlerAtk))
|
||||
else if (AI_BattlerAtMaxHp(battlerAtk))
|
||||
ADJUST_SCORE(-10);
|
||||
else if (aiData->hpPercents[battlerAtk] >= 90)
|
||||
ADJUST_SCORE(-9); //No point in healing, but should at least do it if nothing better
|
||||
|
@ -1822,7 +1822,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
ADJUST_SCORE(-10);
|
||||
else if (battlerDef == BATTLE_PARTNER(battlerAtk))
|
||||
break; //Always heal your ally
|
||||
else if (AtMaxHp(battlerAtk))
|
||||
else if (AI_BattlerAtMaxHp(battlerAtk))
|
||||
ADJUST_SCORE(-10);
|
||||
else if (aiData->hpPercents[battlerAtk] >= 90)
|
||||
ADJUST_SCORE(-8); //No point in healing, but should at least do it if nothing better
|
||||
|
@ -2390,7 +2390,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
{
|
||||
if (gStatuses3[battlerDef] & STATUS3_HEAL_BLOCK)
|
||||
return 0; // cannot even select
|
||||
if (AtMaxHp(battlerDef))
|
||||
if (AI_BattlerAtMaxHp(battlerDef))
|
||||
ADJUST_SCORE(-10);
|
||||
else if (gBattleMons[battlerDef].hp > gBattleMons[battlerDef].maxHP / 2)
|
||||
ADJUST_SCORE(-5);
|
||||
|
@ -2559,8 +2559,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
case EFFECT_JUNGLE_HEALING:
|
||||
if (AtMaxHp(battlerAtk)
|
||||
&& AtMaxHp(BATTLE_PARTNER(battlerAtk))
|
||||
if (AI_BattlerAtMaxHp(battlerAtk)
|
||||
&& AI_BattlerAtMaxHp(BATTLE_PARTNER(battlerAtk))
|
||||
&& !(gBattleMons[battlerAtk].status1 & STATUS1_ANY)
|
||||
&& !(gBattleMons[BATTLE_PARTNER(battlerAtk)].status1 & STATUS1_ANY))
|
||||
ADJUST_SCORE(-10);
|
||||
|
@ -2685,7 +2685,7 @@ static s32 AI_DoubleBattle(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
if (IsMoveEffectWeather(move))
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // check partner move effect
|
||||
|
||||
// Adjust for always crit moves
|
||||
|
|
|
@ -290,7 +290,7 @@ u32 GetHealthPercentage(u32 battlerId)
|
|||
return (u32)((100 * gBattleMons[battlerId].hp) / gBattleMons[battlerId].maxHP);
|
||||
}
|
||||
|
||||
bool32 AtMaxHp(u32 battlerId)
|
||||
bool32 AI_BattlerAtMaxHp(u32 battlerId)
|
||||
{
|
||||
if (AI_DATA->hpPercents[battlerId] == 100)
|
||||
return TRUE;
|
||||
|
@ -1142,7 +1142,7 @@ s32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler, u32 moveConsidered)
|
|||
|
||||
static bool32 CanEndureHit(u32 battler, u32 battlerTarget, u32 move)
|
||||
{
|
||||
if (!BATTLER_MAX_HP(battlerTarget) || gMovesInfo[move].effect == EFFECT_MULTI_HIT)
|
||||
if (!AI_BattlerAtMaxHp(battlerTarget) || gMovesInfo[move].effect == EFFECT_MULTI_HIT)
|
||||
return FALSE;
|
||||
if (gMovesInfo[move].strikeCount > 1 && !(gMovesInfo[move].effect == EFFECT_DRAGON_DARTS && IsValidDoubleBattle(battlerTarget)))
|
||||
return FALSE;
|
||||
|
@ -1564,7 +1564,7 @@ bool32 ShouldTryOHKO(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbil
|
|||
gPotentialItemEffectBattler = battlerDef;
|
||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < AI_DATA->holdEffectParams[battlerDef])
|
||||
return FALSE; //probabilistically speaking, focus band should activate so dont OHKO
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && AtMaxHp(battlerDef))
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && AI_BattlerAtMaxHp(battlerDef))
|
||||
return FALSE;
|
||||
|
||||
if (!DoesBattlerIgnoreAbilityChecks(atkAbility, move) && defAbility == ABILITY_STURDY)
|
||||
|
@ -2761,7 +2761,7 @@ enum AIPivot ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 mov
|
|||
return SHOULD_PIVOT; // Won't get the two turns, pivot
|
||||
|
||||
if (!IS_MOVE_STATUS(move) && ((AI_DATA->shouldSwitch & (1u << battlerAtk))
|
||||
|| (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
|| (AI_BattlerAtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
|| (B_STURDY >= GEN_5 && defAbility == ABILITY_STURDY)
|
||||
|| defAbility == ABILITY_MULTISCALE
|
||||
|| defAbility == ABILITY_SHADOW_SHIELD))))
|
||||
|
@ -2769,7 +2769,7 @@ enum AIPivot ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 mov
|
|||
}
|
||||
else if (!hasStatBoost)
|
||||
{
|
||||
if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
if (!IS_MOVE_STATUS(move) && (AI_BattlerAtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
|| (B_STURDY >= GEN_5 && defAbility == ABILITY_STURDY)
|
||||
|| defAbility == ABILITY_MULTISCALE
|
||||
|| defAbility == ABILITY_SHADOW_SHIELD)))
|
||||
|
@ -2848,7 +2848,7 @@ enum AIPivot ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 mov
|
|||
// can knock out foe in 2 hits
|
||||
if (IS_MOVE_STATUS(move) && ((AI_DATA->shouldSwitch & (1u << battlerAtk)) //Damaging move
|
||||
//&& (switchScore >= SWITCHING_INCREASE_RESIST_ALL_MOVES + SWITCHING_INCREASE_KO_FOE //remove hazards
|
||||
|| (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH && AtMaxHp(battlerDef))))
|
||||
|| (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH && AI_BattlerAtMaxHp(battlerDef))))
|
||||
return DONT_PIVOT; // Pivot to break the sash
|
||||
else
|
||||
return CAN_TRY_PIVOT;
|
||||
|
|
|
@ -4854,7 +4854,7 @@ s8 GetMovePriority(u32 battler, u16 move)
|
|||
return gMovesInfo[MOVE_MAX_GUARD].priority;
|
||||
|
||||
if (ability == ABILITY_GALE_WINGS
|
||||
&& (B_GALE_WINGS < GEN_7 || BATTLER_MAX_HP(battler))
|
||||
&& (B_GALE_WINGS < GEN_7 || IsBattlerAtMaxHp(battler))
|
||||
&& gMovesInfo[move].type == TYPE_FLYING)
|
||||
{
|
||||
priority++;
|
||||
|
|
|
@ -2208,12 +2208,12 @@ static void Cmd_adjustdamage(void)
|
|||
RecordItemEffectBattle(battlerDef, holdEffect);
|
||||
gSpecialStatuses[battlerDef].focusBanded = TRUE;
|
||||
}
|
||||
else if (B_STURDY >= GEN_5 && GetBattlerAbility(battlerDef) == ABILITY_STURDY && BATTLER_MAX_HP(battlerDef))
|
||||
else if (B_STURDY >= GEN_5 && GetBattlerAbility(battlerDef) == ABILITY_STURDY && IsBattlerAtMaxHp(battlerDef))
|
||||
{
|
||||
RecordAbilityBattle(battlerDef, ABILITY_STURDY);
|
||||
gSpecialStatuses[battlerDef].sturdied = TRUE;
|
||||
}
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(battlerDef))
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && IsBattlerAtMaxHp(battlerDef))
|
||||
{
|
||||
RecordItemEffectBattle(battlerDef, holdEffect);
|
||||
gSpecialStatuses[battlerDef].focusSashed = TRUE;
|
||||
|
@ -5997,7 +5997,7 @@ static void Cmd_moveend(void)
|
|||
&& gBattlerAttacker != gBattlerTarget
|
||||
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)
|
||||
&& MoveResultHasEffect(gBattlerTarget)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& gMovesInfo[gCurrentMove].power != 0
|
||||
&& CompareStat(gBattlerTarget, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
{
|
||||
|
@ -6282,7 +6282,7 @@ static void Cmd_moveend(void)
|
|||
if (gBattlerAttacker != gBattlerTarget
|
||||
&& gMovesInfo[gCurrentMove].category != DAMAGE_CATEGORY_STATUS
|
||||
&& MoveResultHasEffect(gBattlerTarget)
|
||||
&& TARGET_TURN_DAMAGED)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
gBattleStruct->timesGotHit[GetBattlerSide(gBattlerTarget)][gBattlerPartyIndexes[gBattlerTarget]]++;
|
||||
}
|
||||
|
@ -6563,7 +6563,7 @@ static void Cmd_moveend(void)
|
|||
&& gBattleMons[gBattlerAttacker].item == ITEM_NONE
|
||||
&& gBattleMons[gBattlerTarget].item != ITEM_NONE
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item)
|
||||
&& !gSpecialStatuses[gBattlerAttacker].gemBoost // In base game, gems are consumed after magician would activate.
|
||||
&& !(gWishFutureKnock.knockedOffMons[GetBattlerSide(gBattlerTarget)] & (1u << gBattlerPartyIndexes[gBattlerTarget]))
|
||||
|
@ -6609,7 +6609,7 @@ static void Cmd_moveend(void)
|
|||
continue;
|
||||
// Since we check if battler was damaged, we don't need to check move result.
|
||||
// In fact, doing so actually prevents multi-target moves from activating eject button properly
|
||||
if (!BATTLER_TURN_DAMAGED(battler))
|
||||
if (!IsBattlerTurnDamaged(battler))
|
||||
continue;
|
||||
}
|
||||
else if (ejectPackBattlers & (1u << battler))
|
||||
|
@ -6704,7 +6704,7 @@ static void Cmd_moveend(void)
|
|||
if (redCardBattlers & (1u << battler)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& BATTLER_TURN_DAMAGED(battler)
|
||||
&& IsBattlerTurnDamaged(battler)
|
||||
&& CanBattlerSwitch(gBattlerAttacker))
|
||||
{
|
||||
gLastUsedItem = gBattleMons[battler].item;
|
||||
|
@ -6753,7 +6753,7 @@ static void Cmd_moveend(void)
|
|||
// Attacker is mon who made contact, battler is mon with pickpocket
|
||||
if (battler != gBattlerAttacker // Cannot pickpocket yourself
|
||||
&& GetBattlerAbility(battler) == ABILITY_PICKPOCKET // Target must have pickpocket ability
|
||||
&& BATTLER_TURN_DAMAGED(battler) // Target needs to have been damaged
|
||||
&& IsBattlerTurnDamaged(battler) // Target needs to have been damaged
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) // Subsitute unaffected
|
||||
&& IsBattlerAlive(battler) // Battler must be alive to pickpocket
|
||||
&& gBattleMons[battler].item == ITEM_NONE // Pickpocketer can't have an item already
|
||||
|
@ -8514,7 +8514,7 @@ static bool32 TryCheekPouch(u32 battler, u32 itemId)
|
|||
&& GetBattlerAbility(battler) == ABILITY_CHEEK_POUCH
|
||||
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)
|
||||
&& gBattleStruct->ateBerry[GetBattlerSide(battler)] & (1u << gBattlerPartyIndexes[battler])
|
||||
&& !BATTLER_MAX_HP(battler))
|
||||
&& !IsBattlerAtMaxHp(battler))
|
||||
{
|
||||
gBattleStruct->moveDamage[battler] = GetNonDynamaxMaxHP(battler) / 3;
|
||||
if (gBattleStruct->moveDamage[battler] == 0)
|
||||
|
@ -9585,7 +9585,7 @@ static void Cmd_various(void)
|
|||
case VARIOUS_JUMP_IF_FULL_HP:
|
||||
{
|
||||
VARIOUS_ARGS(const u8 *jumpInstr);
|
||||
if (BATTLER_MAX_HP(battler))
|
||||
if (IsBattlerAtMaxHp(battler))
|
||||
gBattlescriptCurrInstr = cmd->jumpInstr;
|
||||
else
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
|
@ -9687,7 +9687,7 @@ static void Cmd_various(void)
|
|||
{
|
||||
VARIOUS_ARGS(const u8 *failInstr);
|
||||
if ((gStatuses3[battler] & (STATUS3_SEMI_INVULNERABLE | STATUS3_HEAL_BLOCK))
|
||||
|| BATTLER_MAX_HP(battler)
|
||||
|| IsBattlerAtMaxHp(battler)
|
||||
|| !gBattleMons[battler].hp
|
||||
|| !(IsBattlerGrounded(battler)))
|
||||
{
|
||||
|
@ -12696,7 +12696,7 @@ static void Cmd_tryKO(void)
|
|||
gSpecialStatuses[gBattlerTarget].focusBanded = TRUE;
|
||||
RecordItemEffectBattle(gBattlerTarget, holdEffect);
|
||||
}
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(gBattlerTarget))
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && IsBattlerAtMaxHp(gBattlerTarget))
|
||||
{
|
||||
gSpecialStatuses[gBattlerTarget].focusSashed = TRUE;
|
||||
RecordItemEffectBattle(gBattlerTarget, holdEffect);
|
||||
|
@ -17238,7 +17238,7 @@ void BS_TryHealPulse(void)
|
|||
{
|
||||
NATIVE_ARGS(const u8 *failInstr);
|
||||
|
||||
if (BATTLER_MAX_HP(gBattlerTarget))
|
||||
if (IsBattlerAtMaxHp(gBattlerTarget))
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
|
@ -17495,7 +17495,7 @@ void BS_TryActivateGulpMissile(void)
|
|||
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& gBattleMons[gBattlerTarget].species != SPECIES_CRAMORANT
|
||||
&& GetBattlerAbility(gBattlerTarget) == ABILITY_GULP_MISSILE)
|
||||
{
|
||||
|
@ -17696,7 +17696,7 @@ void BS_TryHitSwitchTarget(void)
|
|||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& MoveResultHasEffect(gBattlerTarget)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_1ST_HIT
|
||||
&& GetBattlerAbility(gBattlerTarget) != ABILITY_GUARD_DOG)
|
||||
{
|
||||
|
|
|
@ -2255,7 +2255,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
else if (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)
|
||||
&& ability == ABILITY_ICE_BODY
|
||||
&& !(gStatuses3[battler] & (STATUS3_UNDERGROUND | STATUS3_UNDERWATER))
|
||||
&& !BATTLER_MAX_HP(battler)
|
||||
&& !IsBattlerAtMaxHp(battler)
|
||||
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
gBattleScripting.battler = battler;
|
||||
|
@ -2282,7 +2282,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
break;
|
||||
case ENDTURN_INGRAIN: // ingrain
|
||||
if ((gStatuses3[battler] & STATUS3_ROOTED)
|
||||
&& !BATTLER_MAX_HP(battler)
|
||||
&& !IsBattlerAtMaxHp(battler)
|
||||
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)
|
||||
&& IsBattlerAlive(battler))
|
||||
{
|
||||
|
@ -2294,7 +2294,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
break;
|
||||
case ENDTURN_AQUA_RING: // aqua ring
|
||||
if ((gStatuses3[battler] & STATUS3_AQUA_RING)
|
||||
&& !BATTLER_MAX_HP(battler)
|
||||
&& !IsBattlerAtMaxHp(battler)
|
||||
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)
|
||||
&& IsBattlerAlive(battler))
|
||||
{
|
||||
|
@ -2372,7 +2372,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
{
|
||||
if (ability == ABILITY_POISON_HEAL)
|
||||
{
|
||||
if (!BATTLER_MAX_HP(battler) && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
if (!IsBattlerAtMaxHp(battler) && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
gBattleStruct->moveDamage[battler] = GetNonDynamaxMaxHP(battler) / 8;
|
||||
if (gBattleStruct->moveDamage[battler] == 0)
|
||||
|
@ -2400,7 +2400,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||
{
|
||||
if (ability == ABILITY_POISON_HEAL)
|
||||
{
|
||||
if (!BATTLER_MAX_HP(battler) && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
if (!IsBattlerAtMaxHp(battler) && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
gBattleStruct->moveDamage[battler] = GetNonDynamaxMaxHP(battler) / 8;
|
||||
if (gBattleStruct->moveDamage[battler] == 0)
|
||||
|
@ -5148,7 +5148,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
// Dry Skin works similarly to Rain Dish in Rain
|
||||
case ABILITY_RAIN_DISH:
|
||||
if (IsBattlerWeatherAffected(battler, B_WEATHER_RAIN)
|
||||
&& !BATTLER_MAX_HP(battler)
|
||||
&& !IsBattlerAtMaxHp(battler)
|
||||
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_RainDishActivates);
|
||||
|
@ -5403,7 +5403,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
{
|
||||
case MOVE_ABSORBED_BY_DRAIN_HP_ABILITY:
|
||||
gBattleStruct->pledgeMove = FALSE;
|
||||
if (BATTLER_MAX_HP(battler) || (B_HEAL_BLOCKING >= GEN_5 && gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
if (IsBattlerAtMaxHp(battler) || (B_HEAL_BLOCKING >= GEN_5 && gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
{
|
||||
if ((gProtectStructs[gBattlerAttacker].notFirstStrike))
|
||||
gBattlescriptCurrInstr = BattleScript_MonMadeMoveUseless;
|
||||
|
@ -5475,7 +5475,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
{
|
||||
case ABILITY_JUSTIFIED:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& moveType == TYPE_DARK
|
||||
&& CompareStat(battler, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
|
@ -5489,7 +5489,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_RATTLED:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& (moveType == TYPE_DARK || moveType == TYPE_BUG || moveType == TYPE_GHOST)
|
||||
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
|
@ -5503,7 +5503,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_WATER_COMPACTION:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& moveType == TYPE_WATER
|
||||
&& CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
|
@ -5518,7 +5518,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_STAMINA:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& gBattlerAttacker != gBattlerTarget
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
{
|
||||
|
@ -5531,7 +5531,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_BERSERK:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& HadMoreThanHalfHpNowDoesnt(battler)
|
||||
&& (gMultiHitCounter == 0 || gMultiHitCounter == 1)
|
||||
|
@ -5548,7 +5548,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_EMERGENCY_EXIT:
|
||||
case ABILITY_WIMP_OUT:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
// Had more than half of hp before, now has less
|
||||
&& HadMoreThanHalfHpNowDoesnt(battler)
|
||||
|
@ -5566,7 +5566,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_WEAK_ARMOR:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& IS_MOVE_PHYSICAL(gCurrentMove)
|
||||
&& (CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN) // Don't activate if both Speed and Defense cannot be raised.
|
||||
|
@ -5582,7 +5582,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_CURSED_BODY:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& gDisableStructs[gBattlerAttacker].disabledMove == MOVE_NONE
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !IsAbilityOnSide(gBattlerAttacker, ABILITY_AROMA_VEIL)
|
||||
|
@ -5602,7 +5602,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_MUMMY:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker)
|
||||
&& gBattleStruct->overwrittenAbilities[gBattlerAttacker] != GetBattlerAbility(gBattlerTarget)
|
||||
|
@ -5627,7 +5627,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_WANDERING_SPIRIT:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker)
|
||||
&& !(GetActiveGimmick(gBattlerTarget) == GIMMICK_DYNAMAX)
|
||||
|
@ -5651,7 +5651,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_ANGER_POINT:
|
||||
if (MoveResultHasEffect(battler)
|
||||
&& gSpecialStatuses[battler].criticalHit
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& CompareStat(battler, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
{
|
||||
|
@ -5665,7 +5665,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
if (MoveResultHasEffect(battler)
|
||||
&& move != MOVE_STRUGGLE
|
||||
&& gMovesInfo[move].power != 0
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !IS_BATTLER_OF_TYPE(battler, moveType)
|
||||
&& moveType != TYPE_STELLAR
|
||||
&& moveType != TYPE_MYSTERY
|
||||
|
@ -5684,7 +5684,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& (CompareStat(gBattlerAttacker, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN) || GetBattlerAbility(gBattlerAttacker) == ABILITY_MIRROR_ARMOR)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||
{
|
||||
|
@ -5701,7 +5701,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||
{
|
||||
|
@ -5780,7 +5780,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& MoveResultHasEffect(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& CanBeSlept(gBattlerAttacker, ability, NOT_BLOCKED_BY_SLEEP_CLAUSE)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||
|
@ -5804,7 +5804,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& CanBePoisoned(gBattlerTarget, gBattlerAttacker, GetBattlerAbility(gBattlerAttacker))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||
|
@ -5825,7 +5825,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& CanBeParalyzed(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||
|
@ -5845,7 +5845,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& (IsMoveMakingContact(move, gBattlerAttacker))
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& CanBeBurned(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker))
|
||||
&& (B_ABILITY_TRIGGER_CHANCE >= GEN_4 ? RandomPercentage(RNG_FLAME_BODY, 30) : RandomChance(RNG_FLAME_BODY, 1, 3)))
|
||||
{
|
||||
|
@ -5861,7 +5861,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& (B_ABILITY_TRIGGER_CHANCE >= GEN_4 ? RandomPercentage(RNG_CUTE_CHARM, 30) : RandomChance(RNG_CUTE_CHARM, 1, 3))
|
||||
&& !(gBattleMons[gBattlerAttacker].status2 & STATUS2_INFATUATION)
|
||||
|
@ -5878,7 +5878,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
}
|
||||
break;
|
||||
case ABILITY_ILLUSION:
|
||||
if (gBattleStruct->illusion[gBattlerTarget].on && !gBattleStruct->illusion[gBattlerTarget].broken && TARGET_TURN_DAMAGED)
|
||||
if (gBattleStruct->illusion[gBattlerTarget].on && !gBattleStruct->illusion[gBattlerTarget].broken && IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_IllusionOff;
|
||||
|
@ -5889,7 +5889,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED)
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
gEffectBattler = gBattlerTarget;
|
||||
BattleScriptPushCursor();
|
||||
|
@ -5899,7 +5899,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_STEAM_ENGINE:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)
|
||||
&& (moveType == TYPE_FIRE || moveType == TYPE_WATER))
|
||||
|
@ -5914,7 +5914,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_SAND_SPIT:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !(gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT))
|
||||
{
|
||||
if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT)
|
||||
|
@ -5935,7 +5935,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_PERISH_BODY:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& (IsMoveMakingContact(move, gBattlerAttacker))
|
||||
|
@ -5956,7 +5956,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_GULP_MISSILE:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(battler)
|
||||
&& gBattleMons[gBattlerTarget].species != SPECIES_CRAMORANT)
|
||||
{
|
||||
|
@ -5987,7 +5987,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_SEED_SOWER:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& TryChangeBattleTerrain(gBattlerTarget, STATUS_FIELD_GRASSY_TERRAIN, &gFieldTimers.terrainTimer))
|
||||
{
|
||||
|
@ -5998,7 +5998,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_THERMAL_EXCHANGE:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& CompareStat(gBattlerTarget, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN)
|
||||
&& moveType == TYPE_FIRE)
|
||||
|
@ -6013,7 +6013,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_ANGER_SHELL:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& (gMultiHitCounter == 0 || gMultiHitCounter == 1) // Activates after all hits from a multi-hit move.
|
||||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& HadMoreThanHalfHpNowDoesnt(gBattlerTarget)
|
||||
|
@ -6031,7 +6031,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
case ABILITY_ELECTROMORPHOSIS:
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& IsBattlerAlive(gBattlerTarget))
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
|
@ -6044,7 +6044,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& (!gBattleStruct->isSkyBattle)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& IS_MOVE_PHYSICAL(gCurrentMove)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& (gSideTimers[GetBattlerSide(gBattlerAttacker)].toxicSpikesAmount != 2))
|
||||
{
|
||||
SWAP(gBattlerAttacker, gBattlerTarget, i);
|
||||
|
@ -6065,7 +6065,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& CanBePoisoned(gBattlerAttacker, gBattlerTarget, GetBattlerAbility(gBattlerTarget))
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(move, gBattlerAttacker)
|
||||
&& TARGET_TURN_DAMAGED // Need to actually hit the target
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget) // Need to actually hit the target
|
||||
&& RandomPercentage(RNG_POISON_TOUCH, 30))
|
||||
{
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_POISON;
|
||||
|
@ -6081,7 +6081,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& CanBePoisoned(gBattlerAttacker, gBattlerTarget, GetBattlerAbility(gBattlerTarget))
|
||||
&& TARGET_TURN_DAMAGED // Need to actually hit the target
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget) // Need to actually hit the target
|
||||
&& RandomWeighted(RNG_TOXIC_CHAIN, 7, 3))
|
||||
{
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_TOXIC;
|
||||
|
@ -6097,7 +6097,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
&& IsBattlerAlive(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& RandomChance(RNG_STENCH, 1, 10)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !MoveHasAdditionalEffect(gCurrentMove, MOVE_EFFECT_FLINCH))
|
||||
{
|
||||
gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH;
|
||||
|
@ -6109,7 +6109,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
|||
break;
|
||||
case ABILITY_GULP_MISSILE:
|
||||
if ((gBattleMons[gBattlerAttacker].species == SPECIES_CRAMORANT)
|
||||
&& ((gCurrentMove == MOVE_SURF && TARGET_TURN_DAMAGED) || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)
|
||||
&& ((gCurrentMove == MOVE_SURF && IsBattlerTurnDamaged(gBattlerTarget)) || gStatuses3[gBattlerAttacker] & STATUS3_UNDERWATER)
|
||||
&& TryBattleFormChange(gBattlerAttacker, FORM_CHANGE_BATTLE_HP_PERCENT))
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
|
@ -6911,7 +6911,7 @@ static u8 TrySetEnigmaBerry(u32 battler)
|
|||
{
|
||||
if (IsBattlerAlive(battler)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& ((BATTLER_TURN_DAMAGED(battler) && gBattleStruct->moveResultFlags[battler] & MOVE_RESULT_SUPER_EFFECTIVE) || gBattleScripting.overrideBerryRequirements)
|
||||
&& ((IsBattlerTurnDamaged(battler) && gBattleStruct->moveResultFlags[battler] & MOVE_RESULT_SUPER_EFFECTIVE) || gBattleScripting.overrideBerryRequirements)
|
||||
&& !(gBattleScripting.overrideBerryRequirements && gBattleMons[battler].hp == gBattleMons[battler].maxHP)
|
||||
&& (B_HEAL_BLOCKING < GEN_5 || !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)))
|
||||
{
|
||||
|
@ -6935,7 +6935,7 @@ static u8 DamagedStatBoostBerryEffect(u32 battler, u8 statId, u8 category)
|
|||
|| (!DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& GetBattleMoveCategory(gCurrentMove) == category
|
||||
&& battler != gBattlerAttacker
|
||||
&& BATTLER_TURN_DAMAGED(battler)))
|
||||
&& IsBattlerTurnDamaged(battler)))
|
||||
)
|
||||
{
|
||||
BufferStatChange(battler, statId, STRINGID_STATROSE);
|
||||
|
@ -7992,7 +7992,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
atkHoldEffectParam *= 2;
|
||||
if (gBattleStruct->moveDamage[battler] != 0 // Need to have done damage
|
||||
&& MoveResultHasEffect(gBattlerTarget)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !gMovesInfo[gCurrentMove].ignoresKingsRock
|
||||
&& gBattleMons[gBattlerTarget].hp
|
||||
&& RandomPercentage(RNG_HOLD_EFFECT_FLINCH, atkHoldEffectParam)
|
||||
|
@ -8084,7 +8084,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
switch (battlerHoldEffect)
|
||||
{
|
||||
case HOLD_EFFECT_AIR_BALLOON:
|
||||
if (TARGET_TURN_DAMAGED)
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget))
|
||||
{
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
BattleScriptPushCursor();
|
||||
|
@ -8092,7 +8092,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
}
|
||||
break;
|
||||
case HOLD_EFFECT_ROCKY_HELMET:
|
||||
if (TARGET_TURN_DAMAGED
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker)
|
||||
&& IsBattlerAlive(gBattlerAttacker)
|
||||
|
@ -8110,7 +8110,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_WEAKNESS_POLICY:
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& gBattleStruct->moveResultFlags[gBattlerTarget] & MOVE_RESULT_SUPER_EFFECTIVE)
|
||||
{
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
|
@ -8120,7 +8120,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_SNOWBALL:
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& moveType == TYPE_ICE)
|
||||
{
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
|
@ -8131,7 +8131,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_LUMINOUS_MOSS:
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& moveType == TYPE_WATER)
|
||||
{
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
|
@ -8142,7 +8142,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_CELL_BATTERY:
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& moveType == TYPE_ELECTRIC)
|
||||
{
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
|
@ -8153,7 +8153,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_ABSORB_BULB:
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& moveType == TYPE_WATER)
|
||||
{
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
|
@ -8167,7 +8167,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_JABOCA_BERRY: // consume and damage attacker if used physical move
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& IS_MOVE_PHYSICAL(gCurrentMove)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||
|
@ -8187,7 +8187,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
break;
|
||||
case HOLD_EFFECT_ROWAP_BERRY: // consume and damage attacker if used special move
|
||||
if (IsBattlerAlive(battler)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
|
||||
&& IS_MOVE_SPECIAL(gCurrentMove)
|
||||
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_MAGIC_GUARD)
|
||||
|
@ -8224,7 +8224,7 @@ u32 ItemBattleEffects(enum ItemEffect caseID, u32 battler, bool32 moveTurn)
|
|||
}
|
||||
break;
|
||||
case HOLD_EFFECT_STICKY_BARB:
|
||||
if (TARGET_TURN_DAMAGED
|
||||
if (IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& MoveResultHasEffect(gBattlerTarget)
|
||||
&& GetBattlerHoldEffect(gBattlerAttacker, TRUE) != HOLD_EFFECT_PROTECTIVE_PADS
|
||||
&& IsMoveMakingContact(gCurrentMove, gBattlerAttacker)
|
||||
|
@ -10101,7 +10101,7 @@ static inline uq4_12_t GetDefenderAbilitiesModifier(u32 move, u32 moveType, u32
|
|||
{
|
||||
case ABILITY_MULTISCALE:
|
||||
case ABILITY_SHADOW_SHIELD:
|
||||
if (BATTLER_MAX_HP(battlerDef))
|
||||
if (IsBattlerAtMaxHp(battlerDef))
|
||||
return UQ_4_12(0.5);
|
||||
break;
|
||||
case ABILITY_FILTER:
|
||||
|
|
Loading…
Reference in a new issue