mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
feat(Core/Scripting): Implement SetInvincibility() to prevent creatur… (#20508)
This commit is contained in:
@@ -62,13 +62,20 @@ public:
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_summonedRend = false;
|
||||
if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS)
|
||||
{
|
||||
instance->SetBossState(DATA_GYTH, NOT_STARTED);
|
||||
summons.DespawnAll();
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
SetInvincibility(true); // Don't let boss die before summoning Rend.
|
||||
|
||||
ScheduleHealthCheckEvent(25, [&] {
|
||||
DoCastAOE(SPELL_SUMMON_REND, true);
|
||||
me->RemoveAura(SPELL_REND_MOUNTS);
|
||||
SetInvincibility(false);
|
||||
});
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit* /*who*/) override
|
||||
@@ -104,21 +111,6 @@ public:
|
||||
instance->SetBossState(DATA_GYTH, DONE);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*type*/, SpellSchoolMask /*school*/) override
|
||||
{
|
||||
if (!_summonedRend && me->HealthBelowPctDamaged(25, damage))
|
||||
{
|
||||
if (damage >= me->GetHealth())
|
||||
{
|
||||
// Let creature fall to 1 HP but prevent it from dying before boss is summoned.
|
||||
damage = me->GetHealth() - 1;
|
||||
}
|
||||
DoCast(me, SPELL_SUMMON_REND, true);
|
||||
me->RemoveAura(SPELL_REND_MOUNTS);
|
||||
_summonedRend = true;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
@@ -173,9 +165,6 @@ public:
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
private:
|
||||
bool _summonedRend;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
|
||||
Reference in New Issue
Block a user