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 void __declspec(naked) combat_ai_hack() {
__asm {
mov edx, [ebx + 0x10]; // cap.min_hp
cmp eax, edx;
cmp eax, [ebx + 0x10]; // cap.min_hp - minimum hp, below which NPC will run away
jl tryHeal; // curr_hp < min_hp
end:
add esp, 4;
@@ -64,12 +63,10 @@ end:
tryHeal:
mov eax, esi;
call ai_check_drugs_;
push edx;
mov eax, esi;
mov edx, STAT_current_hp;
call stat_level_;
pop edx;
cmp eax, edx; // edx - minimum hp, below which NPC will run away
cmp eax, [ebx + 0x10]; // cap.min_hp
jge end;
retn; // flee
}