[SD2] Garr adds explosion fix

This commit is contained in:
stormrage-project 2015-09-02 21:49:04 +02:00 committed by Antz
parent 8467c6f193
commit 7543d235e1

View File

@ -189,35 +189,15 @@ struct mob_firesworn : public CreatureScript
{ {
m_uiImmolateTimer = urand(4 * IN_MILLISECONDS, 8 * IN_MILLISECONDS); // These times are probably wrong m_uiImmolateTimer = urand(4 * IN_MILLISECONDS, 8 * IN_MILLISECONDS); // These times are probably wrong
m_uiSeparationCheckTimer = 5 * IN_MILLISECONDS; m_uiSeparationCheckTimer = 5 * IN_MILLISECONDS;
m_bExploding = false; m_uiExplodeTimer = 0;
}
void JustDied(Unit* /*pKiller*/) override
{
if (m_pInstance)
{
if (Creature* pGarr = m_pInstance->GetSingleCreatureFromStorage(NPC_GARR))
pGarr->CastSpell(pGarr, SPELL_ENRAGE, true, NULL, NULL, m_creature->GetObjectGuid());
}
} }
void DamageTaken(Unit* /*pDealer*/, uint32& uiDamage) override void DamageTaken(Unit* /*pDealer*/, uint32& uiDamage) override
{ {
if (!m_bExploding && m_creature->HealthBelowPctDamaged(10, uiDamage)) if (!m_uiExplodeTimer && m_creature->HealthBelowPctDamaged(10, uiDamage))
{
ReceiveAIEvent(AI_EVENT_CUSTOM_A, m_creature, m_creature, SPELL_ERUPTION);
uiDamage = 0;
}
}
void ReceiveAIEvent(AIEventType type, Creature* /*pSender*/, Unit* pInvoker, uint32 uiData) override
{
if (type == AI_EVENT_CUSTOM_A && pInvoker == m_creature)
{ {
m_creature->CastSpell(m_creature, SPELL_ERUPTION, true); m_creature->CastSpell(m_creature, SPELL_ERUPTION, true);
m_creature->ForcedDespawn(100); m_uiExplodeTimer = 500;
uiDamage = 0; // just for more convenient GM testing by .damage
m_bExploding = true;
} }
} }
@ -228,6 +208,16 @@ struct mob_firesworn : public CreatureScript
return; return;
} }
if (m_uiExplodeTimer)
{
if (m_uiExplodeTimer <= uiDiff)
m_creature->SetHealth(0);
else
m_uiExplodeTimer -= uiDiff;
return; // no other actions during and after explosion
}
// Immolate_Timer // Immolate_Timer
if (m_uiImmolateTimer < uiDiff) if (m_uiImmolateTimer < uiDiff)
{ {
@ -241,14 +231,6 @@ struct mob_firesworn : public CreatureScript
} }
else m_uiImmolateTimer -= uiDiff; else m_uiImmolateTimer -= uiDiff;
// Cast Erruption and let them die
if (m_creature->GetHealthPercent() <= 10.0f)
{
DoCastSpellIfCan(m_creature->getVictim(), SPELL_ERUPTION);
m_creature->SetDeathState(JUST_DIED);
m_creature->RemoveCorpse();
}
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
}; };