fix(Scripts/Ulduar): Brundir invincible during Overload if not last boss (#25029)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-03-10 20:47:33 -03:00
committed by GitHub
parent 10b4f04c44
commit 8db47a6a29

View File

@@ -121,23 +121,30 @@ enum Misc
POINT_CHANNEL_STEELBREAKER = 1
};
static uint8 CountAliveBosses(InstanceScript* instance)
{
uint8 count = 0;
if (!instance)
return count;
for (uint8 i = 0; i < 3; ++i)
if (Creature* boss = instance->GetCreature(DATA_STEELBREAKER + i))
if (boss->IsAlive())
++count;
return count;
}
bool IsEncounterComplete(InstanceScript* pInstance, Creature* me)
{
if (!pInstance || !me)
return false;
for (uint8 i = 0; i < 3; ++i)
{
if (Creature* boss = pInstance->GetCreature(DATA_STEELBREAKER + i))
{
if (boss->IsAlive())
return false;
continue;
}
else
if (!pInstance->GetCreature(DATA_STEELBREAKER + i))
return false;
}
return true;
return CountAliveBosses(pInstance) == 0;
}
void RespawnAssemblyOfIron(InstanceScript* pInstance, Creature* me)
@@ -550,6 +557,7 @@ struct boss_stormcaller_brundir : public ScriptedAI
void Reset() override
{
SetInvincibility(false);
me->SetLootMode(0);
RespawnAssemblyOfIron(pInstance, me);
@@ -667,6 +675,26 @@ struct boss_stormcaller_brundir : public ScriptedAI
me->CastSpell(me, SPELL_LIGHTNING_CHANNEL_PRE, true);
}
void OnSpellCast(SpellInfo const* spellInfo) override
{
// When Overload begins, prevent Brundir from dying unless he is the last boss alive
if (spellInfo->Id == SPELL_OVERLOAD && CountAliveBosses(pInstance) > 1)
SetInvincibility(true);
}
void OnChannelFinished(SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_OVERLOAD)
SetInvincibility(false);
}
void OnSpellFailed(SpellInfo const* spellInfo) override
{
// Also lift invincibility if the channel is somehow interrupted
if (spellInfo->Id == SPELL_OVERLOAD)
SetInvincibility(false);
}
void UpdateAI(uint32 diff) override
{
if (!me->IsInCombat() && me->GetReactState() == REACT_AGGRESSIVE)