generated from sigonasr2/CPlusPlusProjectTemplate
Writing more tests...
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
fbd730b0e6
commit
ddb9c04e86
Binary file not shown.
11
SeasonI.h
11
SeasonI.h
@ -9,6 +9,7 @@
|
||||
|
||||
using namespace olc;
|
||||
|
||||
#define 시험
|
||||
|
||||
class Map;
|
||||
enum class ItemName;
|
||||
@ -26,17 +27,17 @@ class SeasonI:public PixelGameEngine{
|
||||
bool OnUserCreate()override;
|
||||
void SetupMoveList();
|
||||
void SetupItemList();
|
||||
void SetupPartyMemberStats();
|
||||
void SetupAnimations();
|
||||
void SetupObjectInfo();
|
||||
void SetupEncounters();
|
||||
void SetupPartyMemberStats(); 시험
|
||||
void SetupAnimations(); 시험
|
||||
void SetupObjectInfo(); 시험
|
||||
void SetupEncounters(); 시험
|
||||
void SetupBattleProperties();
|
||||
void SetGameFlag(Flag flag,bool val);
|
||||
void LoadMap(Map*map);
|
||||
void SaveMap(Map*map);
|
||||
void AddItemToPlayerInventory(ItemName item);
|
||||
Decal*CreateSprite(std::string spriteName);
|
||||
Object*CreateObjectInfo(Object*obj,std::string spriteFileName,int sprWidth,Flag enableFlag=Flag::NONE,Flag disableFlag=Flag::NONE);
|
||||
Object*CreateObjectInfo(Object*obj,std::string spriteFileName,int sprWidth,Flag enableFlag=Flag::NONE,Flag disableFlag=Flag::NONE); 시험
|
||||
vi2d grid(int x, int y);
|
||||
bool GetGameFlag(int flag);
|
||||
bool GetGameFlag(Flag flag);
|
||||
|
||||
@ -28,6 +28,8 @@ extern std::map<std::string,Decal*> SPRITES;
|
||||
extern std::map<std::string,Animation*> ANIMATIONS;
|
||||
extern std::array<Object*,4> PARTY_MEMBER_OBJ;
|
||||
extern std::map<int,Object*> OBJ_INFO;
|
||||
extern std::map<BattleMoveName,Battle::Move*>MOVELIST;
|
||||
extern std::vector<Encounter*>ENCOUNTER_LIST;
|
||||
|
||||
int testCount=0;
|
||||
|
||||
@ -58,7 +60,11 @@ bool SeasonI::OnUserCreate(){
|
||||
Test("Party Member stats should not be initialized",
|
||||
PARTY_MEMBER_STATS[i]==nullptr);
|
||||
}
|
||||
Test("No battle moves are loaded",
|
||||
MOVELIST.size()==0);
|
||||
SetupPartyMemberStats();
|
||||
Test("Battle moves now exist (still not defined)",
|
||||
MOVELIST.size()>0);
|
||||
for (int i=0;i<PARTY_MEMBER_STATS.size();i++) {
|
||||
Test("Party Members get initialized with correct defaults",
|
||||
PARTY_MEMBER_STATS[i]->stats==partyMemberDefaultStats);
|
||||
@ -88,6 +94,74 @@ bool SeasonI::OnUserCreate(){
|
||||
SetupObjectInfo();
|
||||
Test("Using the same sprite definition does not cause memory leak",
|
||||
playerAnimPointer==OBJ_INFO[0]->spr->spr);
|
||||
Test("No encounters are loaded",
|
||||
ENCOUNTER_LIST.size()==0);
|
||||
SetupEncounters();
|
||||
Test("SetupEncounters() loads up new encounters",
|
||||
ENCOUNTER_LIST.size()>0);
|
||||
Encounter*testEncounter=new Encounter(encounter::ENCOUNTER_1,{0,0},std::array<vd2d,4>{vd2d
|
||||
{grid(1,2)},{grid(2,2)},{grid(3,2)},{grid(4,2)}},
|
||||
std::vector<Entity*>{
|
||||
new Entity(new Standard_Obj(
|
||||
NPC1_4,"Test Obj",3,2,ANIMATIONS["player.png"]),
|
||||
{HP:70,maxHP:70,PP:10,maxPP:10,baseAtk:14,speed:5,resistances:{0,0,0,0}},std::vector<Battle::Move*>{
|
||||
MOVELIST[BattleMoveName::TESTMOVE1],
|
||||
MOVELIST[BattleMoveName::TESTMOVE2],
|
||||
MOVELIST[BattleMoveName::TESTMOVE3],
|
||||
},
|
||||
{ITEMLIST[ItemName::COOKIE]},
|
||||
돈 20),
|
||||
new Entity(new Standard_Obj(
|
||||
NPC1_4,"Test Obj 2",1,3,ANIMATIONS["player.png"]),
|
||||
{HP:70,maxHP:70,PP:10,maxPP:10,baseAtk:14,speed:5,resistances:{0,0,0,0}},std::vector<Battle::Move*>{
|
||||
MOVELIST[BattleMoveName::TESTMOVE1],
|
||||
MOVELIST[BattleMoveName::TESTMOVE2],
|
||||
},
|
||||
{ITEMLIST[ItemName::PIZZA]}),
|
||||
new Entity(new Standard_Obj(
|
||||
NPC1_4,"Test Obj 3",2,2,ANIMATIONS["player.png"]),
|
||||
{HP:70,maxHP:70,PP:10,maxPP:10,baseAtk:14,speed:5,resistances:{0,0,0,0}},std::vector<Battle::Move*>{
|
||||
MOVELIST[BattleMoveName::TESTMOVE1],
|
||||
}),
|
||||
});
|
||||
Test("Test encounter has three entities",
|
||||
testEncounter->objs.size()==3);
|
||||
Test("Test encounter uses ID ENCOUNTER_1",
|
||||
testEncounter->id==encounter::ENCOUNTER_1);
|
||||
testPos={0,0};
|
||||
Test("Test encounter uses position ("+std::to_string(testPos.x)+","+std::to_string(testPos.y)+")",
|
||||
testEncounter->pos==testPos);
|
||||
Test("Test encounter player positions are correct",
|
||||
testEncounter->playerPos==std::array<vd2d,4>{vd2d{grid(1,2)},{grid(2,2)},{grid(3,2)},{grid(4,2)}});
|
||||
Test("Test encounter grid positions are correct",
|
||||
testEncounter->playerPos==std::array<vd2d,4>{vd2d{grid(1,2)},{grid(2,2)},{grid(3,2)},{grid(4,2)}});
|
||||
Test("Enemy 1 has 3 battle moves.",
|
||||
testEncounter->objs[0]->moveSet==std::vector<Battle::Move*>{
|
||||
MOVELIST[BattleMoveName::TESTMOVE1],
|
||||
MOVELIST[BattleMoveName::TESTMOVE2],
|
||||
MOVELIST[BattleMoveName::TESTMOVE3],
|
||||
});
|
||||
Test("Enemy 1 has a cookie as a drop.",
|
||||
testEncounter->objs[0]->inventory==std::vector<Item*>{ITEMLIST[ItemName::COOKIE]});
|
||||
Test("Enemy 1 gives 20 money.",
|
||||
testEncounter->objs[0]->money==20);
|
||||
Test("Enemy 2 has 2 battle moves.",
|
||||
testEncounter->objs[1]->moveSet==std::vector<Battle::Move*>{
|
||||
MOVELIST[BattleMoveName::TESTMOVE1],
|
||||
MOVELIST[BattleMoveName::TESTMOVE2],
|
||||
});
|
||||
Test("Enemy 2 has a pizza as a drop.",
|
||||
testEncounter->objs[1]->inventory==std::vector<Item*>{ITEMLIST[ItemName::PIZZA]});
|
||||
Test("Enemy 2 gives 0 money.",
|
||||
testEncounter->objs[1]->money==0);
|
||||
Test("Enemy 3 has 1 battle move.",
|
||||
testEncounter->objs[2]->moveSet==std::vector<Battle::Move*>{
|
||||
MOVELIST[BattleMoveName::TESTMOVE1],
|
||||
});
|
||||
Test("Enemy 3 has no items to drop.",
|
||||
testEncounter->objs[2]->inventory==std::vector<Item*>{});
|
||||
Test("Enemy 3 gives 0 money.",
|
||||
testEncounter->objs[2]->money==0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user