fix(DB/Creature): Fix ZA bosses not despawning on evade (#20900)

This commit is contained in:
Andrew
2024-12-12 02:09:59 -03:00
committed by GitHub
parent cef1b781d7
commit a4c30ad720
2 changed files with 21 additions and 0 deletions

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CreatureGroups.h"
#include "CreatureScript.h"
#include "Player.h"
#include "ScriptedCreature.h"
@@ -144,6 +145,9 @@ struct boss_zuljin : public BossAI
me->SetCombatMovement(true);
me->m_Events.KillAllEvents(false);
_nextPhase = 0;
if (CreatureGroup* formation = me->GetFormation())
formation->RespawnFormation(true);
}
void JustEngagedWith(Unit* /*who*/) override
@@ -239,6 +243,21 @@ struct boss_zuljin : public BossAI
});
}
void EnterEvadeMode(EvadeReason /*why*/) override
{
if (CreatureGroup* formation = me->GetFormation())
{
for (auto const& itr : formation->GetMembers())
{
if (itr.first && itr.first != me)
itr.first->DespawnOnEvade(2min);
}
}
me->DespawnOnEvade(2min);
_EnterEvadeMode();
}
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_CLAW_RAGE_CHARGE && target != me)