aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMik1893 <michele.roscelli@gmail.com>2015-06-26 16:52:40 +0200
committerMik1893 <michele.roscelli@gmail.com>2015-06-26 16:52:40 +0200
commitaccab5451d3e62739e4aa376d25bc6623f0d3c52 (patch)
tree97fe88ab691bbad1e6b4414dd46f8fca4cceb239 /src
parent409c8e406df29a3ce4527822f1f65c8b0184ef6a (diff)
Core/Creature: Fix UNIT_FLAG_IMMUNE_TO_PC validity for player pets
related to #14780 and #14744
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp6
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 a91bbf00735..3b9b6d9dfe8 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1370,6 +1370,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;