aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2009-08-04 19:28:31 +0200
committerQAston <none@none>2009-08-04 19:28:31 +0200
commitd95e9c1027380f93b045e2fdea400256a0214860 (patch)
tree022925343ff003663ff2e93185ce877e9dca007e /src
parent1d7375c545e881a12d12f633e0387695b327c432 (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')
-rw-r--r--src/game/Spell.cpp17
-rw-r--r--src/game/SpellAuras.cpp14
-rw-r--r--src/game/SpellEffects.cpp21
-rw-r--r--src/game/SpellMgr.cpp4
-rw-r--r--src/game/SpellMgr.h5
5 files changed, 54 insertions, 7 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);
+ }
}
}
}
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 6e893611304..aa8c2014b7a 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2813,6 +2813,14 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
return;
}
break;
+ case SPELLFAMILY_DEATHKNIGHT:
+ // Summon Gargoyle ( will start feeding gargoyle )
+ if(GetId()==61777)
+ {
+ m_target->CastSpell(m_target,m_spellProto->EffectTriggerSpell[m_effIndex],true);
+ return;
+ }
+ break;
default:
break;
}
@@ -7214,8 +7222,9 @@ void AuraEffect::PeriodicDummyTick()
return;
}
// Summon Gargoyle
-// if (spell->SpellFamilyFlags & 0x0000008000000000LL)
-// return;
+ // Being pursuaded by Gargoyle - AI related?
+ // if (spell->SpellFamilyFlags[1] & 0x00000080)
+ // break;
// Death Rune Mastery
// if (spell->SpellFamilyFlags & 0x0000000000004000LL)
// return;
@@ -7612,6 +7621,7 @@ void AuraEffect::HandleAuraCloneCaster( bool Apply, bool Real , bool /*changeAmo
{
if (!Real)
return;
+
if (Apply)
{
Unit * caster = GetCaster();
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 3f95efcdeed..b3ee8baa7e8 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -1936,11 +1936,30 @@ void Spell::EffectDummy(uint32 i)
bp = damage;
}
m_caster->CastCustomSpell(unitTarget,m_spellInfo->CalculateSimpleValue(1),&bp,NULL,NULL,true);
- // Suicide
+ // Corpse Explosion (Suicide)
unitTarget->CastCustomSpell(unitTarget,43999,&bp,NULL,NULL,true);
// Set corpse look
unitTarget->SetDisplayId(25537+urand(0,3));
}
+ // Runic Power Feed ( keeping Gargoyle alive )
+ else if (m_spellInfo->Id == 50524)
+ {
+ // No power, dismiss Gargoyle
+ if (m_caster->GetPower(POWER_RUNIC_POWER)<30)
+ m_caster->CastSpell((Unit*)NULL,50515,true);
+ else
+ m_caster->ModifyPower(POWER_RUNIC_POWER,-30);
+
+ return;
+ }
+ // Dismiss Gargoyle
+ else if (m_spellInfo->Id == 50515)
+ {
+ // FIXME: gargoyle should fly away
+ unitTarget->setDeathState(JUST_DIED);
+ m_caster->RemoveAurasDueToSpell(50514);
+ return;
+ }
break;
}
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 3802e1c230b..2bc51076de2 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -720,6 +720,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
case 31719: // Suspension
case 61987: // Avenging Wrath Marker
case 11196: // Recently Bandadged
+ case 50524: // Runic Power Feed
return false;
case 12042: // Arcane Power
return true;
@@ -1933,6 +1934,9 @@ void SpellMgr::LoadSpellScriptTarget()
}
break;
}
+ case SPELL_TARGET_TYPE_CONTROLLED:
+ if( targetEntry==0 )
+ sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry);
default:
{
//players
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index b2ba185f82a..42767a7df09 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -533,10 +533,11 @@ enum SpellScriptTargetType
{
SPELL_TARGET_TYPE_GAMEOBJECT = 0,
SPELL_TARGET_TYPE_CREATURE = 1,
- SPELL_TARGET_TYPE_DEAD = 2
+ SPELL_TARGET_TYPE_DEAD = 2,
+ SPELL_TARGET_TYPE_CONTROLLED = 3,
};
-#define MAX_SPELL_TARGET_TYPE 3
+#define MAX_SPELL_TARGET_TYPE 4
struct SpellTargetEntry
{