mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-13 17:22:25 +01:00
A couple of improvements, courtesy of Syreldar
-Optimized the checks for `WEATHER_RAIN_PRIMAL` and `WEATHER_SUN_PRIMAL` in `Cmd_attackcanceler`. -Moved the dmg calculation effect of `WEATHER_STRONG_WINDS` to the `CalcFinalDmg` function.
This commit is contained in:
parent
c0c6821f62
commit
e39dc493fc
@ -1324,23 +1324,21 @@ static void Cmd_attackcanceler(void)
|
||||
s32 i, moveType;
|
||||
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
|
||||
if (moveType == TYPE_FIRE
|
||||
&& (gBattleWeather & WEATHER_RAIN_PRIMAL)
|
||||
&& !IsAbilityOnField(ABILITY_AIR_LOCK)
|
||||
&& !IsAbilityOnField(ABILITY_CLOUD_NINE)
|
||||
&& gBattleMoves[gCurrentMove].power >= 1)
|
||||
&& WEATHER_HAS_EFFECT
|
||||
&& gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_PrimordialSeaFizzlesOutFireTypeMoves;
|
||||
return;
|
||||
}
|
||||
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
if (moveType == TYPE_WATER
|
||||
&& (gBattleWeather & WEATHER_SUN_PRIMAL)
|
||||
&& !IsAbilityOnField(ABILITY_AIR_LOCK)
|
||||
&& !IsAbilityOnField(ABILITY_CLOUD_NINE)
|
||||
&& gBattleMoves[gCurrentMove].power >= 1)
|
||||
&& WEATHER_HAS_EFFECT
|
||||
&& gBattleMoves[gCurrentMove].power)
|
||||
{
|
||||
BattleScriptPushCursor();
|
||||
gBattlescriptCurrInstr = BattleScript_DesolateLandEvaporatesWaterTypeMoves;
|
||||
@ -1366,7 +1364,6 @@ static void Cmd_attackcanceler(void)
|
||||
return;
|
||||
|
||||
// Check Protean activation.
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
if ((GetBattlerAbility(gBattlerAttacker) == ABILITY_PROTEAN || GetBattlerAbility(gBattlerAttacker) == ABILITY_LIBERO)
|
||||
&& (gBattleMons[gBattlerAttacker].type1 != moveType || gBattleMons[gBattlerAttacker].type2 != moveType ||
|
||||
(gBattleMons[gBattlerAttacker].type3 != moveType && gBattleMons[gBattlerAttacker].type3 != TYPE_MYSTERY))
|
||||
|
@ -7898,6 +7898,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move
|
||||
else if (moveType == TYPE_WATER)
|
||||
dmg = ApplyModifier(UQ_4_12(0.5), dmg);
|
||||
}
|
||||
else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS)
|
||||
{
|
||||
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)
|
||||
&& typeEffectivenessModifier >= UQ_4_12(2.0))
|
||||
dmg = ApplyModifier(UQ_4_12(0.5), dmg);
|
||||
}
|
||||
|
||||
// check stab
|
||||
if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE)
|
||||
@ -8139,18 +8145,6 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
|
||||
modifier = UQ_4_12(1.0);
|
||||
}
|
||||
|
||||
// WEATHER_STRONG_WINDS weakens super effective moves against flying type mons
|
||||
if (gBattleWeather & WEATHER_STRONG_WINDS
|
||||
&& modifier == UQ_4_12(2.0)
|
||||
&& (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING))
|
||||
&& !IsAbilityOnField(ABILITY_AIR_LOCK)
|
||||
&& !IsAbilityOnField(ABILITY_CLOUD_NINE))
|
||||
{
|
||||
modifier = UQ_4_12(1.0);
|
||||
PrepareStringBattle(STRINGID_ATTACKWEAKENEDBSTRONGWINDS, battlerDef);
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power)
|
||||
{
|
||||
modifier = UQ_4_12(0.0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user