[7586] New caster AI::SpellHitTarget call at casted spell landing to target (player/creature/pet/go)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Lightguard 2009-03-30 00:41:44 +04:00 committed by VladimirMangos
parent f726bd69a5
commit 4717f68984
4 changed files with 18 additions and 3 deletions

View file

@ -978,7 +978,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
// Get original caster (if exist) and calculate damage/healing from him data
Unit *caster = m_originalCaster ? m_originalCaster : m_caster;
// Skip if m_originalCaster not avaiable
// Skip if m_originalCaster not available
if (!caster)
return;
@ -1071,7 +1071,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
}
// Call scripted function for AI if this spell is casted upon a creature (except pets)
if(IS_CREATURE_GUID(target->targetGUID))
if(unit->GetTypeId()==TYPEID_UNIT)
{
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
@ -1081,6 +1081,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if(((Creature*)unit)->AI())
((Creature*)unit)->AI()->SpellHit(m_caster ,m_spellInfo);
}
// Call scripted function for AI if this spell is casted by a creature
if(m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->AI())
((Creature*)m_caster)->AI()->SpellHitTarget(unit,m_spellInfo);
}
void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
@ -1219,6 +1223,10 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
if( m_caster->GetTypeId() == TYPEID_PLAYER && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() )
((Player*)m_caster)->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
// Call scripted function for AI if this spell is casted by a creature
if(m_caster->GetTypeId()==TYPEID_UNIT && ((Creature*)m_caster)->AI())
((Creature*)m_caster)->AI()->SpellHitTarget(go,m_spellInfo);
}
void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)