From fecc001140cda7748b7516f17d8add2811f5f81d Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 7 Jul 2024 09:41:46 -0500 Subject: [PATCH] Fix bug where move spd % set bonus effect applied two times in a row. 56/56 tests passing. Release Build 9923. --- Adventures in Lestoria Tests/PlayerTests.cpp | 8 ++++++++ Adventures in Lestoria/Player.cpp | 1 - Adventures in Lestoria/Version.h | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Adventures in Lestoria Tests/PlayerTests.cpp b/Adventures in Lestoria Tests/PlayerTests.cpp index b389292b..889b8614 100644 --- a/Adventures in Lestoria Tests/PlayerTests.cpp +++ b/Adventures in Lestoria Tests/PlayerTests.cpp @@ -354,5 +354,13 @@ namespace PlayerTests const int enhancedDamageDealt{testMonster.GetMaxHealth()-testMonster.GetHealth()}; Assert::AreEqual(enhancedDamageDealt,damageDealt*5,L"Original damage dealt should be half of the new attack. Factor in 100% crit rate and a bonus 100% crit dmg (making it 250%) 200%*2.5=500% damage."); } + TEST_METHOD(MoveSpdPctStatEquipCheck){ + std::weak_ptrsetArmor{Inventory::AddItem("Test Armor2"s)}; + + Assert::AreEqual(1.f,player->GetMoveSpdMult(),L"Move Spd is 100%"); + + Inventory::EquipItem(setArmor,EquipSlot::ARMOR); + Assert::AreEqual(2.f,player->GetMoveSpdMult(),L"100% Move Spd should double the move speed from 100% to 200%"); + } }; } diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 674c3bdf..e92142ee 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -277,7 +277,6 @@ const int Player::GetDefense()const{ float Player::GetMoveSpdMult(){ float moveSpdPct=GetEquipStat("Move Spd %")/100.f; float mod_moveSpd=moveSpdPct; - mod_moveSpd+=GetBonusStat("Move Spd %"); for(const Buff&b:GetBuffs(BuffType::SLOWDOWN)){ mod_moveSpd-=moveSpdPct*b.intensity; } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 21ac0996..c86b03d4 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 9922 +#define VERSION_BUILD 9923 #define stringify(a) stringify_(a) #define stringify_(a) #a