world-of-might-and-magic icon indicating copy to clipboard operation
world-of-might-and-magic copied to clipboard

Vanilla bug - HP can exceed MaxHP

Open captainurist opened this issue 1 year ago • 3 comments

Describe the bug Subj.

To Reproduce

  1. Cast day of the gods.
  2. Heal.
  3. Wait for it to expire.
  4. HP stays > MaxHP.

Any subsequent health regen source will snap HP down to MaxHP. Damage can be taken as normal with hp > Max without snap.

The same applies to MP.

Expected behavior Ultimately, the behaviour is inconsistent and there are two possible fixes:

  1. HP never exceeds MaxHP
  2. Regen doesn't snap HP back to MaxHP

Environment (please complete the following information):

  • OS: OSX
  • Architecture: M1

Screenshots None.

Saved game file None.

Additional context

captainurist avatar Jan 04 '24 20:01 captainurist

Breaking commit https://github.com/OpenEnroth/OpenEnroth/commit/4bd992a796a91b9caebb939208360e4f03755be8

captainurist avatar Jan 04 '24 21:01 captainurist

Should redo the code there like this:

character.health = std::max(character.health, std::min(character.GetMaxHealth(), character.health + ticks5));

captainurist avatar Jan 04 '24 21:01 captainurist

I believe our current behavior matches vanilla so moving to milestone 0.2.

pskelton avatar Jan 14 '24 21:01 pskelton