Index: src/game/SpellAuras.cpp =================================================================== --- src/game/SpellAuras.cpp (revision 5333) +++ src/game/SpellAuras.cpp (working copy) @@ -429,6 +429,22 @@ { } +SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, +Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem) +{ + if (caster) + m_casters_target_guid = caster->GetUInt64Value(UNIT_FIELD_TARGET); +} + +SingleEnemyTargetAura::~SingleEnemyTargetAura() +{ +} + +Unit* SingleEnemyTargetAura::GetTriggerTarget() const +{ + return ObjectAccessor::GetUnit(*m_target, m_casters_target_guid); +} + Unit* Aura::GetCaster() const { if(m_caster_guid==m_target->GetGUID()) @@ -1055,7 +1071,7 @@ // generic casting code with custom spells and target/caster customs uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex]; Unit* caster = GetCaster(); - Unit* target = m_target; + Unit* target = GetTriggerTarget(); uint64 originalCasterGUID = GetCasterGUID(); // specific code for cases with no trigger spell provided in field @@ -1077,14 +1093,6 @@ case 29528: trigger_spell_id = 28713; break; // Inoculation case 29917: trigger_spell_id = 29916; break; // Feed Captured Animal - case 1515: // Tame Beast - { - // TODO: currently this used as hack for Tame beast triggered spell, - // BUT this can be correct way to provide target for ALL this function calls - // in case m_target==caster (or GetSpellProto()->EffectImplicitTargetA[m_effIndex]==TARGET_SELF ) - target = ObjectAccessor::GetUnit(*m_target, m_target->GetUInt64Value(UNIT_FIELD_TARGET)); - break; - } case 1010: // Curse of Idiocy { // TODO: spell casted by result in correct way mostly Index: src/game/SpellAuras.h =================================================================== --- src/game/SpellAuras.h (revision 5333) +++ src/game/SpellAuras.h (working copy) @@ -261,6 +261,8 @@ int32 m_procCharges; + virtual Unit* GetTriggerTarget() { return m_target; } + // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras void HandleShapeshiftBoosts(bool apply); protected: @@ -319,4 +321,15 @@ ~PersistentAreaAura(); void Update(uint32 diff); }; + +class MANGOS_DLL_SPEC SingleEnemyTargetAura : public Aura +{ + public: + SingleEnemyTargetAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem = NULL); + ~SingleEnemyTargetAura(); + Unit* GetTriggerTarget() const; + + protected: + uint64 m_casters_target_guid; +}; #endif Index: src/game/SpellEffects.cpp =================================================================== --- src/game/SpellEffects.cpp (revision 5333) +++ src/game/SpellEffects.cpp (working copy) @@ -1645,26 +1645,6 @@ sLog.outDebug("Spell: Additional Aura is: %u", AdditionalSpellInfo->EffectApplyAuraName[0]); } } - - // arcane missiles, do not affect tame beast - if(Aur->IsTrigger() && m_spellInfo->Id != 1515) - { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); - if (!spellInfo) return; - if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->EffectImplicitTargetA[0] == TARGET_SINGLE_ENEMY) - { - Unit *target = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection()); - if (target) - { - if (!m_caster->IsFriendlyTo(target)) - Aur->SetTarget(target); - else - cancel(); - } - else - cancel(); - } - } } void Spell::EffectUnlearnSpecialization( uint32 i ) Index: src/game/SpellMgr.cpp =================================================================== --- src/game/SpellMgr.cpp (revision 5333) +++ src/game/SpellMgr.cpp (working copy) @@ -1525,3 +1525,17 @@ return false; } + +bool IsTargetSingleEnemyAura(SpellEntry const* spellInfo, uint8 effectId) +{ + uint32 triggeredSpellId = spellInfo->EffectTriggerSpell[effectId]; + + bool hasTargetSingleEnemy = false; + SpellEntry const* triggredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId); + if (triggredSpellInfo) + { + for (int i = 0; i < 3; ++i) + hasTargetSingleEnemy |= (triggredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY); + } + return hasTargetSingleEnemy; +} \ No newline at end of file Index: src/game/SpellMgr.h =================================================================== --- src/game/SpellMgr.h (revision 5333) +++ src/game/SpellMgr.h (working copy) @@ -106,6 +106,8 @@ bool CanUsedWhileStealthed(uint32 spellId); bool IsMechanicInvulnerabilityImmunityToSpell(SpellEntry const* spellInfo); +bool IsTargetSingleEnemyAura(SpellEntry const* spellInfo, uint8 effectId); + // Spell affects related declarations (accessed using SpellMgr functions) struct SpellAffection {