diff options
| author | Treeston <treeston.mmoc@gmail.com> | 2017-07-01 20:18:02 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2020-08-13 22:46:44 +0200 |
| commit | 8be23fcbbdf26e8169defd761e61765f301bebe0 (patch) | |
| tree | 6309b79f7dd617a8ddc801624dbbd4ed7ac22174 /src/server/scripts/EasternKingdoms/MagistersTerrace | |
| parent | 2c99678118798279372f17d4bb5f5a88ac95c413 (diff) | |
[3.3.5] Combat/Threat rewrite - prep & refactor (#19966)
* Combat/Threat rewrite (PR #19930) prep work. Mostly refactors, and a compatibility layer on ThreatManager/HostileReference that allows scripts to be changed already.
(cherry picked from commit e2a1ccd118d129b96e09ff1a15ed0adb1d4a3897)
Diffstat (limited to 'src/server/scripts/EasternKingdoms/MagistersTerrace')
| -rw-r--r-- | src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp | 18 | ||||
| -rw-r--r-- | src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp | 41 |
2 files changed, 20 insertions, 39 deletions
diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 1a379d8676e..a21c0e1ed78 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -200,15 +200,15 @@ public: if (!summonedUnit) return; - ThreatContainer::StorageType const &threatlist = me->getThreatManager().getThreatList(); + ThreatContainer::StorageType const& threatlist = me->GetThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); if (unit && unit->IsAlive()) { - float threat = me->getThreatManager().getThreat(unit); - summonedUnit->AddThreat(unit, threat); + float threat = me->GetThreatManager().getThreat(unit); + AddThreat(unit, threat, summonedUnit); } } } @@ -218,7 +218,7 @@ public: 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 threatlist = me->GetThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { @@ -231,7 +231,7 @@ public: void CastGravityLapseKnockUp() { - ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); + ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { @@ -244,7 +244,7 @@ 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 threatlist = me->GetThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { @@ -260,7 +260,7 @@ public: void RemoveGravityLapse() { - ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList(); + ThreatContainer::StorageType threatlist = me->GetThreatManager().getThreatList(); ThreatContainer::StorageType::const_iterator i = threatlist.begin(); for (i = threatlist.begin(); i != threatlist.end(); ++i) { @@ -400,7 +400,7 @@ public: if (Orb && target) { Orb->SetSpeedRate(MOVE_RUN, 0.5f); - Orb->AddThreat(target, 1000000.0f); + AddThreat(target, 1000000.0f, Orb); Orb->AI()->AttackStart(target); } } @@ -680,7 +680,7 @@ public: { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) { - me->AddThreat(target, 1.0f); + AddThreat(target, 1.0f); me->TauntApply(target); 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 97b410e07c9..1a30ef9dca1 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -168,16 +168,9 @@ public: Talk(SAY_AGGRO); for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) - { if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUID[i])) - { - if (!pAdd->GetVictim()) - { - who->SetInCombatWith(pAdd); - pAdd->AddThreat(who, 0.0f); - } - } - } + if (!pAdd->IsEngaged()) + AddThreat(who, 0.0f, pAdd); instance->SetBossState(DATA_DELRISSA, IN_PROGRESS); } @@ -398,25 +391,13 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI return; for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i) - { if (Unit* pAdd = ObjectAccessor::GetUnit(*me, m_auiLackeyGUIDs[i])) - { - if (!pAdd->GetVictim() && pAdd != me) - { - who->SetInCombatWith(pAdd); - pAdd->AddThreat(who, 0.0f); - } - } - } + if (!pAdd->IsEngaged() && pAdd != me) + AddThreat(who, 0.0f, pAdd); if (Creature* pDelrissa = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_DELRISSA))) - { - if (pDelrissa->IsAlive() && !pDelrissa->GetVictim()) - { - who->SetInCombatWith(pDelrissa); - pDelrissa->AddThreat(who, 0.0f); - } - } + if (pDelrissa->IsAlive() && !pDelrissa->IsEngaged()) + AddThreat(who, 0.0f, pDelrissa); } void JustDied(Unit* /*killer*/) override @@ -472,7 +453,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI if (ResetThreatTimer <= diff) { - DoResetThreat(); + ResetThreatList(); ResetThreatTimer = urand(5000, 20000); } else ResetThreatTimer -= diff; } @@ -544,10 +525,10 @@ public: Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0); - DoResetThreat(); + ResetThreatList(); if (unit) - me->AddThreat(unit, 1000.0f); + AddThreat(unit, 1000.0f); InVanish = true; Vanish_Timer = 30000; @@ -869,7 +850,7 @@ public: if (Blink_Timer <= diff) { bool InMeleeRange = false; - ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); + ThreatContainer::StorageType const& t_list = me->GetThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) @@ -963,7 +944,7 @@ public: if (Intercept_Stun_Timer <= diff) { bool InMeleeRange = false; - ThreatContainer::StorageType const &t_list = me->getThreatManager().getThreatList(); + ThreatContainer::StorageType const& t_list = me->GetThreatManager().getThreatList(); for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) |
