mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +00:00
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:
@@ -121,23 +121,30 @@ enum Misc
|
|||||||
POINT_CHANNEL_STEELBREAKER = 1
|
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)
|
bool IsEncounterComplete(InstanceScript* pInstance, Creature* me)
|
||||||
{
|
{
|
||||||
if (!pInstance || !me)
|
if (!pInstance || !me)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (uint8 i = 0; i < 3; ++i)
|
for (uint8 i = 0; i < 3; ++i)
|
||||||
{
|
if (!pInstance->GetCreature(DATA_STEELBREAKER + i))
|
||||||
if (Creature* boss = pInstance->GetCreature(DATA_STEELBREAKER + i))
|
|
||||||
{
|
|
||||||
if (boss->IsAlive())
|
|
||||||
return false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return true;
|
return CountAliveBosses(pInstance) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RespawnAssemblyOfIron(InstanceScript* pInstance, Creature* me)
|
void RespawnAssemblyOfIron(InstanceScript* pInstance, Creature* me)
|
||||||
@@ -550,6 +557,7 @@ struct boss_stormcaller_brundir : public ScriptedAI
|
|||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
|
SetInvincibility(false);
|
||||||
me->SetLootMode(0);
|
me->SetLootMode(0);
|
||||||
RespawnAssemblyOfIron(pInstance, me);
|
RespawnAssemblyOfIron(pInstance, me);
|
||||||
|
|
||||||
@@ -667,6 +675,26 @@ struct boss_stormcaller_brundir : public ScriptedAI
|
|||||||
me->CastSpell(me, SPELL_LIGHTNING_CHANNEL_PRE, true);
|
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
|
void UpdateAI(uint32 diff) override
|
||||||
{
|
{
|
||||||
if (!me->IsInCombat() && me->GetReactState() == REACT_AGGRESSIVE)
|
if (!me->IsInCombat() && me->GetReactState() == REACT_AGGRESSIVE)
|
||||||
|
|||||||
Reference in New Issue
Block a user