Add check for Magic Guard to avoid taking recoil damage (#4578)
* Add check for Magic Guard to avoid taking recoil damage * 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 * update format of tests with magic guard and some form of recoil damage
This commit is contained in:
parent
bbb6ade9e8
commit
e5b33a0434
4 changed files with 22 additions and 2 deletions
|
@ -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
|
||||
|
|
17
test/battle/ability/magic_guard.c
Normal file
17
test/battle/ability/magic_guard.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
#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 {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOUBLE_EDGE, player);
|
||||
HP_BAR(opponent);
|
||||
NOT HP_BAR(player);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue