From 96cb4d382311e1a127549d5ee30f72a7c33bc669 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 21 Dec 2023 16:06:12 -0300 Subject: [PATCH] Added last CannotUseItemsInBattle tests (#3789) * Added missing CannotUseItemsInBattle tests * Removed individual assumptions for the EFFECT_ITEM_ESCAPE tests and added a single global one * Added assumption for the move-related EFFECT_ITEM_ESCAPE test * Moved the Mean Look assumption for consistency with other tests and to be extra safe --- test/battle/item_effect/escape.c | 50 ++++++++++++++++++++++++++++ test/battle/item_effect/restore_pp.c | 2 ++ test/battle/item_effect/revive.c | 2 ++ test/battle/item_effect/throw_ball.c | 7 ++++ 4 files changed, 61 insertions(+) create mode 100644 test/battle/item_effect/escape.c create mode 100644 test/battle/item_effect/throw_ball.c diff --git a/test/battle/item_effect/escape.c b/test/battle/item_effect/escape.c new file mode 100644 index 0000000000..0947a4ff9a --- /dev/null +++ b/test/battle/item_effect/escape.c @@ -0,0 +1,50 @@ +#include "global.h" +#include "test/battle.h" + +ASSUMPTIONS +{ + ASSUME(gItems[ITEM_POKE_TOY].battleUsage == EFFECT_ITEM_ESCAPE); +} + +WILD_BATTLE_TEST("Poke Toy lets the player escape from a wild battle") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { USE_ITEM(player, ITEM_POKE_TOY); } + } SCENE { + MESSAGE("{PLAY_SE SE_FLEE}Got away safely!\p"); + } +} + +WILD_BATTLE_TEST("Poke Toy lets the player escape from a wild battle even if a move forbid them to") +{ + GIVEN { + ASSUME(gBattleMoves[MOVE_MEAN_LOOK].effect == EFFECT_MEAN_LOOK); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_MEAN_LOOK); } + TURN { USE_ITEM(player, ITEM_POKE_TOY); } + } SCENE { + // Turn 1 + MESSAGE("Wild Wobbuffet used Mean Look!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_MEAN_LOOK, opponent); + MESSAGE("Wobbuffet can't escape now!"); + // Turn 2 + MESSAGE("{PLAY_SE SE_FLEE}Got away safely!\p"); + } +} + +WILD_BATTLE_TEST("Poke Toy lets the player escape from a wild battle even if an ability forbid them to") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_DIGLETT) { Ability(ABILITY_ARENA_TRAP); } + } WHEN { + TURN { USE_ITEM(player, ITEM_POKE_TOY); } + } SCENE { + MESSAGE("{PLAY_SE SE_FLEE}Got away safely!\p"); + } +} diff --git a/test/battle/item_effect/restore_pp.c b/test/battle/item_effect/restore_pp.c index e998ef3d98..ef621ca0f2 100644 --- a/test/battle/item_effect/restore_pp.c +++ b/test/battle/item_effect/restore_pp.c @@ -64,3 +64,5 @@ SINGLE_BATTLE_TEST("Max Elixir restores the PP of all of a battler's moves fully EXPECT_EQ(player->pp[3], 40); } } + +TO_DO_BATTLE_TEST("Ether won't work if the selected move has all its PP") diff --git a/test/battle/item_effect/revive.c b/test/battle/item_effect/revive.c index 2be2ac4a61..45c57322e8 100644 --- a/test/battle/item_effect/revive.c +++ b/test/battle/item_effect/revive.c @@ -72,3 +72,5 @@ SINGLE_BATTLE_TEST("Max Honey restores a fainted battler's HP fully") EXPECT_EQ(player->hp, 200); } } + +TO_DO_BATTLE_TEST("Revive won't restore a battler's HP if it hasn't fainted") diff --git a/test/battle/item_effect/throw_ball.c b/test/battle/item_effect/throw_ball.c new file mode 100644 index 0000000000..17ba01db50 --- /dev/null +++ b/test/battle/item_effect/throw_ball.c @@ -0,0 +1,7 @@ +#include "global.h" +#include "test/battle.h" + +TO_DO_BATTLE_TEST("Poke Balls can't be thrown when there's 2 opposing wild battlers") +TO_DO_BATTLE_TEST("Poke Balls can't be thrown when there's no space in the Pokemon Storage System") +TO_DO_BATTLE_TEST("Poke Balls can't be thrown when an opposing wild battler is in a semi-invulnerable state") +TO_DO_BATTLE_TEST("Poke Balls can't be thrown when B_FLAG_NO_CATCHING is set")