From 6410d837c7435dde2aa083118ea5e4522f76cb6c Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 25 Jun 2024 17:10:39 -0500 Subject: [PATCH] Player Equipment set effect tests added. --- Adventures in Lestoria Tests/PlayerTests.cpp | 44 ++++++++++++++++++++ Adventures in Lestoria/Player.cpp | 8 +++- Adventures in Lestoria/Version.h | 2 +- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/Adventures in Lestoria Tests/PlayerTests.cpp b/Adventures in Lestoria Tests/PlayerTests.cpp index d38abec5..aad13e32 100644 --- a/Adventures in Lestoria Tests/PlayerTests.cpp +++ b/Adventures in Lestoria Tests/PlayerTests.cpp @@ -161,5 +161,49 @@ namespace PlayerTests player->Hurt(30,player->OnUpperLevel(),player->GetZ()); Assert::AreEqual(74,player->GetHealth()); //Even though we are supposed to take 30 damage, damage reduction reduces it to 26 instead. (Random variance is controlled during testing. If this number changes at some point, either the damage formula or the item's stats have changed!) } + TEST_METHOD(PlayerSetEffectsAcknowledged){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor"s)}; + setArmor.lock()->enhancementLevel="Item.Item Max Enhancement Level"_I; //Force enhance the item to the max enhancement level. + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + + //This gear is supposed to be provide an additional 100 defense, 1000 health, and 100 attack. + Assert::AreEqual(100.f+player->GetBaseStat("Defense"),player->GetStat("Defense")); + Assert::AreEqual(100.f+player->GetBaseStat("Attack"),player->GetStat("Attack")); + Assert::AreEqual(1000.f+player->GetBaseStat("Health"),player->GetStat("Health")); + } + TEST_METHOD(PlayerSetEffectsAcknowledged2){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor2"s)}; + setArmor.lock()->enhancementLevel="Item.Item Max Enhancement Level"_I; //Force enhance the item to the max enhancement level. + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + + //This gear is supposed to be provide an additional 100 defense, 1000 health, and 100 attack. + Assert::AreEqual(100.f+player->GetBaseStat("Defense %"),player->GetStat("Defense %")); + Assert::AreEqual(100.f+player->GetBaseStat("Attack %"),player->GetStat("Attack %")); + Assert::AreEqual(100.f+player->GetBaseStat("Move Spd %"),player->GetStat("Move Spd %")); + Assert::AreEqual(100.f+player->GetBaseStat("CDR"),player->GetStat("CDR")); + Assert::AreEqual(100.f+player->GetBaseStat("Crit Rate"),player->GetStat("Crit Rate")); + Assert::AreEqual(100.f+player->GetBaseStat("Crit Dmg"),player->GetStat("Crit Dmg")); + Assert::AreEqual(100.f+player->GetBaseStat("Health %"),player->GetStat("Health %")); + Assert::AreEqual(100.f+player->GetBaseStat("HP6 Recovery %"),player->GetStat("HP6 Recovery %")); + } + TEST_METHOD(PlayerSetEffectsAcknowledged3){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor3"s)}; + setArmor.lock()->enhancementLevel="Item.Item Max Enhancement Level"_I; //Force enhance the item to the max enhancement level. + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + + //This gear is supposed to be provide an additional 100 defense, 1000 health, and 100 attack. + Assert::AreEqual(100.f+player->GetBaseStat("HP4 Recovery %"),player->GetStat("HP4 Recovery %")); + Assert::AreEqual(100.f+player->GetBaseStat("Damage Reduction"),player->GetStat("Damage Reduction")); + } + TEST_METHOD(PlayerSetEffectsAcknowledged4){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor4"s)}; + setArmor.lock()->enhancementLevel="Item.Item Max Enhancement Level"_I; //Force enhance the item to the max enhancement level. + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + + //This gear is supposed to be provide an additional 100 defense, 1000 health, and 100 attack. + Assert::AreEqual(100.f+player->GetBaseStat("HP Recovery %"),player->GetStat("HP Recovery %")); + Assert::AreEqual(50.f+player->GetBaseStat("Attack Spd"),player->GetStat("Attack Spd")); + Assert::AreEqual(100.f+player->GetBaseStat("Mana"),player->GetStat("Mana")); + } }; } diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index f21b5df4..99b3f717 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -98,8 +98,8 @@ Player::Player(Player*player) void Player::Initialize(){ Player::GROUND_SLAM_SPIN_TIME="Warrior.Ability 2.SpinTime"_F; - SetBaseStat("Health",hp); - SetBaseStat("Mana",mana); + SetBaseStat("Health","Warrior.BaseHealth"_I); + SetBaseStat("Mana","Player.BaseMana"_I); SetBaseStat("Defense",0); SetBaseStat("Attack","Warrior.BaseAtk"_I); SetBaseStat("Move Spd %",100); @@ -108,6 +108,10 @@ void Player::Initialize(){ SetBaseStat("Crit Dmg","Player.Crit Dmg"_F); SetBaseStat("Health %",0); SetBaseStat("HP6 Recovery %",0); + SetBaseStat("HP4 Recovery %",0); + SetBaseStat("HP Recovery %",0); + SetBaseStat("Damage Reduction",0); + SetBaseStat("Attack Spd",0); cooldownSoundInstance=Audio::Engine().LoadSound("spell_cast.ogg"_SFX); } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index e67c1b37..49f0b388 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 9849 +#define VERSION_BUILD 9851 #define stringify(a) stringify_(a) #define stringify_(a) #a