Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ BossAI::BossAI(Creature* creature, uint32 bossId) : ScriptedAI(creature),
summons(creature),
_bossId(bossId)
{
callForHelpRange = 0.0f;
if (instance)
SetBoundary(instance->GetBossBoundary(bossId));

Expand Down Expand Up @@ -630,6 +631,13 @@ void BossAI::_JustEngagedWith()
me->setActive(true);
DoZoneInCombat();
ScheduleTasks();
if (callForHelpRange)
{
ScheduleTimedEvent(0s, [&]
{
me->CallForHelp(callForHelpRange);
}, 2s);
}
if (instance)
{
// bosses do not respawn, check only on enter combat
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/AI/ScriptedAI/ScriptedCreature.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ class BossAI : public ScriptedAI
BossAI(Creature* creature, uint32 bossId);
~BossAI() override {}

float callForHelpRange;

InstanceScript* const instance;

bool CanRespawn() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct boss_high_astromancer_solarian : public BossAI
{
boss_high_astromancer_solarian(Creature* creature) : BossAI(creature, DATA_ASTROMANCER)
{
callForHelpRange = 105.0f;
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
Expand Down Expand Up @@ -118,7 +119,6 @@ struct boss_high_astromancer_solarian : public BossAI
{
Talk(SAY_AGGRO);
BossAI::JustEngagedWith(who);
me->CallForHelp(105.0f);
me->GetMotionMaster()->Clear();

scheduler.Schedule(3650ms, [this](TaskContext context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct boss_void_reaver : public BossAI
{
boss_void_reaver(Creature* creature) : BossAI(creature, DATA_REAVER)
{
callForHelpRange = 105.0f;
scheduler.SetValidator([this]
{
return !me->HasUnitState(UNIT_STATE_CASTING);
Expand Down Expand Up @@ -82,7 +83,6 @@ struct boss_void_reaver : public BossAI
{
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
me->CallForHelp(105.0f);

scheduler.Schedule(10min, [this](TaskContext)
{
Expand Down
Loading