diff options
author | QAston <none@none> | 2009-08-04 19:28:31 +0200 |
---|---|---|
committer | QAston <none@none> | 2009-08-04 19:28:31 +0200 |
commit | d95e9c1027380f93b045e2fdea400256a0214860 (patch) | |
tree | 022925343ff003663ff2e93185ce877e9dca007e /src/game/Spell.cpp | |
parent | 1d7375c545e881a12d12f633e0387695b327c432 (diff) |
*Fix Gargoyle feeding behaviour - original patch by thenecromancer.
*Add SPELL_TARGET_TYPE_CONTROLLED for spell_script_target table for fast search of units(grid search skipped) and to prevent applying effects to not owned summons
--HG--
branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r-- | src/game/Spell.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 837b8606398..999cdd8c893 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1730,6 +1730,15 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType) { switch(i_spellST->second.type) { + case SPELL_TARGET_TYPE_CONTROLLED: + for(Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) + if ((*itr)->GetEntry() == i_spellST->second.targetEntry && (*itr)->IsWithinDistInMap(m_caster, range)) + { + goScriptTarget = NULL; + range = m_caster->GetDistance(creatureScriptTarget); + creatureScriptTarget = ((Creature *)*itr); + } + break; case SPELL_TARGET_TYPE_GAMEOBJECT: if(i_spellST->second.targetEntry) { @@ -2261,8 +2270,6 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) { case 46584: // Raise Dead { - // TODO: change visual of corpses which gave ghoul? - // Allow corpses to be ghouled only once? m_targets.m_targetMask &= ~TARGET_FLAG_DEST_LOCATION; WorldObject* result = FindCorpseUsing<MaNGOS::RaiseDeadObjectCheck> (); if(result) @@ -2332,6 +2339,12 @@ void Spell::SetTargetMap(uint32 i, uint32 cur) { if(i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE) SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, i_spellST->second.targetEntry); + else if (i_spellST->second.type == SPELL_TARGET_TYPE_CONTROLLED) + { + for(Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) + if ((*itr)->GetEntry() == i_spellST->second.targetEntry && (*itr)->IsWithinDistInMap(m_caster, radius)) + unitList.push_back(*itr); + } } } } |