Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battle tests for Poison Heal, Sap Sipper and Defeatist #3181

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/battle_scripts_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -8006,9 +8006,10 @@ BattleScript_DoTurnDmgEnd:
end2

BattleScript_PoisonHealActivates::
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
printstring STRINGID_POISONHEALHPUP
waitmessage B_WAIT_TIME_LONG
recordability BS_ATTACKER
statusanimation BS_ATTACKER
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_ATTACKER
Expand Down
46 changes: 46 additions & 0 deletions test/ability_defeatist.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "global.h"
#include "test_battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_ECHOED_VOICE].split == SPLIT_SPECIAL);
}

SINGLE_BATTLE_TEST("Defeatist halves Attack when HP <= 50%", s16 damage)
{
u32 hp;
PARAMETRIZE { hp = 400; }
PARAMETRIZE { hp = 200; }
GIVEN {
PLAYER(SPECIES_ARCHEN) { Ability(ABILITY_DEFEATIST); HP(hp), MaxHP(400);}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
}
}

SINGLE_BATTLE_TEST("Defeatist halves Special Attack when HP <= 50%", s16 damage)
{
u32 hp;
PARAMETRIZE { hp = 400; }
PARAMETRIZE { hp = 200; }
GIVEN {
PLAYER(SPECIES_ARCHEN) { Ability(ABILITY_DEFEATIST); HP(hp), MaxHP(400);}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_ECHOED_VOICE); MOVE(opponent, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_ECHOED_VOICE, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
}
}
62 changes: 62 additions & 0 deletions test/ability_poison_heal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "global.h"
#include "test_battle.h"

SINGLE_BATTLE_TEST("Poison Heal heals from Poison damage")
{
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Status1(STATUS1_POISON); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
}
}

SINGLE_BATTLE_TEST("Poison Heal heals from Toxic Poison damage")
{
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Status1(STATUS1_TOXIC_POISON); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
}
}

SINGLE_BATTLE_TEST("Poison Heal does not heal or cause damage when under Heal Block")
{
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Status1(STATUS1_POISON); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_HEAL_BLOCK); }
} SCENE {
NONE_OF {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
}
}
}

SINGLE_BATTLE_TEST("Poison Heal activates before Toxic Orb")
{
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Item(ITEM_TOXIC_ORB); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
NONE_OF {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
}
}
}
55 changes: 55 additions & 0 deletions test/ability_sap_sipper.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "global.h"
#include "test_battle.h"

SINGLE_BATTLE_TEST("Sap Sipper negates damage from Grass-type moves")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_VINE_WHIP); }
} SCENE {
NONE_OF { HP_BAR(player); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the canceling move messages at least.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no explicit canceling message, since it flows into the "increases Attack" tests

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's add the regular messages to make it explicit how the messaging shows up. I had to look up a video to make sure.

}
}

SINGLE_BATTLE_TEST("Sap Sipper negates effects from Grass-type moves")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SPORE); }
} SCENE {
NONE_OF { ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); }
NONE_OF { STATUS_ICON(player, sleep: TRUE); }
}
}

SINGLE_BATTLE_TEST("Sap Sipper increases Attack by one stage when hit by a Grass-type move")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_VINE_WHIP); }
} SCENE {
ABILITY_POPUP(player, ABILITY_SAP_SIPPER);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Marill's Attack rose!");
AsparagusEduardo marked this conversation as resolved.
Show resolved Hide resolved
}
}

SINGLE_BATTLE_TEST("Sap Sipper does not increase Attack if already maxed")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(player, MOVE_BELLY_DRUM); MOVE(opponent, MOVE_VINE_WHIP); }
} SCENE {
ABILITY_POPUP(player, ABILITY_SAP_SIPPER);
NONE_OF { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); }
Bassoonian marked this conversation as resolved.
Show resolved Hide resolved
NONE_OF { MESSAGE("Marill's Attack rose!"); }
}
}