Add in Monster Unit tests verifying move speed is adjusted properly.
This commit is contained in:
parent
b617120867
commit
f1fa126d1e
@ -30,7 +30,7 @@ namespace MonsterTests
|
|||||||
ItemInfo::InitializeItems();
|
ItemInfo::InitializeItems();
|
||||||
testGame->InitializePlayer();
|
testGame->InitializePlayer();
|
||||||
Stats::InitializeDamageReductionTable();
|
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;
|
MONSTER_DATA["TestName"]=testMonsterData;
|
||||||
}
|
}
|
||||||
void SetupMockMap(){
|
void SetupMockMap(){
|
||||||
@ -114,6 +114,36 @@ namespace MonsterTests
|
|||||||
testMonster.Hurt(testMonster.GetMaxHealth(),testMonster.OnUpperLevel(),testMonster.GetZ());
|
testMonster.Hurt(testMonster.GetMaxHealth(),testMonster.OnUpperLevel(),testMonster.GetZ());
|
||||||
Assert::AreEqual(size_t(1),ItemDrop::GetDrops().size());
|
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());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ public:
|
|||||||
const int GetHealth()const;
|
const int GetHealth()const;
|
||||||
const int GetMaxHealth()const;
|
const int GetMaxHealth()const;
|
||||||
int GetAttack();
|
int GetAttack();
|
||||||
|
//This function returns the multiplier for the movespd from the base spd. So 100 movespd is 1.0.
|
||||||
float GetMoveSpdMult();
|
float GetMoveSpdMult();
|
||||||
//Obtains the size multiplier (from 0.f-1.f).
|
//Obtains the size multiplier (from 0.f-1.f).
|
||||||
float GetSizeMult()const;
|
float GetSizeMult()const;
|
||||||
|
@ -63,7 +63,7 @@ struct MonsterDropData{
|
|||||||
struct MonsterData{
|
struct MonsterData{
|
||||||
public:
|
public:
|
||||||
MonsterData();
|
MonsterData();
|
||||||
MonsterData(std::string name,std::string displayName,int hp,int atk,const uint32_t xp,std::vector<MonsterDropData>drops,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::vector<MonsterDropData>drops,float moveSpd=100.f,float size=1.0f,std::string strategy="Run Towards",int collisionDmg=0);
|
||||||
int GetHealth();
|
int GetHealth();
|
||||||
int GetAttack();
|
int GetAttack();
|
||||||
const uint32_t GetXP()const;
|
const uint32_t GetXP()const;
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 9787
|
#define VERSION_BUILD 9790
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user