REDIVIVUS

Proposals / #1263

Mac DAMAGE_CheckDefenseEvasion: uint32_t __fastcall (pUnit2 ECX attacker, pUnit EDX defender, bIsMissile)

checked · by KierTaylor · submitted 2026-11-06

Names follow the Windows twin 0x0057dd60 by role: pUnit = the defender that rolls (Windows ESI), pUnit2 = the attacker (Windows EDI), bIsMissile = the stack flag. Mac EDX -> EDI is the defender: NULL/type/mode (2, 0xf) checks, its +0x60 data and its seed are used. Mac ECX is saved to [EBP-0x18] and reloaded later as the other unit. [EBP+8] is the flag (CMP [EBP+8],0 picks dodge vs avoid); there are no other stack reads. EAX = the result code, then a plain RET, and DAMAGE_CheckBlockAndEvasion returns it directly. Its call 0x002801c4 sets ECX=[EBP+0xc]/ESI, EDX=ESI/EDI, [ESP]=[EBP+0x14].

Changes 1, applied together

  1. Set prototype mac 0x00280334

    signatureundefined DAMAGE_CheckDefenseEvasion(void)→uint32_t DAMAGE_CheckDefenseEvasion(D2UnitStrc* pUnit2, D2UnitStrc* pUnit, int32_t bIsMissile)
    conventionunknown→__fastcall