fix(Scripts/Ahnkahet): Clean up Herald Volazj insanity casting and ph… (#23549)

This commit is contained in:
Andrew
2025-11-07 19:37:42 -03:00
committed by GitHub
parent 433be02111
commit 09e0343491

View File

@@ -77,51 +77,52 @@ enum Misc
DATA_SET_INSANITY_PHASE = 1, DATA_SET_INSANITY_PHASE = 1,
}; };
enum Events
{
EVENT_HERALD_MIND_FLAY = 1,
EVENT_HERALD_SHADOW,
EVENT_HERALD_SHIVER,
};
const std::array<uint32, MAX_INSANITY_TARGETS> InsanitySpells = { SPELL_INSANITY_PHASING_1, SPELL_INSANITY_PHASING_2, SPELL_INSANITY_PHASING_3, SPELL_INSANITY_PHASING_4, SPELL_INSANITY_PHASING_5 }; const std::array<uint32, MAX_INSANITY_TARGETS> InsanitySpells = { SPELL_INSANITY_PHASING_1, SPELL_INSANITY_PHASING_2, SPELL_INSANITY_PHASING_3, SPELL_INSANITY_PHASING_4, SPELL_INSANITY_PHASING_5 };
struct boss_volazj : public BossAI struct boss_volazj : public BossAI
{ {
boss_volazj(Creature* pCreature) : BossAI(pCreature, DATA_HERALD_VOLAZJ), boss_volazj(Creature* pCreature) : BossAI(pCreature, DATA_HERALD_VOLAZJ),
insanityTimes(0),
insanityPhase(false) insanityPhase(false)
{ } { }
void InitializeAI() override
{
BossAI::InitializeAI();
// Visible for all players in insanity
me->SetPhaseMask((1 | 16 | 32 | 64 | 128 | 256), true);
}
void Reset() override void Reset() override
{ {
_Reset(); _Reset();
insanityTimes = 0;
insanityPhase = false; insanityPhase = false;
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(false, UNIT_STATE_STUNNED); me->SetControlled(false, UNIT_STATE_STUNNED);
ResetPlayersPhaseMask(); ResetPlayersPhaseMask();
instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT); instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT);
me->SetPhaseMask((1 | 16 | 32 | 64 | 128 | 256), true);
ScheduleHealthCheckEvent({ 66, 33 }, [&]{
scheduler.CancelAll();
DoCastSelf(SPELL_INSANITY);
}, false);
}
void ScheduleTasks() override
{
ScheduleTimedEvent(8s, [&] {
DoCastVictim(SPELL_MIND_FLAY);
}, 20s);
ScheduleTimedEvent(5s, [&] {
DoCastVictim(SPELL_SHADOW_BOLT_VOLLEY);
}, 5s);
ScheduleTimedEvent(15s, [&] {
DoCastRandomTarget(SPELL_SHIVER);
}, 15s);
} }
void JustEngagedWith(Unit* /*who*/) override void JustEngagedWith(Unit* /*who*/) override
{ {
_JustEngagedWith(); _JustEngagedWith();
events.ScheduleEvent(EVENT_HERALD_MIND_FLAY, 8s);
events.ScheduleEvent(EVENT_HERALD_SHADOW, 5s);
events.ScheduleEvent(EVENT_HERALD_SHIVER, 15s);
Talk(SAY_AGGRO); Talk(SAY_AGGRO);
DoCastSelf(SPELL_WHISPER_AGGRO); DoCastSelf(SPELL_WHISPER_AGGRO);
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_QUICK_DEMISE_START_EVENT);
me->SetInCombatWithZone();
} }
void JustDied(Unit* /*killer*/) override void JustDied(Unit* /*killer*/) override
@@ -184,36 +185,13 @@ struct boss_volazj : public BossAI
} }
} }
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override
{
// Do not perform insanity recast if boss is casting Insanity already
if (me->FindCurrentSpellBySpellId(SPELL_INSANITY))
{
return;
}
// First insanity
if (insanityTimes == 0 && me->HealthBelowPctDamaged(66, damage))
{
DoCastSelf(SPELL_INSANITY, false);
++insanityTimes;
}
// Second insanity
else if (insanityTimes == 1 && me->HealthBelowPctDamaged(33, damage))
{
me->InterruptNonMeleeSpells(false);
DoCastSelf(SPELL_INSANITY, false);
++insanityTimes;
}
}
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
//Return since we have no target //Return since we have no target
if (!UpdateVictim()) if (!UpdateVictim())
{
return; return;
}
scheduler.Update(diff);
if (insanityPhase) if (insanityPhase)
{ {
@@ -226,53 +204,13 @@ struct boss_volazj : public BossAI
me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
me->SetControlled(false, UNIT_STATE_STUNNED); me->SetControlled(false, UNIT_STATE_STUNNED);
me->RemoveAurasDueToSpell(INSANITY_VISUAL); me->RemoveAurasDueToSpell(INSANITY_VISUAL);
} ScheduleTasks();
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}
while (uint32 const eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_HERALD_MIND_FLAY:
{
DoCastVictim(SPELL_MIND_FLAY, false);
events.Repeat(20s);
break;
}
case EVENT_HERALD_SHADOW:
{
DoCastVictim(SPELL_SHADOW_BOLT_VOLLEY, false);
events.Repeat(5s);
break;
}
case EVENT_HERALD_SHIVER:
{
if (Unit* pTarget = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
{
DoCast(pTarget, SPELL_SHIVER, false);
}
events.Repeat(15s);
break;
}
}
if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
private: private:
uint8 insanityTimes;
bool insanityPhase; // Indicates if boss enter to insanity phase bool insanityPhase; // Indicates if boss enter to insanity phase
uint32 GetPlrInsanityAuraId(uint32 phaseMask) const uint32 GetPlrInsanityAuraId(uint32 phaseMask) const
@@ -312,6 +250,7 @@ private:
bool CheckPhaseMinions() bool CheckPhaseMinions()
{ {
summons.RemoveNotExisting(); summons.RemoveNotExisting();
if (summons.empty()) if (summons.empty())
{ {
ResetPlayersPhaseMask(); ResetPlayersPhaseMask();