diff --git a/Adventures in Lestoria Tests/BuffTests.cpp b/Adventures in Lestoria Tests/BuffTests.cpp index 68f20364..5fe95ace 100644 --- a/Adventures in Lestoria Tests/BuffTests.cpp +++ b/Adventures in Lestoria Tests/BuffTests.cpp @@ -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_ptrattachedTarget,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."); + } }; } \ No newline at end of file diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index 29d4032c..d5a04b78 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -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); diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 8cb42770..9b11f790 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -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); } diff --git a/Adventures in Lestoria/TrailEffect.h b/Adventures in Lestoria/TrailEffect.h index c75dda06..e088d785 100644 --- a/Adventures in Lestoria/TrailEffect.h +++ b/Adventures in Lestoria/TrailEffect.h @@ -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; }; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index fb9d58ca..411e3d62 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 5 -#define VERSION_BUILD 11330 +#define VERSION_BUILD 11332 #define stringify(a) stringify_(a) #define stringify_(a) #a