mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-16 16:42:10 +01:00
move some WEATHER_HAS_EFFECT after bitfield checks to speed up damage calcs
This commit is contained in:
parent
035b2332af
commit
078874aa1e
@ -4400,7 +4400,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DrizzleActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -4413,7 +4413,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_SandstreamActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -4426,7 +4426,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_DroughtActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -4439,7 +4439,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
BattleScriptPushCursorAndCallback(BattleScript_SnowWarningActivates);
|
||||
effect++;
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_PRIMAL_ANY && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT && !gSpecialStatuses[battler].switchInAbilityDone)
|
||||
{
|
||||
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BlockedByPrimalWeatherEnd3);
|
||||
@ -5316,9 +5316,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& !(WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SANDSTORM))
|
||||
&& !(gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT))
|
||||
{
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_PRIMAL_ANY)
|
||||
if (gBattleWeather & B_WEATHER_PRIMAL_ANY && WEATHER_HAS_EFFECT)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_BlockedByPrimalWeatherRet;
|
||||
@ -7974,7 +7974,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
|
||||
basePower *= 2;
|
||||
break;
|
||||
case EFFECT_WEATHER_BALL:
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_ANY)
|
||||
if (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT)
|
||||
basePower *= 2;
|
||||
break;
|
||||
case EFFECT_PURSUIT:
|
||||
@ -8176,7 +8176,7 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
|
||||
break;
|
||||
case ABILITY_SAND_FORCE:
|
||||
if ((moveType == TYPE_STEEL || moveType == TYPE_ROCK || moveType == TYPE_GROUND)
|
||||
&& WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SANDSTORM)
|
||||
&& gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT)
|
||||
MulModifier(&modifier, UQ_4_12(1.3));
|
||||
break;
|
||||
case ABILITY_RIVALRY:
|
||||
@ -8785,7 +8785,7 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType,
|
||||
}
|
||||
|
||||
// sandstorm sp.def boost for rock types
|
||||
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_SANDSTORM && !usesDefStat)
|
||||
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT && !usesDefStat)
|
||||
MulModifier(&modifier, UQ_4_12(1.5));
|
||||
|
||||
// The defensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 5th badge and 7th badges.
|
||||
@ -9038,7 +9038,7 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt
|
||||
mod = UQ_4_12(2.0);
|
||||
|
||||
// B_WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon
|
||||
if (WEATHER_HAS_EFFECT && gBattleWeather & B_WEATHER_STRONG_WINDS)
|
||||
if (gBattleWeather & B_WEATHER_STRONG_WINDS && WEATHER_HAS_EFFECT)
|
||||
{
|
||||
if (defType == TYPE_FLYING && mod >= UQ_4_12(2.0))
|
||||
mod = UQ_4_12(1.0);
|
||||
@ -9986,10 +9986,7 @@ u16 GetUsedHeldItem(u8 battler)
|
||||
|
||||
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags)
|
||||
{
|
||||
if (!WEATHER_HAS_EFFECT)
|
||||
return FALSE;
|
||||
|
||||
if (gBattleWeather & weatherFlags)
|
||||
if (gBattleWeather & weatherFlags && WEATHER_HAS_EFFECT)
|
||||
{
|
||||
// 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(battlerId, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||
|
Loading…
x
Reference in New Issue
Block a user