Merge branch 'RHH/master' into RHH/upcoming

This commit is contained in:
Eduardo Quezada 2023-06-26 18:09:53 -04:00
commit f9bf91a2f0
64 changed files with 561 additions and 588 deletions

View File

@ -2,6 +2,7 @@
#include "string_util.h"
#include "text.h"
#include "strings.h"
#include "union_room_chat.h"
EWRAM_DATA u8 gStringVar1[0x100] = {0};
EWRAM_DATA u8 gStringVar2[0x100] = {0};
@ -779,3 +780,19 @@ void StripExtCtrlCodes(u8 *str)
}
str[destIndex] = EOS;
}
u8 *StringCopyUppercase(u8 *dest, const u8 *src)
{
while (*src != EOS)
{
if (*src >= CHAR_a && *src <= CHAR_z)
*dest = gCaseToggleTable[*src];
else
*dest = *src;
dest++;
src++;
}
*dest = EOS;
return dest;
}

View File

@ -42,5 +42,6 @@ u8 GetExtCtrlCodeLength(u8 code);
s32 StringCompareWithoutExtCtrlCodes(const u8 *str1, const u8 *str2);
void ConvertInternationalString(u8 *s, u8 language);
void StripExtCtrlCodes(u8 *str);
u8 *StringCopyUppercase(u8 *dest, const u8 *src);
#endif // GUARD_STRING_UTIL_H

View File

@ -4,4 +4,6 @@
void EnterUnionRoomChat(void);
void InitUnionRoomChatRegisteredTexts(void);
extern const u8 gCaseToggleTable[256];
#endif // GUARD_UNION_ROOM_CHAT_H

View File

@ -5224,7 +5224,7 @@ u8 *CopyEasyChatWord(u8 *dest, u16 easyChatWord)
{
u16 index = EC_INDEX(easyChatWord);
u8 groupId = EC_GROUP(easyChatWord);
resultStr = StringCopy(dest, GetEasyChatWord(groupId, index));
resultStr = StringCopyUppercase(dest, GetEasyChatWord(groupId, index));
}
else
{

View File

@ -335,7 +335,7 @@ static const u8 sKeyboardPageMaxRow[UNION_ROOM_KB_PAGE_COUNT] =
[UNION_ROOM_KB_PAGE_REGISTER] = 9
};
static const u8 sCaseToggleTable[256] = {
const u8 gCaseToggleTable[256] = {
[CHAR_A] = CHAR_a,
[CHAR_B] = CHAR_b,
[CHAR_C] = CHAR_c,
@ -1734,7 +1734,7 @@ static void SwitchCaseOfLastMessageCharacter(void)
str = GetLastCharOfMessagePtr();
if (*str != CHAR_EXTRA_SYMBOL)
{
character = sCaseToggleTable[*str];
character = gCaseToggleTable[*str];
if (character)
*str = character;
}
@ -1997,7 +1997,7 @@ static int GetShouldShowCaseToggleIcon(void)
{
u8 *str = GetLastCharOfMessagePtr();
u32 character = *str;
if (character > EOS || sCaseToggleTable[character] == character || sCaseToggleTable[character] == CHAR_SPACE)
if (character > EOS || gCaseToggleTable[character] == character || gCaseToggleTable[character] == CHAR_SPACE)
return 3; // Don't show
else
return 0; // Show

View File

@ -81,7 +81,7 @@ SINGLE_BATTLE_TEST("Contrary lowers a stat after using a move which would normal
PARAMETRIZE { ability = ABILITY_TANGLED_FEET; }
GIVEN {
ASSUME(gBattleMoves[MOVE_SWORDS_DANCE].effect == EFFECT_ATTACK_UP_2);
PLAYER(SPECIES_WOBBUFFET) {Defense(102); }
PLAYER(SPECIES_WOBBUFFET) { Defense(102); }
OPPONENT(SPECIES_SPINDA) { Ability(ability); Attack(100); }
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
@ -118,7 +118,7 @@ SINGLE_BATTLE_TEST("Contrary raises a stat after using a move which would normal
PARAMETRIZE { ability = ABILITY_TANGLED_FEET; }
GIVEN {
ASSUME(gBattleMoves[MOVE_GROWL].effect == EFFECT_ATTACK_DOWN);
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_SPINDA) { Ability(ability); Speed(2); }
} WHEN {
TURN { MOVE(player, MOVE_GROWL); MOVE(opponent, MOVE_TACKLE); }

View File

@ -9,7 +9,7 @@ SINGLE_BATTLE_TEST("Damp prevents explosion-like moves from enemies")
PARAMETRIZE { move = MOVE_MIND_BLOWN; }
PARAMETRIZE { move = MOVE_MISTY_EXPLOSION; }
GIVEN {
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); };
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
@ -47,7 +47,7 @@ SINGLE_BATTLE_TEST("Damp prevents explosion-like moves from self")
PARAMETRIZE { move = MOVE_MIND_BLOWN; }
PARAMETRIZE { move = MOVE_MISTY_EXPLOSION; }
GIVEN {
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); };
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
@ -61,8 +61,8 @@ SINGLE_BATTLE_TEST("Damp prevents damage from aftermath")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT);
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); };
OPPONENT(SPECIES_VOLTORB) { Ability(ABILITY_AFTERMATH); HP(1); };
PLAYER(SPECIES_PARAS) { Ability(ABILITY_DAMP); }
OPPONENT(SPECIES_VOLTORB) { Ability(ABILITY_AFTERMATH); HP(1); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); }

View File

@ -13,8 +13,8 @@ SINGLE_BATTLE_TEST("Download raises Attack if player has lower Def than Sp. Def"
PARAMETRIZE { ability = ABILITY_TRACE; }
PARAMETRIZE { ability = ABILITY_DOWNLOAD; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Defense(100); SpDefense(200); };
OPPONENT(SPECIES_PORYGON) { Ability(ability); Attack(100); };
PLAYER(SPECIES_WOBBUFFET) { Defense(100); SpDefense(200); }
OPPONENT(SPECIES_PORYGON) { Ability(ability); Attack(100); }
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
@ -36,8 +36,8 @@ SINGLE_BATTLE_TEST("Download raises Sp.Attack if enemy has lower Sp. Def than De
PARAMETRIZE { ability = ABILITY_TRACE; }
PARAMETRIZE { ability = ABILITY_DOWNLOAD; }
GIVEN {
PLAYER(SPECIES_PORYGON) { Ability(ability); SpAttack(100); };
OPPONENT(SPECIES_WOBBUFFET) {Defense(200); SpDefense(100); };
PLAYER(SPECIES_PORYGON) { Ability(ability); SpAttack(100); }
OPPONENT(SPECIES_WOBBUFFET) { Defense(200); SpDefense(100); }
} WHEN {
TURN { MOVE(player, MOVE_TRI_ATTACK); }
} SCENE {
@ -60,13 +60,13 @@ SINGLE_BATTLE_TEST("Download doesn't activate if target hasn't been sent out yet
PARAMETRIZE { ability = ABILITY_DOWNLOAD; }
GIVEN {
ASSUME(gBattleMoves[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION);
PLAYER(SPECIES_WOBBUFFET) { Speed(100); };
PLAYER(SPECIES_PORYGON) { Ability(ability); Defense(400); SpDefense(300); Speed(300); Attack(100); };
OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(100); };
OPPONENT(SPECIES_PORYGON2) { Ability(ability); Defense(100); SpDefense(200); Speed(200); };
PLAYER(SPECIES_WOBBUFFET) { Speed(100); }
PLAYER(SPECIES_PORYGON) { Ability(ability); Defense(400); SpDefense(300); Speed(300); Attack(100); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(100); }
OPPONENT(SPECIES_PORYGON2) { Ability(ability); Defense(100); SpDefense(200); Speed(200); }
} WHEN {
TURN { MOVE(player, MOVE_EXPLOSION); SEND_OUT(player, 1); SEND_OUT(opponent, 1); }
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_TRI_ATTACK);}
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_TRI_ATTACK); }
} SCENE {
HP_BAR(player, hp: 0);
ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, player);

View File

@ -8,7 +8,7 @@ SINGLE_BATTLE_TEST("Drizzle summons rain", s16 damage)
PARAMETRIZE { ability = ABILITY_DAMP; }
GIVEN {
PLAYER(SPECIES_POLITOED) { Ability(ability); };
PLAYER(SPECIES_POLITOED) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_BUBBLE); }

View File

@ -1,18 +1,16 @@
#include "global.h"
#include "test_battle.h"
#define TEST_MAX_HP (200)
SINGLE_BATTLE_TEST("Dry Skin causes 1/8th Max HP damage in Sun")
{
GIVEN {
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SUNNY_DAY); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DRY_SKIN);
HP_BAR(player, damage: TEST_MAX_HP / 8);
HP_BAR(player, damage: 200 / 8);
MESSAGE("The Parasect's Dry Skin takes its toll!");
}
}
@ -20,14 +18,14 @@ SINGLE_BATTLE_TEST("Dry Skin causes 1/8th Max HP damage in Sun")
SINGLE_BATTLE_TEST("Dry Skin heals 1/8th Max HP in Rain")
{
GIVEN {
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_RAIN_DANCE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DRY_SKIN);
MESSAGE("Parasect's Dry Skin restored its HP a little!");
HP_BAR(player, hp: TEST_MAX_HP / 8 + 100);
HP_BAR(player, damage: -(200 / 8));
}
}
@ -39,9 +37,9 @@ SINGLE_BATTLE_TEST("Dry Skin increases damage taken from Fire-type moves by 25%"
GIVEN {
ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_PARASECT) { Ability(ability); };
OPPONENT(SPECIES_PARASECT) { Ability(ability); }
} WHEN {
TURN {MOVE(player, MOVE_EMBER); }
TURN { MOVE(player, MOVE_EMBER); }
} SCENE {
MESSAGE("Wobbuffet used Ember!");
HP_BAR(opponent, captureDamage: &results[i].damage);
@ -54,13 +52,13 @@ SINGLE_BATTLE_TEST("Dry Skin heals 25% when hit by water type moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BUBBLE].type == TYPE_WATER);
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_BUBBLE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DRY_SKIN);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 100);
HP_BAR(player, damage: -50);
MESSAGE("Parasect restored HP using its Dry Skin!");
}
}
@ -69,7 +67,7 @@ SINGLE_BATTLE_TEST("Dry Skin does not activate if protected")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BUBBLE].type == TYPE_WATER);
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_BUBBLE); }
@ -83,13 +81,13 @@ SINGLE_BATTLE_TEST("Dry Skin is only triggered once on multi strike moves")
GIVEN {
ASSUME(gBattleMoves[MOVE_WATER_SHURIKEN].type == TYPE_WATER);
ASSUME(gBattleMoves[MOVE_WATER_SHURIKEN].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_WATER_SHURIKEN); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DRY_SKIN);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 100);
HP_BAR(player, damage: -50);
MESSAGE("Parasect restored HP using its Dry Skin!");
}
}
@ -101,13 +99,13 @@ SINGLE_BATTLE_TEST("Dry Skin prevents Absorb Bulb and Luminous Moss from activat
PARAMETRIZE { item = ITEM_LUMINOUS_MOSS; }
GIVEN {
ASSUME(gBattleMoves[MOVE_BUBBLE].type == TYPE_WATER);
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(TEST_MAX_HP); Item(item); };
PLAYER(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); HP(100); MaxHP(200); Item(item); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_BUBBLE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_DRY_SKIN);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 100);
HP_BAR(player, damage: -50);
MESSAGE("Parasect restored HP using its Dry Skin!");
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);

View File

@ -4,7 +4,7 @@
SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim in harsh sunlight")
{
GIVEN {
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); };
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
@ -18,7 +18,7 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim in harsh sunlight")
SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal when weather changes")
{
GIVEN {
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); };
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
@ -39,7 +39,7 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal when its abili
{
GIVEN {
ASSUME(B_WEATHER_FORMS >= GEN_5);
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); };
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }
@ -61,7 +61,7 @@ DOUBLE_BATTLE_TEST("Flower Gift increases the attack of Cherrim and its allies b
PARAMETRIZE { sunny = FALSE; }
PARAMETRIZE { sunny = TRUE; }
GIVEN {
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); };
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
@ -95,7 +95,7 @@ DOUBLE_BATTLE_TEST("Flower Gift increases the Sp. Def of Cherrim and its allies
PARAMETRIZE { sunny = FALSE; }
PARAMETRIZE { sunny = TRUE; }
GIVEN {
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); };
PLAYER(SPECIES_CHERRIM) { Ability(ABILITY_FLOWER_GIFT); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);

View File

