aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/EasternKingdoms
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp52
-rw-r--r--src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp26
2 files changed, 26 insertions, 52 deletions
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
index 6635fc0bc7b..4ffaf1c5f42 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp
@@ -199,30 +199,21 @@ public:
if (!summonedUnit)
return;
- ThreatContainer::StorageType const& threatlist = me->GetThreatManager().getThreatList();
- ThreatContainer::StorageType::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i != threatlist.end(); ++i)
+ for (auto* ref : me->GetThreatManager().GetUnsortedThreatList())
{
- Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
+ Unit* unit = ref->GetVictim();
if (unit && unit->IsAlive())
- {
- float threat = me->GetThreatManager().getThreat(unit);
- AddThreat(unit, threat, summonedUnit);
- }
+ AddThreat(unit, ref->GetThreat(), summonedUnit);
}
}
void TeleportPlayersToSelf()
{
- float x = KaelLocations[0][0];
- float y = KaelLocations[0][1];
- me->UpdatePosition(x, y, LOCATION_Z, 0.0f);
- ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
- ThreatContainer::StorageType::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i != threatlist.end(); ++i)
+ me->UpdatePosition(KaelLocations[0][0], KaelLocations[0][1], LOCATION_Z, 0.0f);
+ for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
{
- Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
- if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
+ Unit* unit = pair.second->GetOther(me);
+ if (unit->GetTypeId() == TYPEID_PLAYER)
unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true);
}
DoCast(me, SPELL_TELEPORT_CENTER, true);
@@ -230,14 +221,11 @@ public:
void CastGravityLapseKnockUp()
{
- ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
- ThreatContainer::StorageType::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i != threatlist.end(); ++i)
+ for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
{
- Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
- if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
+ Unit* unit = pair.second->GetOther(me);
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
- // Knockback into the air
CastSpellExtraArgs args;
args.TriggerFlags = TRIGGERED_FULL_MASK;
args.OriginalCaster = me->GetGUID();
@@ -248,12 +236,10 @@ public:
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
{
- ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
- ThreatContainer::StorageType::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i != threatlist.end(); ++i)
+ for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
{
- Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
- if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
+ Unit* unit = pair.second->GetOther(me);
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
// Also needs an exception in spell system.
CastSpellExtraArgs args;
@@ -267,12 +253,10 @@ public:
void RemoveGravityLapse()
{
- ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList();
- ThreatContainer::StorageType::const_iterator i = threatlist.begin();
- for (i = threatlist.begin(); i != threatlist.end(); ++i)
+ for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
{
- Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
- if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
+ Unit* unit = pair.second->GetOther(me);
+ if (unit->GetTypeId() == TYPEID_PLAYER)
{
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
@@ -684,8 +668,8 @@ public:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
- AddThreat(target, 1.0f);
- me->TauntApply(target);
+ ResetThreatList();
+ AddThreat(target, 1000000.0f);
AttackStart(target);
}
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
index 9480bf038a5..6d7816ff0d8 100644
--- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
+++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp
@@ -855,17 +855,12 @@ public:
if (Blink_Timer <= diff)
{
bool InMeleeRange = false;
- ThreatContainer::StorageType const& t_list = me->GetThreatManager().getThreatList();
- for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (pair.second->GetOther(me)->IsWithinMeleeRange(me))
{
- //if in melee range
- if (target->IsWithinDistInMap(me, 5))
- {
- InMeleeRange = true;
- break;
- }
+ InMeleeRange = true;
+ break;
}
}
@@ -949,17 +944,12 @@ public:
if (Intercept_Stun_Timer <= diff)
{
bool InMeleeRange = false;
- ThreatContainer::StorageType const& t_list = me->GetThreatManager().getThreatList();
- for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
+ for (auto const& pair : me->GetCombatManager().GetPvECombatRefs())
{
- if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
+ if (pair.second->GetOther(me)->IsWithinMeleeRange(me))
{
- //if in melee range
- if (target->IsWithinDistInMap(me, ATTACK_DISTANCE))
- {
- InMeleeRange = true;
- break;
- }
+ InMeleeRange = true;
+ break;
}
}