mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 05:43:12 +01:00
Custom logic for putting people in combat instead of relying on CreatureAI or Creature methods.
(cherry picked from commit 6a8524c068)
This commit is contained in:
@@ -553,10 +553,25 @@ void Creature::Update(uint32 diff)
|
||||
|
||||
if (m_combatPulseTime == 0)
|
||||
{
|
||||
if (AI())
|
||||
AI()->DoZoneInCombat();
|
||||
else
|
||||
SetInCombatWithZone();
|
||||
Map::PlayerList const &players = GetMap()->GetPlayers();
|
||||
if (!players.isEmpty())
|
||||
for (Map::PlayerList::const_iterator it = players.begin(); it != players.end(); ++it)
|
||||
{
|
||||
if (Player* player = it->GetSource())
|
||||
{
|
||||
if (player->IsGameMaster())
|
||||
continue;
|
||||
|
||||
if (player->IsAlive() && this->IsHostileTo(player))
|
||||
{
|
||||
if (CanHaveThreatList())
|
||||
AddThreat(player, 0.0f);
|
||||
this->SetInCombatWith(player);
|
||||
player->SetInCombatWith(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_combatPulseTime = m_combatPulseDelay * IN_MILLISECONDS;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user