Fix bug where move spd % set bonus effect applied two times in a row. 56/56 tests passing. Release Build 9923.

mac-build
sigonasr2 5 months ago
parent ce445c7d41
commit fecc001140
  1. 8
      Adventures in Lestoria Tests/PlayerTests.cpp
  2. 1
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Version.h

@ -354,5 +354,13 @@ namespace PlayerTests
const int enhancedDamageDealt{testMonster.GetMaxHealth()-testMonster.GetHealth()}; 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."); 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_ptr<Item>setArmor{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%");
}
}; };
} }

@ -277,7 +277,6 @@ const int Player::GetDefense()const{
float Player::GetMoveSpdMult(){ float Player::GetMoveSpdMult(){
float moveSpdPct=GetEquipStat("Move Spd %")/100.f; float moveSpdPct=GetEquipStat("Move Spd %")/100.f;
float mod_moveSpd=moveSpdPct; float mod_moveSpd=moveSpdPct;
mod_moveSpd+=GetBonusStat("Move Spd %");
for(const Buff&b:GetBuffs(BuffType::SLOWDOWN)){ for(const Buff&b:GetBuffs(BuffType::SLOWDOWN)){
mod_moveSpd-=moveSpdPct*b.intensity; mod_moveSpd-=moveSpdPct*b.intensity;
} }

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 3 #define VERSION_PATCH 3
#define VERSION_BUILD 9922 #define VERSION_BUILD 9923
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save