diff --git a/Adventures in Lestoria/CharacterMenuWindow.cpp b/Adventures in Lestoria/CharacterMenuWindow.cpp index 8f43ab8d..7e4f916e 100644 --- a/Adventures in Lestoria/CharacterMenuWindow.cpp +++ b/Adventures in Lestoria/CharacterMenuWindow.cpp @@ -74,7 +74,7 @@ void Menu::InitializeCharacterMenuWindow(){ }; const static std::arraydisplayAttrs{ - 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_ptrequippedItem=Inventory::GetEquip(slot); std::weak_ptrotherItem; - 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); diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index f156f76b..3fb0e643 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -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(GetPos(),damage,true,HEALTH_GAIN)); } return true; diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 17ca94e3..d27c26bd 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -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(); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 2b276165..868f521c 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -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 diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 150656b3..ce6ce0a3 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