From 0a3805492577ca978e19cec9222c79debbe78620 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Mon, 30 Aug 2021 21:21:07 -0300 Subject: [PATCH] Print `STRINGID_ATTACKWEAKENEDBSTRONGWINDS` properly --- data/battle_scripts_1.s | 7 +++++++ include/battle_scripts.h | 1 + src/battle_util.c | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f46bffcf3..ecfddf762 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6936,6 +6936,13 @@ BattleScript_DeltaStreamActivates:: waitmessage B_WAIT_TIME_LONG end3 +BattleScript_AttackWeakenedByStrongWinds:: + pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUp + printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS + waitmessage B_WAIT_TIME_LONG + end3 + BattleScript_SnowWarningActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 28118b21c..f3470776a 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -375,5 +375,6 @@ extern const u8 BattleScript_PrimordialSeaActivates[]; extern const u8 BattleScript_PrimordialSeaFizzlesOutFireTypeMoves[]; extern const u8 BattleScript_DeltaStreamActivates[]; extern const u8 BattleScript_MysteriousAirCurrentBlowsOn[]; +extern const u8 BattleScript_AttackWeakenedByStrongWinds[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/src/battle_util.c b/src/battle_util.c index 96cbfbc87..0f89def27 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -484,6 +484,14 @@ void HandleAction_UseMove(void) for (i = 0; i < MAX_BATTLERS_COUNT; i++) gBattleStruct->hpBefore[i] = gBattleMons[i].hp; + GET_MOVE_TYPE(gCurrentMove, moveType); + if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS) + { + if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_FLYING) + && CalcTypeEffectivenessMultiplier(gCurrentMove, moveType, gBattlerAttacker, gBattlerTarget, FALSE) >= UQ_4_12(2.0)) + BattleScriptPushCursorAndCallback(BattleScript_AttackWeakenedByStrongWinds); + } + gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT; }