diff --git a/C++ProjectTemplate b/C++ProjectTemplate index 46f2545..ecdc282 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/SeasonI.h b/SeasonI.h index 90f00a5..3afe510 100644 --- a/SeasonI.h +++ b/SeasonI.h @@ -9,7 +9,7 @@ using namespace olc; -#define 시험 +#define 됐어 class Map; enum class ItemName; @@ -25,19 +25,19 @@ class SeasonI:public PixelGameEngine{ public: SeasonI(){sAppName="Season I: Winters of Loneliness";} bool OnUserCreate()override; - void SetupMoveList(); + void SetupMoveList(); 됐어 void SetupItemList(); - void SetupPartyMemberStats(); 시험 - void SetupAnimations(); 시험 - void SetupObjectInfo(); 시험 - void SetupEncounters(); 시험 - void SetupBattleProperties(); + 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); diff --git a/battleproperty.h b/battleproperty.h index 787110d..9073adb 100644 --- a/battleproperty.h +++ b/battleproperty.h @@ -2,6 +2,7 @@ #define BATTLE_PROPERTY_H #include "pixelGameEngine.h" #include "entity.h" +#include "object.h" using namespace olc; diff --git a/defines.h b/defines.h index d18a9f3..6721ed1 100644 --- a/defines.h +++ b/defines.h @@ -49,5 +49,14 @@ enum class Property{ REVIVE }; +enum:char{ + ALPHA=α, + BETA=β, + GAMMA=γ, + OMEGA=Ω, + SIGMA=Σ, +}; + + extern vd2d cameraPos; #endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index f0cb2c4..4e653b2 100644 --- a/main.cpp +++ b/main.cpp @@ -16,7 +16,7 @@ #include "map.h" #include "SeasonI.h" -//#include "test/test.h" +#include "test/test.h" #ifndef TEST_SUITE #define OLC_PGE_APPLICATION @@ -37,15 +37,6 @@ vd2d cameraPos={0,0}; std::vector PARTY_INVENTORY; -enum{ - ALPHA=α, - BETA=β, - GAMMA=γ, - OMEGA=Ω, - SIGMA=Σ, -}; - - class DamageNumber{ public: diff --git a/test/test.cpp b/test/test.cpp index b6b0ad3..51f0634 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -30,6 +30,7 @@ extern std::array PARTY_MEMBER_OBJ; extern std::map OBJ_INFO; extern std::mapMOVELIST; extern std::vectorENCOUNTER_LIST; +extern std::map BATTLE_PROPERTIES; int testCount=0; @@ -135,13 +136,13 @@ bool SeasonI::OnUserCreate(){ testEncounter->playerPos==std::array{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{grid(1,2)},{grid(2,2)},{grid(3,2)},{grid(4,2)}}); - Test("Enemy 1 has 3 battle moves.", + Test("Enemy 1 has 3 battle moves", testEncounter->objs[0]->moveSet==std::vector{ MOVELIST[BattleMoveName::TESTMOVE1], MOVELIST[BattleMoveName::TESTMOVE2], MOVELIST[BattleMoveName::TESTMOVE3], }); - Test("Enemy 1 has a cookie as a drop.", + Test("Enemy 1 has a cookie as a drop", testEncounter->objs[0]->inventory==std::vector{ITEMLIST[ItemName::COOKIE]}); Test("Enemy 1 gives 20 money.", testEncounter->objs[0]->money==20); @@ -150,7 +151,7 @@ bool SeasonI::OnUserCreate(){ MOVELIST[BattleMoveName::TESTMOVE1], MOVELIST[BattleMoveName::TESTMOVE2], }); - Test("Enemy 2 has a pizza as a drop.", + Test("Enemy 2 has a pizza as a drop", testEncounter->objs[1]->inventory==std::vector{ITEMLIST[ItemName::PIZZA]}); Test("Enemy 2 gives 0 money.", testEncounter->objs[1]->money==0); @@ -158,10 +159,50 @@ bool SeasonI::OnUserCreate(){ testEncounter->objs[2]->moveSet==std::vector{ MOVELIST[BattleMoveName::TESTMOVE1], }); - Test("Enemy 3 has no items to drop.", + Test("Enemy 3 has no items to drop", testEncounter->objs[2]->inventory==std::vector{}); Test("Enemy 3 gives 0 money.", testEncounter->objs[2]->money==0); + Test("There are no battle properties", + BATTLE_PROPERTIES.size()==0); + SetupBattleProperties(); + Test("Battle Properties populated", + BATTLE_PROPERTIES.size()>0); + Test("Test Move 1 exists in the map.", + MOVELIST.count(BattleMoveName::TESTMOVE1)); + Test("Test Move 1 is undefined", + MOVELIST[BattleMoveName::TESTMOVE1]==nullptr); + MOVELIST[BattleMoveName::TESTMOVE1]=new Battle::Move{"Test Move 1","An attack",baseDmg:30,randomDmg:5,range:6,channelTime:27,friendly:false}; + Test("Verify Test Move 1's now set properly", + MOVELIST[BattleMoveName::TESTMOVE1]!=nullptr); + Test("Verify Test Move 1's Power Name shows up correctly", + MOVELIST[BattleMoveName::TESTMOVE1]->GetPowerName()=="Test Move 1"); + MOVELIST[BattleMoveName::TESTMOVE1]->grade=GAMMA; + Test("Verify Test Move 1's Power Name shows up correctly with a grade", + MOVELIST[BattleMoveName::TESTMOVE1]->GetPowerName()=="Test Move 1 "+std::string(1,(char)GAMMA)); + Test("Cookie is undefined", + ITEMLIST[ItemName::COOKIE]==nullptr); + SetupItemList(); + Test("Cookie is defined", + ITEMLIST[ItemName::COOKIE]!=nullptr); + delete ITEMLIST[ItemName::COOKIE]; + ITEMLIST.erase(ItemName::COOKIE); + ITEMLIST[ItemName::COOKIE]=new Item("Cookie","A delightful little treat. Restores 40 HP.",2,{hpRecovery:40,consumable:Consumable::FRIENDLY,sellPrice:2}); + Test("Cookie name is set properly", + ITEMLIST[ItemName::COOKIE]->name=="Cookie"); + Test("Cookie description is set properly", + ITEMLIST[ItemName::COOKIE]->description=="A delightful little treat. Restores 40 HP."); + Test("Cookie drop chance is set properly", + ITEMLIST[ItemName::COOKIE]->dropChance==2); + delete ITEMLIST[ItemName::FREEZE_PACKET]; + ITEMLIST.erase(ItemName::FREEZE_PACKET); + ITEMLIST[ItemName::FREEZE_PACKET]=new Item("Freeze Packet","Lets out some blistering cold weather.",256,{consumable:Consumable::ENEMY,sellPrice:36},MOVELIST[BattleMoveName::FREEZE_PACKET]); + Test("Freeze Packet name is set properly", + ITEMLIST[ItemName::FREEZE_PACKET]->name=="Freeze Packet"); + Test("Freeze Packet description is set properly", + ITEMLIST[ItemName::FREEZE_PACKET]->description=="Lets out some blistering cold weather."); + Test("Freeze Packet drop chance is set properly", + ITEMLIST[ItemName::FREEZE_PACKET]->dropChance==2); return true; }