[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
No votes
 
Total votes: 0

User avatar
kingpin
Retired Admin
Cherub
Posts: 10954
Joined: Sat Jan 11, 2003 12:51 pm
Sweden

Hand-picked

[1.10] Superuniques - Regen & Hitpoint calculations

Post by kingpin » Fri Jul 28, 2006 4:19 am

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
6FC6B006  |. 83C0 03        ADD EAX,3 ; add 3 levels
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.

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

Hand-picked

Re: [1.10] Superuniques - Regen & Hitpoint calculations

Post by Nefarius » Fri Jul 28, 2006 11:10 am

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

User avatar
kingpin
Retired Admin
Cherub
Posts: 10954
Joined: Sat Jan 11, 2003 12:51 pm
Sweden

Hand-picked

Re: [1.10] Superuniques - Regen & Hitpoint calculations

Post by kingpin » Fri Jul 28, 2006 11:24 am

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.

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12100
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U
United States of America

Hand-picked

Re: [1.10] Superuniques - Regen & Hitpoint calculations

Post by Myhrginoc » Fri Jul 28, 2006 3:54 pm

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
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
pepa999
Posts: 57
Joined: Mon Oct 20, 2008 7:10 pm
Czech Republic

Re: [1.10] Superuniques - Regen & Hitpoint calculations

Post by pepa999 » Tue May 07, 2019 5:59 am

Nefarius wrote:
Fri Jul 28, 2006 11:10 am
Superuniques, uniques, champions etc never regenerate HP.
There is another piece of code that sets the stat to 0.
Anyone knows, where is that piece of code? I would like to let them regenerate like other monsters, just make them using "damageregen" from monstats.txt.

Return to “Code Editing”