Skip to content

Commit

Permalink
Tests for Air Balloon (rh-hideout#3071)
Browse files Browse the repository at this point in the history
* Add tests for HOLD_EFFECT_AIR_BALLOON

* Apply suggestions from code review

---------

Co-authored-by: Bart <bart@DESKTOP-IKF42MG.localdomain>
Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
  • Loading branch information
3 people committed Jun 26, 2023
1 parent c7e8edf commit 4a6f791
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions test/hold_effect_air_balloon.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#include "global.h"
#include "test_battle.h"

ASSUMPTIONS
{
ASSUME(gItems[ITEM_AIR_BALLOON].holdEffect == HOLD_EFFECT_AIR_BALLOON);
ASSUME(gBattleMoves[MOVE_EARTHQUAKE].type == TYPE_GROUND);
ASSUME(gBattleMoves[MOVE_TACKLE].type != TYPE_GROUND);
ASSUME(gBattleMoves[MOVE_RECYCLE].effect == EFFECT_RECYCLE);
}

SINGLE_BATTLE_TEST("Air Balloon prevents the holder from taking damage from ground type moves")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_EARTHQUAKE); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
MESSAGE("Foe Wobbuffet used Earthquake!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_EARTHQUAKE, opponent);
MESSAGE("It doesn't affect Wobbuffet…");
}
}

SINGLE_BATTLE_TEST("Air Balloon pops when the holder is hit by a move that is not ground type")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
MESSAGE("Foe Wobbuffet used Tackle!");
MESSAGE("Wobbuffet's Air Balloon popped!");
}
}

SINGLE_BATTLE_TEST("Air Balloon no longer prevents the holder from taking damage from ground type moves once it has been popped")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_EARTHQUAKE); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
MESSAGE("Foe Wobbuffet used Tackle!");
MESSAGE("Wobbuffet's Air Balloon popped!");
MESSAGE("Foe Wobbuffet used Earthquake!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_EARTHQUAKE, opponent);
NOT MESSAGE("It doesn't affect Wobbuffet…");
}
}

SINGLE_BATTLE_TEST("Air Balloon can not be restored with Recycle after it has been popped")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
MOVE(opponent, MOVE_TACKLE);
MOVE(player, MOVE_RECYCLE);
}
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
MESSAGE("Foe Wobbuffet used Tackle!");
MESSAGE("Wobbuffet's Air Balloon popped!");
MESSAGE("Wobbuffet used Recycle!");
MESSAGE("But it failed!");
}
}

SINGLE_BATTLE_TEST("Air Balloon prevents the user from being healed by Grassy Terrain")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); MaxHP(100); HP(1); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_GRASSY_TERRAIN); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
NOT MESSAGE("Wobbuffet is healed by the Grassy Terrain!");
}
}

SINGLE_BATTLE_TEST("Air Balloon pops before it can be stolen with Magician")
{
GIVEN {
ASSUME(P_GEN_6_POKEMON == TRUE);
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_DELPHOX) { Ability(ABILITY_MAGICIAN); };
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
MESSAGE("Wobbuffet's Air Balloon popped!");
NOT ABILITY_POPUP(opponent, ABILITY_MAGICIAN);
}
}

SINGLE_BATTLE_TEST("Air Balloon pops before it can be stolen with Thief or Covet")
{
u32 move;
KNOWN_FAILING;
PARAMETRIZE { move = MOVE_THIEF; }
PARAMETRIZE { move = MOVE_COVET; }
GIVEN {
ASSUME(gBattleMoves[move].effect == EFFECT_THIEF);
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
} SCENE {
MESSAGE("Wobbuffet floats in the air with its Air Balloon!");
MESSAGE("Wobbuffet's Air Balloon popped!");
NOT MESSAGE("Foe Wobbuffet stole Wobbuffet's Air Balloon!");
}
}

0 comments on commit 4a6f791

Please sign in to comment.