@ -9,7 +9,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an opponent's m
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, move); }
@ -28,7 +28,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from its own move")
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
@ -47,7 +47,7 @@ DOUBLE_BATTLE_TEST("Forecast transforms Castform in weather from a partner's mov
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
@ -68,10 +68,10 @@ DOUBLE_BATTLE_TEST("Forecast transforms all Castforms present in weather")
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
OPPONENT(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
} WHEN {
TURN { MOVE(playerRight, move); }
} SCENE {
@ -97,9 +97,9 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an ability")
PARAMETRIZE { species = SPECIES_GROUDON; ability = ABILITY_DROUGHT; }
PARAMETRIZE { species = SPECIES_ABOMASNOW; ability = ABILITY_SNOW_WARNING; }
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(species) { Ability(ability); };
OPPONENT(species) { Ability(ability); }
} WHEN {
TURN { SWITCH(opponent, 1); }
} SCENE {
@ -115,9 +115,9 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in primal weather")
PARAMETRIZE { species = SPECIES_KYOGRE; ability = ABILITY_PRIMORDIAL_SEA; item = ITEM_BLUE_ORB; }
PARAMETRIZE { species = SPECIES_GROUDON; ability = ABILITY_DESOLATE_LAND; item = ITEM_RED_ORB; }
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(species) { Item(item); };
OPPONENT(species) { Item(item); }
} WHEN {
TURN { SWITCH(opponent, 1); }
} SCENE {
@ -131,15 +131,15 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform in primal weather")
SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when weather expires")
{
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_RAIN_DANCE); }
TURN { }
TURN { }
TURN { }
TURN { }
TURN { }
TURN {}
TURN {}
TURN {}
TURN {}
TURN {}
} SCENE {
// transforms
ABILITY_POPUP(player, ABILITY_FORECAST);
@ -155,7 +155,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when weather exp
SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when Sandstorm is active")
{
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_RAIN_DANCE); }
@ -175,7 +175,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when Sandstorm i
SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal under Air Lock")
{
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_RAYQUAZA);
} WHEN {
@ -199,7 +199,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform on switch-in")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_RAIN_DANCE); }
@ -217,7 +217,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform on switch-in")
SINGLE_BATTLE_TEST("Forecast transforms Castform when weather changes")
{
GIVEN {
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_RAIN_DANCE); }
@ -238,7 +238,7 @@ SINGLE_BATTLE_TEST("Forecast transforms Castform back to normal when its ability
{
GIVEN {
ASSUME(B_WEATHER_FORMS >= GEN_5);
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); };
PLAYER(SPECIES_CASTFORM) { Ability(ABILITY_FORECAST); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); }

View File

@ -8,8 +8,8 @@ SINGLE_BATTLE_TEST("Hunger Switch switches Morpeko's forms at the end of the tur
PARAMETRIZE { species = SPECIES_MORPEKO_HANGRY; }
GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE);
PLAYER(species) { Speed(2); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); };
PLAYER(species) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {

View File

@ -1,13 +1,11 @@
#include "global.h"
#include "test_battle.h"
#define TEST_MAX_HP (100)
SINGLE_BATTLE_TEST("Ice Body prevents damage from hail")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_GLALIE) { Ability(ABILITY_ICE_BODY); };
OPPONENT(SPECIES_GLALIE) { Ability(ABILITY_ICE_BODY); }
} WHEN {
TURN { MOVE(player, MOVE_HAIL); MOVE(opponent, MOVE_SKILL_SWAP); }
} SCENE {
@ -18,13 +16,13 @@ SINGLE_BATTLE_TEST("Ice Body prevents damage from hail")
SINGLE_BATTLE_TEST("Ice Body recovers 1/16th of Max HP in hail.")
{
GIVEN {
PLAYER(SPECIES_GLALIE) { Ability(ABILITY_ICE_BODY); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_GLALIE) { Ability(ABILITY_ICE_BODY); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_HAIL); }
} SCENE {
ABILITY_POPUP(player, ABILITY_ICE_BODY);
MESSAGE("Glalie's Ice Body healed it a little bit!");
HP_BAR(player, hp: TEST_MAX_HP / 16 + 1);
HP_BAR(player, damage: -(100 / 16));
}
}

View File

@ -27,8 +27,8 @@ SINGLE_BATTLE_TEST("Insomnia prevents yawn")
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SPORE); }
TURN { }
TURN { }
TURN {}
TURN {}
} SCENE {
ABILITY_POPUP(player, ABILITY_INSOMNIA);
NONE_OF {

View File

@ -14,7 +14,7 @@ SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after switch ou
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_ARBOK) { Ability(ability); };
OPPONENT(SPECIES_ARBOK) { Ability(ability); }
} WHEN {
TURN { SWITCH(opponent, 1); }
TURN { MOVE(player, MOVE_TACKLE); }
@ -37,9 +37,9 @@ SINGLE_BATTLE_TEST("Intimidate (opponent) lowers player's attack after KO", s16
PARAMETRIZE { ability = ABILITY_INTIMIDATE; }
PARAMETRIZE { ability = ABILITY_SHED_SKIN; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(2); };
OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); };
OPPONENT(SPECIES_ARBOK) { Ability(ability); Speed(1); };
PLAYER(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); }
OPPONENT(SPECIES_ARBOK) { Ability(ability); Speed(1); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); SEND_OUT(opponent, 1); }
TURN { MOVE(player, MOVE_TACKLE); }
@ -61,17 +61,17 @@ DOUBLE_BATTLE_TEST("Intimidate doesn't activate on an empty field in a double ba
{
GIVEN {
ASSUME(gBattleMoves[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION);
PLAYER(SPECIES_WOBBUFFET) { };
PLAYER(SPECIES_WOBBUFFET) { HP(1); };
PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); };
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); }
PLAYER(SPECIES_ABRA);
OPPONENT(SPECIES_WOBBUFFET) { HP(1); };
OPPONENT(SPECIES_WOBBUFFET) { HP(1); };
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); };
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_ARBOK) { Ability(ABILITY_INTIMIDATE); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(playerLeft, MOVE_EXPLOSION); SEND_OUT(playerLeft, 2); SEND_OUT(opponentLeft, 2); SEND_OUT(playerRight, 3); SEND_OUT(opponentRight, 3); }
TURN { MOVE(playerLeft, MOVE_CELEBRATE);}
TURN { MOVE(playerLeft, MOVE_CELEBRATE); }
} SCENE {
HP_BAR(playerLeft, hp: 0);
ANIMATION(ANIM_TYPE_MOVE, MOVE_EXPLOSION, playerLeft);
@ -101,8 +101,8 @@ SINGLE_BATTLE_TEST("Intimidate and Eject Button force the opponent to Attack")
GIVEN {
ASSUME(gItems[ITEM_EJECT_BUTTON].holdEffect == HOLD_EFFECT_EJECT_BUTTON);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_HITMONTOP) { Moves(MOVE_TACKLE); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_HITMONTOP) { Moves(MOVE_TACKLE); }
} WHEN {
TURN {
MOVE(player, MOVE_QUICK_ATTACK);
@ -129,7 +129,7 @@ DOUBLE_BATTLE_TEST("Intimidate activates on an empty slot")
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_CROAGUNK);
PLAYER(SPECIES_WYNAUT);
PLAYER(SPECIES_HITMONTOP) { Ability(ABILITY_INTIMIDATE); };
PLAYER(SPECIES_HITMONTOP) { Ability(ABILITY_INTIMIDATE); }
OPPONENT(SPECIES_RALTS);
OPPONENT(SPECIES_AZURILL);
} WHEN {

View File

@ -52,7 +52,7 @@ SINGLE_BATTLE_TEST("Leaf Guard prevents non-volatile status conditions in sun")
MESSAGE("It's super effective!");
break;
}
NONE_OF {STATUS_ICON(player, status1: TRUE);}
NONE_OF { STATUS_ICON(player, status1: TRUE); }
}
}
@ -64,16 +64,16 @@ SINGLE_BATTLE_TEST("Leaf Guard prevents status conditions from Flame Orb and Tox
GIVEN {
ASSUME(gItems[ITEM_FLAME_ORB].holdEffect == HOLD_EFFECT_FLAME_ORB);
ASSUME(gItems[ITEM_TOXIC_ORB].holdEffect == HOLD_EFFECT_TOXIC_ORB);
PLAYER(SPECIES_LEAFEON) {Ability(ABILITY_LEAF_GUARD); Item(item); };
PLAYER(SPECIES_LEAFEON) { Ability(ABILITY_LEAF_GUARD); Item(item); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SUNNY_DAY); }
} SCENE {
if (item == ITEM_FLAME_ORB) {
NONE_OF { MESSAGE("Leafeon was burned!"); STATUS_ICON(player, burn: TRUE);}
NONE_OF { MESSAGE("Leafeon was burned!"); STATUS_ICON(player, burn: TRUE); }
}
else {
NONE_OF { MESSAGE("Leafeon is badly poisoned!"); STATUS_ICON(player, poison: TRUE);}
NONE_OF { MESSAGE("Leafeon is badly poisoned!"); STATUS_ICON(player, poison: TRUE); }
}
}
}
@ -83,13 +83,13 @@ SINGLE_BATTLE_TEST("Leaf Guard prevents Rest during sun")
GIVEN {
ASSUME(B_LEAF_GUARD_PREVENTS_REST >= GEN_5);
ASSUME(gBattleMoves[MOVE_REST].effect == EFFECT_REST);
PLAYER(SPECIES_LEAFEON) { Ability(ABILITY_LEAF_GUARD); HP(100); MaxHP(200); };
PLAYER(SPECIES_LEAFEON) { Ability(ABILITY_LEAF_GUARD); HP(100); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SUNNY_DAY); MOVE(player, MOVE_REST); }
} SCENE {
MESSAGE("But it failed!");
NOT STATUS_ICON(player, sleep: TRUE);
NONE_OF {HP_BAR(player);}
NONE_OF { HP_BAR(player); }
}
}

View File

@ -4,7 +4,7 @@
SINGLE_BATTLE_TEST("Limber prevents paralysis")
{
GIVEN {
PLAYER(SPECIES_PERSIAN) { Ability(ABILITY_LIMBER); };
PLAYER(SPECIES_PERSIAN) { Ability(ABILITY_LIMBER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_THUNDER_SHOCK); }

View File

@ -7,7 +7,7 @@ SINGLE_BATTLE_TEST("Magic Bounce bounces back status moves")
GIVEN {
ASSUME(gBattleMoves[MOVE_TOXIC].effect == EFFECT_TOXIC);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE);};
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); }
} WHEN {
TURN { MOVE(player, MOVE_TOXIC); }
} SCENE {
@ -25,7 +25,7 @@ SINGLE_BATTLE_TEST("Magic Bounce bounces back powder moves")
ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER);
ASSUME(gBattleMoves[MOVE_STUN_SPORE].effect == EFFECT_PARALYZE);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE);};
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); }
} WHEN {
TURN { MOVE(player, MOVE_STUN_SPORE); }
} SCENE {
@ -43,7 +43,7 @@ SINGLE_BATTLE_TEST("Magic Bounce cannot bounce back powder moves against Grass T
ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER);
ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS);
PLAYER(SPECIES_ODDISH);
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE);};
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); }
} WHEN {
TURN { MOVE(player, MOVE_STUN_SPORE); }
} SCENE {
@ -64,7 +64,7 @@ DOUBLE_BATTLE_TEST("Magic Bounce bounces back moves hitting both foes at two foe
ASSUME(gBattleMoves[MOVE_LEER].target == MOVE_TARGET_BOTH);
PLAYER(SPECIES_ABRA);
PLAYER(SPECIES_KADABRA);
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE);};
OPPONENT(SPECIES_ESPEON) { Ability(ABILITY_MAGIC_BOUNCE); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN { MOVE(playerLeft, MOVE_LEER); }

View File

@ -5,8 +5,8 @@ SINGLE_BATTLE_TEST("Oblivious prevents Infatuation")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_ATTRACT].effect == EFFECT_ATTRACT);
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); Gender(MON_MALE); };
OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); };
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); Gender(MON_MALE); }
OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); }
} WHEN {
TURN { MOVE(opponent, MOVE_ATTRACT); }
} SCENE {
@ -20,8 +20,8 @@ SINGLE_BATTLE_TEST("Oblivious prevents Captivate")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_CAPTIVATE].effect == EFFECT_CAPTIVATE);
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); Gender(MON_MALE); };
OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); };
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); Gender(MON_MALE); }
OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); }
} WHEN {
TURN { MOVE(opponent, MOVE_ATTRACT); }
} SCENE {
@ -36,7 +36,7 @@ SINGLE_BATTLE_TEST("Oblivious prevents Taunt")
GIVEN {
ASSUME(gBattleMoves[MOVE_TAUNT].effect == EFFECT_TAUNT);
ASSUME(B_OBLIVIOUS_TAUNT >= GEN_6);
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); };
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_TAUNT); }
@ -54,9 +54,9 @@ SINGLE_BATTLE_TEST("Oblivious prevents Intimidate")
{
GIVEN {
ASSUME(B_UPDATED_INTIMIDATE >= GEN_8);
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); };
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); };
OPPONENT(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); }
} WHEN {
TURN { SWITCH(opponent, 1); }
} SCENE {

View File

@ -1,18 +1,16 @@
#include "global.h"
#include "test_battle.h"
#define TEST_MAX_HP (100)
SINGLE_BATTLE_TEST("Rain Dish recovers 1/16th of Max HP in Rain")
{
GIVEN {
PLAYER(SPECIES_LUDICOLO) { Ability(ABILITY_RAIN_DISH); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_LUDICOLO) { Ability(ABILITY_RAIN_DISH); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_RAIN_DANCE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_RAIN_DISH);
MESSAGE("Ludicolo's Rain Dish restored its HP a little!");
HP_BAR(player, hp: TEST_MAX_HP / 16 + 1);
HP_BAR(player, damage: -(100 / 16));
}
}

View File

@ -4,7 +4,7 @@
SINGLE_BATTLE_TEST("Sand Veil prevents damage from sandstorm")
{
GIVEN {
PLAYER(SPECIES_CACNEA) { Ability(ABILITY_SAND_VEIL); };
PLAYER(SPECIES_CACNEA) { Ability(ABILITY_SAND_VEIL); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SANDSTORM); }
@ -19,7 +19,7 @@ SINGLE_BATTLE_TEST("Sand Veil increases evasion during sandstorm")
PASSES_RANDOMLY(4, 5, RNG_ACCURACY);
GIVEN {
ASSUME(gBattleMoves[MOVE_POUND].accuracy == 100);
PLAYER(SPECIES_SANDSHREW) { Ability(ABILITY_SAND_VEIL); };
PLAYER(SPECIES_SANDSHREW) { Ability(ABILITY_SAND_VEIL); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SANDSTORM); }

View File

@ -15,7 +15,7 @@ SINGLE_BATTLE_TEST("Schooling switches Level 20+ Wishiwashi's form when HP is 25
Level(level);
HP(GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP) / 2);
Ability(ABILITY_SCHOOLING);
};
}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_SUPER_FANG); }
@ -55,7 +55,7 @@ SINGLE_BATTLE_TEST("Schooling switches Level 20+ Wishiwashi's form when HP is ov
Level(level);
HP(GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP) / (overQuarterHP ? 2 : 4));
Ability(ABILITY_SCHOOLING);
};
}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_CELEBRATE); }
@ -89,7 +89,7 @@ SINGLE_BATTLE_TEST("Schooling switches Level 20+ Wishiwashi's form when HP is he
Level(level);
HP(GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP) / 4);
Ability(ABILITY_SCHOOLING);
};
}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_HEAL_PULSE); }

