From 16cace5d5108a725a78fc271e87ed3e81e944593 Mon Sep 17 00:00:00 2001 From: Isaac Rivera Date: Tue, 14 May 2024 16:07:52 -0400 Subject: [PATCH 1/3] Add check for Magic Guard to avoid taking recoil damage --- data/battle_scripts_1.s | 1 + 1 file changed, 1 insertion(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f20e13e8ae0a..a0f1e81ae344 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7467,6 +7467,7 @@ BattleScript_MoveEffectConfusion:: BattleScript_MoveEffectRecoil:: jumpifmove MOVE_STRUGGLE, BattleScript_DoRecoil jumpifability BS_ATTACKER, ABILITY_ROCK_HEAD, BattleScript_RecoilEnd + jumpifability BS_ATTACKER, ABILITY_MAGIC_GUARD, BattleScript_RecoilEnd BattleScript_DoRecoil:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE | HITMARKER_IGNORE_DISGUISE healthbarupdate BS_ATTACKER From f04733a4673113df68b69bde53bf944bb0fd018a Mon Sep 17 00:00:00 2001 From: Isaac Rivera Date: Tue, 14 May 2024 16:57:05 -0400 Subject: [PATCH 2/3] add test to verify a mon with magic guard does not take recoil damage followed format from "Steel Beam hp loss is prevented by Magic Guard" test --- test/battle/ability/magic_guard.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/battle/ability/magic_guard.c diff --git a/test/battle/ability/magic_guard.c b/test/battle/ability/magic_guard.c new file mode 100644 index 000000000000..41a1d9c5b844 --- /dev/null +++ b/test/battle/ability/magic_guard.c @@ -0,0 +1,16 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Magic Guard prevents recoil damage to the user") +{ + GIVEN { + ASSUME(gMovesInfo[MOVE_DOUBLE_EDGE].recoil == 33); + PLAYER(SPECIES_CLEFABLE) { Ability(ABILITY_MAGIC_GUARD); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_DOUBLE_EDGE); } + } SCENE { + NOT HP_BAR(player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_EDGE, player); + } +} From caa429c3f5406f1b628c5c062887f19dd3ba18ec Mon Sep 17 00:00:00 2001 From: Isaac Rivera Date: Wed, 15 May 2024 09:27:38 -0400 Subject: [PATCH 3/3] update format of tests with magic guard and some form of recoil damage --- test/battle/ability/magic_guard.c | 3 ++- test/battle/move_effect/max_hp_50_recoil.c | 3 ++- test/battle/move_effect/mind_blown.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/battle/ability/magic_guard.c b/test/battle/ability/magic_guard.c index 41a1d9c5b844..69e8bac9c7fc 100644 --- a/test/battle/ability/magic_guard.c +++ b/test/battle/ability/magic_guard.c @@ -10,7 +10,8 @@ SINGLE_BATTLE_TEST("Magic Guard prevents recoil damage to the user") } WHEN { TURN { MOVE(player, MOVE_DOUBLE_EDGE); } } SCENE { - NOT HP_BAR(player); ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_EDGE, player); + HP_BAR(opponent); + NOT HP_BAR(player); } } diff --git a/test/battle/move_effect/max_hp_50_recoil.c b/test/battle/move_effect/max_hp_50_recoil.c index 8d5cbdaed2cd..1ac98854e095 100644 --- a/test/battle/move_effect/max_hp_50_recoil.c +++ b/test/battle/move_effect/max_hp_50_recoil.c @@ -91,8 +91,9 @@ SINGLE_BATTLE_TEST("Steel Beam hp loss is prevented by Magic Guard") } WHEN { TURN { MOVE(player, MOVE_STEEL_BEAM); } } SCENE { - NOT HP_BAR(player); ANIMATION(ANIM_TYPE_MOVE, MOVE_STEEL_BEAM, player); + HP_BAR(opponent); + NOT HP_BAR(player); } } diff --git a/test/battle/move_effect/mind_blown.c b/test/battle/move_effect/mind_blown.c index f1b7d8b98a46..da39cf18d787 100644 --- a/test/battle/move_effect/mind_blown.c +++ b/test/battle/move_effect/mind_blown.c @@ -114,8 +114,9 @@ SINGLE_BATTLE_TEST("Mind Blown hp loss is prevented by Magic Guard") } WHEN { TURN { MOVE(player, MOVE_MIND_BLOWN); } } SCENE { - NOT HP_BAR(player); ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, player); + HP_BAR(opponent); + NOT HP_BAR(player); } }