mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed a bug that critters killed in combat by scripting still being able to move in their combat turn if the distance parameter in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled (from Mr.Stalin)
This commit is contained in:
@@ -1109,6 +1109,18 @@ map_leave:
|
||||
}
|
||||
}
|
||||
|
||||
static void __declspec(naked) ai_move_steps_closer_hook() {
|
||||
__asm {
|
||||
call fo::funcoffs::combat_turn_run_;
|
||||
movzx dx, word ptr [esi + 0x44]; // combat_data.results
|
||||
test dx, DAM_DEAD or DAM_KNOCKED_OUT or DAM_LOSE_TURN;
|
||||
jz end;
|
||||
mov [esi + 0x40], 0; // pobj.curr_mp (source reset ap)
|
||||
end:
|
||||
retn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BugFixes::init()
|
||||
{
|
||||
@@ -1420,6 +1432,10 @@ void BugFixes::init()
|
||||
// Fix for being at incorrect hex after map change when the exit hex in source map is at the same position as
|
||||
// some exit hex in destination map
|
||||
MakeCall(0x48A704, obj_move_to_tile_hack);
|
||||
|
||||
// Fix for critters killed in combat by scripting still being able to move in their combat turn if the distance parameter
|
||||
// in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled
|
||||
HookCall(0x42A1A8, ai_move_steps_closer_hook); // 0x42B24D
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user