aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Combat/ThreatManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Combat/ThreatManager.cpp')
-rwxr-xr-xsrc/server/game/Combat/ThreatManager.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index d82e43ba83b..87853a53b6c 100755
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
return false;
// not in same map or phase
- if (!hatedUnit->IsInMap(hatingUnit))
+ if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit))
return false;
// spell not causing threat
@@ -182,6 +182,7 @@ void HostileReference::updateOnlineStatus()
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
&& !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT)
&& getTarget()->IsInMap(getSourceUnit())
+ && getTarget()->InSamePhase(getSourceUnit())
)
{
Creature* creature = getSourceUnit()->ToCreature();
@@ -193,7 +194,6 @@ void HostileReference::updateOnlineStatus()
}
else
accessible = true;
-
}
setAccessibleState(accessible);
setOnlineOfflineState(online);
@@ -353,7 +353,9 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
// list sorted and and we check current target, then this is best case
if (currentVictim == currentRef || currentRef->getThreat() <= 1.1f * currentVictim->getThreat())
{
- currentRef = currentVictim; // for second case
+ if (currentVictim != currentRef && attacker->canCreatureAttack(currentVictim->getTarget()))
+ currentRef = currentVictim; // for second case, if currentvictim is attackable
+
found = true;
break;
}
@@ -534,6 +536,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
setCurrentVictim(NULL);
setDirty(true);
}
+ iOwner->SendRemoveFromThreatListOpcode(hostilRef);
iThreatContainer.remove(hostilRef);
iThreatOfflineContainer.addReference(hostilRef);
}