*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
+15 -2
View File
@@ -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);
}
}
}
}
+12 -2
View File
@@ -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();
+20 -1
View File
@@ -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;
}
+4
View File
@@ -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
+3 -2
View File
@@ -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
{