diff options
author | Silker <61223313+Si1ker@users.noreply.github.com> | 2021-09-16 06:32:36 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-16 14:32:36 +0200 |
commit | 4dc642d530e3d4aa66f9b3a6bbb941392553d7b9 (patch) | |
tree | 863cd6555d507560782f0f6d29d928c1947e8416 /src/server/game/AI/CreatureAI.cpp | |
parent | fd229f75e10aa01e6d298baeb0b5fb8470dff870 (diff) |
fix(Creature/Core): Boss phased reset (#7828)
Co-authored-by: Si1ker <Si1ker@users.noreply.github.com>
Co-authored-by: lineagedr <lineagedr@users.noreply.github.com>
Co-authored-by: Footman <footman@hotmail.de>
Diffstat (limited to 'src/server/game/AI/CreatureAI.cpp')
-rw-r--r-- | src/server/game/AI/CreatureAI.cpp | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 6aada410ed..09173c0631 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -14,6 +14,21 @@ #include "SpellMgr.h" #include "Vehicle.h" +class PhasedRespawn : public BasicEvent +{ +public: + PhasedRespawn(Creature& owner) : BasicEvent(), _owner(owner) {} + + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override + { + _owner.RespawnOnEvade(); + return true; + } + +private: + Creature& _owner; +}; + //Disable CreatureAI when charmed void CreatureAI::OnCharmed(bool /*apply*/) { @@ -170,10 +185,50 @@ void CreatureAI::EnterEvadeMode() } } - Reset(); - - if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons! - me->GetVehicleKit()->Reset(true); + // @todo: Turn into a flags_extra in creature_template + // despawn bosses at reset - only verified tbc/woltk bosses with this reset type - add bosses in last line respectively (dungeon/raid) and increase array limit + static constexpr std::array<uint32, 24> bosses = { + /* dungeons */ + 28684, /* Krik'thir the Gatewatcher */ + 36502, /* Devourer of Souls */ + 36658, /* Scourgelord Tyrannus */ + /* raids */ + 32871, /* Algalon */ + 39863, /* Halion */ + 33186, /* Razorscale */ + 36626, /* Festergut */ + 32867, /* Steelbreaker - Assembly of Iron */ + 32927, /* Runemaster Molgeim - Assembly of Iron */ + 32857, /* Stormcaller Brundir - Assembly of Iron */ + 33350, /* Mimiron */ + 16060, /* Gothik the Harvester */ + 36678, /* Professor Putricide */ + 15990, /* Kel'Thuzad */ + 33993, /* Emalon the Storm Watcher */ + 17257, /* Magtheridon */ + 25315, /* Kil'jaeden */ + 15928, /* Thaddius */ + 32930, /* Kologarn */ + 32906, /* Freya */ + 36597, /* The Lich King */ + 36853, /* Sindragosa */ + 36855, /* Lady Deathwhisper */ + 37955 /* Blood-Queen Lana'thel */ + }; + + if (std::find(std::begin(bosses), std::end(bosses), me->GetEntry()) != std::end(bosses)) + { + me->DespawnOnEvade(); + me->m_Events.AddEvent(new PhasedRespawn(*me), me->m_Events.CalculateTime(20000)); + } + else // bosses will run back to the spawnpoint at reset + { + Reset(); + if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons! + { + me->GetVehicleKit()->Reset(true); + } + } } /*void CreatureAI::AttackedBy(Unit* attacker) |