Exemplo n.º 1
0
void PlayerbotDruidAI::DoNonCombatActions()
{
    Player * m_bot = GetPlayerBot();
    Player * master = GetMaster();
    if (!m_bot || !master)
        return;

    PlayerbotAI* ai = GetAI();

    // mana check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    Item* pItem = ai->FindDrink();
    Item* fItem = ai->FindBandage();

    if (pItem != NULL && ai->GetManaPercent() < 30)
    {
        ai->TellMaster("I could use a drink.");
        ai->UseItem(pItem);
        return;
    }
    else if (!pItem && INNERVATE > 0 && !m_bot->HasAura(INNERVATE) && ai->GetManaPercent() <= 20 && ai->CastSpell(INNERVATE, *m_bot))
        return;

    // hp check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    pItem = ai->FindFood();

    if (pItem != NULL && ai->GetHealthPercent() < 30)
    {
        ai->TellMaster("I could use some food.");
        ai->UseItem(pItem);
        return;
    }
    else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
    {
        ai->TellMaster("I could use first aid.");
        ai->UseItem(fItem);
        return;
    }

    // buff and heal master's group
    if (master->GetGroup())
    {
        // Buff master with group buff
        if (master->isAlive() && GIFT_OF_THE_WILD && ai->HasSpellReagents(GIFT_OF_THE_WILD) && ai->Buff(GIFT_OF_THE_WILD, master))
            return;

        Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
            if (!tPlayer || tPlayer == m_bot)
                continue;

            // Resurrect member if needed
            if (!tPlayer->isAlive())
            {
                if (ai->CastSpell(REVIVE, *tPlayer))
                {
                    std::string msg = "Resurrecting ";
                    msg += tPlayer->GetName();
                    m_bot->Say(msg, LANG_UNIVERSAL);
                    return;
                }
                else
                    continue;
            }
            else
            {
                // buff and heal
                if (BuffPlayer(tPlayer))
                    return;

                if (HealTarget(tPlayer))
                    return;
            }
        }
    }
    else
    {
        if (master->isAlive())
        {
            if (BuffPlayer(master))
                return;
            if (HealTarget(master))
                return;
        }
        else
        if (ai->CastSpell(REVIVE, *master))
            ai->TellMaster("Resurrecting you, Master.");
    }

    BuffPlayer(m_bot);
} // end DoNonCombatActions
Exemplo n.º 2
0
void PlayerbotWarlockAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
        case PlayerbotAI::SCENARIO_DUEL:
        {
            if (SHADOW_BOLT > 0)
                ai->CastSpell(SHADOW_BOLT);
            return;
        }
        default:
            break;
    }

    // ------- Non Duel combat ----------

    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();
    Pet *pet = m_bot->GetPet();

    // Empower demon
    if (pet && DEMONIC_EMPOWERMENT && !m_bot->HasSpellCooldown(DEMONIC_EMPOWERMENT))
        ai->CastSpell(DEMONIC_EMPOWERMENT);

    // Use voidwalker sacrifice on low health if possible
    if (ai->GetHealthPercent() < 50)
        if (pet && pet->GetEntry() == DEMON_VOIDWALKER && SACRIFICE && !m_bot->HasAura(SACRIFICE))
            ai->CastPetSpell(SACRIFICE);

    // Use healthstone
    if (ai->GetHealthPercent() < 30)
    {
        Item* healthStone = ai->FindConsumable(HEALTHSTONE_DISPLAYID);
        if (healthStone)
            ai->UseItem(healthStone);
    }

    // Damage Spells
    switch (SpellSequence)
    {
        case SPELL_CURSES:
            if (CURSE_OF_AGONY && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(SHADOWFLAME) && LastSpellCurse < 1)
            {
                ai->CastSpell(CURSE_OF_AGONY, *pTarget);
                SpellSequence = SPELL_AFFLICTION;
                ++LastSpellCurse;
                break;
            }
            else if (CURSE_OF_THE_ELEMENTS && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_WEAKNESS) && LastSpellCurse < 2)
            {
                ai->CastSpell(CURSE_OF_THE_ELEMENTS, *pTarget);
                SpellSequence = SPELL_AFFLICTION;
                ++LastSpellCurse;
                break;
            }
            else if (CURSE_OF_WEAKNESS && !pTarget->HasAura(CURSE_OF_WEAKNESS) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && LastSpellCurse < 3)
            {
                ai->CastSpell(CURSE_OF_WEAKNESS, *pTarget);
                SpellSequence = SPELL_AFFLICTION;
                ++LastSpellCurse;
                break;
            }
            else if (CURSE_OF_TONGUES && !pTarget->HasAura(CURSE_OF_TONGUES) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(CURSE_OF_WEAKNESS) && !pTarget->HasAura(CURSE_OF_AGONY) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS) && LastSpellCurse < 4)
            {
                ai->CastSpell(CURSE_OF_TONGUES, *pTarget);
                SpellSequence = SPELL_AFFLICTION;
                ++LastSpellCurse;
                break;
            }
            LastSpellCurse = 0;
        //SpellSequence = SPELL_AFFLICTION;
            /* no break */
        case SPELL_AFFLICTION:
            if (LIFE_TAP && LastSpellAffliction < 1 && ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 50)
            {
                ai->CastSpell(LIFE_TAP, *m_bot);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (CORRUPTION && !pTarget->HasAura(CORRUPTION) && !pTarget->HasAura(SHADOWFLAME) && !pTarget->HasAura(SEED_OF_CORRUPTION) && LastSpellAffliction < 2)
            {
                ai->CastSpell(CORRUPTION, *pTarget);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (DRAIN_SOUL && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.40 && !pTarget->HasAura(DRAIN_SOUL) && LastSpellAffliction < 3)
            {
                ai->CastSpell(DRAIN_SOUL, *pTarget);
                //ai->SetIgnoreUpdateTime(15);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (DRAIN_LIFE && LastSpellAffliction < 4 && !pTarget->HasAura(DRAIN_SOUL) && !pTarget->HasAura(SEED_OF_CORRUPTION) && !pTarget->HasAura(DRAIN_LIFE) && !pTarget->HasAura(DRAIN_MANA) && ai->GetHealthPercent() <= 70)
            {
                ai->CastSpell(DRAIN_LIFE, *pTarget);
                //ai->SetIgnoreUpdateTime(5);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (UNSTABLE_AFFLICTION && LastSpellAffliction < 5 && !pTarget->HasAura(UNSTABLE_AFFLICTION) && !pTarget->HasAura(SHADOWFLAME))
            {
                ai->CastSpell(UNSTABLE_AFFLICTION, *pTarget);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (HAUNT && LastSpellAffliction < 6 && !pTarget->HasAura(HAUNT))
            {
                ai->CastSpell(HAUNT, *pTarget);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (SEED_OF_CORRUPTION && !pTarget->HasAura(SEED_OF_CORRUPTION) && LastSpellAffliction < 7)
            {
                ai->CastSpell(SEED_OF_CORRUPTION, *pTarget);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (HOWL_OF_TERROR && !pTarget->HasAura(HOWL_OF_TERROR) && ai->GetAttackerCount() > 3 && LastSpellAffliction < 8)
            {
                ai->CastSpell(HOWL_OF_TERROR, *pTarget);
                ai->TellMaster("casting howl of terror!");
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if (FEAR && !pTarget->HasAura(FEAR) && pVictim == m_bot && ai->GetAttackerCount() >= 2 && LastSpellAffliction < 9)
            {
                ai->CastSpell(FEAR, *pTarget);
                //ai->TellMaster("casting fear!");
                //ai->SetIgnoreUpdateTime(1.5);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            else if ((pet)
                     && (DARK_PACT > 0 && ai->GetManaPercent() <= 50 && LastSpellAffliction < 10 && pet->GetPower(POWER_MANA) > 0))
            {
                ai->CastSpell(DARK_PACT, *m_bot);
                SpellSequence = SPELL_DESTRUCTION;
                ++LastSpellAffliction;
                break;
            }
            LastSpellAffliction = 0;
        //SpellSequence = SPELL_DESTRUCTION;
            /* no break */
        case SPELL_DESTRUCTION:
            if (SHADOWFURY && LastSpellDestruction < 1 && !pTarget->HasAura(SHADOWFURY))
            {
                ai->CastSpell(SHADOWFURY, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (SHADOW_BOLT && LastSpellDestruction < 2)
            {
                ai->CastSpell(SHADOW_BOLT, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (RAIN_OF_FIRE && LastSpellDestruction < 3 && ai->GetAttackerCount() >= 3)
            {
                ai->CastSpell(RAIN_OF_FIRE, *pTarget);
                //ai->TellMaster("casting rain of fire!");
                //ai->SetIgnoreUpdateTime(8);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (SHADOWFLAME && !pTarget->HasAura(SHADOWFLAME) && LastSpellDestruction < 4)
            {
                ai->CastSpell(SHADOWFLAME, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (IMMOLATE && !pTarget->HasAura(IMMOLATE) && !pTarget->HasAura(SHADOWFLAME) && LastSpellDestruction < 5)
            {
                ai->CastSpell(IMMOLATE, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (CONFLAGRATE && LastSpellDestruction < 6)
            {
                ai->CastSpell(CONFLAGRATE, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (INCINERATE && LastSpellDestruction < 7)
            {
                ai->CastSpell(INCINERATE, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (SEARING_PAIN && LastSpellDestruction < 8)
            {
                ai->CastSpell(SEARING_PAIN, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (SOUL_FIRE && LastSpellDestruction < 9)
            {
                ai->CastSpell(SOUL_FIRE, *pTarget);
                //ai->SetIgnoreUpdateTime(6);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (CHAOS_BOLT && LastSpellDestruction < 10)
            {
                ai->CastSpell(CHAOS_BOLT, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (SHADOWBURN && LastSpellDestruction < 11 && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.20 && !pTarget->HasAura(SHADOWBURN))
            {
                ai->CastSpell(SHADOWBURN, *pTarget);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else if (HELLFIRE && LastSpellDestruction < 12 && !m_bot->HasAura(HELLFIRE) && ai->GetAttackerCount() >= 5 && ai->GetHealthPercent() >= 50)
            {
                ai->CastSpell(HELLFIRE);
                ai->TellMaster("casting hellfire!");
                //ai->SetIgnoreUpdateTime(15);
                SpellSequence = SPELL_CURSES;
                ++LastSpellDestruction;
                break;
            }
            else
            {
                LastSpellDestruction = 0;
                SpellSequence = SPELL_CURSES;
            }
            break;
        default:
            break;
    }
} // end DoNextCombatManeuver
void PlayerbotPaladinAI::DoNextCombatManeuver(Unit *pTarget)
{
    Unit* pVictim = pTarget->getVictim();
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
        case PlayerbotAI::SCENARIO_DUEL:
            if (HAMMER_OF_JUSTICE > 0)
                ai->CastSpell(HAMMER_OF_JUSTICE);
            return;
    }

    // damage spells
    Player *m_bot = GetPlayerBot();
    Group *m_group = m_bot->GetGroup();
    float dist = m_bot->GetDistance(pTarget);
    std::ostringstream out;

    //Shield master if low hp.
    uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();

    if (GetMaster()->isAlive())
        if (masterHP < 25 && HAND_OF_PROTECTION > 0 && !GetMaster()->HasAura(FORBEARANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(HAND_OF_PROTECTION, EFFECT_INDEX_0) && !GetMaster()->HasAura(DIVINE_PROTECTION, EFFECT_INDEX_0) && !GetMaster()->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0))
            ai->CastSpell(HAND_OF_PROTECTION, *GetMaster());

    // heal group inside combat, but do not heal if tank
    if (m_group && pVictim != m_bot)  // possible tank
    {
        Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *m_groupMember = sObjectMgr.GetPlayer(itr->guid);
            if (!m_groupMember || !m_groupMember->isAlive())
                continue;

            uint32 memberHP = m_groupMember->GetHealth() * 100 / m_groupMember->GetMaxHealth();
            if (memberHP < 40 && ai->GetManaPercent() >= 40)  // do not heal bots without plenty of mana for master & self
                if (HealTarget(m_groupMember))
                    return;
        }
    }

    if (RIGHTEOUS_FURY > 0 && !m_bot->HasAura(RIGHTEOUS_FURY, EFFECT_INDEX_0))
        ai->CastSpell (RIGHTEOUS_FURY, *m_bot);

    if (SHADOW_RESISTANCE_AURA > 0 && !m_bot->HasAura(SHADOW_RESISTANCE_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_WARLOCK)
        ai->CastSpell (SHADOW_RESISTANCE_AURA, *m_bot);

    if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_WARRIOR)
        ai->CastSpell (DEVOTION_AURA, *m_bot);

    if (FIRE_RESISTANCE_AURA > 0 && !m_bot->HasAura(FIRE_RESISTANCE_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_MAGE)
        ai->CastSpell (FIRE_RESISTANCE_AURA, *m_bot);

    if (RETRIBUTION_AURA > 0 && !m_bot->HasAura(RETRIBUTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_PRIEST)
        ai->CastSpell (RETRIBUTION_AURA, *m_bot);

    if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_SHAMAN)
        ai->CastSpell (DEVOTION_AURA, *m_bot);

    if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_ROGUE)
        ai->CastSpell (DEVOTION_AURA, *m_bot);

    if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_PALADIN)
        ai->CastSpell (DEVOTION_AURA, *m_bot);

    if (ai->GetHealthPercent() <= 40 || GetMaster()->GetHealth() <= GetMaster()->GetMaxHealth() * 0.4)
        SpellSequence = Healing;
    else
        SpellSequence = Combat;

    switch (SpellSequence)
    {
        case Combat:
            if (JUDGEMENT_OF_LIGHT > 0 && !pTarget->HasAura(JUDGEMENT_OF_LIGHT, EFFECT_INDEX_0) && CombatCounter < 1 && ai->GetManaPercent() >= 5)
            {
                ai->CastSpell (JUDGEMENT_OF_LIGHT, *pTarget);
                out << " Judgement of Light";
                CombatCounter++;
                break;
            }
            else if (SEAL_OF_COMMAND > 0 && !m_bot->HasAura(SEAL_OF_COMMAND, EFFECT_INDEX_0) && CombatCounter < 2 && ai->GetManaPercent() >= 14)
            {
                ai->CastSpell (SEAL_OF_COMMAND, *m_bot);
                out << " Seal of Command";
                CombatCounter++;
                break;
            }
            else if (HAMMER_OF_JUSTICE > 0 && !pTarget->HasAura(HAMMER_OF_JUSTICE, EFFECT_INDEX_0) && CombatCounter < 3 && ai->GetManaPercent() >= 3)
            {
                ai->CastSpell (HAMMER_OF_JUSTICE, *pTarget);
                out << " Hammer of Justice";
                CombatCounter++;
                break;
            }
            else if (CRUSADER_STRIKE > 0 && CombatCounter < 4 && ai->GetManaPercent() >= 5)
            {
                ai->CastSpell (CRUSADER_STRIKE, *pTarget);
                out << " Crusader Strike";
                CombatCounter++;
                break;
            }
            else if (AVENGING_WRATH > 0 && CombatCounter < 5 && !m_bot->HasAura(AVENGING_WRATH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell (AVENGING_WRATH, *m_bot);
                out << " Avenging Wrath";
                CombatCounter++;
                break;
            }
            else if (SACRED_SHIELD > 0 && CombatCounter < 6 && pVictim == m_bot && ai->GetHealthPercent() < 70 && !m_bot->HasAura(SACRED_SHIELD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 12)
            {
                ai->CastSpell (SACRED_SHIELD, *m_bot);
                out << " Sacred Shield";
                CombatCounter++;
                break;
            }
            else if (DIVINE_STORM > 0 && CombatCounter < 7 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 12)
            {
                ai->CastSpell (DIVINE_STORM, *pTarget);
                out << " Divine Storm";
                CombatCounter++;
                break;
            }
            else if (HAMMER_OF_WRATH > 0 && CombatCounter < 8 && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.20 && ai->GetManaPercent() >= 14)
            {
                ai->CastSpell (HAMMER_OF_WRATH, *pTarget);
                out << " Hammer of Wrath";
                CombatCounter++;
                break;
            }
            else if (HOLY_WRATH > 0 && CombatCounter < 9 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell (HOLY_WRATH, *pTarget);
                out << " Holy Wrath";
                CombatCounter++;
                break;
            }
            else if (HAND_OF_SACRIFICE > 0 && pVictim == GetMaster() && !GetMaster()->HasAura(HAND_OF_SACRIFICE, EFFECT_INDEX_0) && CombatCounter < 10 && ai->GetManaPercent() >= 6)
            {
                ai->CastSpell (HAND_OF_SACRIFICE, *GetMaster());
                out << " Hand of Sacrifice";
                CombatCounter++;
                break;
            }
            else if (DIVINE_PROTECTION > 0 && pVictim == m_bot && !m_bot->HasAura(FORBEARANCE, EFFECT_INDEX_0) && ai->GetHealthPercent() < 30 && CombatCounter < 11 && ai->GetManaPercent() >= 3)
            {
                ai->CastSpell (DIVINE_PROTECTION, *m_bot);
                out << " Divine Protection";
                CombatCounter++;
                break;
            }
            else if (RIGHTEOUS_DEFENSE > 0 && pVictim != m_bot && ai->GetHealthPercent() > 70 && CombatCounter < 12)
            {
                ai->CastSpell (RIGHTEOUS_DEFENSE, *pTarget);
                out << " Righteous Defense";
                CombatCounter++;
                break;
            }
            else if (DIVINE_PLEA > 0 && !m_bot->HasAura(DIVINE_PLEA, EFFECT_INDEX_0) && ai->GetManaPercent() < 50 && CombatCounter < 13)
            {
                ai->CastSpell (DIVINE_PLEA, *m_bot);
                out << " Divine Plea";
                CombatCounter++;
                break;
            }
            else if (DIVINE_FAVOR > 0 && !m_bot->HasAura(DIVINE_FAVOR, EFFECT_INDEX_0) && CombatCounter < 14)
            {
                ai->CastSpell (DIVINE_FAVOR, *m_bot);
                out << " Divine Favor";
                CombatCounter++;
                break;
            }
            else if (CombatCounter > 15)
            {
                CombatCounter = 0;
                //ai->TellMaster("CombatCounter Reset");
                break;
            }
            else
            {
                CombatCounter = 0;
                //ai->TellMaster("Counter = 0");
                break;
            }

        case Healing:
            if (ai->GetHealthPercent() <= 40)
            {
                HealTarget (m_bot);
                out << " ...healing bot";
                break;
            }
            if (masterHP <= 40)
            {
                HealTarget (GetMaster());
                out << " ...healing master";
                break;
            }
            else
            {
                CombatCounter = 0;
                //ai->TellMaster("Counter = 0");
                break;
            }
    }
    if (ai->GetManager()->m_confDebugWhisper)
        ai->TellMaster(out.str().c_str());

    if (AVENGING_WRATH > 0 && !m_bot->HasAura(AVENGING_WRATH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
        ai->CastSpell(AVENGING_WRATH, *m_bot);

    if (DIVINE_SHIELD > 0 && ai->GetHealthPercent() < 30 && pVictim == m_bot && !m_bot->HasAura(FORBEARANCE, EFFECT_INDEX_0) && !m_bot->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 3)
        ai->CastSpell(DIVINE_SHIELD, *m_bot);

    if (DIVINE_SACRIFICE > 0 && ai->GetHealthPercent() > 50 && pVictim != m_bot && !m_bot->HasAura(DIVINE_SACRIFICE, EFFECT_INDEX_0))
        ai->CastSpell(DIVINE_SACRIFICE, *m_bot);
}
void PlayerbotPaladinAI::DoNonCombatActions()
{
    PlayerbotAI* ai = GetAI();
    Player * m_bot = GetPlayerBot();
    if (!m_bot)
        return;

    // Buff myself
    if (ai->GetCombatOrder() == ai->ORDERS_TANK)
        ai->SelfBuff(RIGHTEOUS_FURY);
    BuffPlayer(m_bot);

    // Buff master
    BuffPlayer(ai->GetMaster());

    // mana check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    Item* pItem = ai->FindDrink();
    Item* fItem = ai->FindBandage();

    if (pItem != NULL && ai->GetManaPercent() < 40)
    {
        ai->TellMaster("I could use a drink.");
        ai->UseItem(pItem);
        return;
    }

    // hp check original
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    pItem = ai->FindFood();

    if (pItem != NULL && ai->GetHealthPercent() < 40)
    {
        ai->TellMaster("I could use some food.");
        ai->UseItem(pItem);
        return;
    }
    else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
    {
        ai->TellMaster("I could use first aid.");
        ai->UseItem(fItem);
        return;
    }

    // heal and buff group
    if (GetMaster()->GetGroup())
    {
        Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *tPlayer = sObjectMgr.GetPlayer(itr->guid);
            if (!tPlayer)
                continue;

            if (!tPlayer->isAlive())
            {
                if (ai->CastSpell(REDEMPTION, *tPlayer))
                {
                    std::string msg = "Resurrecting ";
                    msg += tPlayer->GetName();
                    m_bot->Say(msg, LANG_UNIVERSAL);
                    return;
                }
                else
                    continue;
            }

            if (HealTarget(tPlayer))
                return;

            if (tPlayer != m_bot && tPlayer != GetMaster())
                if (BuffPlayer(tPlayer))
                    return;
        }
    }
}
Exemplo n.º 5
0
void PlayerbotPriestAI::DoNonCombatActions()
{
    PlayerbotAI* ai = GetAI();
    Player * m_bot = GetPlayerBot();
    if (!m_bot)
        return;

    SpellSequence = SPELL_HOLY;

    // buff myself
    if (FORTITUDE > 0)
        (!m_bot->HasAura(FORTITUDE, EFFECT_INDEX_0) && ai->CastSpell (FORTITUDE, *m_bot));

    if (INNER_FIRE > 0)
        (!m_bot->HasAura(INNER_FIRE, EFFECT_INDEX_0) && ai->CastSpell (INNER_FIRE, *m_bot));

    // buff master
    if (FORTITUDE > 0)
        (!GetMaster()->HasAura(FORTITUDE, EFFECT_INDEX_0) && ai->CastSpell(FORTITUDE,*(GetMaster())) );

    // mana check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    Item* pItem = ai->FindDrink();
    Item* fItem = ai->FindBandage();

    if (pItem != NULL && ai->GetManaPercent() < 30)
    {
        ai->TellMaster("I could use a drink.");
        ai->UseItem(*pItem);
        ai->SetIgnoreUpdateTime(30);
        return;
    }

    // hp check
    if (m_bot->getStandState() != UNIT_STAND_STATE_STAND)
        m_bot->SetStandState(UNIT_STAND_STATE_STAND);

    pItem = ai->FindFood();

    if (pItem != NULL && ai->GetHealthPercent() < 30)
    {
        ai->TellMaster("I could use some food.");
        ai->UseItem(*pItem);
        ai->SetIgnoreUpdateTime(30);
        return;
    }
    else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70)
    {
        ai->TellMaster("I could use first aid.");
        ai->UseItem(*fItem);
        ai->SetIgnoreUpdateTime(8);
        return;
    }

    // buff and heal master's group
    if (GetMaster()->GetGroup())
    {
        Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *tPlayer = sObjectMgr.GetPlayer(uint64 (itr->guid));
            if( !tPlayer )
                continue;

            // first rezz em
            if ( !tPlayer->isAlive() && !tPlayer->GetPlayerbotAI() )
            {
                std::string msg = "rezzing ";
                msg += tPlayer->GetName();
                GetPlayerBot()->Say(msg, LANG_UNIVERSAL);
                ai->CastSpell(REZZ, *tPlayer);
                // rez is only 10 sec, but give time for lag
                ai->SetIgnoreUpdateTime(17);
            }
            else if( tPlayer->isAlive() )
            {
                // buff and heal
                (!tPlayer->HasAura(FORTITUDE, EFFECT_INDEX_0) && ai->CastSpell (FORTITUDE, *tPlayer));
                (HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth()));
            }
        }
    }
} // end DoNonCombatActions
Exemplo n.º 6
0
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget)
{
    Unit* pVictim = pTarget->getVictim();
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
        case PlayerbotAI::SCENARIO_DUEL:
            (ai->HasAura(SCREAM,*pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) ||
                ai->CastSpell(PAIN) ||
                (ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) ||
                (ai->GetPlayerBot()->GetDistance(pTarget) <= 5 && ai->CastSpell(SCREAM)) ||
                ai->CastSpell(MIND_BLAST) ||
                (ai->GetHealthPercent() < 20 && ai->CastSpell(GREAT_HEAL)) ||
                ai->CastSpell(SMITE);
            return;
    }

    // ------- Non Duel combat ----------

    ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob

    Player *m_bot = GetPlayerBot();
    Group *m_group = m_bot->GetGroup();

    // Heal myself
    if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0))
    {
        ai->TellMaster("I'm casting fade.");
        ai->CastSpell(FADE, *m_bot);
    }
    else if (ai->GetHealthPercent() < 25 && PWS > 0 && !m_bot->HasAura(PWS, EFFECT_INDEX_0))
    {
        ai->TellMaster("I'm casting pws on myself.");
        ai->CastSpell(PWS);
    }
    else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0)
    {
        ai->TellMaster("I'm casting desperate prayer.");
        ai->CastSpell(DESPERATE_PRAYER, *m_bot);
    }
    else if (ai->GetHealthPercent() < 80)
        HealTarget (*m_bot, ai->GetHealthPercent());

    // Heal master
    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
    if (GetMaster()->isAlive())
    {
        if (masterHP < 25 && PWS > 0 && !GetMaster()->HasAura(PWS, EFFECT_INDEX_0))
                ai->CastSpell(PWS, *(GetMaster()));
        else if (masterHP < 80)
            HealTarget (*GetMaster(), masterHP);
    }

    // Heal group
    if( m_group )
    {
        Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots();
        for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
        {
            Player *m_groupMember = sObjectMgr.GetPlayer( itr->guid );
            if( !m_groupMember || !m_groupMember->isAlive() )
                continue;

            uint32 memberHP = m_groupMember->GetHealth()*100 / m_groupMember->GetMaxHealth();
            if( memberHP < 25 )
                HealTarget( *m_groupMember, memberHP );
        }
    }

    // Damage Spells
    ai->SetInFront( pTarget );
    float dist = m_bot->GetDistance( pTarget );

    switch (SpellSequence)
    {
        case SPELL_HOLY:
            if (SMITE > 0 && LastSpellHoly <1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17)
            {
                ai->CastSpell(SMITE, *pTarget);
                SpellSequence = SPELL_SHADOWMAGIC;
                LastSpellHoly = LastSpellHoly +1;
                break;
            }
            else if (MANA_BURN > 0 && LastSpellHoly <2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14)
            {
                //ai->TellMaster("I'm casting mana burn.");
                ai->CastSpell(MANA_BURN, *pTarget);
                ai->SetIgnoreUpdateTime(3);
                SpellSequence = SPELL_SHADOWMAGIC;
                LastSpellHoly = LastSpellHoly +1;
                break;
            }
            else if (HOLY_NOVA > 0 && LastSpellHoly <3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 22)
            {
                //ai->TellMaster("I'm casting holy nova.");
                ai->CastSpell(HOLY_NOVA);
                SpellSequence = SPELL_SHADOWMAGIC;
                LastSpellHoly = LastSpellHoly +1;
                break;
             }
             else if (HOLY_FIRE > 0 && LastSpellHoly <4 && !pTarget->HasAura(HOLY_FIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 13)
             {
                 //ai->TellMaster("I'm casting holy fire.");
                 ai->CastSpell(HOLY_FIRE, *pTarget);
                 SpellSequence = SPELL_SHADOWMAGIC;
                 LastSpellHoly = LastSpellHoly +1;
                 break;
             }
             else if (PRAYER_OF_MENDING > 0 && LastSpellHoly <5 && pVictim == GetMaster() && GetMaster()->GetHealth() <= GetMaster()->GetMaxHealth()*0.7 && !GetMaster()->HasAura(PRAYER_OF_MENDING, EFFECT_INDEX_0) && ai->GetManaPercent() >= 15)
             {
                 //ai->TellMaster("I'm casting prayer of mending on master.");
                 ai->CastSpell(PRAYER_OF_MENDING, *GetMaster());
                 SpellSequence = SPELL_SHADOWMAGIC;
                 LastSpellHoly = LastSpellHoly +1;
                 break;
             }
             else if (LastSpellHoly > 6)
             {
                 LastSpellHoly = 0;
                 SpellSequence = SPELL_SHADOWMAGIC;
                 break;
             }
             LastSpellHoly = LastSpellHoly + 1;
             //SpellSequence = SPELL_SHADOWMAGIC;
             //break;

        case SPELL_SHADOWMAGIC:
            if (PAIN > 0 && LastSpellShadowMagic <1 && !pTarget->HasAura(PAIN, EFFECT_INDEX_0) && ai->GetManaPercent() >= 25)
            {
                //ai->TellMaster("I'm casting pain.");
                ai->CastSpell(PAIN, *pTarget);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (MIND_BLAST > 0 && LastSpellShadowMagic <2 && ai->GetManaPercent() >= 19)
            {
                //ai->TellMaster("I'm casting mind blast.");
                ai->CastSpell(MIND_BLAST, *pTarget);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
           else if (SCREAM > 0 && LastSpellShadowMagic <3 && ai->GetAttackerCount()>=3 && ai->GetManaPercent() >= 15)
            {
                ai->TellMaster("I'm casting scream.");
                ai->CastSpell(SCREAM);
                SpellSequence = SPELL_DISCIPLINE;
                (LastSpellShadowMagic = LastSpellShadowMagic +1);
                break;
            }

            else if (MIND_FLAY > 0 && LastSpellShadowMagic <4 && !pTarget->HasAura(MIND_FLAY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 10)
            {
                //ai->TellMaster("I'm casting mind flay.");
                ai->CastSpell(MIND_FLAY, *pTarget);
                ai->SetIgnoreUpdateTime(3);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (DEVOURING_PLAGUE > 0 && LastSpellShadowMagic <5 && !pTarget->HasAura(DEVOURING_PLAGUE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 28)
            {
                ai->CastSpell(DEVOURING_PLAGUE, *pTarget);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (SHADOW_PROTECTION > 0 && LastSpellShadowMagic <6 && ai->GetManaPercent() >= 60)
            {
                ai->CastSpell(SHADOW_PROTECTION, *pTarget);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (VAMPIRIC_TOUCH > 0 && LastSpellShadowMagic <7 && !pTarget->HasAura(VAMPIRIC_TOUCH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(VAMPIRIC_TOUCH, *pTarget);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (SHADOWFIEND > 0 && LastSpellShadowMagic <8)
            {
                ai->CastSpell(SHADOWFIEND);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (MIND_SEAR > 0 && LastSpellShadowMagic <9 && ai->GetAttackerCount()>=3 && ai->GetManaPercent() >= 28)
            {
                ai->CastSpell(MIND_SEAR, *pTarget);
                ai->SetIgnoreUpdateTime(5);
                SpellSequence = SPELL_DISCIPLINE;
                LastSpellShadowMagic = LastSpellShadowMagic +1;
                break;
            }
            else if (LastSpellShadowMagic > 10)
            {
                LastSpellShadowMagic = 0;
                SpellSequence = SPELL_DISCIPLINE;
                break;
            }
            LastSpellShadowMagic = LastSpellShadowMagic +1;
            //SpellSequence = SPELL_DISCIPLINE;
            //break;

        case SPELL_DISCIPLINE:
            if (FEAR_WARD > 0 && LastSpellDiscipline <1 && ai->GetManaPercent() >= 3)
            {
                //ai->TellMaster("I'm casting fear ward");
                ai->CastSpell(FEAR_WARD, *(GetMaster()));
                SpellSequence = SPELL_HOLY;
                LastSpellDiscipline = LastSpellDiscipline + 1;
                break;
            }
            else if (POWER_INFUSION > 0 && LastSpellDiscipline <2 && ai->GetManaPercent() >= 16)
            {
                //ai->TellMaster("I'm casting power infusion");
                ai->CastSpell(POWER_INFUSION, *(GetMaster()));
                SpellSequence = SPELL_HOLY;
                LastSpellDiscipline = LastSpellDiscipline + 1;
                break;
            }
            else if (MASS_DISPEL > 0 && LastSpellDiscipline <3 && ai->GetManaPercent() >= 33)
            {
                //ai->TellMaster("I'm casting mass dispel");
                ai->CastSpell(MASS_DISPEL);
                SpellSequence = SPELL_HOLY;
                LastSpellDiscipline = LastSpellDiscipline + 1;
                break;
            }
            else if (INNER_FOCUS > 0 && !m_bot->HasAura(INNER_FOCUS, EFFECT_INDEX_0) && LastSpellDiscipline <4)
            {
                //ai->TellMaster("I'm casting inner focus");
                ai->CastSpell(INNER_FOCUS, *m_bot);
                SpellSequence = SPELL_HOLY;
                LastSpellDiscipline = LastSpellDiscipline + 1;
                break;
            }
            else if (PENANCE > 0 && LastSpellDiscipline <5 && ai->GetManaPercent() >= 16)
            {
                //ai->TellMaster("I'm casting PENANCE");
                ai->CastSpell(PENANCE);
                SpellSequence = SPELL_HOLY;
                LastSpellDiscipline = LastSpellDiscipline + 1;
                break;
            }
            else if (LastSpellDiscipline > 6)
            {
                LastSpellDiscipline = 0;
                SpellSequence = SPELL_HOLY;
                break;
            }
            else
            {
                LastSpellDiscipline = LastSpellDiscipline + 1;
                SpellSequence = SPELL_HOLY;
            }
    }
} // end DoNextCombatManeuver
Exemplo n.º 7
0
void PlayerbotDeathKnightAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    switch (ai->GetScenarioType())
    {
        case PlayerbotAI::SCENARIO_DUEL:
            ai->CastSpell(PLAGUE_STRIKE);
            return;
    }

    // ------- Non Duel combat ----------

    //ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob

    // DK Attacks: Unholy, Frost & Blood

    // damage spells
    ai->SetInFront( pTarget );//<---
    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();
    Pet *pet = m_bot->GetPet();
    float dist = m_bot->GetDistance( pTarget );
    std::ostringstream out;

    switch (SpellSequence)
    {
        case SPELL_DK_UNHOLY:
               if (UNHOLY_PRESENCE > 0)
                     (!m_bot->HasAura(UNHOLY_PRESENCE, EFFECT_INDEX_0) && !m_bot->HasAura(BLOOD_PRESENCE, EFFECT_INDEX_0) && !m_bot->HasAura(FROST_PRESENCE, EFFECT_INDEX_0) && ai->CastSpell (UNHOLY_PRESENCE, *m_bot));

               // check for BONE_SHIELD in combat
               if (BONE_SHIELD > 0)
                     (!m_bot->HasAura(BONE_SHIELD, EFFECT_INDEX_0) && !m_bot->HasAura(ARMY_OF_THE_DEAD, EFFECT_INDEX_0) && ai->CastSpell (BONE_SHIELD, *m_bot));

               if (ARMY_OF_THE_DEAD > 0 && ai->GetAttackerCount()>=5 && LastSpellUnholyDK < 1)
               {
                      ai->CastSpell(ARMY_OF_THE_DEAD);
                      out << " summoning Army of the Dead!";
                      if (ARMY_OF_THE_DEAD > 0 && m_bot->HasAura(ARMY_OF_THE_DEAD, EFFECT_INDEX_0))
                      ai->SetIgnoreUpdateTime(7);
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (PLAGUE_STRIKE > 0 && !pTarget->HasAura(PLAGUE_STRIKE, EFFECT_INDEX_0) && LastSpellUnholyDK < 2)
               {
                      ai->CastSpell(PLAGUE_STRIKE, *pTarget);
                      out << " Plague Strike";
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (DEATH_GRIP > 0 && !pTarget->HasAura(DEATH_GRIP, EFFECT_INDEX_0) && LastSpellUnholyDK < 3)
               {
                      ai->CastSpell(DEATH_GRIP, *pTarget);
                      out << " Death Grip";
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (DEATH_COIL > 0 && LastSpellUnholyDK < 4 && ai->GetRunicPower() >= 40)
               {
                      ai->CastSpell(DEATH_COIL, *pTarget);
                      out << " Death Coil";
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (DEATH_STRIKE > 0 && !pTarget->HasAura(DEATH_STRIKE, EFFECT_INDEX_0) && LastSpellUnholyDK < 5)
               {
                      ai->CastSpell(DEATH_STRIKE, *pTarget);
                      out << " Death Strike";
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (UNHOLY_BLIGHT > 0 && !pTarget->HasAura(UNHOLY_BLIGHT, EFFECT_INDEX_0) && LastSpellUnholyDK < 6)
               {
                      ai->CastSpell(UNHOLY_BLIGHT);
                      out << " Unholy Blight";
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (SCOURGE_STRIKE > 0 && LastSpellUnholyDK < 7)
               {
                      ai->CastSpell(SCOURGE_STRIKE, *pTarget);
                      out << " Scourge Strike";
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (DEATH_AND_DECAY > 0 && ai->GetAttackerCount()>=3 && dist <= ATTACK_DISTANCE && !pTarget->HasAura(DEATH_AND_DECAY, EFFECT_INDEX_0) && LastSpellUnholyDK < 8)
               {
                      ai->CastSpell(DEATH_AND_DECAY);
                      out << " Death and Decay";
                      ai->SetIgnoreUpdateTime(1);
                      SpellSequence = SPELL_DK_FROST;
                      LastSpellUnholyDK = LastSpellUnholyDK +1;
                      break;
               }
               else if (SUMMON_GARGOYLE > 0 && !m_bot->HasAura(ARMY_OF_THE_DEAD, EFFECT_INDEX_0) && !pTarget->HasAura(SUMMON_GARGOYLE, EFFECT_INDEX_0) && LastSpellUnholyDK < 9 && ai->GetRunicPower() >= 60)
               {
                     ai->CastSpell(SUMMON_GARGOYLE, *pTarget);
                     out << " summoning Gargoyle";
                     ai->SetIgnoreUpdateTime(2);
                     SpellSequence = SPELL_DK_FROST;
                     LastSpellUnholyDK = LastSpellUnholyDK +1;
                     break;
               }
               else if (CORPSE_EXPLOSION > 0 && dist <= ATTACK_DISTANCE && LastSpellUnholyDK < 10)
               {
                     ai->CastSpell(CORPSE_EXPLOSION, *pTarget);
                     out << " Corpse Explosion";
                     SpellSequence = SPELL_DK_FROST;
                     LastSpellUnholyDK = LastSpellUnholyDK +1;
                     break;
               }
               else if (ANTI_MAGIC_SHELL > 0 && pTarget->IsNonMeleeSpellCasted(true) && !m_bot->HasAura(ANTI_MAGIC_SHELL, EFFECT_INDEX_0) && LastSpellUnholyDK < 11 && ai->GetRunicPower() >= 20)
               {
                     ai->CastSpell(ANTI_MAGIC_SHELL, *m_bot);
                     out << " Anti-Magic Shell";
                     SpellSequence = SPELL_DK_FROST;
                     LastSpellUnholyDK = LastSpellUnholyDK +1;
                     break;
               }
               else if (ANTI_MAGIC_ZONE > 0 && pTarget->IsNonMeleeSpellCasted(true) && !m_bot->HasAura(ANTI_MAGIC_SHELL, EFFECT_INDEX_0) && LastSpellUnholyDK < 12)
               {
                     ai->CastSpell(ANTI_MAGIC_ZONE, *m_bot);
                     out << " Anti-Magic Zone";
                     SpellSequence = SPELL_DK_FROST;
                     LastSpellUnholyDK = LastSpellUnholyDK +1;
                     break;
               }
               else if(( !pet )
                     && (RAISE_DEAD > 0 && !m_bot->HasAura(ARMY_OF_THE_DEAD, EFFECT_INDEX_0) && LastSpellUnholyDK < 13))
               {
                     ai->CastSpell(RAISE_DEAD);
                     out << " summoning Ghoul";
                     SpellSequence = SPELL_DK_FROST;
                     LastSpellUnholyDK = LastSpellUnholyDK +1;
                     break;
               }
               else if(( pet )
                     && (GHOUL_FRENZY > 0 && pVictim == pet && !pet->HasAura(GHOUL_FRENZY, EFFECT_INDEX_0) && LastSpellUnholyDK < 14))
               {
                     ai->CastSpell(GHOUL_FRENZY, *pet);
                     out << " casting Ghoul Frenzy on pet";
                     SpellSequence = SPELL_DK_FROST;
                     LastSpellUnholyDK = LastSpellUnholyDK +1;
                     break;
               }
               else if (LastSpellUnholyDK > 15)
               {
                     LastSpellUnholyDK = 0;
                     SpellSequence = SPELL_DK_FROST;
                     break;
               }

               LastSpellUnholyDK = 0;

        case SPELL_DK_FROST:
               if (FROST_PRESENCE > 0)
                     (!m_bot->HasAura(FROST_PRESENCE, EFFECT_INDEX_0) && !m_bot->HasAura(BLOOD_PRESENCE, EFFECT_INDEX_0) && !m_bot->HasAura(UNHOLY_PRESENCE, EFFECT_INDEX_0) && ai->CastSpell (FROST_PRESENCE, *m_bot));

               if (DEATHCHILL > 0)
                     (!m_bot->HasAura(DEATHCHILL, EFFECT_INDEX_0) && !m_bot->HasAura(KILLING_MACHINE, EFFECT_INDEX_0) && ai->CastSpell (DEATHCHILL, *m_bot));
               else if (KILLING_MACHINE > 0)
                     (!m_bot->HasAura(KILLING_MACHINE, EFFECT_INDEX_0) && !m_bot->HasAura(DEATHCHILL, EFFECT_INDEX_0) && ai->CastSpell (KILLING_MACHINE, *m_bot));

               if (ICY_TOUCH > 0 && !pTarget->HasAura(ICY_TOUCH, EFFECT_INDEX_0) && LastSpellFrostDK < 1)
               {
                     ai->CastSpell(ICY_TOUCH, *pTarget);
                     out << " Icy Touch";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (OBLITERATE > 0 && LastSpellFrostDK < 2)
               {
                     ai->CastSpell(OBLITERATE, *pTarget);
                     out << " Obliterate";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (FROST_STRIKE > 0 && LastSpellFrostDK < 3 && ai->GetRunicPower() >= 40)
               {
                     ai->CastSpell(FROST_STRIKE, *pTarget);
                     out << " Frost Strike";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (HOWLING_BLAST > 0 && ai->GetAttackerCount()>=3 && LastSpellFrostDK < 4)
               {
                     ai->CastSpell(HOWLING_BLAST, *pTarget);
                     out << " Howling Blast";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (CHAINS_OF_ICE > 0 && !pTarget->HasAura(CHAINS_OF_ICE, EFFECT_INDEX_0) && LastSpellFrostDK < 5)
               {
                     ai->CastSpell(CHAINS_OF_ICE, *pTarget);
                     out << " Chains of Ice";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (RUNE_STRIKE > 0 && LastSpellFrostDK < 6 && ai->GetRunicPower() >= 20)
               {
                     ai->CastSpell(RUNE_STRIKE, *pTarget);
                     out << " Rune Strike";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (ICY_CLUTCH > 0 && !pTarget->HasAura(ICY_CLUTCH, EFFECT_INDEX_0) && LastSpellFrostDK < 7)
               {
                     ai->CastSpell(ICY_CLUTCH, *pTarget);
                     out << " Icy Clutch";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (ICEBOUND_FORTITUDE > 0 && ai->GetHealthPercent() < 50 && pVictim == m_bot && !m_bot->HasAura(ICEBOUND_FORTITUDE, EFFECT_INDEX_0) && LastSpellFrostDK < 8 && ai->GetRunicPower() >= 20)
               {
                     ai->CastSpell(ICEBOUND_FORTITUDE, *m_bot);
                     out << " Icebound Fortitude";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (MIND_FREEZE > 0 && pTarget->IsNonMeleeSpellCasted(true) && dist <= ATTACK_DISTANCE && LastSpellFrostDK < 9 && ai->GetRunicPower() >= 20)
               {
                     ai->CastSpell(MIND_FREEZE, *pTarget);
                     out << " Mind Freeze";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (HUNGERING_COLD > 0 && ai->GetAttackerCount()>=3 && dist <= ATTACK_DISTANCE && LastSpellFrostDK < 10 && ai->GetRunicPower() >= 40)
               {
                     ai->CastSpell(HUNGERING_COLD, *pTarget);
                     out << " Hungering Cold";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (EMPOWER_WEAPON > 0 && ai->GetRunicPower() < 20 && LastSpellFrostDK < 11)
               {
                     ai->CastSpell(EMPOWER_WEAPON, *m_bot);
                     out << " Empower Rune Weapon";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (UNBREAKABLE_ARMOR > 0 && !m_bot->HasAura(UNBREAKABLE_ARMOR, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70 && pVictim == m_bot && LastSpellFrostDK < 12)
               {
                     ai->CastSpell(UNBREAKABLE_ARMOR, *m_bot);
                     out << " Unbreakable Armor";
                     SpellSequence = SPELL_DK_BLOOD;
                     LastSpellFrostDK = LastSpellFrostDK +1;
                     break;
               }
               else if (LastSpellFrostDK > 13)
               {
                     LastSpellFrostDK = 0;
                     SpellSequence = SPELL_DK_BLOOD;
                     break;
               }

               LastSpellFrostDK = 0;

        case SPELL_DK_BLOOD:
               if (BLOOD_PRESENCE > 0)
                     (!m_bot->HasAura(BLOOD_PRESENCE, EFFECT_INDEX_0) && !m_bot->HasAura(UNHOLY_PRESENCE, EFFECT_INDEX_0) && !m_bot->HasAura(FROST_PRESENCE, EFFECT_INDEX_0) && ai->CastSpell (BLOOD_PRESENCE, *m_bot));

               if (MARK_OF_BLOOD > 0 && !pTarget->HasAura(MARK_OF_BLOOD, EFFECT_INDEX_0) && LastSpellBloodDK < 1)
               {
                     ai->CastSpell(MARK_OF_BLOOD, *pTarget);
                     out << " Mark of Blood";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (BLOOD_STRIKE > 0 && LastSpellBloodDK < 2)
               {
                     ai->CastSpell(BLOOD_STRIKE, *pTarget);
                     out << " Blood Strike";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK =  LastSpellBloodDK +1;
                     break;
               }
               else if (PESTILENCE > 0 && dist <= ATTACK_DISTANCE && ai->GetAttackerCount()>=3 && LastSpellBloodDK < 3)
               {
                     ai->CastSpell(PESTILENCE, *pTarget);
                     out << " Pestilence";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (STRANGULATE > 0 && !pTarget->HasAura(STRANGULATE, EFFECT_INDEX_0) && LastSpellBloodDK < 4)
               {
                     ai->CastSpell(STRANGULATE, *pTarget);
                     out << " Strangulate";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (BLOOD_BOIL > 0 && ai->GetAttackerCount()>=5 && dist <= ATTACK_DISTANCE && LastSpellBloodDK < 5)
               {
                     ai->CastSpell(BLOOD_BOIL, *pTarget);
                     out << " Blood Boil";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (HEART_STRIKE > 0 && LastSpellBloodDK < 6)
               {
                     ai->CastSpell(HEART_STRIKE, *pTarget);
                     out << " Heart Strike";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (VAMPIRIC_BLOOD > 0 && ai->GetHealthPercent() < 70 && !m_bot->HasAura(VAMPIRIC_BLOOD, EFFECT_INDEX_0) && LastSpellBloodDK < 7)
               {
                     ai->CastSpell(VAMPIRIC_BLOOD, *m_bot);
                     out << " Vampiric Blood";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (RUNE_TAP > 0 && ai->GetHealthPercent() < 70 && !m_bot->HasAura(VAMPIRIC_BLOOD, EFFECT_INDEX_0) && LastSpellBloodDK < 8)
               {
                     ai->CastSpell(RUNE_TAP, *m_bot);
                     out << " Rune Tap";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (HYSTERIA > 0 && ai->GetHealthPercent() > 25 && !m_bot->HasAura(HYSTERIA, EFFECT_INDEX_0) && LastSpellBloodDK < 9)
               {
                     ai->CastSpell(HYSTERIA, *m_bot);
                     out << " Hysteria";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (DANCING_WEAPON > 0 && !m_bot->HasAura(DANCING_WEAPON, EFFECT_INDEX_0) && ai->GetRunicPower() >= 60 && LastSpellBloodDK < 10)
               {
                     ai->CastSpell(DANCING_WEAPON, *pTarget);
                     out << " summoning Dancing Rune Weapon";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (DARK_COMMAND > 0 && ai->GetHealthPercent() > 50 && pVictim != m_bot && !pTarget->HasAura(DARK_COMMAND, EFFECT_INDEX_0) && dist <= ATTACK_DISTANCE && LastSpellBloodDK < 11)
               {
                     ai->CastSpell(DARK_COMMAND, *pTarget);
                     out << " Dark Command";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if(( pet )
                     && (DEATH_PACT > 0 && ai->GetHealthPercent() < 50 && LastSpellBloodDK < 12 && ai->GetRunicPower() >= 40))
               {
                     ai->CastSpell(DEATH_PACT, *pet);
                     out << " Death Pact (sacrifice pet)";
                     SpellSequence = SPELL_DK_UNHOLY;
                     LastSpellBloodDK = LastSpellBloodDK +1;
                     break;
               }
               else if (LastSpellBloodDK > 13)
               {
                     LastSpellBloodDK = 0;
                     SpellSequence = SPELL_DK_UNHOLY;
                     break;
               }
               else
               {
                     LastSpellBloodDK = 0;
                     SpellSequence = SPELL_DK_UNHOLY;
               }
    }
    if( ai->GetManager()->m_confDebugWhisper )
        ai->TellMaster( out.str().c_str() );

} // end DoNextCombatManeuver