From 20a7dec070f85c2bdad8b11ee8f64732b835d548 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Thu, 1 Apr 2021 17:23:47 +1300 Subject: [PATCH] Fix Thousand Arrows vs. Flying Type Should ignore type modifiers against flying types that aren't grounded. Previous code just negated the targets' flying typing. --- src/battle_util.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index fbf4ed1172..b368950449 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7831,8 +7831,6 @@ static void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType, u8 batt mod = UQ_4_12(2.0); if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef) && mod == UQ_4_12(0.0)) mod = UQ_4_12(1.0); - if (gBattleMoves[move].flags & FLAG_DAMAGE_AIRBORNE && defType == TYPE_FLYING) // Thousand Arrows - mod = UQ_4_12(1.0); if (gProtectStructs[battlerDef].kingsShielded && gBattleMoves[move].effect != EFFECT_FEINT) mod = UQ_4_12(1.0); @@ -7884,6 +7882,14 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); } } + + // Thousand Arrows ignores type modifiers for flying mons + if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DAMAGE_AIRBORNE) + && (gBattleMons[battlerDef].type1 == TYPE_FLYING || gBattleMons[battlerDef].type2 == TYPE_FLYING || gBattleMons[battlerDef].type3 == TYPE_FLYING)) + { + modifier = UQ_4_12(1.0); + } + if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) { modifier = UQ_4_12(0.0);