diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index 7192f64b..9c606ed7 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -477,7 +477,22 @@ namespace EnchantTests Assert::AreEqual(player->GetAbility2().GetCooldownTime()-2.5f,player->GetAbility2().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same."); Assert::AreEqual(player->GetAbility3().GetCooldownTime()-1.f,player->GetAbility3().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same."); Assert::AreEqual(player->GetAbility4().GetCooldownTime(),player->GetAbility4().cooldown,L"Ability 4 isn't setup for anything and returns as unused, causing cooldowns to remain the same."); - + } + TEST_METHOD(LastReserveCheck){ + player->SetBaseStat("Attack",100.f); + Assert::AreEqual(0.0_Pct,player->GetDamageReductionPct(),L"Damage reduction starts at 0%"); + Assert::AreEqual(100,player->GetAttack(),L"Attack damage starts at 100."); + Assert::AreEqual(0.0_Pct,player->GetCooldownReductionPct(),L"Cooldown reduction starts at 0%"); + std::weak_ptrnullRing{Inventory::AddItem("Null Ring"s)}; + Inventory::EquipItem(nullRing,EquipSlot::RING1); + nullRing.lock()->EnchantItem("Last Reserve"); + Assert::AreEqual(0.0_Pct,player->GetDamageReductionPct(),L"Damage reduction is still 0%"); + Assert::AreEqual(100,player->GetAttack(),L"Attack damage still 100."); + Assert::AreEqual(0.0_Pct,player->GetCooldownReductionPct(),L"Cooldown reduction is still 0%"); + player->Hurt(80,player->OnUpperLevel(),player->GetZ()); + Assert::AreEqual(30.0_Pct,player->GetDamageReductionPct(),L"Damage reduction increased to 30%"); + Assert::AreEqual(110,player->GetAttack(),L"Attack damage is now 110."); + Assert::AreEqual(10.0_Pct,player->GetCooldownReductionPct(),L"Cooldown reduction increased to 10%"); } }; } \ No newline at end of file diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 57752ca7..695d392e 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1535,8 +1535,8 @@ void AiL::RenderWorld(float fElapsedTime){ #ifdef _DEBUG if("debug_collision_boxes_snapping"_I){ if(fmod(tile->pos.x+collision.pos.x,1.f)!=0.f||fmod(tile->pos.y+collision.pos.y,1.f)!=0.f){ - view.DrawShadowStringPropDecal(tile->pos+collision.pos-vf2d{0,24},(tile->pos+collision.pos).str(),RED,BLACK,{0.5f,1.f},24.f); - view.DrawShadowStringPropDecal(tile->pos+collision.pos+vf2d{0,24},((tile->pos+collision.pos)+(collision.size)).str(),GREEN,BLACK,{0.5f,1.f},24.f); + view.DrawShadowStringPropDecal(tile->pos+collision.pos-vf2d{0,24},(tile->pos+collision.pos).str(),RED,BLACK,{0.5f,1.f},{0.5f,1.f},24.f); + view.DrawShadowStringPropDecal(tile->pos+collision.pos+vf2d{0,24},((tile->pos+collision.pos)+(collision.size)).str(),GREEN,BLACK,{0.5f,1.f},{0.5f,1.f},24.f); } } #endif @@ -1595,8 +1595,8 @@ void AiL::RenderWorld(float fElapsedTime){ #ifdef _DEBUG if("debug_collision_boxes_snapping"_I){ if(fmod(tile->pos.x+collision.pos.x,1.f)!=0.f||fmod(tile->pos.y+collision.pos.y,1.f)!=0.f){ - view.DrawShadowStringPropDecal(tile->pos+collision.pos-vf2d{0,24},(tile->pos+collision.pos).str(),RED,BLACK,{0.5f,1.f},24.f); - view.DrawShadowStringPropDecal(tile->pos+collision.pos+vf2d{0,24},((tile->pos+collision.pos)+(collision.size)).str(),GREEN,BLACK,{0.5f,1.f},24.f); + view.DrawShadowStringPropDecal(tile->pos+collision.pos-vf2d{0,24},(tile->pos+collision.pos).str(),RED,BLACK,{0.5f,1.f},{0.5f,1.f},24.f); + view.DrawShadowStringPropDecal(tile->pos+collision.pos+vf2d{0,24},((tile->pos+collision.pos)+(collision.size)).str(),GREEN,BLACK,{0.5f,1.f},{0.5f,1.f},24.f); } } #endif diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 4ce042d9..a1a5c910 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -270,7 +270,9 @@ const int Player::GetMaxMana()const{ } const int Player::GetAttack()const{ - return int(GetModdedStatBonuses("Attack")); + int finalAtk{int(round(GetModdedStatBonuses("Attack")))}; + finalAtk+=LastReserveEnchantConditionsMet()?round(GetBaseStat("Attack")*"Last Reserve"_ENC["ATTACK PCT"]/100.f):0; + return finalAtk; } const int Player::GetDefense()const{ @@ -1457,6 +1459,7 @@ const float Player::GetCooldownReductionPct()const{ modCDRPct+=b.intensity; } modCDRPct+=GetEquipStat("CDR")/100; + modCDRPct+=LastReserveEnchantConditionsMet()?"Last Reserve"_ENC["COOLDOWN REDUCTION PCT"]/100.f:0.f; return modCDRPct; } @@ -1544,7 +1547,7 @@ void Player::PerformHPRecovery(){ const float Player::GetDamageReductionPct()const{ float modDmgReductionPct=0; modDmgReductionPct+=GetEquipStat("Damage Reduction")/100.f; - if(HasEnchant("Last Reserve"))modDmgReductionPct+="Last Reserve"_ENC["DAMAGE REDUCTION PCT"]/100.f; + if(LastReserveEnchantConditionsMet())modDmgReductionPct+="Last Reserve"_ENC["DAMAGE REDUCTION PCT"]/100.f; return modDmgReductionPct; } @@ -1942,4 +1945,8 @@ Ability&Player::GetItem2(){ } Ability&Player::GetItem3(){ return useItem3; +} + +const bool Player::LastReserveEnchantConditionsMet()const{ + return HasEnchant("Last Reserve")&&GetHealthRatio()<="Last Reserve"_ENC["HP BELOW THRESHOLD"]/100.f; } \ No newline at end of file diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 0dfaa25c..8367246d 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -381,6 +381,7 @@ private: float daggerThrowWaitTimer{INFINITY}; std::unordered_setenchantList; void OnAbilityUse(const Ability&ability); //Callback when an ability successfully is used and has gone on cooldown. + const bool LastReserveEnchantConditionsMet()const; protected: const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5b3cd184..c61972db 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 10793 +#define VERSION_BUILD 10798 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 72801fad..5a19cdf6 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