From 0f2cc99f45d46f9c5780bbf265b023e4dcc1832c Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 06:32:06 -0300 Subject: [PATCH] WEATHER_STRONG_WINDS modifier fix MulByTypeEffectiveness was the right answer all along. I also added a short pause to BattleScript_AttackWeakenedByStrongWinds before STRINGID_ATTACKWEAKENEDBSTRONGWINDS is printed. --- data/battle_scripts_1.s | 1 + src/battle_util.c | 19 +++++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8aa2b32ba..e3a395e18 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7307,6 +7307,7 @@ BattleScript_DeltaStreamActivates:: end3 BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG return diff --git a/src/battle_util.c b/src/battle_util.c index d783edab2..4e57d3425 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8476,6 +8476,13 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT) mod = UQ_4_12(1.0); + // WEATHER_STRONG_WINDS weakens Super Effective moves against Flying-type Pokémon + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (defType == TYPE_FLYING && mod >= UQ_4_12(2.0)) + mod = UQ_4_12(1.0); + } + MulModifier(modifier, mod); } @@ -8531,18 +8538,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 Pokémon - if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) - { - if ((gBattleMons[battlerDef].type1 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type1) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type2 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type2) >= UQ_4_12(2.0)) - || (gBattleMons[battlerDef].type3 == TYPE_FLYING - && GetTypeModifier(moveType, gBattleMons[battlerDef].type3) >= UQ_4_12(2.0))) - modifier = UQ_4_12(1.0); - } - if (((GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0)) || (GetBattlerAbility(battlerDef) == ABILITY_TELEPATHY && battlerDef == BATTLE_PARTNER(battlerAtk))) && gBattleMoves[move].power)