Fix health display on equipment menu to show max health instead of current health. Fix health values being reduced due to temporary unequips when hovering over items. Release Build 7887.

pull/35/head
sigonasr2 9 months ago
parent 5992adbc5f
commit 72f4693cfc
  1. 11
      Adventures in Lestoria/CharacterMenuWindow.cpp
  2. 4
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Player.h
  4. 2
      Adventures in Lestoria/Version.h
  5. BIN
      x64/Release/Adventures in Lestoria.exe

@ -74,7 +74,7 @@ void Menu::InitializeCharacterMenuWindow(){
};
const static std::array<AttributeData,7>displayAttrs{
AttributeData{"Health",[&]()->int{return game->GetPlayer()->GetHealth();}},
AttributeData{"Health",[&]()->int{return game->GetPlayer()->GetMaxHealth();}},
AttributeData{"Attack",[&]()->int{return game->GetPlayer()->GetAttack();}},
AttributeData{"Defense",[&]()->int{return game->GetPlayer()->GetStat("Defense");}},
AttributeData{"Move Spd %",[&]()->int{return ceil(game->GetPlayer()->GetMoveSpdMult()*100);}},
@ -194,11 +194,14 @@ void Menu::InitializeCharacterMenuWindow(){
statsBeforeEquip.push_back(attribute.calcFunc());
}
int healthBeforeEquip=game->GetPlayer()->GetHealth();
int manaBeforeEquip=game->GetPlayer()->GetMana();
std::weak_ptr<Item>equippedItem=Inventory::GetEquip(slot);
std::weak_ptr<Item>otherItem;
if(slot==EquipSlot::RING1)otherItem=Inventory::GetEquip(EquipSlot::RING2);
if(slot&EquipSlot::RING1)otherItem=Inventory::GetEquip(EquipSlot::RING2);
else
if(slot==EquipSlot::RING2)otherItem=Inventory::GetEquip(EquipSlot::RING1);
if(slot&EquipSlot::RING2)otherItem=Inventory::GetEquip(EquipSlot::RING1);
if(OppositeRingSlotDoesNotMatchCurrentEquip(button.lock())){ //If we find that the opposite ring slot is equipped to us, this would be an item swap or the exact same ring, therefore no stat calculations apply.
Inventory::EquipItem(buttonItem,slot);
for(int counter=0;const AttributeData&attribute:displayAttrs){
@ -210,6 +213,8 @@ void Menu::InitializeCharacterMenuWindow(){
Inventory::UnequipItem(slot);
if(!ISBLANK(equippedItem)){
Inventory::EquipItem(equippedItem,slot);
game->GetPlayer()->Heal(healthBeforeEquip-game->GetPlayer()->GetHealth(),true);
game->GetPlayer()->RestoreMana(manaBeforeEquip-game->GetPlayer()->GetMana(),true);
}
if(!ISBLANK(otherItem)){
if(slot==EquipSlot::RING1)Inventory::EquipItem(otherItem,EquipSlot::RING2);

@ -987,9 +987,9 @@ void Player::SetIframes(float duration){
iframe_time=duration;
}
bool Player::Heal(int damage){
bool Player::Heal(int damage,bool suppressDamageNumber){
hp=std::clamp(hp+damage,0,int(GetStat("Health")));
if(damage>0){
if(!suppressDamageNumber&&damage>0){
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(GetPos(),damage,true,HEALTH_GAIN));
}
return true;

@ -175,7 +175,7 @@ public:
bool Hurt(int damage,bool onUpperLevel,float z);
//Return false if healing was not possible.
bool Heal(int damage);
bool Heal(int damage,bool suppressDamageNumber=false);
//specificClass is a bitwise-combination of classes from the Class enum. It makes sure certain animations only play if you are a certain class.
void UpdateAnimation(std::string animState,int specificClass=ANY);
Animate2D::Frame GetFrame();

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 4
#define VERSION_PATCH 4
#define VERSION_BUILD 7886
#define VERSION_BUILD 7887
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save