Cleanup and fixes to buff tests.

pull/65/head
sigonasr2 3 months ago
parent bcaed9aed5
commit fd1a7a6597
  1. 16
      Adventures in Lestoria Tests/BuffTests.cpp
  2. 4
      Adventures in Lestoria Tests/EnchantTests.cpp
  3. 4
      Adventures in Lestoria/Monster.cpp
  4. 2
      Adventures in Lestoria/TrailEffect.h
  5. 2
      Adventures in Lestoria/Version.h

@ -53,11 +53,6 @@ INCLUDE_DAMAGENUMBER_LIST
INCLUDE_MONSTER_LIST
INCLUDE_INITIALIZEGAMECONFIGURATIONS
TEST_MODULE_INITIALIZE(AiLTestSuite)
{
debugLogger.open("debug.log");
}
namespace BuffTests
{
TEST_CLASS(BuffTest)
@ -103,7 +98,7 @@ namespace BuffTests
}
#pragma endregion
TEST_METHOD_INITIALIZE(MonsterInitialize){
TEST_METHOD_INITIALIZE(BuffInitialize){
SetupTestMonster();
SetupMockMap();
}
@ -116,8 +111,17 @@ namespace BuffTests
Assert::AreEqual(size_t(0),m.GetBuffs(BuffType::AFFECTED_BY_LIGHTNING_BOLT).size(),L"Monsters do not have any lightning bolt affected buffs when spawning.");
m.AddBuff(BuffType::AFFECTED_BY_LIGHTNING_BOLT,3.f,1,[](std::weak_ptr<Monster>attachedTarget,Buff&b){attachedTarget.lock()->Hurt(5,attachedTarget.lock()->OnUpperLevel(),attachedTarget.lock()->GetZ());});
Assert::AreEqual(size_t(1),m.GetBuffs(BuffType::AFFECTED_BY_LIGHTNING_BOLT).size(),L"Monster now has Affected By Lightning Bolt buff. Should get hurt for 5 damage in 3 seconds...");
Game::Update(0.f);
Game::Update(3.f);
Assert::AreEqual(25,m.GetHealth(),L"Monster should have taken 5 health from the expired callback provided.");
}
TEST_METHOD(AddBuffPlayerCallbackExpireFunctionTest){
Assert::AreEqual(size_t(0),game->GetPlayer()->GetBuffs(BuffType::AFFECTED_BY_LIGHTNING_BOLT).size(),L"Player does not have any lightning bolt affected buffs when spawning.");
game->GetPlayer()->AddBuff(BuffType::AFFECTED_BY_LIGHTNING_BOLT,3.f,1,[](Player*attachedTarget,Buff&b){attachedTarget->Hurt(5,attachedTarget->OnUpperLevel(),attachedTarget->GetZ());});
Assert::AreEqual(size_t(1),game->GetPlayer()->GetBuffs(BuffType::AFFECTED_BY_LIGHTNING_BOLT).size(),L"Player is now affected By Lightning Bolt buff. Should get hurt for 5 damage in 3 seconds...");
Game::Update(0.f);
Game::Update(3.f);
Assert::AreEqual(95,game->GetPlayer()->GetHealth(),L"Player should have taken 5 health from the expired callback provided.");
}
};
}

@ -1225,13 +1225,13 @@ namespace EnchantTests
Game::Update(0.f);
Assert::AreEqual(size_t(1),game->GetBackgroundEffects().size(),L"There should be a background effect (i.e. the Black Hole).");
}
TEST_METHOD(FireBoltNoEnchantCheck){
TEST_METHOD(TrailOfFireNoEnchantCheck){
Game::ChangeClass(player,WIZARD);
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);
Game::Update(0.5f);
Assert::AreEqual(size_t(0),game->GetEffect(EffectType::TRAIL_OF_FIRE).size(),L"Trail of Fire should not be generated.");
}
TEST_METHOD(FireBoltEnchantCheck){
TEST_METHOD(TrailOfFireEnchantCheck){
Game::ChangeClass(player,WIZARD);
Game::GiveAndEquipEnchantedRing("Trail of Fire");
player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput);

@ -880,11 +880,11 @@ void Monster::AddBuff(BuffType type,float duration,float intensity,Buff::Monster
}
void Monster::AddBuff(BuffType type,BuffRestorationType restorationType,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks){
if(type==STAT_UP)ERR("WARNING! Incorrect usage of STAT_UP buff! It should not be an overtime buff! Use a different consutrctor!!!");
if(type==STAT_UP)ERR("WARNING! Incorrect usage of STAT_UP buff! It should not be an overtime buff! Use a different constructor!!!");
buffList.emplace_back(GetWeakPointer(),type,restorationType,overTimeType,duration,intensity,timeBetweenTicks);
}
void Monster::AddBuff(BuffType type,BuffRestorationType restorationType,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks,Buff::MonsterBuffExpireCallbackFunction expireCallback){
if(type==STAT_UP)ERR("WARNING! Incorrect usage of STAT_UP buff! It should not be an overtime buff! Use a different consutrctor!!!");
if(type==STAT_UP)ERR("WARNING! Incorrect usage of STAT_UP buff! It should not be an overtime buff! Use a different constructor!!!");
buffList.emplace_back(GetWeakPointer(),type,restorationType,overTimeType,duration,intensity,timeBetweenTicks,expireCallback);
}

@ -77,7 +77,7 @@ struct TrailEffect:Effect{
vf2d flameTrailSize{flameTrailLine.length(),float(GetFrame().GetSourceImage()->Sprite()->height)};
flameTrailSize*=size;
const auto PixelToUVSpace=[this,&flameTrailSize](vf2d pixelPos){
const auto PixelToUVSpace=[this](vf2d pixelPos){
pixelPos.x+=imageXOffset;
return pixelPos/GetFrame().GetSourceImage()->Sprite()->Size()/size;
};

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 5
#define VERSION_BUILD 11330
#define VERSION_BUILD 11332
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save