Tweaks and fixes

-Fixed the Flying-type checks of WEATHER_STRONG_WINDS.
-Fixed the order of actions involving the printing of STRINGID_ATTACKWEAKENEDBSTRONGWINDS.
This commit is contained in:
LOuroboros 2021-10-04 06:43:43 -03:00
parent 64a45d8f48
commit dcefb523f8
3 changed files with 27 additions and 11 deletions

View File

@ -7293,7 +7293,7 @@ BattleScript_AttackWeakenedByStrongWinds::
call BattleScript_AbilityPopUp
printstring STRINGID_ATTACKWEAKENEDBSTRONGWINDS
waitmessage B_WAIT_TIME_LONG
end3
return
BattleScript_SnowWarningActivates::
pause B_WAIT_TIME_SHORT

View File

@ -1914,6 +1914,9 @@ static void Cmd_typecalc(void)
static void Cmd_adjustdamage(void)
{
u8 holdEffect, param;
u32 moveType;
GET_MOVE_TYPE(gCurrentMove, moveType);
if (DoesSubstituteBlockMove(gBattlerAttacker, gBattlerTarget, gCurrentMove))
goto END;
@ -1991,6 +1994,23 @@ END:
gBattlescriptCurrInstr = BattleScript_GemActivates;
gLastUsedItem = gBattleMons[gBattlerAttacker].item;
}
// WEATHER_STRONG_WINDS prints a string when it's about to reduce the power
// of a move that is Super Effective against a Flying-type Pokémon.
if (gBattleWeather & WEATHER_STRONG_WINDS)
{
if ((gBattleMons[gBattlerTarget].type1 == TYPE_FLYING
&& GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type1) >= UQ_4_12(2.0))
|| (gBattleMons[gBattlerTarget].type2 == TYPE_FLYING
&& GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type2) >= UQ_4_12(2.0))
|| (gBattleMons[gBattlerTarget].type3 == TYPE_FLYING
&& GetTypeModifier(moveType, gBattleMons[gBattlerTarget].type3) >= UQ_4_12(2.0)))
{
gBattlerAbility = gBattlerTarget;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_AttackWeakenedByStrongWinds;
}
}
}
static void Cmd_multihitresultmessage(void)

View File

@ -486,14 +486,6 @@ 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;
}
@ -8300,8 +8292,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move
}
else if (WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_STRONG_WINDS)
{
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)
&& typeEffectivenessModifier >= UQ_4_12(2.0))
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);
}