Skip to content

Commit

Permalink
Tests for Anger Point and Moxie (#4811)
Browse files Browse the repository at this point in the history
* Create anger_point.c

* Create moxie.c

* Add extra test and animations

* add another test
  • Loading branch information
Sneed69 authored Jun 16, 2024
1 parent b8607fe commit 107cb96
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 0 deletions.
73 changes: 73 additions & 0 deletions test/battle/ability/anger_point.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Anger Point raises Attack stage to maximum after receiving a critical hit")
{
ASSUME(gMovesInfo[MOVE_FROST_BREATH].alwaysCriticalHit);

GIVEN {
PLAYER(SPECIES_PRIMEAPE) { Ability(ABILITY_ANGER_POINT); }
OPPONENT(SPECIES_SNORUNT);
} WHEN {
TURN { MOVE(opponent, MOVE_FROST_BREATH); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FROST_BREATH, opponent);
MESSAGE("A critical hit!");
ABILITY_POPUP(player, ABILITY_ANGER_POINT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Primeape's Anger Point maxed its Attack!");
} THEN {
EXPECT_EQ(player->statStages[STAT_ATK], MAX_STAT_STAGE);
}
}

SINGLE_BATTLE_TEST("Anger Point does not trigger when already at maximum Attack stage")
{
ASSUME(gMovesInfo[MOVE_FROST_BREATH].alwaysCriticalHit);
ASSUME(gMovesInfo[MOVE_BELLY_DRUM].effect == EFFECT_BELLY_DRUM);

GIVEN {
PLAYER(SPECIES_PRIMEAPE) { Ability(ABILITY_ANGER_POINT); Speed(2); }
OPPONENT(SPECIES_SNORUNT) { Speed(1); }
} WHEN {
TURN { MOVE(player, MOVE_BELLY_DRUM); MOVE(opponent, MOVE_FROST_BREATH); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_BELLY_DRUM, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Primeape cut its own HP and maximized ATTACK!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FROST_BREATH, opponent);
MESSAGE("A critical hit!");
NONE_OF {
ABILITY_POPUP(player, ABILITY_ANGER_POINT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Primeape's Anger Point maxed its Attack!");
}
} THEN {
EXPECT_EQ(player->statStages[STAT_ATK], MAX_STAT_STAGE);
}
}

SINGLE_BATTLE_TEST("Anger Point does not trigger when a substitute takes the hit")
{
ASSUME(gMovesInfo[MOVE_FROST_BREATH].alwaysCriticalHit);
ASSUME(gMovesInfo[MOVE_SUBSTITUTE].effect == EFFECT_SUBSTITUTE);

GIVEN {
PLAYER(SPECIES_PRIMEAPE) { Ability(ABILITY_ANGER_POINT); Speed(2); }
OPPONENT(SPECIES_SNORUNT) { Speed(1); }
} WHEN {
TURN { MOVE(player, MOVE_SUBSTITUTE); MOVE(opponent, MOVE_FROST_BREATH); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, player);
MESSAGE("Primeape made a SUBSTITUTE!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FROST_BREATH, opponent);
MESSAGE("A critical hit!");
NONE_OF {
ABILITY_POPUP(player, ABILITY_ANGER_POINT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Primeape's Anger Point maxed its Attack!");
}
} THEN {
EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE);
}
}
121 changes: 121 additions & 0 deletions test/battle/ability/moxie.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#include "global.h"
#include "test/battle.h"

DOUBLE_BATTLE_TEST("Moxie raises Attack by one stage after directly causing a Pokemon to faint")
{
ASSUME(gMovesInfo[MOVE_EARTHQUAKE].target == MOVE_TARGET_FOES_AND_ALLY);

GIVEN {
PLAYER(SPECIES_SALAMENCE) { Ability(ABILITY_MOXIE); }
PLAYER(SPECIES_SNORUNT) { HP(1); }
OPPONENT(SPECIES_GLALIE) { HP(1); }
OPPONENT(SPECIES_ABRA) { HP(1); }
OPPONENT(SPECIES_ABRA);
} WHEN {
TURN { MOVE(playerLeft, MOVE_EARTHQUAKE); SEND_OUT(opponentLeft, 2); }
} SCENE {
int i;

ANIMATION(ANIM_TYPE_MOVE, MOVE_EARTHQUAKE, playerLeft);
for (i = 0; i < 3; i++) {
ONE_OF {
MESSAGE("Snorunt fainted!");
MESSAGE("Foe Glalie fainted!");
MESSAGE("Foe Abra fainted!");
}
ABILITY_POPUP(playerLeft, ABILITY_MOXIE);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Salamence's Moxie raised its Attack!");
}
} THEN {
EXPECT_EQ(playerLeft->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 3);
}
}

DOUBLE_BATTLE_TEST("Moxie does not trigger if Pokemon faint to indirect damage or damage from other Pokemon")
{
GIVEN {
PLAYER(SPECIES_SALAMENCE) { Ability(ABILITY_MOXIE); }
PLAYER(SPECIES_SNORUNT) { HP(1); Status1(STATUS1_POISON); }
OPPONENT(SPECIES_GLALIE) { HP(1); Status1(STATUS1_BURN); }
OPPONENT(SPECIES_ABRA) { HP(1); }
OPPONENT(SPECIES_ABRA);
} WHEN {
TURN { MOVE(playerRight, MOVE_QUICK_ATTACK, target: opponentRight); SEND_OUT(opponentLeft, 2); }
} SCENE {
int i;

ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, playerRight);
for (i = 0; i < 3; i++) {
ONE_OF {
MESSAGE("Snorunt fainted!");
MESSAGE("Foe Glalie fainted!");
MESSAGE("Foe Abra fainted!");
}
NONE_OF {
ABILITY_POPUP(playerLeft, ABILITY_MOXIE);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Salamence's Moxie raised its Attack!");
}
}
} THEN {
EXPECT_EQ(playerLeft->statStages[STAT_ATK], DEFAULT_STAT_STAGE);
}
}

SINGLE_BATTLE_TEST("Moxie does not trigger when already at maximum Attack stage")
{
ASSUME(gMovesInfo[MOVE_BELLY_DRUM].effect == EFFECT_BELLY_DRUM);

GIVEN {
PLAYER(SPECIES_SALAMENCE) { Ability(ABILITY_MOXIE); }
OPPONENT(SPECIES_SNORUNT) { HP(1); }
OPPONENT(SPECIES_SNORUNT);
} WHEN {
TURN { MOVE(player, MOVE_BELLY_DRUM); }
TURN { MOVE(player, MOVE_QUICK_ATTACK); SEND_OUT(opponent, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_BELLY_DRUM, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Salamence cut its own HP and maximized ATTACK!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, player);
MESSAGE("Foe Snorunt fainted!");
NONE_OF {
ABILITY_POPUP(player, ABILITY_MOXIE);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Salamence's Moxie raised its Attack!");
}
} THEN {
EXPECT_EQ(player->statStages[STAT_ATK], MAX_STAT_STAGE);
}
}

DOUBLE_BATTLE_TEST("Moxie does not increase damage done by the same move that causes another Pokemon to faint")
{
s16 damage[2];

ASSUME(gMovesInfo[MOVE_EARTHQUAKE].target == MOVE_TARGET_FOES_AND_ALLY);

KNOWN_FAILING; // Requires simultaneous damage implementation
GIVEN {
PLAYER(SPECIES_SALAMENCE) { Ability(ABILITY_MOXIE); }
PLAYER(SPECIES_ABRA) { HP(1); }
OPPONENT(SPECIES_GLALIE);
OPPONENT(SPECIES_GLALIE);
OPPONENT(SPECIES_ABRA);
} WHEN {
TURN { MOVE(playerLeft, MOVE_EARTHQUAKE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_EARTHQUAKE, playerLeft);
HP_BAR(opponentLeft, captureDamage: &damage[0]);
HP_BAR(playerRight);
MESSAGE("Abra fainted!");
ABILITY_POPUP(playerLeft, ABILITY_MOXIE);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
MESSAGE("Salamence's Moxie raised its Attack!");
HP_BAR(opponentRight, captureDamage: &damage[1]);
} THEN {
EXPECT_EQ(playerLeft->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 1);
EXPECT_EQ(damage[0], damage[1]);
}
}

0 comments on commit 107cb96

Please sign in to comment.