From 3b4159e1e3364651f2712d47728538c96f824059 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Fri, 13 Nov 2009 16:34:04 +0100 Subject: Apply #212 New functions: void DoAddAuraToAllHostilePlayers & void DoCastToAllHostilePlayers patch by Maanuel --HG-- branch : trunk --- .../northrend/obsidian_sanctum/boss_sartharion.cpp | 16 +++--------- src/game/UnitAI.cpp | 30 ++++++++++++++++++++++ src/game/UnitAI.h | 2 ++ 3 files changed, 35 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp index 768e6520b92..caed800001f 100644 --- a/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp +++ b/src/bindings/scripts/scripts/northrend/obsidian_sanctum/boss_sartharion.cpp @@ -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& threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::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; } diff --git a/src/game/UnitAI.cpp b/src/game/UnitAI.cpp index 85b8ad6abba..bafcb04a2f3 100644 --- a/src/game/UnitAI.cpp +++ b/src/game/UnitAI.cpp @@ -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& threatlist = me->getThreatManager().getThreatList(); + for (std::list::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& threatlist = me->getThreatManager().getThreatList(); + for (std::list::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; diff --git a/src/game/UnitAI.h b/src/game/UnitAI.h index c5e02b07d1b..e56ae6a8e0a 100644 --- a/src/game/UnitAI.h +++ b/src/game/UnitAI.h @@ -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); -- cgit v1.2.3