From 1270dada3455fe0d981f1ef683c1407ab1fc22dd Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 14 Sep 2014 10:35:57 +0200 Subject: [PATCH] Don't set Attacked flag when the actor is already in combat with the attacker (Fixes #1909) --- apps/openmw/mwclass/creature.cpp | 3 ++- apps/openmw/mwclass/npc.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 139f390f8..c31ab2a2a 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -329,7 +329,8 @@ namespace MWClass { // NOTE: 'object' and/or 'attacker' may be empty. - getCreatureStats(ptr).setAttacked(true); + if (!attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)) + getCreatureStats(ptr).setAttacked(true); // Self defense if ((canWalk(ptr) || canFly(ptr) || canSwim(ptr)) // No retaliation for totally static creatures diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index 8915f6654..b6d418108 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -640,10 +640,12 @@ namespace MWClass bool wasDead = getCreatureStats(ptr).isDead(); - getCreatureStats(ptr).setAttacked(true); + if (!attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)) + { + getCreatureStats(ptr).setAttacked(true); - if (!attacker.isEmpty()) MWBase::Environment::get().getMechanicsManager()->actorAttacked(ptr, attacker); + } if(!successful) {