From ffc2c04ea6ef65a0c5cf89dae37568053539fc4c Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Mon, 10 Nov 2025 11:58:42 -0300 Subject: [PATCH] Added Soundproof and Bulletproof tests (#8189) --- test/battle/ability/bulletproof.c | 18 +++++++++++- test/battle/ability/soundproof.c | 18 +++++++++++- test/battle/item_effect/poke_flute.c | 43 ++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 test/battle/item_effect/poke_flute.c diff --git a/test/battle/ability/bulletproof.c b/test/battle/ability/bulletproof.c index 733eb63a11..37d59b468e 100644 --- a/test/battle/ability/bulletproof.c +++ b/test/battle/ability/bulletproof.c @@ -1,4 +1,20 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Bulletproof makes ballistic moves fail against the ability user"); +SINGLE_BATTLE_TEST("Bulletproof makes ballistic moves fail against the ability user") +{ + GIVEN { + ASSUME(IsBallisticMove(MOVE_ELECTRO_BALL)); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_CHESPIN) { Ability(ABILITY_BULLETPROOF); } + } WHEN { + TURN { MOVE(player, MOVE_ELECTRO_BALL); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_BULLETPROOF); + MESSAGE("The opposing Chespin's Bulletproof blocks Electro Ball!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_ELECTRO_BALL, player); + HP_BAR(opponent); + } + } +} diff --git a/test/battle/ability/soundproof.c b/test/battle/ability/soundproof.c index a7135942d1..6af6231cc2 100644 --- a/test/battle/ability/soundproof.c +++ b/test/battle/ability/soundproof.c @@ -1,4 +1,20 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("TODO: Write Soundproof (Ability) test titles") +SINGLE_BATTLE_TEST("Soundproof makes sound moves fail against the ability user") +{ + GIVEN { + ASSUME(IsSoundMove(MOVE_BOOMBURST)); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_EXPLOUD) { Ability(ABILITY_SOUNDPROOF); } + } WHEN { + TURN { MOVE(player, MOVE_BOOMBURST); } + } SCENE { + ABILITY_POPUP(opponent, ABILITY_SOUNDPROOF); + MESSAGE("The opposing Exploud's Soundproof blocks Boomburst!"); + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BOOMBURST, player); + HP_BAR(opponent); + } + } +} diff --git a/test/battle/item_effect/poke_flute.c b/test/battle/item_effect/poke_flute.c new file mode 100644 index 0000000000..c9aebed5d3 --- /dev/null +++ b/test/battle/item_effect/poke_flute.c @@ -0,0 +1,43 @@ +#include "global.h" +#include "test/battle.h" +#include "constants/item_effects.h" + +DOUBLE_BATTLE_TEST("Poke Flute heals all battlers from being asleep") +{ + GIVEN { + ASSUME(gItemsInfo[ITEM_POKE_FLUTE].battleUsage == EFFECT_ITEM_USE_POKE_FLUTE); + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + } WHEN { + TURN { USE_ITEM(playerLeft, ITEM_POKE_FLUTE, partyIndex: 0); } + } SCENE { + MESSAGE("The Pokémon hearing the flute awoke!"); + } THEN { + EXPECT_EQ(playerLeft->status1, STATUS1_NONE); + EXPECT_EQ(playerRight->status1, STATUS1_NONE); + EXPECT_EQ(opponentLeft->status1, STATUS1_NONE); + EXPECT_EQ(opponentRight->status1, STATUS1_NONE); + } +} + +DOUBLE_BATTLE_TEST("Poke Flute does not heal battlers with Soundproof from being asleep") +{ + GIVEN { + ASSUME(gItemsInfo[ITEM_POKE_FLUTE].battleUsage == EFFECT_ITEM_USE_POKE_FLUTE); + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + PLAYER(SPECIES_EXPLOUD) { Ability(ABILITY_SOUNDPROOF); Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); } + OPPONENT(SPECIES_EXPLOUD) { Ability(ABILITY_SOUNDPROOF); Status1(STATUS1_SLEEP); } + } WHEN { + TURN { USE_ITEM(playerLeft, ITEM_POKE_FLUTE, partyIndex: 0); } + } SCENE { + MESSAGE("The Pokémon hearing the flute awoke!"); + } THEN { + EXPECT_EQ(playerLeft->status1, STATUS1_NONE); + EXPECT_NE(playerRight->status1, STATUS1_NONE); + EXPECT_EQ(opponentLeft->status1, STATUS1_NONE); + EXPECT_NE(opponentRight->status1, STATUS1_NONE); + } +}