Add in Monster Unit tests verifying move speed is adjusted properly.

mac-build
sigonasr2 5 months ago
parent b617120867
commit f1fa126d1e
  1. 32
      Adventures in Lestoria Tests/Adventures in Lestoria Tests.cpp
  2. 1
      Adventures in Lestoria/Monster.h
  3. 2
      Adventures in Lestoria/MonsterData.h
  4. 2
      Adventures in Lestoria/Version.h

@ -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());
}
};
}

@ -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;

@ -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::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 GetAttack();
const uint32_t GetXP()const;

@ -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

Loading…
Cancel
Save