From 35add44a9004b97ef573635a970c94883f04a395 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Wed, 31 Mar 2021 23:05:30 +1300 Subject: [PATCH] Thousand Arrows hits airborne targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thousand Arrows now hits flying types, Pokémon with Levitate, Pokémon holding an Air Balloon, and Pokémon under the effect of Magnet Rise, Telekinesis etc. Also fixed its effect chance, which was 0 instead of 100. --- include/constants/pokemon.h | 1 + src/battle_util.c | 4 +++- src/data/battle_moves.h | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 8f8bb3c473..3dd9dee9bc 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -267,6 +267,7 @@ #define FLAG_DANCE (1 << 21) #define FLAG_DMG_IN_AIR (1 << 22) // X2 dmg on air, always hits target on air #define FLAG_HIT_IN_AIR (1 << 23) // dmg is normal, always hits target on air +#define FLAG_DAMAGE_AIRBORNE (1 << 24) // Makes a Ground type move do 1x damage to flying and levitating targets // Split defines. #define SPLIT_PHYSICAL 0x0 diff --git a/src/battle_util.c b/src/battle_util.c index f1f5ffd100..fbf4ed1172 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7831,6 +7831,8 @@ 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); @@ -7870,7 +7872,7 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat && gBattleMons[battlerDef].type3 != gBattleMons[battlerDef].type1) MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type3, battlerAtk, recordAbilities); - if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef)) + if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef) && !(gBattleMoves[move].flags & FLAG_DAMAGE_AIRBORNE)) { modifier = UQ_4_12(0.0); if (recordAbilities && GetBattlerAbility(battlerDef) == ABILITY_LEVITATE) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 661af2eab5..729f866c62 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -9488,10 +9488,10 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .type = TYPE_GROUND, .accuracy = 100, .pp = 10, - .secondaryEffectChance = 0, + .secondaryEffectChance = 100, .target = MOVE_TARGET_BOTH, .priority = 0, - .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIT_IN_AIR, + .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_HIT_IN_AIR | FLAG_DAMAGE_AIRBORNE, .split = SPLIT_PHYSICAL, },