Refactor creature proximity aggro related code.

- Units immune to NPCs can no longer attack NPCs.

- Units immune to PCs can no longer attack PCs.

- Civilians can call guards when attacked by creatures too.

- If you go near a creature your party members are attacking, you will enter combat too.
This commit is contained in:
ratkosrb
2021-12-11 00:54:12 +02:00
parent d4cdb05ab1
commit 2c83139467
63 changed files with 521 additions and 759 deletions
+1 -1
View File
@@ -3500,7 +3500,7 @@ bool WorldObject::IsValidAttackTarget(Unit const* target, bool checkAlive) const
if (FindMap() != target->FindMap())
return false;
if (!target->IsTargetable(true, IsCharmerOrOwnerPlayerOrPlayerItself(), false, checkAlive))
if (!target->IsTargetableBy(this, false, checkAlive))
return false;
Unit const* pThisUnit = ToUnit();