View File

@ -5,7 +5,7 @@ SINGLE_BATTLE_TEST("Snow Cloak prevents damage from hail")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_GLACEON) { Ability(ABILITY_SNOW_CLOAK); };
OPPONENT(SPECIES_GLACEON) { Ability(ABILITY_SNOW_CLOAK); }
} WHEN {
TURN { MOVE(player, MOVE_HAIL); MOVE(opponent, MOVE_SKILL_SWAP); }
} SCENE {
@ -18,7 +18,7 @@ SINGLE_BATTLE_TEST("Snow Cloak increases evasion during hail")
PASSES_RANDOMLY(4, 5, RNG_ACCURACY);
GIVEN {
ASSUME(gBattleMoves[MOVE_POUND].accuracy == 100);
PLAYER(SPECIES_GLACEON) { Ability(ABILITY_SNOW_CLOAK); };
PLAYER(SPECIES_GLACEON) { Ability(ABILITY_SNOW_CLOAK); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_HAIL); }

View File

@ -8,7 +8,7 @@ SINGLE_BATTLE_TEST("Snow Warning summons snow")
#endif
{
GIVEN {
PLAYER(SPECIES_ABOMASNOW) { Ability(ABILITY_SNOW_WARNING); };
PLAYER(SPECIES_ABOMASNOW) { Ability(ABILITY_SNOW_WARNING); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {}

View File

@ -4,8 +4,8 @@
SINGLE_BATTLE_TEST("Speed Boost gradually boosts Speed")
{
GIVEN {
PLAYER(SPECIES_TORCHIC) { Ability(ABILITY_SPEED_BOOST); Speed(99); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(100); };
PLAYER(SPECIES_TORCHIC) { Ability(ABILITY_SPEED_BOOST); Speed(99); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(100); }
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_CELEBRATE); }
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_CELEBRATE); }

View File

@ -6,7 +6,7 @@ SINGLE_BATTLE_TEST("Stench has a 10% chance to flinch")
PASSES_RANDOMLY(1, 10, RNG_STENCH);
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].power > 0);
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_STENCH); };
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_STENCH); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); }
@ -23,7 +23,7 @@ SINGLE_BATTLE_TEST("Stench does not stack with King's Rock")
ASSUME(gItems[ITEM_KINGS_ROCK].holdEffect == HOLD_EFFECT_FLINCH);
ASSUME(gBattleMoves[MOVE_TACKLE].power > 0);
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_STENCH); Item(ITEM_KINGS_ROCK); };
PLAYER(SPECIES_GRIMER) { Ability(ABILITY_STENCH); Item(ITEM_KINGS_ROCK); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); }

View File

@ -1,19 +1,17 @@
#include "global.h"
#include "test_battle.h"
#define TEST_MAX_HP (100)
SINGLE_BATTLE_TEST("Volt Absorb heals 25% when hit by electric type moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_THUNDER_SHOCK].type == TYPE_ELECTRIC);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_THUNDER_SHOCK); }
} SCENE {
ABILITY_POPUP(player, ABILITY_VOLT_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Jolteon restored HP using its Volt Absorb!");
}
}
@ -22,7 +20,7 @@ SINGLE_BATTLE_TEST("Volt Absorb does not activate if protected")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_THUNDER_SHOCK].type == TYPE_ELECTRIC);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_THUNDER_SHOCK); }
@ -36,13 +34,13 @@ SINGLE_BATTLE_TEST("Volt Absorb activates on status moves")
GIVEN {
ASSUME(gBattleMoves[MOVE_THUNDER_WAVE].type == TYPE_ELECTRIC);
ASSUME(gBattleMoves[MOVE_THUNDER_WAVE].split == SPLIT_STATUS);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_THUNDER_WAVE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_VOLT_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Jolteon restored HP using its Volt Absorb!");
}
}
@ -52,13 +50,13 @@ SINGLE_BATTLE_TEST("Volt Absorb is only triggered once on multi strike moves")
GIVEN {
ASSUME(gBattleMoves[MOVE_FURY_SWIPES].type == TYPE_NORMAL);
ASSUME(gBattleMoves[MOVE_FURY_SWIPES].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
OPPONENT(SPECIES_GRAVELER_ALOLAN) { Ability(ABILITY_GALVANIZE); };
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_GRAVELER_ALOLAN) { Ability(ABILITY_GALVANIZE); }
} WHEN {
TURN { MOVE(opponent, MOVE_FURY_SWIPES); }
} SCENE {
ABILITY_POPUP(player, ABILITY_VOLT_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Jolteon restored HP using its Volt Absorb!");
}
}
@ -69,7 +67,7 @@ DOUBLE_BATTLE_TEST("Volt Absorb does not stop Electric Typed Explosion from dama
GIVEN {
ASSUME(gBattleMoves[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION);
ASSUME(gBattleMoves[MOVE_EXPLOSION].type == TYPE_NORMAL);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(TEST_MAX_HP); }
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(100); }
PLAYER(SPECIES_ABRA);
OPPONENT(SPECIES_GRAVELER_ALOLAN) { Ability(ABILITY_GALVANIZE); }
OPPONENT(SPECIES_WYNAUT);
@ -77,7 +75,7 @@ DOUBLE_BATTLE_TEST("Volt Absorb does not stop Electric Typed Explosion from dama
TURN { MOVE(opponentLeft, MOVE_EXPLOSION); }
} SCENE {
ABILITY_POPUP(playerLeft, ABILITY_VOLT_ABSORB);
HP_BAR(playerLeft, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(playerLeft, damage: -25);
MESSAGE("Jolteon restored HP using its Volt Absorb!");
HP_BAR(playerRight, captureDamage: &damage1);
HP_BAR(opponentRight, captureDamage: &damage2);
@ -91,13 +89,13 @@ SINGLE_BATTLE_TEST("Volt Absorb prevents Cell Battery from activating")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_THUNDER_SHOCK].type == TYPE_ELECTRIC);
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(TEST_MAX_HP); Item(ITEM_CELL_BATTERY); };
PLAYER(SPECIES_JOLTEON) { Ability(ABILITY_VOLT_ABSORB); HP(1); MaxHP(100); Item(ITEM_CELL_BATTERY); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_THUNDER_SHOCK); }
} SCENE {
ABILITY_POPUP(player, ABILITY_VOLT_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Jolteon restored HP using its Volt Absorb!");
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);

View File

@ -1,19 +1,17 @@
#include "global.h"
#include "test_battle.h"
#define TEST_MAX_HP (100)
SINGLE_BATTLE_TEST("Water Absorb heals 25% when hit by water type moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BUBBLE].type == TYPE_WATER);
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_BUBBLE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_WATER_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Poliwag restored HP using its Water Absorb!");
}
}
@ -22,7 +20,7 @@ SINGLE_BATTLE_TEST("Water Absorb does not activate if protected")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BUBBLE].type == TYPE_WATER);
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_BUBBLE); }
@ -36,13 +34,13 @@ SINGLE_BATTLE_TEST("Water Absorb activates on status moves")
GIVEN {
ASSUME(gBattleMoves[MOVE_SOAK].type == TYPE_WATER);
ASSUME(gBattleMoves[MOVE_SOAK].split == SPLIT_STATUS);
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SOAK); }
} SCENE {
ABILITY_POPUP(player, ABILITY_WATER_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Poliwag restored HP using its Water Absorb!");
}
}
@ -52,13 +50,13 @@ SINGLE_BATTLE_TEST("Water Absorb is only triggered once on multi strike moves")
GIVEN {
ASSUME(gBattleMoves[MOVE_WATER_SHURIKEN].type == TYPE_WATER);
ASSUME(gBattleMoves[MOVE_WATER_SHURIKEN].effect == EFFECT_MULTI_HIT);
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(TEST_MAX_HP); };
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_WATER_SHURIKEN); }
} SCENE {
ABILITY_POPUP(player, ABILITY_WATER_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Poliwag restored HP using its Water Absorb!");
}
}
@ -70,13 +68,13 @@ SINGLE_BATTLE_TEST("Water Absorb prevents Absorb Bulb and Luminous Moss from act
PARAMETRIZE { item = ITEM_LUMINOUS_MOSS; }
GIVEN {
ASSUME(gBattleMoves[MOVE_BUBBLE].type == TYPE_WATER);
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(TEST_MAX_HP); Item(item); };
PLAYER(SPECIES_POLIWAG) { Ability(ABILITY_WATER_ABSORB); HP(1); MaxHP(100); Item(item); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_BUBBLE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_WATER_ABSORB);
HP_BAR(player, hp: TEST_MAX_HP / 4 + 1);
HP_BAR(player, damage: -25);
MESSAGE("Poliwag restored HP using its Water Absorb!");
NONE_OF {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player);

View File

@ -15,7 +15,7 @@ SINGLE_BATTLE_TEST("Zen Mode switches Darmanitan's form when HP is half or less
{
Ability(ABILITY_ZEN_MODE);
HP((GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP) / 2) + 1);
};
}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_TACKLE); }
@ -45,7 +45,7 @@ SINGLE_BATTLE_TEST("Zen Mode switches Darmanitan's form when HP is half or less
{
Ability(ABILITY_ZEN_MODE);
HP(GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP) / 2);
};
}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_CELEBRATE); }
@ -74,7 +74,7 @@ SINGLE_BATTLE_TEST("Zen Mode switches Darmanitan's form when HP is healed above
{
Ability(ABILITY_ZEN_MODE);
HP(GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP) / 2);
};
}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_HEAL_PULSE); }

View File

