Yeah, thx for pointing on TriggerSpell.
What you want? It's clear enough.
AM is a similar to many spells like Penance. So nothing "special" needed. Or, perhaps, i don't understand your thought.
For what purpose?
Too complicated. KISS,
Anyway, i found a... way.
Let's see a mangos SpellAuras.cpp in func TriggerSpell:
ObjectGuid casterGUID = GetCasterGuid(); //remember! it's always original caster!
Unit* triggerTarget = GetTriggerTarget(); //and this is target
...
// Victim, spellInfo, triggered, castItem, triggeredByAura, originalCaster ....
triggerTarget->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this, casterGUID);
That means, in "default case", caster will be always == victim, which is truth in server inner logic(AM is a aura on victim), but wrong in theory(it's a regular spell A->B).
Let's see a trinity core(oregoncore) in same place:
in constructor init: m_target(target) // m_target = target(from args)
Unit* caster = GetCaster();
Unit* target = GetTriggerTarget();
uint64 originalCasterGUID = GetCasterGUID();
m_target->CastSpell(target, triggeredSpellInfo, true, 0, this, originalCasterGUID);
m_target is target, placed in Aura constructor.
So, let's see what happens on AM spellcast:
It places 2 auras with spellproto id of AM channeled spell(in case of TBC - 38699): with same target and caster pointer and with different target and caster pointers(second effect, with id 38700).
Important thing: in mangos and oregoncore it has same behavior! That means, real problem is betweet constructor calling and CastSpell!
Okay, we in constructor. So whats happend in it?
In oregon: save target into m_target.
In mangos: ... nothing!
Okay, next... In Aura::TriggerSpell():
In oregon: m_target casts AM(aura effect spell 38700) on target. But target is "GetTriggerTarget();"! Just a triggerTarget, in mangos.
In mangos: stupidly triggerTarget casts AM on itself.
Solution: save "target" from Aura constructor arguments, use it as target->CastSpell.
Really simple. Not tested, but all comment and thoughts are welcome.