mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
bd4736cc97
test multi battle final remove empty line
141 lines
5.3 KiB
C
141 lines
5.3 KiB
C
#include "global.h"
|
|
#include "test.h"
|
|
#include "battle.h"
|
|
#include "battle_main.h"
|
|
#include "data.h"
|
|
#include "malloc.h"
|
|
#include "string_util.h"
|
|
#include "constants/item.h"
|
|
#include "constants/abilities.h"
|
|
#include "constants/trainers.h"
|
|
#include "constants/battle.h"
|
|
|
|
|
|
static const struct TrainerMonCustomized sTestParty1[] =
|
|
{
|
|
{
|
|
.species = SPECIES_WOBBUFFET,
|
|
.ball = ITEM_MASTER_BALL,
|
|
.ability = ABILITY_TELEPATHY,
|
|
.friendship = 42,
|
|
.gender = TRAINER_MON_FEMALE,
|
|
.heldItem = ITEM_ASSAULT_VEST,
|
|
.isShiny = TRUE,
|
|
.iv = TRAINER_PARTY_IVS(25,26,27,28,29,30),
|
|
.ev = TRAINER_PARTY_EVS(252, 0, 0, 252, 4, 0),
|
|
.lvl = 67,
|
|
.moves = {MOVE_AIR_SLASH, MOVE_BARRIER, MOVE_SOLAR_BEAM, MOVE_EXPLOSION},
|
|
.nature = TRAINER_PARTY_NATURE(NATURE_HASTY),
|
|
.nickname = COMPOUND_STRING("Bubbles")
|
|
},
|
|
{
|
|
.species = SPECIES_WOBBUFFET,
|
|
.ability = ABILITY_SHADOW_TAG,
|
|
.lvl = 5,
|
|
},
|
|
};
|
|
|
|
static const struct TrainerMonNoItemDefaultMoves sTestParty2[] =
|
|
{
|
|
{
|
|
.species = SPECIES_WOBBUFFET,
|
|
.lvl = 5,
|
|
},
|
|
{
|
|
.species = SPECIES_WOBBUFFET,
|
|
.lvl = 6,
|
|
}
|
|
};
|
|
|
|
static const struct Trainer sTestTrainer1 =
|
|
{
|
|
.trainerName = _("Test1"),
|
|
.party = EVERYTHING_CUSTOMIZED(sTestParty1),
|
|
};
|
|
|
|
static const struct Trainer sTestTrainer2 =
|
|
{
|
|
.trainerName = _("Test2"),
|
|
.party = NO_ITEM_DEFAULT_MOVES(sTestParty2),
|
|
};
|
|
|
|
TEST("CreateNPCTrainerPartyForTrainer generates customized Pokémon")
|
|
{
|
|
struct Pokemon *testParty = Alloc(6 * sizeof(struct Pokemon));
|
|
u8 nickBuffer[20];
|
|
CreateNPCTrainerPartyFromTrainer(testParty, &sTestTrainer1, TRUE, BATTLE_TYPE_TRAINER);
|
|
EXPECT(IsMonShiny(&testParty[0]));
|
|
EXPECT(!IsMonShiny(&testParty[1]));
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_POKEBALL, 0) == ITEM_MASTER_BALL);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_POKEBALL, 0) == ITEM_POKE_BALL);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPECIES, 0) == SPECIES_WOBBUFFET);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPECIES, 0) == SPECIES_WOBBUFFET);
|
|
|
|
EXPECT(GetMonAbility(&testParty[0]) == ABILITY_TELEPATHY);
|
|
EXPECT(GetMonAbility(&testParty[1]) == ABILITY_SHADOW_TAG);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_FRIENDSHIP, 0) == 42);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_FRIENDSHIP, 0) == 0);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_HELD_ITEM, 0) == ITEM_ASSAULT_VEST);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_HELD_ITEM, 0) == ITEM_NONE);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_HP_IV, 0) == 25);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_ATK_IV, 0) == 26);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_DEF_IV, 0) == 27);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPEED_IV, 0) == 28);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPATK_IV, 0) == 29);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPDEF_IV, 0) == 30);
|
|
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_HP_IV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_ATK_IV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_DEF_IV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPEED_IV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPATK_IV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPDEF_IV, 0) == 0);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_HP_EV, 0) == 252);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_ATK_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_DEF_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPEED_EV, 0) == 252);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPATK_EV, 0) == 4);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_SPDEF_EV, 0) == 0);
|
|
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_HP_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_ATK_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_DEF_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPEED_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPATK_EV, 0) == 0);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_SPDEF_EV, 0) == 0);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_LEVEL, 0) == 67);
|
|
EXPECT(GetMonData(&testParty[1], MON_DATA_LEVEL, 0) == 5);
|
|
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_MOVE1, 0) == MOVE_AIR_SLASH);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_MOVE2, 0) == MOVE_BARRIER);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_MOVE3, 0) == MOVE_SOLAR_BEAM);
|
|
EXPECT(GetMonData(&testParty[0], MON_DATA_MOVE4, 0) == MOVE_EXPLOSION);
|
|
|
|
GetMonData(&testParty[0], MON_DATA_NICKNAME, nickBuffer);
|
|
EXPECT(StringCompare(nickBuffer, COMPOUND_STRING("Bubbles")) == 0);
|
|
|
|
GetMonData(&testParty[1], MON_DATA_NICKNAME, nickBuffer);
|
|
EXPECT(StringCompare(nickBuffer, COMPOUND_STRING("Wobbuffet")) == 0);
|
|
|
|
EXPECT(GetGenderFromSpeciesAndPersonality(GetMonData(&testParty[0], MON_DATA_SPECIES, 0), testParty[0].box.personality) == MON_FEMALE);
|
|
|
|
EXPECT(GetNature(&testParty[0]) == NATURE_HASTY);
|
|
|
|
Free(testParty);
|
|
}
|
|
|
|
TEST("CreateNPCTrainerPartyForTrainer generates different personalities for different mons")
|
|
{
|
|
struct Pokemon *testParty = Alloc(6 * sizeof(struct Pokemon));
|
|
CreateNPCTrainerPartyFromTrainer(testParty, &sTestTrainer2, TRUE, BATTLE_TYPE_TRAINER);
|
|
EXPECT(testParty[0].box.personality != testParty[1].box.personality);
|
|
Free(testParty);
|
|
}
|