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/Zulaman) Multiple fixes to Jan'alai #21257

Closed
wants to merge 29 commits into from
Closed
Changes from 21 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
29507be
Update boss_janalai.cpp
blinkysc Jan 24, 2025
a0f3e32
Update boss_janalai.cpp
blinkysc Jan 24, 2025
bd1e42f
Update boss_janalai.cpp
blinkysc Jan 24, 2025
6b4204f
Update boss_janalai.cpp
blinkysc Jan 24, 2025
d25d432
Update boss_janalai.cpp
blinkysc Jan 24, 2025
069709c
Update boss_janalai.cpp
blinkysc Jan 24, 2025
fb6b4db
Update boss_janalai.cpp
blinkysc Jan 24, 2025
ea0e719
Update boss_janalai.cpp
blinkysc Jan 24, 2025
248d3a2
Update boss_janalai.cpp
blinkysc Jan 24, 2025
e812841
Update boss_janalai.cpp
blinkysc Jan 24, 2025
306385b
Update boss_janalai.cpp
blinkysc Jan 24, 2025
00bac08
Update boss_janalai.cpp
blinkysc Jan 24, 2025
e0fc3d3
Update boss_janalai.cpp
blinkysc Jan 24, 2025
b888ab3
Update boss_janalai.cpp
blinkysc Jan 24, 2025
f90eba3
Update boss_janalai.cpp
blinkysc Jan 24, 2025
70f28b2
Update boss_janalai.cpp
blinkysc Jan 24, 2025
04a9fd9
Update boss_janalai.cpp
blinkysc Jan 24, 2025
6f3d140
Attack 1s before boom
blinkysc Jan 24, 2025
935fbc2
Attack 3s before boom
blinkysc Jan 24, 2025
a30b29c
Update boss_janalai.cpp
blinkysc Jan 24, 2025
f24fd05
Update boss_janalai.cpp
blinkysc Jan 24, 2025
adf33a6
Update boss_janalai.cpp
blinkysc Jan 24, 2025
d42da41
Make sure UNIT_STATE_NOT_MOVE cleared on reset()
blinkysc Jan 24, 2025
2ce1686
East const flavor
blinkysc Feb 6, 2025
d57ecdd
Clean Random
blinkysc Feb 6, 2025
ac4bbc8
psuedo random more better
blinkysc Feb 6, 2025
faf2ef4
Update boss_janalai.cpp
blinkysc Feb 8, 2025
134f826
constexpr
blinkysc Feb 8, 2025
83c7796
Merge branch 'master' into janalaiFix
blinkysc Feb 8, 2025
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
76 changes: 44 additions & 32 deletions src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ struct boss_janalai : public BossAI
BossAI::JustEngagedWith(who);
Talk(SAY_AGGRO);
//schedule abilities
ScheduleTimedEvent(30s, [&]{
ScheduleTimedEvent(57s, [&]{
StartBombing();
}, 20s, 40s);
}, 30s);

scheduler.Schedule(10s, GROUP_HATCHING, [this](TaskContext context)
{
Expand Down Expand Up @@ -218,18 +218,20 @@ struct boss_janalai : public BossAI
});

ScheduleTimedEvent(8s, [&]{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
if (!_isBombing)
{
me->AttackStop();
me->GetMotionMaster()->Clear();
DoCast(target, SPELL_FLAME_BREATH);
me->StopMoving();
_isFlameBreathing = true;
// placeholder time idk yet
scheduler.Schedule(2s, [this](TaskContext)
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
_isFlameBreathing = false;
});
me->AttackStop();
me->GetMotionMaster()->Clear();
DoCast(target, SPELL_FLAME_BREATH);
me->StopMoving();
_isFlameBreathing = true;
scheduler.Schedule(1500ms, [this](TaskContext)
{
_isFlameBreathing = false;
});
}
}
}, 8s);

Expand Down Expand Up @@ -290,11 +292,13 @@ struct boss_janalai : public BossAI

