fix(Scripts/HyjalSummit): Couple Archimonde adjustments. (#19193)

* Init.

Co-Authored-By: cyberium <cyberium@users.noreply.github.com>
Co-Authored-By: killerwife <killerwife@users.noreply.github.com>

* Corrections.

* Adjust fear timer.

* Wrong spell.

* Whitespace.

* Use the much cooler and more hip scheduler.

* Correct teleport timers.

Matches up with sniffed 3.4.3 data.

* Swap magic number for constant.

Co-Authored-By: killerwife <killerwife@users.noreply.github.com>

* Adjust notation.

* Public.

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

* Kitzunu's fault.

Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>

---------

Co-authored-by: cyberium <cyberium@users.noreply.github.com>
Co-authored-by: killerwife <killerwife@users.noreply.github.com>
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
Benjamin Jackson
2024-07-04 13:31:22 -04:00
committed by GitHub
parent bd29e9e1b3
commit c3e22c0fe2

View File

@@ -143,35 +143,37 @@ struct npc_doomfire_spirit : public ScriptedAI
{
npc_doomfire_spirit(Creature* creature) : ScriptedAI(creature){ }
float const turnConstant = 0.785402f;
float fAngle = urand(0, M_PI * 2);
void Reset() override
{
scheduler.CancelAll();
ScheduleTimedEvent(0s, [&] {
me->GetMotionMaster()->MovePoint(NEAR_POINT, DoomfireMovement(me->GetPosition()));
}, 1500ms);
float nextOrientation = Position::NormalizeOrientation(me->GetOrientation() + irand(-1, 1) * turnConstant);
Position pos = GetFirstRandomAngleCollisionPosition(8.f, nextOrientation); // both orientation and distance verified with sniffs
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), nextOrientation);
}, 1600ms);
fAngle = urand(0, M_PI * 2);
}
Position DoomfireMovement(Position mePos)
Position GetFirstRandomAngleCollisionPosition(float dist, float angle)
{
float angle = mePos.GetOrientation();
float distance = 100.0f;
float newAngle = angle + ((rand() % 181) - 90) * M_PI / 180;
float x = mePos.GetPositionX() + distance * cos(newAngle);
float y = mePos.GetPositionY() + distance * sin(newAngle);
Position targetPos = Position(x, y, me->GetPositionZ());
return targetPos;
Position pos;
for (uint32 i = 0; i < 10; ++i)
{
pos = me->WorldObject::GetFirstCollisionPosition(dist, angle);
if (me->GetDistance(pos) > dist * 0.8f) // if at least 80% distance, good enough
break;
angle += (M_PI / 5); // else try slightly different angle
}
return pos;
}
void UpdateAI(uint32 diff) override
{
scheduler.Update(diff);
if (!UpdateVictim())
return;
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
};
@@ -313,7 +315,7 @@ struct boss_archimonde : public BossAI
DoCastVictim(SPELL_RED_SKY_EFFECT);
DoCastVictim(SPELL_HAND_OF_DEATH);
}, 3s);
scheduler.Schedule(25s, 35s, GROUP_FEAR, [this](TaskContext context)
scheduler.Schedule(40s, GROUP_FEAR, [this](TaskContext context)
{
DoCastAOE(SPELL_FEAR);
context.Repeat(42s);
@@ -381,11 +383,6 @@ struct boss_archimonde : public BossAI
summoned->CastSpell(summoned, SPELL_DOOMFIRE_SPAWN);
summoned->CastSpell(summoned, SPELL_DOOMFIRE, true, 0, 0, me->GetGUID());
}
else if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT)
{
Position randomPosition = summoned->GetRandomNearPosition(40.0f);
summoned->GetMotionMaster()->MovePoint(0, randomPosition);
}
else
{
summoned->SetFaction(me->GetFaction()); //remove?