mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Merge pull request #15504 from Treeston/3.3.5-bosscombatpulse
Core/Creature: Add default-disabled periodic zone combat pulse (and have base AI enable it for bosses)
This commit is contained in:
@@ -470,6 +470,7 @@ void BossAI::_Reset()
|
||||
if (!me->IsAlive())
|
||||
return;
|
||||
|
||||
me->SetCombatPulseDelay(0);
|
||||
me->ResetLootMode();
|
||||
events.Reset();
|
||||
summons.DespawnAll();
|
||||
@@ -500,6 +501,7 @@ void BossAI::_EnterCombat()
|
||||
instance->SetBossState(_bossId, IN_PROGRESS);
|
||||
}
|
||||
|
||||
me->SetCombatPulseDelay(5);
|
||||
me->setActive(true);
|
||||
DoZoneInCombat();
|
||||
ScheduleTasks();
|
||||
|
||||
@@ -138,7 +138,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
|
||||
Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapObject(),
|
||||
m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0),
|
||||
m_lootRecipient(), m_lootRecipientGroup(0), _skinner(), _pickpocketLootRestore(0), m_corpseRemoveTime(0), m_respawnTime(0),
|
||||
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE),
|
||||
m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_combatPulseTime(0), m_combatPulseDelay(0), m_reactState(REACT_AGGRESSIVE),
|
||||
m_defaultMovementType(IDLE_MOTION_TYPE), m_spawnId(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false),
|
||||
m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL)
|
||||
@@ -539,10 +539,44 @@ void Creature::Update(uint32 diff)
|
||||
LastCharmerGUID.Clear();
|
||||
}
|
||||
|
||||
// if periodic combat pulse is enabled and we are both in combat and in a dungeon, do this now
|
||||
if (m_combatPulseDelay > 0 && IsInCombat() && GetMap()->IsDungeon())
|
||||
{
|
||||
if (diff > m_combatPulseTime)
|
||||
m_combatPulseTime = 0;
|
||||
else
|
||||
m_combatPulseTime -= diff;
|
||||
|
||||
if (m_combatPulseTime == 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsInEvadeMode() && IsAIEnabled)
|
||||
{
|
||||
// do not allow the AI to be changed during update
|
||||
m_AI_locked = true;
|
||||
|
||||
i_AI->UpdateAI(diff);
|
||||
m_AI_locked = false;
|
||||
}
|
||||
|
||||
@@ -601,6 +601,14 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
|
||||
float GetRespawnRadius() const { return m_respawnradius; }
|
||||
void SetRespawnRadius(float dist) { m_respawnradius = dist; }
|
||||
|
||||
uint32 GetCombatPulseDelay() const { return m_combatPulseDelay; }
|
||||
void SetCombatPulseDelay(uint32 delay) // (secs) interval at which the creature pulses the entire zone into combat (only works in dungeons)
|
||||
{
|
||||
m_combatPulseDelay = delay;
|
||||
if (m_combatPulseTime == 0 || m_combatPulseTime > delay)
|
||||
m_combatPulseTime = delay;
|
||||
}
|
||||
|
||||
uint32 m_groupLootTimer; // (msecs)timer used for group loot
|
||||
uint32 lootingGroupLowGUID; // used to find group which is looting corpse
|
||||
|
||||
@@ -686,6 +694,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
|
||||
uint32 m_respawnDelay; // (secs) delay between corpse disappearance and respawning
|
||||
uint32 m_corpseDelay; // (secs) delay between death and corpse disappearance
|
||||
float m_respawnradius;
|
||||
uint32 m_combatPulseTime; // (msecs) remaining time for next zone-in-combat pulse
|
||||
uint32 m_combatPulseDelay; // (secs) how often the creature puts the entire zone in combat (only works in dungeons)
|
||||
|
||||
ReactStates m_reactState; // for AI, not charmInfo
|
||||
void RegenerateMana();
|
||||
|
||||
Reference in New Issue
Block a user