Core/Threat: Threat system adjustments:

* Online states are now re-evaluated before victim update instead of continuously. Closes #22226. Tagging #21501.
* Victim update now happens every 1s as opposed to every server tick unless current target goes away.
* Suppressed threat is no longer re-established until the victim gains additional threat (by hitting the target, for instance).
* Assistance threat is now split between non-controlled units threatened by target, as opposed to all units threatened by target.

(cherry picked from commit 5cea572a9a)
This commit is contained in:
Treeston
2018-08-27 19:08:17 +02:00
committed by Shauren
parent 395f58d651
commit 392a644dc8
11 changed files with 218 additions and 185 deletions

View File

@@ -295,9 +295,6 @@ public:
void UpdateAI(uint32 diff) override
{
if (!_lastPlayerCombatState && me->IsEngaged())
me->GetThreatManager().UpdateOnlineStates(false, true);
if (!UpdateVictim())
return;

View File

@@ -610,7 +610,10 @@ struct boss_faction_championsAI : public BossAI
{
for (ThreatReference* ref : me->GetThreatManager().GetModifiableThreatList())
if (Player* victim = ref->GetVictim()->ToPlayer())
ref->SetThreat(1000000.0f * CalculateThreat(me->GetDistance2d(victim), victim->GetArmor(), victim->GetHealth()));
{
ref->ScaleThreat(0.0f);
ref->AddThreat(1000000.0f * CalculateThreat(me->GetDistance2d(victim), victim->GetArmor(), victim->GetHealth()));
}
}
void UpdatePower()

View File

@@ -600,7 +600,7 @@ class boss_algalon_the_observer : public CreatureScript
//! for creatures that start combat in REACT_PASSIVE and UNIT_FLAG_NOT_SELECTABLE
//! causing them to immediately evade
if (!me->GetThreatManager().IsThreatListEmpty())
AttackStart(me->GetThreatManager().SelectVictim());
AttackStart(me->GetThreatManager().GetCurrentVictim());
for (uint32 i = 0; i < LIVING_CONSTELLATION_COUNT; ++i)
if (Creature* summon = DoSummon(NPC_LIVING_CONSTELLATION, ConstellationPos[i], 0, TEMPSUMMON_DEAD_DESPAWN))
summon->SetReactState(REACT_PASSIVE);