fix(Scripts/BossAI): add optional variable to BossAI class to make sure the boss calls for help (#18630)

init
This commit is contained in:
Dan
2024-03-30 15:31:41 +01:00
committed by GitHub
parent 88be6d8150
commit a870173558
4 changed files with 12 additions and 2 deletions

View File

@@ -571,6 +571,7 @@ BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
summons(creature), summons(creature),
_bossId(bossId) _bossId(bossId)
{ {
callForHelpRange = 0.0f;
if (instance) if (instance)
SetBoundary(instance->GetBossBoundary(bossId)); SetBoundary(instance->GetBossBoundary(bossId));
@@ -630,6 +631,13 @@ void BossAI::_JustEngagedWith()
me->setActive(true); me->setActive(true);
DoZoneInCombat(); DoZoneInCombat();
ScheduleTasks(); ScheduleTasks();
if (callForHelpRange)
{
ScheduleTimedEvent(0s, [&]
{
me->CallForHelp(callForHelpRange);
}, 2s);
}
if (instance) if (instance)
{ {
// bosses do not respawn, check only on enter combat // bosses do not respawn, check only on enter combat

View File

@@ -462,6 +462,8 @@ public:
BossAI(Creature* creature, uint32 bossId); BossAI(Creature* creature, uint32 bossId);
~BossAI() override {} ~BossAI() override {}
float callForHelpRange;
InstanceScript* const instance; InstanceScript* const instance;
bool CanRespawn() override; bool CanRespawn() override;

View File

@@ -60,6 +60,7 @@ struct boss_high_astromancer_solarian : public BossAI
{ {
boss_high_astromancer_solarian(Creature* creature) : BossAI(creature, DATA_ASTROMANCER) boss_high_astromancer_solarian(Creature* creature) : BossAI(creature, DATA_ASTROMANCER)
{ {
callForHelpRange = 105.0f;
scheduler.SetValidator([this] scheduler.SetValidator([this]
{ {
return !me->HasUnitState(UNIT_STATE_CASTING); return !me->HasUnitState(UNIT_STATE_CASTING);
@@ -118,7 +119,6 @@ struct boss_high_astromancer_solarian : public BossAI
{ {
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
BossAI::JustEngagedWith(who); BossAI::JustEngagedWith(who);
me->CallForHelp(105.0f);
me->GetMotionMaster()->Clear(); me->GetMotionMaster()->Clear();
scheduler.Schedule(3650ms, [this](TaskContext context) scheduler.Schedule(3650ms, [this](TaskContext context)

View File

@@ -41,6 +41,7 @@ struct boss_void_reaver : public BossAI
{ {
boss_void_reaver(Creature* creature) : BossAI(creature, DATA_REAVER) boss_void_reaver(Creature* creature) : BossAI(creature, DATA_REAVER)
{ {
callForHelpRange = 105.0f;
scheduler.SetValidator([this] scheduler.SetValidator([this]
{ {
return !me->HasUnitState(UNIT_STATE_CASTING); return !me->HasUnitState(UNIT_STATE_CASTING);
@@ -82,7 +83,6 @@ struct boss_void_reaver : public BossAI
{ {
BossAI::JustEngagedWith(who); BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
me->CallForHelp(105.0f);
scheduler.Schedule(10min, [this](TaskContext) scheduler.Schedule(10min, [this](TaskContext)
{ {