@ -21,7 +21,7 @@ SINGLE_BATTLE_TEST("Zacian changes into its Crowned Form when holding the Rusted
PARAMETRIZE { item = ITEM_RUSTED_SWORD; }
GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE);
PLAYER(SPECIES_ZACIAN) { Item(item); };
PLAYER(SPECIES_ZACIAN) { Item(item); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
@ -37,7 +37,7 @@ SINGLE_BATTLE_TEST("Zacian's Iron Head becomes Behemoth Blade upon form change")
{
GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE);
PLAYER(SPECIES_ZACIAN) { Item(ITEM_RUSTED_SWORD); Moves(MOVE_IRON_HEAD, MOVE_CELEBRATE); };
PLAYER(SPECIES_ZACIAN) { Item(ITEM_RUSTED_SWORD); Moves(MOVE_IRON_HEAD, MOVE_CELEBRATE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
@ -54,7 +54,7 @@ SINGLE_BATTLE_TEST("Zamazenta changes into its Crowned Form when holding the Rus
PARAMETRIZE { item = ITEM_RUSTED_SHIELD; }
GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE);
PLAYER(SPECIES_ZAMAZENTA) { Item(item); };
PLAYER(SPECIES_ZAMAZENTA) { Item(item); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
@ -70,7 +70,7 @@ SINGLE_BATTLE_TEST("Zamazenta's Iron Head becomes Behemoth Bash upon form change
{
GIVEN {
ASSUME(P_GEN_8_POKEMON == TRUE);
PLAYER(SPECIES_ZAMAZENTA) { Item(ITEM_RUSTED_SHIELD); Moves(MOVE_IRON_HEAD, MOVE_CELEBRATE); };
PLAYER(SPECIES_ZAMAZENTA) { Item(ITEM_RUSTED_SHIELD); Moves(MOVE_IRON_HEAD, MOVE_CELEBRATE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
@ -105,11 +105,11 @@ SINGLE_BATTLE_TEST("Aegislash reverts to Shield Form upon fainting")
{
GIVEN {
ASSUME(P_GEN_6_POKEMON == TRUE);
PLAYER(SPECIES_AEGISLASH) { HP(1); };
PLAYER(SPECIES_AEGISLASH) { HP(1); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_GUST); SEND_OUT(player, 1);}
TURN { MOVE(opponent, MOVE_GUST); SEND_OUT(player, 1); }
} SCENE {
MESSAGE("Foe Wobbuffet used Gust!");
MESSAGE("Aegislash fainted!");

View File

@ -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!");
}
}

View File

@ -62,7 +62,7 @@ SINGLE_BATTLE_TEST("Berserk Gene does not confuse a Pokemon with Own Tempo but s
PARAMETRIZE { useItem = FALSE; }
PARAMETRIZE { useItem = TRUE; }
GIVEN {
PLAYER(SPECIES_SLOWBRO) { Ability(ABILITY_OWN_TEMPO); if (useItem) Item(ITEM_BERSERK_GENE); };
PLAYER(SPECIES_SLOWBRO) { Ability(ABILITY_OWN_TEMPO); if (useItem) Item(ITEM_BERSERK_GENE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -77,10 +77,7 @@ SINGLE_BATTLE_TEST("Berserk Gene does not confuse a Pokemon with Own Tempo but s
MESSAGE("Slowbro's Own Tempo prevents confusion!");
}
HP_BAR(opponent, captureDamage: &results[i].damage);
NONE_OF
{
MESSAGE("Slowbro became confused!");
}
NOT MESSAGE("Slowbro became confused!");
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage);
}
@ -90,7 +87,7 @@ SINGLE_BATTLE_TEST("Berserk Gene does not confuse on Misty Terrain but still rai
{
GIVEN {
ASSUME(P_GEN_7_POKEMON == TRUE);
PLAYER(SPECIES_TAPU_FINI) { Ability(ABILITY_MISTY_SURGE); Item(ITEM_BERSERK_GENE); };
PLAYER(SPECIES_TAPU_FINI) { Ability(ABILITY_MISTY_SURGE); Item(ITEM_BERSERK_GENE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -99,10 +96,7 @@ SINGLE_BATTLE_TEST("Berserk Gene does not confuse on Misty Terrain but still rai
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Using Berserk Gene, the Attack of Tapu Fini sharply rose!");
NONE_OF
{
MESSAGE("Tapu Fini became confused!");
}
NOT MESSAGE("Tapu Fini became confused!");
}
}
@ -110,7 +104,7 @@ SINGLE_BATTLE_TEST("Berserk Gene does not confuse when Safeguard is active")
{
GIVEN {
PLAYER(SPECIES_WYNAUT);
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); };
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_SAFEGUARD); }
@ -119,17 +113,14 @@ SINGLE_BATTLE_TEST("Berserk Gene does not confuse when Safeguard is active")
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Using Berserk Gene, the Attack of Wobbuffet sharply rose!");
MESSAGE("Wobbuffet's party is protected by SAFEGUARD!");
NONE_OF
{
MESSAGE("Wobbuffet became confused!");
}
NOT MESSAGE("Wobbuffet became confused!");
}
}
SINGLE_BATTLE_TEST("Berserk Gene causes confusion for more than 5 turns") // how else would be check for infinite?
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); };
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {}
@ -139,17 +130,14 @@ SINGLE_BATTLE_TEST("Berserk Gene causes confusion for more than 5 turns") // how
TURN {}
TURN {}
} SCENE {
NONE_OF
{
MESSAGE("Wobbuffet snapped out of confusion!");
}
NOT MESSAGE("Wobbuffet snapped out of confusion!");
}
}
SINGLE_BATTLE_TEST("Berserk Gene causes infinite confusion") // check if bit is set
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); };
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {}
@ -165,7 +153,7 @@ SINGLE_BATTLE_TEST("Berserk Gene causes confusion timer to not tick down", u32 s
PARAMETRIZE { turns = 1; }
PARAMETRIZE { turns = 2; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); };
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_BERSERK_GENE); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
u32 count;

View File

@ -10,8 +10,8 @@ SINGLE_BATTLE_TEST("Eject Button is not triggered when there is nothing to switc
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_WOBBUFFET) { HP(0); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WOBBUFFET) { HP(0); }
} WHEN {
TURN {
MOVE(player, MOVE_QUICK_ATTACK);
@ -30,8 +30,8 @@ SINGLE_BATTLE_TEST("Eject Button is not triggered when there is nothing to switc
SINGLE_BATTLE_TEST("Eject Button is not activated by a Sheer Force boosted move")
{
GIVEN {
PLAYER(SPECIES_NIDOKING) { Ability(ABILITY_SHEER_FORCE); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
PLAYER(SPECIES_NIDOKING) { Ability(ABILITY_SHEER_FORCE); }
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -52,7 +52,7 @@ SINGLE_BATTLE_TEST("Eject Button will not activate under Substitute")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_RAICHU) { Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_RAICHU) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -74,8 +74,8 @@ SINGLE_BATTLE_TEST("Eject Button will not activate under Substitute")
SINGLE_BATTLE_TEST("Eject Button is not blocked by trapping abilities or moves")
{
GIVEN {
PLAYER(SPECIES_DUGTRIO) { Ability(ABILITY_ARENA_TRAP); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
PLAYER(SPECIES_DUGTRIO) { Ability(ABILITY_ARENA_TRAP); }
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -94,7 +94,7 @@ SINGLE_BATTLE_TEST("Eject Button is not triggered after the mon loses Eject Butt
{
GIVEN {
PLAYER(SPECIES_RAICHU);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -114,9 +114,9 @@ SINGLE_BATTLE_TEST("Eject Button is not triggered after the mon loses Eject Butt
SINGLE_BATTLE_TEST("Eject Button is not triggered after given to player by Picketpocket")
{
GIVEN {
PLAYER(SPECIES_REGIELEKI) { Item(ITEM_EJECT_BUTTON); };
PLAYER(SPECIES_REGIELEKI) { Item(ITEM_EJECT_BUTTON); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SNEASEL) { Ability(ABILITY_PICKPOCKET); };
OPPONENT(SPECIES_SNEASEL) { Ability(ABILITY_PICKPOCKET); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {
@ -135,7 +135,7 @@ SINGLE_BATTLE_TEST("Eject Button has no chance to activate after Dragon Tail")
{
GIVEN {
PLAYER(SPECIES_KOMMO_O);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_CHANSEY);
} WHEN {
TURN {
@ -157,7 +157,7 @@ SINGLE_BATTLE_TEST("Eject Button prevents Volt Switch / U-Turn from activating")
GIVEN {
PLAYER(SPECIES_MANECTRIC);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WYNAUT);
} WHEN {
TURN {
@ -174,7 +174,7 @@ SINGLE_BATTLE_TEST("Eject Button is activated before Emergency Exit")
{
GIVEN {
PLAYER(SPECIES_LATIAS);
OPPONENT(SPECIES_GOLISOPOD) { Ability(ABILITY_EMERGENCY_EXIT); Item(ITEM_EJECT_BUTTON); };
OPPONENT(SPECIES_GOLISOPOD) { Ability(ABILITY_EMERGENCY_EXIT); Item(ITEM_EJECT_BUTTON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN {

View File

@ -4,7 +4,7 @@
ASSUMPTIONS
{
gItems[ITEM_LEFTOVERS].holdEffect == HOLD_EFFECT_LEFTOVERS;
};
}
SINGLE_BATTLE_TEST("Leftovers recovers 1/16th HP at end of turn")
{

View File

@ -12,7 +12,7 @@ SINGLE_BATTLE_TEST("Full Restore restores a battler's HP and cures any primary s
PARAMETRIZE{ status = STATUS1_SLEEP; }
GIVEN {
ASSUME(gItems[ITEM_FULL_RESTORE].battleUsage == EFFECT_ITEM_HEAL_AND_CURE_STATUS);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); Status1(status); };
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); Status1(status); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN{ USE_ITEM(player, ITEM_FULL_RESTORE, partyIndex: 0); }
@ -28,7 +28,7 @@ SINGLE_BATTLE_TEST("Full Restore restores a battler's HP and cures confusion")
{
GIVEN {
ASSUME(gItems[ITEM_FULL_RESTORE].battleUsage == EFFECT_ITEM_HEAL_AND_CURE_STATUS);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300);};
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN{ MOVE(opponent, MOVE_CONFUSE_RAY); }

View File

@ -100,16 +100,16 @@ SINGLE_BATTLE_TEST("X Speed sharply raises battler's Speed stat", s16 damage)
PARAMETRIZE { useItem = TRUE; }
GIVEN {
ASSUME(gItems[ITEM_X_SPEED].battleUsage == EFFECT_ITEM_INCREASE_STAT);
if (B_X_ITEMS_BUFF >= GEN_7)
{
PLAYER(SPECIES_WOBBUFFET) { Speed(3); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(4); };
}
else
{
PLAYER(SPECIES_WOBBUFFET) { Speed(4); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); };
}
if (B_X_ITEMS_BUFF >= GEN_7)
{
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(4); }
}
else
{
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
}
} WHEN {
if (useItem) TURN { USE_ITEM(player, ITEM_X_SPEED); }
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_TACKLE); }
@ -118,7 +118,8 @@ SINGLE_BATTLE_TEST("X Speed sharply raises battler's Speed stat", s16 damage)
{
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("Foe Wobbuffet used Tackle!");
} else
}
else
{
MESSAGE("Foe Wobbuffet used Tackle!");
MESSAGE("Wobbuffet used Tackle!");
@ -234,8 +235,8 @@ SINGLE_BATTLE_TEST("Max Mushrooms raises battler's Speed stat", s16 damage)
PARAMETRIZE { useItem = TRUE; }
GIVEN {
ASSUME(gItems[ITEM_MAX_MUSHROOMS].battleUsage == EFFECT_ITEM_INCREASE_ALL_STATS);
PLAYER(SPECIES_WOBBUFFET) { Speed(4); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); };
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
} WHEN {
if (useItem) TURN { USE_ITEM(player, ITEM_MAX_MUSHROOMS); }
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_TACKLE); }
@ -244,7 +245,8 @@ SINGLE_BATTLE_TEST("Max Mushrooms raises battler's Speed stat", s16 damage)
{
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("Foe Wobbuffet used Tackle!");
} else
}
else
{
MESSAGE("Foe Wobbuffet used Tackle!");
MESSAGE("Wobbuffet used Tackle!");

View File

@ -1,186 +1,48 @@
#include "global.h"
#include "test_battle.h"
#define TEST_HP 1
#define MAX_HP 400
SINGLE_BATTLE_TEST("Potion restores a battler's HP by 20")
SINGLE_BATTLE_TEST("Items can restore a battler's HP by a fixed amount")
{
u32 item, hp;
PARAMETRIZE { item = ITEM_POTION; hp = 20; }
PARAMETRIZE { item = ITEM_SUPER_POTION; hp = I_HEALTH_RECOVERY >= GEN_7 ? 60 : 50; }
PARAMETRIZE { item = ITEM_HYPER_POTION; hp = I_HEALTH_RECOVERY >= GEN_7 ? 120 : 200; }
PARAMETRIZE { item = ITEM_FRESH_WATER; hp = I_HEALTH_RECOVERY >= GEN_7 ? 30 : 50; }
PARAMETRIZE { item = ITEM_SODA_POP; hp = I_HEALTH_RECOVERY >= GEN_7 ? 50 : 60; }
PARAMETRIZE { item = ITEM_LEMONADE; hp = I_HEALTH_RECOVERY >= GEN_7 ? 70 : 80; }
PARAMETRIZE { item = ITEM_MOOMOO_MILK; hp = 100; }
PARAMETRIZE { item = ITEM_ENERGY_POWDER; hp = I_HEALTH_RECOVERY >= GEN_7 ? 60 : 50; }
PARAMETRIZE { item = ITEM_ENERGY_ROOT; hp = I_HEALTH_RECOVERY >= GEN_7 ? 120 : 200; }
PARAMETRIZE { item = ITEM_SWEET_HEART; hp = 20; }
PARAMETRIZE { item = ITEM_ORAN_BERRY; hp = 10; }
#if I_SITRUS_BERRY_HEAL < GEN_4
PARAMETRIZE { item = ITEM_SITRUS_BERRY; hp = 30; }
#endif
GIVEN {
ASSUME(gItems[ITEM_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
ASSUME(gItems[item].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_POTION, partyIndex: 0); }
TURN { USE_ITEM(player, item, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 20);
HP_BAR(player, damage: -hp);
}
}
SINGLE_BATTLE_TEST("Super Potion restores a battler's HP by 60")
SINGLE_BATTLE_TEST("Items can restore a battler's HP by a percentage")
{
u32 item, percentage;
PARAMETRIZE { item = ITEM_MAX_POTION; percentage = 100; }
#if I_SITRUS_BERRY_HEAL >= GEN_4
PARAMETRIZE { item = ITEM_SITRUS_BERRY; percentage = 25; }
#endif
GIVEN {
ASSUME(gItems[ITEM_SUPER_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
ASSUME(gItems[item].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_SUPER_POTION, partyIndex: 0); }
TURN { USE_ITEM(player, item, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 60);
HP_BAR(player, damage: -min(399, 400 * percentage / 100));
}
}
SINGLE_BATTLE_TEST("Hyper Potion restores a battler's HP by 120")
{
GIVEN {
ASSUME(gItems[ITEM_HYPER_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_HYPER_POTION, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 120);
}
}
SINGLE_BATTLE_TEST("Max Potion restores a battler's HP fully")
{
GIVEN {
ASSUME(gItems[ITEM_MAX_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_MAX_POTION, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: MAX_HP);
}
}
SINGLE_BATTLE_TEST("Fresh Water restores a battler's HP by 30")
{
GIVEN {
ASSUME(gItems[ITEM_FRESH_WATER].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_FRESH_WATER, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 30);
}
}
SINGLE_BATTLE_TEST("Soda Pop restores a battler's HP by 50")
{
GIVEN {
ASSUME(gItems[ITEM_SODA_POP].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_SODA_POP, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 50);
}
}
SINGLE_BATTLE_TEST("Lemonade restores a battler's HP by 70")
{
GIVEN {
ASSUME(gItems[ITEM_LEMONADE].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_LEMONADE, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 70);
}
}
SINGLE_BATTLE_TEST("Moomoo Milk restores a battler's HP by 100")
{
GIVEN {
ASSUME(gItems[ITEM_MOOMOO_MILK].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_MOOMOO_MILK, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 100);
}
}
SINGLE_BATTLE_TEST("Energy Powder restores a battler's HP by 60(50)")
{
GIVEN {
ASSUME(gItems[ITEM_ENERGY_POWDER].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_ENERGY_POWDER, partyIndex: 0); }
} SCENE {
if (I_HEALTH_RECOVERY >= GEN_7)
HP_BAR(player, hp: TEST_HP + 60);
else
HP_BAR(player, hp: TEST_HP + 50);
}
}
SINGLE_BATTLE_TEST("Energy Root restores a battler's HP by 120(200)")
{
GIVEN {
ASSUME(gItems[ITEM_ENERGY_ROOT].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_ENERGY_ROOT, partyIndex: 0); }
} SCENE {
if (I_HEALTH_RECOVERY >= GEN_7)
HP_BAR(player, hp: TEST_HP + 120);
else
HP_BAR(player, hp: TEST_HP + 200);
}
}
SINGLE_BATTLE_TEST("Sweet Heart restores a battler's HP by 20")
{
GIVEN {
ASSUME(gItems[ITEM_SWEET_HEART].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_SWEET_HEART, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 20);
}
}
SINGLE_BATTLE_TEST("Oran Berry restores a battler's HP by 10")
{
GIVEN {
ASSUME(gItems[ITEM_ORAN_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_ORAN_BERRY, partyIndex: 0); }
} SCENE {
HP_BAR(player, hp: TEST_HP + 10);
}
}
SINGLE_BATTLE_TEST("Sitrus Berry restores a battler's HP by 25% of its max HP(30HP flat)")
{
GIVEN {
ASSUME(gItems[ITEM_SITRUS_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { USE_ITEM(player, ITEM_SITRUS_BERRY, partyIndex: 0); }
} SCENE {
if (I_SITRUS_BERRY_HEAL >= GEN_4)
HP_BAR(player, hp: TEST_HP + MAX_HP * 0.25);
else
HP_BAR(player, hp: TEST_HP + 30);
}
}
#undef TEST_HP
#undef MAX_HP

View File

@ -1,13 +1,11 @@
#include "global.h"
#include "test_battle.h"
#define MAX_HP 200
SINGLE_BATTLE_TEST("Revive restores a fainted battler's HP to half")
{
GIVEN {
ASSUME(gItems[ITEM_REVIVE].battleUsage == EFFECT_ITEM_REVIVE);
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(MAX_HP); }
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(200); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -17,7 +15,7 @@ SINGLE_BATTLE_TEST("Revive restores a fainted battler's HP to half")
} SCENE {
MESSAGE("Wynaut had its HP restored!");
} THEN {
EXPECT_EQ(player->hp, MAX_HP/2);
EXPECT_EQ(player->hp, 100);
}
}
@ -25,7 +23,7 @@ SINGLE_BATTLE_TEST("Max Revive restores a fainted battler's HP fully")
{
GIVEN {
ASSUME(gItems[ITEM_MAX_REVIVE].battleUsage == EFFECT_ITEM_REVIVE);
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(MAX_HP); }
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(200); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -35,7 +33,7 @@ SINGLE_BATTLE_TEST("Max Revive restores a fainted battler's HP fully")
} SCENE {
MESSAGE("Wynaut had its HP restored!");
} THEN {
EXPECT_EQ(player->hp, MAX_HP);
EXPECT_EQ(player->hp, 200);
}
}
@ -43,7 +41,7 @@ SINGLE_BATTLE_TEST("Revival Herb restores a fainted battler's HP fully")
{
GIVEN {
ASSUME(gItems[ITEM_REVIVAL_HERB].battleUsage == EFFECT_ITEM_REVIVE);
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(MAX_HP); }
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(200); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -53,7 +51,7 @@ SINGLE_BATTLE_TEST("Revival Herb restores a fainted battler's HP fully")
} SCENE {
MESSAGE("Wynaut had its HP restored!");
} THEN {
EXPECT_EQ(player->hp, MAX_HP);
EXPECT_EQ(player->hp, 200);
}
}
@ -61,7 +59,7 @@ SINGLE_BATTLE_TEST("Max Honey restores a fainted battler's HP fully")
{
GIVEN {
ASSUME(gItems[ITEM_MAX_HONEY].battleUsage == EFFECT_ITEM_REVIVE);
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(MAX_HP); }
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(200); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -71,8 +69,6 @@ SINGLE_BATTLE_TEST("Max Honey restores a fainted battler's HP fully")
} SCENE {
MESSAGE("Wynaut had its HP restored!");
} THEN {
EXPECT_EQ(player->hp, MAX_HP);
EXPECT_EQ(player->hp, 200);
}
}
#undef MAX_HP

View File

@ -21,9 +21,9 @@ DOUBLE_BATTLE_TEST("Mega Evolution's order is determined by Speed - opponent fas
{
GIVEN {
PLAYER(SPECIES_VENUSAUR) { Item(ITEM_VENUSAURITE); Speed(1); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3);}
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(3);}
OPPONENT(SPECIES_WOBBUFFET) { Speed(4);}
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(4); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_CELEBRATE, megaEvolve: TRUE); MOVE(playerLeft, MOVE_CELEBRATE, megaEvolve: TRUE); }
} SCENE {
@ -40,9 +40,9 @@ DOUBLE_BATTLE_TEST("Mega Evolution's order is determined by Speed - player faste
{
GIVEN {
PLAYER(SPECIES_VENUSAUR) { Item(ITEM_VENUSAURITE); Speed(5); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3);}
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(2);}
OPPONENT(SPECIES_WOBBUFFET) { Speed(4);}
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(4); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_CELEBRATE, megaEvolve: TRUE); MOVE(playerLeft, MOVE_CELEBRATE, megaEvolve: TRUE); }
} SCENE {
@ -110,13 +110,13 @@ DOUBLE_BATTLE_TEST("Mega Evolution happens after switching, but before Focus Pun
GIVEN {
ASSUME(gBattleMoves[MOVE_FOCUS_PUNCH].effect == EFFECT_FOCUS_PUNCH);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_VENUSAUR) { Item(ITEM_VENUSAURITE);}
PLAYER(SPECIES_VENUSAUR) { Item(ITEM_VENUSAURITE); }
OPPONENT(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(opponentRight, 2); MOVE(playerRight, MOVE_FOCUS_PUNCH, megaEvolve: TRUE, target:opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target:opponentLeft); }
TURN {};
TURN { SWITCH(opponentRight, 2); MOVE(playerRight, MOVE_FOCUS_PUNCH, megaEvolve: TRUE, target: opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target: opponentLeft); }
TURN {}
} SCENE {
MESSAGE("2 withdrew Wobbuffet!");
MESSAGE("2 sent out Wobbuffet!");
@ -136,8 +136,8 @@ DOUBLE_BATTLE_TEST("Mega Evolution happens after switching, but before Focus Pun
SINGLE_BATTLE_TEST("Regular Mega Evolution and Fervent Wish Mega Evolution can happen on the same turn")
{
GIVEN {
PLAYER(SPECIES_RAYQUAZA) { Moves(MOVE_DRAGON_ASCENT, MOVE_CELEBRATE); Speed(3);}
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(2);}
PLAYER(SPECIES_RAYQUAZA) { Moves(MOVE_DRAGON_ASCENT, MOVE_CELEBRATE); Speed(3); }
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(2); }
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE, megaEvolve: TRUE); MOVE(opponent, MOVE_CELEBRATE, megaEvolve: TRUE); }
} SCENE {

View File

@ -9,8 +9,8 @@ ASSUMPTIONS
SINGLE_BATTLE_TEST("Assist fails if there are no valid moves to choose from")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Moves(MOVE_ASSIST, MOVE_CELEBRATE, MOVE_METRONOME, MOVE_ME_FIRST); }
PLAYER(SPECIES_WOBBUFFET) {Moves(MOVE_ASSIST, MOVE_ENDURE, MOVE_DRAGON_TAIL, MOVE_SPOTLIGHT); }
PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_ASSIST, MOVE_CELEBRATE, MOVE_METRONOME, MOVE_ME_FIRST); }
PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_ASSIST, MOVE_ENDURE, MOVE_DRAGON_TAIL, MOVE_SPOTLIGHT); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_ASSIST); }

View File

@ -38,10 +38,10 @@ DOUBLE_BATTLE_TEST("Howl raises user's and partner's Attack", s16 damageLeft, s1
PARAMETRIZE { raiseAttack = TRUE; }
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
PLAYER(SPECIES_WOBBUFFET) { Speed(15); };
PLAYER(SPECIES_WYNAUT) { Speed(10); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(13); };
OPPONENT(SPECIES_WYNAUT) { Speed(12); };
PLAYER(SPECIES_WOBBUFFET) { Speed(15); }
PLAYER(SPECIES_WYNAUT) { Speed(10); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(13); }
OPPONENT(SPECIES_WYNAUT) { Speed(12); }
} WHEN {
if (raiseAttack) TURN { MOVE(playerLeft, MOVE_HOWL); }
TURN { MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft); }

View File

@ -30,7 +30,7 @@ SINGLE_BATTLE_TEST("Barb Barrage's power doubles if the target is poisoned/badly
PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) {Status1(status1);}
OPPONENT(SPECIES_WOBBUFFET) { Status1(status1); }
} WHEN {
TURN { MOVE(player, MOVE_BARB_BARRAGE); }
} SCENE {

View File

@ -10,12 +10,12 @@ DOUBLE_BATTLE_TEST("Beak Blast's charging message is shown before other moves ar
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BEAK_BLAST].priority < 0);
PLAYER(SPECIES_WYNAUT) {Speed(10); }
PLAYER(SPECIES_WOBBUFFET) {Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(3); }
PLAYER(SPECIES_WYNAUT) { Speed(10); }
PLAYER(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(3); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_BEAK_BLAST, target:opponentLeft); }
TURN { MOVE(playerLeft, MOVE_BEAK_BLAST, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_BEAK_BLAST_SETUP, playerLeft);
MESSAGE("Wynaut started heating up its beak!");
@ -38,12 +38,12 @@ DOUBLE_BATTLE_TEST("Beak Blast burns all who make contact with the pokemon")
GIVEN {
ASSUME(gBattleMoves[MOVE_BEAK_BLAST].priority < 0);
ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT);
PLAYER(SPECIES_WYNAUT) {Speed(10); }
PLAYER(SPECIES_WOBBUFFET) {Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
PLAYER(SPECIES_WYNAUT) { Speed(10); }
PLAYER(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(opponentRight, MOVE_TACKLE, target:playerLeft); MOVE(playerLeft, MOVE_BEAK_BLAST, target:opponentLeft); }
TURN { MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(opponentRight, MOVE_TACKLE, target: playerLeft); MOVE(playerLeft, MOVE_BEAK_BLAST, target: opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_BEAK_BLAST_SETUP, playerLeft);
MESSAGE("Wynaut started heating up its beak!");

View File

@ -36,8 +36,8 @@ SINGLE_BATTLE_TEST("Defog lowers evasiveness by 1")
SINGLE_BATTLE_TEST("Defog does not lower evasiveness if target behind Substitute")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(4); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(5); }
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
} WHEN {
TURN { MOVE(opponent, MOVE_SUBSTITUTE); MOVE(player, MOVE_DEFOG); }
} SCENE {
@ -58,14 +58,14 @@ DOUBLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes Reflect and Light
PARAMETRIZE { move = MOVE_DEFOG; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(4); }
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_REFLECT); MOVE(opponentRight, MOVE_LIGHT_SCREEN); }
TURN { MOVE(playerLeft, move, target:opponentLeft); }
TURN { MOVE(playerLeft, MOVE_TACKLE, target:opponentLeft); MOVE(playerRight, MOVE_GUST, target:opponentRight); }
TURN { MOVE(playerLeft, move, target: opponentLeft); }
TURN { MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft); MOVE(playerRight, MOVE_GUST, target: opponentRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_REFLECT, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_LIGHT_SCREEN, opponentRight);
@ -93,14 +93,14 @@ DOUBLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes Mist and Safeguard
PARAMETRIZE { move = MOVE_DEFOG; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(4); }
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_MIST); MOVE(opponentRight, MOVE_SAFEGUARD); }
TURN { MOVE(playerLeft, move, target:opponentLeft); }
TURN { MOVE(playerLeft, MOVE_SCREECH, target:opponentLeft); MOVE(playerRight, MOVE_TOXIC, target:opponentRight); }
TURN { MOVE(playerLeft, move, target: opponentLeft); }
TURN { MOVE(playerLeft, MOVE_SCREECH, target: opponentLeft); MOVE(playerRight, MOVE_TOXIC, target: opponentRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIST, opponentLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_SAFEGUARD, opponentRight);
@ -138,14 +138,14 @@ DOUBLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes Stealth Rock and S
PARAMETRIZE { move = MOVE_DEFOG; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(4); }
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_STEALTH_ROCK); MOVE(opponentRight, MOVE_STICKY_WEB); }
TURN { MOVE(playerLeft, move, target:opponentLeft); }
TURN { MOVE(playerLeft, move, target: opponentLeft); }
TURN { SWITCH(playerLeft, 2); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STEALTH_ROCK, opponentLeft);
@ -186,9 +186,9 @@ SINGLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes Spikes from player
PARAMETRIZE { move = MOVE_DEFOG; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(2); }
PLAYER(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(5); }
PLAYER(SPECIES_WOBBUFFET) { Speed(2); }
PLAYER(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
} WHEN {
TURN { MOVE(opponent, MOVE_SPIKES); MOVE(player, move); }
TURN { SWITCH(player, 1); }
@ -226,8 +226,8 @@ SINGLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes terrain")
PARAMETRIZE { move = MOVE_GRASSY_TERRAIN; }
GIVEN {
ASSUME(B_DEFOG_CLEARS_TERRAIN >= GEN_8);
PLAYER(SPECIES_WOBBUFFET) {Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(5); }
PLAYER(SPECIES_WOBBUFFET) { Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
} WHEN {
TURN { MOVE(player, move); MOVE(opponent, MOVE_DEFOG); }
} SCENE {
@ -258,9 +258,9 @@ SINGLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes Toxic Spikes from
PARAMETRIZE { move = MOVE_DEFOG; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
PLAYER(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
} WHEN {
TURN { MOVE(player, MOVE_TOXIC_SPIKES); MOVE(opponent, move); }
TURN { SWITCH(opponent, 1); }
@ -298,14 +298,14 @@ DOUBLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes Aurora Veil from p
GIVEN {
ASSUME(gBattleMoves[MOVE_HAIL].effect == EFFECT_HAIL);
ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE);
PLAYER(SPECIES_GLALIE) {Speed(4); }
PLAYER(SPECIES_GLALIE) {Speed(3); }
OPPONENT(SPECIES_GLALIE) {Speed(2); }
OPPONENT(SPECIES_GLALIE) {Speed(1); }
PLAYER(SPECIES_GLALIE) { Speed(4); }
PLAYER(SPECIES_GLALIE) { Speed(3); }
OPPONENT(SPECIES_GLALIE) { Speed(2); }
OPPONENT(SPECIES_GLALIE) { Speed(1); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_HAIL); MOVE(playerRight, MOVE_AURORA_VEIL); }
TURN { MOVE(opponentLeft, move, target:playerLeft); }
TURN { MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(opponentRight, MOVE_GUST, target:playerRight); }
TURN { MOVE(opponentLeft, move, target: playerLeft); }
TURN { MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(opponentRight, MOVE_GUST, target: playerRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_HAIL, playerLeft);
ANIMATION(ANIM_TYPE_MOVE, MOVE_AURORA_VEIL, playerRight);
@ -330,17 +330,17 @@ DOUBLE_BATTLE_TEST("Defog lowers evasiveness by 1 and removes everything it can"
GIVEN {
ASSUME(gBattleMoves[MOVE_HAIL].effect == EFFECT_HAIL);
ASSUME(gSpeciesInfo[SPECIES_GLALIE].types[0] == TYPE_ICE);
PLAYER(SPECIES_GLALIE) {Speed(4); }
PLAYER(SPECIES_GLALIE) {Speed(3); }
PLAYER(SPECIES_GLALIE) {Speed(12); }
PLAYER(SPECIES_GLALIE) {Speed(3); }
OPPONENT(SPECIES_GLALIE) {Speed(2); }
OPPONENT(SPECIES_GLALIE) {Speed(1); }
OPPONENT(SPECIES_GLALIE) {Speed(1); }
OPPONENT(SPECIES_GLALIE) {Speed(1); }
PLAYER(SPECIES_GLALIE) { Speed(4); }
PLAYER(SPECIES_GLALIE) { Speed(3); }
PLAYER(SPECIES_GLALIE) { Speed(12); }
PLAYER(SPECIES_GLALIE) { Speed(3); }
OPPONENT(SPECIES_GLALIE) { Speed(2); }
OPPONENT(SPECIES_GLALIE) { Speed(1); }
OPPONENT(SPECIES_GLALIE) { Speed(1); }
OPPONENT(SPECIES_GLALIE) { Speed(1); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_STICKY_WEB); MOVE(playerRight, MOVE_SPIKES); MOVE(opponentLeft, MOVE_STICKY_WEB); MOVE(opponentRight, MOVE_SPIKES); }
TURN { SWITCH(playerLeft, 2); SWITCH(playerRight, 3); SWITCH(opponentLeft, 2); SWITCH(opponentRight, 3);}
TURN { SWITCH(playerLeft, 2); SWITCH(playerRight, 3); SWITCH(opponentLeft, 2); SWITCH(opponentRight, 3); }
TURN { MOVE(playerLeft, MOVE_TOXIC_SPIKES); MOVE(playerRight, MOVE_STEALTH_ROCK); MOVE(opponentLeft, MOVE_TOXIC_SPIKES); MOVE(opponentRight, MOVE_STEALTH_ROCK); }
TURN { MOVE(playerLeft, MOVE_HAIL); MOVE(playerRight, MOVE_AURORA_VEIL); MOVE(opponentLeft, MOVE_AURORA_VEIL); MOVE(opponentRight, MOVE_LIGHT_SCREEN); }
TURN { MOVE(playerLeft, MOVE_REFLECT); MOVE(playerRight, MOVE_LIGHT_SCREEN); MOVE(opponentLeft, MOVE_REFLECT); MOVE(opponentRight, MOVE_SAFEGUARD); }

View File

@ -43,7 +43,7 @@ SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze poison/electric types respe
#if B_PARALYZE_ELECTRIC >= GEN_6
PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU; }
#endif // B_PARALYZE_ELECTRIC
PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = MOVE_EFFECT_POISON; species = SPECIES_ARBOK;}
PARAMETRIZE { statusAnim = B_ANIM_STATUS_PSN; rng = MOVE_EFFECT_POISON; species = SPECIES_ARBOK; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(species);
@ -79,7 +79,7 @@ SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze/cause to fall asleep pokemo
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(species) {Ability(ability);}
OPPONENT(species) { Ability(ability); }
} WHEN {
TURN { MOVE(player, MOVE_DIRE_CLAW, WITH_RNG(RNG_DIRE_CLAW, rng)); }
TURN {}
@ -108,7 +108,7 @@ SINGLE_BATTLE_TEST("Dire Claw cannot poison/paralyze/cause to fall asleep a mon
PARAMETRIZE { statusAnim = B_ANIM_STATUS_SLP; rng = MOVE_EFFECT_SLEEP; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_BURN);}
OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_BURN); }
} WHEN {
TURN { MOVE(player, MOVE_DIRE_CLAW, WITH_RNG(RNG_DIRE_CLAW, rng)); }
TURN {}

View File

@ -42,12 +42,12 @@ SINGLE_BATTLE_TEST("Focus Punch activates only if not damaged")
DOUBLE_BATTLE_TEST("Focus Punch activation is based on Speed")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(2) ;}
PLAYER(SPECIES_WYNAUT) {Speed(3) ;}
OPPONENT(SPECIES_WOBBUFFET) {Speed(1) ;}
OPPONENT(SPECIES_WYNAUT) {Speed(5) ;}
PLAYER(SPECIES_WOBBUFFET) { Speed(2); }
PLAYER(SPECIES_WYNAUT) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
OPPONENT(SPECIES_WYNAUT) { Speed(5); }
} WHEN {
TURN { MOVE(opponentRight, MOVE_FOCUS_PUNCH, target:playerLeft); MOVE(playerRight, MOVE_FOCUS_PUNCH, target:opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target:opponentLeft); MOVE(opponentLeft, MOVE_FOCUS_PUNCH, target:playerLeft); }
TURN { MOVE(opponentRight, MOVE_FOCUS_PUNCH, target: playerLeft); MOVE(playerRight, MOVE_FOCUS_PUNCH, target: opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target: opponentLeft); MOVE(opponentLeft, MOVE_FOCUS_PUNCH, target: playerLeft); }
}
SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, opponentRight);

View File

@ -7,14 +7,12 @@ ASSUMPTIONS
ASSUME(gBattleMoves[MOVE_LUNAR_DANCE].effect == EFFECT_HEALING_WISH);
}
#define TEST_MAX_HP (100)
SINGLE_BATTLE_TEST("Healing Wish causes the user to faint and fully heals the replacement")
{
GIVEN {
ASSUME(B_HEALING_WISH_SWITCH >= GEN_5);
PLAYER(SPECIES_GARDEVOIR);
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(TEST_MAX_HP); Status1(STATUS1_POISON); }
PLAYER(SPECIES_WYNAUT) { HP(1); MaxHP(100); Status1(STATUS1_POISON); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_HEALING_WISH); SEND_OUT(player, 1); }
@ -23,7 +21,7 @@ SINGLE_BATTLE_TEST("Healing Wish causes the user to faint and fully heals the re
HP_BAR(player, hp: 0);
MESSAGE("Gardevoir fainted!");
MESSAGE("The healing wish came true for Wynaut!");
HP_BAR(player, hp: TEST_MAX_HP);
HP_BAR(player, hp: 100);
STATUS_ICON(player, none: TRUE);
MESSAGE("Wynaut regained health!");
}
@ -35,7 +33,7 @@ DOUBLE_BATTLE_TEST("Lunar Dance causes the user to faint and fully heals the rep
ASSUME(B_HEALING_WISH_SWITCH >= GEN_5);
PLAYER(SPECIES_GARDEVOIR) { Speed(300); }
PLAYER(SPECIES_WOBBUFFET) { Speed(50); }
PLAYER(SPECIES_WYNAUT) { HP(TEST_MAX_HP - 1); MaxHP(TEST_MAX_HP); Status1(STATUS1_BURN); Speed(50); }
PLAYER(SPECIES_WYNAUT) { HP(99); MaxHP(100); Status1(STATUS1_BURN); Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(50); }
} WHEN {
@ -45,7 +43,7 @@ DOUBLE_BATTLE_TEST("Lunar Dance causes the user to faint and fully heals the rep
HP_BAR(playerLeft, hp: 0);
MESSAGE("Gardevoir fainted!");
MESSAGE("Wynaut became cloaked in mystical moonlight!");
HP_BAR(playerLeft, hp: TEST_MAX_HP);
HP_BAR(playerLeft, hp: 100);
STATUS_ICON(playerLeft, none: TRUE);
MESSAGE("Wynaut regained health!");
}
@ -57,8 +55,8 @@ SINGLE_BATTLE_TEST("Healing Wish effect activates only if the switched pokemon c
ASSUME(B_HEALING_WISH_SWITCH >= GEN_8);
PLAYER(SPECIES_GARDEVOIR) { Speed(300); }
PLAYER(SPECIES_NINJASK) { Speed(400); }
PLAYER(SPECIES_WYNAUT) { HP(TEST_MAX_HP / 2); MaxHP(TEST_MAX_HP); Status1(STATUS1_PARALYSIS); Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(50); }
PLAYER(SPECIES_WYNAUT) { HP(50); MaxHP(100); Status1(STATUS1_PARALYSIS); Speed(50); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(50); }
} WHEN {
TURN { MOVE(player, MOVE_HEALING_WISH); SEND_OUT(player, 1); }
TURN { MOVE(player, MOVE_U_TURN); SEND_OUT(player, 2); }
@ -73,7 +71,7 @@ SINGLE_BATTLE_TEST("Healing Wish effect activates only if the switched pokemon c
ANIMATION(ANIM_TYPE_MOVE, MOVE_U_TURN, player);
MESSAGE("Do it! Wynaut!");
MESSAGE("The healing wish came true for Wynaut!");
HP_BAR(player, hp: TEST_MAX_HP);
HP_BAR(player, hp: 100);
STATUS_ICON(player, none: TRUE);
MESSAGE("Wynaut regained health!");
}

View File

@ -10,8 +10,8 @@ ASSUMPTIONS
SINGLE_BATTLE_TEST("Stone Axe / Ceaseless Edge set up hazards after hitting the target")
{
u16 move;
PARAMETRIZE {move = MOVE_STONE_AXE; }
PARAMETRIZE {move = MOVE_CEASELESS_EDGE; }
PARAMETRIZE { move = MOVE_STONE_AXE; }
PARAMETRIZE { move = MOVE_CEASELESS_EDGE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);

View File

@ -6,17 +6,15 @@ ASSUMPTIONS
ASSUME(gBattleMoves[MOVE_MIND_BLOWN].effect == EFFECT_MIND_BLOWN);
}
#define HP_TEST (400)
SINGLE_BATTLE_TEST("Mind Blown makes the user lose 1/2 of its HP")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(HP_TEST); MaxHP(HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(400); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_MIND_BLOWN); }
} SCENE {
HP_BAR(player, hp: HP_TEST / 2);
HP_BAR(player, damage: 200);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, player);
NOT MESSAGE("Wobbuffet fainted!"); // Wobb had more than 1/2 of its HP, so it can't faint.
}
@ -25,14 +23,14 @@ SINGLE_BATTLE_TEST("Mind Blown makes the user lose 1/2 of its HP")
DOUBLE_BATTLE_TEST("Mind Blown makes the user lose 1/2 of its HP in a double battle")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(HP_TEST); MaxHP(HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(400); MaxHP(400); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_MIND_BLOWN); }
} SCENE {
HP_BAR(playerLeft, hp: HP_TEST / 2);
HP_BAR(playerLeft, damage: 200);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, playerLeft);
NOT MESSAGE("Wobbuffet fainted!"); // Wobb had more than 1/2 of its HP, so it can't faint.
}
@ -41,7 +39,7 @@ DOUBLE_BATTLE_TEST("Mind Blown makes the user lose 1/2 of its HP in a double bat
SINGLE_BATTLE_TEST("Mind Blown causes the user to faint when below 1/2 of its HP")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(HP_TEST / 2); MaxHP(HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(200); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_MIND_BLOWN); }
@ -55,12 +53,12 @@ SINGLE_BATTLE_TEST("Mind Blown causes the user to faint when below 1/2 of its HP
DOUBLE_BATTLE_TEST("Mind Blown causes the user to faint when below 1/2 of its HP in a double battle")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(HP_TEST / 2); MaxHP(HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(200); MaxHP(400); }
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_MIND_BLOWN);}
TURN { MOVE(playerLeft, MOVE_MIND_BLOWN); }
} SCENE {
HP_BAR(playerLeft, hp: 0);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, playerLeft);
@ -71,11 +69,11 @@ DOUBLE_BATTLE_TEST("Mind Blown causes the user to faint when below 1/2 of its HP
SINGLE_BATTLE_TEST("Mind Blown causes the user & the target to faint when below 1/2 of its HP")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(HP_TEST / 2) ; MaxHP(HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(200) ; MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET) { HP(1); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_MIND_BLOWN);}
TURN { MOVE(player, MOVE_MIND_BLOWN); }
} SCENE {
HP_BAR(player, hp: 0);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, player);
@ -88,13 +86,13 @@ SINGLE_BATTLE_TEST("Mind Blown causes the user & the target to faint when below
DOUBLE_BATTLE_TEST("Mind Blown causes everyone to faint in a double battle")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { HP(HP_TEST / 2); MaxHP(HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(200); MaxHP(400); }
PLAYER(SPECIES_WYNAUT) { HP(1); }
OPPONENT(SPECIES_ABRA) { HP(1); }
OPPONENT(SPECIES_KADABRA) { HP(1); }
OPPONENT(SPECIES_KADABRA);
} WHEN {
TURN { MOVE(playerLeft, MOVE_MIND_BLOWN, criticalHit: FALSE); }
TURN { MOVE(playerLeft, MOVE_MIND_BLOWN); }
} SCENE {
HP_BAR(playerLeft, hp: 0);
ANIMATION(ANIM_TYPE_MOVE, MOVE_MIND_BLOWN, playerLeft);

View File

@ -5,13 +5,11 @@
// behaviors. These have been tested in-game, in double, in multi, and in link battles. AI will always
// revive their first fainted party member in order.
#define MOVE_MESSAGE(name) \
do { \
if (B_EXPANDED_MOVE_NAMES == FALSE) \
MESSAGE(name" used RevivlBlesng!"); \
else \
MESSAGE(name" used Revival Blessing!"); \
} while (0); \
#if B_EXPANDED_MOVE_NAMES
#define REVIVAL_BLESSING "Revival Blessing"
#else
#define REVIVAL_BLESSING "RevivlBlesng"
#endif
ASSUMPTIONS
{
@ -28,7 +26,7 @@ SINGLE_BATTLE_TEST("Revival Blessing revives a chosen fainted party member for t
} WHEN {
TURN { MOVE(player, MOVE_REVIVAL_BLESSING); SEND_OUT(player, 2); }
} SCENE {
MOVE_MESSAGE("Wobbuffet")
MESSAGE("Wobbuffet used " REVIVAL_BLESSING "!");
MESSAGE("Wynaut was revived and is ready to fight again!");
}
}
@ -43,7 +41,7 @@ SINGLE_BATTLE_TEST("Revival Blessing revives a fainted party member for an oppon
} WHEN {
TURN { MOVE(opponent, MOVE_REVIVAL_BLESSING); SEND_OUT(opponent, 1); }
} SCENE {
MOVE_MESSAGE("Foe Raichu")
MESSAGE("Foe Raichu used " REVIVAL_BLESSING "!");
MESSAGE("Pichu was revived and is ready to fight again!");
}
}
@ -56,7 +54,7 @@ SINGLE_BATTLE_TEST("Revival Blessing fails if no party members are fainted")
} WHEN {
TURN { MOVE(player, MOVE_REVIVAL_BLESSING); }
} SCENE {
MOVE_MESSAGE("Wobbuffet")
MESSAGE("Wobbuffet used " REVIVAL_BLESSING "!");
MESSAGE("But it failed!");
}
}
@ -84,10 +82,10 @@ TO_DO_BATTLE_TEST("Revival Blessing cannot revive a partner's party member");
// TURN { MOVE(user, MOVE_REVIVAL_BLESSING); }
// } SCENE {
// if (user == opponentLeft) {
// MOVE_MESSAGE(Foe Wobbuffet)
// MESSAGE("Foe Wobbuffet used " REVIVAL_BLESSING "!");
// MESSAGE("But it failed!");
// } else {
// MOVE_MESSAGE(Foe Wynaut)
// MESSAGE("Foe Wynaut used " REVIVAL_BLESSING "!");
// MESSAGE("Wynaut was revived and is ready to fight again!");
// }
// }
@ -110,7 +108,7 @@ TO_DO_BATTLE_TEST("Revived battlers still lose their turn");
// } SCENE {
// MESSAGE("Wobbuffet used Tackle!");
// MESSAGE("Foe Wynaut fainted!");
// MOVE_MESSAGE("Foe Wobbuffet")
// MESSAGE("Foe Wobbuffet used " REVIVAL_BLESSING "!");
// MESSAGE("Wynaut was revived and is ready to fight again!");
// NOT { MESSAGE("Wynaut used Celebrate!"); }
// }

