[WIP] Core/AI: Pets musn't attack civilian NPC in aggressive mode
Port From (https://github.com/TrinityCore/TrinityCore/commit/1e932109996a0ce2117f3d5268064ee882267e84)
This commit is contained in:
@@ -2246,10 +2246,11 @@ namespace Game.Maps
|
||||
|
||||
class NearestHostileUnitInAggroRangeCheck : ICheck<Unit>
|
||||
{
|
||||
public NearestHostileUnitInAggroRangeCheck(Creature creature, bool useLOS = false)
|
||||
public NearestHostileUnitInAggroRangeCheck(Creature creature, bool useLOS = false, bool ignoreCivilians = false)
|
||||
{
|
||||
_me = creature;
|
||||
_useLOS = useLOS;
|
||||
_ignoreCivilians = ignoreCivilians;
|
||||
}
|
||||
|
||||
public bool Invoke(Unit u)
|
||||
@@ -2266,11 +2267,21 @@ namespace Game.Maps
|
||||
if (_useLOS && !u.IsWithinLOSInMap(_me))
|
||||
return false;
|
||||
|
||||
// pets in aggressive do not attack civilians
|
||||
if (_ignoreCivilians)
|
||||
{
|
||||
Creature c = u.ToCreature();
|
||||
if (c != null)
|
||||
if (c.IsCivilian())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Creature _me;
|
||||
bool _useLOS;
|
||||
bool _ignoreCivilians;
|
||||
}
|
||||
|
||||
class AnyAssistCreatureInRangeCheck : ICheck<Creature>
|
||||
|
||||
Reference in New Issue
Block a user