From dc451167d13d42bca8b402335c08e8ab171e163b Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 6 Oct 2021 05:09:47 -0300 Subject: [PATCH] More fixes -Removed ability popup when Strong Winds weakens a SE Flying-type move -Went back to the way I handled the dmg calculation for that originally -Made sure to try to clear the primal weathers in a couple of other battle scripts -Allowed Drought, Drizzle, Sand Stream and Snow Warning to activate but fail if WEATHER_STRONG_WINDS is in effect. --- data/battle_scripts_1.s | 21 +++++++++++++++++++-- src/battle_util.c | 22 ++++++++++++---------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 083db5f070..8aa2b32ba4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -4135,6 +4135,12 @@ BattleScript_MysteriousAirCurrentBlowsOn: waitmessage B_WAIT_TIME_LONG goto BattleScript_MoveEnd +BattleScript_MysteriousAirCurrentBlowsOnEnd3: + pause B_WAIT_TIME_SHORT + printstring STRINGID_MYSTERIOUSAIRCURRENTBLOWSON + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_EffectDefenseUpHit:: setmoveeffect MOVE_EFFECT_DEF_PLUS_1 | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -5255,6 +5261,9 @@ BattleScript_FaintedMonTryChooseAnother: getswitchedmondata BS_ATTACKER switchindataupdate BS_ATTACKER hpthresholds BS_ATTACKER + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_ATTACKER switchinanim BS_ATTACKER, 0 @@ -5265,6 +5274,9 @@ BattleScript_FaintedMonChooseAnother: getswitchedmondata BS_FAINTED switchindataupdate BS_FAINTED hpthresholds BS_FAINTED + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_FAINTED switchinanim BS_FAINTED, FALSE @@ -5297,6 +5309,9 @@ BattleScript_HandleFaintedMonLoop:: getswitchedmondata BS_FAINTED switchindataupdate BS_FAINTED hpthresholds BS_FAINTED + trytoclearprimalweather + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 printstring STRINGID_SWITCHINMON hidepartystatussummary BS_FAINTED switchinanim BS_FAINTED, FALSE @@ -6974,6 +6989,7 @@ BattleScript_ItemSteal:: BattleScript_DrizzleActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNMADEITRAIN waitstate playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES, NULL @@ -7132,6 +7148,7 @@ BattleScript_HealerActivates:: BattleScript_SandstreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM waitstate playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES, NULL @@ -7238,6 +7255,7 @@ BattleScript_IntimidatePrevented: BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_PKMNSXINTENSIFIEDSUN waitstate playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES, NULL @@ -7289,8 +7307,6 @@ BattleScript_DeltaStreamActivates:: end3 BattleScript_AttackWeakenedByStrongWinds:: - pause B_WAIT_TIME_SHORT - call BattleScript_AbilityPopUp printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS waitmessage B_WAIT_TIME_LONG return @@ -7298,6 +7314,7 @@ BattleScript_AttackWeakenedByStrongWinds:: BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + jumpifhalfword CMP_COMMON_BITS, gBattleWeather, WEATHER_STRONG_WINDS, BattleScript_MysteriousAirCurrentBlowsOnEnd3 printstring STRINGID_SNOWWARNINGHAIL waitstate playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES, NULL diff --git a/src/battle_util.c b/src/battle_util.c index 8873d7ae3e..17b04ebf8d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8290,16 +8290,6 @@ 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 ((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))) - dmg = ApplyModifier(UQ_4_12(0.5), dmg); - } // check stab if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE) @@ -8541,6 +8531,18 @@ 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)