forked from dredknight/H5_DLL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMasterOfFireFix.cpp
57 lines (52 loc) · 1.53 KB
/
MasterOfFireFix.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "pch.h"
// Fix: Master of Fire always substracting half defense from the moment of impact instead of half of the current creature defense
void MasterOfFireFix();
void MasterOfFireFix_init(pugi::xml_document& doc) {
assembly_patches.push_back({ PATCH_BYTE, 0x00989BB6, 1, nullptr, 9, 0, 0, 0 }); // disable bugged Master of Fire effect
assembly_patches.push_back({ PATCH_HOOK, 0x008A25F4, 13, MasterOfFireFix, 0, 0, 0, 0 }); // new Master of Fire code
}
__declspec(naked) void MasterOfFireFix() {
__asm
{
sub eax, 1
and ebx, eax
test ebx, ebx
je DEFENSE_IS_ZERO
mov ecx, esi
mov edx, [esi]
push 0xCA
mov ecx, esi
call dword ptr [edx + 0x28]
test eax, eax
je FIRE_EFFECT_NOT_PRESENT
mov edx, [esi]
push 0x55
mov ecx, esi
call dword ptr [edx + 0x28C]
test al, al
jne UNIT_IS_ARMOURED
mov eax, dword ptr [ebp]
mov ecx, ebp
call dword ptr [eax]
mov edx, dword ptr [eax]
push 0x54
mov ecx, eax
call dword ptr [edx + 0x74]
mov ecx, eax
call[count_equipped_artifact]
test eax, eax
jne HERO_HAS_FROZEN_HEART
shr ebx, 1
DEFENSE_IS_ZERO:
FIRE_EFFECT_NOT_PRESENT:
UNIT_IS_ARMOURED:
HERO_HAS_FROZEN_HEART:
mov eax, ebx;
pop edi
pop esi
pop ebp
pop ebx
add esp, 8
ret
}
}