Edit2: Whoops, bug fix #2 had a critical bug that caused the game to crash. Fixed
I've been able to fix two unrelated, display-only bugs in vanilla D2 v1.13c:
Bug 1.
Every class has a ToHitFactor, specified in CharStats.txt, that is added to their attack rating. This bug(See Amazon Basin's wiki page for more info) causes the ToHitFactor to be added twice for calculating the percent hit chance in the LCS. This is a display bug only, and is pretty simple to fix.
Code: Select all
(D2Client.0x000BCCA7 - NOP 5 bytes)
text:6FB6CCA7 call GetClassToHitFactor
The LCS applies the +Damage% bonus from Throwing Mastery and Double Throw's synergy *after* calculating other sources of +Damage%, even though they are actually added to the other sources before being multiplied. This results in 2-3x inflated Throw damage/Double Throw damage for throwbarbs. I had to replace some assembly code to fix it....
Code: Select all
;Insert @ D2Client.0x0003313B (replace 166 bytes of code)
;Add skill damage bonus to EDI
ADD EDI,DWORD PTR SS:[ESP+24] ; EDI = damagepercent + skill_damage_bonus (if any)
;Retrieve Throwing Mastery bonus and store it in EDI
;Note: The functions may use EDI themselves, so let's push EDI onto the stack and retrieve it later
PUSH EDI ; Temporary storage
PUSH 4E ; UNIT_STATE_ThrowingMastery
PUSH ESI
CALL 6FABC1FC ; CALL <JMP.&D2Common.#10494>
POP EDI ; Retrieve from temporary storage
TEST EAX, EAX ; If the player has Throwing Mastery...
JE SHORT 6FAE3163 ; ...then jump to <Continue Calculations>
MOV EDX,DWORD PTR SS:[ESP+2C] ;
MOV EAX,DWORD PTR SS:[ESP+34] ;
PUSH EDI ; Temporary storage (again)
PUSH 1
PUSH EDX
PUSH EAX
PUSH ESI
CALL 6FABC922 ; CALL <JMP.&D2Common.#10804>
POP EDI ; Retrieve from temporary storage
ADD EDI,EAX ; EDI = damagepercent + skill_damage_bonus (if any) + throw_mastery_bonus (if any) ; End of temporary storage
:Continue Calculations
;Calculate final mindamage
MOV EAX,[ESP+10] ; EAX = item_mindamage_percent
ADD EAX,EDI ; EAX = item_mindamage_percent + damagepercent + skill_damage_bonus (if any) + throw_mastery_bonus (if any)
IMUL EAX,[EBP] ; EAX = (mindamage_total_pct * mindamage)
XOR EDX,EDX
MOV ECX, 64
IDIV ECX ; EAX = (mindamage_total_pct * mindamage) / 100
ADD [EBP], EAX
;Calculate final maxdamage
MOV EBX,[ESP+1C] ; EBX => item_throw_mindamage
MOV EAX,[ESP+14] ; EAX = item_maxdamage_percent
ADD EAX,EDI ; EAX = item_maxdamage_percent + damagepercent + skill_damage_bonus (if any) + throw_mastery_bonus (if any)
IMUL EAX,[EBX] ; EAX = (maxdamage_total_pct * maxdamage)
XOR EDX,EDX
MOV ECX, 64
IDIV ECX ; EAX = (maxdamage_total_pct * maxdamage) / 100
ADD [EBX], EAX
;Compare mindamage and maxdamage
MOV ECX, [EBP] ; ECX = mindamage_final
CMP EAX, ECX
JGE SHORT 6FAE319A ; Jump to <End of Code>
MOV [EBX], ECX
:End of Code
;NOP up to D2Client.0x000331E1
Code: Select all
(Copy-paste this to D2Client.0x0003313B)
03 7C 24 24 57 6A 4E 56 E8 B4 90 FD FF 5F 85 C0 74 16 8B 54 24 2C 8B 44 24 34 57 6A 01 52 50 56
E8 C2 97 FD FF 5F 03 F8 8B 44 24 10 03 C7 0F AF 45 00 33 D2 B9 64 00 00 00 F7 F9 01 45 00 8B 5C
24 1C 8B 44 24 14 03 C7 0F AF 03 33 D2 B9 64 00 00 00 F7 F9 01 03 8B 4D 00 3B C1 7D 02 89 0B 90
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
90 90 90 90 90 90