mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-02 08:15:54 +00:00
Make AI attack player also if it attacks follower
This commit is contained in:
parent
5a6ea4e84e
commit
6fa0354a17
1 changed files with 14 additions and 1 deletions
|
@ -338,11 +338,24 @@ namespace MWMechanics
|
|||
aggressive = true;
|
||||
}
|
||||
|
||||
// Initiate combat with the player if we are already in combat with a player follower or escorter
|
||||
const std::list<MWWorld::Ptr>& playerFollowersAndEscorters = getActorsSidingWith(getPlayer());
|
||||
if (!aggressive && againstPlayer)
|
||||
{
|
||||
for (std::list<MWWorld::Ptr>::const_iterator it = playerFollowersAndEscorters.begin(); it != playerFollowersAndEscorters.end(); ++it)
|
||||
{
|
||||
if (creatureStats1.getAiSequence().isInCombat(*it))
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(actor1, actor2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, don't initiate combat with an unreachable target
|
||||
if (!aggressive && !MWMechanics::canFight(actor1,actor2))
|
||||
return;
|
||||
|
||||
const std::list<MWWorld::Ptr>& playerFollowersAndEscorters = getActorsSidingWith(getPlayer());
|
||||
if (!aggressive && (againstPlayer || std::find(playerFollowersAndEscorters.begin(), playerFollowersAndEscorters.end(), actor2) != playerFollowersAndEscorters.end()))
|
||||
{
|
||||
// Player followers and escorters with high fight should not initiate combat here with the player or with
|
||||
|
|
Loading…
Reference in a new issue