ThePhrozenKeep / D2MOO

Reimplementation of the Diablo2 game coupled with patching facilities for modders.
MIT License
93 stars 29 forks source link

Incorrect Range Calc in `SUNITDMG_DrainItemDurability` #165

Open Necrolis opened 2 months ago

Necrolis commented 2 months ago

https://github.com/ThePhrozenKeep/D2MOO/blob/559def2d8fd94e1d2f959fa6e4f907a0f221795f/source/D2Game/src/UNIT/SUnitDmg.cpp#L2303

code compares vs UNIT_PLAYER giving them +2 range, but the assembly compares vs UNIT_MONSTER:

00091B36    83FA 01         CMP EDX,1
00091B39    B9 1C000000     MOV ECX,1C
00091B3E    0F94C0          SETE AL
00091B41    8D7C24 34       LEA EDI,DWORD PTR SS:[ESP+34]
00091B45    8D4400 01       LEA EAX,DWORD PTR DS:[EAX+EAX+1]