From ce445c7d410d2a61e49ae0e1cd8d281078b1a30c Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 7 Jul 2024 08:35:01 -0500 Subject: [PATCH] Monster tests to ensure Health % and Attack % modifiers work properly. 55/55 tests passing. --- Adventures in Lestoria Tests/MonsterTests.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Adventures in Lestoria Tests/MonsterTests.cpp b/Adventures in Lestoria Tests/MonsterTests.cpp index 8c1067bd..8c4bcb66 100644 --- a/Adventures in Lestoria Tests/MonsterTests.cpp +++ b/Adventures in Lestoria Tests/MonsterTests.cpp @@ -149,6 +149,23 @@ namespace MonsterTests Assert::AreEqual(game->GetPlayer()->GetMaxHealth()-15,game->GetPlayer()->GetHealth(),L"Player Health is now 85."); Assert::AreEqual(testMonster2.GetMaxHealth()-15,testMonster2.GetHealth(),L"Monster Health is now 15."); } + TEST_METHOD(HealthUpModifierWorks){ + Monster buffMonster{{},MONSTER_DATA["TestName"]}; + buffMonster.AddBuff(BuffType::STAT_UP,5,5.f,{"Health"}); + + Assert::AreEqual(35,buffMonster.GetMaxHealth(),L"Monster Max Health is now 35."); + Assert::AreEqual(30,buffMonster.GetHealth(),L"Monster Current Health is still 30."); + } + TEST_METHOD(AttackUpPctModifierWorks){ + Monster buffMonster{{},MONSTER_DATA["TestName"]}; + buffMonster.AddBuff(BuffType::STAT_UP,5,100.0_Pct,{"Attack %"}); + + Monster testMonster2{{},MONSTER_DATA["TestName"]}; + game->GetPlayer()->Hurt(buffMonster.GetAttack(),buffMonster.OnUpperLevel(),buffMonster.GetZ()); + testMonster2.Hurt(buffMonster.GetAttack(),buffMonster.OnUpperLevel(),buffMonster.GetZ()); + Assert::AreEqual(game->GetPlayer()->GetMaxHealth()-20,game->GetPlayer()->GetHealth(),L"Player Health is now 80."); + Assert::AreEqual(testMonster2.GetMaxHealth()-20,testMonster2.GetHealth(),L"Monster Health is now 10."); + } TEST_METHOD(MonsterIsConsideredDeadAt0Health){ Monster testMonster{{},MONSTER_DATA["TestName"]}; testMonster.Hurt(testMonster.GetMaxHealth(),testMonster.OnUpperLevel(),testMonster.GetZ());