diff --git a/Adventures in Lestoria Tests/Adventures in Lestoria Tests.cpp b/Adventures in Lestoria Tests/Adventures in Lestoria Tests.cpp index 3147aeb9..88d76329 100644 --- a/Adventures in Lestoria Tests/Adventures in Lestoria Tests.cpp +++ b/Adventures in Lestoria Tests/Adventures in Lestoria Tests.cpp @@ -30,7 +30,7 @@ namespace MonsterTests ItemInfo::InitializeItems(); testGame->InitializePlayer(); Stats::InitializeDamageReductionTable(); - MonsterData testMonsterData{"TestName","Test Monster",30,10,5,{MonsterDropData{"Health Potion",100.f,1,1}}}; + MonsterData testMonsterData{"TestName","Test Monster",30,10,5,{MonsterDropData{"Health Potion",100.f,1,1}},200.f}; MONSTER_DATA["TestName"]=testMonsterData; } void SetupMockMap(){ @@ -114,6 +114,36 @@ namespace MonsterTests testMonster.Hurt(testMonster.GetMaxHealth(),testMonster.OnUpperLevel(),testMonster.GetZ()); Assert::AreEqual(size_t(1),ItemDrop::GetDrops().size()); } + TEST_METHOD(MoveSpdSetCorrectly){ + Monster testMonster{{},MONSTER_DATA["TestName"]}; + Assert::AreEqual(2.f,testMonster.GetMoveSpdMult()); + } + TEST_METHOD(SlowdownBuffTest){ + Monster testMonster{{},MONSTER_DATA["TestName"]}; + testMonster.AddBuff(BuffType::SLOWDOWN,5.f,0.5f); + Assert::AreEqual(1.f,testMonster.GetMoveSpdMult()); + } + TEST_METHOD(SelfInflictedSlowdownTest){ + Monster testMonster{{},MONSTER_DATA["TestName"]}; + testMonster.AddBuff(BuffType::SELF_INFLICTED_SLOWDOWN,5.f,0.5f); + Assert::AreEqual(1.f,testMonster.GetMoveSpdMult()); + } + TEST_METHOD(SpeedBoostTest){ + Monster testMonster{{},MONSTER_DATA["TestName"]}; + testMonster.AddBuff(BuffType::SPEEDBOOST,5.f,0.5f); + Assert::AreEqual(3.f,testMonster.GetMoveSpdMult()); + } + TEST_METHOD(LockOnSpeedBoostTest){ + Monster testMonster{{},MONSTER_DATA["TestName"]}; + testMonster.AddBuff(BuffType::LOCKON_SPEEDBOOST,5.f,0.5f); + Assert::AreEqual(3.f,testMonster.GetMoveSpdMult()); + } + TEST_METHOD(AdditiveMoveSpdBuffsTest){ + Monster testMonster{{},MONSTER_DATA["TestName"]}; + testMonster.AddBuff(BuffType::SLOWDOWN,5.f,0.5f); + testMonster.AddBuff(BuffType::SPEEDBOOST,5.f,0.75f); + Assert::AreEqual(2.5f,testMonster.GetMoveSpdMult()); + } }; } diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index 626d74f9..c49e99ed 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -85,6 +85,7 @@ public: const int GetHealth()const; const int GetMaxHealth()const; int GetAttack(); + //This function returns the multiplier for the movespd from the base spd. So 100 movespd is 1.0. float GetMoveSpdMult(); //Obtains the size multiplier (from 0.f-1.f). float GetSizeMult()const; diff --git a/Adventures in Lestoria/MonsterData.h b/Adventures in Lestoria/MonsterData.h index b6ba4621..c379dc23 100644 --- a/Adventures in Lestoria/MonsterData.h +++ b/Adventures in Lestoria/MonsterData.h @@ -63,7 +63,7 @@ struct MonsterDropData{ struct MonsterData{ public: MonsterData(); - MonsterData(std::string name,std::string displayName,int hp,int atk,const uint32_t xp,std::vectordrops,float moveSpd=1.0f,float size=1.0f,std::string strategy="Run Towards",int collisionDmg=0); + MonsterData(std::string name,std::string displayName,int hp,int atk,const uint32_t xp,std::vectordrops,float moveSpd=100.f,float size=1.0f,std::string strategy="Run Towards",int collisionDmg=0); int GetHealth(); int GetAttack(); const uint32_t GetXP()const; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5190bd49..cb67ecc0 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 9787 +#define VERSION_BUILD 9790 #define stringify(a) stringify_(a) #define stringify_(a) #a