Skip to content

Commit

Permalink
fix(Scripts/BlackTemple): Shade of Akama should despawn on evade and …
Browse files Browse the repository at this point in the history
…Akama despawns before dying (#19894)

* fix(Scripts/BlackTemple): Shade of Akama should despawn on evade and Akama despawns before dying

* Create rev_1725714358950337100.sql

* Update boss_shade_of_akama.cpp
  • Loading branch information
Nyeriah committed Sep 9, 2024
1 parent fafd351 commit 56e03c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
2 changes: 2 additions & 0 deletions data/sql/updates/pending_db_world/rev_1725714358950337100.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--
UPDATE `creature_template` SET `flags_extra` = `flags_extra` |2147483648 WHERE `entry` = 22841;
47 changes: 20 additions & 27 deletions src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ struct npc_akama_shade : public ScriptedAI
DoCastSelf(SPELL_STEALTH, true);
me->SetWalk(true);
_sayLowHealth = false;
_died = false;
scheduler.CancelAll();
}

Expand All @@ -232,14 +233,14 @@ struct npc_akama_shade : public ScriptedAI
case POINT_ENGAGE:
me->SetHomePosition(me->GetPosition());
me->SetFaction(FACTION_ENGAGE);
DoCast(me, SPELL_AKAMA_SOUL_CHANNEL, true);
DoCastSelf(SPELL_AKAMA_SOUL_CHANNEL, true);
break;
case POINT_OUTRO:
DoCastSelf(SPELL_AKAMA_SOUL_RETRIEVE, true);
ScheduleUniqueTimedEvent(15600ms, [&]
{
Talk(SAY_BROKEN_FREE_0);
me->SummonCreatureGroup(SUMMON_GROUP_BROKENS);
Talk(SAY_BROKEN_FREE_0);
me->SummonCreatureGroup(SUMMON_GROUP_BROKENS);
}, 1);
ScheduleUniqueTimedEvent(26550ms, [&]
{
Expand Down Expand Up @@ -275,6 +276,19 @@ struct npc_akama_shade : public ScriptedAI
_sayLowHealth = true;
Talk(SAY_LOW_HEALTH);
}
else if (damage >= me->GetHealth() && !_died)
{
damage = me->GetHealth() - 1;
Talk(SAY_DEATH);
if (Creature* shade = instance->GetCreature(DATA_SHADE_OF_AKAMA))
{
shade->SetHomePosition(shade->GetHomePosition());
shade->AI()->EnterEvadeMode();
}

me->DespawnOrUnsummon();
ScriptedAI::EnterEvadeMode(EvadeReason::EVADE_REASON_OTHER);
}
}

void DoAction(int32 param) override
Expand All @@ -298,18 +312,6 @@ struct npc_akama_shade : public ScriptedAI

void EnterEvadeMode(EvadeReason /*why*/) override { }

void JustDied(Unit* /*killer*/) override
{
Talk(SAY_DEATH);
if (Creature* shade = instance->GetCreature(DATA_SHADE_OF_AKAMA))
{
shade->SetHomePosition(shade->GetHomePosition());
shade->AI()->EnterEvadeMode();
}

me->DespawnOrUnsummon();
}

void JustEngagedWith(Unit* /*who*/) override
{
ScheduleTimedEvent(2s, [&]
Expand Down Expand Up @@ -338,6 +340,7 @@ struct npc_akama_shade : public ScriptedAI

private:
bool _sayLowHealth;
bool _died;
};

struct npc_creature_generator_akama : public ScriptedAI
Expand Down Expand Up @@ -445,27 +448,18 @@ struct npc_creature_generator_akama : public ScriptedAI

struct npc_ashtongue_sorcerer : public NullCreatureAI
{
npc_ashtongue_sorcerer(Creature* creature) : NullCreatureAI(creature)
{
instance = creature->GetInstanceScript();
}
npc_ashtongue_sorcerer(Creature* creature) : NullCreatureAI(creature) { }

void MovementInform(uint32 type, uint32 point) override
{
if (type == POINT_MOTION_TYPE && point == POINT_ENGAGE)
me->CastSpell(me, SPELL_SHADE_SOUL_CHANNEL, true);
}

private:
InstanceScript* instance;
};

struct npc_ashtongue_channeler : public NullCreatureAI
{
npc_ashtongue_channeler(Creature* creature) : NullCreatureAI(creature)
{
instance = creature->GetInstanceScript();
}
npc_ashtongue_channeler(Creature* creature) : NullCreatureAI(creature) { }

void Reset() override
{
Expand All @@ -484,7 +478,6 @@ struct npc_ashtongue_channeler : public NullCreatureAI
}

private:
InstanceScript* instance;
TaskScheduler scheduler;
};

Expand Down

0 comments on commit 56e03c4

Please sign in to comment.