From 6227c0a012ea884f9ccc2bf80e547b54299ec2f8 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sun, 18 Jul 2021 04:05:52 +0200 Subject: [PATCH] Cancel targeted attack on dead targets Fixes #962 --- Source/player.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/player.cpp b/Source/player.cpp index 406fd7907..6ff81f5ea 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -2965,6 +2965,10 @@ void CheckNewPath(int pnum, bool pmWillBeCalled) case ACTION_RATTACKMON: case ACTION_SPELLMON: monster = &Monsters[targetId]; + if ((monster->_mhitpoints >> 6) <= 0) { + player.Stop(); + return; + } if (player.destAction == ACTION_ATTACKMON) MakePlrPath(pnum, monster->position.future, false); break; @@ -2972,6 +2976,10 @@ void CheckNewPath(int pnum, bool pmWillBeCalled) case ACTION_RATTACKPLR: case ACTION_SPELLPLR: target = &Players[targetId]; + if ((target->_pHitPoints >> 6) <= 0) { + player.Stop(); + return; + } if (player.destAction == ACTION_ATTACKPLR) MakePlrPath(pnum, target->position.future, false); break;