mirror of
https://github.com/OpenMW/openmw.git
synced 2026-02-01 23:18:27 +00:00
Merge branch '7340-guards-do-not-become-properly-aggressive' into 'master'
Check combat state in isAggressive for dialogue filters Closes #7340 See merge request OpenMW/openmw!5123
This commit is contained in:
commit
bc5c48b424
1 changed files with 6 additions and 3 deletions
|
|
@ -1571,9 +1571,8 @@ namespace MWMechanics
|
|||
const MWWorld::Class& cls = target.getClass();
|
||||
const MWMechanics::CreatureStats& stats = cls.getCreatureStats(target);
|
||||
const MWMechanics::AiSequence& seq = stats.getAiSequence();
|
||||
return cls.isNpc() && !attacker.isEmpty() && !seq.isInCombat(attacker) && !isAggressive(target, attacker)
|
||||
&& !seq.isEngagedWithActor() && !stats.getAiSequence().isInPursuit()
|
||||
&& !cls.getNpcStats(target).isWerewolf()
|
||||
return cls.isNpc() && !attacker.isEmpty() && !isAggressive(target, attacker) && !seq.isEngagedWithActor()
|
||||
&& !stats.getAiSequence().isInPursuit() && !cls.getNpcStats(target).isWerewolf()
|
||||
&& stats.getMagicEffects().getOrDefault(ESM::MagicEffect::Vampirism).getMagnitude() <= 0;
|
||||
}
|
||||
|
||||
|
|
@ -1864,6 +1863,10 @@ namespace MWMechanics
|
|||
|
||||
bool MechanicsManager::isAggressive(const MWWorld::Ptr& ptr, const MWWorld::Ptr& target)
|
||||
{
|
||||
// If already in combat with target, consider aggressive
|
||||
if (ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(target))
|
||||
return true;
|
||||
|
||||
// Don't become aggressive if a calm effect is active, since it would cause combat to cycle on/off as
|
||||
// combat is activated here and then canceled by the calm effect
|
||||
if ((ptr.getClass().isNpc()
|
||||
|
|
|
|||
Loading…
Reference in a new issue