mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Simplified the ASM code of combat_ai_hack.
This commit is contained in:
+2
-5
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user