fix(Scripts/TempleOfAhnQiraj): Fix crash caused by permanently spawni… (#13698)

fix(Scripts/TempleOfAhnQiraj): Fix crash caused by permanently spawning a tentacle
This commit is contained in:
Skjalf
2022-11-04 19:17:50 -03:00
committed by GitHub
parent fc914f03f1
commit 6cb85d2ff4

View File

@@ -602,11 +602,14 @@ struct npc_eye_tentacle : public ScriptedAI
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
if (me->ToTempSummon())
{
if (Creature* creature = summoner->ToCreature())
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
creature->AI()->JustSummoned(portal);
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
@@ -673,11 +676,14 @@ struct npc_claw_tentacle : public ScriptedAI
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
if (me->ToTempSummon())
{
if (Creature* creature = summoner->ToCreature())
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
creature->AI()->JustSummoned(portal);
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
@@ -740,11 +746,14 @@ struct npc_giant_claw_tentacle : public ScriptedAI
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
if (me->ToTempSummon())
{
if (Creature* creature = summoner->ToCreature())
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
creature->AI()->JustSummoned(portal);
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}
@@ -771,24 +780,10 @@ struct npc_giant_claw_tentacle : public ScriptedAI
void EnterCombat(Unit* /*who*/) override
{
DoZoneInCombat();
_scheduler.Schedule(2s, [this](TaskContext context)
{
DoCastVictim(SPELL_HAMSTRING);
context.Repeat(10s);
}).Schedule(5s, [this](TaskContext context)
{
DoCastSelf(SPELL_THRASH);
context.Repeat(10s);
}).Schedule(3s, [this](TaskContext /*context*/)
{
_canAttack = true;
});
ScheduleMeleeCheck();
ScheduleTasks();
}
void ScheduleMeleeCheck()
void ScheduleTasks()
{
// Check if a target is in melee range
_scheduler.Schedule(10s, [this](TaskContext task)
@@ -810,6 +805,17 @@ struct npc_giant_claw_tentacle : public ScriptedAI
}
task.Repeat();
}).Schedule(2s, [this](TaskContext context)
{
DoCastVictim(SPELL_HAMSTRING);
context.Repeat(10s);
}).Schedule(5s, [this](TaskContext context)
{
DoCastSelf(SPELL_THRASH);
context.Repeat(10s);
}).Schedule(3s, [this](TaskContext /*context*/)
{
_canAttack = true;
});
}
@@ -856,13 +862,8 @@ struct npc_giant_claw_tentacle : public ScriptedAI
DoCastAOE(SPELL_MASSIVE_GROUND_RUPTURE, true);
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
ScheduleMeleeCheck();
ScheduleTasks();
}
_scheduler.Schedule(3s, [this](TaskContext /*context*/)
{
_canAttack = true;
});
}
void UpdateAI(uint32 diff) override
@@ -896,11 +897,14 @@ struct npc_giant_eye_tentacle : public ScriptedAI
portal->SetReactState(REACT_PASSIVE);
_portalGUID = portal->GetGUID();
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
if (me->ToTempSummon())
{
if (Creature* creature = summoner->ToCreature())
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
{
creature->AI()->JustSummoned(portal);
if (Creature* creature = summoner->ToCreature())
{
creature->AI()->JustSummoned(portal);
}
}
}
}