View File

@ -104,7 +104,7 @@ DOUBLE_BATTLE_TEST("Shell Trap activates immediately after being hit on turn 1 a
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WYNAUT) { Speed(1); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_SHELL_TRAP); MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(playerRight, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); }
TURN { MOVE(playerLeft, MOVE_SHELL_TRAP); MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(playerRight, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SHELL_TRAP_SETUP, playerLeft);
MESSAGE("Wobbuffet set a shell trap!");
@ -128,7 +128,7 @@ DOUBLE_BATTLE_TEST("Shell Trap activates immediately after being hit on turn 2 a
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WYNAUT) { Speed(6); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_SHELL_TRAP); MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(playerRight, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); }
TURN { MOVE(playerLeft, MOVE_SHELL_TRAP); MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(playerRight, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SHELL_TRAP_SETUP, playerLeft);
MESSAGE("Wobbuffet set a shell trap!");
@ -152,7 +152,7 @@ DOUBLE_BATTLE_TEST("Shell Trap activates immediately after being hit on turn 3 a
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }
OPPONENT(SPECIES_WYNAUT) { Speed(6); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_SHELL_TRAP); MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(playerRight, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); }
TURN { MOVE(playerLeft, MOVE_SHELL_TRAP); MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(playerRight, MOVE_CELEBRATE); MOVE(opponentRight, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SHELL_TRAP_SETUP, playerLeft);
MESSAGE("Wobbuffet set a shell trap!");

View File

@ -34,14 +34,13 @@ SINGLE_BATTLE_TEST("Stockpile's count can go up only to 3")
}
}
#define MAX_HP_TEST 400
SINGLE_BATTLE_TEST("Spit Up and Swallow don't work if used without Stockpile")
{
u32 move;
PARAMETRIZE {move = MOVE_SWALLOW ;}
PARAMETRIZE {move = MOVE_SPIT_UP ;}
PARAMETRIZE { move = MOVE_SWALLOW; }
PARAMETRIZE { move = MOVE_SPIT_UP; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {HP(10), MaxHP(MAX_HP_TEST) ;}
PLAYER(SPECIES_WOBBUFFET) { HP(10), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
@ -70,9 +69,9 @@ SINGLE_BATTLE_TEST("Spit Up and Swallow don't work if used without Stockpile")
SINGLE_BATTLE_TEST("Spit Up's power raises depending on Stockpile's count", s16 damage)
{
u8 count;
PARAMETRIZE { count = 1;}
PARAMETRIZE { count = 2;}
PARAMETRIZE { count = 3;}
PARAMETRIZE { count = 1; }
PARAMETRIZE { count = 2; }
PARAMETRIZE { count = 3; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
@ -107,11 +106,11 @@ SINGLE_BATTLE_TEST("Spit Up's power raises depending on Stockpile's count", s16
SINGLE_BATTLE_TEST("Swallow heals HP depending on Stockpile's count", s16 hpHeal)
{
u8 count;
PARAMETRIZE { count = 1;}
PARAMETRIZE { count = 2;}
PARAMETRIZE { count = 3;}
PARAMETRIZE { count = 1; }
PARAMETRIZE { count = 2; }
PARAMETRIZE { count = 3; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {HP(1), MaxHP(MAX_HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) { HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STOCKPILE); }
@ -136,23 +135,23 @@ SINGLE_BATTLE_TEST("Swallow heals HP depending on Stockpile's count", s16 hpHeal
ANIMATION(ANIM_TYPE_MOVE, MOVE_SWALLOW, player);
HP_BAR(player, captureDamage: &results[i].hpHeal);
} FINALLY {
EXPECT_EQ(results[0].hpHeal, -(MAX_HP_TEST / 4));
EXPECT_EQ(results[1].hpHeal, -(MAX_HP_TEST / 2));
EXPECT_EQ(results[2].hpHeal, -(MAX_HP_TEST - 1));
EXPECT_EQ(results[0].hpHeal, -100);
EXPECT_EQ(results[1].hpHeal, -200);
EXPECT_EQ(results[2].hpHeal, -399); // 400 - 1.
}
}
SINGLE_BATTLE_TEST("Stockpile temporarily raises Def and Sp. Def", s16 dmgPyhsical, s16 dmgSpecial)
{
u16 move;
PARAMETRIZE {move = MOVE_STOCKPILE;}
PARAMETRIZE {move = MOVE_CELEBRATE;}
PARAMETRIZE { move = MOVE_STOCKPILE; }
PARAMETRIZE { move = MOVE_CELEBRATE; }
GIVEN {
ASSUME(B_STOCKPILE_RAISES_DEFS >= GEN_4);
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_GUST].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
PLAYER(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(player, move); MOVE(opponent, MOVE_TACKLE); }
TURN { MOVE(opponent, MOVE_GUST); }
@ -180,27 +179,27 @@ DOUBLE_BATTLE_TEST("Stockpile's Def and Sp. Def boost is lost after using Spit U
{
u8 count;
u16 move;
PARAMETRIZE {count = 1, move = MOVE_SPIT_UP;}
PARAMETRIZE {count = 2, move = MOVE_SWALLOW;}
PARAMETRIZE {count = 3, move = MOVE_SPIT_UP;}
PARAMETRIZE { count = 1; move = MOVE_SPIT_UP; }
PARAMETRIZE { count = 2; move = MOVE_SWALLOW; }
PARAMETRIZE { count = 3; move = MOVE_SPIT_UP; }
GIVEN {
ASSUME(B_STOCKPILE_RAISES_DEFS >= GEN_4);
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_GUST].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET) {Speed(4); HP(MAX_HP_TEST - 1); MaxHP(MAX_HP_TEST); }
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
PLAYER(SPECIES_WOBBUFFET) { Speed(4); HP(399); MaxHP(400); }
PLAYER(SPECIES_WOBBUFFET) { Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft, criticalHit:FALSE); MOVE(opponentRight, MOVE_GUST, criticalHit:FALSE, target:playerLeft);}
TURN { MOVE(playerLeft, MOVE_STOCKPILE);}
TURN { MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(opponentRight, MOVE_GUST, target: playerLeft); }
TURN { MOVE(playerLeft, MOVE_STOCKPILE); }
if (count != 1) {
TURN { MOVE(playerLeft, MOVE_STOCKPILE);}
TURN { MOVE(playerLeft, MOVE_STOCKPILE); }
if (count == 3) {
TURN { MOVE(playerLeft, MOVE_STOCKPILE);}
TURN { MOVE(playerLeft, MOVE_STOCKPILE); }
}
}
TURN { MOVE(playerLeft, move, target:opponentLeft); MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft, criticalHit:FALSE); MOVE(opponentRight, MOVE_GUST, target:playerLeft, criticalHit:FALSE); }
TURN { MOVE(playerLeft, move, target: opponentLeft); MOVE(opponentLeft, MOVE_TACKLE, target: playerLeft); MOVE(opponentRight, MOVE_GUST, target: playerLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponentLeft);
HP_BAR(playerLeft, captureDamage: &results[i].dmgPyhsicalBefore);

View File

@ -41,7 +41,7 @@ SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze electric/fire/ice typ
u16 species;
u32 rng;
#if B_PARALYZE_ELECTRIC >= GEN_6
PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU;}
PARAMETRIZE { statusAnim = B_ANIM_STATUS_PRZ; rng = MOVE_EFFECT_PARALYSIS; species = SPECIES_RAICHU; }
#endif // B_PARALYZE_ELECTRIC
PARAMETRIZE { statusAnim = B_ANIM_STATUS_BRN; rng = MOVE_EFFECT_BURN; species = SPECIES_ARCANINE; }
PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = MOVE_EFFECT_FREEZE; species = SPECIES_GLALIE; }
@ -85,7 +85,7 @@ SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze pokemon with abilitie
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(species) {Ability(ability);}
OPPONENT(species) { Ability(ability); }
} WHEN {
TURN { MOVE(player, MOVE_TRI_ATTACK, WITH_RNG(RNG_TRI_ATTACK, rng)); }
TURN {}
@ -114,7 +114,7 @@ SINGLE_BATTLE_TEST("Tri Attack cannot paralyze/burn/freeze a mon which is alread
PARAMETRIZE { statusAnim = B_ANIM_STATUS_FRZ; rng = MOVE_EFFECT_FREEZE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_SLEEP);}
OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_SLEEP); }
} WHEN {
TURN { MOVE(player, MOVE_TRI_ATTACK, WITH_RNG(RNG_TRI_ATTACK, rng)); }
TURN {}

View File

@ -14,7 +14,7 @@ SINGLE_BATTLE_TEST("Venoshock's power doubles if the target is poisoned/badly po
PARAMETRIZE { status1 = STATUS1_TOXIC_POISON; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) {Status1(status1);}
OPPONENT(SPECIES_WOBBUFFET) { Status1(status1); }
} WHEN {
TURN { MOVE(player, MOVE_VENOSHOCK); }
} SCENE {

View File

@ -21,7 +21,7 @@ SINGLE_BATTLE_TEST("Powder Moves are blocked by Ability Overcoat")
GIVEN {
ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_PINECO) { Ability(ABILITY_OVERCOAT);};
OPPONENT(SPECIES_PINECO) { Ability(ABILITY_OVERCOAT); }
} WHEN {
TURN { MOVE(player, MOVE_STUN_SPORE); }
} SCENE {
@ -37,7 +37,7 @@ SINGLE_BATTLE_TEST("Powder Moves are blocked by Item Safety Goggles")
ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER);
ASSUME(gItems[ITEM_SAFETY_GOGGLES].holdEffect == HOLD_EFFECT_SAFETY_GOGGLES);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_ABRA) { Item(ITEM_SAFETY_GOGGLES);};
OPPONENT(SPECIES_ABRA) { Item(ITEM_SAFETY_GOGGLES); }
} WHEN {
TURN { MOVE(player, MOVE_STUN_SPORE); }
} SCENE {

View File

@ -30,7 +30,7 @@ SINGLE_BATTLE_TEST("Frostbite deals 1/16 damage to effected pokemon")
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_FROSTBITE); }
} WHEN {
TURN { }
TURN {}
} SCENE {
MESSAGE("Foe Wobbuffet is hurt by its frostbite!");
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent);