void SpawnBombs()
{
float dx, dy;
float maxRadius = std::min(area_dx, area_dy) / 2.0f;
for (int i = 0; i < MAX_BOMB_COUNT; ++i)
{
dx = float(irand(-area_dx / 2, area_dx / 2));
dy = float(irand(-area_dy / 2, area_dy / 2));
float angle = float(rand()) / float(RAND_MAX) * 2.0f * M_PI;
sudlud marked this conversation as resolved.
Show resolved Hide resolved
float radius = float(rand()) / float(RAND_MAX) * maxRadius;
float dx = radius * cos(angle);
float dy = radius * sin(angle);
DoSpawnCreature(NPC_FIRE_BOMB, dx, dy, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
}
}
Expand All @@ -320,44 +324,52 @@ struct boss_janalai : public BossAI
me->GetMotionMaster()->Clear();
me->SetPosition(janalainPos);
me->StopMovingOnCurrentPos();
DoCastSelf(SPELL_FIRE_BOMB_CHANNEL);

FireWall();
SpawnBombs();
me->AddUnitState(UNIT_STATE_NOT_MOVE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This includes UNIT_STATE_DIED.

Also check if this is cleared in Reset as Reset() clears taskscheduler and the ClearUnitState may never run

I see these are similar instructions as flamebreathing above but me->AttackStop(); could be missing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah let me make sure, also probably better way to get him to stop moving. Let me check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the me->ClearUnitState(UNIT_STATE_NOT_MOVE); to Reset() and tested .die both without doing bombs and while in UNIT_STATE_NOT_MOVE. both seem to reset. Didn't test before adding the UNIT_STATE_NOT_MOVE to Reset() but assuming could be bug in future if I didn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried stuff like me->StopMoving() but for whatever reason those other methods just wouldn't work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this marked as resolved? This is a hack and won't be merged as is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, don't wan't to mess anything else up, I'll just close

_isBombing = true;

DoCastSelf(SPELL_TELE_TO_CENTER);
DoCastAOE(SPELL_SUMMON_PLAYERS_DUMMY, true);

//DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
ThrowBombs();

scheduler.Schedule(11s, [this](TaskContext)
scheduler.Schedule(3s, [this](TaskContext)
{
Boom();
_isBombing = false;
me->ClearUnitState(UNIT_STATE_NOT_MOVE);
DoCastSelf(SPELL_FIRE_BOMB_CHANNEL);
FireWall();
SpawnBombs();
ThrowBombs();
scheduler.Schedule(6s, [this](TaskContext)
{
_isBombing = false;
me->RemoveAurasDueToSpell(SPELL_FIRE_BOMB_CHANNEL);
if (Unit* victim = me->GetVictim())
me->Attack(victim, true);
blinkysc marked this conversation as resolved.
Show resolved Hide resolved
});

me->RemoveAurasDueToSpell(SPELL_FIRE_BOMB_CHANNEL);
scheduler.Schedule(9s, [this](TaskContext)
{
Boom();
});
});
}

void ThrowBombs()
{
std::chrono::milliseconds bombTimer = 100ms;

summons.DoForAllSummons([this, &bombTimer](WorldObject* summon) {
std::chrono::milliseconds bombTimer = 0ms;
const std::chrono::milliseconds throwDuration = 5000ms;
blinkysc marked this conversation as resolved.
Show resolved Hide resolved
summons.DoForAllSummons([this, &bombTimer, throwDuration](WorldObject* summon) {
if (summon->GetEntry() == NPC_FIRE_BOMB)
{
if (Creature* bomb = summon->ToCreature())
{
// Calculate timing to spread throws over 5 seconds
std::chrono::milliseconds throwTime = bombTimer % throwDuration;
bomb->m_Events.AddEventAtOffset([this, bomb] {
bomb->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
DoCast(bomb, SPELL_FIRE_BOMB_THROW, true);
bomb->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
}, bombTimer);
}, throwTime);
}

bombTimer += 100ms;
bombTimer += throwDuration / MAX_BOMB_COUNT;
}
});
}
Expand Down
Loading