aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp11
-rw-r--r--src/server/game/Entities/Unit/Unit.h5
3 files changed, 13 insertions, 5 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index b9d6ca5a556..cb92977b2a2 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -471,7 +471,7 @@ bool PetAI::_CanAttack(Unit *target)
bool PetAI::_CheckTargetCC(Unit *target)
{
- if (target->HasCrowdControl())
+ if (me->GetCharmerOrOwnerGUID() && target->HasNegativeAuraWithAttribute(SPELL_ATTR_BREAKABLE_BY_DAMAGE, me->GetCharmerOrOwnerGUID()))
return true;
return false;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 9610d567fd0..f9b4d4825fa 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -4641,6 +4641,17 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid)
return false;
}
+bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid)
+{
+ for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
+ {
+ Aura const *aura = iter->second->GetBase();
+ if (!iter->second->IsPositive() && aura->GetSpellProto()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
+ return true;
+ }
+ return false;
+}
+
AuraEffect * Unit::IsScriptOverriden(SpellEntry const * spell, int32 script) const
{
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 51710d9fe22..f3ee81cc39d 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1640,10 +1640,7 @@ class Unit : public WorldObject
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
- bool HasCrowdControl() {
- return (HasAuraType(SPELL_AURA_MOD_CONFUSE) || HasAuraType(SPELL_AURA_MOD_FEAR) || HasAuraType(SPELL_AURA_MOD_STUN) ||
- HasAuraType(SPELL_AURA_MOD_ROOT) || HasAuraType(SPELL_AURA_TRANSFORM));
- }
+ bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0);
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);