-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMasterOfFireFix.cpp
More file actions
43 lines (40 loc) · 1.17 KB
/
Copy pathMasterOfFireFix.cpp
File metadata and controls
43 lines (40 loc) · 1.17 KB
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
#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
shr ebx, 1
DEFENSE_IS_ZERO:
FIRE_EFFECT_NOT_PRESENT:
UNIT_IS_ARMOURED:
mov eax, ebx;
pop edi
pop esi
pop ebp
pop ebx
add esp, 8
ret
}
}