コード例 #1
0
void PlayerbotRogueAI::DoNextCombatManeuver(Unit *pTarget)
{
    if (!pTarget)
        return;

    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

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

    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();
    float fTargetDist = m_bot->GetCombatDistance(pTarget);

    // TODO: make this work better...
    /*if (pVictim)
       {
        if( pVictim!=m_bot && !m_bot->hasUnitState(UNIT_STAT_FOLLOW) && !pTarget->isInBackInMap(m_bot,10) ) {
            GetAI()->TellMaster( "getting behind target" );
            m_bot->GetMotionMaster()->Clear( true );
            m_bot->GetMotionMaster()->MoveFollow( pTarget, 1, 2*M_PI );
        }
        else if( pVictim==m_bot && m_bot->hasUnitState(UNIT_STAT_FOLLOW) )
        {
            GetAI()->TellMaster( "chasing attacking target" );
            m_bot->GetMotionMaster()->Clear( true );
            m_bot->GetMotionMaster()->MoveChase( pTarget );
        }
       }*/

    //Rouge like behaviour. ^^
/*    if (VANISH > 0 && GetMaster()->isDead()) { //Causes the server to crash :( removed for now.
        m_bot->AttackStop();
        m_bot->RemoveAllAttackers();
        ai->CastSpell(VANISH);
   //        m_bot->RemoveAllSpellCooldown();
        GetAI()->TellMaster("AttackStop, CombatStop, Vanish");
    }*/

    // decide what to do:
    if (pVictim == m_bot && CLOAK_OF_SHADOWS > 0 && pVictim->HasAura(SPELL_AURA_PERIODIC_DAMAGE) && !m_bot->HasAura(CLOAK_OF_SHADOWS, EFFECT_INDEX_0) && ai->CastSpell(CLOAK_OF_SHADOWS))
    {
        if (ai->GetManager()->m_confDebugWhisper)
            ai->TellMaster("CoS!");
        return;
    }
    else if (m_bot->HasAura(STEALTH, EFFECT_INDEX_0))
        SpellSequence = RogueStealth;
    else if (pTarget->IsNonMeleeSpellCasted(true))
        SpellSequence = RogueSpellPreventing;
    else if (pVictim == m_bot && ai->GetHealthPercent() < 40)
        SpellSequence = RogueThreat;
    else
        SpellSequence = RogueCombat;

    // we fight in melee, target is not in range, skip the next part!
    if (fTargetDist > ATTACK_DISTANCE)
        return;

    std::ostringstream out;
    switch (SpellSequence)
    {
        case RogueStealth:
            out << "Case Stealth";
            if (PICK_POCKET > 0 && (pTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0 &&
                !((Creature*)pTarget)->lootForPickPocketed && ai->CastSpell(PICK_POCKET, *pTarget))
                out << " > Pick Pocket";
            else if (PREMEDITATION > 0 && ai->CastSpell(PREMEDITATION, *pTarget))
                out << " > Premeditation";
            else if (AMBUSH > 0 && ai->GetEnergyAmount() >= 60 && ai->CastSpell(AMBUSH, *pTarget))
                out << " > Ambush";
            else if (CHEAP_SHOT > 0 && !pTarget->HasAura(CHEAP_SHOT, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 60 && ai->CastSpell(CHEAP_SHOT, *pTarget))
                out << " > Cheap Shot";
            else if (GARROTE > 0 && ai->GetEnergyAmount() >= 50 && ai->CastSpell(GARROTE, *pTarget))
                out << " > Garrote";
            else
                m_bot->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
            break;
        case RogueThreat:
            out << "Case Threat";
            if (GOUGE > 0 && ai->GetEnergyAmount() >= 45 && !pTarget->HasAura(GOUGE, EFFECT_INDEX_0) && ai->CastSpell(GOUGE, *pTarget))
                out << " > Gouge";
            else if (EVASION > 0 && ai->GetHealthPercent() <= 35 && !m_bot->HasAura(EVASION, EFFECT_INDEX_0) && ai->CastSpell(EVASION))
                out << " > Evasion";
            else if (BLIND > 0 && ai->GetHealthPercent() <= 30 && !pTarget->HasAura(BLIND, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 30 && ai->CastSpell(BLIND, *pTarget))
                out << " > Blind";
            else if (FEINT > 0 && ai->GetHealthPercent() <= 25 && ai->GetEnergyAmount() >= 20 && ai->CastSpell(FEINT))
                out << " > Feint";
            else if (VANISH > 0 && ai->GetHealthPercent() <= 20 && !m_bot->HasAura(FEINT, EFFECT_INDEX_0) && ai->CastSpell(VANISH))
                out << " > Vanish";
            else if (PREPARATION > 0 && ai->CastSpell(PREPARATION))
                out << " > Preparation";
            else if (m_bot->getRace() == RACE_NIGHTELF && ai->GetHealthPercent() <= 15 && !m_bot->HasAura(SHADOWMELD, EFFECT_INDEX_0) && ai->CastSpell(SHADOWMELD, *m_bot))
                out << " > Shadowmeld";
            else
                out << " NONE!";
            break;
        case RogueSpellPreventing:
            out << "Case Prevent";
            if (KIDNEY_SHOT > 0 && ai->GetEnergyAmount() >= 25 && m_bot->GetComboPoints() >= 2 && ai->CastSpell(KIDNEY_SHOT, *pTarget))
                out << " > Kidney Shot";
            else if (KICK > 0 && ai->GetEnergyAmount() >= 25  && ai->CastSpell(KICK, *pTarget))
                out << " > Kick";
            else
                out << " NONE!";
            break;
        case RogueCombat:
        default:
            out << "Case Combat";
            if (m_bot->GetComboPoints() <= 4)
            {
                if (SHADOW_DANCE > 0 && !m_bot->HasAura(SHADOW_DANCE, EFFECT_INDEX_0) && ai->CastSpell(SHADOW_DANCE, *m_bot))
                    out << " > Shadow Dance";
                else if (CHEAP_SHOT > 0 && m_bot->HasAura(SHADOW_DANCE, EFFECT_INDEX_0) && !pTarget->HasAura(CHEAP_SHOT, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 60 && ai->CastSpell(CHEAP_SHOT, *pTarget))
                    out << " > Cheap Shot";
                else if (AMBUSH > 0 && m_bot->HasAura(SHADOW_DANCE, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 60 && ai->CastSpell(AMBUSH, *pTarget))
                    out << " > Ambush";
                else if (GARROTE > 0 && m_bot->HasAura(SHADOW_DANCE, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 50 && ai->CastSpell(GARROTE, *pTarget))
                    out << " > Garrote";
                else if (BACKSTAB > 0 && pTarget->isInBackInMap(m_bot, 1) && ai->GetEnergyAmount() >= 60 && ai->CastSpell(BACKSTAB, *pTarget))
                    out << " > Backstab";
                else if (MUTILATE > 0 && ai->GetEnergyAmount() >= 60 && ai->CastSpell(MUTILATE, *pTarget))
                    out << " > Mutilate";
                else if (SINISTER_STRIKE > 0 && ai->GetEnergyAmount() >= 45 && ai->CastSpell(SINISTER_STRIKE, *pTarget))
                    out << " > Sinister Strike";
                else if (GHOSTLY_STRIKE > 0 && ai->GetEnergyAmount() >= 40 && ai->CastSpell(GHOSTLY_STRIKE, *pTarget))
                    out << " > Ghostly Strike";
                else if (HEMORRHAGE > 0 && ai->GetEnergyAmount() >= 35 && ai->CastSpell(HEMORRHAGE, *pTarget))
                    out << " > Hemorrhage";
                else if (DISMANTLE > 0 && !pTarget->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED) && ai->GetEnergyAmount() >= 25 && ai->CastSpell(DISMANTLE, *pTarget))
                    out << " > Dismantle";
                else if (SHADOWSTEP > 0 && ai->GetEnergyAmount() >= 10 && ai->CastSpell(SHADOWSTEP, *pTarget))
                    out << " > Shadowstep";
                else if (m_bot->getRace() == RACE_BLOODELF && !pTarget->HasAura(ARCANE_TORRENT, EFFECT_INDEX_0) && ai->CastSpell(ARCANE_TORRENT, *pTarget))
                    out << " > Arcane Torrent";
                else if ((m_bot->getRace() == RACE_HUMAN && m_bot->hasUnitState(UNIT_STAT_STUNNED)) || m_bot->HasAuraType(SPELL_AURA_MOD_FEAR) || m_bot->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || (m_bot->HasAuraType(SPELL_AURA_MOD_CHARM) && ai->CastSpell(EVERY_MAN_FOR_HIMSELF, *m_bot)))
                    out << " > Every Man for Himself";
                else if ((m_bot->getRace() == RACE_UNDEAD && m_bot->HasAuraType(SPELL_AURA_MOD_FEAR)) || (m_bot->HasAuraType(SPELL_AURA_MOD_CHARM) && ai->CastSpell(WILL_OF_THE_FORSAKEN, *m_bot)))
                    out << " > Will of the Forsaken";
                else if (m_bot->getRace() == RACE_DWARF && m_bot->HasAuraState(AURA_STATE_DEADLY_POISON) && ai->CastSpell(STONEFORM, *m_bot))
                    out << " > Stoneform";
                else if ((m_bot->getRace() == RACE_GNOME && m_bot->hasUnitState(UNIT_STAT_STUNNED)) || (m_bot->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) && ai->CastSpell(ESCAPE_ARTIST, *m_bot)))
                    out << " > Escape Artist";
                else if (m_bot->getRace() == RACE_ORC && !m_bot->HasAura(BLOOD_FURY, EFFECT_INDEX_0) && ai->CastSpell(BLOOD_FURY, *m_bot))
                    out << " > Blood Fury";
                else if (m_bot->getRace() == RACE_TROLL && !m_bot->HasAura(BERSERKING, EFFECT_INDEX_0) && ai->CastSpell(BERSERKING, *m_bot))
                    out << " > Berserking";
                else
                    out << " NONE!";
            }
            else
            {
                if (EVISCERATE > 0 && pTarget->getClass() == CLASS_ROGUE && ai->GetEnergyAmount() >= 35 && ai->CastSpell(EVISCERATE, *pTarget))
                    out << " > Rogue Eviscerate";
                else if (EVISCERATE > 0 && pTarget->getClass() == CLASS_DRUID && ai->GetEnergyAmount() >= 35 && ai->CastSpell(EVISCERATE, *pTarget))
                    out << " > Druid Eviscerate";
                else if (KIDNEY_SHOT > 0 && pTarget->getClass() == CLASS_SHAMAN && ai->GetEnergyAmount() >= 25 && ai->CastSpell(KIDNEY_SHOT, *pTarget))
                    out << " > Shaman Kidney";
                else if (SLICE_DICE > 0 && pTarget->getClass() == CLASS_WARLOCK && ai->GetEnergyAmount() >= 25 && ai->CastSpell(SLICE_DICE, *pTarget))
                    out << " > Warlock Slice & Dice";
                else if (SLICE_DICE > 0 && pTarget->getClass() == CLASS_HUNTER && ai->GetEnergyAmount() >= 25 && ai->CastSpell(SLICE_DICE, *pTarget))
                    out << " > Hunter Slice & Dice";
                else if (EXPOSE_ARMOR > 0 && pTarget->getClass() == CLASS_WARRIOR && !pTarget->HasAura(EXPOSE_ARMOR, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 25 && ai->CastSpell(EXPOSE_ARMOR, *pTarget))
                    out << " > Warrior Expose Armor";
                else if (EXPOSE_ARMOR > 0 && pTarget->getClass() == CLASS_PALADIN && !pTarget->HasAura(EXPOSE_ARMOR, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 25 && ai->CastSpell(EXPOSE_ARMOR, *pTarget))
                    out << " > Paladin Expose Armor";
                else if (EXPOSE_ARMOR > 0 && pTarget->getClass() == CLASS_DEATH_KNIGHT && !pTarget->HasAura(EXPOSE_ARMOR, EFFECT_INDEX_0) && ai->GetEnergyAmount() >= 25 && ai->CastSpell(EXPOSE_ARMOR, *pTarget))
                    out << " > DK Expose Armor";
                else if (RUPTURE > 0 && pTarget->getClass() == CLASS_MAGE && ai->GetEnergyAmount() >= 25 && ai->CastSpell(RUPTURE, *pTarget))
                    out << " > Mage Rupture";
                else if (RUPTURE > 0 && pTarget->getClass() == CLASS_PRIEST && ai->GetEnergyAmount() >= 25 && ai->CastSpell(RUPTURE, *pTarget))
                    out << " > Priest Rupture";
                else if (EVISCERATE > 0 && ai->GetEnergyAmount() >= 35 && ai->CastSpell(EVISCERATE, *pTarget))
                    out << " > Eviscerate";
                else
                    out << " NONE!";
            }
            break;
    }
    if (ai->GetManager()->m_confDebugWhisper)
        ai->TellMaster(out.str().c_str());
}
コード例 #2
0
ファイル: PlayerbotDruidAI.cpp プロジェクト: AngelX/portalR2
void PlayerbotDruidAI::_DoNextPVECombatManeuverMeleeDPS(Unit* pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

    // True, bear form is set up for tanking but even then it's better DPS for levels 10-19 than humanoid form
    if (CAT_FORM == 0 && BEAR_FORM > 0)
        // but only go there if you can get into bear form. else stay here.
        if (ai->CastSpell(BEAR_FORM))
            return _DoNextPVECombatManeuverBear(pTarget);

    //uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();

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

    if (!m_bot->HasInArc(M_PI_F, pTarget))
    {
        m_bot->SetFacingTo(m_bot->GetAngle(pTarget));
        if (pVictim)
            pVictim->Attack(pTarget, true);
    }

    if (CAT_FORM > 0 && !m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
        if (!ai->CastSpell(CAT_FORM))
        {
            if (ai->GetManaPercent() < 30) // TODO: tweak this value. Pretty sure bear form mana Req is way less than 30% of base mana, let alone total mana
                return;  // conserve mana
            else
                _DoNextPVECombatManeuverSpellDPS(pTarget);
        }

    // Commented out: Above should take care of it
    //// Technically bear form is better than no form for melee druids levels 10-19.
    //if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
    //{
    //    m_bot->RemoveAurasDueToSpell(BEAR_FORM_1);
    //    //ai->TellMaster("FormClearBear");
    //    return;
    //}
    //if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
    //{
    //    m_bot->RemoveAurasDueToSpell(DIRE_BEAR_FORM_1);
    //    //ai->TellMaster("FormClearDireBear");
    //    return;
    //}
    //if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
    //{
    //    m_bot->RemoveAurasDueToSpell(MOONKIN_FORM_1);
    //    //ai->TellMaster("FormClearMoonkin");
    //    return;
    //}

    //if (COWER > 0 && m_bot->GetComboPoints() == 1 && ai->GetEnergyAmount() >= 20) // && HasAnyAggroWhereSecondAggroIsNotHealer()
    //{
    //    ai->CastSpell(COWER);
    //    //ai->TellMaster("Cower");
    //}
    if (MAIM > 0 && m_bot->GetComboPoints() >= 1 && pTarget->IsNonMeleeSpellCasted(true))
    {
        ai->CastSpell(MAIM, *pTarget);
        //ai->TellMaster("SpellPreventing Maim");
        return;
    }

    if (RAKE > 0 && m_bot->GetComboPoints() < 1 && ai->GetEnergyAmount() >= 40) // should be replaced by a check for the bleed effect it causes (along with Combo != 5)
    {
        ai->CastSpell(RAKE, *pTarget);
        //ai->TellMaster("Rake");
        return;
    }
    if (MANGLE > 0 && m_bot->GetComboPoints() == 1 && ai->GetEnergyAmount() >= 45)
    {
        ai->CastSpell(MANGLE, *pTarget);
        //ai->TellMaster("Mangle");
        return;
    }
    if (CLAW > 0 && m_bot->GetComboPoints() < 5 && ai->GetEnergyAmount() >= 45)
    {
        ai->CastSpell(CLAW, *pTarget);
        //ai->TellMaster("Claw");
        return;
    }

    if (m_bot->GetComboPoints() == 5)
    {
        if (RIP > 0 && pTarget->getClass() == CLASS_ROGUE && ai->GetEnergyAmount() >= 30)
            ai->CastSpell(RIP, *pTarget);
        else if (FEROCIOUS_BITE > 0 && ai->GetEnergyAmount() >= 35 &&
                 (pTarget->getClass() == CLASS_HUNTER || pTarget->getClass() == CLASS_WARRIOR ||
                  pTarget->getClass() == CLASS_PALADIN || pTarget->getClass() == CLASS_DEATH_KNIGHT))
            ai->CastSpell(FEROCIOUS_BITE, *pTarget);
        else if (ai->GetEnergyAmount() >= 35)
        {
            //ai->TellMaster("Else Maim, Ferocious Bite or Rip.");
            // MAIM must be first check, best option against other classes
            if (MAIM > 0)
                ai->CastSpell(MAIM, *pTarget);
            else if (FEROCIOUS_BITE > 0)
                ai->CastSpell(FEROCIOUS_BITE, *pTarget);
            else if (RIP > 0) // Fair enough, only needs 30 energy... but that means 35 is plenty
                ai->CastSpell(RIP, *pTarget);
        }
        return;
    }
}
コード例 #3
0
ファイル: PlayerbotDruidAI.cpp プロジェクト: zeroR2/mangos
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

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

    uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth();

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

    if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
        SpellSequence = DruidHeal;
    else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY)
        SpellSequence = DruidCombat;
    else if (IsFeral() && ai->GetCombatOrder() == PlayerbotAI::ORDERS_TANK)
        SpellSequence = DruidTank;
    else
        SpellSequence = DruidSpell;

    switch (SpellSequence)
    {
        case DruidTank: // Its now a tank druid!
            //ai->TellMaster("DruidTank");

            if (!m_bot->HasInArc(M_PI_F, pTarget))
            {
                m_bot->SetFacingTo(m_bot->GetAngle(pTarget));
                if (pVictim)
                    pVictim->Attack(pTarget, true);
            }
            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(768);
            //ai->TellMaster("FormClearCat");
            if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                ai->CastSpell (MOONKIN_FORM);
            else if (DIRE_BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                ai->CastSpell (DIRE_BEAR_FORM);
            else if (BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                ai->CastSpell (BEAR_FORM);
            else if (DEMORALIZING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !pTarget->HasAura(DEMORALIZING_ROAR, EFFECT_INDEX_0) && ai->GetRageAmount() >= 10)
                ai->CastSpell(DEMORALIZING_ROAR, *pTarget);
            if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
            {
                ai->CastSpell(FAERIE_FIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (MOONFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell(MOONFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (ROOTS > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(ROOTS, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (HURRICANE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
            {
                //ai->TellMaster("casting hurricane!");
                ai->CastSpell(HURRICANE, *pTarget);
                ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                break;
            }
            else if (WRATH > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(WRATH, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (INSECT_SWARM > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(INSECT_SWARM, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (STARFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(STARFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (FORCE_OF_NATURE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
            {
                //ai->TellMaster("summoning treants.");
                ai->CastSpell(FORCE_OF_NATURE);
                DruidSpellCombat++;
                break;
            }
            else if (STARFALL > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(STARFALL, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 3 && DruidSpellCombat < 9 && ai->GetManaPercent() >= 39)
            {
                ai->CastSpell(STARFALL, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (BARKSKIN > 0 && pVictim == m_bot && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetHealthPercent() < 75 && DruidSpellCombat < 10 && !m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
            {
                ai->CastSpell(BARKSKIN, *m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (INNERVATE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetManaPercent() < 50 && DruidSpellCombat < 11 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
            {
                ai->CastSpell(INNERVATE, *m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (ENRAGE > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && DruidSpellCombat < 2 && !m_bot->HasAura(ENRAGE, EFFECT_INDEX_0))
            {
                ai->CastSpell(ENRAGE, *m_bot);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (SWIPE > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && DruidSpellCombat < 4 && ai->GetRageAmount() >= 20)
            {
                ai->CastSpell(SWIPE, *pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (MAUL > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && DruidSpellCombat < 6 && ai->GetRageAmount() >= 15)
            {
                ai->CastSpell(MAUL, *pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (BASH > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !pTarget->HasAura(BASH, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetRageAmount() >= 10)
            {
                ai->CastSpell(BASH, *pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (CHALLENGING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && pVictim != m_bot && DruidSpellCombat < 10 && !pTarget->HasAura(CHALLENGING_ROAR, EFFECT_INDEX_0) && !pTarget->HasAura(GROWL, EFFECT_INDEX_0) && ai->GetRageAmount() >= 15)
            {
                ai->CastSpell(CHALLENGING_ROAR, *pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (GROWL > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && pVictim != m_bot && DruidSpellCombat < 12 && !pTarget->HasAura(CHALLENGING_ROAR, EFFECT_INDEX_0) && !pTarget->HasAura(GROWL, EFFECT_INDEX_0))
            {
                ai->CastSpell(GROWL, *pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (DruidSpellCombat > 13)
            {
                DruidSpellCombat = 0;
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidSpell:
            //ai->TellMaster("DruidSpell");
            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(768);
                //ai->TellMaster("FormClearCat");
                break;
            }
            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(5487);
                //ai->TellMaster("FormClearBear");
                break;
            }
            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(9634);
                //ai->TellMaster("FormClearDireBear");
                break;
            }
            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(24858);
                //ai->TellMaster("FormClearMoonkin");
                break;
            }
            if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(FAERIE_FIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (MOONFIRE > 0 && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell(MOONFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (ROOTS > 0 && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(ROOTS, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (HURRICANE > 0 && ai->GetAttackerCount() >= 5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
            {
                //ai->TellMaster("casting hurricane!");
                ai->CastSpell(HURRICANE, *pTarget);
                ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                break;
            }
            else if (WRATH > 0 && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(WRATH, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (INSECT_SWARM > 0 && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(INSECT_SWARM, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (STARFIRE > 0 && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(STARFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (FORCE_OF_NATURE > 0 && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
            {
                //ai->TellMaster("summoning treants.");
                ai->CastSpell(FORCE_OF_NATURE);
                DruidSpellCombat++;
                break;
            }
            else if (STARFALL > 0 && !m_bot->HasAura(STARFALL, EFFECT_INDEX_0) && ai->GetAttackerCount() >= 3 && DruidSpellCombat < 9 && ai->GetManaPercent() >= 39)
            {
                ai->CastSpell(STARFALL, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (BARKSKIN > 0 && pVictim == m_bot && ai->GetHealthPercent() < 75 && DruidSpellCombat < 10 && !m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
            {
                ai->CastSpell(BARKSKIN, *m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (INNERVATE > 0 && ai->GetManaPercent() < 50 && DruidSpellCombat < 11 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
            {
                ai->CastSpell(INNERVATE, *m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (DruidSpellCombat > 13)
            {
                DruidSpellCombat = 0;
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidHeal:
            //ai->TellMaster("DruidHeal");
            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(768);
                //ai->TellMaster("FormClearCat");
                break;
            }
            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(5487);
                //ai->TellMaster("FormClearBear");
                break;
            }
            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(9634);
                //ai->TellMaster("FormClearDireBear");
                break;
            }
            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(24858);
                //ai->TellMaster("FormClearMoonkin");
                break;
            }
            if (ai->GetHealthPercent() <= 40)
            {
                HealTarget (m_bot);
                break;
            }
            if (masterHP <= 40)
            {
                HealTarget (GetMaster());
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidCombat:
            //ai->TellMaster("DruidCombat");
            if (!m_bot->HasInArc(M_PI_F, pTarget))
            {
                m_bot->SetFacingTo(m_bot->GetAngle(pTarget));
                if (pVictim)
                    pVictim->Attack(pTarget, true);
            }
            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(5487);
                //ai->TellMaster("FormClearBear");
                break;
            }
            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(9634);
                //ai->TellMaster("FormClearDireBear");
                break;
            }
            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(24858);
                //ai->TellMaster("FormClearMoonkin");
                break;
            }
            if (CAT_FORM > 0 && !m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                ai->CastSpell (CAT_FORM);
/*
            if (COWER > 0 && m_bot->GetComboPoints() == 1 && ai->GetEnergyAmount() >= 20)
            {
                ai->CastSpell(COWER);
                //ai->TellMaster("Cower");
            }*/
            if (MAIM > 0 && m_bot->GetComboPoints() >= 1 && pTarget->IsNonMeleeSpellCasted(true))
            {
                ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("SpellPreventing Maim");
                break;
            }

            if (RAKE > 0 && m_bot->GetComboPoints() <= 1 && ai->GetEnergyAmount() >= 40)
            {
                ai->CastSpell (RAKE, *pTarget);
                //ai->TellMaster("Rake");
                break;
            }
            else if (CLAW > 0 && m_bot->GetComboPoints() <= 2 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (CLAW, *pTarget);
                //ai->TellMaster("Claw");
                break;
            }
            else if (MANGLE > 0 && m_bot->GetComboPoints() <= 3 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (MANGLE, *pTarget);
                //ai->TellMaster("Mangle");
                break;
            }
            else if (CLAW > 0 && m_bot->GetComboPoints() <= 4 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (CLAW, *pTarget);
                //ai->TellMaster("Claw2");
                break;
            }

            if (m_bot->GetComboPoints() == 5)
            {
                if (RIP > 0 && pTarget->getClass() == CLASS_ROGUE && ai->GetEnergyAmount() >= 30)
                    ai->CastSpell(RIP, *pTarget);
                //ai->TellMaster("Rogue Rip");
                else if (MAIM > 0 && pTarget->getClass() == CLASS_DRUID && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("Druid Maim");
                else if (MAIM > 0 && pTarget->getClass() == CLASS_SHAMAN && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("Shaman Maim");
                else if (MAIM > 0 && pTarget->getClass() == CLASS_WARLOCK && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("Warlock Maim");
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_HUNTER && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                //ai->TellMaster("Hunter Ferocious Bite");
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_WARRIOR && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                //ai->TellMaster("Warrior Ferocious Bite");
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_PALADIN && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                //ai->TellMaster("Paladin Ferocious Bite");
                else if (MAIM > 0 && pTarget->getClass() == CLASS_MAGE && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("Mage Maim");
                else if (MAIM > 0 && pTarget->getClass() == CLASS_PRIEST && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("Priest Maim");
                else if (MAIM > 0 && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("Else Maim");
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;
    }
} // end DoNextCombatManeuver
コード例 #4
0
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    if (!pTarget || pTarget->isDead()) return;
    PlayerbotAI *ai = GetAI();
    if (!ai) return;
    Player *m_bot = GetPlayerBot();
    if (!m_bot || m_bot->isDead()) return;
    Unit *pVictim = pTarget->getVictim();
    Unit *m_tank = FindMainTankInRaid(GetMaster());
    if (!m_tank && m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup()) { FindMainTankInRaid(m_bot); }
    if (!m_tank) { m_tank = m_bot; }
    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
    float pDist = m_bot->GetDistance(pTarget);
    uint8 pThreat = GetThreatPercent(pTarget);

    uint8 reqHeal = 0;
    uint8 OwnPartyHP = GetHealthPercentRaid(m_bot, reqHeal);


    #pragma region Select behaviour
    if (m_tank->GetGUID() == m_bot->GetGUID()) // Hey! I am Main Tank
    {
        if (TALENT_FERAL && BEAR_FORM) { m_role = BOT_ROLE_TANK; } //Just Keep Tanking dont even change forms for healing
        else
        {
            if (TALENT_BALANCE) {
                if ((ai->GetHealthPercent() <= 40 || masterHP <30 ) && (ai->GetManaPercent() >= 40)) { m_role = BOT_ROLE_SUPPORT; }
                else if (OwnPartyHP < 20 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
                else if (ai->GetManaPercent() < 25 ) { m_role = BOT_ROLE_TANK; }
                else { m_role = BOT_ROLE_DPS_RANGED; }
            }
            else //I am both healer and tank?? Hmm
            {
                if ((ai->GetHealthPercent() <= 70 || masterHP <70 ) && (ai->GetManaPercent() >= 50)) { m_role = BOT_ROLE_SUPPORT; }
                else if (OwnPartyHP < 20 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
                else if (ai->GetManaPercent() < 15 ) { m_role = BOT_ROLE_TANK; }
                else { m_role = BOT_ROLE_DPS_RANGED; }
            }
        }
    }
    else if (isUnderAttack() && !( ai->GetForm() == FORM_MOONKIN || ai->GetForm() == FORM_TREE)  ) // if i am under attack
    {
        // Keep being in Cat Form if you can reduce threat
        if (ai->GetForm() == FORM_CAT && CastSpell(COWER,pTarget)) {return; }
        else if (TALENT_RESTO && ai->GetManaPercent() > 10 ) { m_role = BOT_ROLE_SUPPORT; }
        else { m_role = BOT_ROLE_OFFTANK; }
    }
    else if (TALENT_FERAL && CAT_FORM) { // If has any feral forms at all
        if ((ai->GetHealthPercent() <= 40 || masterHP <40 ) && (ai->GetManaPercent() >= 40)) { m_role = BOT_ROLE_SUPPORT; }
        else if (OwnPartyHP < 30 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
        else{ m_role = BOT_ROLE_DPS_MELEE; }
    }
    else if (TALENT_BALANCE) {
        if ((ai->GetHealthPercent() <= 50 || masterHP <40 ) && (ai->GetManaPercent() >= 10)) { m_role = BOT_ROLE_SUPPORT; }
        else if (OwnPartyHP < 40 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; }
        else { m_role = BOT_ROLE_DPS_RANGED; }
    }
    else if (TALENT_RESTO)    { m_role = BOT_ROLE_SUPPORT; }
    else
    {
        // Unknown build or low level : Do not change forms rapidly..
        if ( (ai->GetManaPercent() < 30 && BEAR_FORM) || ( (ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR) && ai->GetManaPercent() < 70 )  ) m_role = BOT_ROLE_DPS_MELEE;
        else { m_role = BOT_ROLE_DPS_RANGED; }
    }

    if (!isUnderAttack() && m_tank->GetGUID() != m_bot->GetGUID())
    {
        // Select Attacking target
        if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && pDist <= 2) {} //if my target is attacking me continue
        else
        {
            Unit *curAtt = GetNearestAttackerOf(m_bot);
            if (curAtt && curAtt->GetGUID() != pTarget->GetGUID())
            {
                m_bot->SetSelection(curAtt->GetGUID());
                //ai->AddLootGUID(curAtt->GetGUID());
                DoNextCombatManeuver(curAtt); //Restart new update to get variables fixed..
                return;
            }
        }
        //my target is attacking me
    }
    #pragma endregion

    // If there's a cast stop
    if (m_bot->HasUnitState(UNIT_STAT_CASTING)) return;
    // Return to normal form from non combat forms
    if (ai->GetForm() == FORM_NONE || ai->GetForm() == FORM_CAT || ai->GetForm() == FORM_TREE || ai->GetForm() == FORM_MOONKIN || ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR )  { } //Those are valid incombat auras
    else if (ai->GetForm() != FORM_NONE && ChangeForm(1)) { } //return to caster form

    switch(m_role)
    {
        #pragma region BOT_ROLE_DPS_MELEE
        case BOT_ROLE_DPS_MELEE:
            //ai->TellMaster("DruidCombat");

            // Do caster form stuff
            if (ai->GetForm() == FORM_NONE)
            {
                //We have little mana probably cant change form
                if (ai->GetManaPercent() < 20 && CastSpell (INNERVATE, m_bot) ) { return; }
                else if(m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) {  return;}
                else if(DoSupportRaid(GetMaster(),false,false,false)) return;
                else if(m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot,false,false,false)) { return; }
            }

            if (CAT_FORM) { if (ChangeForm(CAT_FORM)) { return; } }
            else if (BEAR_FORM) { if (ChangeForm(BEAR_FORM)) { return; } }
            else if (ai->GetForm() != FORM_NONE && ChangeForm(1)) {  } //Normal Form

            TakePosition(pTarget);
            break;
        #pragma endregion

        #pragma region BOT_ROLE_TANK / BOT_ROLE_OFFTANK
        case BOT_ROLE_OFFTANK:
        case BOT_ROLE_TANK: // It is a tank druid or a defending druid

            // Do what you must before getting attacked...
            if (ai->GetForm() == FORM_NONE)
            {
                // Non tank stuff to avoid
                if (m_tank->GetGUID() != m_bot->GetGUID())
                {
                    if (ROOTS && !pTarget->HasAura(CYCLONE) && !pTarget->HasAura(HIBERNATE) && CastSpell(ROOTS, pTarget)) { return; }
                    if (CYCLONE && pDist > 5 && !pTarget->HasAura(ROOTS) && !pTarget->HasAura(HIBERNATE) && CastSpell(CYCLONE, pTarget)) { return; }
                    if (HIBERNATE && pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_BEAST && !pTarget->HasAura(ROOTS) && !pTarget->HasAura(CYCLONE) && CastSpell(HIBERNATE, pTarget)) { return; }
                    //if (m_bot->getRace() == (uint8) RACE_NIGHTELF && isUnderAttack() && CastSpell(R_SHADOWMELD, m_bot)) { return; }
                }
                // Things to do wheter Tank or not
                if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; } //no gcd
                if (ai->GetManaPercent() < 20 && CastSpell (INNERVATE, m_bot) ) { return; } //We have little mana probably cant change form
            }
            TakePosition(pTarget);

            if (ChangeForm(BEAR_FORM)) { return; }

            // if i am main tank, protect master by taunt
            if(m_tank->GetGUID() == m_bot->GetGUID())
            {
                // Taunt if needed (Only for master)
                Unit *curAtt = GetAttackerOf(GetMaster());
                if (curAtt)
                {
                    if (isUnderAttack(GetMaster(),2) && CastSpell(CHALLENGING_ROAR, curAtt)) { return; }
                    if (CastSpell(GROWL, curAtt))  { return; }
                }
                // My target is not attacking me, taunt..
                if (pVictim && pVictim->GetGUID() != m_bot->GetGUID() && CastSpell(GROWL, pTarget) )  { return; }
            }
            break;
        #pragma endregion

        #pragma region BOT_ROLE_DPS_RANGED
        case BOT_ROLE_DPS_RANGED:
            if ( ai->GetManaPercent() < 20 && CastSpell (INNERVATE, m_bot)) { return; }

            // Do caster form stuff
            if (ai->GetForm() == FORM_NONE)
            {
                if(DoSupportRaid(GetMaster())) return;
                else if(m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot)) { return; }
            }

            if (MOONKIN_FORM) { if (ChangeForm(MOONKIN_FORM)) { return; } }
            else if (ai->GetForm() != FORM_NONE && ChangeForm(1)) { } //Normal Form

            TakePosition(pTarget);

            // BUFF UP
            if(DoSupportRaid(GetMaster(),false,false,false)) return;
            else if(m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot,false,false,false)) { return; }

            break;
        #pragma endregion

        #pragma region BOT_ROLE_SUPPORT
        case BOT_ROLE_SUPPORT:
            if ( ai->GetManaPercent() < 20 && CastSpell (INNERVATE,m_bot)) { return; }
            //Get to tree form only if you will no longer cast attack spells
            if( TREE_OF_LIFE_FORM && (ai->GetManaPercent() < offensiveSpellThreshold || isUnderAttack()) )
            {
                 if (ChangeForm(TREE_OF_LIFE_FORM)) { return; }
            }
            else if (ai->GetForm() != FORM_NONE && ChangeForm(1)) { }  //Normal Form no gcd

            TakePosition(pTarget);

            //RezGroup(REBIRTH, GetMaster());
            if (DoSupportRaid(GetMaster())) { return; }
            if (m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot)) { return; }
            //heal pets and bots
            Unit *target = DoSelectLowestHpFriendly(30, 1000);
            if(target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth()) ) { return; }

            break;
        #pragma endregion
    }

    #pragma region DruidCommon
    // Common Dps and protection routine
    if (ai->GetHealthPercent() <= 70 && CastSpell(BARKSKIN,m_bot)) { return; }
    if (isUnderAttack() && CastSpell(NATURES_GRASP,m_bot)) { return; }

    if (ai->GetForm() == FORM_CAT)
    {
        // If at threat limit, use Cower to reduce threat
        if (pThreat > threatThreshold && m_tank->GetGUID() != m_bot->GetGUID() && !isUnderAttack())
        {
            if (m_tank->getVictim() && m_tank->getVictim()->GetGUID() != pTarget->GetGUID()) // I am attacking wrong target!!
            {
                m_bot->SetSelection(m_tank->getVictim()->GetGUID());
                return;
            }
            else
            {
                if (CastSpell(COWER,pTarget)) { return; } //Lets see if we can manage
                else { return; } //use no spells and wait threat to be reduced
            }
        }
        if (CastSpell(FERAL_CHARGE_CAT,pTarget)) { return; }
        if (m_bot->GetComboPoints() >= 1 && pTarget->IsNonMeleeSpellCasted(true) && CastSpell(MAIM, pTarget)) { return; }

        if (CastSpell(BERSERK, m_bot)) { return; }
        if (ai->GetHealthPercent() <= 75 && CastSpell(SURVIVAL_INSTINCTS, m_bot)) { return; }
        if (isUnderAttack() && CastSpell(NATURES_GRASP, m_bot)) { return; }
        if (CastSpell(FAERIE_FIRE_FERAL, pTarget)) { return; }

        if (m_bot->GetComboPoints() < 5)
        {
            if (CastSpell(RAKE, pTarget)) { return; }
            if (CastSpell(MANGLE_CAT, pTarget)) { return; }
            if (!pTarget->HasInArc(M_PI,m_bot) && CastSpell(SHRED, pTarget)) { return; }
            if (ai->GetEnergyAmount() > 65 && CastSpell(MANGLE_CAT, pTarget)) { return; } //Spam mangle if cannot cast shred
            if (ai->GetEnergyAmount() > 65 && CastSpell(CLAW, pTarget) ) { return; } //Spam Claw if there is no mangle
            // if (CanCast(COWER, pTarget) && CastSpell(COWER, pTarget)) { return; } //if still nothing, use COWER to reduce threat
        }
        else
        {
            if (CastSpell(SAVAGE_ROAR)) { return; }
            if (CastSpell(RIP, pTarget)) { return; }
            if (ai->GetEnergyAmount() >= 65 && CastSpell(FEROCIOUS_BITE, pTarget)) { return; } //maxhit for feracious bite
        }
        if (CastSpell(TIGERS_FURY, m_bot)) { return; } //if nothing is ready yet, use tigers fury
    }
    else if (ai->GetForm() == FORM_DIREBEAR || ai->GetForm() == FORM_BEAR)
    {
        // If at threat limit, stop
        if (pThreat > threatThreshold && m_tank->GetGUID() != m_bot->GetGUID() && !isUnderAttack() )
        {
            //Change to tank's target
            if (m_tank->getVictim() && m_tank->getVictim()->GetGUID() != pTarget->GetGUID()) { m_bot->SetSelection(m_tank->getVictim()->GetGUID()); }
            return; //use no spells and wait threat to be reduced
        }
        if (CastSpell(FERAL_CHARGE_BEAR,pTarget)) { return; }
        if (CastSpell(BASH, pTarget,true,true)) { return; } //Need check for immunity
        if (CastSpell(BERSERK, m_bot)) { return; }
        if (CastSpell(DEMORALIZING_ROAR, pTarget)) { return; }
        if (ai->GetHealthPercent() > 90 && ai->GetRageAmount() < 50 && CastSpell(ENRAGE, m_bot)) { return; }
        if (ai->GetHealthPercent() <= 75 && CastSpell(SURVIVAL_INSTINCTS, m_bot)) { return; }
        if ( ( ai->GetHealthPercent() <= 30 || (ai->GetHealthPercent() < 85 && m_tank->GetGUID() != m_bot->GetGUID())  )
            && CastSpell(FRENZIED_REGENERATION)) { return; }
        if (CastSpell(FAERIE_FIRE_FERAL, pTarget)) { return; }
        if (CastSpell(MANGLE_BEAR, pTarget)) { return; }
        if ((ai->GetRageAmount() > 70 || m_tank->GetGUID() == m_bot->GetGUID()) && CastSpell(SWIPE_BEAR, pTarget)) { return; }
        if (ai->GetRageAmount() > 50 && CastSpell(MAUL, pTarget)) {} // Low Priority, Next Attack effect
        if (ai->GetRageAmount() > 60 && CastSpell(LACERATE, pTarget)) { return; } //Currently applies only 1
    }
    else
    {
        //Defensive stuff
        if (m_tank->GetGUID() != m_bot->GetGUID() && pVictim && pVictim->GetGUID() == m_bot->GetGUID() )
        {
            if (ROOTS && !pTarget->HasAura(CYCLONE) && !pTarget->HasAura(HIBERNATE) && CastSpell(ROOTS, pTarget)) { return; }
            if (CYCLONE && pDist > 5 && !pTarget->HasAura(ROOTS) && !pTarget->HasAura(HIBERNATE) && CastSpell(CYCLONE, pTarget)) { return; }
            if (HIBERNATE && pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_BEAST && !pTarget->HasAura(ROOTS) && !pTarget->HasAura(CYCLONE) && CastSpell(HIBERNATE, pTarget)) { return; }
            //if (m_bot->getRace() == (uint8) RACE_NIGHTELF && isUnderAttack() && CastSpell(R_SHADOWMELD, m_bot)) { return; }
            if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; }
        }

        if (CastSpell(FAERIE_FIRE, pTarget)) { return; }

        // If at threat limit, stop
        if (pThreat > threatThreshold && m_tank->GetGUID() != m_bot->GetGUID() && !isUnderAttack() )
        {
            //Change to tank's target
            if (m_tank->getVictim() && m_tank->getVictim()->GetGUID() != pTarget->GetGUID()) { m_bot->SetSelection(m_tank->getVictim()->GetGUID()); }
            return; //use no spells and wait threat to be reduced
        }
        // Continue attacking if theres excess mana (for healers)
        if (m_role == BOT_ROLE_SUPPORT && ai->GetManaPercent() < offensiveSpellThreshold) { return; }
        if (m_role != BOT_ROLE_SUPPORT && CastSpell(NATURES_SWIFTNESS, m_bot)) { } //only balance no gcd

        if (m_bot->HasAura(NATURES_SWIFTNESS) && CastSpell(STARFIRE, pTarget)) { return; }
        if (CastSpell(INSECT_SWARM, pTarget)) { return; }
        if (CastSpell(TYPHOON, pTarget)) { return; }
        if (isUnderAttack(m_tank,4) && CastSpell(HURRICANE, pTarget)) { ai->SetIgnoreUpdateTime(8); return; }
        if (isUnderAttack(m_tank,5) && CastSpell(FORCE_OF_NATURE, m_bot)) { return; }
        if (isUnderAttack(m_tank,4) && CastSpell(STARFALL, pTarget)) { return; }
        if (CastSpell(MOONFIRE, pTarget)) { return; }
        if (CastSpell(WRATH, pTarget)) { return; }
        if (CastSpell(STARFIRE, pTarget)) { return; }
    }

    // If there is nothing else to do buff UP
    if (m_role == BOT_ROLE_DPS_MELEE) //Those already healed and buffed or should never buff in combat
    {
        if (DoSupportRaid(GetMaster(),false,false,false)) { return; }
        if (m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup() && DoSupportRaid(m_bot,false,false,false)) { return; }
    }


    // drink potion if support / healer (Other builds simply overuse mana and waste mana pots)
    if(ai->GetManaPercent() < 5 && (m_role == BOT_ROLE_SUPPORT || m_role == BOT_ROLE_HEALER) )
    {
        Item *pItem = ai->FindPotion();
        if(pItem != NULL)
        {
            if (pItem->GetSpell() && m_bot->HasSpellCooldown(pItem->GetSpell()) ) { return; } //pot is in cooldown
            ai->UseItem(*pItem);
        }
    }
    #pragma endregion
} //end DoNextCombatManeuver
コード例 #5
0
ファイル: PlayerbotRogueAI.cpp プロジェクト: Mferrill/BotCore
void PlayerbotRogueAI::DoNextCombatManeuver(Unit *pTarget)
{
    if (!pTarget || pTarget->isDead()) return;
    PlayerbotAI *ai = GetAI();
    if (!ai) return;
    Player *m_bot = GetPlayerBot();
    if (!m_bot || m_bot->isDead()) return;
    Unit *pVictim = pTarget->getVictim();
    Unit *m_tank = FindMainTankInRaid(GetMaster());
    if (!m_tank && m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup()) { FindMainTankInRaid(m_bot); }
    if (!m_tank) { m_tank = m_bot; }
    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
    float pDist = m_bot->GetDistance(pTarget);
    uint8 pThreat = GetThreatPercent(pTarget);

    #pragma region Choose Target
    // Choose actions accoring to talents (ROGUE is always MELEE DPS)
    m_role = BOT_ROLE_DPS_MELEE;
    // if i am under attack and if i am not tank or offtank: change target if needed
    if (m_tank->GetGUID() != m_bot->GetGUID() && isUnderAttack() ) 
    {
        // Keep hitting but reduce threat
        if (CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }
        else if (CastSpell(VANISH,m_bot)) { return; }
        else //I cannot reduce threat so
        {
            if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && pDist <= 2) {  } // My target is almost up to me, no need to search
            else //Have to select nearest target
            {
                Unit *curAtt = GetNearestAttackerOf(m_bot);
                if (curAtt && curAtt->GetGUID() != pTarget->GetGUID())
                {
                    m_bot->SetSelection(curAtt->GetGUID());
                    DoNextCombatManeuver(curAtt); //Restart new update to get variables fixed..               
                    //return; 
                }
            }
            //my target is attacking me
        }
    }
    #pragma endregion

    // wait until we actually reach our target b4 we actually do anything
    if (m_bot->GetDistance(pTarget)>10.0 && 
        !m_bot->HasAura(STEALTH) &&
        !m_bot->isInCombat() && CastSpell(STEALTH)) 
    { return; }

    TakePosition(pTarget);

    // If there's a cast stop
    if (m_bot->hasUnitState(UNIT_STAT_CASTING)) { return; }

    // wait until we actually reach our target b4 we actually do anything
    /*if (GetPlayerBot()->GetDistance(pTarget)>10.0 && 
        !HasAuraName(GetPlayerBot(),STEALTH) &&
        !GetPlayerBot()->isInCombat() && CastSpell(STEALTH)) 
    { return; }*/

    //Buff
    if (CastSpell(PREMEDITATION,m_bot)) { return; }
    if (CastSpell(COLD_BLOOD,m_bot)) { } //no gcd

    //PROTECT UP
    if (m_tank->GetGUID() != m_bot->GetGUID() && pVictim && pVictim->GetGUID() == m_bot->GetGUID() )
    {
        if (CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }
        if (CastSpell(FEINT,m_bot)) { return; }
        if (CastSpell(VANISH,m_bot)) { return; }
    }
    if (isUnderAttack() && pDist <= MELEE_RANGE && ai->GetHealthPercent() <= 85 && CastSpell(EVASION, m_bot)) { } //no GCD
    if (ai->GetHealthPercent() <= 55 && CastSpell(CLOAK_OF_SHADOWS, m_bot)) { return; }
    if (isUnderAttack() && ai->GetHealthPercent() <= 65 && CastSpell(GOUGE, m_bot)) { return; }
    if (isUnderAttack() && ai->GetHealthPercent() <= 45 && CastSpell(BLIND, m_bot)) { return; }
    if (m_bot->getRace() == (uint8) RACE_DWARF && ai->GetHealthPercent() < 75 && CastSpell(R_STONEFORM,m_bot)) { } //no gcd

    //Break spells
    if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && (pTarget->IsNonMeleeSpellCasted(true) || ai->GetManaPercent() < 40) && CastSpell(R_ARCANE_TORRENT, pTarget)) { } //no gcd
    else if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(KICK, pTarget)) { return; }
    else if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(GOUGE, pTarget)) { return; }
    else if (pTarget->IsNonMeleeSpellCasted(true) && m_bot->GetComboPoints() >= 1 && CastSpell(KIDNEY_SHOT, pTarget)) { return; }

    //Transfer threat
    if (m_tank->GetGUID() != m_bot->GetGUID() && CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }
	if (m_bot->getRace() == (uint8) RACE_TROLL && CastSpell(R_BERSERKING,m_bot)) {} //no GCD
    if (m_bot->getRace() == (uint8) RACE_ORC && CastSpell(R_BLOOD_FURY,m_bot)) {} //no GCD

    // sometimes we lose attack
    if (!m_bot->isInCombat()) {
        m_bot->Attack(pTarget, true); 
    }

	if(TALENT_ASSASSINATION)
	{
		if (!m_bot->HasAura(HUNGER_FOR_BLOOD) && CastSpell(HUNGER_FOR_BLOOD,m_bot)) { return; }
		if (m_bot->GetComboPoints() < 5)
		{
		    if (CastSpell(MUTILATE, pTarget)) { return; }
		}
		else
		{
			if (!pTarget->HasAura(RUPTURE) && CastSpell(RUPTURE)) { return; }
			
		}
	}
	
    if(TALENT_COMBAT)
	{        
		if (CastSpell(BLADE_FLURRY,m_bot)) { return; }
		if (ai->GetEnergyAmount() < 20 && CastSpell(ADRENALINE_RUSH,m_bot)) { return; }
		if (!CastSpell(ADRENALINE_RUSH) && CastSpell(KILLING_SPREE,m_bot,1,0,1)) { return; }
		if (m_bot->GetComboPoints() > 5)
		{
			if (!pTarget->HasAura(RUPTURE) && CastSpell(RUPTURE)) { return; }
		}
	}
	
    if(TALENT_SUBTELTY)
	{	
		if (CastSpell(PREMEDITATION,m_bot)) {}
		if (CastSpell(SHADOW_DANCE,m_bot)) {}
		if (!CastSpell(SHADOW_DANCE,m_bot) && CastSpell(PREPARATION,m_bot)) { return; }
		if (m_bot->GetComboPoints() < 5)
		{
			if (m_bot->HasAura(SHADOW_DANCE) && !pTarget->HasInArc(M_PI,m_bot)) { if (CastSpell(AMBUSH, pTarget)) { return; } }		
            if (CastSpell(GHOSTLY_STRIKE, pTarget)) { return; }
		}
		else
		{
			if (!pTarget->HasAura(RUPTURE) && CastSpell(RUPTURE)) { return; }
			if (!m_bot->HasAura(SLICE_AND_DICE) && CastSpell(SLICE_AND_DICE)) { return; }
			if (CastSpell(SHADOWSTEP,pTarget)) { }
		}
	}

    // defaults if not high enough do specialized attacks
    if (m_bot->GetComboPoints() < 5) {
        if (!pTarget->HasInArc(M_PI,m_bot)) { if (CastSpell(BACKSTAB, pTarget)) { return; } }
        if (!MUTILATE &&CastSpell(SINISTER_STRIKE,pTarget)) { return; } // Dont cast if we have mutilate, save energy for it
    } else {
        if (!m_bot->HasAura(SLICE_AND_DICE) && CastSpell(SLICE_AND_DICE)) {  return; }		
		if (CastSpell(ENVENOM,pTarget)) { return; }
        if (CastSpell(EVISCERATE,pTarget)) { return; }
    }
} //end DoNextCombatManeuver
コード例 #6
0
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI *ai = GetAI();
    if (!ai)
        return;

    Player * m_bot = GetPlayerBot();
    if (!m_bot)
        return;

    Player* m_master = ai->GetLeader();
    if (!m_master)
        return;

    uint32 masterHP = m_master->GetHealth() * 100 / m_master->GetMaxHealth();

    ai->SetInFront(pTarget);
    Unit* pVictim = pTarget->getVictim();

    if (pVictim && ai->GetHealthPercent() >= 40 && m_master->GetHealth() >= m_master->GetMaxHealth() * 0.4)
    {
        if (pVictim == m_bot)
            SpellSequence = DruidTank;
    }
    else if (pTarget->GetHealth() > pTarget->GetMaxHealth() * 0.8 && pVictim)
    {
        if (pVictim != m_bot)
            SpellSequence = DruidSpell;
    }
    else if (ai->GetHealthPercent() <= 40 || m_master->GetHealth() <= m_master->GetMaxHealth() * 0.4)
        SpellSequence = DruidHeal;
    else
        SpellSequence = DruidCombat;

    switch (SpellSequence)
    {
        case DruidTank: // Its now a tank druid!
            if (!m_bot->HasInArc(M_PI_F, pTarget))
            {
                m_bot->SetInFront(pTarget);
            }
            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(768);
            if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                ai->CastSpell (MOONKIN_FORM);
            else if (DIRE_BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                ai->CastSpell (DIRE_BEAR_FORM);
            else if (BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                ai->CastSpell (BEAR_FORM);
            else if (DEMORALIZING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !pTarget->HasAura(DEMORALIZING_ROAR, EFFECT_INDEX_0) && ai->GetRageAmount() >= 10)
                ai->CastSpell(DEMORALIZING_ROAR, pTarget);
            if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
            {
                ai->CastSpell(FAERIE_FIRE, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (MOONFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell(MOONFIRE, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (ROOTS > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(ROOTS, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (HURRICANE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
            {
                ai->CastSpell(HURRICANE, pTarget);
                ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                break;
            }
            else if (WRATH > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(WRATH, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (INSECT_SWARM > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(INSECT_SWARM, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (STARFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(STARFIRE, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (FORCE_OF_NATURE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
            {
                ai->CastSpell(FORCE_OF_NATURE);
                DruidSpellCombat++;
                break;
            }
            else if (STARFALL > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && !m_bot->HasAura(STARFALL, EFFECT_INDEX_0) && DruidSpellCombat < 9 && ai->GetManaPercent() >= 39)
            {
                ai->CastSpell(STARFALL, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (BARKSKIN > 0 && pVictim == m_bot && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetHealthPercent() < 75 && DruidSpellCombat < 10 && !m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
            {
                ai->CastSpell(BARKSKIN, m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (INNERVATE > 0 && m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0) && ai->GetManaPercent() < 50 && DruidSpellCombat < 11 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
            {
                ai->CastSpell(INNERVATE, m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (ENRAGE > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && DruidSpellCombat < 2 && !m_bot->HasAura(ENRAGE, EFFECT_INDEX_0))
            {
                ai->CastSpell(ENRAGE, m_bot);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (SWIPE > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && DruidSpellCombat < 4 && ai->GetRageAmount() >= 20)
            {
                ai->CastSpell(SWIPE, pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (MAUL > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && DruidSpellCombat < 6 && ai->GetRageAmount() >= 15)
            {
                ai->CastSpell(MAUL, pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (BASH > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && !pTarget->HasAura(BASH, EFFECT_INDEX_0) && DruidSpellCombat < 8 && ai->GetRageAmount() >= 10)
            {
                ai->CastSpell(BASH, pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (CHALLENGING_ROAR > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && pVictim != m_bot && DruidSpellCombat < 10 && !pTarget->HasAura(CHALLENGING_ROAR, EFFECT_INDEX_0) && !pTarget->HasAura(GROWL, EFFECT_INDEX_0) && ai->GetRageAmount() >= 15)
            {
                ai->CastSpell(CHALLENGING_ROAR, pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (GROWL > 0 && (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0) || m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) && pVictim != m_bot && DruidSpellCombat < 12 && !pTarget->HasAura(CHALLENGING_ROAR, EFFECT_INDEX_0) && !pTarget->HasAura(GROWL, EFFECT_INDEX_0))
            {
                ai->CastSpell(GROWL, pTarget);
                DruidSpellCombat = DruidSpellCombat + 2;
                break;
            }
            else if (DruidSpellCombat > 13)
            {
                DruidSpellCombat = 0;
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidSpell:
            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(768);

                break;
            }
            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(5487);

                break;
            }
            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(9634);

                break;
            }
            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(24858);

                break;
            }
            if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(FAERIE_FIRE, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (MOONFIRE > 0 && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell(MOONFIRE, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (ROOTS > 0 && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(ROOTS, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (HURRICANE > 0 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
            {

                ai->CastSpell(HURRICANE, pTarget);
                ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                break;
            }
            else if (WRATH > 0 && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(WRATH, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (INSECT_SWARM > 0 && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(INSECT_SWARM, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (STARFIRE > 0 && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(STARFIRE, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (FORCE_OF_NATURE > 0 && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
            {

                ai->CastSpell(FORCE_OF_NATURE);
                DruidSpellCombat++;
                break;
            }
            else if (STARFALL > 0 && !m_bot->HasAura(STARFALL, EFFECT_INDEX_0) && DruidSpellCombat < 9 && ai->GetManaPercent() >= 39)
            {
                ai->CastSpell(STARFALL, pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (BARKSKIN > 0 && pVictim == m_bot && ai->GetHealthPercent() < 75 && DruidSpellCombat < 10 && !m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
            {
                ai->CastSpell(BARKSKIN, m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (INNERVATE > 0 && ai->GetManaPercent() < 50 && DruidSpellCombat < 11 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
            {
                ai->CastSpell(INNERVATE, m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (DruidSpellCombat > 13)
            {
                DruidSpellCombat = 0;
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidHeal:

            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(768);

                break;
            }
            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(5487);

                break;
            }
            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(9634);

                break;
            }
            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(24858);

                break;
            }
            if (ai->GetHealthPercent() <= 40)
            {
                HealTarget (m_bot);
                break;
            }
            if (masterHP <= 40)
            {
                HealTarget (m_master);
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidCombat:

            if (!m_bot->HasInArc(M_PI_F, pTarget))
            {
                m_bot->SetInFront(pTarget);
            }
            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(5487);

                break;
            }
            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(9634);

                break;
            }
            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
            {
                m_bot->RemoveAurasDueToSpell(24858);

                break;
            }
            if (CAT_FORM > 0 && !m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                ai->CastSpell (CAT_FORM);
/*
            if (COWER > 0 && m_bot->GetComboPoints() == 1 && ai->GetEnergyAmount() >= 20)
            {
                ai->CastSpell(COWER);

            }*/
            if (MAIM > 0 && m_bot->GetComboPoints() >= 1 && pTarget->IsNonMeleeSpellCasted(true))
            {
                ai->CastSpell(MAIM, pTarget);

                break;
            }

            if (RAKE > 0 && m_bot->GetComboPoints() <= 1 && ai->GetEnergyAmount() >= 40)
            {
                ai->CastSpell (RAKE, pTarget);

                break;
            }
            else if (CLAW > 0 && m_bot->GetComboPoints() <= 2 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (CLAW, pTarget);

                break;
            }
            else if (MANGLE > 0 && m_bot->GetComboPoints() <= 3 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (MANGLE, pTarget);

                break;
            }
            else if (CLAW > 0 && m_bot->GetComboPoints() <= 4 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (CLAW, pTarget);

                break;
            }

            if (m_bot->GetComboPoints() == 5)
            {
                if (RIP > 0 && pTarget->getClass() == CLASS_ROGUE && ai->GetEnergyAmount() >= 30)
                    ai->CastSpell(RIP, pTarget);

                else if (MAIM > 0 && pTarget->getClass() == CLASS_DRUID && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, pTarget);

                else if (MAIM > 0 && pTarget->getClass() == CLASS_SHAMAN && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, pTarget);

                else if (MAIM > 0 && pTarget->getClass() == CLASS_WARLOCK && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, pTarget);

                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_HUNTER && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(FEROCIOUS_BITE, pTarget);

                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_WARRIOR && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(FEROCIOUS_BITE, pTarget);

                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_PALADIN && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(FEROCIOUS_BITE, pTarget);

                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_DEATH_KNIGHT && ai->GetEnergyAmount() >= 25)
                    ai->CastSpell(FEROCIOUS_BITE, pTarget);

                else if (MAIM > 0 && pTarget->getClass() == CLASS_MAGE && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, pTarget);

                else if (MAIM > 0 && pTarget->getClass() == CLASS_PRIEST && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, pTarget);

                else if (MAIM > 0 && ai->GetEnergyAmount() >= 35)
                    ai->CastSpell(MAIM, pTarget);

                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;
    }
} // end DoNextCombatManeuver
コード例 #7
0
ファイル: PlayerbotRogueAI.cpp プロジェクト: Rhyuk/Dev
void PlayerbotRogueAI::DoNextCombatManeuver(Unit *pTarget)
{
    if (!pTarget || pTarget->isDead()) return;
    PlayerbotAI *ai = GetAI();
    if (!ai) return;
    Player *m_bot = GetPlayerBot();
    if (!m_bot || m_bot->isDead()) return;
    Unit *pVictim = pTarget->getVictim();
    Unit *m_tank = FindMainTankInRaid(GetMaster());
    if (!m_tank && m_bot->GetGroup() && GetMaster()->GetGroup() != m_bot->GetGroup()) { FindMainTankInRaid(m_bot); }
    if (!m_tank) { m_tank = m_bot; }
    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();
    float pDist = m_bot->GetDistance(pTarget);
    uint8 pThreat = GetThreatPercent(pTarget);

    /*switch (ai->GetScenarioType()) {
        case SCENARIO_DUEL: 
            ((CastSpell(BACKSTAB)) ||
            (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(KICK)) ||
            ((GetPlayerBot()->GetComboPoints()==5) && CastSpell(SLICE_DICE)) ||
            (CastSpell(SINISTER_STRIKE)));
            return;
    }*/
    #pragma region Choose Target
    // Choose actions accoring to talents (ROGUE is always MELEE DPS)
    m_role = BOT_ROLE_DPS_MELEE;

    // if i am under attack and if i am not tank or offtank: change target if needed
    if (m_tank->GetGUID() != m_bot->GetGUID() && isUnderAttack() ) 
    {
        // Keep hitting but reduce threat
        if (CastSpell(FEINT,m_bot)) { return; }
        else if (CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }
        else if (CastSpell(VANISH,m_bot)) { return; }
        //else if (m_bot->getRace() == (uint8) RACE_NIGHTELF && CastSpell(R_SHADOWMELD,m_bot)) { return; }
        else //I cannot reduce threat so
        {
            if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && pDist <= 2) {  } // My target is almost up to me, no need to search
            else //Have to select nearest target
            {
                Unit *curAtt = GetNearestAttackerOf(m_bot);
                if (curAtt && curAtt->GetGUID() != pTarget->GetGUID())
                {
                    m_bot->SetSelection(curAtt->GetGUID());
                    //ai->AddLootGUID(curAtt->GetGUID());
                    DoNextCombatManeuver(curAtt); //Restart new update to get variables fixed..
                    return; 
                }
            }
            //my target is attacking me
        }
    }
    #pragma endregion

    // wait until we actually reach our target b4 we actually do anything
    /*if (m_bot->GetDistance(pTarget)>10.0 && 
        !m_bot->HasAura(STEALTH) &&
        !m_bot->isInCombat() && CastSpell(STEALTH)) 
    { return; }*/

    TakePosition(pTarget);

    // If there's a cast stop
    if (m_bot->hasUnitState(UNIT_STAT_CASTING)) { return; }

    // wait until we actually reach our target b4 we actually do anything
    if (GetPlayerBot()->GetDistance(pTarget)>10.0 && 
        !HasAuraName(GetPlayerBot(),STEALTH) &&
        !GetPlayerBot()->isInCombat() && CastSpell(STEALTH)) 
    { return; }

    //Buff
    if (CastSpell(PREMEDITATION,m_bot)) { return; }

    //PROTECT UP
    if (m_tank->GetGUID() != m_bot->GetGUID() && pVictim && pVictim->GetGUID() == m_bot->GetGUID() )
    {
        if (CastSpell(FEINT,m_bot)) { return; }
        if (CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }
        if (CastSpell(VANISH,m_bot)) { return; }
    }
    if (isUnderAttack() && pDist <= MELEE_RANGE && ai->GetHealthPercent() <= 85 && CastSpell(EVASION, m_bot)) { } //no GCD
    if (ai->GetHealthPercent() <= 55 && CastSpell(CLOAK_OF_SHADOWS, m_bot)) { return; }
    if (isUnderAttack() && ai->GetHealthPercent() <= 65 && CastSpell(GOUGE, m_bot)) { return; }
    if (isUnderAttack() && ai->GetHealthPercent() <= 45 && CastSpell(BLIND, m_bot)) { return; }
    if (m_bot->getRace() == (uint8) RACE_DWARF && ai->GetHealthPercent() < 75 && CastSpell(R_STONEFORM,m_bot)) { } //no gcd
    if (m_bot->getRace() == (uint8) RACE_DRAENEI && ai->GetHealthPercent() < 55 && CastSpell(R_GIFT_OF_NAARU,m_bot)) { return; } //no Gcd, but has cast
    if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; } //no gcd but is cast

    //Break spells
    if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && (pTarget->IsNonMeleeSpellCasted(true) || ai->GetManaPercent() < 40) && CastSpell(R_ARCANE_TORRENT, pTarget)) { } //no gcd
    else if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(KICK, pTarget)) { return; }
    else if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(GOUGE, pTarget)) { return; }
    else if (pTarget->IsNonMeleeSpellCasted(true) && m_bot->GetComboPoints() >= 1 && CastSpell(KIDNEY_SHOT, pTarget)) { return; }

    // If at threat limit, try to reduce threat
    if (pThreat > threatThreshold && m_tank->GetGUID() != m_bot->GetGUID() && !isUnderAttack())
    {
        if (m_tank->getVictim() && m_tank->getVictim()->GetGUID() != pTarget->GetGUID()) // I am attacking wrong target!!
        {
            m_bot->SetSelection(m_tank->getVictim()->GetGUID());
            return;
        }
        else  
        {
            if (CastSpell(FEINT,m_bot)) { return; } //Lets see if we can manage
            else if (CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }
            else { return; } //use no spells and wait threat to be reduced
        }
    }

    //Transfer threat
    if (m_tank->GetGUID() != m_bot->GetGUID() && CastSpell(TRICKS_OF_THE_TRADE,m_tank)) { return; }

    //Urgent DPS
    if ((m_bot->HasAura(STEALTH) || m_bot->HasAura(VANISH))&& CastSpell(CHEAP_SHOT,pTarget)) { return; }

    //DPS UP
    if (m_bot->getRace() == (uint8) RACE_TROLL && CastSpell(R_BERSERKING,m_bot)) {} //no GCD
    if (m_bot->getRace() == (uint8) RACE_ORC && CastSpell(R_BLOOD_FURY,m_bot)) {} //no GCD
    if (CastSpell(COLD_BLOOD,m_bot)) { } //no gcd
    if (CastSpell(HUNGER_FOR_BLOOD,m_bot)) { return; }
    if (CastSpell(BLADE_FLURRY,m_bot)) { return; }
    if (ai->GetEnergyAmount() < 20 && CastSpell(ADRENALINE_RUSH,m_bot)) { return; }
    if (CastSpell(SHADOW_DANCE,m_bot)) { return; }
    if (CastSpell(DISMANTLE,pTarget)) { return; }
    if (CastSpell(PREPARATION,m_bot)) { return; }


    if (m_bot->GetComboPoints() < 5)
    {
        if (CastSpell(RIPOSTE,pTarget)) { return; }
        if (CastSpell(KILLING_SPREE,m_bot,1,0,1)) { return; } // KILLING SPREE works great on 1 mob
        if (isUnderAttack(m_tank,3) && CastSpell(FAN_OF_KNIVES,pTarget)) { return; }
        if (BACKSTAB && !pTarget->HasInArc(M_PI,m_bot)) { if (CastSpell(BACKSTAB, pTarget)) { return; } }
        else if (CastSpell(MUTILATE, pTarget)) { return; }
        if (CastSpell(SINISTER_STRIKE,pTarget)) { return; }
        if (CastSpell(HEMORRHAGE,pTarget)) { return; }
        if (CastSpell(GHOSTLY_STRIKE,pTarget)) { return; }        
    }
    else 
    {
        if (ai->GetHealthPercent(*pTarget) > 30 && !m_bot->HasAura(SLICE_AND_DICE) && CastSpell(SLICE_AND_DICE)) { return; }
        if (ai->GetHealthPercent(*pTarget) < 20 && CastSpell(EVISCERATE)) { return; }
        if (!pTarget->HasAura(RUPTURE) && CastSpell(RUPTURE)) { return; }
        if (CastSpell(EVISCERATE)) { return; } // default if all else fails
    }
   
   
} //end DoNextCombatManeuver
コード例 #8
0
void PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return;

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

    uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth();

    ai->SetInFront( pTarget );
    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();

    if (pVictim && ai->GetHealthPercent() >= 40)
    {
        if (pVictim == m_bot)
            SpellSequence = DruidTank;
    }
    else if (pTarget->GetHealth() > pTarget->GetMaxHealth()*0.8 && pVictim)
    {
        if (pVictim != m_bot)
            SpellSequence = DruidSpell;
    }
    else if (ai->GetHealthPercent() <= 40 || GetMaster()->GetHealth() < GetMaster()->GetMaxHealth()*0.8)
        SpellSequence = DruidHeal;
    else
        SpellSequence = DruidCombat;

    switch (SpellSequence)
    {
        case DruidTank: // Its not a tank druid, only self protecting from heavy damage if got aggro.
            ai->TellMaster("DruidTank");

            if( !m_bot->HasInArc(M_PI, pTarget))
            {
                m_bot->SetInFront(pTarget);
                if (pVictim)
                    pVictim->Attack(pTarget, true);
            }
            if(m_bot->HasAura(CAT_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(768);
                //ai->TellMaster("FormClearCat");
            }
			if (MOONKIN_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, 0))
            {
                ai->CastSpell (MOONKIN_FORM);
            }
            else if (DIRE_BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, 0) && !m_bot->HasAura(DIRE_BEAR_FORM, 0))
            {
                ai->CastSpell (DIRE_BEAR_FORM);
            }
			else if (BEAR_FORM > 0 && !m_bot->HasAura(MOONKIN_FORM, 0) && !m_bot->HasAura(DIRE_BEAR_FORM, 0) && !m_bot->HasAura(BEAR_FORM, 0))
            {
                ai->CastSpell (BEAR_FORM);
            }
			else if (DEMORALIZING_ROAR > 0 && m_bot->HasAura(DIRE_BEAR_FORM, 0) || m_bot->HasAura(BEAR_FORM, 0) && !m_bot->HasAura(MOONKIN_FORM, 0) && !pTarget->HasAura(DEMORALIZING_ROAR, 0) && ai->GetRageAmount() >= 10)
            {
                ai->CastSpell(DEMORALIZING_ROAR, *pTarget);
            }
			if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, 0))
            {
                ai->CastSpell(FAERIE_FIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (MOONFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && DruidSpellCombat < 2 && !pTarget->HasAura(MOONFIRE, 0) && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell(MOONFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (ROOTS > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && DruidSpellCombat < 3 && !pTarget->HasAura(ROOTS, 0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(ROOTS, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (HURRICANE > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && ai->GetAttackerCount()>=5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
            {
				//ai->TellMaster("casting hurricane!");
                ai->CastSpell(HURRICANE, *pTarget);
				ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                break;
            }
            else if (WRATH > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && DruidSpellCombat < 5 && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(WRATH, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (INSECT_SWARM > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && DruidSpellCombat < 6 && !pTarget->HasAura(INSECT_SWARM, 0) && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(INSECT_SWARM , *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (STARFIRE > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && DruidSpellCombat < 7 && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(STARFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (FORCE_OF_NATURE > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && DruidSpellCombat < 8 && ai->GetManaPercent() >= 12)
            {
				//ai->TellMaster("summoning treants.");
                ai->CastSpell(FORCE_OF_NATURE);
                DruidSpellCombat++;
                break;
            }
			else if (STARFALL > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && ai->GetAttackerCount()>=3 && DruidSpellCombat < 9 && ai->GetManaPercent() >= 39)
            {
                ai->CastSpell(STARFALL, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (BARKSKIN > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && ai->GetHealthPercent() < 50 && DruidSpellCombat < 10 && !m_bot->HasAura(BARKSKIN, 0))
            {
                ai->CastSpell(BARKSKIN, *m_bot);
                DruidSpellCombat++;
                break;
            }
			else if (INNERVATE > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && ai->GetManaPercent() < 50 && DruidSpellCombat < 11 && !m_bot->HasAura(INNERVATE, 0))
            {
                ai->CastSpell(INNERVATE, *m_bot);
                DruidSpellCombat++;
                break;
            }
			else if (THORNS > 0 && m_bot->HasAura(MOONKIN_FORM, 0) && ai->GetManaPercent() >= 19 && DruidSpellCombat < 12 && !m_bot->HasAura(THORNS, 0))
            {
                ai->CastSpell(THORNS, *m_bot);
                DruidSpellCombat++;
                break;
            }
			else if (DruidSpellCombat > 13)
            {
                DruidSpellCombat = 0;
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidSpell:
            //ai->TellMaster("DruidSpell");
            if(m_bot->HasAura(CAT_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(768);
                //ai->TellMaster("FormClearCat");
                break;
            }
            if(m_bot->HasAura(BEAR_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(5487);
                //ai->TellMaster("FormClearBear");
                break;
            }
			if(m_bot->HasAura(DIRE_BEAR_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(9634);
                //ai->TellMaster("FormClearDireBear");
                break;
            }
			if(m_bot->HasAura(MOONKIN_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(24858);
                //ai->TellMaster("FormClearMoonkin");
                break;
            }
            if (FAERIE_FIRE > 0 && DruidSpellCombat < 1 && !pTarget->HasAura(FAERIE_FIRE, 0) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(FAERIE_FIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (MOONFIRE > 0 && DruidSpellCombat < 2 && (!pTarget->HasAura(MOONFIRE, 0)) && ai->GetManaPercent() >= 24)
            {
                ai->CastSpell(MOONFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (ROOTS > 0 && DruidSpellCombat < 3 && (!pTarget->HasAura(ROOTS, 0)) && ai->GetManaPercent() >= 8)
            {
                ai->CastSpell(ROOTS, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (HURRICANE > 0 && ai->GetAttackerCount()>=5 && DruidSpellCombat < 4 && ai->GetManaPercent() >= 91)
            {
				//ai->TellMaster("casting hurricane!");
                ai->CastSpell(HURRICANE, *pTarget);
				ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                break;
            }
			else if (INNERVATE > 0 && ai->GetManaPercent() < 50 && DruidSpellCombat < 5 && !m_bot->HasAura(INNERVATE, 0))
            {
                ai->CastSpell(INNERVATE, *m_bot);
                DruidSpellCombat++;
                break;
            }
            else if (WRATH > 0 && DruidSpellCombat < 6 && ai->GetManaPercent() >= 13)
            {
                ai->CastSpell(WRATH, *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (INSECT_SWARM > 0 && DruidSpellCombat < 7 && !pTarget->HasAura(INSECT_SWARM, 0) && ai->GetManaPercent() >= 9)
            {
                ai->CastSpell(INSECT_SWARM , *pTarget);
                DruidSpellCombat++;
                break;
            }
            else if (STARFIRE > 0 && DruidSpellCombat < 8 && ai->GetManaPercent() >= 18)
            {
                ai->CastSpell(STARFIRE, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (FORCE_OF_NATURE > 0 && DruidSpellCombat < 9 && ai->GetManaPercent() >= 12)
            {
				//ai->TellMaster("summoning treants.");
                ai->CastSpell(FORCE_OF_NATURE);
                DruidSpellCombat++;
                break;
            }
			else if (STARFALL > 0 && ai->GetAttackerCount()>=3 && DruidSpellCombat < 10 && ai->GetManaPercent() >= 39)
            {
                ai->CastSpell(STARFALL, *pTarget);
                DruidSpellCombat++;
                break;
            }
			else if (BARKSKIN > 0 && ai->GetHealthPercent() < 50 && DruidSpellCombat < 11 && !m_bot->HasAura(BARKSKIN, 0))
            {
                ai->CastSpell(BARKSKIN, *m_bot);
                DruidSpellCombat++;
                break;
            }
			else if (MANA_REJUVENATION > 0 && ai->GetManaPercent() < 50 && DruidSpellCombat < 12 && !m_bot->HasAura(MANA_REJUVENATION, 0))
            {
                ai->CastSpell(MANA_REJUVENATION, *m_bot);
                DruidSpellCombat++;
                break;
            }
			else if (DruidSpellCombat > 13)
            {
                DruidSpellCombat = 0;
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidHeal:
            //ai->TellMaster("DruidHeal");
            if(m_bot->HasAura(CAT_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(768);
                //ai->TellMaster("FormClearCat");
                break;
            }
            if(m_bot->HasAura(BEAR_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(5487);
                //ai->TellMaster("FormClearBear");
                break;
            }
            if(m_bot->HasAura(DIRE_BEAR_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(9634);
                //ai->TellMaster("FormClearDireBear");
                break;
            }
			if(m_bot->HasAura(MOONKIN_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(24858);
                //ai->TellMaster("FormClearMoonkin");
                break;
            }
            if (ai->GetHealthPercent() < 70)
            {
                HealTarget (*GetPlayerBot(), ai->GetHealthPercent());
                break;
            }
            if (masterHP < 70)
            {
                HealTarget (*GetMaster(), masterHP);
                break;
            }
            else
            {
                DruidSpellCombat = 0;
                break;
            }
            break;

        case DruidCombat:
            //ai->TellMaster("DruidCombat");
            if( !m_bot->HasInArc(M_PI, pTarget))
            {
                m_bot->SetInFront(pTarget);
                if (pVictim)
                    pVictim->Attack(pTarget, true);
            }
            if(m_bot->HasAura(BEAR_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(5487);
                //ai->TellMaster("FormClearBear");
                break;
            }
			if(m_bot->HasAura(DIRE_BEAR_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(9634);
                //ai->TellMaster("FormClearDireBear");
                break;
            }
			if(m_bot->HasAura(MOONKIN_FORM, 0))
            {
                m_bot->RemoveAurasDueToSpell(24858);
                //ai->TellMaster("FormClearMoonkin");
                break;
            }
            if (CAT_FORM > 0 && !m_bot->HasAura(CAT_FORM, 0))
                ai->CastSpell (CAT_FORM);
/*
            if (COWER > 0 && m_bot->GetComboPoints() == 1 && ai->GetEnergyAmount() >= 20)
            {
                ai->CastSpell(COWER);
                //ai->TellMaster("Cower");
            }*/
            if (MAIM > 0 && m_bot->GetComboPoints() >= 1 && pTarget->IsNonMeleeSpellCasted(true))
            {
                ai->CastSpell(MAIM, *pTarget);
                //ai->TellMaster("SpellPreventing Maim");
                break;
            }

            if (RAKE > 0 && m_bot->GetComboPoints() <= 1 && ai->GetEnergyAmount() >= 40)
            {
                ai->CastSpell (RAKE, *pTarget);
                //ai->TellMaster("Rake");
                break;
            }
            else if (CLAW > 0 && m_bot->GetComboPoints() <= 2 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (CLAW, *pTarget);
                //ai->TellMaster("Claw");
                break;
            }
            else if (MANGLE > 0 && m_bot->GetComboPoints() <= 3 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (MANGLE, *pTarget);
                //ai->TellMaster("Mangle");
                break;
            }
            else if (CLAW > 0 && m_bot->GetComboPoints() <= 4 && ai->GetEnergyAmount() >= 45)
            {
                ai->CastSpell (CLAW, *pTarget);
                //ai->TellMaster("Claw2");
                break;
            }

            if (m_bot->GetComboPoints() == 5)
            {
                if (RIP > 0 && pTarget->getClass() == CLASS_ROGUE && ai->GetEnergyAmount() >= 30)
                {
                    ai->CastSpell(RIP, *pTarget);
                    //ai->TellMaster("Rogue Rip");
                }
                else if (MAIM > 0 && pTarget->getClass() == CLASS_DRUID && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(MAIM, *pTarget);
                    //ai->TellMaster("Druid Maim");
                }
                else if (MAIM > 0 && pTarget->getClass() == CLASS_SHAMAN && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(MAIM, *pTarget);
                    //ai->TellMaster("Shaman Maim");
                }
                else if (MAIM > 0 && pTarget->getClass() == CLASS_WARLOCK && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(MAIM, *pTarget);
                    //ai->TellMaster("Warlock Maim");
                }
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_HUNTER && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                    //ai->TellMaster("Hunter Ferocious Bite");
                }
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_WARRIOR && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                    //ai->TellMaster("Warrior Ferocious Bite");
                }
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_PALADIN && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                    //ai->TellMaster("Paladin Ferocious Bite");
                }
                else if (FEROCIOUS_BITE > 0 && pTarget->getClass() == CLASS_DEATH_KNIGHT && ai->GetEnergyAmount() >= 25)
                {
                    ai->CastSpell(FEROCIOUS_BITE, *pTarget);
                    //ai->TellMaster("DK Ferocious Bite");
                }
                else if (MAIM > 0 && pTarget->getClass() == CLASS_MAGE && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(MAIM, *pTarget);
                    //ai->TellMaster("Mage Maim");
                }
                else if (MAIM > 0 && pTarget->getClass() == CLASS_PRIEST && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(MAIM, *pTarget);
                    //ai->TellMaster("Priest Maim");
                }
                else if (MAIM > 0 && ai->GetEnergyAmount() >= 35)
                {
                    ai->CastSpell(MAIM, *pTarget);
                    //ai->TellMaster("Else Maim");
                }
                break;
			}
            else
            {
				DruidSpellCombat = 0;
				break;
            }
            break;
    }
} // end DoNextCombatManeuver
コード例 #9
0
bool PlayerbotDruidAI::DoNextCombatManeuver(Unit *pTarget)
{
    PlayerbotAI* ai = GetAI();
    if (!ai)
        return false;

    Player* pMaster = ai->GetMaster();
    if (!pMaster)
        return false;

    uint32 masterHP = pMaster->GetHealth() * 100 / pMaster->GetMaxHealth();

    ai->SetInFront(pTarget);
    Player *m_bot = GetPlayerBot();
    Unit* pVictim = pTarget->getVictim();

    if (pVictim
        && (ai->GetHealthPercent() >= 40)
        && (pMaster->GetHealth() >= pMaster->GetMaxHealth() * 0.4))
    {
        if (pVictim == m_bot)
            SpellSequence = DruidTank;
    }
    else if (pVictim
        && (pTarget->GetHealth() > pTarget->GetMaxHealth() * 0.8))
    {
        if (pVictim != m_bot)
            SpellSequence = DruidSpell;
    }
    else if (ai->GetHealthPercent() <= 40 || pMaster->GetHealth() <= pMaster->GetMaxHealth() * 0.4)
        SpellSequence = DruidHeal;
    else
        SpellSequence = DruidCombat;

    switch (SpellSequence)
    {
        case DruidTank:

            m_bot->SetInFront(pTarget);
            if (pVictim)
                pVictim->Attack(pTarget, true);

            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(768);

            if ((MOONKIN_FORM > 0)
                && (!m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (ai->CastSpell(MOONKIN_FORM)))
                return true;

            if ((DIRE_BEAR_FORM > 0)
                && (!m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (!m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                && (ai->CastSpell(DIRE_BEAR_FORM)))
                return true;

            if ((BEAR_FORM > 0)
                && (!m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (!m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                && (!m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (ai->CastSpell(BEAR_FORM)))
                return true;

            if ((DEMORALIZING_ROAR > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (!m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (!pTarget->HasAura(DEMORALIZING_ROAR, EFFECT_INDEX_0))
                && (ai->GetRageAmount() >= 10)
                && (ai->CastSpell(DEMORALIZING_ROAR, *pTarget)))
                return true;

            if ((FAERIE_FIRE > 0)
                && (DruidSpellCombat < 1)
                && (!pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
                && (ai->CastSpell(FAERIE_FIRE, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((MOONFIRE > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 2)
                && (!pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 24)
                && (ai->CastSpell(MOONFIRE, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((ROOTS > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 3)
                && (!pTarget->HasAura(ROOTS, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 8)
                && (ai->CastSpell(ROOTS, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((HURRICANE > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (ai->GetAttackerCount() >= 5)
                && (DruidSpellCombat < 4)
                && (ai->GetManaPercent() >= 91)
                && (ai->CastSpell(HURRICANE, *pTarget)))
            {
                ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                return true;
            }

            if ((WRATH > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 5)
                && (ai->GetManaPercent() >= 13)
                && (ai->CastSpell(WRATH, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((INSECT_SWARM > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 6)
                && (!pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 9)
                && (ai->CastSpell(INSECT_SWARM , *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((STARFIRE > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 7)
                && (ai->GetManaPercent() >= 18)
                && (ai->CastSpell(STARFIRE, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((FORCE_OF_NATURE > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 8)
                && (ai->GetManaPercent() >= 12)
                && (ai->CastSpell(FORCE_OF_NATURE)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((STARFALL > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (!m_bot->HasAura(STARFALL, EFFECT_INDEX_0))
                && (ai->GetAttackerCount() >= 3)
                && (DruidSpellCombat < 9)
                && (ai->GetManaPercent() >= 39)
                && (ai->CastSpell(STARFALL, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((BARKSKIN > 0)
                && (pVictim == m_bot)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (ai->GetHealthPercent() < 75)
                && (DruidSpellCombat < 10)
                && (!m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
                && (ai->CastSpell(BARKSKIN, *m_bot)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((INNERVATE > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (ai->GetManaPercent() < 50)
                && (DruidSpellCombat < 11)
                && (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
                && (ai->CastSpell(INNERVATE, *m_bot)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((MANA_REJUVENATION > 0)
                && (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                && (ai->GetManaPercent() < 50)
                && (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
                && (DruidSpellCombat < 12)
                && (!m_bot->HasAura(MANA_REJUVENATION, EFFECT_INDEX_0))
                && (ai->CastSpell(MANA_REJUVENATION, *m_bot)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((ENRAGE > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 2)
                && (!m_bot->HasAura(ENRAGE, EFFECT_INDEX_0))
                && (ai->CastSpell(ENRAGE, *m_bot)))
            {
                DruidSpellCombat++;
                DruidSpellCombat++;
                return true;
            }

            if ((SWIPE > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 4)
                && (ai->GetRageAmount() >= 20)
                && (ai->CastSpell(SWIPE, *pTarget)))
            {
                DruidSpellCombat++;
                DruidSpellCombat++;
                return true;
            }

            if ((MAUL > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (DruidSpellCombat < 6)
                && (ai->GetRageAmount() >= 15)
                && (ai->CastSpell(MAUL, *pTarget)))
            {
                DruidSpellCombat++;
                DruidSpellCombat++;
                return true;
            }

            if ((BASH > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (!pTarget->HasAura(BASH, EFFECT_INDEX_0))
                && (DruidSpellCombat < 8)
                && (ai->GetRageAmount() >= 10)
                && (ai->CastSpell(BASH, *pTarget)))
            {
                DruidSpellCombat++;
                DruidSpellCombat++;
                return true;
            }

            if ((CHALLENGING_ROAR > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (pVictim != m_bot)
                && (DruidSpellCombat < 10)
                && (!pTarget->HasAura(CHALLENGING_ROAR, EFFECT_INDEX_0))
                && (!pTarget->HasAura(GROWL, EFFECT_INDEX_0))
                && (ai->GetRageAmount() >= 15)
                && (ai->CastSpell(CHALLENGING_ROAR, *pTarget)))
            {
                DruidSpellCombat++;
                DruidSpellCombat++;
                return true;
            }

            if ((GROWL > 0)
                && ((m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))|| m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                && (pVictim != m_bot)
                && (DruidSpellCombat < 12)
                && (!pTarget->HasAura(CHALLENGING_ROAR, EFFECT_INDEX_0))
                && (!pTarget->HasAura(GROWL, EFFECT_INDEX_0))
                && (ai->CastSpell(GROWL, *pTarget)))
            {
                DruidSpellCombat++;
                DruidSpellCombat++;
                return true;
            }

            DruidSpellCombat = 0;
            break;

        case DruidSpell:

            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(768);

            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(5487);

            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(9634);

            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(24858);

            if ((FAERIE_FIRE > 0)
                && (DruidSpellCombat < 1)
                && (!pTarget->HasAura(FAERIE_FIRE, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 8)
                && (ai->CastSpell(FAERIE_FIRE, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((MOONFIRE > 0)
                && (DruidSpellCombat < 2)
                && (!pTarget->HasAura(MOONFIRE, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 24)
                && (ai->CastSpell(MOONFIRE, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((ROOTS > 0)
                && (DruidSpellCombat < 3)
                && (!pTarget->HasAura(ROOTS, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 8)
                && (ai->CastSpell(ROOTS, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((HURRICANE > 0)
                && (ai->GetAttackerCount() >= 5)
                && (DruidSpellCombat < 4)
                && (ai->GetManaPercent() >= 91)
                && (ai->CastSpell(HURRICANE, *pTarget)))
            {
                ai->SetIgnoreUpdateTime(10);
                DruidSpellCombat++;
                return true;
            }

            if ((WRATH > 0)
                && (DruidSpellCombat < 5)
                && (ai->GetManaPercent() >= 13)
                && (ai->CastSpell(WRATH, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((INSECT_SWARM > 0)
                && (DruidSpellCombat < 6)
                && (!pTarget->HasAura(INSECT_SWARM, EFFECT_INDEX_0))
                && (ai->GetManaPercent() >= 9)
                && (ai->CastSpell(INSECT_SWARM , *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((STARFIRE > 0)
                && (DruidSpellCombat < 7)
                && (ai->GetManaPercent() >= 18)
                && (ai->CastSpell(STARFIRE, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((FORCE_OF_NATURE > 0)
                && (DruidSpellCombat < 8)
                && (ai->GetManaPercent() >= 12)
                && (ai->CastSpell(FORCE_OF_NATURE)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((STARFALL > 0)
                && (!m_bot->HasAura(STARFALL, EFFECT_INDEX_0))
                && (ai->GetAttackerCount() >= 3)
                && (DruidSpellCombat < 9)
                && (ai->GetManaPercent() >= 39)
                && (ai->CastSpell(STARFALL, *pTarget)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((BARKSKIN > 0)
                && (pVictim == m_bot)
                && (ai->GetHealthPercent() < 75)
                && (DruidSpellCombat < 10)
                && (!m_bot->HasAura(BARKSKIN, EFFECT_INDEX_0))
                && (ai->CastSpell(BARKSKIN, *m_bot)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((INNERVATE > 0)
                && (ai->GetManaPercent() < 50)
                && (DruidSpellCombat < 11)
                && (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
                && (ai->CastSpell(INNERVATE, *m_bot)))
            {
                DruidSpellCombat++;
                return true;
            }

            if ((MANA_REJUVENATION > 0)
                && (ai->GetManaPercent() < 50)
                && (DruidSpellCombat < 12)
                && (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0))
                && (!m_bot->HasAura(MANA_REJUVENATION, EFFECT_INDEX_0))
                && (ai->CastSpell(MANA_REJUVENATION, *m_bot)))
            {
                DruidSpellCombat++;
                return true;
            }

            DruidSpellCombat = 0;
            break;

        case DruidHeal:

            if (m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(768);

            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(5487);

            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(9634);

            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(24858);

            if ((ai->GetHealthPercent() <= 40)
                && HealTarget(*m_bot, ai->GetHealthPercent()))
                return true;

            if ((masterHP <= 40)
                && HealTarget(*pMaster, masterHP))
                return true;

            DruidSpellCombat = 0;
            break;

        case DruidCombat:

            m_bot->SetInFront(pTarget);
            if (pVictim)
                pVictim->Attack(pTarget, true);

            if (m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(5487);

            if (m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(9634);

            if (m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0))
                m_bot->RemoveAurasDueToSpell(24858);

            if ((CAT_FORM > 0)
                && (!m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0))
                && (ai->CastSpell(CAT_FORM)))
                return true;

            if ((MAIM > 0)
                && (m_bot->GetComboPoints() >= 1)
                && (pTarget->IsNonMeleeSpellCasted(true))
                && (ai->CastSpell(MAIM, *pTarget)))
                return true;

            if ((RAKE > 0)
                && (m_bot->GetComboPoints() <= 1)
                && (ai->GetEnergyAmount() >= 40)
                && (ai->CastSpell(RAKE, *pTarget)))
                return true;

            if ((CLAW > 0)
                && (m_bot->GetComboPoints() <= 2)
                && (ai->GetEnergyAmount() >= 45)
                && (ai->CastSpell(CLAW, *pTarget)))
                return true;

            if ((MANGLE > 0)
                && (m_bot->GetComboPoints() <= 3)
                && (ai->GetEnergyAmount() >= 45)
                && (ai->CastSpell(MANGLE, *pTarget)))
                return true;

            if ((CLAW > 0)
                && (m_bot->GetComboPoints() <= 4)
                && (ai->GetEnergyAmount() >= 45)
                && (ai->CastSpell(CLAW, *pTarget)))
                return true;

            if (m_bot->GetComboPoints() == 5)
            {
                if ((RIP > 0)
                    && (pTarget->getClass() == CLASS_ROGUE)
                    && (ai->GetEnergyAmount() >= 30)
                    && (ai->CastSpell(RIP, *pTarget)))
                    return true;

                if ((MAIM > 0)
                    && (pTarget->getClass() == CLASS_DRUID)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(MAIM, *pTarget)))
                    return true;

                if ((MAIM > 0)
                    && (pTarget->getClass() == CLASS_SHAMAN)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(MAIM, *pTarget)))
                    return true;

                if ((MAIM > 0)
                    && (pTarget->getClass() == CLASS_WARLOCK)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(MAIM, *pTarget)))
                    return true;

                if ((FEROCIOUS_BITE > 0)
                    && (pTarget->getClass() == CLASS_HUNTER)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(FEROCIOUS_BITE, *pTarget)))
                    return true;

                if ((FEROCIOUS_BITE > 0)
                    && (pTarget->getClass() == CLASS_WARRIOR)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(FEROCIOUS_BITE, *pTarget)))
                    return true;

                if ((FEROCIOUS_BITE > 0)
                    && (pTarget->getClass() == CLASS_PALADIN)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(FEROCIOUS_BITE, *pTarget)))
                    return true;

                if ((FEROCIOUS_BITE > 0)
                    && (pTarget->getClass() == CLASS_DEATH_KNIGHT)
                    && (ai->GetEnergyAmount() >= 25)
                    && (ai->CastSpell(FEROCIOUS_BITE, *pTarget)))
                    return true;

                if ((MAIM > 0)
                    && (pTarget->getClass() == CLASS_MAGE)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(MAIM, *pTarget)))
                    return true;

                if ((MAIM > 0)
                    && (pTarget->getClass() == CLASS_PRIEST)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(MAIM, *pTarget)))
                    return true;

                if ((MAIM > 0)
                    && (ai->GetEnergyAmount() >= 35)
                    && (ai->CastSpell(MAIM, *pTarget)))
                    return true;
            }

            DruidSpellCombat = 0;
            break;
    }

    return false;
}