View File

@ -168,9 +168,9 @@ s32 MgbaPrintf_(const char *fmt, ...);
#define PARAMETRIZE if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter)
#define TO_DO \
Test_ExpectedResult(TEST_RESULT_TODO)
#define EXPECT_TO_DO \
Test_ExitWithResult(TEST_RESULT_TODO, "%s:%d: EXPECT_TO_DO", gTestRunnerState.test->filename, __LINE__)
do { \
Test_ExpectedResult(TEST_RESULT_TODO); \
Test_ExitWithResult(TEST_RESULT_TODO, "%s:%d: EXPECT_TO_DO", gTestRunnerState.test->filename, __LINE__); \
} while (0)
#endif

View File

@ -651,12 +651,9 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState;
/* Test */
#define TO_DO_BATTLE_TEST(_name) \
SINGLE_BATTLE_TEST("TODO: " _name) \
TEST("TODO: " _name) \
{ \
TO_DO; \
GIVEN { PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } \
WHEN { TURN { } } \
THEN { EXPECT_TO_DO; } \
}
#define SINGLE_BATTLE_TEST(_name, ...) \

View File

@ -155,7 +155,8 @@ void CB2_TestRunner(void)
if (gTestRunnerState.test->runner->tearDown)
gTestRunnerState.test->runner->tearDown(gTestRunnerState.test->data);
if (!gTestRunnerState.expectLeaks)
if (gTestRunnerState.result == gTestRunnerState.expectedResult
&& !gTestRunnerState.expectLeaks)
{
const struct MemBlock *head = HeapHead();
const struct MemBlock *block = head;
@ -372,10 +373,10 @@ void Test_ExitWithResult(enum TestResult result, const char *fmt, ...)
gTestRunnerState.result = result;
ReinitCallbacks();
if (gTestRunnerState.state == STATE_REPORT_RESULT
&& gTestRunnerState.test->runner->handleExitWithResult)
&& gTestRunnerState.result != gTestRunnerState.expectedResult)
{
if (!gTestRunnerState.test->runner->handleExitWithResult(gTestRunnerState.test->data, result)
&& gTestRunnerState.result != gTestRunnerState.expectedResult)
if (!gTestRunnerState.test->runner->handleExitWithResult
|| !gTestRunnerState.test->runner->handleExitWithResult(gTestRunnerState.test->data, result))
{
va_list va;
va_start(va, fmt);

View File

@ -841,6 +841,14 @@ void TestRunner_Battle_AfterLastTurn(void)
STATE->runFinally = FALSE;
}
static void TearDownBattle(void)
{
FreeMonSpritesGfx();
FreeBattleSpritesData();
FreeBattleResources();
FreeAllWindowBuffers();
}
static void CB2_BattleTest_NextParameter(void)
{
if (++STATE->runParameter >= STATE->parameters)
@ -856,10 +864,7 @@ static void CB2_BattleTest_NextParameter(void)
static void CB2_BattleTest_NextTrial(void)
{
FreeMonSpritesGfx();
FreeBattleSpritesData();
FreeBattleResources();
FreeAllWindowBuffers();
TearDownBattle();
SetMainCallback2(CB2_BattleTest_NextParameter);
@ -903,12 +908,7 @@ static void BattleTest_TearDown(void *data)
// Free resources that aren't cleaned up when the battle was
// aborted unexpectedly.
if (STATE->tearDownBattle)
{
FreeMonSpritesGfx();
FreeBattleSpritesData();
FreeBattleResources();
FreeAllWindowBuffers();
}
TearDownBattle();
FREE_AND_SET_NULL(STATE->results);
FREE_AND_SET_NULL(STATE);
}

View File

@ -1,9 +1,6 @@
#include "global.h"
#include "test_battle.h"
#define TEST_HP 1
#define MAX_HP 400
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_SNOWSCAPE].effect == EFFECT_SNOWSCAPE);
@ -50,7 +47,7 @@ SINGLE_BATTLE_TEST("Snow turns Weather Ball to an Ice-type move and doubles its
SINGLE_BATTLE_TEST("Snow allows Blizzard to bypass accuracy checks")
{
PASSES_RANDOMLY(100, 100);
PASSES_RANDOMLY(100, 100, RNG_ACCURACY);
GIVEN {
ASSUME(gBattleMoves[MOVE_BLIZZARD].accuracy == 70);
PLAYER(SPECIES_WOBBUFFET);
@ -105,12 +102,12 @@ SINGLE_BATTLE_TEST("Snow causes Moonlight to recover 1/4 of the user's max HP")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MOONLIGHT); }
} SCENE {
HP_BAR(player, hp: TEST_HP + (MAX_HP/4));
HP_BAR(player, damage: -(400 / 4));
}
}
@ -118,12 +115,12 @@ SINGLE_BATTLE_TEST("Snow causes Moonlight to recover 1/4 of the user's max HP")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_MOONLIGHT].effect == EFFECT_MOONLIGHT);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MOONLIGHT); }
} SCENE {
HP_BAR(player, hp: TEST_HP + (MAX_HP/4));
HP_BAR(player, damage: -(400 / 4));
}
}
@ -131,12 +128,12 @@ SINGLE_BATTLE_TEST("Snow causes Synthesis to recover 1/4 of the user's max HP")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_SYNTHESIS].effect == EFFECT_SYNTHESIS);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_SYNTHESIS); }
} SCENE {
HP_BAR(player, hp: TEST_HP + (MAX_HP/4));
HP_BAR(player, damage: -(400 / 4));
}
}
@ -144,14 +141,11 @@ SINGLE_BATTLE_TEST("Snow causes Morning Sun to recover 1/4 of the user's max HP"
{
GIVEN {
ASSUME(gBattleMoves[MOVE_MORNING_SUN].effect == EFFECT_MORNING_SUN);
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SNOWSCAPE); MOVE(player, MOVE_MORNING_SUN); }
} SCENE {
HP_BAR(player, hp: TEST_HP + (MAX_HP/4));
HP_BAR(player, damage: -(400 / 4));
}
}
#undef MAX_HP
#undef TEST_HP

