## [1.10] Superuniques - Regen & Hitpoint calculations

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

0

kingpin
Cherub
Posts: 10921
Joined: Sat Jan 11, 2003 12:51 pm
Contact:

### [1.10] Superuniques - Regen & Hitpoint calculations

I have been looking into Superuniques code related to regenrate & hitpoint calculation to see how +3 Level affect hitpoints. What I found out is some weird behavor and unexpected results

The forumula for regenrate in 1.10 are:
6FC41AA3 C1FF 08 SAR EDI,8 ; Hitpoints SAR 8
6FC41AA6 0FAFF8 IMUL EDI,EAX ; shifted hp value * Damageregen (from monstats.txt)
6FC41AA9 C1FF 04 SAR EDI,4 ; Final Regenrate SAR 4
An example:

My test SU mob had 408HP

To use 408hp in our calculcation we convert it to real value 408*256 and it's ends up as 104448.

After shift 104448 right 8 step you end up with = 408

408*2 = 816

After shift 816 right 4 step you end up with = 33.

33 is the final regen rate.

The hitpoint calculcation is done here.

Code: Select all

``````6FC41A1F   6A 00            PUSH 0
6FC41A21   6A 06            PUSH 6 ; Hitpoints
6FC41A23   56               PUSH ESI ; ptUnit
6FC41A24   E8 699C0D00      CALL <JMP.&D2Common.#10519> ; get hitpoints
6FC41A29   85C0             TEST EAX,EAX
6FC41A2B   894424 1C        MOV DWORD PTR SS:[ESP+1C],EAX
6FC41A2F   0F8E 12050000    JLE D2Game.6FC41F47
6FC41A35   81FB 00010000    CMP EBX,100
6FC41A3B   7F 08            JG SHORT D2Game.6FC41A45
6FC41A3D   C74424 24 000100>MOV DWORD PTR SS:[ESP+24],100
6FC41A45   DB4424 1C        FILD DWORD PTR SS:[ESP+1C]
6FC41A49   DB4424 24        FILD DWORD PTR SS:[ESP+24]
6FC41A4D   DEF9             FDIVP ST(1),ST
6FC41A4F   DB4424 28        FILD DWORD PTR SS:[ESP+28]
6FC41A53   DEC9             FMULP ST(1),ST
6FC41A55   E8 9AB80D00      CALL D2Game.6FD1D2F4
``````
It will set the final hitpoint in the original code at end of a jump abit later in the code.

I couldn't really find where it reads the "700 unique +hp%" from monUmod.txt. It may done that from a point abit up in code before this call.

But, I changed the "700 unique +hp%" to "100 unique +hp%" and did see a different in health.

BaseUnit HP: 49
Modified by Unique Bonus (+700%): 392

BaseUnit HP: 46
Modified by Unique Bonus (+100%): 92

What is weird?

The code add +3 level but the +3 level never affect hitpoints at all.

Code: Select all

``````6FC6AFFC  |. 6A 00          PUSH 0 ; base_index
6FC6AFFE  |. 6A 0C          PUSH 0C ; level
6FC6B000  |. 56             PUSH ESI ; ptUnit
6FC6B001  |. E8 8C060B00    CALL <JMP.&D2Common.#10519> ; get Level
6FC6B009  |. 6A 00          PUSH 0
6FC6B00B  |. 50             PUSH EAX ; value
6FC6B00C  |. 6A 0C          PUSH 0C ; level
6FC6B00E  |. 56             PUSH ESI ; ptUnit
6FC6B00F  |. E8 94080B00    CALL <JMP.&D2Common.#10517> ; set new Level
``````
Because of the added +3 Level. The code run add hitpoints, regenrate twice. But, never change the +3 Level to affect hitpoints. I did notice a chance for hitpoints, but it lower it a bit! and my monLvl is correct so isn't because of that, have double check to verify that.

Nefarius
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains
Contact:

### Re: [1.10] Superuniques - Regen & Hitpoint calculations

Superuniques, uniques, champions etc never regenerate HP.
There is another piece of code that sets the stat to 0.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

kingpin
Cherub
Posts: 10921
Joined: Sat Jan 11, 2003 12:51 pm
Contact:

### Re: [1.10] Superuniques - Regen & Hitpoint calculations

Nefarius";p="281549" wrote:Superuniques, uniques, champions etc never regenerate HP.
There is another piece of code that sets the stat to 0.
Yeah,

it's right. Didn't check so far that SU actually regenerated. Added *10 multiplier to test, and no regen at all.

Myhrginoc
Cherub
Posts: 12062
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U

### Re: [1.10] Superuniques - Regen & Hitpoint calculations

Which is probably why a logic bug never got fixed, it wasn't supposed to matter.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial