mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 03:15:41 +00:00
refactor(Core/Combat): Code style and improvement of ThreatMgr (#12992)
This commit is contained in:
@@ -102,17 +102,17 @@ struct boss_faction_championsAI : public ScriptedAI
|
||||
|
||||
void RecalculateThreat()
|
||||
{
|
||||
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
|
||||
ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
|
||||
for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
|
||||
{
|
||||
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
|
||||
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().getThreat(pUnit) )
|
||||
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit) )
|
||||
{
|
||||
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
|
||||
me->GetThreatMgr().modifyThreatPercent(pUnit, -100);
|
||||
//me->getThreatMgr().doAddThreat(pUnit, 10000000.0f * threatMod);
|
||||
if (HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit))
|
||||
ref->addThreat(10000000.0f * threatMod);
|
||||
me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);
|
||||
//me->getThreatMgr().DoAddThreat(pUnit, 10000000.0f * threatMod);
|
||||
if (HostileReference* ref = me->GetThreatMgr().GetOnlineContainer().getReferenceByTarget(pUnit))
|
||||
ref->AddThreat(10000000.0f * threatMod);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ struct boss_faction_championsAI : public ScriptedAI
|
||||
|
||||
uint32 EnemiesInRange(float distance)
|
||||
{
|
||||
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
|
||||
ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
|
||||
uint32 count = 0;
|
||||
Unit* target;
|
||||
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
|
||||
@@ -191,7 +191,7 @@ struct boss_faction_championsAI : public ScriptedAI
|
||||
|
||||
Unit* SelectEnemyCaster(bool casting, float range)
|
||||
{
|
||||
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList();
|
||||
ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
|
||||
Unit* target;
|
||||
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user