void UpdateAI(const uint32 uiDiff) override { // Return since we have no target if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { return; } // Trigger special ability function at 75, 50 and 25% health if (m_creature->GetHealthPercent() < 100.0f - m_uiEventCounter * 25.0f && DoSpecialDragonAbility()) { ++m_uiEventCounter; } // Call dragon specific virtual function if (!UpdateDragonAI(uiDiff)) { return; } if (m_uiSeepingFogTimer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_SEEPING_FOG_R, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SEEPING_FOG_L, CAST_TRIGGERED); m_uiSeepingFogTimer = urand(120000, 150000); // Rather Guesswork, but one Fog has 2min duration, hence a bit longer } else { m_uiSeepingFogTimer -= uiDiff; } if (m_uiNoxiousBreathTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_NOXIOUS_BREATH) == CAST_OK) { m_uiNoxiousBreathTimer = urand(14000, 20000); } } else { m_uiNoxiousBreathTimer -= uiDiff; } if (m_uiTailsweepTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_TAILSWEEP) == CAST_OK) { m_uiTailsweepTimer = 2000; } } else { m_uiTailsweepTimer -= uiDiff; } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { // Return since we have no target if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Trigger special ability function at 75, 50 and 25% health if (m_uiEventCounter < 4 && m_creature->GetHealthPercent() < 100.0f - m_uiEventCounter * 25.0f + m_specialOffset[m_uiEventCounter - 1] && DoSpecialDragonAbility()) ++m_uiEventCounter; // Call dragon specific virtual function if (!UpdateDragonAI(uiDiff)) return; if (m_uiSeepingFogTimer < uiDiff) { DoCastSpellIfCan(m_creature, SPELL_SEEPING_FOG_R, CAST_TRIGGERED); DoCastSpellIfCan(m_creature, SPELL_SEEPING_FOG_L, CAST_TRIGGERED); m_uiSeepingFogTimer = urand(2*MINUTE*IN_MILLISECONDS, 140*IN_MILLISECONDS); } else m_uiSeepingFogTimer -= uiDiff; if (m_uiNoxiousBreathTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_NOXIOUS_BREATH) == CAST_OK) m_uiNoxiousBreathTimer = urand(14000, 20000); } else m_uiNoxiousBreathTimer -= uiDiff; if (m_uiTailsweepTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_TAILSWEEP) == CAST_OK) m_uiTailsweepTimer = 2000; } else m_uiTailsweepTimer -= uiDiff; DoMeleeAttackIfReady(); }