*Mangos [7011] Add check Aura Spell req in Spell::CanCast. By DiSlord.
--HG-- branch : trunk
This commit is contained in:
@@ -3488,6 +3488,12 @@ uint8 Spell::CanCast(bool strict)
|
||||
if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot)))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
|
||||
// Caster aura req check if need
|
||||
if(m_spellInfo->casterAuraSpell && !m_caster->isAuraPresent(m_spellInfo->casterAuraSpell))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
if(m_spellInfo->excludeCasterAuraSpell && m_caster->isAuraPresent(m_spellInfo->excludeCasterAuraSpell))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
|
||||
// cancel autorepeat spells if cast start when moving
|
||||
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
|
||||
if( m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
|
||||
@@ -3506,6 +3512,12 @@ uint8 Spell::CanCast(bool strict)
|
||||
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
// Target aura req check if need
|
||||
if(m_spellInfo->targetAuraSpell && !target->isAuraPresent(m_spellInfo->targetAuraSpell))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
if(m_spellInfo->excludeTargetAuraSpell && target->isAuraPresent(m_spellInfo->excludeTargetAuraSpell))
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
|
||||
if(target != m_caster)
|
||||
{
|
||||
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
|
||||
|
||||
@@ -4012,6 +4012,17 @@ Aura* Unit::GetAura(uint32 spellId, uint32 effindex)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Unit::isAuraPresent(uint32 spellId)
|
||||
{
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, i));
|
||||
if (iter != m_Auras.end())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Unit::AddDynObject(DynamicObject* dynObj)
|
||||
{
|
||||
m_dynObjGUIDs.push_back(dynObj->GetGUID());
|
||||
|
||||
@@ -1312,6 +1312,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
uint8 GetVisibleAurasCount() { return m_visibleAuras.size(); }
|
||||
|
||||
Aura* GetAura(uint32 spellId, uint32 effindex);
|
||||
bool isAuraPresent(uint32 spellId);
|
||||
AuraMap & GetAuras() { return m_Auras; }
|
||||
AuraMap const& GetAuras() const { return m_Auras; }
|
||||
AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }
|
||||
|
||||
Reference in New Issue
Block a user