New functions: void DoAddAuraToAllHostilePlayers & void DoCastToAllHostilePlayers
patch by Maanuel

--HG--
branch : trunk
This commit is contained in:
Kudlaty
2009-11-13 16:34:04 +01:00
parent f04da1b620
commit 3b4159e1e3
3 changed files with 35 additions and 13 deletions
@@ -302,16 +302,6 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI
DoCast(m_creature, SPELL_WILL_OF_SARTHARION);
}
void ApplyDebuff(uint32 spellPowerOf)
{
std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
if (Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
if (target->GetTypeId() == TYPEID_PLAYER)
m_creature->AddAura(spellPowerOf, target);
}
void CallDragon(uint32 uiDataId)
{
if (pInstance)
@@ -332,17 +322,17 @@ struct TRINITY_DLL_DECL boss_sartharionAI : public ScriptedAI
case NPC_TENEBRON:
iTextId = SAY_SARTHARION_CALL_TENEBRON;
pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aTene[1].m_fX, m_aTene[1].m_fY, m_aTene[1].m_fZ);
ApplyDebuff(SPELL_POWER_OF_TENEBRON);
DoAddAuraToAllHostilePlayers(SPELL_POWER_OF_TENEBRON);
break;
case NPC_SHADRON:
iTextId = SAY_SARTHARION_CALL_SHADRON;
pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aShad[1].m_fX, m_aShad[1].m_fY, m_aShad[1].m_fZ);
ApplyDebuff(SPELL_POWER_OF_SHADRON);
DoAddAuraToAllHostilePlayers(SPELL_POWER_OF_SHADRON);
break;
case NPC_VESPERON:
iTextId = SAY_SARTHARION_CALL_VESPERON;
pTemp->GetMotionMaster()->MovePoint(POINT_ID_LAND, m_aVesp[1].m_fX, m_aVesp[1].m_fY, m_aVesp[1].m_fZ);
ApplyDebuff(SPELL_POWER_OF_VESPERON);
DoAddAuraToAllHostilePlayers(SPELL_POWER_OF_VESPERON);
break;
}
+30
View File
@@ -237,6 +237,36 @@ float UnitAI::DoGetSpellMaxRange(uint32 spellId, bool positive)
return GetSpellMaxRange(spellId, positive);
}
void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
{
if (me->isInCombat())
{
std::list<HostilReference*>& threatlist = me->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid()))
if (pTemp->GetTypeId() == TYPEID_PLAYER)
me->AddAura(spellid, pTemp);
}
}else
return;
}
void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
{
if (me->isInCombat())
{
std::list<HostilReference*>& threatlist = me->getThreatManager().getThreatList();
for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid()))
if (pTemp->GetTypeId() == TYPEID_PLAYER)
me->CastSpell(pTemp, spellid, triggered);
}
}else
return;
}
void UnitAI::DoCast(uint32 spellId)
{
Unit *target = NULL;
+2
View File
@@ -68,8 +68,10 @@ class TRINITY_DLL_SPEC UnitAI
void AttackStartCaster(Unit *victim, float dist);
void DoAddAuraToAllHostilePlayers(uint32 spellid);
void DoCast(uint32 spellId);
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false);
void DoCastVictim(uint32 spellId, bool triggered = false);
void DoCastAOE(uint32 spellId, bool triggered = false);