Exemplo n.º 1
0
void CasterAI::InitializeAI()
{
    CombatAI::InitializeAI();

    m_attackDist = 30.0f;
    for (SpellVct::iterator itr = spells.begin(); itr != spells.end(); ++itr)
        if (AISpellInfo[*itr].condition == AICOND_COMBAT && m_attackDist > GetAISpellInfo(*itr)->maxRange)
            m_attackDist = GetAISpellInfo(*itr)->maxRange;
    if (m_attackDist == 30.0f)
        m_attackDist = MELEE_RANGE;
}
Exemplo n.º 2
0
void AddSC_boss_sapphiron()
{
    Script *newscript;
    newscript = new Script;
    newscript->Name = "boss_sapphiron";
    newscript->GetAI = &GetAI_boss_sapphiron;
    newscript->RegisterSelf();

    // Chill
    GetAISpellInfo(28547)->cooldown = 1000;
    GetAISpellInfo(55699)->cooldown = 1000;
}
Exemplo n.º 3
0
void CasterAI::UpdateAI(const uint32 diff)
{
    if (!UpdateVictim())
        return;

    events.Update(diff);

    if (me->GetVictim()->HasBreakableByDamageCrowdControlAura(me))
    {
        me->InterruptNonMeleeSpells(false);
        return;
    }

    if (me->HasUnitState(UNIT_STATE_CASTING))
        return;

    if (uint32 spellId = events.ExecuteEvent())
    {
        if (me->HasSpellCooldown(spellId))
            return;

        DoCast(spellId);
        uint32 casttime = me->GetCurrentSpellCastTime(spellId);
        events.ScheduleEvent(spellId, (casttime ? casttime : 500) + GetAISpellInfo(spellId)->realCooldown);
    }
}
Exemplo n.º 4
0
void CasterAI::UpdateAI(const uint32 diff)
{
    if (!UpdateVictim())
        return;

    events.Update(diff);

    if (me->hasUnitState(UNIT_STAT_CASTING))
        return;

    if (uint32 spellId = events.ExecuteEvent())
    {
        DoCast(spellId);
        uint32 casttime = me->GetCurrentSpellCastTime(spellId);
        events.ScheduleEvent(spellId, (casttime ? casttime : 500) + GetAISpellInfo(spellId)->realCooldown);
    }
}
Exemplo n.º 5
0
void CasterAI::EnterCombat(Unit *who) {
	if (spells.empty())
		return;

	uint32 spell = rand() % spells.size();
	uint32 count = 0;
	for (SpellVct::iterator itr = spells.begin(); itr != spells.end();
			++itr, ++count) {
		if (AISpellInfo[*itr].condition == AICOND_AGGRO)
			me->CastSpell(who, *itr, false);
		else if (AISpellInfo[*itr].condition == AICOND_COMBAT) {
			uint32 cooldown = GetAISpellInfo(*itr)->realCooldown;
			if (count == spell) {
				DoCast(spells[spell]);
				cooldown += me->GetCurrentSpellCastTime(*itr);
			}
			events.ScheduleEvent(*itr, cooldown);
		}
	}
}
Exemplo n.º 6
0
void CasterAI::UpdateAI(const uint32 diff)
{
    if (!UpdateVictim())
        return;

    events.Update(diff);

    if (me->getVictim() && me->getVictim()->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_DAMAGE))
    {
        me->InterruptNonMeleeSpells(false);
        return;
    }

    if (me->hasUnitState(UNIT_STAT_CASTING))
        return;

    if (uint32 spellId = events.ExecuteEvent())
    {
        DoCast(spellId);
        uint32 casttime = me->GetCurrentSpellCastTime(spellId);
        events.ScheduleEvent(spellId, (casttime ? casttime : 500) + GetAISpellInfo(spellId)->realCooldown);
    }
}