Merge pull request #1432 from BuffelSaft/thousand_arrows

Fix Thousand Arrows
This commit is contained in:
Eduardo Quezada D'Ottone 2021-05-21 11:40:13 -04:00 committed by GitHub
commit 04c6331a60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -314,6 +314,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

View File

@ -7961,7 +7961,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)
@ -7973,6 +7973,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);

View File

@ -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,
},