Replace WEATHER_HAS_EFFECT with HasWeatherEffect (#6069)
This commit is contained in:
parent
8184737868
commit
ac9c8ac3bb
@ -355,7 +355,7 @@ struct AiLogicData
|
||||
u8 monToSwitchInId[MAX_BATTLERS_COUNT]; // ID of the mon to switch in.
|
||||
u8 mostSuitableMonId[MAX_BATTLERS_COUNT]; // Stores result of GetMostSuitableMonToSwitchInto, which decides which generic mon the AI would switch into if they decide to switch. This can be overruled by specific mons found in ShouldSwitch; the final resulting mon is stored in AI_monToSwitchIntoId.
|
||||
struct SwitchinCandidate switchinCandidate; // Struct used for deciding which mon to switch to in battle_ai_switch_items.c
|
||||
u8 weatherHasEffect:1; // The same as WEATHER_HAS_EFFECT. Stored here, so it's called only once.
|
||||
u8 weatherHasEffect:1; // The same as HasWeatherEffect(). Stored here, so it's called only once.
|
||||
u8 ejectButtonSwitch:1; // Tracks whether current switch out was from Eject Button
|
||||
u8 ejectPackSwitch:1; // Tracks whether current switch out was from Eject Pack
|
||||
u8 predictingSwitch:1; // Determines whether AI will use predictions this turn or not
|
||||
|
||||
@ -82,8 +82,6 @@ enum ItemEffect
|
||||
ITEMEFFECT_STATS_CHANGED, // For White Herb and Eject Pack
|
||||
};
|
||||
|
||||
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
|
||||
|
||||
#define IS_WHOLE_SIDE_ALIVE(battler) ((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler))))
|
||||
#define IS_ALIVE_AND_PRESENT(battler) (IsBattlerAlive(battler) && IsBattlerSpritePresent(battler))
|
||||
|
||||
@ -343,5 +341,6 @@ u32 NumAffectedSpreadMoveTargets(void);
|
||||
bool32 IsPursuitTargetSet(void);
|
||||
void ClearPursuitValuesIfSet(u32 battler);
|
||||
void ClearPursuitValues(void);
|
||||
bool32 HasWeatherEffect(void);
|
||||
|
||||
#endif // GUARD_BATTLE_UTIL_H
|
||||
|
||||
@ -468,7 +468,7 @@ void SetAiLogicDataForTurn(struct AiLogicData *aiData)
|
||||
// Set delay timer to count how long it takes for AI to choose action/move
|
||||
gBattleStruct->aiDelayTimer = gMain.vblankCounter1;
|
||||
|
||||
aiData->weatherHasEffect = WEATHER_HAS_EFFECT;
|
||||
aiData->weatherHasEffect = HasWeatherEffect();
|
||||
weather = AI_GetWeather(aiData);
|
||||
|
||||
// get/assume all battler data and simulate AI damage
|
||||
@ -794,7 +794,7 @@ void BattleAI_DoAIProcessing_PredictedSwitchin(struct AI_ThinkingStruct *aiThink
|
||||
aiData->effectiveness[battlerAtk][battlerDef][aiThink->movesetIndex] = effectivenessSwitchin[aiThink->movesetIndex];
|
||||
aiData->moveAccuracy[battlerAtk][battlerDef][aiThink->movesetIndex] = moveAccuracySwitchin[aiThink->movesetIndex];
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
if (aiThink->aiLogicId < ARRAY_COUNT(sBattleAiFuncTable)
|
||||
@ -824,7 +824,7 @@ void BattleAI_DoAIProcessing_PredictedSwitchin(struct AI_ThinkingStruct *aiThink
|
||||
for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
||||
{
|
||||
aiData->simulatedDmg[battlerAtk][battlerDef][moveIndex] = simulatedDamageSwitchout[moveIndex];
|
||||
aiData->effectiveness[battlerAtk][battlerDef][moveIndex] = effectivenessSwitchout[moveIndex];
|
||||
aiData->effectiveness[battlerAtk][battlerDef][moveIndex] = effectivenessSwitchout[moveIndex];
|
||||
aiData->moveAccuracy[battlerAtk][battlerDef][moveIndex] = moveAccuracySwitchout[moveIndex];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1342,7 +1342,7 @@ static s32 GetSwitchinWeatherImpact(void)
|
||||
s32 weatherImpact = 0, maxHP = AI_DATA->switchinCandidate.battleMon.maxHP, ability = AI_DATA->switchinCandidate.battleMon.ability;
|
||||
u32 holdEffect = ItemId_GetHoldEffect(AI_DATA->switchinCandidate.battleMon.item);
|
||||
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
if (HasWeatherEffect())
|
||||
{
|
||||
// Damage
|
||||
if (holdEffect != HOLD_EFFECT_SAFETY_GOGGLES && ability != ABILITY_MAGIC_GUARD && ability != ABILITY_OVERCOAT)
|
||||
|
||||
@ -1077,7 +1077,7 @@ void BtlController_EmitMoveAnimation(u32 battler, u32 bufferId, u16 move, u8 tur
|
||||
gBattleResources->transferBuffer[9] = (dmg & 0xFF000000) >> 24;
|
||||
gBattleResources->transferBuffer[10] = friendship;
|
||||
gBattleResources->transferBuffer[11] = multihit;
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
if (HasWeatherEffect())
|
||||
{
|
||||
gBattleResources->transferBuffer[12] = gBattleWeather;
|
||||
gBattleResources->transferBuffer[13] = (gBattleWeather & 0xFF00) >> 8;
|
||||
|
||||
@ -4204,7 +4204,7 @@ enum
|
||||
void SetupAISwitchingData(u32 battler, bool32 isAiRisky)
|
||||
{
|
||||
s32 opposingBattler = GetBattlerAtPosition(BATTLE_OPPOSITE(GetBattlerPosition(battler)));
|
||||
|
||||
|
||||
// AI's predicting data
|
||||
if ((AI_THINKING_STRUCT->aiFlags[battler] & AI_FLAG_PREDICT_SWITCH))
|
||||
{
|
||||
@ -4785,7 +4785,7 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect)
|
||||
u32 speed = gBattleMons[battler].speed;
|
||||
|
||||
// weather abilities
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
if (HasWeatherEffect())
|
||||
{
|
||||
if (ability == ABILITY_SWIFT_SWIM && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && gBattleWeather & B_WEATHER_RAIN)
|
||||
speed *= 2;
|
||||
@ -4804,7 +4804,7 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect)
|
||||
speed *= 2;
|
||||
else if (ability == ABILITY_SLOW_START && gDisableStructs[battler].slowStartTimer != 0)
|
||||
speed /= 2;
|
||||
else if (ability == ABILITY_PROTOSYNTHESIS && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) && ((gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT) || gDisableStructs[battler].boosterEnergyActivates))
|
||||
else if (ability == ABILITY_PROTOSYNTHESIS && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) && ((gBattleWeather & B_WEATHER_SUN && HasWeatherEffect()) || gDisableStructs[battler].boosterEnergyActivates))
|
||||
speed = (GetHighestStatId(battler) == STAT_SPEED) ? (speed * 150) / 100 : speed;
|
||||
else if (ability == ABILITY_QUARK_DRIVE && !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) && (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN || gDisableStructs[battler].boosterEnergyActivates))
|
||||
speed = (GetHighestStatId(battler) == STAT_SPEED) ? (speed * 150) / 100 : speed;
|
||||
@ -5911,7 +5911,7 @@ u32 GetDynamicMoveType(struct Pokemon *mon, u32 move, u32 battler, u8 *ateBoost)
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_WEATHER_BALL:
|
||||
if (gMain.inBattle && WEATHER_HAS_EFFECT)
|
||||
if (gMain.inBattle && HasWeatherEffect())
|
||||
{
|
||||
if (gBattleWeather & B_WEATHER_RAIN && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||
return TYPE_WATER;
|
||||
|
||||
@ -1450,7 +1450,7 @@ static bool32 AccuracyCalcHelper(u32 move, u32 battler)
|
||||
effect = TRUE;
|
||||
}
|
||||
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
if (HasWeatherEffect())
|
||||
{
|
||||
if ((moveEffect == EFFECT_THUNDER || moveEffect == EFFECT_RAIN_ALWAYS_HIT)
|
||||
&& IsBattlerWeatherAffected(battler, B_WEATHER_RAIN))
|
||||
@ -1539,11 +1539,11 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u
|
||||
switch (defAbility)
|
||||
{
|
||||
case ABILITY_SAND_VEIL:
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
if (HasWeatherEffect() && gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
calc = (calc * 80) / 100; // 1.2 sand veil loss
|
||||
break;
|
||||
case ABILITY_SNOW_CLOAK:
|
||||
if (WEATHER_HAS_EFFECT && (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)))
|
||||
if (HasWeatherEffect() && (gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)))
|
||||
calc = (calc * 80) / 100; // 1.2 snow cloak loss
|
||||
break;
|
||||
case ABILITY_TANGLED_FEET:
|
||||
@ -1595,7 +1595,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u
|
||||
if (B_AFFECTION_MECHANICS == TRUE && GetBattlerAffectionHearts(battlerDef) == AFFECTION_FIVE_HEARTS)
|
||||
calc = (calc * 90) / 100;
|
||||
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_FOG)
|
||||
if (HasWeatherEffect() && gBattleWeather & B_WEATHER_FOG)
|
||||
calc = (calc * 60) / 100; // modified by 3/5
|
||||
|
||||
return calc;
|
||||
@ -2307,7 +2307,7 @@ static u32 UpdateEffectivenessResultFlagsForDoubleSpreadMoves(u32 resultFlags)
|
||||
|
||||
static inline bool32 TryStrongWindsWeakenAttack(u32 battlerDef, u32 moveType)
|
||||
{
|
||||
if (gBattleWeather & B_WEATHER_STRONG_WINDS && WEATHER_HAS_EFFECT)
|
||||
if (gBattleWeather & B_WEATHER_STRONG_WINDS && HasWeatherEffect())
|
||||
{
|
||||
if (GetMoveCategory(gCurrentMove) != DAMAGE_CATEGORY_STATUS
|
||||
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)
|
||||
@ -7692,7 +7692,7 @@ bool32 DoSwitchInAbilities(u32 battler)
|
||||
{
|
||||
return (TryPrimalReversion(battler)
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, battler, 0, 0, 0)
|
||||
|| (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT && AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, battler, 0, 0, 0))
|
||||
|| (gBattleWeather & B_WEATHER_ANY && HasWeatherEffect() && AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, battler, 0, 0, 0))
|
||||
|| (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY && AbilityBattleEffects(ABILITYEFFECT_ON_TERRAIN, battler, 0, 0, 0)));
|
||||
}
|
||||
|
||||
@ -10721,7 +10721,7 @@ static void Cmd_various(void)
|
||||
{
|
||||
VARIOUS_ARGS();
|
||||
if (gSideStatuses[GetBattlerSide(battler)] & SIDE_STATUS_AURORA_VEIL
|
||||
|| !(WEATHER_HAS_EFFECT && gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)))
|
||||
|| !(HasWeatherEffect() && gBattleWeather & (B_WEATHER_HAIL | B_WEATHER_SNOW)))
|
||||
{
|
||||
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
@ -14161,14 +14161,14 @@ static void Cmd_recoverbasedonsunlight(void)
|
||||
{
|
||||
if (gCurrentMove == MOVE_SHORE_UP)
|
||||
{
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
if (HasWeatherEffect() && gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = 20 * GetNonDynamaxMaxHP(gBattlerAttacker) / 30;
|
||||
else
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(gBattleWeather & B_WEATHER_ANY) || !WEATHER_HAS_EFFECT || GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||
if (!(gBattleWeather & B_WEATHER_ANY) || !HasWeatherEffect() || GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
|
||||
else if (gBattleWeather & B_WEATHER_SUN)
|
||||
gBattleStruct->moveDamage[gBattlerAttacker] = 20 * GetNonDynamaxMaxHP(gBattlerAttacker) / 30;
|
||||
|
||||
@ -2242,7 +2242,7 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
{
|
||||
case ENDTURN_WEATHER_DAMAGE:
|
||||
ability = GetBattlerAbility(battler);
|
||||
if (!IsBattlerAlive(battler) || !WEATHER_HAS_EFFECT || ability == ABILITY_MAGIC_GUARD)
|
||||
if (!IsBattlerAlive(battler) || !HasWeatherEffect() || ability == ABILITY_MAGIC_GUARD)
|
||||
{
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
@ -3553,7 +3553,7 @@ static void CancellerStanceChangeTwo(u32 *effect)
|
||||
|
||||
static void CancellerWeatherPrimal(u32 *effect)
|
||||
{
|
||||
if (WEATHER_HAS_EFFECT && GetMovePower(gCurrentMove) > 0)
|
||||
if (HasWeatherEffect() && GetMovePower(gCurrentMove) > 0)
|
||||
{
|
||||
u32 moveType = GetBattleMoveType(gCurrentMove);
|
||||
if (moveType == TYPE_FIRE && (gBattleWeather & B_WEATHER_RAIN_PRIMAL))
|
||||
@ -4893,7 +4893,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && HasWeatherEffect() && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -4906,7 +4906,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && HasWeatherEffect() && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -4919,7 +4919,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && HasWeatherEffect() && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -4937,7 +4937,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
BattleScriptPushCursorAndCallback(BattleScript_SnowWarningActivatesHail);
|
||||
effect++;
|
||||
}
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && HasWeatherEffect() && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -6070,9 +6070,9 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
if (MoveResultHasEffect(gBattlerTarget)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& IsBattlerTurnDamaged(gBattlerTarget)
|
||||
&& !(gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT))
|
||||
&& !(gBattleWeather & B_WEATHER_SANDSTORM && HasWeatherEffect()))
|
||||
{
|
||||
if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT)
|
||||
if (gBattleWeather & B_WEATHER_PRIMAL_ANY && HasWeatherEffect())
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BlockedByPrimalWeatherRet;
|
||||
@ -6533,7 +6533,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
case ABILITY_FLOWER_GIFT:
|
||||
if ((IsBattlerWeatherAffected(battler, gBattleWeather)
|
||||
|| gBattleWeather == B_WEATHER_NONE
|
||||
|| !WEATHER_HAS_EFFECT) // Air Lock active
|
||||
|| !HasWeatherEffect()) // Air Lock active
|
||||
&& TryBattleFormChange(battler, FORM_CHANGE_BATTLE_WEATHER))
|
||||
{
|
||||
gBattleScripting.battler = battler;
|
||||
@ -6565,7 +6565,7 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
|
||||
}
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
if (!gDisableStructs[battler].weatherAbilityDone
|
||||
&& (gBattleWeather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT
|
||||
&& (gBattleWeather & B_WEATHER_SUN) && HasWeatherEffect()
|
||||
&& !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||
&& !gDisableStructs[battler].boosterEnergyActivates)
|
||||
{
|
||||
@ -7318,7 +7318,7 @@ static inline u32 TryBoosterEnergy(u32 battler, enum ItemEffect caseID)
|
||||
if (gDisableStructs[battler].boosterEnergyActivates || gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||
return ITEM_NO_EFFECT;
|
||||
|
||||
if (((GetBattlerAbility(battler) == ABILITY_PROTOSYNTHESIS) && !((gBattleWeather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT))
|
||||
if (((GetBattlerAbility(battler) == ABILITY_PROTOSYNTHESIS) && !((gBattleWeather & B_WEATHER_SUN) && HasWeatherEffect()))
|
||||
|| ((GetBattlerAbility(battler) == ABILITY_QUARK_DRIVE) && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)))
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
@ -9574,7 +9574,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(struct DamageCalculationData *
|
||||
case ABILITY_PROTOSYNTHESIS:
|
||||
{
|
||||
u8 defHighestStat = GetHighestStatId(battlerDef);
|
||||
if (((weather & B_WEATHER_SUN && WEATHER_HAS_EFFECT) || gDisableStructs[battlerDef].boosterEnergyActivates)
|
||||
if (((weather & B_WEATHER_SUN && HasWeatherEffect()) || gDisableStructs[battlerDef].boosterEnergyActivates)
|
||||
&& ((IsBattleMovePhysical(move) && defHighestStat == STAT_DEF) || (IsBattleMoveSpecial(move) && defHighestStat == STAT_SPDEF))
|
||||
&& !(gBattleMons[battlerDef].status2 & STATUS2_TRANSFORMED))
|
||||
modifier = uq4_12_multiply(modifier, UQ_4_12(0.7));
|
||||
@ -9856,7 +9856,7 @@ static inline u32 CalcAttackStat(struct DamageCalculationData *damageCalcData, u
|
||||
if (!(gBattleMons[battlerAtk].status2 & STATUS2_TRANSFORMED))
|
||||
{
|
||||
u32 atkHighestStat = GetHighestStatId(battlerAtk);
|
||||
if (((weather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT) || gDisableStructs[battlerAtk].boosterEnergyActivates)
|
||||
if (((weather & B_WEATHER_SUN) && HasWeatherEffect()) || gDisableStructs[battlerAtk].boosterEnergyActivates)
|
||||
{
|
||||
if ((IsBattleMovePhysical(move) && atkHighestStat == STAT_ATK) || (IsBattleMoveSpecial(move) && atkHighestStat == STAT_SPATK))
|
||||
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
||||
@ -9875,7 +9875,7 @@ static inline u32 CalcAttackStat(struct DamageCalculationData *damageCalcData, u
|
||||
}
|
||||
break;
|
||||
case ABILITY_ORICHALCUM_PULSE:
|
||||
if ((weather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT && IsBattleMovePhysical(move))
|
||||
if ((weather & B_WEATHER_SUN) && HasWeatherEffect() && IsBattleMovePhysical(move))
|
||||
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3333));
|
||||
break;
|
||||
case ABILITY_HADRON_ENGINE:
|
||||
@ -10570,7 +10570,7 @@ static inline s32 DoFutureSightAttackDamageCalc(struct DamageCalculationData *da
|
||||
|
||||
static u32 GetWeather(void)
|
||||
{
|
||||
if (gBattleWeather == B_WEATHER_NONE || !WEATHER_HAS_EFFECT)
|
||||
if (gBattleWeather == B_WEATHER_NONE || !HasWeatherEffect())
|
||||
return B_WEATHER_NONE;
|
||||
else
|
||||
return gBattleWeather;
|
||||
@ -10643,7 +10643,7 @@ static inline void MulByTypeEffectiveness(uq4_12_t *modifier, u32 move, u32 move
|
||||
mod = UQ_4_12(2.0);
|
||||
|
||||
// B_WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon
|
||||
if (gBattleWeather & B_WEATHER_STRONG_WINDS && WEATHER_HAS_EFFECT)
|
||||
if (gBattleWeather & B_WEATHER_STRONG_WINDS && HasWeatherEffect())
|
||||
{
|
||||
if (defType == TYPE_FLYING && mod >= UQ_4_12(2.0))
|
||||
mod = UQ_4_12(1.0);
|
||||
@ -11124,13 +11124,13 @@ u16 GetBattleFormChangeTargetSpecies(u32 battler, u16 method)
|
||||
targetSpecies = formChanges[i].targetSpecies;
|
||||
}
|
||||
// We need to revert the weather form if the field is under Air Lock, too.
|
||||
else if (!WEATHER_HAS_EFFECT && formChanges[i].param1 == B_WEATHER_NONE)
|
||||
else if (!HasWeatherEffect() && formChanges[i].param1 == B_WEATHER_NONE)
|
||||
{
|
||||
targetSpecies = formChanges[i].targetSpecies;
|
||||
}
|
||||
// Otherwise, just check for a match between the weather and the form change table.
|
||||
// Added a check for whether the weather is in effect to prevent end-of-turn soft locks with Cloud Nine / Air Lock
|
||||
else if (((gBattleWeather & formChanges[i].param1) && WEATHER_HAS_EFFECT)
|
||||
else if (((gBattleWeather & formChanges[i].param1) && HasWeatherEffect())
|
||||
|| (gBattleWeather == B_WEATHER_NONE && formChanges[i].param1 == B_WEATHER_NONE))
|
||||
{
|
||||
targetSpecies = formChanges[i].targetSpecies;
|
||||
@ -11753,7 +11753,7 @@ bool32 PickupHasValidTarget(u32 battler)
|
||||
|
||||
bool32 IsBattlerWeatherAffected(u32 battler, u32 weatherFlags)
|
||||
{
|
||||
if (gBattleWeather & weatherFlags && WEATHER_HAS_EFFECT)
|
||||
if (gBattleWeather & weatherFlags && HasWeatherEffect())
|
||||
{
|
||||
// given weather is active -> check if its sun, rain against utility umbrella ( since only 1 weather can be active at once)
|
||||
if (gBattleWeather & (B_WEATHER_SUN | B_WEATHER_RAIN) && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||
@ -12302,3 +12302,10 @@ void ClearPursuitValuesIfSet(u32 battler)
|
||||
if (gBattleStruct->battlerState[battler].pursuitTarget)
|
||||
ClearPursuitValues();
|
||||
}
|
||||
|
||||
bool32 HasWeatherEffect(void)
|
||||
{
|
||||
if (IsAbilityOnField(ABILITY_CLOUD_NINE) || IsAbilityOnField(ABILITY_AIR_LOCK))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user