diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index bd55b6954a..0cf0862f15 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -222,7 +222,7 @@ enum { EFFECT_HEAL_PULSE, EFFECT_QUASH, EFFECT_ION_DELUGE, - EFFECT_FREEZE_DRY, + EFFECT_SUPER_EFFECTIVE_ON_ARG, EFFECT_TOPSY_TURVY, EFFECT_MISTY_TERRAIN, EFFECT_GRASSY_TERRAIN, diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 6dd50eaaa1..178e913a43 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -4258,7 +4258,7 @@ static u32 AI_CalcMoveScore(u32 battlerAtk, u32 battlerDef, u32 move) ADJUST_SCORE(DECENT_EFFECT); break; case EFFECT_SOAK: - if (HasMoveWithType(battlerAtk, TYPE_ELECTRIC) || HasMoveWithType(battlerAtk, TYPE_GRASS) || HasMoveEffect(battlerAtk, EFFECT_FREEZE_DRY)) + if (HasMoveWithType(battlerAtk, TYPE_ELECTRIC) || HasMoveWithType(battlerAtk, TYPE_GRASS) || (HasMoveEffect(battlerAtk, EFFECT_SUPER_EFFECTIVE_ON_ARG) && gMovesInfo[move].argument == TYPE_WATER) ) ADJUST_SCORE(DECENT_EFFECT); // Get some super effective moves break; case EFFECT_THIRD_TYPE: diff --git a/src/battle_util.c b/src/battle_util.c index 523026f8eb..45b0566bae 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9132,8 +9132,16 @@ static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 m } else if (gMovesInfo[move].effect == EFFECT_BODY_PRESS) { - atkStat = gBattleMons[battlerAtk].defense; - atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF]; + if (IS_MOVE_PHYSICAL(move)) + { + atkStat = gBattleMons[battlerAtk].defense; + atkStage = gBattleMons[battlerAtk].statStages[STAT_DEF]; + } + else + { + atkStat = gBattleMons[battlerAtk].spDefense; + atkStage = gBattleMons[battlerAtk].statStages[STAT_SPDEF]; + } } else { @@ -9879,7 +9887,7 @@ static inline void MulByTypeEffectiveness(uq4_12_t *modifier, u32 move, u32 move if (moveType == TYPE_PSYCHIC && defType == TYPE_DARK && gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED && mod == UQ_4_12(0.0)) mod = UQ_4_12(1.0); - if (gMovesInfo[move].effect == EFFECT_FREEZE_DRY && defType == TYPE_WATER) + if (gMovesInfo[move].effect == EFFECT_SUPER_EFFECTIVE_ON_ARG && defType == gMovesInfo[move].argument) 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); diff --git a/src/data/battle_move_effects.h b/src/data/battle_move_effects.h index 4cf54b0370..52efcb1212 100644 --- a/src/data/battle_move_effects.h +++ b/src/data/battle_move_effects.h @@ -1429,7 +1429,7 @@ const struct BattleMoveEffect gBattleMoveEffects[NUM_BATTLE_MOVE_EFFECTS] = .battleTvScore = 0, // TODO: Assign points }, - [EFFECT_FREEZE_DRY] = + [EFFECT_SUPER_EFFECTIVE_ON_ARG] = { .battleScript = BattleScript_EffectHit, .battleTvScore = 0, // TODO: Assign points diff --git a/src/data/moves_info.h b/src/data/moves_info.h index b4639fd290..b19f4a7c43 100644 --- a/src/data/moves_info.h +++ b/src/data/moves_info.h @@ -13680,7 +13680,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] = .description = COMPOUND_STRING( "Super effective on Water-\n" "types. May cause freezing."), - .effect = EFFECT_FREEZE_DRY, + .effect = EFFECT_SUPER_EFFECTIVE_ON_ARG, .power = 70, .type = TYPE_ICE, .accuracy = 100, @@ -13688,6 +13688,7 @@ const struct MoveInfo gMovesInfo[MOVES_COUNT_DYNAMAX] = .target = MOVE_TARGET_SELECTED, .priority = 0, .category = DAMAGE_CATEGORY_SPECIAL, + .argument = TYPE_WATER, .additionalEffects = ADDITIONAL_EFFECTS({ .moveEffect = MOVE_EFFECT_FREEZE_OR_FROSTBITE, .chance = 10, diff --git a/test/battle/move_effect/body_press.c b/test/battle/move_effect/body_press.c new file mode 100644 index 0000000000..a88a9bcaa5 --- /dev/null +++ b/test/battle/move_effect/body_press.c @@ -0,0 +1,29 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gMovesInfo[MOVE_BODY_PRESS].effect == EFFECT_BODY_PRESS); +} + +SINGLE_BATTLE_TEST("Body Press uses physical defense stat of target", s16 damage) +{ + u32 move; + + PARAMETRIZE { move = MOVE_DRILL_PECK; } + PARAMETRIZE { move = MOVE_BODY_PRESS; } + + GIVEN { + ASSUME(gMovesInfo[MOVE_DRILL_PECK].power == gMovesInfo[MOVE_BODY_PRESS].power); + ASSUME(gMovesInfo[MOVE_CHARM].effect == EFFECT_ATTACK_DOWN_2); + PLAYER(SPECIES_MEW); + OPPONENT(SPECIES_SHELLDER); + } WHEN { + TURN { MOVE(opponent, MOVE_CHARM); MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + } +} diff --git a/test/battle/move_effect/foul_play.c b/test/battle/move_effect/foul_play.c new file mode 100644 index 0000000000..cc853b48de --- /dev/null +++ b/test/battle/move_effect/foul_play.c @@ -0,0 +1,29 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gMovesInfo[MOVE_FOUL_PLAY].effect == EFFECT_FOUL_PLAY); +} + +SINGLE_BATTLE_TEST("Foul Play uses physical attack stat of target", s16 damage) +{ + u32 move; + + PARAMETRIZE { move = MOVE_HIGH_HORSEPOWER; } + PARAMETRIZE { move = MOVE_FOUL_PLAY; } + + GIVEN { + ASSUME(gMovesInfo[MOVE_HIGH_HORSEPOWER].power == gMovesInfo[MOVE_FOUL_PLAY].power); + ASSUME(gMovesInfo[MOVE_SWORDS_DANCE].effect == EFFECT_ATTACK_UP_2); + PLAYER(SPECIES_SHELLDER); + OPPONENT(SPECIES_SHELLDER); + } WHEN { + TURN { MOVE(opponent, MOVE_SWORDS_DANCE); MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + } +} diff --git a/test/battle/move_effect/super_effective_on_arg.c b/test/battle/move_effect/super_effective_on_arg.c new file mode 100644 index 0000000000..d10b8a2231 --- /dev/null +++ b/test/battle/move_effect/super_effective_on_arg.c @@ -0,0 +1,21 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gMovesInfo[MOVE_FREEZE_DRY].effect == EFFECT_SUPER_EFFECTIVE_ON_ARG); +} + +SINGLE_BATTLE_TEST("Freeze Dry is super effective on water types") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_SHELLDER); + } WHEN { + TURN { MOVE(player, MOVE_FREEZE_DRY); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FREEZE_DRY, player); + HP_BAR(opponent); + MESSAGE("It's super effective!"); + } +}