forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New tests + Sheer Force / Last Resort minor bug fixes (#3378)
* tests for intimidate defiant * sheer force fix + tests * white herb tests * tests for stealth rock, weak armor and last resort fix * style changes to weak armor test
- Loading branch information
Showing
9 changed files
with
487 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
DOUBLE_BATTLE_TEST("Defiant sharply raises player's Attack after Intimidate") | ||
{ | ||
u32 abilityLeft, abilityRight; | ||
|
||
PARAMETRIZE { abilityLeft = ABILITY_VITAL_SPIRIT; abilityRight = ABILITY_VITAL_SPIRIT; } | ||
PARAMETRIZE { abilityLeft = ABILITY_VITAL_SPIRIT; abilityRight = ABILITY_DEFIANT; } | ||
PARAMETRIZE { abilityLeft = ABILITY_DEFIANT; abilityRight = ABILITY_VITAL_SPIRIT; } | ||
PARAMETRIZE { abilityLeft = ABILITY_DEFIANT; abilityRight = ABILITY_DEFIANT; } | ||
|
||
GIVEN { | ||
PLAYER(SPECIES_MANKEY) { Ability(abilityLeft); } | ||
PLAYER(SPECIES_PRIMEAPE) { Ability(abilityRight); } | ||
OPPONENT(SPECIES_GYARADOS) { Ability(ABILITY_INTIMIDATE); } | ||
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); } | ||
} WHEN { | ||
TURN { MOVE(playerLeft, MOVE_TACKLE, target:opponentLeft); MOVE(playerRight, MOVE_TACKLE, target:opponentRight); } | ||
} SCENE { | ||
//1st mon Intimidate | ||
ABILITY_POPUP(opponentLeft, ABILITY_INTIMIDATE); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); | ||
MESSAGE("Foe Gyarados's Intimidate cuts Mankey's attack!"); | ||
if (abilityLeft == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(playerLeft, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); | ||
MESSAGE("Mankey's Attack sharply rose!"); | ||
} | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); | ||
MESSAGE("Foe Gyarados's Intimidate cuts Primeape's attack!"); | ||
if (abilityRight == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(playerRight, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); | ||
MESSAGE("Primeape's Attack sharply rose!"); | ||
} | ||
|
||
//2nd mon Intimidate | ||
ABILITY_POPUP(opponentRight, ABILITY_INTIMIDATE); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); | ||
MESSAGE("Foe Arbok's Intimidate cuts Mankey's attack!"); | ||
if (abilityLeft == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(playerLeft, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft); | ||
MESSAGE("Mankey's Attack sharply rose!"); | ||
} | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); | ||
MESSAGE("Foe Arbok's Intimidate cuts Primeape's attack!"); | ||
if (abilityRight == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(playerRight, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerRight); | ||
MESSAGE("Primeape's Attack sharply rose!"); | ||
} | ||
} FINALLY { | ||
// -2 from Intimidates and +4 from Defiants gets +2 total | ||
EXPECT_EQ(playerLeft->statStages[STAT_ATK], (abilityLeft == ABILITY_DEFIANT) ? DEFAULT_STAT_STAGE + 2 : DEFAULT_STAT_STAGE - 2); | ||
EXPECT_EQ(playerRight->statStages[STAT_ATK], (abilityRight == ABILITY_DEFIANT) ? DEFAULT_STAT_STAGE + 2 : DEFAULT_STAT_STAGE - 2); | ||
} | ||
} | ||
|
||
// Same as above, but for opponent. | ||
DOUBLE_BATTLE_TEST("Defiant sharply raises opponent's Attack after Intimidate") | ||
{ | ||
u32 abilityLeft, abilityRight; | ||
|
||
PARAMETRIZE { abilityLeft = ABILITY_VITAL_SPIRIT; abilityRight = ABILITY_VITAL_SPIRIT; } | ||
PARAMETRIZE { abilityLeft = ABILITY_VITAL_SPIRIT; abilityRight = ABILITY_DEFIANT; } | ||
PARAMETRIZE { abilityLeft = ABILITY_DEFIANT; abilityRight = ABILITY_VITAL_SPIRIT; } | ||
PARAMETRIZE { abilityLeft = ABILITY_DEFIANT; abilityRight = ABILITY_DEFIANT; } | ||
|
||
GIVEN { | ||
OPPONENT(SPECIES_MANKEY) { Ability(abilityLeft); } | ||
OPPONENT(SPECIES_PRIMEAPE) { Ability(abilityRight); } | ||
PLAYER(SPECIES_GYARADOS) { Ability(ABILITY_INTIMIDATE); } | ||
PLAYER(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); } | ||
} WHEN { | ||
TURN { MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(opponentRight, MOVE_TACKLE, target:playerRight); } | ||
} SCENE { | ||
//1st mon Intimidate | ||
ABILITY_POPUP(playerLeft, ABILITY_INTIMIDATE); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); | ||
MESSAGE("Gyarados's Intimidate cuts Foe Mankey's attack!"); | ||
if (abilityLeft == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(opponentLeft, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); | ||
MESSAGE("Foe Mankey's Attack sharply rose!"); | ||
} | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); | ||
MESSAGE("Gyarados's Intimidate cuts Foe Primeape's attack!"); | ||
if (abilityRight == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(opponentRight, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); | ||
MESSAGE("Foe Primeape's Attack sharply rose!"); | ||
} | ||
|
||
//2nd mon Intimidate | ||
ABILITY_POPUP(playerRight, ABILITY_INTIMIDATE); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); | ||
MESSAGE("Arbok's Intimidate cuts Foe Mankey's attack!"); | ||
if (abilityLeft == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(opponentLeft, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); | ||
MESSAGE("Foe Mankey's Attack sharply rose!"); | ||
} | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); | ||
MESSAGE("Arbok's Intimidate cuts Foe Primeape's attack!"); | ||
if (abilityRight == ABILITY_DEFIANT) { | ||
ABILITY_POPUP(opponentRight, ABILITY_DEFIANT); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); | ||
MESSAGE("Foe Primeape's Attack sharply rose!"); | ||
} | ||
} FINALLY { | ||
// -2 from Intimidates and +4 from Defiants gets +2 total | ||
EXPECT_EQ(opponentLeft->statStages[STAT_ATK], (abilityLeft == ABILITY_DEFIANT) ? DEFAULT_STAT_STAGE + 2 : DEFAULT_STAT_STAGE - 2); | ||
EXPECT_EQ(opponentRight->statStages[STAT_ATK], (abilityRight == ABILITY_DEFIANT) ? DEFAULT_STAT_STAGE + 2 : DEFAULT_STAT_STAGE - 2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
SINGLE_BATTLE_TEST("Sheer Force boosts power, but removes secondary effects of moves", s16 damage) | ||
{ | ||
s32 j; | ||
u32 ability, move; | ||
|
||
for (j = 1; j < MOVES_COUNT; j++) | ||
{ | ||
if (gBattleMoves[j].sheerForceBoost && j != MOVE_ORDER_UP) | ||
{ | ||
PARAMETRIZE { ability = ABILITY_ANGER_POINT; move = j; } | ||
PARAMETRIZE { ability = ABILITY_SHEER_FORCE; move = j; } | ||
} | ||
} | ||
|
||
GIVEN { | ||
PLAYER(SPECIES_TAUROS) { Ability(ability); Status1(move == MOVE_SNORE ? STATUS1_SLEEP : STATUS1_NONE); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(player, move); } | ||
if (gBattleMoves[move].effect == EFFECT_TWO_TURNS_ATTACK || gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE) { | ||
TURN { SKIP_TURN(player); } | ||
TURN { ; } | ||
} | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, move, player); | ||
HP_BAR(opponent, captureDamage: &results[i].damage); | ||
if (ability == ABILITY_SHEER_FORCE) { | ||
NONE_OF { | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); | ||
STATUS_ICON(opponent, STATUS1_FREEZE); | ||
STATUS_ICON(opponent, STATUS1_POISON); | ||
STATUS_ICON(opponent, STATUS1_BURN); | ||
STATUS_ICON(opponent, STATUS1_TOXIC_POISON); | ||
STATUS_ICON(opponent, STATUS1_PARALYSIS); | ||
MESSAGE("Wobbuffet is confused!"); | ||
MESSAGE("Wobbuffet flinched!"); | ||
} | ||
// Volt Tackle/Flare Blitz edge case: recoil happens, but target isn't statused | ||
if (gBattleMoves[move].effect == EFFECT_RECOIL_33_STATUS) | ||
{ | ||
HP_BAR(player); | ||
MESSAGE("Tauros is hit with recoil!"); | ||
} | ||
} | ||
} FINALLY { | ||
s32 j; | ||
for (j = 0; j < gBattleTestRunnerState->parametersCount; j+=2) | ||
{ | ||
EXPECT_GT(results[j+1].damage, results[j].damage); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
ASSUMPTIONS | ||
{ | ||
ASSUME(gBattleMoves[MOVE_TACKLE].power != 0); | ||
ASSUME(gBattleMoves[MOVE_GUST].power != 0); | ||
ASSUME(gBattleMoves[MOVE_GUST].split == SPLIT_SPECIAL); | ||
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL); | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Weak Armor lowers Defense by 1 and boosts Speed by 2 when hit by a physical attack") | ||
{ | ||
u16 move; | ||
|
||
PARAMETRIZE { move = MOVE_TACKLE; } | ||
PARAMETRIZE { move = MOVE_GUST; } | ||
|
||
GIVEN { | ||
PLAYER(SPECIES_SLUGMA) { Ability(ABILITY_WEAK_ARMOR); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(opponent, move); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, move, opponent); | ||
HP_BAR(player); | ||
if (move == MOVE_TACKLE) { | ||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
MESSAGE("Slugma's Weak Armor lowered its Defense!"); | ||
MESSAGE("Slugma's Weak Armor raised its Speed!"); | ||
} | ||
} THEN { | ||
if (move == MOVE_TACKLE) { | ||
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE - 1); | ||
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 2); | ||
} | ||
} | ||
} | ||
|
||
// Oddly specific, but it was a bug at one point. | ||
SINGLE_BATTLE_TEST("Weak Armor does not trigger when brought in by Dragon Tail and taking Stealth Rock damage") | ||
{ | ||
GIVEN { | ||
ASSUME(gBattleMoves[MOVE_STEALTH_ROCK].effect == EFFECT_STEALTH_ROCK); | ||
ASSUME(gBattleMoves[MOVE_DRAGON_TAIL].effect == EFFECT_HIT_SWITCH_TARGET); | ||
PLAYER(SPECIES_WOBBUFFET); | ||
PLAYER(SPECIES_SLUGMA) { Ability(ABILITY_WEAK_ARMOR); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(opponent, MOVE_STEALTH_ROCK); } | ||
TURN { MOVE(opponent, MOVE_DRAGON_TAIL); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STEALTH_ROCK, opponent); | ||
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_TAIL, opponent); | ||
HP_BAR(player); | ||
MESSAGE("Slugma was dragged out!"); | ||
HP_BAR(player); | ||
MESSAGE("Pointed stones dug into Slugma!"); | ||
NONE_OF { | ||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
MESSAGE("Slugma's Weak Armor lowered its Defense!"); | ||
MESSAGE("Slugma's Weak Armor raised its Speed!"); | ||
} | ||
} THEN { | ||
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE); | ||
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "global.h" | ||
#include "test/battle.h" | ||
|
||
ASSUMPTIONS | ||
{ | ||
gItems[ITEM_WHITE_HERB].holdEffect == HOLD_EFFECT_RESTORE_STATS; | ||
} | ||
|
||
SINGLE_BATTLE_TEST("White Herb restores stats when they're lowered") | ||
{ | ||
GIVEN { | ||
ASSUME(gBattleMoves[MOVE_LEER].effect == EFFECT_DEFENSE_DOWN); | ||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_WHITE_HERB); } | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { MOVE(opponent, MOVE_LEER); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); | ||
MESSAGE("Wobbuffet's White Herb restored its status!"); | ||
} THEN { | ||
EXPECT(player->item == ITEM_NONE); | ||
EXPECT(player->statStages[STAT_DEF] = DEFAULT_STAT_STAGE); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("White Herb restores stats after Attack was lowered by Intimidate in singles") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_WHITE_HERB); } | ||
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); } | ||
} WHEN { | ||
TURN { ; } | ||
} SCENE { | ||
ABILITY_POPUP(opponent, ABILITY_INTIMIDATE); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); | ||
MESSAGE("Wobbuffet's White Herb restored its status!"); | ||
} THEN { | ||
EXPECT(player->item == ITEM_NONE); | ||
EXPECT(player->statStages[STAT_DEF] = DEFAULT_STAT_STAGE); | ||
} | ||
} | ||
|
||
DOUBLE_BATTLE_TEST("White Herb restores stats after Attack was lowered by Intimidate in doubles") | ||
{ | ||
GIVEN { | ||
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_WHITE_HERB); } | ||
OPPONENT(SPECIES_WYNAUT) { Item(ITEM_WHITE_HERB); } | ||
PLAYER(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); } | ||
PLAYER(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
TURN { ; } | ||
} SCENE { | ||
ABILITY_POPUP(playerLeft, ABILITY_INTIMIDATE); | ||
|
||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentLeft); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponentRight); | ||
|
||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentLeft); | ||
MESSAGE("Foe Wobbuffet's White Herb restored its status!"); | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentRight); | ||
MESSAGE("Foe Wynaut's White Herb restored its status!"); | ||
} THEN { | ||
EXPECT(opponentLeft->item == ITEM_NONE); | ||
EXPECT(opponentLeft->statStages[STAT_DEF] = DEFAULT_STAT_STAGE); | ||
EXPECT(opponentRight->item == ITEM_NONE); | ||
EXPECT(opponentRight->statStages[STAT_DEF] = DEFAULT_STAT_STAGE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.