diff options
author | Mik1893 <michele.roscelli@gmail.com> | 2015-06-26 16:52:40 +0200 |
---|---|---|
committer | DDuarte <dnpd.dd@gmail.com> | 2015-07-03 01:06:33 +0100 |
commit | c7ca7397115856876c52cc31198101173023c9c8 (patch) | |
tree | af18b7f83596bf0c19db2888aef395aa746d2e9c /src | |
parent | 0b745370dc8629be7f64c941f8e6bd65b172a77d (diff) |
Core/Creature: Fix UNIT_FLAG_IMMUNE_TO_PC validity for player pets
related to #14780 and #14744
(cherry picked from commit accab5451d3e62739e4aa376d25bc6623f0d3c52)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 587c937863f..7f44bd184d6 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1407,6 +1407,12 @@ bool Creature::CanStartAttack(Unit const* who, bool force) const if (IsCivilian()) return false; + // This set of checks is should be done only for creatures + if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters + || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false + || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) // player pets are immune to pc as well + return false; + // Do not attack non-combat pets if (who->GetTypeId() == TYPEID_UNIT && who->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) return false; |