check for breakable ability
This commit is contained in:
parent
8b2774e07d
commit
89563cb9b1
3 changed files with 18 additions and 14 deletions
|
@ -146,7 +146,7 @@ bool32 TryChangeBattleWeather(u32 battler, u32 weatherEnumId, bool32 viaAbility)
|
|||
u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 moveArg);
|
||||
bool32 TryPrimalReversion(u32 battler);
|
||||
bool32 IsNeutralizingGasOnField(void);
|
||||
bool32 IsMoldBreakerTypeAbility(u32 ability);
|
||||
bool32 IsMoldBreakerTypeAbility(u32 battler, u32 ability);
|
||||
u32 GetBattlerAbility(u32 battler);
|
||||
u32 IsAbilityOnSide(u32 battler, u32 ability);
|
||||
u32 IsAbilityOnOpposingSide(u32 battler, u32 ability);
|
||||
|
|
|
@ -1188,7 +1188,7 @@ bool32 DoesBattlerIgnoreAbilityChecks(u32 atkAbility, u32 move)
|
|||
if (AI_THINKING_STRUCT->aiFlags[sBattler_AI] & AI_FLAG_NEGATE_UNAWARE)
|
||||
return FALSE; // AI handicap flag: doesn't understand ability suppression concept
|
||||
|
||||
if (IsMoldBreakerTypeAbility(atkAbility) || gMovesInfo[move].ignoresTargetAbility)
|
||||
if (IsMoldBreakerTypeAbility(sBattler_AI, atkAbility) || gMovesInfo[move].ignoresTargetAbility)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
@ -2766,7 +2766,7 @@ bool32 AI_CanBeInfatuated(u32 battlerAtk, u32 battlerDef, u32 defAbility)
|
|||
|
||||
u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbility, u32 move)
|
||||
{
|
||||
if (((!IsMoldBreakerTypeAbility(AI_DATA->abilities[battlerAtk]) && (defAbility == ABILITY_SHIELD_DUST || defAbility == ABILITY_INNER_FOCUS))
|
||||
if (((!IsMoldBreakerTypeAbility(battlerAtk, AI_DATA->abilities[battlerAtk]) && (defAbility == ABILITY_SHIELD_DUST || defAbility == ABILITY_INNER_FOCUS))
|
||||
|| AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_COVERT_CLOAK
|
||||
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|
||||
|| AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_SLOWER)) // Opponent goes first
|
||||
|
@ -2809,7 +2809,7 @@ bool32 ShouldFakeOut(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
|| AI_DATA->holdEffects[battlerAtk] == HOLD_EFFECT_CHOICE_BAND
|
||||
|| AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_COVERT_CLOAK
|
||||
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|
||||
|| (!IsMoldBreakerTypeAbility(AI_DATA->abilities[battlerAtk])
|
||||
|| (!IsMoldBreakerTypeAbility(battlerAtk, AI_DATA->abilities[battlerAtk])
|
||||
&& (AI_DATA->abilities[battlerDef] == ABILITY_SHIELD_DUST || AI_DATA->abilities[battlerDef] == ABILITY_INNER_FOCUS)))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -6207,8 +6207,11 @@ bool32 IsNeutralizingGasOnField(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsMoldBreakerTypeAbility(u32 ability)
|
||||
bool32 IsMoldBreakerTypeAbility(u32 battler, u32 ability)
|
||||
{
|
||||
if (gStatuses3[battler] & STATUS3_GASTRO_ACID)
|
||||
return FALSE;
|
||||
|
||||
return (ability == ABILITY_MOLD_BREAKER || ability == ABILITY_TERAVOLT || ability == ABILITY_TURBOBLAZE
|
||||
|| (ability == ABILITY_MYCELIUM_MIGHT && IS_MOVE_STATUS(gCurrentMove)));
|
||||
}
|
||||
|
@ -6224,6 +6227,9 @@ u32 GetBattlerAbility(u32 battler)
|
|||
&& gStatuses3[battler] & STATUS3_GASTRO_ACID
|
||||
&& gBattleMons[battler].ability == ABILITY_COMATOSE)
|
||||
return ABILITY_NONE;
|
||||
|
||||
if (!gAbilitiesInfo[gBattleMons[battler].ability].breakable)
|
||||
return gBattleMons[battler].ability;
|
||||
}
|
||||
|
||||
if (gStatuses3[battler] & STATUS3_GASTRO_ACID)
|
||||
|
@ -6234,15 +6240,13 @@ u32 GetBattlerAbility(u32 battler)
|
|||
&& noAbilityShield)
|
||||
return ABILITY_NONE;
|
||||
|
||||
if (((IsMoldBreakerTypeAbility(gBattleMons[gBattlerAttacker].ability)
|
||||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_GASTRO_ACID))
|
||||
|| gMovesInfo[gCurrentMove].ignoresTargetAbility)
|
||||
&& battler != gBattlerAttacker
|
||||
&& gAbilitiesInfo[gBattleMons[battler].ability].breakable
|
||||
&& noAbilityShield
|
||||
&& gBattlerByTurnOrder[gCurrentTurnActionNumber] == gBattlerAttacker
|
||||
&& gActionsByTurnOrder[gCurrentTurnActionNumber] == B_ACTION_USE_MOVE
|
||||
&& gCurrentTurnActionNumber < gBattlersCount)
|
||||
if ((IsMoldBreakerTypeAbility(gBattlerAttacker, gBattleMons[gBattlerAttacker].ability) || gMovesInfo[gCurrentMove].ignoresTargetAbility)
|
||||
&& battler != gBattlerAttacker
|
||||
&& gAbilitiesInfo[gBattleMons[battler].ability].breakable
|
||||
&& noAbilityShield
|
||||
&& gBattlerByTurnOrder[gCurrentTurnActionNumber] == gBattlerAttacker
|
||||
&& gActionsByTurnOrder[gCurrentTurnActionNumber] == B_ACTION_USE_MOVE
|
||||
&& gCurrentTurnActionNumber < gBattlersCount)
|
||||
return ABILITY_NONE;
|
||||
|
||||
return gBattleMons[battler].ability;
|
||||
|
|
Loading…
Reference in a new issue