From fc5c93fd83efaf64129a32f52646d7922177e0a8 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 25 Feb 2023 12:15:40 +0100 Subject: [PATCH 1/2] exclude status move type check --- src/battle_ai_util.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 4641ba2cdd..8cb3d46602 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -802,7 +802,16 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, } else { - effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); + #if B_GLARE_GHOST == GEN_3 + else if (move == MOVE_GLARE || move == MOVE_THUNDER_WAVE) + effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); + else +# endif + if (move == MOVE_THUNDER_WAVE) + effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); + else + effectivenessMultiplier = UQ_4_12(1.0); + dmg = 0; } From df47312e329b9f9576036b4c7604f40e1c70d33a Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 25 Feb 2023 12:38:57 +0100 Subject: [PATCH 2/2] Fix move to battle_util.c --- src/battle_ai_util.c | 11 +---------- src/battle_util.c | 18 +++++++++++------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 8cb3d46602..4641ba2cdd 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -802,16 +802,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 *typeEffectiveness, } else { - #if B_GLARE_GHOST == GEN_3 - else if (move == MOVE_GLARE || move == MOVE_THUNDER_WAVE) - effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); - else -# endif - if (move == MOVE_THUNDER_WAVE) - effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); - else - effectivenessMultiplier = UQ_4_12(1.0); - + effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE); dmg = 0; } diff --git a/src/battle_util.c b/src/battle_util.c index ccc7445b52..0a00372c0d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9851,7 +9851,17 @@ 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 && !IsBattlerGrounded2(battlerDef, TRUE) && !(gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)) + if (gBattleMoves[move].split == SPLIT_STATUS && move != MOVE_THUNDER_WAVE) + { + modifier = UQ_4_12(1.0); + #if B_GLARE_GHOST <= GEN_3 + if (move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) + { + modifier = UQ_4_12(0.0); + } + #endif + } + else if (moveType == TYPE_GROUND && !IsBattlerGrounded2(battlerDef, TRUE) && !(gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)) { modifier = UQ_4_12(0.0); if (recordAbilities && defAbility == ABILITY_LEVITATE) @@ -9869,12 +9879,6 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat modifier = UQ_4_12(0.0); } #endif -#if B_GLARE_GHOST >= GEN_4 - else if (move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) - { - modifier = UQ_4_12(1.0); - } -#endif // Thousand Arrows ignores type modifiers for flying mons if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)