Simplified the ASM code of combat_ai_hack.

This commit is contained in:
NovaRain
2019-05-24 20:01:19 +08:00
parent 1f6dac09b8
commit daf6585ba3
+2 -5
View File
@@ -55,8 +55,7 @@ reTarget:
static const DWORD combat_ai_hack_Ret = 0x42B204; static const DWORD combat_ai_hack_Ret = 0x42B204;
static void __declspec(naked) combat_ai_hack() { static void __declspec(naked) combat_ai_hack() {
__asm { __asm {
mov edx, [ebx + 0x10]; // cap.min_hp cmp eax, [ebx + 0x10]; // cap.min_hp - minimum hp, below which NPC will run away
cmp eax, edx;
jl tryHeal; // curr_hp < min_hp jl tryHeal; // curr_hp < min_hp
end: end:
add esp, 4; add esp, 4;
@@ -64,12 +63,10 @@ end:
tryHeal: tryHeal:
mov eax, esi; mov eax, esi;
call ai_check_drugs_; call ai_check_drugs_;
push edx;
mov eax, esi; mov eax, esi;
mov edx, STAT_current_hp; mov edx, STAT_current_hp;
call stat_level_; call stat_level_;
pop edx; cmp eax, [ebx + 0x10]; // cap.min_hp
cmp eax, edx; // edx - minimum hp, below which NPC will run away
jge end; jge end;
retn; // flee retn; // flee
} }