*Target is never valid on MAPID_INVALID.
--HG-- branch : trunk
This commit is contained in:
+7
-5
@@ -2558,14 +2558,14 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
|||||||
|
|
||||||
void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura)
|
void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura)
|
||||||
{
|
{
|
||||||
if(m_CastItem)
|
if (m_CastItem)
|
||||||
m_castItemGUID = m_CastItem->GetGUID();
|
m_castItemGUID = m_CastItem->GetGUID();
|
||||||
else
|
else
|
||||||
m_castItemGUID = 0;
|
m_castItemGUID = 0;
|
||||||
|
|
||||||
m_targets = *targets;
|
m_targets = *targets;
|
||||||
|
|
||||||
if(!m_targets.getUnitTargetGUID() && m_spellInfo->Targets & TARGET_FLAG_UNIT)
|
if (!m_targets.getUnitTargetGUID() && m_spellInfo->Targets & TARGET_FLAG_UNIT)
|
||||||
{
|
{
|
||||||
Unit *target = NULL;
|
Unit *target = NULL;
|
||||||
if(m_caster->GetTypeId() == TYPEID_UNIT)
|
if(m_caster->GetTypeId() == TYPEID_UNIT)
|
||||||
@@ -2573,7 +2573,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
|
|||||||
else
|
else
|
||||||
target = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
|
target = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
|
||||||
|
|
||||||
if(target && IsValidSingleTargetSpell(target))
|
if (target && IsValidSingleTargetSpell(target))
|
||||||
m_targets.setUnitTarget(target);
|
m_targets.setUnitTarget(target);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2586,7 +2586,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
|
|||||||
// Fill aura scaling information
|
// Fill aura scaling information
|
||||||
if (m_caster->IsControlledByPlayer() && !IsPassiveSpell(m_spellInfo->Id) && m_spellInfo->spellLevel && !IsChanneledSpell(m_spellInfo) && !m_IsTriggeredSpell)
|
if (m_caster->IsControlledByPlayer() && !IsPassiveSpell(m_spellInfo->Id) && m_spellInfo->spellLevel && !IsChanneledSpell(m_spellInfo) && !m_IsTriggeredSpell)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
|
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||||
{
|
{
|
||||||
if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
|
if (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
|
||||||
{
|
{
|
||||||
@@ -6350,7 +6350,9 @@ bool SpellEvent::IsDeletable() const
|
|||||||
|
|
||||||
bool Spell::IsValidSingleTargetEffect(Unit const* target, Targets type) const
|
bool Spell::IsValidSingleTargetEffect(Unit const* target, Targets type) const
|
||||||
{
|
{
|
||||||
switch(type)
|
if (target->GetMapId() == MAPID_INVALID)
|
||||||
|
return false;
|
||||||
|
switch (type)
|
||||||
{
|
{
|
||||||
case TARGET_UNIT_TARGET_ENEMY:
|
case TARGET_UNIT_TARGET_ENEMY:
|
||||||
return !m_caster->IsFriendlyTo(target);
|
return !m_caster->IsFriendlyTo(target);
|
||||||
|
|||||||
Reference in New Issue
Block a user