Skip to content

Commit

Permalink
fix(Scripts/BlackTemple): blade_of_azzinoth...and Possible crash (#19891
Browse files Browse the repository at this point in the history
)

* Update boss_illidan.cpp

* Update boss_illidan.cpp
  • Loading branch information
PkllonG committed Sep 7, 2024
1 parent e7448f2 commit dc4c874
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,10 @@ enum WarbladeTear

struct npc_blade_of_azzinoth : public ScriptedAI
{
npc_blade_of_azzinoth(Creature* creature) : ScriptedAI(creature) { }
npc_blade_of_azzinoth(Creature* creature) : ScriptedAI(creature)
{
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
}

void IsSummonedBy(WorldObject* /*summoner*/) override
{
Expand Down Expand Up @@ -1257,12 +1260,13 @@ enum FlameAzzinoth

struct npc_flame_of_azzinoth : public ScriptedAI
{
npc_flame_of_azzinoth(Creature* creature) : ScriptedAI(creature), _bladeSummoner(nullptr) { }
npc_flame_of_azzinoth(Creature* creature) : ScriptedAI(creature) { }

void IsSummonedBy(WorldObject* /*summoner*/) override
{
// Flame is set to be Illidan's summon, so we check for nearest blade
_bladeSummoner = me->FindNearestCreature(NPC_BLADE_OF_AZZINOTH, 15.0f);
if (Creature* _blade = me->FindNearestCreature(NPC_BLADE_OF_AZZINOTH, 15.0f))
_bladeGUID = _blade->GetGUID();

me->SetCorpseDelay(2);
me->SetReactState(REACT_DEFENSIVE);
Expand All @@ -1285,8 +1289,8 @@ struct npc_flame_of_azzinoth : public ScriptedAI
void JustEngagedWith(Unit* /*who*/) override
{
ScheduleTimedEvent(10s, [&] {
if (_bladeSummoner)
if (Unit* target = _bladeSummoner->AI()->SelectTarget(SelectTargetMethod::Random, 0, 30.f, true))
if (Creature* _blade = ObjectAccessor::GetCreature(*me, _bladeGUID))
if (Unit* target = _blade->AI()->SelectTarget(SelectTargetMethod::Random, 0, 30.0f, true))
DoCast(target, SPELL_CHARGE);
}, 5s, 20s);

Expand All @@ -1301,7 +1305,7 @@ struct npc_flame_of_azzinoth : public ScriptedAI
}

private:
Creature* _bladeSummoner;
ObjectGuid _bladeGUID;
};

class spell_illidan_draw_soul : public SpellScript
Expand Down

0 comments on commit dc4c874

Please sign in to comment.