diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.04k stars 792 forks source link

[Issue Report]: Overflow with Acolyte Amulet? #6875

Open Chonkblonk opened 10 months ago

Chonkblonk commented 10 months ago

Operating System

Windows x64

DevilutionX version

1.5.1

Describe

I play as a Sorcerer and get to high level, in Nightmare I find the Acolyte's Amulet, which is a Hellfire item. I think "Wow, this is perhaps the least useful drop yet!" and put it in my stash.

Fast forward some days, and I make a Warrior, he's level 1 and I go look in my stash for fun stuff I can start him out with. Seeing the Acolyte's Amulet, which transfers 50% of mana to health, I try it out for the fun of it. Expecting the meager mana to add some extra life, instead I get THIS result.

Screenshot from 2023-12-21 12-50-09 Now, this doesn't look right at all. I don't know if this is some sort of overflow or if the amulet decided to remember my Sorcerer's massive mana pool for some reason and apply that on my Warrior. After I took a screenshot and went to write this, the game also ended up freezing/crashing, so I assume that it created some situation the .exe did not like.

Loading the game up again, there he is, but this time the health and HP values are normal, so it seems self-correcting, in a way.

To Reproduce

.

Expected Behavior

No response

Additional context

No response

julealgon commented 10 months ago

I don't know if this is some sort of overflow or if the amulet decided to remember my Sorcerer's massive mana pool for some reason and apply that on my Warrior.

Loading the game up again, there he is, but this time the health and HP values are normal, so it seems self-correcting, in a way.

You are probably onto something there... if this goes away when reloading, it is most likely state that wasn't correctly cleared between one game and the other (which is what happens with the vanilla game in several scenarios, such as "refreshing wirt items", or "difficulty levels in normal" etc).

This is one of the reasons why I'd actually advocate for the menu and the game being 2 separate processes.

StephenCWills commented 10 months ago

This is one of the reasons why I'd actually advocate for the menu and the game being 2 separate processes.

That wouldn't help here. Stash saves item data in SP save format so it remembers the HP/mana values assigned to the item when it was picked up. Before 1.5.1, we used the heroitems file in the character saves to do the same for items in the player's inventory. But recently with the introduction of the item validation logic, we switched back to the vanilla way of regenerating the item on new game. So now there's a bit of a difference between leaving an item in your stash and holding it in your inventory when you create a new game.

julealgon commented 10 months ago

Stash saves item data in SP save format so it remembers the HP/mana values assigned to the item when it was picked up.

Had no idea about that. Thanks for pointing it out!

kphoenix137 commented 7 months ago

I don't know if this is some sort of overflow or if the amulet decided to remember my Sorcerer's massive mana pool for some reason and apply that on my Warrior.

Loading the game up again, there he is, but this time the health and HP values are normal, so it seems self-correcting, in a way.

You are probably onto something there... if this goes away when reloading, it is most likely state that wasn't correctly cleared between one game and the other (which is what happens with the vanilla game in several scenarios, such as "refreshing wirt items", or "difficulty levels in normal" etc).

This is one of the reasons why I'd actually advocate for the menu and the game being 2 separate processes.

Specifically, the problem is rooted in how poorly these affixes were implemented. The game would write the hp/mana values when the item gets generated/regenerated. This is especially problematic in a single player game session, because you can level up, but those values written to the item never change.