View File

@ -12,7 +12,7 @@ all: mgba-rom-test-hydra$(EXE)
@:
mgba-rom-test-hydra$(EXE): $(SRCS)
$(CC) $(SRCS) -o $@ $(LDFLAGS)
$(CC) $(SRCS) -o $@ -lm $(LDFLAGS)
clean:
$(RM) mgba-rom-test-hydra$(EXE)

View File

@ -15,6 +15,7 @@
* passes/known fails/assumption fails/fails.
*/
#include <fcntl.h>
#include <math.h>
#include <poll.h>
#include <signal.h>
#include <stdbool.h>
@ -53,9 +54,10 @@ struct Runner
};
static unsigned nrunners = 0;
static unsigned runners_digits = 0;
static struct Runner *runners = NULL;
static void handle_read(struct Runner *runner)
static void handle_read(int i, struct Runner *runner)
{
char *sol = runner->input_buffer;
char *eol;
@ -101,7 +103,7 @@ static void handle_read(struct Runner *runner)
add_to_results:
runner->results++;
soc += 2;
fprintf(stdout, "%s: ", runner->test_name);
fprintf(stdout, "[%0*d] %s: ", runners_digits, i, runner->test_name);
fwrite(soc, 1, eol - soc, stdout);
fwrite(runner->output_buffer, 1, runner->output_buffer_size, stdout);
strcpy(runner->test_name, "WAITING...");
@ -166,7 +168,11 @@ static void unlink_roms(void)
if (runners[i].rom_path[0])
{
if (unlink(runners[i].rom_path) == -1)
perror("unlink rom_path failed");
{
int fd;
if ((fd = open(runners[i].rom_path, O_RDONLY)) != -1)
perror("unlink rom_path failed");
}
}
}
}
@ -230,6 +236,7 @@ int main(int argc, char *argv[])
nrunners = sysconf(_SC_NPROCESSORS_ONLN);
if (nrunners > MAX_PROCESSES)
nrunners = MAX_PROCESSES;
runners_digits = ceil(log10(nrunners));
runners = calloc(nrunners, sizeof(*runners));
if (!runners)
{
@ -244,7 +251,7 @@ int main(int argc, char *argv[])
runners[i].output_buffer = malloc(runners[i].output_buffer_capacity);
strcpy(runners[i].test_name, "WAITING...");
if (tty)
fprintf(stdout, "%s\n", runners[i].test_name);
fprintf(stdout, "[%0*d] %s\n", runners_digits, i, runners[i].test_name);
}
fflush(stdout);
atexit(unlink_roms);
@ -293,7 +300,7 @@ int main(int argc, char *argv[])
_exit(2);
}
char rom_path[FILENAME_MAX];
sprintf(rom_path, "/tmp/file%05d", getpid());
sprintf(rom_path, "/tmp/mgba-rom-test-hydra-%05d", getpid());
int tmpfd;
if ((tmpfd = open(rom_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) == -1)
{
@ -375,7 +382,7 @@ int main(int argc, char *argv[])
}
} else {
runners[i].pid = pid;
sprintf(runners[i].rom_path, "/tmp/file%05d", runners[i].pid);
sprintf(runners[i].rom_path, "/tmp/mgba-rom-test-hydra-%05d", runners[i].pid);
runners[i].outfd = pipefds[0];
if (close(pipefds[1]) == -1)
{
@ -412,7 +419,7 @@ int main(int argc, char *argv[])
for (int i = 0; i < nrunners; i++)
{
if (runners[i].outfd >= 0)
scrollback += (strlen(runners[i].test_name) + winsize.ws_col - 1) / winsize.ws_col;
scrollback += (3 + runners_digits + strlen(runners[i].test_name) + winsize.ws_col - 1) / winsize.ws_col;
}
if (scrollback > 0)
fprintf(stdout, "\e[%dF\e[J", scrollback);
@ -434,7 +441,7 @@ int main(int argc, char *argv[])
exit(2);
}
runners[i].input_buffer_size += n;
handle_read(&runners[i]);
handle_read(i, &runners[i]);
}
if (pollfds[i].revents & (POLLERR | POLLHUP))
@ -454,7 +461,7 @@ int main(int argc, char *argv[])
for (int i = 0; i < nrunners; i++)
{
if (runners[i].outfd >= 0)
fprintf(stdout, "%s\n", runners[i].test_name);
fprintf(stdout, "[%0*d] %s\n", runners_digits, i, runners[i].test_name);
}
fflush(stdout);