Core/PetAI: Implement a more correct way of findng if your pet's target has Crowd Control on it. Stuns like Hammer of Justice will not make your pet stop attacking anymore.
Pet's will only stop attacking if the Crowd Control is casted by the owner of the pet. Fixes issue #4037 --HG-- branch : trunk
This commit is contained in:
@@ -471,7 +471,7 @@ bool PetAI::_CanAttack(Unit *target)
|
|||||||
|
|
||||||
bool PetAI::_CheckTargetCC(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 true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -4641,6 +4641,17 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid)
|
|||||||
return false;
|
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
|
AuraEffect * Unit::IsScriptOverriden(SpellEntry const * spell, int32 script) const
|
||||||
{
|
{
|
||||||
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
|
||||||
|
|||||||
@@ -1640,10 +1640,7 @@ class Unit : public WorldObject
|
|||||||
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
|
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const * affectedSpell) const;
|
||||||
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
|
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
|
||||||
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
|
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
|
||||||
bool HasCrowdControl() {
|
bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0);
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
|
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
|
||||||
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
|
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
|
||||||
|
|||||||
Reference in New Issue
Block a user