From b2ae457feb91ca3d630922c8d7e457541e5d010c Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 8 Jul 2024 10:48:00 -0500 Subject: [PATCH] Finish all player set effect equipment tests. 87/87 tests passing. --- Adventures in Lestoria Tests/PlayerTests.cpp | 78 ++++++++++++++++++++ Adventures in Lestoria/Version.h | 2 +- 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/Adventures in Lestoria Tests/PlayerTests.cpp b/Adventures in Lestoria Tests/PlayerTests.cpp index 94da90fd..5dc53a0b 100644 --- a/Adventures in Lestoria Tests/PlayerTests.cpp +++ b/Adventures in Lestoria Tests/PlayerTests.cpp @@ -429,15 +429,93 @@ namespace PlayerTests Inventory::EquipItem(setArmor,EquipSlot::ARMOR); Assert::AreEqual(1.f,player->GetCooldownReductionPct(),L"Player should have 100% CDR"); testKey->bHeld=true; //Force the key to be held down for testing purposes. + player->CheckAndPerformAbility(player->GetRightClickAbility(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility1(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput); player->CheckAndPerformAbility(player->GetAbility4(),testKeyboardInput); + game->SetElapsedTime(0.01f); //Force elapsed time value. game->OnUserUpdate(0.01f); //Let 0.01 seconds go by. All abilities should be off cooldown. + Assert::AreEqual(0.f,player->GetRightClickAbility().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); //Defensive is currently not affected by CDR. Assert::AreEqual(0.f,player->GetAbility1().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility2().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility3().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); Assert::AreEqual(0.f,player->GetAbility4().cooldown,L"Using an ability with 100% CDR should result in a 0 second cooldown."); } + TEST_METHOD(CritRateStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor2"s)}; + + Assert::AreEqual(0.f,player->GetCritRatePct(),L"Crit Rate is 0%"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(1.f,player->GetCritRatePct(),L"Player should have 100% Crit Rate"); + } + TEST_METHOD(CritDmgStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor2"s)}; + + Assert::AreEqual(0.5f,player->GetCritDmgPct(),L"Crit Damage is 50%"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(1.5f,player->GetCritDmgPct(),L"Player should have 150% Crit Damage"); + } + TEST_METHOD(HealthPctStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor2"s)}; + + Assert::AreEqual(100,player->GetHealth(),L"Current Health is 100"); + Assert::AreEqual(100,player->GetMaxHealth(),L"Max Health is 100"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(100,player->GetHealth(),L"Current Health is still 100"); + Assert::AreEqual(200,player->GetMaxHealth(),L"Max Health is now 200"); + } + TEST_METHOD(HP6RecoveryStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor2"s)}; + + Assert::AreEqual(0.0_Pct,player->GetHP6RecoveryPct(),L"HP6 Recovery % is 0"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(100.0_Pct,player->GetHP6RecoveryPct(),L"HP6 Recovery % is 100%"); + } + TEST_METHOD(HP4RecoveryStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor3"s)}; + + Assert::AreEqual(0.0_Pct,player->GetHP4RecoveryPct(),L"HP4 Recovery % is 0"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(100.0_Pct,player->GetHP4RecoveryPct(),L"HP4 Recovery % is 100%"); + } + TEST_METHOD(DamageReductionStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor3"s)}; + Assert::AreEqual(0.0_Pct,player->GetDamageReductionPct(),L"Damage Reduction is 0%"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(100.0_Pct,player->GetDamageReductionPct(),L"Damage Reduction is 100%"); + } + TEST_METHOD(HPRecoveryStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor4"s)}; + + Assert::AreEqual(0.0_Pct,player->GetHPRecoveryPct(),L"HP Recovery % is 0"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(100.0_Pct,player->GetHPRecoveryPct(),L"HP Recovery % is 100%"); + } + TEST_METHOD(AttackSpeedStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor4"s)}; + + Assert::AreEqual(0.f,player->GetAttackRecoveryRateReduction(),L"Attack Speed Reduction is 0 seconds"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(50.f,player->GetAttackRecoveryRateReduction(),L"Attack Speed Reduction is 50 seconds"); + } + TEST_METHOD(ManaStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor4"s)}; + + Assert::AreEqual(100,player->GetMana(),L"Mana is 100"); + Assert::AreEqual(100,player->GetMaxMana(),L"Max Mana is 100"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(100,player->GetMana(),L"Mana is still 100"); + Assert::AreEqual(200,player->GetMaxMana(),L"Max Mana is now 200"); + } }; } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 07169f43..f36165f5 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 3 -#define VERSION_BUILD 9937 +#define VERSION_BUILD 9940 #define stringify(a) stringify_(a) #define stringify_(a) #a