mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[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:
parent
f726bd69a5
commit
4717f68984
4 changed files with 18 additions and 3 deletions
|
|
@ -119,6 +119,9 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI
|
|||
// Called when hit by a spell
|
||||
void SpellHit(Unit *, const SpellEntry*){}
|
||||
|
||||
// Called when spell hits creature's target
|
||||
void SpellHitTarget(WorldObject*, const SpellEntry*) {}
|
||||
|
||||
Creature* m_creature;
|
||||
|
||||
//= Some useful helpers =========================
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
class Unit;
|
||||
class Creature;
|
||||
class WorldObject;
|
||||
struct SpellEntry;
|
||||
|
||||
#define TIME_INTERVAL_LOOK 5000
|
||||
|
|
@ -79,6 +80,9 @@ class MANGOS_DLL_SPEC CreatureAI
|
|||
// Called when hit by a spell
|
||||
virtual void SpellHit(Unit*, const SpellEntry*) {}
|
||||
|
||||
// Called when spell hits creature's target
|
||||
virtual void SpellHitTarget(WorldObject*, const SpellEntry*) {}
|
||||
|
||||
// Called when vitim entered water and creature can not enter water
|
||||
virtual bool canReachByRangeAttack(Unit*) { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7585"
|
||||
#define REVISION_NR "7586"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue