@ -74,7 +74,7 @@ void Menu::InitializeCharacterMenuWindow(){
} ;
} ;
const static std : : array < AttributeData , 7 > displayAttrs {
const static std : : array < AttributeData , 7 > displayAttrs {
AttributeData { " Health " , [ & ] ( ) - > int { return game - > GetPlayer ( ) - > GetHealth ( ) ; } } ,
AttributeData { " Health " , [ & ] ( ) - > int { return game - > GetPlayer ( ) - > GetMax Health ( ) ; } } ,
AttributeData { " Attack " , [ & ] ( ) - > int { return game - > GetPlayer ( ) - > GetAttack ( ) ; } } ,
AttributeData { " Attack " , [ & ] ( ) - > int { return game - > GetPlayer ( ) - > GetAttack ( ) ; } } ,
AttributeData { " Defense " , [ & ] ( ) - > int { return game - > GetPlayer ( ) - > GetStat ( " Defense " ) ; } } ,
AttributeData { " Defense " , [ & ] ( ) - > int { return game - > GetPlayer ( ) - > GetStat ( " Defense " ) ; } } ,
AttributeData { " Move Spd % " , [ & ] ( ) - > int { return ceil ( game - > GetPlayer ( ) - > GetMoveSpdMult ( ) * 100 ) ; } } ,
AttributeData { " Move Spd % " , [ & ] ( ) - > int { return ceil ( game - > GetPlayer ( ) - > GetMoveSpdMult ( ) * 100 ) ; } } ,
@ -194,11 +194,14 @@ void Menu::InitializeCharacterMenuWindow(){
statsBeforeEquip . push_back ( attribute . calcFunc ( ) ) ;
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 > equippedItem = Inventory : : GetEquip ( slot ) ;
std : : weak_ptr < Item > otherItem ;
std : : weak_ptr < Item > otherItem ;
if ( slot = = EquipSlot : : RING1 ) otherItem = Inventory : : GetEquip ( EquipSlot : : RING2 ) ;
if ( slot & EquipSlot : : RING1 ) otherItem = Inventory : : GetEquip ( EquipSlot : : RING2 ) ;
else
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.
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 ) ;
Inventory : : EquipItem ( buttonItem , slot ) ;
for ( int counter = 0 ; const AttributeData & attribute : displayAttrs ) {
for ( int counter = 0 ; const AttributeData & attribute : displayAttrs ) {
@ -210,6 +213,8 @@ void Menu::InitializeCharacterMenuWindow(){
Inventory : : UnequipItem ( slot ) ;
Inventory : : UnequipItem ( slot ) ;
if ( ! ISBLANK ( equippedItem ) ) {
if ( ! ISBLANK ( equippedItem ) ) {
Inventory : : EquipItem ( equippedItem , slot ) ;
Inventory : : EquipItem ( equippedItem , slot ) ;
game - > GetPlayer ( ) - > Heal ( healthBeforeEquip - game - > GetPlayer ( ) - > GetHealth ( ) , true ) ;
game - > GetPlayer ( ) - > RestoreMana ( manaBeforeEquip - game - > GetPlayer ( ) - > GetMana ( ) , true ) ;
}
}
if ( ! ISBLANK ( otherItem ) ) {
if ( ! ISBLANK ( otherItem ) ) {
if ( slot = = EquipSlot : : RING1 ) Inventory : : EquipItem ( otherItem , EquipSlot : : RING2 ) ;
if ( slot = = EquipSlot : : RING1 ) Inventory : : EquipItem ( otherItem , EquipSlot : : RING2 ) ;