*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
This commit is contained in:
QAston
2009-08-04 19:28:31 +02:00
parent 1d7375c545
commit d95e9c1027
7 changed files with 67 additions and 12 deletions
+8 -5
View File
@@ -143,9 +143,13 @@ INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comm
-- -------- -- --------
-- TARGET -- TARGET
-- -------- -- --------
-- Mirror Image
DELETE FROM `spell_script_target` WHERE `entry` IN (58836); DELETE FROM `spell_script_target` WHERE `entry` IN (58836, 50524, 50515);
INSERT INTO `spell_script_target` VALUES (58836, 1, 31216); INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES
(58836, 3, 31216), -- Mirror Image
(50524, 3, 27829), -- Runic Power Feed
(50515, 3, 27829); -- Dismiss Gargoyle
-- zulaman -- zulaman
DELETE FROM `spell_script_target` WHERE `entry` IN DELETE FROM `spell_script_target` WHERE `entry` IN
(42577,42471,43734,42631); (42577,42471,43734,42631);
@@ -1953,8 +1957,7 @@ INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES
(52479, 1, 28822), (52479, 1, 28822),
(52576, 1, 28834), -- Electro-magnetic Pulse (52576, 1, 28834), -- Electro-magnetic Pulse
(52576, 1, 28886), (52576, 1, 28886),
(53110, 1, 28940), -- Devour Humanoid (53110, 1, 28940); -- Devour Humanoid
(48743, 1, 26125); -- Death pact
-- Eye of Acherus -- Eye of Acherus
DELETE FROM `spell_target_position` WHERE `id`=51852; DELETE FROM `spell_target_position` WHERE `id`=51852;
+5
View File
@@ -0,0 +1,5 @@
DELETE FROM `spell_script_target` WHERE `entry` IN (58836, 48743, 50524, 50515);
INSERT INTO `spell_script_target` (`entry`, `type`, `targetEntry`) VALUES
(58836, 3, 31216),
(50524, 3, 27829),
(50515, 3, 27829);
+15 -2
View File
@@ -1730,6 +1730,15 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType)
{ {
switch(i_spellST->second.type) 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: case SPELL_TARGET_TYPE_GAMEOBJECT:
if(i_spellST->second.targetEntry) if(i_spellST->second.targetEntry)
{ {
@@ -2261,8 +2270,6 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
{ {
case 46584: // Raise Dead 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; m_targets.m_targetMask &= ~TARGET_FLAG_DEST_LOCATION;
WorldObject* result = FindCorpseUsing<MaNGOS::RaiseDeadObjectCheck> (); WorldObject* result = FindCorpseUsing<MaNGOS::RaiseDeadObjectCheck> ();
if(result) if(result)
@@ -2332,6 +2339,12 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
{ {
if(i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE) if(i_spellST->second.type == SPELL_TARGET_TYPE_CREATURE)
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, i_spellST->second.targetEntry); 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);
}
} }
} }
} }
+12 -2
View File
@@ -2813,6 +2813,14 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
return; return;
} }
break; 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: default:
break; break;
} }
@@ -7214,8 +7222,9 @@ void AuraEffect::PeriodicDummyTick()
return; return;
} }
// Summon Gargoyle // Summon Gargoyle
// if (spell->SpellFamilyFlags & 0x0000008000000000LL) // Being pursuaded by Gargoyle - AI related?
// return; // if (spell->SpellFamilyFlags[1] & 0x00000080)
// break;
// Death Rune Mastery // Death Rune Mastery
// if (spell->SpellFamilyFlags & 0x0000000000004000LL) // if (spell->SpellFamilyFlags & 0x0000000000004000LL)
// return; // return;
@@ -7612,6 +7621,7 @@ void AuraEffect::HandleAuraCloneCaster( bool Apply, bool Real , bool /*changeAmo
{ {
if (!Real) if (!Real)
return; return;
if (Apply) if (Apply)
{ {
Unit * caster = GetCaster(); Unit * caster = GetCaster();
+20 -1
View File
@@ -1936,11 +1936,30 @@ void Spell::EffectDummy(uint32 i)
bp = damage; bp = damage;
} }
m_caster->CastCustomSpell(unitTarget,m_spellInfo->CalculateSimpleValue(1),&bp,NULL,NULL,true); m_caster->CastCustomSpell(unitTarget,m_spellInfo->CalculateSimpleValue(1),&bp,NULL,NULL,true);
// Suicide // Corpse Explosion (Suicide)
unitTarget->CastCustomSpell(unitTarget,43999,&bp,NULL,NULL,true); unitTarget->CastCustomSpell(unitTarget,43999,&bp,NULL,NULL,true);
// Set corpse look // Set corpse look
unitTarget->SetDisplayId(25537+urand(0,3)); 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; break;
} }
+4
View File
@@ -720,6 +720,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
case 31719: // Suspension case 31719: // Suspension
case 61987: // Avenging Wrath Marker case 61987: // Avenging Wrath Marker
case 11196: // Recently Bandadged case 11196: // Recently Bandadged
case 50524: // Runic Power Feed
return false; return false;
case 12042: // Arcane Power case 12042: // Arcane Power
return true; return true;
@@ -1933,6 +1934,9 @@ void SpellMgr::LoadSpellScriptTarget()
} }
break; break;
} }
case SPELL_TARGET_TYPE_CONTROLLED:
if( targetEntry==0 )
sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry);
default: default:
{ {
//players //players
+3 -2
View File
@@ -533,10 +533,11 @@ enum SpellScriptTargetType
{ {
SPELL_TARGET_TYPE_GAMEOBJECT = 0, SPELL_TARGET_TYPE_GAMEOBJECT = 0,
SPELL_TARGET_TYPE_CREATURE = 1, 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 struct SpellTargetEntry
{ {