aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 5a68a5dee95..8f74606cda1 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -4649,28 +4649,25 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT;
- if(m_caster->GetTypeId()==TYPEID_UNIT && (((Creature*)m_caster)->isPet() || m_caster->isCharmed()))
- {
//dead owner (pets still alive when owners ressed?)
- if(m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->isAlive())
- return SPELL_FAILED_CASTER_DEAD;
+ if(Unit *owner = m_caster->GetCharmerOrOwner())
+ if(!owner->isAlive())
+ return SPELL_FAILED_CASTER_DEAD;
if(!target && m_targets.getUnitTarget())
target = m_targets.getUnitTarget();
- bool need = false;
- for(uint32 i = 0;i<3;i++)
+ for(uint32 i = 0; i < 3; ++i)
{
- if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_TARGET_ENEMY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_TARGET_ALLY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_TARGET_ANY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_TARGET_PARTY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_DST_TARGET_ENEMY)
+ if(spellmgr.SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_UNIT_TARGET
+ || spellmgr.SpellTargetType[m_spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_DEST_TARGET)
{
- need = true;
if(!target)
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
+ m_targets.setUnitTarget(target);
break;
}
}
- if(need)
- m_targets.setUnitTarget(target);
Unit* _target = m_targets.getUnitTarget();
@@ -4685,7 +4682,6 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
//cooldown
if(((Creature*)m_caster)->HasSpellCooldown(m_spellInfo->Id))
return SPELL_FAILED_NOT_READY;
- }
return CheckCast(true);
}
@@ -4816,8 +4812,8 @@ bool Spell::CanAutoCast(Unit* target)
}
else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] ))
{
- if( target->HasAuraEffect(m_spellInfo->Id, j) )
- return false;
+ if( target->HasAuraEffect(m_spellInfo->Id, j) )
+ return false;
}
}