diff --git a/Source/itemdat.h b/Source/itemdat.h index b52c8cd88e2d..3d539fb58ba5 100644 --- a/Source/itemdat.h +++ b/Source/itemdat.h @@ -360,7 +360,7 @@ enum class ItemSpecialEffect : uint32_t { }; use_enum_as_flags(ItemSpecialEffect); -enum class ItemSpecialEffectHf : uint8_t { +enum class ItemSpecialEffectHf : uint16_t { // clang-format off None = 0, Devastation = 1 << 0, @@ -370,6 +370,8 @@ enum class ItemSpecialEffectHf : uint8_t { Doppelganger = 1 << 4, ACAgainstDemons = 1 << 5, ACAgainstUndead = 1 << 6, + ManaToLife = 1 << 7, + LifeToMana = 1 << 8, // clang-format on }; use_enum_as_flags(ItemSpecialEffectHf); diff --git a/Source/items.cpp b/Source/items.cpp index 11e2df886900..79269f6ec4ba 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1010,16 +1010,12 @@ int SaveItemPower(const Player &player, Item &item, ItemPower &power) case IPL_ACUNDEAD: item._iDamAcFlags |= ItemSpecialEffectHf::ACAgainstUndead; break; - case IPL_MANATOLIFE: { - int portion = ((player._pMaxManaBase >> 6) * 50 / 100) << 6; - item._iPLMana -= portion; - item._iPLHP += portion; - } break; - case IPL_LIFETOMANA: { - int portion = ((player._pMaxHPBase >> 6) * 40 / 100) << 6; - item._iPLHP -= portion; - item._iPLMana += portion; - } break; + case IPL_MANATOLIFE: + item._iDamAcFlags |= ItemSpecialEffectHf::ManaToLife; + break; + case IPL_LIFETOMANA: + item._iDamAcFlags |= ItemSpecialEffectHf::LifeToMana; + break; default: break; } @@ -2375,8 +2371,21 @@ void CalcPlrItemVals(Player &player, bool loadgfx) dmod += item._iPLDamMod; ghit += item._iPLGetHit; lrad += item._iPLLight; - ihp += item._iPLHP; - imana += item._iPLMana; + + // Check for Acolyte's Amulet and Gladiator Ring to apply bonuses as life and mana changes, rather than getting static bonuses from the item data + if (IsAnyOf(item._iDamAcFlags, ItemSpecialEffectHf::ManaToLife)) { + int portion = ((player._pMaxManaBase >> 6) * 50 / 100) << 6; + imana -= portion; + ihp += portion; + } else if (IsAnyOf(item._iDamAcFlags, ItemSpecialEffectHf::LifeToMana)) { + int portion = ((player._pMaxHPBase >> 6) * 40 / 100) << 6; + ihp -= portion; + imana += portion; + } else { + ihp += item._iPLHP; + imana += item._iPLMana; + } + spllvladd += item._iSplLvlAdd; enac += item._iPLEnAc; fmin += item._iFMinDam;