Skip to content

Commit

Permalink
Helm of Spirits hp regen
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonomov committed Dec 17, 2024
1 parent 07b78f5 commit ccd3372
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Note: You'll need access to the data from the original game. If you don't have a
* Teleport initial: 50 [35]; minimum: 30 [15]
#### Items:
* Effects of drinking Spectral Elixir: +1 to one attribute [+3 to all attributes].
* Helm of Spirits has an additional life regeneration magical effect of 1.25 hit points per second.
* Damage versus demons affix [+200%]:
* Deadly Hunter: +50%
* Civerb's Cudgel: +150%
Expand Down
2 changes: 1 addition & 1 deletion Source/itemdat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ const UniqueItem UniqueItems[] = {
{ N_("Naj's Puzzler"), UITYPE_LONGSTAFF, 18, 5, 34000, { { IPL_MAG, 20, 20 }, { IPL_DEX, 10, 10 }, { IPL_ALLRES, 20, 20 }, { IPL_SPELL, 23, 57 }, { IPL_LIFE_CURSE, 25, 25 }, { } } },
{ N_("Mindcry"), UITYPE_QUARSTAFF, 20, 4, 41500, { { IPL_MAG, 15, 15 }, { IPL_SPELL, 13, 69 }, { IPL_ALLRES, 15, 15 }, { IPL_SPLLVLADD, 1, 1 }, { }, { } } },
{ N_("Rod of Onan"), UITYPE_WARSTAFF, 22, 3, 44167, { { IPL_SPELL, 21, 50 }, { IPL_DAMP, 100, 100 }, { IPL_ATTRIBS, 5, 5 }, { }, { }, { } } },
{ N_("Helm of Spirits"), UITYPE_HELM, 1, 2, 7525, { { IPL_STEALLIFE, 5, 5 }, { IPL_INVCURS, 77 }, { }, { }, { }, { } } },
{ N_("Helm of Spirits"), UITYPE_HELM, 1, 2, 7525, { { IPL_STEALLIFE, 5, 5 }, { IPL_MULT_ARROWS, 3, 3 }, { IPL_INVCURS, 78 }, { }, { }, { } } },
{ N_("Thinking Cap"), UITYPE_SKULLCAP, 6, 5, 2020, { { IPL_MANA, 30, 30 }, { IPL_SPLLVLADD, 2, 2 }, { IPL_ALLRES, 20, 20 }, { IPL_SETDUR, 1, 1 }, { IPL_INVCURS, 93 }, { } } },
{ N_("OverLord's Helm"), UITYPE_HELM, 7, 6, 12500, { { IPL_STR, 20, 20 }, { IPL_DEX, 15, 15 }, { IPL_VIT, 5, 5 }, { IPL_MAG_CURSE, 20, 20 }, { IPL_SETDUR, 15, 15 }, { IPL_INVCURS, 99 } } },
{ N_("Fool's Crest"), UITYPE_HELM, 12, 5, 10150, { { IPL_ATTRIBS_CURSE, 4, 4 }, { IPL_LIFE, 100, 100 }, { IPL_GETHIT_CURSE, 6, 6 }, { IPL_THORNS, 1, 3 }, { IPL_INVCURS, 80 }, { } } },
Expand Down
2 changes: 1 addition & 1 deletion Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3871,7 +3871,7 @@ bool DoOil(Player &player, int cii)
case IPL_LIGHT_CURSE:
return fmt::format(fmt::runtime(_(/*xgettext:no-c-format*/ "-{:d}% light radius")), -10 * item._iPLLight);
case IPL_MULT_ARROWS:
return _("multiple arrows per shot");
return _("regenerate life");
case IPL_FIRE_ARROWS:
if (item._iFMinDam == item._iFMaxDam)
return fmt::format(fmt::runtime(_("fire arrows damage: {:d}")), item._iFMinDam);
Expand Down
2 changes: 0 additions & 2 deletions Source/panels/spell_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,6 @@ void DoSpeedBook()
}
}
}

SetCursorPos({ x, y });
}

} // namespace devilution
3 changes: 3 additions & 0 deletions Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3028,6 +3028,9 @@ void ProcessPlayers()
if (HasAnyOf(player._pIFlags, ItemSpecialEffect::DrainLife) && leveltype != DTYPE_TOWN) {
ApplyPlrDamage(DamageType::Physical, player, 0, 0, 4);
}
if (HasAnyOf(player._pIFlags, ItemSpecialEffect::MultipleArrows) && player._pHitPoints < player._pMaxHP && player._pMaxHP > 0) {
player.RegenerateHitPoints();
}
if (HasAnyOf(player._pIFlags, ItemSpecialEffect::NoMana) && player._pManaBase > 0) {
player._pManaBase -= player._pMana;
player._pMana = 0;
Expand Down
14 changes: 10 additions & 4 deletions Source/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ struct Player {
int _pMana;
int _pMaxMana;
int _pManaPer;
int _pRegenOverflow;
int _pManaRegenOverflow;
int _pIMinDam;
int _pIMaxDam;
int _pIAC;
Expand Down Expand Up @@ -591,13 +591,19 @@ struct Player {
int maxmanaregen = _pMaxMana;
if (_pClass == HeroClass::Sorcerer)
maxmanaregen += maxmanaregen * _pLevel / 100;
_pRegenOverflow += maxmanaregen % regendivisor;
int regenmana = maxmanaregen / regendivisor + _pRegenOverflow / regendivisor;
_pRegenOverflow %= regendivisor;
_pManaRegenOverflow += maxmanaregen % regendivisor;
int regenmana = maxmanaregen / regendivisor + _pManaRegenOverflow / regendivisor;
_pManaRegenOverflow %= regendivisor;
_pMana = clamp(_pMana + regenmana, _pMana, _pMaxMana);
_pManaBase = clamp(_pManaBase + regenmana, _pManaBase, _pMaxManaBase);
}

void RegenerateHitPoints()
{
_pHitPoints = clamp(_pHitPoints + 4, _pHitPoints, _pMaxHP);
_pHPBase = clamp(_pHPBase + 4, _pHPBase, _pMaxHPBase);
}

/**
* @brief Gets the effective spell level for the player, considering item bonuses
* @param spell SpellID enum member identifying the spell
Expand Down

0 comments on commit ccd3372

Please sign in to comment.