Last Reserve enchant implemented. Release Build 10798.

mac-build
sigonasr2 4 months ago
parent 333acfe149
commit 859ff52ac2
  1. 17
      Adventures in Lestoria Tests/EnchantTests.cpp
  2. 8
      Adventures in Lestoria/AdventuresInLestoria.cpp
  3. 11
      Adventures in Lestoria/Player.cpp
  4. 1
      Adventures in Lestoria/Player.h
  5. 2
      Adventures in Lestoria/Version.h
  6. BIN
      x64/Release/Adventures in Lestoria.exe

@ -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_ptr<Item>nullRing{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%");
}
};
}

@ -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

@ -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;
}

@ -381,6 +381,7 @@ private:
float daggerThrowWaitTimer{INFINITY};
std::unordered_set<std::string>enchantList;
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;

@ -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

Loading…
Cancel
Save