diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 8a758e09f..484fbb96b 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -289,6 +289,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectAttackAccUp .4byte BattleScript_EffectAttackSpAttackUp .4byte BattleScript_EffectHurricane + .4byte BattleScript_EffectTwoTypedMove BattleScript_EffectAttackSpAttackUp: attackcanceler @@ -847,6 +848,7 @@ BattleScript_EffectPsyshock: BattleScript_EffectWeatherBall: BattleScript_EffectHiddenPower: BattleScript_EffectFreezeDry: +BattleScript_EffectTwoTypedMove: jumpifnotmove MOVE_SURF, BattleScript_HitFromAtkCanceler jumpifnostatus3 BS_TARGET, STATUS3_UNDERWATER, BattleScript_HitFromAtkCanceler orword gHitMarker, HITMARKER_IGNORE_UNDERWATER diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 6f20a8f1b..37f79c14e 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -278,5 +278,6 @@ #define EFFECT_ATTACK_ACCURACY_UP 272 #define EFFECT_ATTACK_SPATK_UP 273 #define EFFECT_HURRICANE 274 +#define EFFECT_TWO_TYPED_MOVE 275 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/data/battle_moves.h b/include/data/battle_moves.h index 970f2f5a8..bfeaa8ca8 100644 --- a/include/data/battle_moves.h +++ b/include/data/battle_moves.h @@ -6724,7 +6724,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .split = SPLIT_PHYSICAL, }, { // MOVE_FLYING_PRESS - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_TWO_TYPED_MOVE, .power = 100, .type = TYPE_FIGHTING, .accuracy = 95, @@ -6734,6 +6734,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] = .priority = 0, .flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGSROCK_AFFECTED | FLAG_DMG_MINIMIZE, .split = SPLIT_PHYSICAL, + .argument = TYPE_FLYING, }, { // MOVE_MAT_BLOCK .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect diff --git a/src/battle_util.c b/src/battle_util.c index 3c03ae4f7..9a49d60a6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5447,41 +5447,50 @@ static void UpdateMoveResultFlags(u16 modifier) } } +static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities, u16 modifier) +{ + u32 atkAbility = GetBattlerAbility(battlerAtk); + MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, atkAbility); + if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1) + MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type2, atkAbility); + + if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef)) + { + modifier = UQ_4_12(0.0); + if (recordAbilities && GetBattlerAbility(battlerDef) == ABILITY_LEVITATE) + { + gLastUsedAbility = ABILITY_LEVITATE; + gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); + gLastLandedMoves[battlerDef] = 0; + gBattleCommunication[6] = moveType; + RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); + } + } + if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) + { + modifier = UQ_4_12(0.0); + if (recordAbilities) + { + gLastUsedAbility = ABILITY_WONDER_GUARD; + gMoveResultFlags |= MOVE_RESULT_MISSED; + gLastLandedMoves[battlerDef] = 0; + gBattleCommunication[6] = 3; + RecordAbilityBattle(battlerDef, ABILITY_WONDER_GUARD); + } + } + + return modifier; +} + u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities) { u16 modifier = UQ_4_12(1.0); if (move != MOVE_STRUGGLE && moveType != TYPE_MYSTERY) { - u32 atkAbility = GetBattlerAbility(battlerAtk); - MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type1, atkAbility); - if (gBattleMons[battlerDef].type2 != gBattleMons[battlerDef].type1) - MulByTypeEffectiveness(&modifier, move, moveType, battlerDef, gBattleMons[battlerDef].type2, atkAbility); - - if (moveType == TYPE_GROUND && !IsBattlerGrounded(battlerDef)) - { - modifier = UQ_4_12(0.0); - if (recordAbilities && GetBattlerAbility(battlerDef) == ABILITY_LEVITATE) - { - gLastUsedAbility = ABILITY_LEVITATE; - gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE); - gLastLandedMoves[battlerDef] = 0; - gBattleCommunication[6] = moveType; - RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); - } - } - if (GetBattlerAbility(battlerDef) == ABILITY_WONDER_GUARD && modifier <= UQ_4_12(1.0) && gBattleMoves[move].power) - { - modifier = UQ_4_12(0.0); - if (recordAbilities) - { - gLastUsedAbility = ABILITY_WONDER_GUARD; - gMoveResultFlags |= MOVE_RESULT_MISSED; - gLastLandedMoves[battlerDef] = 0; - gBattleCommunication[6] = 3; - RecordAbilityBattle(battlerDef, ABILITY_WONDER_GUARD); - } - } + modifier = CalcTypeEffectivenessMultiplierInternal(move, moveType, battlerAtk, battlerDef, recordAbilities, modifier); + if (gBattleMoves[move].effect == EFFECT_TWO_TYPED_MOVE) + modifier = CalcTypeEffectivenessMultiplierInternal(move, gBattleMoves[move].argument, battlerAtk, battlerDef, recordAbilities, modifier); } UpdateMoveResultFlags(modifier);