Skip to content

Commit

Permalink
Added a check for NPC being dead to NPCsTryToSpendExtraAP (closes #524)
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaRain committed May 2, 2024
1 parent 7b650bf commit d4ca2b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sfall/Modules/AI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void __declspec(naked) ai_danger_source_hack_pm_newFind() {
jnz hasTarget;
retn;
hasTarget:
test [ecx + damageFlags], DAM_DEAD;
test byte ptr [ecx + damageFlags], DAM_DEAD;
jz isNotDead;
xor ecx, ecx;
isNotDead:
Expand Down Expand Up @@ -290,6 +290,7 @@ static long RetryCombatMinAP;

static void __declspec(naked) RetryCombatHook() {
static DWORD RetryCombatLastAP = 0;
using namespace fo;
__asm {
mov RetryCombatLastAP, 0;
retry:
Expand All @@ -300,6 +301,8 @@ static void __declspec(naked) RetryCombatHook() {
call fo::funcoffs::process_bk_;
jmp process;
next:
test byte ptr [esi + damageFlags], DAM_DEAD; // is NPC dead in the previous attack?
jnz end;
mov eax, [esi + movePoints];
cmp eax, RetryCombatMinAP;
jl end;
Expand Down

0 comments on commit d4ca2b9

Please sign in to comment.