mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-29 13:22:48 +01:00
Merge pull request #16666 from Treeston/3.3.5-bodypull
[3.3.5] Fix bosses losing interest in the person running at them
This commit is contained in:
@@ -134,7 +134,10 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (me->HasReactState(REACT_AGGRESSIVE) && me->CanStartAttack(who, false))
|
if (me->HasReactState(REACT_AGGRESSIVE) && me->CanStartAttack(who, false))
|
||||||
|
{
|
||||||
|
me->AddThreat(who, 0.0f); // ensure our initial target is the first thing added to threat list so we don't randomly switch off if DoZoneInCombat is called during the EnterCombat hook
|
||||||
AttackStart(who);
|
AttackStart(who);
|
||||||
|
}
|
||||||
//else if (who->GetVictim() && me->IsFriendlyTo(who)
|
//else if (who->GetVictim() && me->IsFriendlyTo(who)
|
||||||
// && me->IsWithinDistInMap(who, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
|
// && me->IsWithinDistInMap(who, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
|
||||||
// && me->CanStartAttack(who->GetVictim(), true)) /// @todo if we use true, it will not attack it when it arrives
|
// && me->CanStartAttack(who->GetVictim(), true)) /// @todo if we use true, it will not attack it when it arrives
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
|
|||||||
{
|
{
|
||||||
// current victim is a second choice target, so don't compare threat with it below
|
// current victim is a second choice target, so don't compare threat with it below
|
||||||
if (currentRef == currentVictim)
|
if (currentRef == currentVictim)
|
||||||
currentVictim = NULL;
|
currentVictim = nullptr;
|
||||||
++iter;
|
++iter;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -437,12 +437,15 @@ void ThreatManager::_addThreat(Unit* victim, float threat)
|
|||||||
|
|
||||||
if (!ref) // there was no ref => create a new one
|
if (!ref) // there was no ref => create a new one
|
||||||
{
|
{
|
||||||
|
bool isFirst = iThreatContainer.empty();
|
||||||
// threat has to be 0 here
|
// threat has to be 0 here
|
||||||
HostileReference* hostileRef = new HostileReference(victim, this, 0);
|
HostileReference* hostileRef = new HostileReference(victim, this, 0);
|
||||||
iThreatContainer.addReference(hostileRef);
|
iThreatContainer.addReference(hostileRef);
|
||||||
hostileRef->addThreat(threat); // now we add the real threat
|
hostileRef->addThreat(threat); // now we add the real threat
|
||||||
if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster())
|
if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster())
|
||||||
hostileRef->setOnlineOfflineState(false); // GM is always offline
|
hostileRef->setOnlineOfflineState(false); // GM is always offline
|
||||||
|
else if (isFirst)
|
||||||
|
setCurrentVictim(hostileRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class ThreatContainer
|
|||||||
|
|
||||||
HostileReference* getMostHated() const
|
HostileReference* getMostHated() const
|
||||||
{
|
{
|
||||||
return iThreatList.empty() ? NULL : iThreatList.front();
|
return iThreatList.empty() ? nullptr : iThreatList.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
HostileReference* getReferenceByTarget(Unit* victim) const;
|
HostileReference* getReferenceByTarget(Unit* victim) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user