From fad11981a58ad3a5d2299533da0c29ec38a461e9 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 24 Mar 2023 11:03:34 -0300 Subject: [PATCH] Tests for form change on switch out and fainting --- test/ability_zen_mode.c | 10 +++++----- test/form_change.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/test/ability_zen_mode.c b/test/ability_zen_mode.c index acf0ba291..f18f6d659 100644 --- a/test/ability_zen_mode.c +++ b/test/ability_zen_mode.c @@ -20,11 +20,11 @@ SINGLE_BATTLE_TEST("Zen Mode switches Darmanitan's form when HP is half or less } WHEN { TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_TACKLE); } } SCENE { - MESSAGE("Darmanitan used Celebrate!"); - MESSAGE("Foe Wobbuffet used Tackle!"); - HP_BAR(player); - ABILITY_POPUP(player, ABILITY_ZEN_MODE); - ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); + MESSAGE("Darmanitan used Celebrate!"); + MESSAGE("Foe Wobbuffet used Tackle!"); + HP_BAR(player); + ABILITY_POPUP(player, ABILITY_ZEN_MODE); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); } THEN { ASSUME(player->hp <= player->maxHP / 2); EXPECT_EQ(player->species, zenSpecies); diff --git a/test/form_change.c b/test/form_change.c index 8d761bb12..74ba2b75f 100644 --- a/test/form_change.c +++ b/test/form_change.c @@ -79,3 +79,41 @@ SINGLE_BATTLE_TEST("Zamazenta's Iron Head becomes Behemoth Bash upon form change EXPECT_EQ(player->moves[0], MOVE_BEHEMOTH_BASH); } } + +SINGLE_BATTLE_TEST("Aegislash reverts to Shield Form upon switching out") +{ + GIVEN { + ASSUME(P_GEN_6_POKEMON == TRUE); + PLAYER(SPECIES_AEGISLASH); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_TACKLE); } + TURN { SWITCH(player, 1); } + TURN { SWITCH(player, 0); } + } SCENE { + ABILITY_POPUP(player, ABILITY_STANCE_CHANGE); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player); + MESSAGE("Aegislash used Tackle!"); + MESSAGE("Foe Wobbuffet used Celebrate!"); + } THEN { + EXPECT_EQ(player->species, SPECIES_AEGISLASH); + } +} + +SINGLE_BATTLE_TEST("Aegislash reverts to Shield Form upon fainting") +{ + GIVEN { + ASSUME(P_GEN_6_POKEMON == TRUE); + PLAYER(SPECIES_AEGISLASH) { HP(1); }; + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_GUST); SEND_OUT(player, 1);} + } SCENE { + MESSAGE("Foe Wobbuffet used Gust!"); + MESSAGE("Aegislash fainted!"); + } THEN { + EXPECT_EQ(GetMonData(&PLAYER_PARTY[0], MON_DATA_SPECIES), SPECIES_AEGISLASH); + } +}