void PlayerbotMageAI::DoNextCombatManeuver(Unit *pTarget) { PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: if (FIREBALL > 0) ai->CastSpell(FIREBALL); return; } // ------- Non Duel combat ---------- ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob // Damage Spells (primitive example) ai->SetInFront( pTarget ); Player *m_bot = GetPlayerBot(); Unit* pVictim = pTarget->getVictim(); switch (SpellSequence) { case SPELL_FROST: if (ICY_VEINS > 0 && !m_bot->HasAura(ICY_VEINS, 0) && LastSpellFrost < 1 && ai->GetManaPercent() >= 3) { ai->CastSpell(ICY_VEINS, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (FROSTBOLT > 0 && LastSpellFrost < 2 && !pTarget->HasAura(FROSTBOLT, 0) && ai->GetManaPercent() >= 16) { ai->CastSpell(FROSTBOLT, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (FROST_WARD > 0 && LastSpellFrost < 3 && !m_bot->HasAura(FROST_WARD, 0) && ai->GetManaPercent() >= 19) { ai->CastSpell(FROST_WARD, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (FROST_NOVA > 0 && LastSpellFrost < 4 && !pTarget->HasAura(FROST_NOVA, 0) && ai->GetManaPercent() >= 10) { ai->CastSpell(FROST_NOVA, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (ICE_LANCE > 0 && LastSpellFrost < 5 && ai->GetManaPercent() >= 7) { ai->CastSpell(ICE_LANCE, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (BLIZZARD > 0 && LastSpellFrost < 6 && ai->GetAttackerCount()>=5 && ai->GetManaPercent() >= 89) { ai->CastSpell(BLIZZARD, *pTarget); ai->SetIgnoreUpdateTime(8); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (CONE_OF_COLD > 0 && LastSpellFrost < 7 && !pTarget->HasAura(CONE_OF_COLD, 0) && ai->GetManaPercent() >= 35) { ai->CastSpell(CONE_OF_COLD, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (DEEP_FREEZE > 0 && LastSpellFrost < 8 && ai->GetManaPercent() >= 9) { ai->CastSpell(DEEP_FREEZE, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (ICE_BARRIER > 0 && LastSpellFrost < 9 && ai->GetHealthPercent() < 70 && ai->GetManaPercent() >= 30) { ai->CastSpell(ICE_BARRIER, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (SUMMON_WATER_ELEMENTAL > 0 && LastSpellFrost < 10 && ai->GetManaPercent() >= 16) { ai->CastSpell(SUMMON_WATER_ELEMENTAL); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (ICE_BLOCK > 0 && LastSpellFrost < 11 && !m_bot->HasAura(ICE_BLOCK, 0) && ai->GetHealthPercent() < 25) { ai->CastSpell(ICE_BLOCK, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } else if (COLD_SNAP > 0 && LastSpellFrost < 12) { ai->CastSpell(COLD_SNAP, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost +1; break; } LastSpellFrost = 0; //SpellSequence = SPELL_FIRE; //break; case SPELL_FIRE: if (FIRE_WARD > 0 && !m_bot->HasAura(FIRE_WARD, 0) && LastSpellFire < 1 && ai->GetManaPercent() >= 3) { ai->CastSpell(FIRE_WARD, *m_bot); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (COMBUSTION > 0 && !m_bot->HasAura(COMBUSTION, 0) && LastSpellFire < 2) { ai->CastSpell(COMBUSTION, *GetMaster()); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (FIREBALL > 0 && LastSpellFire < 3 && ai->GetManaPercent() >= 23) { ai->CastSpell(FIREBALL, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (FIRE_BLAST > 0 && LastSpellFire < 4 && ai->GetManaPercent() >= 25) { ai->CastSpell(FIRE_BLAST, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (FLAMESTRIKE > 0 && LastSpellFire < 5 && ai->GetManaPercent() >= 35) { ai->CastSpell(FLAMESTRIKE, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (SCORCH > 0 && LastSpellFire < 6 && ai->GetManaPercent() >= 10) { ai->CastSpell(SCORCH, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (PYROBLAST > 0 && LastSpellFire < 7 && !pTarget->HasAura(PYROBLAST, 0) && ai->GetManaPercent() >= 27) { ai->CastSpell(PYROBLAST, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (BLAST_WAVE > 0 && LastSpellFire < 8 && ai->GetAttackerCount()>=3 && pVictim && ai->GetManaPercent() >= 34) { ai->CastSpell(BLAST_WAVE); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (DRAGONS_BREATH > 0 && LastSpellFire < 9 && pVictim && ai->GetManaPercent() >= 37) { ai->CastSpell(DRAGONS_BREATH, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (LIVING_BOMB > 0 && LastSpellFire < 10 && !pTarget->HasAura(LIVING_BOMB, 0) && ai->GetManaPercent() >= 27) { ai->CastSpell(LIVING_BOMB, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } else if (FROSTFIRE_BOLT > 0 && LastSpellFire < 11 && !pTarget->HasAura(FROSTFIRE_BOLT, 0) && ai->GetManaPercent() >= 14) { ai->CastSpell(FROSTFIRE_BOLT, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire +1; break; } LastSpellFire = 0; //SpellSequence = SPELL_ARCANE; //break; case SPELL_ARCANE: if (ARCANE_POWER > 0 && LastSpellArcane < 1 && ai->GetManaPercent() >= 37) { ai->CastSpell(ARCANE_POWER, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (ARCANE_MISSILES > 0 && LastSpellArcane < 2 && ai->GetManaPercent() >= 37) { ai->CastSpell(ARCANE_MISSILES, *pTarget); ai->SetIgnoreUpdateTime(3); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (ARCANE_EXPLOSION > 0 && LastSpellArcane < 3 && ai->GetAttackerCount()>=3 && pVictim && ai->GetManaPercent() >= 27) { ai->CastSpell(ARCANE_EXPLOSION, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (COUNTERSPELL > 0 && pTarget->GetPower(POWER_MANA) > 0 && LastSpellArcane < 4 && ai->GetManaPercent() >= 9) { ai->CastSpell(COUNTERSPELL, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (SLOW > 0 && LastSpellArcane < 5 && !pTarget->HasAura(SLOW, 0) && ai->GetManaPercent() >= 12) { ai->CastSpell(SLOW, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (ARCANE_BARRAGE > 0 && LastSpellArcane < 6 && ai->GetManaPercent() >= 27) { ai->CastSpell(ARCANE_BARRAGE, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (ARCANE_BLAST > 0 && LastSpellArcane < 7 && ai->GetManaPercent() >= 8) { ai->CastSpell(ARCANE_BLAST, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (MIRROR_IMAGE > 0 && LastSpellArcane < 8 && ai->GetManaPercent() >= 10) { ai->CastSpell(MIRROR_IMAGE); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else if (MANA_SHIELD > 0 && LastSpellArcane < 9 && ai->GetHealthPercent() < 50 && !m_bot->HasAura(MANA_SHIELD, 0) && ai->GetManaPercent() >= 8) { ai->CastSpell(MANA_SHIELD, *m_bot); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane +1; break; } else { LastSpellArcane = 0; SpellSequence = SPELL_FROST; } } } // end DoNextCombatManeuver
void PlayerbotHunterAI::DoNonCombatActions() { PlayerbotAI *ai = GetAI(); if( !ai ) return; Player * m_bot = GetPlayerBot(); if (!m_bot) return; // reset ranged combat state if( !m_rangedCombat ) m_rangedCombat = true; // buff group if (TRUESHOT_AURA > 0) (!m_bot->HasAura(TRUESHOT_AURA, 0) && ai->CastSpell (TRUESHOT_AURA, *m_bot)); // buff myself if (ASPECT_OF_THE_HAWK > 0) (!m_bot->HasAura(ASPECT_OF_THE_HAWK, 0) && ai->CastSpell (ASPECT_OF_THE_HAWK, *m_bot)); // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 30) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, 0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(*fItem); ai->SetIgnoreUpdateTime(8); return; } else if (pItem == NULL && fItem == NULL && m_bot->getRace() == RACE_DRAENEI && !m_bot->HasAura(GIFT_OF_THE_NAARU, 0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I'm casting gift of the naaru."); ai->CastSpell(GIFT_OF_THE_NAARU, *m_bot); return; } // check for pet if( PET_SUMMON>0 && !m_petSummonFailed && HasPet(m_bot) ) { // we can summon pet, and no critical summon errors before Pet *pet = m_bot->GetPet(); if( !pet ) { // summon pet if( PET_SUMMON>0 && ai->CastSpell(PET_SUMMON,*m_bot) ) ai->TellMaster( "summoning pet." ); else { m_petSummonFailed = true; ai->TellMaster( "summon pet failed!" ); } } else if( pet->getDeathState() != ALIVE ) { // revive pet if( PET_REVIVE>0 && ai->GetManaPercent()>=80 && ai->CastSpell(PET_REVIVE,*m_bot) ) ai->TellMaster( "reviving pet." ); } else if( ((float)pet->GetHealth()/(float)pet->GetMaxHealth()) < 0.5f ) { // heal pet when health lower 50% if( PET_MEND>0 && !pet->getDeathState() != ALIVE && !pet->HasAura(PET_MEND,0) && ai->GetManaPercent()>=13 && ai->CastSpell(PET_MEND,*m_bot) ) ai->TellMaster( "healing pet." ); } else if(pet->GetHappinessState() != HAPPY) // if pet is hungry { // list out items in main backpack for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++) { Item* const pItem = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (pItem) { const ItemPrototype* const pItemProto = pItem->GetProto(); if (!pItemProto ) continue; if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet { //sLog.outDebug("Food for pet: %s",pItemProto->Name1); uint32 count = 1; // number of items used int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet ai->TellMaster( "feeding pet." ); ai->SetIgnoreUpdateTime(10); return; } } } // list out items in other removable backpacks for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag) { const Bag* const pBag = (Bag*) m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag); if (pBag) { for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot) { Item* const pItem = m_bot->GetItemByPos(bag, slot); if (pItem) { const ItemPrototype* const pItemProto = pItem->GetProto(); if (!pItemProto ) continue; if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet { //sLog.outDebug("Food for pet: %s",pItemProto->Name1); uint32 count = 1; // number of items used int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet ai->TellMaster( "feeding pet." ); ai->SetIgnoreUpdateTime(10); return; } } } } } if( pet->HasAura(PET_MEND,0) && !pet->HasAura(PET_FEED,0) ) ai->TellMaster( "..no pet food!" ); ai->SetIgnoreUpdateTime(7); } } } // end DoNonCombatActions
void PlayerbotMageAI::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 Actions // Choose actions accoring to talents (MAGE is always ranged dps) m_role = BOT_ROLE_DPS_RANGED; // if i am under attack and if i am not tank or offtank: change target if needed if (isUnderAttack()) { // Keep hitting but reduce threat //else if (m_bot->getRace() == (uint8) RACE_NIGHTELF && CastSpell(R_SHADOWMELD,m_bot)) { return; } 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 TakePosition(pTarget); // If there's a cast stop if (m_bot->HasUnitState(UNIT_STAT_CASTING)) { return; } if (DoSupportRaid(m_bot,30,0,0,0,1,1)) { return; } if (m_tank->GetGUID() != m_bot->GetGUID() && pVictim && pVictim->GetGUID() == m_bot->GetGUID() ) { //if (CastSpell(INVISIBILITY, m_bot)) { return; } if (ai->GetHealthPercent(*pTarget) > 50 && CastSpell(POLYMORPH)) { return; } //if (m_bot->getRace() == (uint8) RACE_NIGHTELF && isUnderAttack() && CastSpell(R_SHADOWMELD, m_bot)) { return; } } if (isUnderAttack() && pDist > 5 && CastSpell(FROST_NOVA, pTarget)) { return; } if (DEEP_FREEZE && pTarget->isFrozen() && CastSpell(DEEP_FREEZE,pTarget)) { return; } if (isUnderAttack() && CastSpell(DRAGONS_BREATH, pTarget)) { return; } if ((isUnderAttack() || ai->GetHealthPercent() < 75 && !HasAuraName(m_bot, MANA_SHIELD)) && ai->GetManaPercent() > 40 && CastSpell(MANA_SHIELD,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 if ((ai->GetHealthPercent() < 65 || ai->GetManaPercent() < 5) && CastSpell(ICE_BLOCK,m_bot)) { return; } if (isUnderAttack() && CastSpell(ICE_BARRIER, pTarget)) { return; } if (ai->GetManaPercent() < 30 && CastSpell (EVOCATION, m_bot)) { return; } //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 (pThreat < threatThreshold && pTarget->IsNonMeleeSpellCasted(true) && CastSpell(COUNTER_SPELL, pTarget)) { return; } //High threat if (!m_bot->HasAura(MOLTEN_ARMOR) && CastSpell(MOLTEN_ARMOR,m_bot)) { return; } if (ai->GetHealthPercent(*pTarget) > 96) { return; } // dont dps too early //Catch if (pTarget->HasUnitMovementFlag(UNIT_FLAG_FLEEING)) { if (CastSpell(FROST_NOVA,pTarget)) return; if (CastSpell(FROSTBOLT,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(INVISIBILITY,m_bot)) { return; } //Lets see if we can manage else if (m_bot->FindCurrentSpellBySpellId(SHOOT)) { m_bot->InterruptNonMeleeSpells( true, SHOOT ); return; } //Disable wand else { return; } //use no spells and wait threat to be reduced } } // buff up if (CastSpell(ICY_VEINS,m_bot)) {} //nogcd 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(POM,m_bot)) {} //nogcd if (TALENT_ARCANE) { if (CastSpell(ARCANE_POWER,m_bot)) {} //nogcd if (CastSpell(MIRROR_IMAGE,m_bot)) { return; } //AOE if (isUnderAttack(m_tank,5)) { if (CastSpell(BLIZZARD,pTarget)) { return; } } //DPS if (ARCANE_BLAST) { Aura *abaura = m_bot->GetAura(P_ARCANE_BLAST); if (abaura && abaura->GetStackAmount() >= 3) { if (m_bot->HasAura(P_MISSILE_BARRAGE) && CastSpell(ARCANE_MISSILES,pTarget)) { return; } else if (CastSpell(ARCANE_BARRAGE,pTarget)) { return; } } } if (CastSpell(ARCANE_BARRAGE,pTarget) ) { return; } } if (TALENT_FIRE) { if (CastSpell(COMBUSTION,m_bot)) { } //nogcd if (CastSpell(MIRROR_IMAGE,m_bot)) { return; } //AOE if (isUnderAttack(m_tank,5)) { if (CastSpell(FLAMESTRIKE,pTarget)) { return; } if (CastSpell(BLAST_WAVE,pTarget)) { return; } if (CastSpell(LIVING_BOMB,pTarget)) { return; } if (CastSpell(DRAGONS_BREATH,pTarget)) { return; } } //DPS if (m_bot->HasAura(P_HOT_STREAK) && CastSpell(PYROBLAST,pTarget)) { return; } if (!pTarget->HasAura(LIVING_BOMB,m_bot->GetGUID()) && CastSpell(LIVING_BOMB,pTarget)) { return; } //if (!pTarget->HasAura(IMP_SCORCH) && CastSpell(SCORCH,pTarget)) { return; } if (CastSpell(FIREBALL,pTarget)) { return; } } if (TALENT_FROST) { if (CastSpell(MIRROR_IMAGE,m_bot)) { return; } if (CastSpell(WATER_ELEMENTAL,m_bot)) { return; } uint64 pet_guid = m_bot->GetPetGUID(); if (pet_guid>0){ Pet* pet = ObjectAccessor::GetPet(*m_bot, pet_guid); Unit *unit = ObjectAccessor::GetUnit(*m_bot, pet_guid); if (unit!=NULL){ if (!unit->isInCombat()) { m_bot->GetSession()->HandlePetActionHelper(unit, pet_guid, COMMAND_ATTACK, ACT_COMMAND, pTarget->GetGUID()); } } } //if (CastSpell(33395, pTarget)) // pet freeze spell // sLog.outError ("successfully casted freeze"); //AOE if (isUnderAttack(m_tank,5)) { if (CastSpell(BLIZZARD,pTarget)) { return; } } //DPS if (m_bot->HasAura(P_FINGERS_OF_FROST) && CastSpell(DEEP_FREEZE,pTarget)) { return; } if (m_bot->HasAura(P_BRAIN_FREEZE) && CastSpell(FROSTFIRE_BOLT,pTarget)) { return; } if (CastSpell(FROSTBOLT,pTarget,true,true)) { return; } } // Defaults especialy for lower levels if (m_bot->HasAura(P_BRAIN_FREEZE) && CastSpell(FIREBALL,pTarget,1,1)) { return; } if (m_bot->HasAura(P_FIRESTARTER) && CastSpell(FLAMESTRIKE,pTarget,1,1)) { return; } if (m_bot->HasAura(P_HOT_STREAK) && CastSpell(PYROBLAST,pTarget,1,1)) { return; } if (m_bot->HasAura(POM) && (CastSpell(PYROBLAST,pTarget,1,1) || CastSpell(FIREBALL,pTarget,1,1) || CastSpell(FROSTBOLT,pTarget,1,1))) { return; } if (pTarget->isFrozen() && CastSpell(ICE_LANCE,pTarget)) { return; } if (m_bot->isMoving() && (CastSpell(FIRE_BLAST,pTarget,1,1) || CastSpell(ARCANE_BARRAGE,pTarget) || CastSpell(ICE_LANCE,pTarget))) { return; } if (CastSpell(FIREBALL,pTarget)) { return; } if (CastSpell(FROSTBOLT,pTarget)) { return; } if (CastSpell(ARCANE_MISSILES,pTarget)) { return; } // drink potion if(ai->GetManaPercent() < 5 ) { Item *pItem = ai->FindPotion(); if(pItem != NULL) { if (pItem->GetSpell() && m_bot->HasSpellCooldown(pItem->GetSpell()) ) { return; } //pot is in cooldown ai->UseItem(*pItem); } } // if we get down here, it means we are out of mana, so use wand CastSpell(SHOOT, pTarget); } //end DoNextCombatManeuver
void PlayerbotWarlockAI::DoNonCombatActions() { PlayerbotAI *ai = GetAI(); if( !ai ) return; Player * m_bot = GetPlayerBot(); if (!m_bot) return; SpellSequence = SPELL_CURSES; Pet *pet = m_bot->GetPet(); // buff myself DEMON_SKIN, DEMON_ARMOR, FEL_ARMOR if (FEL_ARMOR > 0) (!m_bot->HasAura(FEL_ARMOR, EFFECT_INDEX_0) && ai->CastSpell(FEL_ARMOR, *m_bot)); else if (DEMON_ARMOR > 0) (!m_bot->HasAura(DEMON_ARMOR, EFFECT_INDEX_0) && !m_bot->HasAura(FEL_ARMOR, EFFECT_INDEX_0) && ai->CastSpell(DEMON_ARMOR, *m_bot)); else if (DEMON_SKIN > 0) (!m_bot->HasAura(DEMON_SKIN, EFFECT_INDEX_0) && !m_bot->HasAura(FEL_ARMOR, EFFECT_INDEX_0) && !m_bot->HasAura(DEMON_ARMOR, EFFECT_INDEX_0) && ai->CastSpell(DEMON_SKIN, *m_bot)); // buff myself & master DETECT_INVISIBILITY if (DETECT_INVISIBILITY > 0) (!m_bot->HasAura(DETECT_INVISIBILITY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 2 && ai->CastSpell(DETECT_INVISIBILITY, *m_bot)); if (DETECT_INVISIBILITY > 0) (!GetMaster()->HasAura(DETECT_INVISIBILITY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 2 && ai->CastSpell(DETECT_INVISIBILITY, *GetMaster())); // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 25) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if(( pet ) && (pItem == NULL && DARK_PACT>0 && ai->GetManaPercent() <= 50 && pet->GetPower(POWER_MANA) > 0) ) { ai->CastSpell(DARK_PACT, *m_bot); //ai->TellMaster("casting dark pact."); return; } else if(( !pet ) && (pItem == NULL && LIFE_TAP>0 && ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 25) ) { ai->CastSpell(LIFE_TAP, *m_bot); //ai->TellMaster("casting life tap."); return; } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(*fItem); ai->SetIgnoreUpdateTime(8); return; } else if(( pet ) && (pItem == NULL && fItem == NULL && CONSUME_SHADOWS>0 && !m_bot->HasAura(CONSUME_SHADOWS, EFFECT_INDEX_0) && ai->GetHealthPercent() < 75) ) { ai->CastSpell(CONSUME_SHADOWS, *m_bot); //ai->TellMaster("casting consume shadows."); return; } // check for demon if( SUMMON_FELGUARD>0 || SUMMON_FELHUNTER>0 || SUMMON_SUCCUBUS>0 || SUMMON_VOIDWALKER>0 || SUMMON_IMP>0 && !m_demonSummonFailed ) { if( !pet ) { // summon demon if( SUMMON_FELGUARD>0 && ai->CastSpell(SUMMON_FELGUARD,*m_bot) ) ai->TellMaster( "summoning felguard." ); else if( SUMMON_FELHUNTER>0 && ai->CastSpell(SUMMON_FELHUNTER,*m_bot) ) ai->TellMaster( "summoning felhunter." ); else if( SUMMON_SUCCUBUS>0 && ai->CastSpell(SUMMON_SUCCUBUS,*m_bot) ) ai->TellMaster( "summoning succubus." ); else if( SUMMON_VOIDWALKER>0 && ai->CastSpell(SUMMON_VOIDWALKER,*m_bot) ) ai->TellMaster( "summoning voidwalker." ); else if( SUMMON_IMP>0 && ai->GetManaPercent() >= 64 && ai->CastSpell(SUMMON_IMP,*m_bot) ) ai->TellMaster( "summoning imp." ); else { m_demonSummonFailed = true; //ai->TellMaster( "summon demon failed!" ); } } } // check for buffs with demon if(( pet ) && ( SOUL_LINK>0 && !m_bot->HasAura(SOUL_LINK, EFFECT_INDEX_0) && ai->GetManaPercent() >= 16 && ai->CastSpell(SOUL_LINK,*m_bot) )) { //ai->TellMaster( "casting soul link." ); return; } else if(( pet ) && ( BLOOD_PACT>0 && !m_bot->HasAura(BLOOD_PACT, EFFECT_INDEX_0) && ai->CastSpell(BLOOD_PACT,*m_bot) )) { //ai->TellMaster( "casting blood pact." ); return; } else if(( pet ) && ( FEL_INTELLIGENCE>0 && !m_bot->HasAura(FEL_INTELLIGENCE, EFFECT_INDEX_0) && ai->CastSpell(FEL_INTELLIGENCE,*m_bot) )) { //ai->TellMaster( "casting fel intelligence." ); return; } } // end DoNonCombatActions
void PlayerbotPriestAI::DoNonCombatActions() { PlayerbotAI* ai = GetAI(); Player * m_bot = GetPlayerBot(); Player * master = GetMaster(); if (!m_bot || !master) return; SpellSequence = SPELL_HOLY; // selfbuff goes first if (ai->SelfBuff(INNER_FIRE)) return; // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 30) { ai->TellMaster("I could use a drink."); ai->UseItem(pItem); return; } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(pItem); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(fItem); return; } // buff and heal master's group if (master->GetGroup()) { // Buff master with group buffs if (!master->IsInDuel(master)) if (master->isAlive()) { if (PRAYER_OF_FORTITUDE && ai->HasSpellReagents(PRAYER_OF_FORTITUDE) && ai->Buff(PRAYER_OF_FORTITUDE, master)) return; if (PRAYER_OF_SPIRIT && ai->HasSpellReagents(PRAYER_OF_SPIRIT) && ai->Buff(PRAYER_OF_SPIRIT, master)) return; } Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(itr->guid); if (!tPlayer || tPlayer == m_bot) continue; if (tPlayer->IsInDuelWith(master)) continue; // first rezz em if (!tPlayer->isAlive()) { if (ai->CastSpell(RESURRECTION, *tPlayer)) { std::string msg = "Resurrecting "; msg += tPlayer->GetName(); m_bot->Say(msg, LANG_UNIVERSAL); return; } else continue; } else { // buff and heal if (BuffPlayer(tPlayer)) return; if (HealTarget(tPlayer)) return; } } } else { if (master->isAlive() && !master->IsInDuel(master)) { if (BuffPlayer(master)) return; if (HealTarget(master)) return; } else if (ai->CastSpell(RESURRECTION, *master)) ai->TellMaster("Resurrecting you, Master."); } BuffPlayer(m_bot); } // end DoNonCombatActions
void PlayerbotPaladinAI::DoNonCombatActions() { PlayerbotAI* ai = GetAI(); Player * m_bot = GetPlayerBot(); if (!m_bot) return; // Buff myself if (ai->GetCombatOrder() == ai->ORDERS_TANK) ai->SelfBuff(RIGHTEOUS_FURY); BuffPlayer(m_bot); // Buff master BuffPlayer(ai->GetMaster()); // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 40) { ai->TellMaster("I could use a drink."); ai->UseItem(pItem); return; } // hp check original if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 40) { ai->TellMaster("I could use some food."); ai->UseItem(pItem); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(fItem); return; } // heal and buff group if (GetMaster()->GetGroup()) { Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(itr->guid); if (!tPlayer) continue; if (!tPlayer->isAlive()) { if (ai->CastSpell(REDEMPTION, *tPlayer)) { std::string msg = "Resurrecting "; msg += tPlayer->GetName(); m_bot->Say(msg, LANG_UNIVERSAL); return; } else continue; } if (HealTarget(tPlayer)) return; if (tPlayer != m_bot && tPlayer != GetMaster()) if (BuffPlayer(tPlayer)) return; } } }
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_STATE_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
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; }
bool PlayerbotDruidAI::DoNonCombatActions() { Player * m_bot = GetPlayerBot(); if (!m_bot) return false; PlayerbotAI* ai = GetAI(); if (!ai) return false; Player* pMaster = ai->GetMaster(); if (!pMaster) return false; 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 ((MARK_OF_THE_WILD > 0) && (!m_bot->HasAura(MARK_OF_THE_WILD, EFFECT_INDEX_0)) && (ai->CastSpell(MARK_OF_THE_WILD, *m_bot))) return true; if ((THORNS > 0) && (!m_bot->HasAura(THORNS, EFFECT_INDEX_0)) && (ai->CastSpell(THORNS, *m_bot))) return true; if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* drinkOrFoodItem = ai->FindDrink(); Item* bandageItem = ai->FindBandage(); if (drinkOrFoodItem && (ai->GetManaPercent() < 30)) { ai->UseItem(*drinkOrFoodItem); ai->SetIgnoreUpdateTime(30); return true; } if (!drinkOrFoodItem && (INNERVATE > 0) && (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0)) && (ai->GetManaPercent() <= 70) && (ai->CastSpell(INNERVATE, *m_bot))) return true; if (!drinkOrFoodItem && (MANA_REJUVENATION > 0) && (!m_bot->HasAura(INNERVATE, EFFECT_INDEX_0)) && (!m_bot->HasAura(MANA_REJUVENATION, EFFECT_INDEX_0)) && (ai->GetManaPercent() <= 70) && (ai->CastSpell(MANA_REJUVENATION, *m_bot))) return true; if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); drinkOrFoodItem = ai->FindFood(); if (drinkOrFoodItem && (ai->GetHealthPercent() < 30)) { ai->UseItem(*drinkOrFoodItem); ai->SetIgnoreUpdateTime(30); return true; } if (!drinkOrFoodItem && bandageItem && (!m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0)) && (ai->GetHealthPercent() < 70)) { ai->UseItem(*bandageItem); ai->SetIgnoreUpdateTime(8); return true; } if (pMaster->GetGroup()) { Group::MemberSlotList const& groupSlot = pMaster->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(itr->guid); if (!tPlayer || !tPlayer->isAlive()) continue; if ((!tPlayer->HasAura(MARK_OF_THE_WILD, EFFECT_INDEX_0)) && (ai->CastSpell(MARK_OF_THE_WILD, *tPlayer))) return true; if (HealTarget(*tPlayer, tPlayer->GetHealth() * 100 / tPlayer->GetMaxHealth())) return true; } } return false; }
void PlayerbotShamanAI::DoNonCombatActions() { PlayerbotAI* ai = GetAI(); Player * m_bot = GetPlayerBot(); if (!m_bot) return; SpellSequence = SPELL_ENHANCEMENT; // buff master with EARTH_SHIELD if (EARTH_SHIELD > 0) (!GetMaster()->HasAura(EARTH_SHIELD, 0) && ai->CastSpell(EARTH_SHIELD,*(GetMaster())) ); // buff myself with WATER_SHIELD, LIGHTNING_SHIELD if (WATER_SHIELD > 0) (!m_bot->HasAura(WATER_SHIELD, 0) && !m_bot->HasAura(LIGHTNING_SHIELD, 0) && ai->CastSpell(WATER_SHIELD,*m_bot) ); else if (LIGHTNING_SHIELD > 0) (!m_bot->HasAura(LIGHTNING_SHIELD, 0) && !m_bot->HasAura(WATER_SHIELD, 0) && ai->CastSpell(LIGHTNING_SHIELD,*m_bot) ); /* // buff myself weapon if (ROCKBITER_WEAPON > 0) (!m_bot->HasAura(ROCKBITER_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && ai->CastSpell(ROCKBITER_WEAPON,*m_bot) ); else if (EARTHLIVING_WEAPON > 0) (!m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(WINDFURY_WEAPON,*m_bot) ); else if (WINDFURY_WEAPON > 0) (!m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(WINDFURY_WEAPON,*m_bot) ); else if (FLAMETONGUE_WEAPON > 0) (!m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(FLAMETONGUE_WEAPON,*m_bot) ); else if (FROSTBRAND_WEAPON > 0) (!m_bot->HasAura(FROSTBRAND_WEAPON, 0) && !m_bot->HasAura(EARTHLIVING_WEAPON, 0) && !m_bot->HasAura(WINDFURY_WEAPON, 0) && !m_bot->HasAura(FLAMETONGUE_WEAPON, 0) && !m_bot->HasAura(ROCKBITER_WEAPON, 0) && ai->CastSpell(FROSTBRAND_WEAPON,*m_bot) ); */ // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 30) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, 0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(*fItem); ai->SetIgnoreUpdateTime(8); return; } // heal master's group if (GetMaster()->GetGroup()) { Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(uint64 (itr->guid)); if( !tPlayer || !tPlayer->isAlive() ) continue; // heal (HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth())); } } } // end DoNonCombatActions
void PlayerbotShamanAI::DoNextCombatManeuver(Unit *pTarget) { PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: ai->CastSpell(LIGHTNING_BOLT); return; } // ------- Non Duel combat ---------- ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob <----changed Player *m_bot = GetPlayerBot(); Group *m_group = m_bot->GetGroup(); // Heal myself if (ai->GetHealthPercent() < 30 && ai->GetManaPercent() >= 32) { ai->CastSpell(HEALING_WAVE); } else if (ai->GetHealthPercent() < 50 && ai->GetManaPercent() >= 19) { ai->CastSpell(LESSER_HEALING_WAVE); } else if (ai->GetHealthPercent() < 70) HealTarget (*m_bot, ai->GetHealthPercent()); // Heal master uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth(); if (GetMaster()->isAlive()) { if (masterHP < 30 && ai->GetManaPercent() >= 32) ai->CastSpell(HEALING_WAVE, *(GetMaster())); else if (masterHP < 70) HealTarget (*GetMaster(), masterHP); } // Heal group if( m_group ) { Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *m_groupMember = sObjectMgr.GetPlayer( itr->guid ); if( !m_groupMember || !m_groupMember->isAlive() ) continue; uint32 memberHP = m_groupMember->GetHealth()*100 / m_groupMember->GetMaxHealth(); if( memberHP < 30 ) HealTarget( *m_groupMember, memberHP ); } } // Damage Spells ai->SetInFront( pTarget ); switch (SpellSequence) { case SPELL_ENHANCEMENT: if (STRENGTH_OF_EARTH_TOTEM > 0 && LastSpellEnhancement == 1 && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 13) { ai->CastSpell(STRENGTH_OF_EARTH_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (STONESKIN_TOTEM > 0 && LastSpellEnhancement == 5 && (!m_bot->HasAura(STONESKIN_TOTEM, 0)) && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 13) { ai->CastSpell(STONESKIN_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (FOCUSED > 0 && LastSpellEnhancement == 2) { ai->CastSpell(FOCUSED, *pTarget); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (FROST_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 10 && (!m_bot->HasAura(FROST_RESISTANCE_TOTEM, 0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && (!m_bot->HasAura(FLAMETONGUE_TOTEM, 0)) && ai->GetManaPercent() >= 10) { ai->CastSpell(FROST_RESISTANCE_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (FLAMETONGUE_TOTEM > 0 && LastSpellEnhancement == 15 && (!m_bot->HasAura(FLAMETONGUE_TOTEM, 0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && (!m_bot->HasAura(FROST_RESISTANCE_TOTEM, 0)) && ai->GetManaPercent() >= 14) { ai->CastSpell(FLAMETONGUE_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (FIRE_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 20 && (!m_bot->HasAura(FIRE_RESISTANCE_TOTEM, 0)) && (!m_bot->HasAura(HEALING_STREAM_TOTEM, 0)) && (!m_bot->HasAura(MANA_SPRING_TOTEM, 0)) && ai->GetManaPercent() >= 10) { ai->CastSpell(FIRE_RESISTANCE_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (GROUNDING_TOTEM > 0 && LastSpellEnhancement == 25 && (!m_bot->HasAura(GROUNDING_TOTEM, 0)) && (!m_bot->HasAura(WRATH_OF_AIR_TOTEM, 0)) && (!m_bot->HasAura(WIND_FURY_TOTEM, 0)) && ai->GetManaPercent() >= 5) { ai->CastSpell(GROUNDING_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (NATURE_RESISTANCE_TOTEM > 0 && LastSpellEnhancement == 30 && (!m_bot->HasAura(NATURE_RESISTANCE_TOTEM, 0)) && (!m_bot->HasAura(WRATH_OF_AIR_TOTEM, 0)) && (!m_bot->HasAura(GROUNDING_TOTEM, 0)) && (!m_bot->HasAura(WIND_FURY_TOTEM, 0)) && ai->GetManaPercent() >= 10) { ai->CastSpell(NATURE_RESISTANCE_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (WIND_FURY_TOTEM > 0 && LastSpellEnhancement == 35 && (!m_bot->HasAura(WIND_FURY_TOTEM, 0)) && (!m_bot->HasAura(WRATH_OF_AIR_TOTEM, 0)) && (!m_bot->HasAura(GROUNDING_TOTEM, 0)) && ai->GetManaPercent() >= 11) { ai->CastSpell(WIND_FURY_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (STORMSTRIKE > 0 && LastSpellEnhancement == 4 && (!pTarget->HasAura(STORMSTRIKE, 0)) && ai->GetManaPercent() >= 8) { ai->CastSpell(STORMSTRIKE, *pTarget); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (LAVA_LASH > 0 && LastSpellEnhancement == 6 && ai->GetManaPercent() >= 4) { ai->CastSpell(LAVA_LASH, *pTarget); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (FERAL_SPIRIT > 0 && LastSpellEnhancement == 7 && ai->GetManaPercent() >= 12) { ai->CastSpell(FERAL_SPIRIT); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (WRATH_OF_AIR_TOTEM > 0 && (!m_bot->HasAura(WRATH_OF_AIR_TOTEM, 0)) && (!m_bot->HasAura(GROUNDING_TOTEM, 0)) && LastSpellEnhancement == 40) { ai->CastSpell(WRATH_OF_AIR_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (EARTH_ELEMENTAL_TOTEM > 0 && LastSpellEnhancement == 45 && ai->GetManaPercent() >= 24) { ai->CastSpell(EARTH_ELEMENTAL_TOTEM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (BLOODLUST > 0 && LastSpellEnhancement == 8 && (!GetMaster()->HasAura(BLOODLUST, 0)) && ai->GetManaPercent() >= 26) { ai->CastSpell(BLOODLUST); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (HEROISM > 0 && LastSpellEnhancement == 10 && (!GetMaster()->HasAura(HEROISM, 0)) && ai->GetManaPercent() >= 26) { ai->CastSpell(HEROISM); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (SHAMANISTIC_RAGE > 0 && (!m_bot->HasAura(SHAMANISTIC_RAGE, 0)) && LastSpellEnhancement == 11) { ai->CastSpell(SHAMANISTIC_RAGE, *m_bot); SpellSequence = SPELL_RESTORATION; LastSpellEnhancement = LastSpellEnhancement +1; break; } else if (LastSpellEnhancement > 50) { LastSpellEnhancement = 1; SpellSequence = SPELL_RESTORATION; break; } LastSpellEnhancement = LastSpellEnhancement + 1; //SpellSequence = SPELL_RESTORATION; //break; case SPELL_RESTORATION: if (HEALING_STREAM_TOTEM > 0 && LastSpellRestoration < 3 && ai->GetHealthPercent() < 50 && (!m_bot->HasAura(HEALING_STREAM_TOTEM, 0)) && (!m_bot->HasAura(MANA_SPRING_TOTEM, 0)) && ai->GetManaPercent() >= 4) { ai->CastSpell(HEALING_STREAM_TOTEM); SpellSequence = SPELL_ELEMENTAL; LastSpellRestoration = LastSpellRestoration +1; break; } else if (MANA_SPRING_TOTEM > 0 && LastSpellRestoration < 4 && (!m_bot->HasAura(MANA_SPRING_TOTEM, 0)) && (!m_bot->HasAura(HEALING_STREAM_TOTEM, 0)) && ai->GetManaPercent() >= 5) { ai->CastSpell(MANA_SPRING_TOTEM); SpellSequence = SPELL_ELEMENTAL; LastSpellRestoration = LastSpellRestoration +1; break; } else if (MANA_TIDE_TOTEM > 0 && LastSpellRestoration < 5 && ai->GetManaPercent() < 50 && ai->GetManaPercent() >= 3) { ai->CastSpell(MANA_TIDE_TOTEM); SpellSequence = SPELL_ELEMENTAL; LastSpellRestoration = LastSpellRestoration +1; break; } /*else if (TREMOR_TOTEM > 0 && LastSpellRestoration < 6 && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 2) { ai->CastSpell(TREMOR_TOTEM); SpellSequence = SPELL_ELEMENTAL; LastSpellRestoration = LastSpellRestoration +1; break; }*/ else if (LastSpellRestoration > 6) { LastSpellRestoration = 0; SpellSequence = SPELL_ELEMENTAL; break; } LastSpellRestoration = LastSpellRestoration +1; //SpellSequence = SPELL_ELEMENTAL; //break; case SPELL_ELEMENTAL: if (LIGHTNING_BOLT > 0 && LastSpellElemental == 1 && ai->GetManaPercent() >= 13) { ai->CastSpell(LIGHTNING_BOLT, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (SEARING_TOTEM > 0 && LastSpellElemental == 2 && (!pTarget->HasAura(SEARING_TOTEM, 0)) && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && ai->GetManaPercent() >= 9) { ai->CastSpell(SEARING_TOTEM); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (STONECLAW_TOTEM > 0 && ai->GetHealthPercent() < 51 && LastSpellElemental == 3 && (!pTarget->HasAura(STONECLAW_TOTEM, 0)) && (!pTarget->HasAura(EARTHBIND_TOTEM, 0)) && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 8) { ai->CastSpell(STONECLAW_TOTEM); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (FLAME_SHOCK > 0 && LastSpellElemental == 4 && (!pTarget->HasAura(FLAME_SHOCK, 0)) && ai->GetManaPercent() >= 22) { ai->CastSpell(FLAME_SHOCK, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (LAVA_BURST > 0 && LastSpellElemental == 5 && (pTarget->HasAura(FLAME_SHOCK, 0)) && ai->GetManaPercent() >= 10) { ai->CastSpell(LAVA_BURST, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (MAGMA_TOTEM > 0 && LastSpellElemental == 6 && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && ai->GetManaPercent() >= 35) { ai->CastSpell(MAGMA_TOTEM); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (EARTHBIND_TOTEM > 0 && LastSpellElemental == 7 && (!pTarget->HasAura(EARTHBIND_TOTEM, 0)) && (!m_bot->HasAura(STRENGTH_OF_EARTH_TOTEM, 0)) && ai->GetManaPercent() >= 5) { ai->CastSpell(EARTHBIND_TOTEM); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (EARTH_SHOCK > 0 && LastSpellElemental == 8 && ai->GetManaPercent() >= 23) { ai->CastSpell(EARTH_SHOCK, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (PURGE > 0 && LastSpellElemental == 9 && ai->GetManaPercent() >= 8) { ai->CastSpell(PURGE, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (WIND_SHOCK > 0 && LastSpellElemental == 10 && ai->GetManaPercent() >= 8) { ai->CastSpell(WIND_SHOCK, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (FIRE_NOVA_TOTEM > 0 && LastSpellElemental == 11 && ai->GetManaPercent() >= 33) { ai->CastSpell(FIRE_NOVA_TOTEM); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (FROST_SHOCK > 0 && LastSpellElemental == 12 && (!pTarget->HasAura(FROST_SHOCK, 0)) && ai->GetManaPercent() >= 23) { ai->CastSpell(FROST_SHOCK, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (CHAIN_LIGHTNING > 0 && LastSpellElemental == 13 && ai->GetManaPercent() >= 33) { ai->CastSpell(CHAIN_LIGHTNING, *pTarget); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (TOTEM_OF_WRATH > 0 && LastSpellElemental == 14 && (!m_bot->HasAura(TOTEM_OF_WRATH, 0)) && ai->GetManaPercent() >= 5) { ai->CastSpell(TOTEM_OF_WRATH); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } else if (FIRE_ELEMENTAL_TOTEM > 0 && LastSpellElemental == 15 && ai->GetManaPercent() >= 23) { ai->CastSpell(FIRE_ELEMENTAL_TOTEM); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; } /*else if (HEX > 0 && LastSpellElemental == 16 && (!pTarget->HasAura(HEX, 0)) && ai->GetManaPercent() >= 3) { ai->CastSpell(HEX); SpellSequence = SPELL_ENHANCEMENT; LastSpellElemental = LastSpellElemental + 1; break; }*/ else if (LastSpellElemental > 16) { LastSpellElemental = 1; SpellSequence = SPELL_ENHANCEMENT; break; } else { LastSpellElemental = LastSpellElemental + 1; SpellSequence = SPELL_ENHANCEMENT; } } } // end DoNextCombatManeuver
void PlayerbotPaladinAI::DoNextCombatManeuver(Unit *pTarget){ PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: if (HAMMER_OF_JUSTICE > 0) { ai->CastSpell(HAMMER_OF_JUSTICE); } return; } // damage spells ai->SetInFront( pTarget ); Player *m_bot = GetPlayerBot(); //Shield master if low hp. uint32 masterHP = GetMaster()->GetHealth()*100 / GetMaster()->GetMaxHealth(); if (GetMaster()->isAlive()) { if (masterHP < 25 && HAND_OF_PROTECTION > 0 && !GetMaster()->HasAura(HAND_OF_PROTECTION, 0)) { ai->CastSpell(HAND_OF_PROTECTION, *(GetMaster())); } } if (SHADOW_RESISTANCE_AURA > 0 && !m_bot->HasAura(SHADOW_RESISTANCE_AURA, 0) && pTarget->getClass() == CLASS_WARLOCK) { GetAI()->CastSpell (SHADOW_RESISTANCE_AURA, *m_bot); } if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_WARRIOR) { GetAI()->CastSpell (DEVOTION_AURA, *m_bot); } if (FIRE_RESISTANCE_AURA > 0 && !m_bot->HasAura(FIRE_RESISTANCE_AURA, 0) && pTarget->getClass() == CLASS_MAGE) { GetAI()->CastSpell (FIRE_RESISTANCE_AURA, *m_bot); } if (RETRIBUTION_AURA > 0 && !m_bot->HasAura(RETRIBUTION_AURA, 0) && pTarget->getClass() == CLASS_PRIEST) { GetAI()->CastSpell (RETRIBUTION_AURA, *m_bot); } if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_SHAMAN) { GetAI()->CastSpell (DEVOTION_AURA, *m_bot); } if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_ROGUE) { GetAI()->CastSpell (DEVOTION_AURA, *m_bot); } if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, 0) && pTarget->getClass() == CLASS_PALADIN) { GetAI()->CastSpell (DEVOTION_AURA, *m_bot); } if (ai->GetHealthPercent() < 55) { SpellSequence = Healing; } else { SpellSequence = Combat; } switch (SpellSequence) { case Combat: //GetAI()->TellMaster("Combat"); if (JUDGEMENT_OF_LIGHT > 0 && CombatCounter < 1 && ai->GetManaPercent() >=15) { GetAI()->CastSpell (JUDGEMENT_OF_LIGHT, *pTarget); //GetAI()->TellMaster("Judgement"); CombatCounter++; break; } else if (SEAL_OF_COMMAND > 0 && CombatCounter < 2 && ai->GetManaPercent() >= 25) { GetAI()->CastSpell (SEAL_OF_COMMAND, *m_bot); //GetAI()->TellMaster("SealC"); CombatCounter++; break; } else if (HAMMER_OF_JUSTICE > 0 && CombatCounter < 3 && ai->GetManaPercent() >=15) { GetAI()->CastSpell (HAMMER_OF_JUSTICE, *pTarget); //GetAI()->TellMaster("Hammer"); CombatCounter++; break; } else if (CRUSADER_STRIKE > 0 && CombatCounter < 4 && ai->GetManaPercent() >=15) { GetAI()->CastSpell (CRUSADER_STRIKE, *pTarget); GetAI()->TellMaster("CStrike"); CombatCounter++; break; } else if (CombatCounter < 5) { CombatCounter = 0; //GetAI()->TellMaster("CombatCounter Reset"); break; } else { CombatCounter = 0; //GetAI()->TellMaster("Counter = 0"); break; } case Healing: //GetAI()->TellMaster("Healing"); if (HOLY_LIGHT > 0 && HealCounter < 1 && ai->GetHealthPercent() < 45 && ai->GetManaPercent() >= 20) { GetAI()->CastSpell (HOLY_LIGHT); //GetAI()->TellMaster("HLight1"); HealCounter++; break; } else if (HOLY_LIGHT > 0 && HealCounter < 2 && ai->GetHealthPercent() < 75 && ai->GetManaPercent() >= 20) { GetAI()->CastSpell (HOLY_LIGHT); //GetAI()->TellMaster("Hlight2"); HealCounter++; break; } else if (HealCounter < 3) { HealCounter = 0; //GetAI()->TellMaster("HealCounter Reset"); break; } else { HealCounter = 0; //GetAI()->TellMaster("Counter = 0"); break; } } if (HAMMER_OF_WRATH > 0 && pTarget->GetHealth() < pTarget->GetMaxHealth()*0.2 && ai->GetManaPercent() >=15) { ai->CastSpell(HAMMER_OF_WRATH, *pTarget); } if (AVENGING_WRATH > 0 && ai->GetManaPercent() >= 8) { ai->CastSpell(AVENGING_WRATH); } if (DIVINE_SHIELD > 0 && ai->GetHealthPercent() < 30 && ai->GetManaPercent() >= 3) { GetAI()->CastSpell(DIVINE_SHIELD, *m_bot); } }
void PlayerbotHunterAI::DoNonCombatActions() { PlayerbotAI *ai = GetAI(); Player *m_bot = GetPlayerBot(); if (!m_bot || !ai || m_bot->isDead()) { return; } //If Casting or Eating/Drinking return if (m_bot->HasUnitState(UNIT_STAT_CASTING)) { return; } if (m_bot->getStandState() == UNIT_STAND_STATE_SIT) { return; } // buff group if (CastSpell(TRUESHOT_AURA, m_bot)) { return; } //mana/hp check //Don't bother with eating, if low on hp, just let it heal themself if (m_bot->getRace() == (uint8) RACE_UNDEAD_PLAYER && ai->GetHealthPercent() < 75 && CastSpell(R_CANNIBALIZE,m_bot)) { return; } if (ai->GetManaPercent() < 20 || ai->GetHealthPercent() < 30) { ai->Feast(); } #pragma region Check Pet // check for pet if( PET_SUMMON>0 && !m_petSummonFailed && HasPet(m_bot) ) { // we can summon pet, and no critical summon errors before Pet *pet = m_bot->GetPet(); if( !pet ) { // summon pet if( PET_SUMMON>0 && ai->CastSpell(PET_SUMMON,m_bot) ) ai->TellMaster( "summoning pet." ); else { m_petSummonFailed = true; ai->TellMaster( "summon pet failed!" ); } } else if( pet->getDeathState() != ALIVE ) { // revive pet if( PET_REVIVE>0 && ai->GetManaPercent()>=80 && ai->CastSpell(PET_REVIVE,m_bot) ) ai->TellMaster( "reviving pet." ); } else if( ((float)pet->GetHealth()/(float)pet->GetMaxHealth()) < 0.5f ) { // heal pet when health lower 50% if( PET_MEND>0 && !pet->getDeathState() != ALIVE && !pet->HasAura(PET_MEND,0) && ai->GetManaPercent()>=13 && ai->CastSpell(PET_MEND,m_bot) ) ai->TellMaster( "healing pet." ); } else if(pet->GetHappinessState() != HAPPY) // if pet is hungry { Unit *caster = (Unit*)m_bot; // list out items in main backpack for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; slot++) { Item* const pItem = m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (pItem) { const ItemTemplate* const pItemProto = pItem->GetTemplate(); if (!pItemProto ) continue; if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet { //sLog.outDebug("Food for pet: %s",pItemProto->Name1); caster->CastSpell(caster,51284,true); // pet feed visual uint32 count = 1; // number of items used int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet ai->TellMaster( "feeding pet." ); ai->SetIgnoreUpdateTime(10); return; } } } // list out items in other removable backpacks for (uint8 bag = INVENTORY_SLOT_BAG_START; bag < INVENTORY_SLOT_BAG_END; ++bag) { const Bag* const pBag = (Bag*) m_bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag); if (pBag) { for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot) { Item* const pItem = m_bot->GetItemByPos(bag, slot); if (pItem) { const ItemTemplate* const pItemProto = pItem->GetTemplate(); if (!pItemProto ) continue; if(pet->HaveInDiet(pItemProto)) // is pItem in pets diet { //sLog.outDebug("Food for pet: %s",pItemProto->Name1); caster->CastSpell(caster,51284,true); // pet feed visual uint32 count = 1; // number of items used int32 benefit = pet->GetCurrentFoodBenefitLevel(pItemProto->ItemLevel); // nutritional value of food m_bot->DestroyItemCount(pItem,count,true); // remove item from inventory m_bot->CastCustomSpell(m_bot,PET_FEED,&benefit,NULL,NULL,true); // feed pet ai->TellMaster( "feeding pet." ); ai->SetIgnoreUpdateTime(10); return; } } } } } if( pet->HasAura(PET_MEND, 0) && !pet->HasAura(PET_FEED, 0)) ai->TellMaster( "..no pet food!" ); ai->SetIgnoreUpdateTime(7); } #pragma endregion } } // end DoNonCombatActions
void PlayerbotHunterAI::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); Pet *pet = m_bot->GetPet(); if (m_tank->GetGUID() == m_bot->GetGUID() && pet && pet->isAlive() && pet->isInCombat()) { m_tank = pet; } uint8 petThreat = 0; if (pet) { GetThreatPercent(pTarget,pet); } // switch (ai->GetScenarioType()) // { // case PlayerbotAI::SCENARIO_DUEL: // ai->CastSpell(RAPTOR_STRIKE); // return; // } // ------- Non Duel combat ---------- #pragma region Choose Target // Choose Target if (isUnderAttack()) // I am under attack { 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 #pragma region Pet Actions // Pet's own Actions if( pet && pet->isAlive() ) { // Setup pet if (pet->GetCharmInfo()->IsAtStay()) {pet->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW); } //Heal pet if ( ( ((float)pet->GetHealth()/(float)pet->GetMaxHealth()) < 0.5f ) && ( PET_MEND>0 && !pet->getDeathState() != ALIVE && pVictim != m_bot && CastSpell(PET_MEND,m_bot) )) { return; } // Set pet to attack hunter's attacker > its own attackers > hunter's target if (!pet->getVictim()) { pet->AI()->AttackStart(pTarget); } else if (isUnderAttack(m_bot)) { pet->AI()->AttackStart(pTarget); } //Always help hunter if she's under attack else if (pet->getVictim()->GetGUID() != pTarget->GetGUID() && !isUnderAttack(pet)) { pet->AI()->AttackStart(pTarget); } else if (isUnderAttack(pet)) // Pet is under attack and hunter has no attackers { if ( pet->getVictim()->getVictim() && pet->getVictim()->getVictim()->GetGUID() == pet->GetGUID() && pDist <= 2) { } // My target is almost up to me, no need to search else //Have to select nearest target { Unit *curAtt = GetNearestAttackerOf(pet,true); if (curAtt && (!pet->getVictim() || curAtt->GetGUID() != pet->getVictim()->GetGUID())) { pet->AI()->AttackStart(curAtt); //Attack nearest attacker } } //Actions to do under attack (Always tank it, and try to kill it, until someone (!= hunter) takes aggro back) //Hunter should help her pet whether main tank or not, unless she's being attacked (BEWARE Targeting Loop possibility) if (pet->getVictim() && !isUnderAttack(m_bot) && pet->getVictim()->GetGUID() != pTarget->GetGUID()) { m_bot->SetSelection(pet->getVictim()->GetGUID()); DoNextCombatManeuver(pet->getVictim()); //Restart new update to get variables fixed.. return; } } // Pet tanking behaviour if (pet->GetGUID() == m_tank->GetGUID() || isUnderAttack(m_bot) || isUnderAttack(pet)) { if (GROWL) pet->GetCharmInfo()->SetSpellAutocast(GROWL,true); //Autocast growl if (BAD_ATTITUDE) pet->GetCharmInfo()->SetSpellAutocast(BAD_ATTITUDE,true); if (COWER) pet->GetCharmInfo()->SetSpellAutocast(COWER,false); if (CastSpell(INTIMIDATION,m_bot)) { return; } } else { if (GROWL) pet->GetCharmInfo()->SetSpellAutocast(GROWL,false); //Do not try to get aggro if (BAD_ATTITUDE) pet->GetCharmInfo()->SetSpellAutocast(BAD_ATTITUDE,false); if (COWER) pet->GetCharmInfo()->SetSpellAutocast(COWER,true); //Autocast cower } // NORMAL PET dps attacks if (petThreat < threatThreshold || pet->GetGUID() == m_tank->GetGUID() || isUnderAttack(m_bot)) { if (CastSpell(KILL_COMMAND,m_bot)) { } else if (CastSpell(BESTIAL_WRATH,m_bot)) { } } // NETHERSHOCK DEMORALIZINGSCREECH } #pragma endregion // If there's a cast stop if(m_bot->HasUnitState(UNIT_STAT_CASTING)) return; // Cast CC breakers if any match found (does not work yet) // uint32 ccSpells[4] = { R_ESCAPE_ARTIST, R_EVERY_MAN_FOR_HIMSELF, R_WILL_OF_FORSAKEN, R_STONEFORM }; // if (castSelfCCBreakers(ccSpells)) { } //most of them dont have gcd #pragma region Evasive manuevers // Do evasive manuevers if under attack if (isUnderAttack()) { if (m_tank->GetGUID() == m_bot->GetGUID()) { } // i am tank and my pet is probably dead, so i have to face the attackers else if (CastSpell(FEIGN_DEATH,m_bot)) { return; } //avoid attack //else if (m_bot->getRace() == (uint8) RACE_NIGHTELF && CastSpell(R_SHADOWMELD,m_bot) ) { return; } else if (CastSpell(CONCUSSIVE_SHOT,pTarget)) { return; } else if (CastSpell(WYVERN_STING,pTarget)) { return; } else if (CastSpell(SCATTER_SHOT,pTarget)) { return; } else if (CastSpell(FREEZING_ARROW,pTarget)) { return; } else if (CastSpell(MISDIRECTION,m_tank)) { return; } else if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget) ) { return; } //no gcd but is cast else if (pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_BEAST && CastSpell(SCARE_BEAST,pTarget)) { return; } else if (pDist <= 2 && CastSpell(FREEZING_TRAP,pTarget)) { return; } } #pragma endregion //Select combat mode m_role = BOT_ROLE_DPS_RANGED; if ((isUnderAttack() && pDist <= ATTACK_DISTANCE) || !m_bot->GetUInt32Value(PLAYER_AMMO_ID) ) { m_role = BOT_ROLE_DPS_MELEE; } TakePosition(pTarget); #pragma region Buff / Protect //Buff 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(TRUESHOT_AURA, m_bot)) { return; } if (CastSpell(RAPID_FIRE,m_bot)) { return; } if (CastSpell(HUNTERS_MARK,pTarget)) { return; } if ((ai->GetHealthPercent() < 80 || ai->GetManaPercent() < 60 ) && CastSpell(READINESS,m_bot)) { } //no gcd //Protect yourself if needed if (m_bot->getRace() == (uint8) RACE_DWARF && ai->GetHealthPercent() < 75 && CastSpell(R_STONEFORM,m_bot) ) { } //no gcd if (ai->GetHealthPercent() < 20 && CastSpell(DETERRENCE,m_bot)) {} //No GCD if (m_bot->getRace() == (uint8) RACE_DRAENEI && ai->GetHealthPercent() < 55 && CastSpell(R_GIFT_OF_NAARU,m_bot)) { return; } //Break Spells if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && ( pTarget->IsNonMeleeSpellCasted(true) || ai->GetManaPercent() < 20 ) && CastSpell(R_ARCANE_TORRENT, pTarget) ) { } //no gcd if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(SILENCING_SHOT, pTarget) ) { return; } if (pTarget->IsNonMeleeSpellCasted(true) && CastSpell(SCATTER_SHOT, pTarget) ) { return; } //Catch if (pTarget->HasUnitMovementFlag(UNIT_FLAG_FLEEING)) { if (CastSpell(WING_CLIP,pTarget)) return; if (CastSpell(CONCUSSIVE_SHOT,pTarget)) return; if (CastSpell(SCATTER_SHOT, pTarget) ) { return; } } #pragma endregion //Do combat switch (m_role) { #pragma region BOT_ROLE_DPS_MELEE case BOT_ROLE_DPS_MELEE: if (AUTO_SHOT) { m_bot->InterruptNonMeleeSpells( true, AUTO_SHOT ); } //Stop autoshot if (CastSpell(ASPECT_OF_THE_MONKEY,m_bot)) { return; } //Get Monkey aspect if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; } //no gcd but is cast // Threat control if (pThreat < threatThreshold || m_tank->GetGUID() == m_bot->GetGUID() || m_bot->HasAura(MISDIRECTION) ) { } //Continue attack else { if (pet && isUnderAttack(pet) && pet->getVictim() && pet->getVictim()->GetGUID() != pTarget->GetGUID()) //Should be helping pet { m_bot->SetSelection(pet->getVictim()->GetGUID()); return; } else 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(FEIGN_DEATH,m_bot)) { return; } else { return; } // No more threat reducing spells, just slow down } if (CastSpell(RAPTOR_STRIKE,pTarget,true,true)) {} //No gcd if (CastSpell(MONGOOSE_BITE,pTarget,true,true)) { return; } // Cannot be sure if casted or not else if (CastSpell(COUNTERATTACK,pTarget,true,true)) { return; } // Cannot be sure if casted or not if (CastSpell(WING_CLIP,pTarget)) { return; } if (isUnderAttack(m_tank,6) && CastSpell(SNAKE_TRAP,m_bot)) { return; } if (isUnderAttack(m_tank,4) && CastSpell(EXPLOSIVE_TRAP,m_bot)) { return; } if (CastSpell(IMMOLATION_TRAP,m_bot)) { return; } break; #pragma endregion #pragma region BOT_ROLE_DPS_RANGED case BOT_ROLE_DPS_RANGED: if (m_pulling) { if (GetAI()->CastSpell(CONCUSSIVE_SHOT,pTarget) || GetAI()->CastSpell(AUTO_SHOT,pTarget)) { m_pulling = false; GetAI()->SetCombatOrder(ORDERS_NONE); GetAI()->Follow(*GetMaster()); GetAI()->SetIgnoreUpdateTime(2); if(HasPet(GetPlayerBot())) m_bot->GetPet()->SetReactState(REACT_DEFENSIVE); } return; } if (AUTO_SHOT && !m_bot->FindCurrentSpellBySpellId(AUTO_SHOT)) { ai->CastSpell(AUTO_SHOT,pTarget); } //Start autoshot if (!(ai->GetManaPercent() < 85 && m_bot->HasAura(ASPECT_OF_THE_VIPER)) && CastSpell(ASPECT_OF_THE_HAWK,m_bot)) { return; } //Get Hawk aspect if ((ai->GetManaPercent() < 25) && CastSpell(ASPECT_OF_THE_VIPER,m_bot,true,false,true)) { return; } //Build up mana // 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 && CastSpell(DISTRACTING_SHOT, curAtt)) { return; } // My target is not attacking me, taunt.. if (pVictim && pVictim->GetGUID() != m_bot->GetGUID() && CastSpell(DISTRACTING_SHOT, pTarget) ) { return; } } // If i am not tank, transfer threat to tank or pet.. else { if (CastSpell(MISDIRECTION,m_tank)) { return; } if (pet && pet->isAlive() && CastSpell(MISDIRECTION,pet)) { return; } // Threat control if (pThreat < threatThreshold || m_bot->HasAura(MISDIRECTION) ) { } //Continue attack else { if (pet && isUnderAttack(pet) && pet->getVictim() && pet->getVictim()->GetGUID() != pTarget->GetGUID()) //Should be helping pet { m_bot->SetSelection(pet->getVictim()->GetGUID()); return; } else 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(FEIGN_DEATH,m_bot)) { return; } else { return; } // No more threat reducing spells, just slow down } } // DO dps if (ai->GetHealthPercent(*pTarget) < 20 && CastSpell(KILL_SHOT,pTarget)) { return; } if (isUnderAttack(m_tank,4) && CastSpell(MULTI_SHOT,pTarget)) { return; } if (isUnderAttack(m_tank,4) && CastSpell(VOLLEY,pTarget)) { GetAI()->SetIgnoreUpdateTime(7); return; } if (CanCast(CHIMERA_SHOT,pTarget) && (pTarget->HasAura(VIPER_STING,m_bot->GetGUID()) || pTarget->HasAura(SERPENT_STING,m_bot->GetGUID()) ) && CastSpell(CHIMERA_SHOT,pTarget,false) ) { return; } if (ai->GetManaPercent() < 60 && ai->GetManaPercent(*pTarget) > 4 && CastSpell(VIPER_STING,pTarget)) { return; } if (!pTarget->HasAura(VIPER_STING,m_bot->GetGUID()) && CastSpell(SERPENT_STING,pTarget)) { return; } if (CastSpell(ARCANE_SHOT,pTarget)) { return; } if (CastSpell(BLACK_ARROW,pTarget)) { return; } if (CastSpell(EXPLOSIVE_SHOT,pTarget)) { return; } if (CastSpell(STEADY_SHOT,pTarget)) { return; } break; #pragma endregion } /*// 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); } }*/ } // end DoNextCombatManeuver
void PlayerbotMageAI::DoNextCombatManeuver(Unit *pTarget) { PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: if (FIREBALL > 0) ai->CastSpell(FIREBALL); return; default: break; } // ------- Non Duel combat ---------- // Damage Spells (primitive example) Player *m_bot = GetPlayerBot(); Unit* pVictim = pTarget->getVictim(); float dist = m_bot->GetCombatDistance(pTarget); switch (SpellSequence) { case SPELL_FROST: if (ICY_VEINS > 0 && !m_bot->HasAura(ICY_VEINS, EFFECT_INDEX_0) && LastSpellFrost < 1 && ai->GetManaPercent() >= 3) { ai->CastSpell(ICY_VEINS, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (FROSTBOLT > 0 && LastSpellFrost < 2 && !pTarget->HasAura(FROSTBOLT, EFFECT_INDEX_0) && ai->GetManaPercent() >= 16) { ai->CastSpell(FROSTBOLT, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (FROST_WARD > 0 && LastSpellFrost < 3 && !m_bot->HasAura(FROST_WARD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 19) { ai->CastSpell(FROST_WARD, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (FROST_NOVA > 0 && LastSpellFrost < 4 && dist <= ATTACK_DISTANCE && !pTarget->HasAura(FROST_NOVA, EFFECT_INDEX_0) && ai->GetManaPercent() >= 10) { ai->CastSpell(FROST_NOVA, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (ICE_LANCE > 0 && LastSpellFrost < 5 && ai->GetManaPercent() >= 7) { ai->CastSpell(ICE_LANCE, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (BLIZZARD > 0 && LastSpellFrost < 6 && ai->GetAttackerCount() >= 5 && ai->GetManaPercent() >= 89) { ai->CastSpell(BLIZZARD, *pTarget); ai->SetIgnoreUpdateTime(8); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (CONE_OF_COLD > 0 && LastSpellFrost < 7 && dist <= ATTACK_DISTANCE && !pTarget->HasAura(CONE_OF_COLD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 35) { ai->CastSpell(CONE_OF_COLD, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (DEEP_FREEZE > 0 && LastSpellFrost < 8 && pTarget->HasAura(AURA_STATE_FROZEN, EFFECT_INDEX_0) && !pTarget->HasAura(DEEP_FREEZE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 9) { ai->CastSpell(DEEP_FREEZE, *pTarget); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (ICE_BARRIER > 0 && LastSpellFrost < 9 && pVictim == m_bot && !m_bot->HasAura(ICE_BARRIER, EFFECT_INDEX_0) && ai->GetHealthPercent() < 50 && ai->GetManaPercent() >= 30) { ai->CastSpell(ICE_BARRIER, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (SUMMON_WATER_ELEMENTAL > 0 && LastSpellFrost < 10 && ai->GetManaPercent() >= 16) { ai->CastSpell(SUMMON_WATER_ELEMENTAL); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (ICE_BLOCK > 0 && LastSpellFrost < 11 && pVictim == m_bot && !m_bot->HasAura(ICE_BLOCK, EFFECT_INDEX_0) && ai->GetHealthPercent() < 30) { ai->CastSpell(ICE_BLOCK, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } else if (COLD_SNAP > 0 && LastSpellFrost < 12) { ai->CastSpell(COLD_SNAP, *m_bot); SpellSequence = SPELL_FIRE; LastSpellFrost = LastSpellFrost + 1; break; } LastSpellFrost = 0; //SpellSequence = SPELL_FIRE; /* no break */ case SPELL_FIRE: if (FIRE_WARD > 0 && !m_bot->HasAura(FIRE_WARD, EFFECT_INDEX_0) && LastSpellFire < 1 && ai->GetManaPercent() >= 3) { ai->CastSpell(FIRE_WARD, *m_bot); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (COMBUSTION > 0 && !m_bot->HasAura(COMBUSTION, EFFECT_INDEX_0) && LastSpellFire < 2) { ai->CastSpell(COMBUSTION, *m_bot); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (FIREBALL > 0 && LastSpellFire < 3 && ai->GetManaPercent() >= 23) { ai->CastSpell(FIREBALL, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (FIRE_BLAST > 0 && LastSpellFire < 4 && ai->GetManaPercent() >= 25) { ai->CastSpell(FIRE_BLAST, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (FLAMESTRIKE > 0 && LastSpellFire < 5 && ai->GetManaPercent() >= 35) { ai->CastSpell(FLAMESTRIKE, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (SCORCH > 0 && LastSpellFire < 6 && ai->GetManaPercent() >= 10) { ai->CastSpell(SCORCH, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (PYROBLAST > 0 && LastSpellFire < 7 && !pTarget->HasAura(PYROBLAST, EFFECT_INDEX_0) && ai->GetManaPercent() >= 27) { ai->CastSpell(PYROBLAST, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (BLAST_WAVE > 0 && LastSpellFire < 8 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 34) { ai->CastSpell(BLAST_WAVE, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (DRAGONS_BREATH > 0 && LastSpellFire < 9 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 37) { ai->CastSpell(DRAGONS_BREATH, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (LIVING_BOMB > 0 && LastSpellFire < 10 && !pTarget->HasAura(LIVING_BOMB, EFFECT_INDEX_0) && ai->GetManaPercent() >= 27) { ai->CastSpell(LIVING_BOMB, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } else if (FROSTFIRE_BOLT > 0 && LastSpellFire < 11 && !pTarget->HasAura(FROSTFIRE_BOLT, EFFECT_INDEX_0) && ai->GetManaPercent() >= 14) { ai->CastSpell(FROSTFIRE_BOLT, *pTarget); SpellSequence = SPELL_ARCANE; LastSpellFire = LastSpellFire + 1; break; } LastSpellFire = 0; //SpellSequence = SPELL_ARCANE; /* no break */ case SPELL_ARCANE: if (ARCANE_POWER > 0 && LastSpellArcane < 1 && ai->GetManaPercent() >= 37) { ai->CastSpell(ARCANE_POWER, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (ARCANE_MISSILES > 0 && LastSpellArcane < 2 && ai->GetManaPercent() >= 37) { ai->CastSpell(ARCANE_MISSILES, *pTarget); ai->SetIgnoreUpdateTime(3); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (ARCANE_EXPLOSION > 0 && LastSpellArcane < 3 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 27) { ai->CastSpell(ARCANE_EXPLOSION, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (COUNTERSPELL > 0 && pTarget->IsNonMeleeSpellCasted(true) && LastSpellArcane < 4 && ai->GetManaPercent() >= 9) { ai->CastSpell(COUNTERSPELL, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (SLOW > 0 && LastSpellArcane < 5 && !pTarget->HasAura(SLOW, EFFECT_INDEX_0) && ai->GetManaPercent() >= 12) { ai->CastSpell(SLOW, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (ARCANE_BARRAGE > 0 && LastSpellArcane < 6 && ai->GetManaPercent() >= 27) { ai->CastSpell(ARCANE_BARRAGE, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (ARCANE_BLAST > 0 && LastSpellArcane < 7 && ai->GetManaPercent() >= 8) { ai->CastSpell(ARCANE_BLAST, *pTarget); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (MIRROR_IMAGE > 0 && LastSpellArcane < 8 && ai->GetManaPercent() >= 10) { ai->CastSpell(MIRROR_IMAGE); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else if (MANA_SHIELD > 0 && LastSpellArcane < 9 && ai->GetHealthPercent() < 70 && pVictim == m_bot && !m_bot->HasAura(MANA_SHIELD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8) { ai->CastSpell(MANA_SHIELD, *m_bot); SpellSequence = SPELL_FROST; LastSpellArcane = LastSpellArcane + 1; break; } else { LastSpellArcane = 0; SpellSequence = SPELL_FROST; } break; default: break; } } // end DoNextCombatManeuver
bool PlayerbotDruidAI::HealTarget(Unit &target, uint8 hp) { PlayerbotAI* ai = GetAI(); if (!ai) return false; Player* pMaster = ai->GetMaster(); if (!pMaster) return false; Player *m_bot = GetPlayerBot(); if ((hp < 70) && (REJUVENATION > 0) && (!target.HasAura(REJUVENATION, EFFECT_INDEX_0)) && (!target.HasAura(REGROWTH, EFFECT_INDEX_0)) && (ai->GetManaPercent() >= 21) && (ai->CastSpell(REJUVENATION, target))) return true; if ((hp < 60) && (LIFEBLOOM > 0) && (!target.HasAura(LIFEBLOOM, EFFECT_INDEX_0)) && (ai->GetManaPercent() >= 28) && (ai->CastSpell(LIFEBLOOM, target))) return true; if ((hp < 55) && (REGROWTH > 0) && (!target.HasAura(REGROWTH, EFFECT_INDEX_0)) && (!target.HasAura(REJUVENATION, EFFECT_INDEX_0)) && (ai->GetManaPercent() >= 33) && (ai->CastSpell(REGROWTH, target))) return true; if ((hp < 50) && (SWIFTMEND > 0) && (target.HasAura(REJUVENATION, EFFECT_INDEX_0) || target.HasAura(REGROWTH, EFFECT_INDEX_0)) && (ai->GetManaPercent() >= 16) && (ai->CastSpell(SWIFTMEND, target))) return true; if ((hp < 45) && (WILD_GROWTH > 0) && (!target.HasAura(WILD_GROWTH, EFFECT_INDEX_0)) && (ai->GetManaPercent() >= 26) && (ai->CastSpell(WILD_GROWTH, target))) return true; if ((hp < 30) && (NOURISH > 0) && (ai->GetManaPercent() >= 18) && (ai->CastSpell(NOURISH, target))) return true; if ((hp < 25) && (HEALING_TOUCH > 0) && (ai->GetManaPercent() >= 38) && (ai->CastSpell(HEALING_TOUCH, target))) return true; return false; }
void PlayerbotPaladinAI::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); // Fill mana if needed if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && ai->GetManaPercent() < 20 && CastSpell(R_ARCANE_TORRENT, pTarget)) { } //no gcd if (ai->GetManaPercent() < 30 && CastSpell (DIVINE_PLEA, m_bot)) { return; } // If hp is too low divine shield if (ai->GetHealthPercent() < 20 && (!m_bot->HasAura(DIVINE_SHIELD) || !m_bot->HasAura(HOP) || !m_bot->HasAura(SACRED_SHIELD))) { if (!m_bot->HasAura(FORBEARANCE)) { if (CastSpell(DIVINE_SHIELD,m_bot)) { return; } if (CastSpell(HOP,m_bot)) { return; } } else if (CastSpell(SACRED_SHIELD,m_bot)) { return; } } // if i am under attack and if i am not tank or offtank: change target if needed if (m_tank->GetGUID() != m_bot->GetGUID() && !TALENT_PROT && isUnderAttack() ) { // Keep hitting but reduce threat if (CastSpell(HOS,m_bot,true,true)) { } //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 region Choose Actions // Choose actions accoring to talents if (m_tank->GetGUID() == m_bot->GetGUID()) // Hey! I am Main Tank { if (TALENT_PROT) { m_role=BOT_ROLE_TANK; } //Just Keep Tanking else { if (TALENT_RETRI) { if ((ai->GetHealthPercent() <= 40 || masterHP <40 ) && (ai->GetManaPercent() >= 40)) { m_role = BOT_ROLE_SUPPORT; } else if (OwnPartyHP < 40 && ai->GetManaPercent() >= 30) { m_role = BOT_ROLE_SUPPORT; } else { m_role = BOT_ROLE_TANK; } //have no shield but can tank if you think so } else if (TALENT_HOLY) //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 m_role = BOT_ROLE_TANK; } else { m_role = BOT_ROLE_TANK; } //Unknown build or low level } } else if (TALENT_RETRI) { if ((ai->GetHealthPercent() <= 40 || masterHP <40 ) && (ai->GetManaPercent() >= 40)) { m_role = BOT_ROLE_SUPPORT; } else if (OwnPartyHP < 40 && ai->GetManaPercent() >= 30) {m_role = BOT_ROLE_SUPPORT;} else { m_role = BOT_ROLE_DPS_MELEE; } } else if (TALENT_PROT) { if ((ai->GetHealthPercent() <= 30 || masterHP <40 ) && (ai->GetManaPercent() >= 20)) { m_role = BOT_ROLE_SUPPORT; } else if (OwnPartyHP < 40 && ai->GetManaPercent() >= 40) { m_role = BOT_ROLE_SUPPORT; } else { m_role = BOT_ROLE_OFFTANK; } } else if (TALENT_HOLY) { m_role = BOT_ROLE_SUPPORT; } else { m_role = BOT_ROLE_DPS_MELEE; } //Unknown build or low level.. Mainly attack //takepos if (m_role == BOT_ROLE_SUPPORT || m_role == BOT_ROLE_HEALER) TakePosition(pTarget,BOT_ROLE_DPS_MELEE,0.5f); else TakePosition(pTarget,m_role); // If there's a cast stop if(m_bot->HasUnitState(UNIT_STATE_CASTING)) return; Unit *target = DoSelectLowestHpFriendly(40, 1000); switch(m_role) { #pragma region BOT_ROLE_SUPPORT case BOT_ROLE_SUPPORT: ChangeAura(CONCENTRATION_AURA); if (!TALENT_PROT && m_tank->GetGUID() != m_bot->GetGUID()) m_bot->RemoveAurasDueToSpell(RIGHTEOUS_FURY); // Choose Seal if (SOW && ai->GetManaPercent() <= 30) { if (CastSpell(SOW,m_bot)) { return; } } else if (m_bot->HasAura(SOW) && ai->GetManaPercent() < 85) { } // Paladin was striving for mana, keep until he got most of his mana back else if(SOL && ai->GetHealthPercent() < 40) { if(CastSpell(SOL,m_bot)) { return; } } else if(CastSpell(SOR, m_bot)) { return; } if (!m_bot->HasAura(FORBEARANCE) && CastSpell(AVENGING_WRATH,m_bot)) { } // no gcd if (DoSupportRaid(m_bot)) { return; } //heal pets and bots if(target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth()) ) { return; } if (ai->GetManaPercent() <= 80 && CastSpell(JOW,pTarget,true,true)) { return; } // Use Spells only if mana is sufficient.. if(ai->GetManaPercent() < offensiveSpellThreshold ) return; break; #pragma endregion #pragma region BOT_ROLE_TANK / BOT_ROLE_OFFTANK case BOT_ROLE_TANK: case BOT_ROLE_OFFTANK: ChangeAura(DEVOTION_AURA); if (CastSpell(RIGHTEOUS_FURY,m_bot)) { return; } // Choose Seal if (SOW && ai->GetManaPercent() <= 30) { if (CastSpell(SOW,m_bot)) { return; } } else if (m_bot->HasAura(SOW) && ai->GetManaPercent() < 85) { } // Paladin was striving for mana, keep until he got most of his mana back else if (SOL && ai->GetHealthPercent() < 40) { if (CastSpell(SOL,m_bot)) { return; } } else if (CastSpell(SOR,m_bot)) { return; } // We are tank/offtank threat is not an issiue; // Use taunts only if helping target is not main tank.. // Taunt if needed (Only for master) if(GetMaster()->GetGUID() != m_tank->GetGUID()) { // Taunt if needed (Only for master) Unit *curAtt = GetAttackerOf(GetMaster()); if (curAtt) { if (isUnderAttack(GetMaster(),2) && CastSpell(RIGHTEOUS_DEFENSE, GetMaster())) { return; } if (CastSpell(HOR, curAtt,true,true)) { } //No GCD } } // My target is not attacking me, taunt.. if ( m_tank->GetGUID() == m_bot->GetGUID() && pVictim && pVictim->GetGUID() != m_bot->GetGUID() && CastSpell(HOR, pTarget,true,true) ) { } //NO GCD // Tank specials if (TALENT_PROT && ai->GetManaPercent() < 90 && CastSpell (DIVINE_PLEA, m_bot)) { return; } //Prot paladin always uses this.. if (pVictim && pVictim->GetGUID() == m_bot->GetGUID() && CastSpell(HOLY_SHIELD,m_bot)) { return; } if (CastSpell(AVENGERS_SHIELD,pTarget,true,true)) { return; } if (CastSpell(HOTR,pTarget,true,true)) { return; } if (CastSpell(HOLY_WRATH,pTarget,true,true)){ return; } if (CastSpell(CONSECRATION,pTarget)) { return; } if (m_bot->getRace() == (uint8) RACE_DWARF && CastSpell(R_STONEFORM,m_bot)) { return; } if (DoSupportRaid(m_bot)) { return; } //heal pets and bots if(target && target->isAlive() && HealTarget(target, target->GetHealth()*100 / target->GetMaxHealth()) ) { return; } break; #pragma endregion #pragma region BOT_ROLE_DPS_MELEE case BOT_ROLE_DPS_MELEE: ChangeAura(RETRIBUTION_AURA); if (!TALENT_PROT && m_tank->GetGUID() != m_bot->GetGUID()) m_bot->RemoveAurasDueToSpell(RIGHTEOUS_FURY); if (CastSpell(SOV,m_bot)) { return; } if (CastSpell (HAMMER_OF_JUSTICE, pTarget)) { return; } if (!m_bot->HasAura(FORBEARANCE) && CastSpell(AVENGING_WRATH,m_bot)) {} //no gcd if (CastSpell(JOW,pTarget)) { return; } if (CastSpell(DIVINE_STORM, pTarget)) { return; } if (CastSpell(CRUSADER_STRIKE, pTarget)) { return; } if (GetAI()->GetHealthPercent(*pTarget)<20 && CastSpell(HAMMER_OF_WRATH, pTarget)) { return; } if (CastSpell(CONSECRATION,pTarget)) { return; } if (m_bot->HasAura(AOW) && CastSpell(EXORCISM,pTarget)) { return; } if (CastSpell(HOLY_WRATH,pTarget)) { return; } break; #pragma endregion } #pragma region PaladinCommon // Shared dps spells if (pTarget->GetCreatureType() == (uint32) CREATURE_TYPE_HUMANOID && pTarget->IsNonMeleeSpellCasted(true) && CastSpell (REPENTANCE, pTarget)) { return; } if (m_bot->getRace() == (uint8) RACE_BLOODELF && pDist < 8 && pTarget->IsNonMeleeSpellCasted(true) && CastSpell(R_ARCANE_TORRENT, pTarget)) { } //no gcd 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 at threat limit, stop if(pThreat > threatThreshold && !TALENT_PROT && 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(HOS,m_bot)) { return; } //Lets see if we can manage with HOS else { 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 (GetAI()->GetHealthPercent(*pTarget)<20 && CastSpell(HAMMER_OF_WRATH, pTarget,true,true)) { return; } //no gcd but cast if (CastSpell (HAMMER_OF_JUSTICE, pTarget)) { return; } if (CanCast(JOW,pTarget,true) && ( ( ai->GetManaPercent() <= 70 && ai->GetHealthPercent() > 90) || ( ai->GetManaPercent() <= 50 && ai->GetHealthPercent() > 75) || ( ai->GetManaPercent() <= 20 && ai->GetHealthPercent() > 20) ) && CastSpell(JOW,pTarget,false)) { return; } else if (CastSpell(JOL,pTarget),true,true) { return; } if (CastSpell(SHIELD_OF_RIGHTEOUSNESS,pTarget,true,true)) { return; } if (CastSpell (DIVINE_STORM, pTarget,true,true)) { return; } if (CastSpell (CRUSADER_STRIKE, pTarget,true,true)) { return; } if (m_bot->getRace() == (uint8) RACE_TAUREN && pDist < 8 && CastSpell(R_WAR_STOMP, pTarget)) { return; } //no GCD but cast if (isUnderAttack(m_tank,4) && CastSpell(HOLY_WRATH,pTarget,true,true)) { return; } if (isUnderAttack(m_tank,4) && CastSpell(CONSECRATION,pTarget)) { return; } if (CastSpell(HOLY_SHOCK,pTarget,true,true)) { return; } if (m_role != BOT_ROLE_SUPPORT && ai->GetManaPercent() > 60 && OwnPartyHP < 65 && DoSupportRaid(m_bot)) { return; } //if there is spare time and mana, do healz and other stuff.. else if (m_role != BOT_ROLE_SUPPORT && ai->GetManaPercent() > 30 && DoSupportRaid(m_bot,30,false,false,false,true,false)) { return; } if (CastSpell(EXORCISM,pTarget,true,true)) { 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
void PlayerbotDruidAI::DoNonCombatActions() { PlayerbotAI* ai = GetAI(); Player * m_bot = GetPlayerBot(); if (!m_bot) return; if(m_bot->GetAura(CAT_FORM, 0)) { m_bot->RemoveAurasDueToSpell(768); ai->TellMaster("FormClearCat"); } if(m_bot->GetAura(BEAR_FORM, 0)) { m_bot->RemoveAurasDueToSpell(5487); ai->TellMaster("FormClearBear"); } if(m_bot->GetAura(DIRE_BEAR_FORM, 0)) { m_bot->RemoveAurasDueToSpell(9634); ai->TellMaster("FormClearDireBear"); } if(m_bot->GetAura(MOONKIN_FORM, 0)) { m_bot->RemoveAurasDueToSpell(24858); ai->TellMaster("FormClearMoonkin"); } /* // mana myself with MANA_REJUVENATION (*moved to combat: interferes with drinking/eating) if (GetAI()->GetManaPercent() < 50 && MANA_REJUVENATION > 0 && !m_bot->HasAura(MANA_REJUVENATION, 0)) GetAI()->CastSpell(MANA_REJUVENATION, *m_bot); */ // buff myself with MARK_OF_THE_WILD if (MARK_OF_THE_WILD > 0 && !m_bot->GetAura(MARK_OF_THE_WILD, 0)) ai->CastSpell (MARK_OF_THE_WILD, *m_bot); // Thorns generates aggro for moonkin if (THORNS > 0 && !m_bot->GetAura(THORNS, 0)) ai->CastSpell (THORNS, *m_bot); /* // buff master with THORNS if (THORNS > 0 && !GetMaster()->HasAura(THORNS,0)) ai->CastSpell (THORNS, *(GetMaster())); */ // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); if (pItem != NULL && ai->GetManaPercent() < 50) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } // buff and heal master's group if (GetMaster()->GetGroup()) { Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = objmgr.GetPlayer(uint64 (itr->guid)); if( !tPlayer ) continue; // first rezz em if ( !tPlayer->isAlive() && !tPlayer->GetPlayerbotAI() ) { std::string msg = "rezzing "; msg += tPlayer->GetName(); GetPlayerBot()->Say(msg, LANG_UNIVERSAL); ai->CastSpell(REVIVE, *tPlayer); // rez is only 10 sec, but give time for lag ai->SetIgnoreUpdateTime(17); } else if( tPlayer->isAlive() ) { // buff and heal (!tPlayer->GetAura(MARK_OF_THE_WILD,0) && ai->CastSpell (MARK_OF_THE_WILD, *tPlayer)); //(!tPlayer->HasAura(THORNS,0) && GetAI()->CastSpell (THORNS, *tPlayer)); (HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth())); return; } } } } // end DoNonCombatActions
void PlayerbotPaladinAI::DoNextCombatManeuver(Unit *pTarget) { Unit* pVictim = pTarget->getVictim(); PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: if (HAMMER_OF_JUSTICE > 0) ai->CastSpell(HAMMER_OF_JUSTICE); return; default: break; } // damage spells ai->SetInFront(pTarget); Player *m_bot = GetPlayerBot(); Group *m_group = m_bot->GetGroup(); float dist = m_bot->GetDistance(pTarget); std::ostringstream out; //Shield master if low hp. uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth(); if (GetMaster()->isAlive()) if (masterHP < 25 && HAND_OF_PROTECTION > 0 && !GetMaster()->HasAura(FORBEARANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(HAND_OF_PROTECTION, EFFECT_INDEX_0) && !GetMaster()->HasAura(DIVINE_PROTECTION, EFFECT_INDEX_0) && !GetMaster()->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0)) ai->CastSpell(HAND_OF_PROTECTION, *GetMaster()); // heal group inside combat, but do not heal if tank if (m_group && pVictim != m_bot) // possible tank { Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *m_groupMember = sObjectMgr.GetPlayer(itr->guid); if (!m_groupMember || !m_groupMember->isAlive()) continue; uint32 memberHP = m_groupMember->GetHealth() * 100 / m_groupMember->GetMaxHealth(); if (memberHP < 40 && ai->GetManaPercent() >= 40) // do not heal bots without plenty of mana for master & self if (HealTarget(m_groupMember)) return; } } if (RIGHTEOUS_FURY > 0 && !m_bot->HasAura(RIGHTEOUS_FURY, EFFECT_INDEX_0)) ai->CastSpell (RIGHTEOUS_FURY, *m_bot); if (SHADOW_RESISTANCE_AURA > 0 && !m_bot->HasAura(SHADOW_RESISTANCE_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_WARLOCK) ai->CastSpell (SHADOW_RESISTANCE_AURA, *m_bot); if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_WARRIOR) ai->CastSpell (DEVOTION_AURA, *m_bot); if (FIRE_RESISTANCE_AURA > 0 && !m_bot->HasAura(FIRE_RESISTANCE_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_MAGE) ai->CastSpell (FIRE_RESISTANCE_AURA, *m_bot); if (RETRIBUTION_AURA > 0 && !m_bot->HasAura(RETRIBUTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_PRIEST) ai->CastSpell (RETRIBUTION_AURA, *m_bot); if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_SHAMAN) ai->CastSpell (DEVOTION_AURA, *m_bot); if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_ROGUE) ai->CastSpell (DEVOTION_AURA, *m_bot); if (DEVOTION_AURA > 0 && !m_bot->HasAura(DEVOTION_AURA, EFFECT_INDEX_0) && pTarget->getClass() == CLASS_PALADIN) ai->CastSpell (DEVOTION_AURA, *m_bot); if (ai->GetHealthPercent() <= 40 || GetMaster()->GetHealth() <= GetMaster()->GetMaxHealth() * 0.4) SpellSequence = Healing; else SpellSequence = Combat; switch (SpellSequence) { case Combat: if (JUDGEMENT_OF_LIGHT > 0 && !pTarget->HasAura(JUDGEMENT_OF_LIGHT, EFFECT_INDEX_0) && CombatCounter < 1 && ai->GetManaPercent() >= 5) { ai->CastSpell (JUDGEMENT_OF_LIGHT, *pTarget); out << " Judgement of Light"; CombatCounter++; break; } else if (SEAL_OF_COMMAND > 0 && !m_bot->HasAura(SEAL_OF_COMMAND, EFFECT_INDEX_0) && CombatCounter < 2 && ai->GetManaPercent() >= 14) { ai->CastSpell (SEAL_OF_COMMAND, *m_bot); out << " Seal of Command"; CombatCounter++; break; } else if (HAMMER_OF_JUSTICE > 0 && !pTarget->HasAura(HAMMER_OF_JUSTICE, EFFECT_INDEX_0) && CombatCounter < 3 && ai->GetManaPercent() >= 3) { ai->CastSpell (HAMMER_OF_JUSTICE, *pTarget); out << " Hammer of Justice"; CombatCounter++; break; } else if (CRUSADER_STRIKE > 0 && CombatCounter < 4 && ai->GetManaPercent() >= 5) { ai->CastSpell (CRUSADER_STRIKE, *pTarget); out << " Crusader Strike"; CombatCounter++; break; } else if (AVENGING_WRATH > 0 && CombatCounter < 5 && !m_bot->HasAura(AVENGING_WRATH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8) { ai->CastSpell (AVENGING_WRATH, *m_bot); out << " Avenging Wrath"; CombatCounter++; break; } else if (SACRED_SHIELD > 0 && CombatCounter < 6 && pVictim == m_bot && ai->GetHealthPercent() < 70 && !m_bot->HasAura(SACRED_SHIELD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 12) { ai->CastSpell (SACRED_SHIELD, *m_bot); out << " Sacred Shield"; CombatCounter++; break; } else if (DIVINE_STORM > 0 && CombatCounter < 7 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 12) { ai->CastSpell (DIVINE_STORM, *pTarget); out << " Divine Storm"; CombatCounter++; break; } else if (HAMMER_OF_WRATH > 0 && CombatCounter < 8 && pTarget->GetHealth() < pTarget->GetMaxHealth() * 0.20 && ai->GetManaPercent() >= 14) { ai->CastSpell (HAMMER_OF_WRATH, *pTarget); out << " Hammer of Wrath"; CombatCounter++; break; } else if (HOLY_WRATH > 0 && CombatCounter < 9 && ai->GetAttackerCount() >= 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 24) { ai->CastSpell (HOLY_WRATH, *pTarget); out << " Holy Wrath"; CombatCounter++; break; } else if (HAND_OF_SACRIFICE > 0 && pVictim == GetMaster() && !GetMaster()->HasAura(HAND_OF_SACRIFICE, EFFECT_INDEX_0) && CombatCounter < 10 && ai->GetManaPercent() >= 6) { ai->CastSpell (HAND_OF_SACRIFICE, *GetMaster()); out << " Hand of Sacrifice"; CombatCounter++; break; } else if (DIVINE_PROTECTION > 0 && pVictim == m_bot && !m_bot->HasAura(FORBEARANCE, EFFECT_INDEX_0) && ai->GetHealthPercent() < 30 && CombatCounter < 11 && ai->GetManaPercent() >= 3) { ai->CastSpell (DIVINE_PROTECTION, *m_bot); out << " Divine Protection"; CombatCounter++; break; } else if (RIGHTEOUS_DEFENSE > 0 && pVictim != m_bot && ai->GetHealthPercent() > 70 && CombatCounter < 12) { ai->CastSpell (RIGHTEOUS_DEFENSE, *pTarget); out << " Righteous Defense"; CombatCounter++; break; } else if (DIVINE_PLEA > 0 && !m_bot->HasAura(DIVINE_PLEA, EFFECT_INDEX_0) && ai->GetManaPercent() < 50 && CombatCounter < 13) { ai->CastSpell (DIVINE_PLEA, *m_bot); out << " Divine Plea"; CombatCounter++; break; } else if (DIVINE_FAVOR > 0 && !m_bot->HasAura(DIVINE_FAVOR, EFFECT_INDEX_0) && CombatCounter < 14) { ai->CastSpell (DIVINE_FAVOR, *m_bot); out << " Divine Favor"; CombatCounter++; break; } else if (CombatCounter > 15) { CombatCounter = 0; //ai->TellMaster("CombatCounter Reset"); break; } else { CombatCounter = 0; //ai->TellMaster("Counter = 0"); break; } case Healing: if (ai->GetHealthPercent() <= 40) { HealTarget (m_bot); out << " ...healing bot"; break; } if (masterHP <= 40) { HealTarget (GetMaster()); out << " ...healing master"; break; } else { CombatCounter = 0; //ai->TellMaster("Counter = 0"); break; } } if (ai->GetManager()->m_confDebugWhisper) ai->TellMaster(out.str().c_str()); if (AVENGING_WRATH > 0 && !m_bot->HasAura(AVENGING_WRATH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 8) ai->CastSpell(AVENGING_WRATH, *m_bot); if (DIVINE_SHIELD > 0 && ai->GetHealthPercent() < 30 && pVictim == m_bot && !m_bot->HasAura(FORBEARANCE, EFFECT_INDEX_0) && !m_bot->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0) && ai->GetManaPercent() >= 3) ai->CastSpell(DIVINE_SHIELD, *m_bot); if (DIVINE_SACRIFICE > 0 && ai->GetHealthPercent() > 50 && pVictim != m_bot && !m_bot->HasAura(DIVINE_SACRIFICE, EFFECT_INDEX_0)) ai->CastSpell(DIVINE_SACRIFICE, *m_bot); }
void PlayerbotPaladinAI::DoNonCombatActions() { PlayerbotAI* ai = GetAI(); Player * m_bot = GetPlayerBot(); if (!m_bot) return; // buff myself if (GREATER_BLESSING_OF_MIGHT > 0 && !m_bot->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *m_bot); else if (BLESSING_OF_MIGHT > 0 && !m_bot->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !m_bot->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_MIGHT, *m_bot); if (DIVINE_FAVOR > 0 && !m_bot->HasAura(DIVINE_FAVOR, EFFECT_INDEX_0) && ai->GetManaPercent() >= 3) ai->CastSpell(DIVINE_FAVOR , *m_bot); /* if (SEAL_OF_COMMAND > 0) ai->CastSpell (SEAL_OF_COMMAND, *m_bot); // interferes with drinking/eating */ //Select Class buff seq. ///Process Who is my master --> get the player class --> aura already present if not then proced --> cast the spell //Priest if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PRIEST && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster())); if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PRIEST && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster())); //Mage if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_MAGE && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster())); if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_MAGE && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster())); //Paladin if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PALADIN && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster())); if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_PALADIN && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster())); //Warlock if (BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_WARLOCK && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_WISDOM, *(GetMaster())); if (GREATER_BLESSING_OF_WISDOM > 0 && GetMaster()->getClass() == CLASS_WARLOCK && !GetMaster()->HasAura(GREATER_BLESSING_OF_WISDOM, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_WISDOM, *(GetMaster())); //Warrior if (BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_MIGHT, *(GetMaster())); if (GREATER_BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(DEFENSIVE_STANCE, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *(GetMaster())); if (BLESSING_OF_KINGS > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_KINGS, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_KINGS, EFFECT_INDEX_0) && !GetMaster()->HasAura(BERSERKER_STANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(BATTLE_STANCE, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_KINGS, *(GetMaster())); if (GREATER_BLESSING_OF_KINGS > 0 && GetMaster()->getClass() == CLASS_WARRIOR && !GetMaster()->HasAura(GREATER_BLESSING_OF_KINGS, EFFECT_INDEX_0) && !GetMaster()->HasAura(BERSERKER_STANCE, EFFECT_INDEX_0) && !GetMaster()->HasAura(BATTLE_STANCE, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_KINGS, *(GetMaster())); //Rogue if (BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_ROGUE && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_MIGHT, *(GetMaster())); if (GREATER_BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_ROGUE && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *(GetMaster())); //Shaman if (BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_SHAMAN && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0) && !GetMaster()->HasAura(BLESSING_OF_MIGHT, EFFECT_INDEX_0)) ai->CastSpell (BLESSING_OF_MIGHT, *(GetMaster())); if (GREATER_BLESSING_OF_MIGHT > 0 && GetMaster()->getClass() == CLASS_SHAMAN && !GetMaster()->HasAura(GREATER_BLESSING_OF_MIGHT, EFFECT_INDEX_0)) ai->CastSpell (GREATER_BLESSING_OF_MIGHT, *(GetMaster())); // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 40) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } // hp check original if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 40) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(*fItem); ai->SetIgnoreUpdateTime(8); return; } // heal group if (GetMaster()->GetGroup()) { Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(uint64 (itr->guid)); if( !tPlayer || !tPlayer->isAlive() ) continue; // heal player (HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth())); } } }
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
void PlayerbotDruidAI::DoNonCombatActions() { Player * m_bot = GetPlayerBot(); Player * master = GetMaster(); if (!m_bot || !master) return; PlayerbotAI* ai = GetAI(); // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 30) { ai->TellMaster("I could use a drink."); ai->UseItem(pItem); return; } else if (!pItem && INNERVATE > 0 && !m_bot->HasAura(INNERVATE) && ai->GetManaPercent() <= 20 && ai->CastSpell(INNERVATE, *m_bot)) return; // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(pItem); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(fItem); return; } // buff and heal master's group if (master->GetGroup()) { // Buff master with group buff if (master->isAlive() && GIFT_OF_THE_WILD && ai->HasSpellReagents(GIFT_OF_THE_WILD) && ai->Buff(GIFT_OF_THE_WILD, master)) return; Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(itr->guid); if (!tPlayer || tPlayer == m_bot) continue; // Resurrect member if needed if (!tPlayer->isAlive()) { if (ai->CastSpell(REVIVE, *tPlayer)) { std::string msg = "Resurrecting "; msg += tPlayer->GetName(); m_bot->Say(msg, LANG_UNIVERSAL); return; } else continue; } else { // buff and heal if (BuffPlayer(tPlayer)) return; if (HealTarget(tPlayer)) return; } } } else { if (master->isAlive()) { if (BuffPlayer(master)) return; if (HealTarget(master)) return; } else if (ai->CastSpell(REVIVE, *master)) ai->TellMaster("Resurrecting you, Master."); } BuffPlayer(m_bot); } // end DoNonCombatActions
void PlayerbotWarlockAI::DoNextCombatManeuver(Unit *pTarget) { PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: if (SHADOW_BOLT > 0) ai->CastSpell(SHADOW_BOLT); return; } // ------- Non Duel combat ---------- //ai->SetMovementOrder( PlayerbotAI::MOVEMENT_FOLLOW, GetMaster() ); // dont want to melee mob ai->SetInFront( pTarget ); Player *m_bot = GetPlayerBot(); Unit* pVictim = pTarget->getVictim(); Pet *pet = m_bot->GetPet(); // Damage Spells ai->SetInFront( pTarget ); switch (SpellSequence) { case SPELL_CURSES: if (CURSE_OF_AGONY > 0 && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && LastSpellCurse < 1 && ai->GetManaPercent() >= 14) { ai->CastSpell(CURSE_OF_AGONY, *pTarget); SpellSequence = SPELL_AFFLICTION; LastSpellCurse = LastSpellCurse +1; break; } else if (CURSE_OF_THE_ELEMENTS > 0 && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && LastSpellCurse < 2 && ai->GetManaPercent() >= 10) { ai->CastSpell(CURSE_OF_THE_ELEMENTS, *pTarget); SpellSequence = SPELL_AFFLICTION; LastSpellCurse = LastSpellCurse +1; break; } else if (CURSE_OF_EXHAUSTION > 0 && !pTarget->HasAura(CURSE_OF_EXHAUSTION, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && LastSpellCurse < 3 && ai->GetManaPercent() >= 6) { ai->CastSpell(CURSE_OF_EXHAUSTION, *pTarget); SpellSequence = SPELL_AFFLICTION; LastSpellCurse = LastSpellCurse +1; break; } else if (CURSE_OF_WEAKNESS > 0 && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_EXHAUSTION, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && LastSpellCurse < 4 && ai->GetManaPercent() >= 14) { ai->CastSpell(CURSE_OF_WEAKNESS, *pTarget); SpellSequence = SPELL_AFFLICTION; LastSpellCurse = LastSpellCurse +1; break; } else if (CURSE_OF_TONGUES > 0 && !pTarget->HasAura(CURSE_OF_TONGUES, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_WEAKNESS, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_EXHAUSTION, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_AGONY, EFFECT_INDEX_0) && !pTarget->HasAura(CURSE_OF_THE_ELEMENTS, EFFECT_INDEX_0) && LastSpellCurse < 5 && ai->GetManaPercent() >= 4) { ai->CastSpell(CURSE_OF_TONGUES, *pTarget); SpellSequence = SPELL_AFFLICTION; LastSpellCurse = LastSpellCurse +1; break; } LastSpellCurse = 0; //SpellSequence = SPELL_AFFLICTION; //break; case SPELL_AFFLICTION: if (LIFE_TAP > 0 && LastSpellAffliction < 1 && ai->GetManaPercent() <= 50) { ai->CastSpell(LIFE_TAP, *m_bot); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (CORRUPTION > 0 && !pTarget->HasAura(CORRUPTION, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && LastSpellAffliction < 2 && ai->GetManaPercent() >= 19) { ai->CastSpell(CORRUPTION, *pTarget); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (DRAIN_SOUL > 0 && pTarget->GetHealth() < pTarget->GetMaxHealth()*0.40 && !pTarget->HasAura(DRAIN_SOUL, EFFECT_INDEX_0) && LastSpellAffliction < 3 && ai->GetManaPercent() >= 19) { ai->CastSpell(DRAIN_SOUL, *pTarget); ai->SetIgnoreUpdateTime(15); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (DRAIN_LIFE > 0 && LastSpellAffliction < 4 && !pTarget->HasAura(DRAIN_SOUL, EFFECT_INDEX_0) && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_LIFE, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_MANA, EFFECT_INDEX_0) && ai->GetHealthPercent() <= 70 && ai->GetManaPercent() >= 23) { ai->CastSpell(DRAIN_LIFE, *pTarget); ai->SetIgnoreUpdateTime(5); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (DRAIN_MANA > 0 && pTarget->GetPower(POWER_MANA) > 0 && !pTarget->HasAura(DRAIN_SOUL, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_MANA, EFFECT_INDEX_0) && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && !pTarget->HasAura(DRAIN_LIFE, EFFECT_INDEX_0) && LastSpellAffliction < 5 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 17) { ai->CastSpell(DRAIN_MANA, *pTarget); ai->SetIgnoreUpdateTime(5); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (UNSTABLE_AFFLICTION > 0 && LastSpellAffliction < 6 && !pTarget->HasAura(UNSTABLE_AFFLICTION, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && ai->GetManaPercent() >= 20) { ai->CastSpell(UNSTABLE_AFFLICTION, *pTarget); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (HAUNT > 0 && LastSpellAffliction < 7 && !pTarget->HasAura(HAUNT, EFFECT_INDEX_0) && ai->GetManaPercent() >= 12) { ai->CastSpell(HAUNT, *pTarget); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (ATROCITY > 0 && !pTarget->HasAura(ATROCITY, EFFECT_INDEX_0) && LastSpellAffliction < 8 && ai->GetManaPercent() >= 21) { ai->CastSpell(ATROCITY, *pTarget); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (SEED_OF_CORRUPTION > 0 && !pTarget->HasAura(SEED_OF_CORRUPTION, EFFECT_INDEX_0) && LastSpellAffliction < 9 && ai->GetManaPercent() >= 34) { ai->CastSpell(SEED_OF_CORRUPTION, *pTarget); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (HOWL_OF_TERROR > 0 && !pTarget->HasAura(HOWL_OF_TERROR, EFFECT_INDEX_0) && ai->GetAttackerCount()>3 && LastSpellAffliction < 10 && ai->GetManaPercent() >= 11) { ai->CastSpell(HOWL_OF_TERROR, *pTarget); ai->TellMaster("casting howl of terror!"); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if (FEAR > 0 && !pTarget->HasAura(FEAR, EFFECT_INDEX_0) && pVictim==m_bot && ai->GetAttackerCount()>=2 && LastSpellAffliction < 11 && ai->GetManaPercent() >= 12) { ai->CastSpell(FEAR, *pTarget); //ai->TellMaster("casting fear!"); ai->SetIgnoreUpdateTime(1.5); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } else if(( pet ) && (DARK_PACT > 0 && ai->GetManaPercent() <= 50 && LastSpellAffliction < 12 && pet->GetPower(POWER_MANA) > 0)) { ai->CastSpell(DARK_PACT, *m_bot); SpellSequence = SPELL_DESTRUCTION; LastSpellAffliction = LastSpellAffliction +1; break; } LastSpellAffliction = 0; //SpellSequence = SPELL_DESTRUCTION; //break; case SPELL_DESTRUCTION: if (SHADOWFURY > 0 && LastSpellDestruction < 1 && !pTarget->HasAura(SHADOWFURY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 37) { ai->CastSpell(SHADOWFURY, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (SHADOW_BOLT > 0 && LastSpellDestruction < 2 && ai->GetManaPercent() >= 23) { ai->CastSpell(SHADOW_BOLT, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (RAIN_OF_FIRE > 0 && LastSpellDestruction < 3 && ai->GetAttackerCount()>=3 && ai->GetManaPercent() >= 77) { ai->CastSpell(RAIN_OF_FIRE, *pTarget); //ai->TellMaster("casting rain of fire!"); ai->SetIgnoreUpdateTime(8); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (SHADOWFLAME > 0 && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && LastSpellDestruction < 4 && ai->GetManaPercent() >= 25) { ai->CastSpell(SHADOWFLAME, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (IMMOLATE > 0 && !pTarget->HasAura(IMMOLATE, EFFECT_INDEX_0) && !pTarget->HasAura(SHADOWFLAME, EFFECT_INDEX_0) && LastSpellDestruction < 5 && ai->GetManaPercent() >= 23) { ai->CastSpell(IMMOLATE, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (CONFLAGRATE > 0 && LastSpellDestruction < 6 && ai->GetManaPercent() >= 16) { ai->CastSpell(CONFLAGRATE, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (INCINERATE > 0 && LastSpellDestruction < 7 && ai->GetManaPercent() >= 19) { ai->CastSpell(INCINERATE, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (SEARING_PAIN > 0 && LastSpellDestruction < 8 && ai->GetManaPercent() >= 11) { ai->CastSpell(SEARING_PAIN, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (SOUL_FIRE > 0 && LastSpellDestruction < 9 && ai->GetManaPercent() >= 13) { ai->CastSpell(SOUL_FIRE, *pTarget); ai->SetIgnoreUpdateTime(6); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (CHAOS_BOLT > 0 && LastSpellDestruction < 10 && ai->GetManaPercent() >= 9) { ai->CastSpell(CHAOS_BOLT, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (SHADOWBURN > 0 && LastSpellDestruction < 11 && pTarget->GetHealth() < pTarget->GetMaxHealth()*0.20 && !pTarget->HasAura(SHADOWBURN, EFFECT_INDEX_0) && ai->GetManaPercent() >= 27) { ai->CastSpell(SHADOWBURN, *pTarget); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else if (HELLFIRE > 0 && LastSpellDestruction < 12 && !m_bot->HasAura(HELLFIRE, EFFECT_INDEX_0) && ai->GetAttackerCount()>=5 && ai->GetHealthPercent() >= 10 && ai->GetManaPercent() >= 87) { ai->CastSpell(HELLFIRE); ai->TellMaster("casting hellfire!"); ai->SetIgnoreUpdateTime(15); SpellSequence = SPELL_CURSES; LastSpellDestruction = LastSpellDestruction + 1; break; } else { LastSpellDestruction = 0; SpellSequence = SPELL_CURSES; } } } // end DoNextCombatManeuver
void PlayerbotDruidAI::DoNonCombatActions() { Player * m_bot = GetPlayerBot(); if (!m_bot) return; PlayerbotAI* ai = GetAI(); if(m_bot->HasAura(CAT_FORM, EFFECT_INDEX_0)) { m_bot->RemoveAurasDueToSpell(768); //ai->TellMaster("FormClearCat"); } if(m_bot->HasAura(BEAR_FORM, EFFECT_INDEX_0)) { m_bot->RemoveAurasDueToSpell(5487); //ai->TellMaster("FormClearBear"); } if(m_bot->HasAura(DIRE_BEAR_FORM, EFFECT_INDEX_0)) { m_bot->RemoveAurasDueToSpell(9634); //ai->TellMaster("FormClearDireBear"); } if(m_bot->HasAura(MOONKIN_FORM, EFFECT_INDEX_0)) { m_bot->RemoveAurasDueToSpell(24858); //ai->TellMaster("FormClearMoonkin"); } // buff myself with MARK_OF_THE_WILD if (MARK_OF_THE_WILD > 0 && !m_bot->HasAura(MARK_OF_THE_WILD, EFFECT_INDEX_0)) ai->CastSpell (MARK_OF_THE_WILD, *m_bot); // Thorns generates aggro for moonkin if (THORNS > 0 && !m_bot->HasAura(THORNS, EFFECT_INDEX_0)) ai->CastSpell (THORNS, *m_bot); // mana check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem != NULL && ai->GetManaPercent() < 30) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if(pItem == NULL && INNERVATE>0 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0) && ai->GetManaPercent() <= 70) { ai->CastSpell(INNERVATE, *m_bot); //ai->TellMaster("casting innervate."); return; } else if(pItem == NULL && MANA_REJUVENATION>0 && !m_bot->HasAura(INNERVATE, EFFECT_INDEX_0) && !m_bot->HasAura(MANA_REJUVENATION, EFFECT_INDEX_0) && ai->GetManaPercent() <= 70) { ai->CastSpell(MANA_REJUVENATION, *m_bot); //ai->TellMaster("casting mana rejuvenation."); return; } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(*fItem); ai->SetIgnoreUpdateTime(8); return; } // buff and heal master's group if (GetMaster()->GetGroup()) { Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(uint64 (itr->guid)); if( !tPlayer || !tPlayer->isAlive() ) continue; // buff and heal (!tPlayer->HasAura(MARK_OF_THE_WILD,EFFECT_INDEX_0) && ai->CastSpell (MARK_OF_THE_WILD, *tPlayer)); //(!tPlayer->HasAura(THORNS,0) && ai->CastSpell (THORNS, *tPlayer)); (HealTarget(*tPlayer, tPlayer->GetHealth()*100 / tPlayer->GetMaxHealth())); } } } // end DoNonCombatActions
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget) { Unit* pVictim = pTarget->getVictim(); PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: (ai->HasAura(SCREAM, *pTarget) && ai->GetHealthPercent() < 60 && ai->CastSpell(HEAL)) || ai->CastSpell(SHADOW_WORD_PAIN) || (ai->GetHealthPercent() < 80 && ai->CastSpell(RENEW)) || (ai->GetPlayerBot()->GetCombatDistance(pTarget, true) <= 5 && ai->CastSpell(SCREAM)) || ai->CastSpell(MIND_BLAST) || (ai->GetHealthPercent() < 20 && ai->CastSpell(GREATER_HEAL)) || ai->CastSpell(SMITE); return; } // ------- Non Duel combat ---------- Player *m_bot = GetPlayerBot(); Group *m_group = m_bot->GetGroup(); // Heal myself if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0)) { ai->TellMaster("I'm casting fade."); ai->CastSpell(FADE, *m_bot); } else if (ai->GetHealthPercent() < 25 && POWER_WORD_SHIELD > 0 && !m_bot->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0)) { ai->TellMaster("I'm casting pws on myself."); ai->CastSpell(POWER_WORD_SHIELD); } else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0) { ai->TellMaster("I'm casting desperate prayer."); ai->CastSpell(DESPERATE_PRAYER, *m_bot); } else if (ai->GetHealthPercent() < 80) HealTarget (m_bot); // Heal master uint32 masterHP = GetMaster()->GetHealth() * 100 / GetMaster()->GetMaxHealth(); if (GetMaster()->isAlive()) { if (masterHP < 25 && POWER_WORD_SHIELD > 0 && !GetMaster()->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0)) ai->CastSpell(POWER_WORD_SHIELD, *(GetMaster())); else if (masterHP < 80) HealTarget (GetMaster()); } // Heal group if (m_group) { Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *m_groupMember = sObjectMgr.GetPlayer(itr->guid); if (!m_groupMember || !m_groupMember->isAlive()) continue; uint32 memberHP = m_groupMember->GetHealth() * 100 / m_groupMember->GetMaxHealth(); if (memberHP < 25) HealTarget(m_groupMember); } } if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_HEAL) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY) SpellSequence = SPELL_HOLY; else if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) // && ai->GetMovementOrder() == PlayerbotAI::MOVEMENT_STAY) SpellSequence = SPELL_SHADOWMAGIC; else SpellSequence = SPELL_HOLY; // Damage Spells float dist = m_bot->GetCombatDistance(pTarget, true); switch (SpellSequence) { case SPELL_HOLY: if (SMITE > 0 && LastSpellHoly < 1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17) { ai->CastSpell(SMITE, *pTarget); LastSpellHoly = LastSpellHoly + 1; } else if (MANA_BURN > 0 && LastSpellHoly < 2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14) { //ai->TellMaster("I'm casting mana burn."); ai->CastSpell(MANA_BURN, *pTarget); ai->SetIgnoreUpdateTime(3); LastSpellHoly = LastSpellHoly + 1; } else if (HOLY_NOVA > 0 && LastSpellHoly < 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 22) { //ai->TellMaster("I'm casting holy nova."); ai->CastSpell(HOLY_NOVA); LastSpellHoly = LastSpellHoly + 1; } else if (HOLY_FIRE > 0 && LastSpellHoly < 4 && !pTarget->HasAura(HOLY_FIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 13) { //ai->TellMaster("I'm casting holy fire."); ai->CastSpell(HOLY_FIRE, *pTarget); LastSpellHoly = LastSpellHoly + 1; } else if (PRAYER_OF_MENDING > 0 && LastSpellHoly < 5 && pVictim == GetMaster() && GetMaster()->GetHealth() <= GetMaster()->GetMaxHealth() * 0.7 && !GetMaster()->HasAura(PRAYER_OF_MENDING, EFFECT_INDEX_0) && ai->GetManaPercent() >= 15) { //ai->TellMaster("I'm casting prayer of mending on master."); ai->CastSpell(PRAYER_OF_MENDING, *GetMaster()); LastSpellHoly = LastSpellHoly + 1; } else LastSpellHoly = 0; if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_NONE) SpellSequence = SPELL_SHADOWMAGIC; break; case SPELL_SHADOWMAGIC: if (SHADOW_WORD_PAIN > 0 && LastSpellShadowMagic < 1 && !pTarget->HasAura(SHADOW_WORD_PAIN, EFFECT_INDEX_0) && ai->GetManaPercent() >= 25) { //ai->TellMaster("I'm casting pain."); ai->CastSpell(SHADOW_WORD_PAIN, *pTarget); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (MIND_BLAST > 0 && LastSpellShadowMagic < 2 && ai->GetManaPercent() >= 19) { //ai->TellMaster("I'm casting mind blast."); ai->CastSpell(MIND_BLAST, *pTarget); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (SCREAM > 0 && LastSpellShadowMagic < 3 && ai->GetAttackerCount() >= 3 && ai->GetManaPercent() >= 15) { ai->TellMaster("I'm casting scream."); ai->CastSpell(SCREAM); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (MIND_FLAY > 0 && LastSpellShadowMagic < 4 && !pTarget->HasAura(MIND_FLAY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 10) { //ai->TellMaster("I'm casting mind flay."); ai->CastSpell(MIND_FLAY, *pTarget); ai->SetIgnoreUpdateTime(3); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (DEVOURING_PLAGUE > 0 && LastSpellShadowMagic < 5 && !pTarget->HasAura(DEVOURING_PLAGUE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 28) { ai->CastSpell(DEVOURING_PLAGUE, *pTarget); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (SHADOW_PROTECTION > 0 && LastSpellShadowMagic < 6 && ai->GetManaPercent() >= 60) { ai->CastSpell(SHADOW_PROTECTION, *pTarget); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (VAMPIRIC_TOUCH > 0 && LastSpellShadowMagic < 7 && !pTarget->HasAura(VAMPIRIC_TOUCH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 18) { ai->CastSpell(VAMPIRIC_TOUCH, *pTarget); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (SHADOWFIEND > 0 && LastSpellShadowMagic < 8) { ai->CastSpell(SHADOWFIEND); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else if (MIND_SEAR > 0 && LastSpellShadowMagic < 9 && ai->GetAttackerCount() >= 3 && ai->GetManaPercent() >= 28) { ai->CastSpell(MIND_SEAR, *pTarget); ai->SetIgnoreUpdateTime(5); LastSpellShadowMagic = LastSpellShadowMagic + 1; } else LastSpellShadowMagic = 0; if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_NONE || ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) SpellSequence = SPELL_DISCIPLINE; break; case SPELL_DISCIPLINE: if (FEAR_WARD > 0 && LastSpellDiscipline < 1 && ai->GetManaPercent() >= 3) { //ai->TellMaster("I'm casting fear ward"); ai->CastSpell(FEAR_WARD, *(GetMaster())); LastSpellDiscipline = LastSpellDiscipline + 1; } else if (POWER_INFUSION > 0 && LastSpellDiscipline < 2 && ai->GetManaPercent() >= 16) { //ai->TellMaster("I'm casting power infusion"); ai->CastSpell(POWER_INFUSION, *(GetMaster())); LastSpellDiscipline = LastSpellDiscipline + 1; } else if (MASS_DISPEL > 0 && LastSpellDiscipline < 3 && ai->GetManaPercent() >= 33) { //ai->TellMaster("I'm casting mass dispel"); ai->CastSpell(MASS_DISPEL); LastSpellDiscipline = LastSpellDiscipline + 1; } else if (INNER_FOCUS > 0 && !m_bot->HasAura(INNER_FOCUS, EFFECT_INDEX_0) && LastSpellDiscipline < 4) { //ai->TellMaster("I'm casting inner focus"); ai->CastSpell(INNER_FOCUS, *m_bot); LastSpellDiscipline = LastSpellDiscipline + 1; } else if (PENANCE > 0 && LastSpellDiscipline < 5 && ai->GetManaPercent() >= 16) { //ai->TellMaster("I'm casting PENANCE"); ai->CastSpell(PENANCE); LastSpellDiscipline = LastSpellDiscipline + 1; } else LastSpellDiscipline = 0; if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_NONE) SpellSequence = SPELL_HOLY; else if (ai->GetCombatOrder() == PlayerbotAI::ORDERS_ASSIST) SpellSequence = SPELL_SHADOWMAGIC; break; } } // end DoNextCombatManeuver
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 && GetMaster()->GetHealth() >= GetMaster()->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 || GetMaster()->GetHealth() <= GetMaster()->GetMaxHealth()*0.4) SpellSequence = DruidHeal; else SpellSequence = DruidCombat; switch (SpellSequence) { case DruidTank: // Its now a tank druid! //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, 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 (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++; 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 (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++; 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, ai->GetHealthPercent()); break; } if (masterHP <= 40) { 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, 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 (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
void PlayerbotHunterAI::DoNextCombatManeuver(Unit *pTarget) { PlayerbotAI* ai = GetAI(); if (!ai) return; switch (ai->GetScenarioType()) { case PlayerbotAI::SCENARIO_DUEL: ai->CastSpell(RAPTOR_STRIKE); return; } // ------- Non Duel combat ---------- // Hunter ai->SetInFront( pTarget ); Player *m_bot = GetPlayerBot(); Unit* pVictim = pTarget->getVictim(); // check for pet and heal if neccessary Pet *pet = m_bot->GetPet(); if(( pet ) && ( ((float)pet->GetHealth()/(float)pet->GetMaxHealth()) < 0.5f ) && ( PET_MEND>0 && !pet->getDeathState() != ALIVE && pVictim != m_bot && !pet->HasAura(PET_MEND,0) && ai->GetManaPercent()>=13 && ai->CastSpell(PET_MEND,*m_bot) )) { ai->TellMaster( "healing pet." ); return; } else if(( pet ) && ( INTIMIDATION>0 && pVictim == pet && !pet->HasAura(INTIMIDATION,0) && ai->CastSpell(INTIMIDATION,*m_bot) )) { //ai->TellMaster( "casting intimidation." ); // if pet has aggro :) return; } // racial traits if( m_bot->getRace() == RACE_ORC && !m_bot->HasAura( BLOOD_FURY,0 ) ) { ai->CastSpell( BLOOD_FURY,*m_bot ); //ai->TellMaster( "Blood Fury." ); } else if( m_bot->getRace() == RACE_TROLL && !m_bot->HasAura( BERSERKING,0 ) ) { ai->CastSpell( BERSERKING,*m_bot ); //ai->TellMaster( "Berserking." ); } // check if ranged combat is possible (set m_rangedCombat and switch auras float dist = m_bot->GetDistance( pTarget ); if( (dist<=ATTACK_DISTANCE || !m_bot->GetUInt32Value(PLAYER_AMMO_ID)) && m_rangedCombat ) { // switch to melee combat (target in melee range, out of ammo) m_rangedCombat = false; if( !m_bot->GetUInt32Value(PLAYER_AMMO_ID) ) ai->TellMaster( "Out of ammo!" ); // become monkey (increases dodge chance)... ( ASPECT_OF_THE_MONKEY>0 && !m_bot->HasAura(ASPECT_OF_THE_MONKEY, 0) && ai->CastSpell(ASPECT_OF_THE_MONKEY,*m_bot) ); } else if( dist>ATTACK_DISTANCE && !m_rangedCombat ) { // switch to ranged combat m_rangedCombat = true; // increase ranged attack power... ( ASPECT_OF_THE_HAWK>0 && !m_bot->HasAura(ASPECT_OF_THE_HAWK, 0) && ai->CastSpell(ASPECT_OF_THE_HAWK,*m_bot) ); } else if( m_rangedCombat && !m_bot->HasAura(ASPECT_OF_THE_HAWK, 0) ) { // check if we have hawk aspect in ranged combat ( ASPECT_OF_THE_HAWK>0 && ai->CastSpell(ASPECT_OF_THE_HAWK,*m_bot) ); } else if( !m_rangedCombat && !m_bot->HasAura(ASPECT_OF_THE_MONKEY, 0) ) { // check if we have monkey aspect in melee combat ( ASPECT_OF_THE_MONKEY>0 && ai->CastSpell(ASPECT_OF_THE_MONKEY,*m_bot) ); } // activate auto shot if( AUTO_SHOT>0 && m_rangedCombat && !m_bot->FindCurrentSpellBySpellId(AUTO_SHOT) ) { ai->CastSpell(AUTO_SHOT,*pTarget); //ai->TellMaster( "started auto shot." ); } else if( AUTO_SHOT>0 && m_bot->FindCurrentSpellBySpellId(AUTO_SHOT) ) { m_bot->InterruptNonMeleeSpells( true, AUTO_SHOT ); //ai->TellMaster( "stopped auto shot." ); } // damage spells std::ostringstream out; if( m_rangedCombat ) { out << "Case Ranged"; if( HUNTERS_MARK>0 && ai->GetManaPercent()>=3 && !pTarget->HasAura(HUNTERS_MARK,0) && ai->CastSpell(HUNTERS_MARK,*pTarget) ) out << " > Hunter's Mark"; else if( RAPID_FIRE>0 && ai->GetManaPercent()>=3 && !m_bot->HasAura(RAPID_FIRE,0) && ai->CastSpell(RAPID_FIRE,*m_bot) ) out << " > Rapid Fire"; else if( MULTI_SHOT>0 && ai->GetManaPercent()>=13 && ai->GetAttackerCount()>=3 && ai->CastSpell(MULTI_SHOT,*pTarget) ) out << " > Multi-Shot"; else if( ARCANE_SHOT>0 && ai->GetManaPercent()>=7 && ai->CastSpell(ARCANE_SHOT,*pTarget) ) out << " > Arcane Shot"; else if( CONCUSSIVE_SHOT>0 && ai->GetManaPercent()>=6 && !pTarget->HasAura(CONCUSSIVE_SHOT,0) && ai->CastSpell(CONCUSSIVE_SHOT,*pTarget) ) out << " > Concussive Shot"; else if( EXPLOSIVE_SHOT>0 && ai->GetManaPercent()>=10 && !pTarget->HasAura(EXPLOSIVE_SHOT,0) && ai->CastSpell(EXPLOSIVE_SHOT,*pTarget) ) out << " > Explosive Shot"; else if( VIPER_STING>0 && ai->GetManaPercent()>=8 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent()<70 && !pTarget->HasAura(VIPER_STING,0) && ai->CastSpell(VIPER_STING,*pTarget) ) out << " > Viper Sting"; else if( SERPENT_STING>0 && ai->GetManaPercent()>=13 && !pTarget->HasAura(SERPENT_STING,0) && !pTarget->HasAura(SCORPID_STING,0) && !pTarget->HasAura(VIPER_STING,0) && ai->CastSpell(SERPENT_STING,*pTarget) ) out << " > Serpent Sting"; else if( SCORPID_STING>0 && ai->GetManaPercent()>=11 && !pTarget->HasAura(WYVERN_STING,0) && !pTarget->HasAura(SCORPID_STING,0) && !pTarget->HasAura(SERPENT_STING,0) && !pTarget->HasAura(VIPER_STING,0) && ai->CastSpell(SCORPID_STING,*pTarget) ) out << " > Scorpid Sting"; else if( CHIMERA_SHOT>0 && ai->GetManaPercent()>=12 && ai->CastSpell(CHIMERA_SHOT,*pTarget) ) out << " > Chimera Shot"; else if( VOLLEY>0 && ai->GetManaPercent()>=24 && ai->GetAttackerCount()>=3 && ai->CastSpell(VOLLEY,*pTarget) ) out << " > Volley"; else if( BLACK_ARROW>0 && ai->GetManaPercent()>=6 && !pTarget->HasAura(BLACK_ARROW,0) && ai->CastSpell(BLACK_ARROW,*pTarget) ) out << " > Black Arrow"; else if( AIMED_SHOT>0 && ai->GetManaPercent()>=12 && ai->CastSpell(AIMED_SHOT,*pTarget) ) out << " > Aimed Shot"; else if( STEADY_SHOT>0 && ai->GetManaPercent()>=5 && ai->CastSpell(STEADY_SHOT,*pTarget) ) out << " > Steady Shot"; else if( KILL_SHOT>0 && ai->GetManaPercent()>=7 && pTarget->GetHealth() < pTarget->GetMaxHealth()*0.2 && ai->CastSpell(KILL_SHOT,*pTarget) ) out << " > Kill Shot!"; else out << " NONE!"; } else { out << "Case Melee"; if( RAPTOR_STRIKE>0 && ai->GetManaPercent()>=6 && ai->CastSpell(RAPTOR_STRIKE,*pTarget) ) out << " > Raptor Strike"; else if( EXPLOSIVE_TRAP>0 && ai->GetManaPercent()>=27 && !pTarget->HasAura(EXPLOSIVE_TRAP,0) && !pTarget->HasAura(ARCANE_TRAP,0) && !pTarget->HasAura(IMMOLATION_TRAP,0) && !pTarget->HasAura(FROST_TRAP,0) && !pTarget->HasAura(BEAR_TRAP,0) && ai->CastSpell(EXPLOSIVE_TRAP,*pTarget) ) out << " > Explosive Trap"; else if( WING_CLIP>0 && ai->GetManaPercent()>=6 && !pTarget->HasAura(WING_CLIP,0) && ai->CastSpell(WING_CLIP,*pTarget) ) out << " > Wing Clip"; else if( IMMOLATION_TRAP>0 && ai->GetManaPercent()>=13 && !pTarget->HasAura(IMMOLATION_TRAP,0) && !pTarget->HasAura(ARCANE_TRAP,0) && !pTarget->HasAura(EXPLOSIVE_TRAP,0) && !pTarget->HasAura(FROST_TRAP,0) && !pTarget->HasAura(BEAR_TRAP,0) && ai->CastSpell(IMMOLATION_TRAP,*pTarget) ) out << " > Immolation Trap"; else if( MONGOOSE_BITE>0 && ai->GetManaPercent()>=4 && ai->CastSpell(MONGOOSE_BITE,*pTarget) ) out << " > Mongoose Bite"; else if( FROST_TRAP>0 && ai->GetManaPercent()>=2 && !pTarget->HasAura(FROST_TRAP,0) && !pTarget->HasAura(ARCANE_TRAP,0) && !pTarget->HasAura(IMMOLATION_TRAP,0) && !pTarget->HasAura(EXPLOSIVE_TRAP,0) && !pTarget->HasAura(BEAR_TRAP,0) && ai->CastSpell(FROST_TRAP,*pTarget) ) out << " > Frost Trap"; else if( ARCANE_TRAP>0 && !pTarget->HasAura(ARCANE_TRAP,0) && !pTarget->HasAura(BEAR_TRAP,0) && !pTarget->HasAura(EXPLOSIVE_TRAP,0) && !pTarget->HasAura(IMMOLATION_TRAP,0) && !pTarget->HasAura(FROST_TRAP,0) && ai->CastSpell(ARCANE_TRAP,*pTarget) ) out << " > Arcane Trap"; else if( DETERRENCE>0 && pVictim == m_bot && m_bot->GetHealth() < m_bot->GetMaxHealth()*0.5 && !m_bot->HasAura(DETERRENCE,0) && ai->CastSpell(DETERRENCE,*m_bot) ) out << " > Deterrence"; else if( m_bot->getRace() == RACE_TAUREN && !pTarget->HasAura( WAR_STOMP,0 ) && ai->CastSpell(WAR_STOMP,*pTarget) ) out << " > War Stomp"; else if( m_bot->getRace() == RACE_BLOODELF && !pTarget->HasAura( ARCANE_TORRENT,0 ) && ai->CastSpell( ARCANE_TORRENT,*pTarget ) ) out << " > Arcane Torrent"; 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_NIGHTELF && pVictim == m_bot && ai->GetHealthPercent() < 25 && !m_bot->HasAura( SHADOWMELD,0 ) && ai->CastSpell( SHADOWMELD,*m_bot ) ) out << " > Shadowmeld"; else if( m_bot->getRace() == RACE_DRAENEI && ai->GetHealthPercent() < 25 && !m_bot->HasAura(GIFT_OF_THE_NAARU,0) && ai->CastSpell(GIFT_OF_THE_NAARU,*m_bot) ) out << " > Gift of the Naaru"; else if(( pet && !pet->getDeathState() != ALIVE) && ( MISDIRECTION>0 && pVictim == m_bot && !m_bot->HasAura(MISDIRECTION,0) && ai->GetManaPercent()>=9 && ai->CastSpell(MISDIRECTION,*pet)) ) out << " > Misdirection"; // give threat to pet /*else if( FREEZING_TRAP>0 && ai->GetManaPercent()>=5 && !pTarget->HasAura(FREEZING_TRAP,0) && !pTarget->HasAura(ARCANE_TRAP,0) && !pTarget->HasAura(EXPLOSIVE_TRAP,0) && !pTarget->HasAura(BEAR_TRAP,0) && !pTarget->HasAura(IMMOLATION_TRAP,0) && !pTarget->HasAura(FROST_TRAP,0) && ai->CastSpell(FREEZING_TRAP,*pTarget) ) out << " > Freezing Trap"; // this can trap your bots too else if( BEAR_TRAP>0 && !pTarget->HasAura(BEAR_TRAP,0) && !pTarget->HasAura(ARCANE_TRAP,0) && !pTarget->HasAura(EXPLOSIVE_TRAP,0) && !pTarget->HasAura(IMMOLATION_TRAP,0) && !pTarget->HasAura(FROST_TRAP,0) && ai->CastSpell(BEAR_TRAP,*pTarget) ) out << " > Bear Trap"; // this was just too annoying :) else if( DISENGAGE>0 && pVictim && ai->GetManaPercent()>=5 && ai->CastSpell(DISENGAGE,*pTarget) ) out << " > Disengage!"; // attempt to return to ranged combat*/ else out << " NONE!"; } if( ai->GetManager()->m_confDebugWhisper ) ai->TellMaster( out.str().c_str() ); } // end DoNextCombatManeuver
void PlayerbotMageAI::DoNonCombatActions() { Player * m_bot = GetPlayerBot(); Player * master = GetMaster(); if (!m_bot || !master) return; SpellSequence = SPELL_FROST; PlayerbotAI* ai = GetAI(); // Buff armor if (MOLTEN_ARMOR) { if (ai->SelfBuff(MOLTEN_ARMOR)) return; } else if (MAGE_ARMOR) { if (ai->SelfBuff(MAGE_ARMOR)) return; } else if (ICE_ARMOR) { if (ai->SelfBuff(ICE_ARMOR)) return; } else if (FROST_ARMOR) if (ai->SelfBuff(FROST_ARMOR)) return; // buff master's group if (master->GetGroup()) { // Buff master with group buff... if (!master->IsInDuel(master)) if (ARCANE_BRILLIANCE && ai->HasSpellReagents(ARCANE_BRILLIANCE)) if (ai->Buff(ARCANE_BRILLIANCE, master)) return; // ...and check group for new members joined or resurrected, or just buff everyone if no group buff available Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = sObjectMgr.GetPlayer(itr->guid); if (!tPlayer || !tPlayer->isAlive() || tPlayer == m_bot) continue; if (tPlayer->IsInDuelWith(master)) continue; // buff if (BuffPlayer(tPlayer)) return; } } // There is no group, buff master else if (master->isAlive() && BuffPlayer(master)) return; // Buff self finally else if (master->isAlive() && !master->IsInDuel(master)) if (BuffPlayer(master)) return; // conjure food & water if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); Item* fItem = ai->FindBandage(); if (pItem == NULL && CONJURE_WATER && ai->GetBaseManaPercent() >= 48) { ai->TellMaster("I'm conjuring some water."); ai->CastSpell(CONJURE_WATER, *m_bot); ai->SetIgnoreUpdateTime(3); return; } else if (pItem != NULL && ai->GetManaPercent() < 30) { ai->TellMaster("I could use a drink."); ai->UseItem(pItem); return; } pItem = ai->FindFood(); if (pItem == NULL && CONJURE_FOOD && ai->GetBaseManaPercent() >= 48) { ai->TellMaster("I'm conjuring some food."); ai->CastSpell(CONJURE_FOOD, *m_bot); ai->SetIgnoreUpdateTime(3); } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 30) { ai->TellMaster("I could use some food."); ai->UseItem(pItem); return; } else if (pItem == NULL && fItem != NULL && !m_bot->HasAura(RECENTLY_BANDAGED, EFFECT_INDEX_0) && ai->GetHealthPercent() < 70) { ai->TellMaster("I could use first aid."); ai->UseItem(fItem); return; } } // end DoNonCombatActions
void PlayerbotPriestAI::DoNextCombatManeuver(Unit *pTarget) { Unit* pVictim = pTarget->getVictim(); PlayerbotAI* ai = GetAI(); if (!ai) return; Player* m_master = ai->GetLeader(); if (!m_master) return; //ai->SetMovementTarget(PlayerbotAI::MOVEMENT_FOLLOW, m_master); // dont want to melee mob Player *m_bot = GetPlayerBot(); Group *m_group = m_bot->GetGroup(); // Heal myself if (ai->GetHealthPercent() < 15 && FADE > 0 && !m_bot->HasAura(FADE, EFFECT_INDEX_0)) { ai->CastSpell(FADE, m_bot); } else if (ai->GetHealthPercent() < 25 && POWER_WORD_SHIELD > 0 && !m_bot->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0)) { ai->CastSpell(POWER_WORD_SHIELD); } else if (ai->GetHealthPercent() < 35 && DESPERATE_PRAYER > 0) { ai->CastSpell(DESPERATE_PRAYER, m_bot); } else if (ai->GetHealthPercent() < 80) HealTarget (m_bot); // Heal master uint32 masterHP = m_master->GetHealth() * 100 / m_master->GetMaxHealth(); if (m_master->isAlive()) { if (masterHP < 25 && POWER_WORD_SHIELD > 0 && !m_master->HasAura(POWER_WORD_SHIELD, EFFECT_INDEX_0)) ai->CastSpell(POWER_WORD_SHIELD, m_master); else if (masterHP < 80) HealTarget (m_master); } // Heal group if (m_group) { Group::MemberSlotList const& groupSlot = m_group->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *m_groupMember = sObjectMgr.GetPlayer(itr->guid); if (!m_groupMember || !m_groupMember->isAlive()) continue; uint32 memberHP = m_groupMember->GetHealth() * 100 / m_groupMember->GetMaxHealth(); if (memberHP < 25) HealTarget(m_groupMember); } } // Damage Spells ai->SetInFront(pTarget); float dist = m_bot->GetDistance(pTarget); switch (SpellSequence) { case SPELL_HOLY: if (SMITE > 0 && LastSpellHoly < 1 && !pTarget->HasAura(SMITE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 17) { ai->CastSpell(SMITE, pTarget); SpellSequence = SPELL_SHADOWMAGIC; LastSpellHoly = LastSpellHoly + 1; break; } else if (MANA_BURN > 0 && LastSpellHoly < 2 && pTarget->GetPower(POWER_MANA) > 0 && ai->GetManaPercent() < 70 && ai->GetManaPercent() >= 14) { ai->CastSpell(MANA_BURN, pTarget); ai->SetIgnoreUpdateTime(3); SpellSequence = SPELL_SHADOWMAGIC; LastSpellHoly = LastSpellHoly + 1; break; } else if (HOLY_NOVA > 0 && LastSpellHoly < 3 && dist <= ATTACK_DISTANCE && ai->GetManaPercent() >= 22) { ai->CastSpell(HOLY_NOVA); SpellSequence = SPELL_SHADOWMAGIC; LastSpellHoly = LastSpellHoly + 1; break; } else if (HOLY_FIRE > 0 && LastSpellHoly < 4 && !pTarget->HasAura(HOLY_FIRE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 13) { ai->CastSpell(HOLY_FIRE, pTarget); SpellSequence = SPELL_SHADOWMAGIC; LastSpellHoly = LastSpellHoly + 1; break; } else if (PRAYER_OF_MENDING > 0 && LastSpellHoly < 5 && pVictim == m_master && m_master->GetHealth() <= m_master->GetMaxHealth() * 0.7 && !m_master->HasAura(PRAYER_OF_MENDING, EFFECT_INDEX_0) && ai->GetManaPercent() >= 15) { ai->CastSpell(PRAYER_OF_MENDING, m_master); SpellSequence = SPELL_SHADOWMAGIC; LastSpellHoly = LastSpellHoly + 1; break; } else if (LastSpellHoly > 6) { LastSpellHoly = 0; SpellSequence = SPELL_SHADOWMAGIC; break; } LastSpellHoly = LastSpellHoly + 1; //SpellSequence = SPELL_SHADOWMAGIC; //break; case SPELL_SHADOWMAGIC: if (SHADOW_WORD_PAIN > 0 && LastSpellShadowMagic < 1 && !pTarget->HasAura(SHADOW_WORD_PAIN, EFFECT_INDEX_0) && ai->GetManaPercent() >= 25) { ai->CastSpell(SHADOW_WORD_PAIN, pTarget); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (MIND_BLAST > 0 && LastSpellShadowMagic < 2 && ai->GetManaPercent() >= 19) { ai->CastSpell(MIND_BLAST, pTarget); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (SCREAM > 0 && LastSpellShadowMagic < 3 && ai->GetManaPercent() >= 15) { ai->CastSpell(SCREAM); SpellSequence = SPELL_DISCIPLINE; (LastSpellShadowMagic = LastSpellShadowMagic + 1); break; } else if (MIND_FLAY > 0 && LastSpellShadowMagic < 4 && !pTarget->HasAura(MIND_FLAY, EFFECT_INDEX_0) && ai->GetManaPercent() >= 10) { ai->CastSpell(MIND_FLAY, pTarget); ai->SetIgnoreUpdateTime(3); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (DEVOURING_PLAGUE > 0 && LastSpellShadowMagic < 5 && !pTarget->HasAura(DEVOURING_PLAGUE, EFFECT_INDEX_0) && ai->GetManaPercent() >= 28) { ai->CastSpell(DEVOURING_PLAGUE, pTarget); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (SHADOW_PROTECTION > 0 && LastSpellShadowMagic < 6 && ai->GetManaPercent() >= 60) { ai->CastSpell(SHADOW_PROTECTION, pTarget); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (VAMPIRIC_TOUCH > 0 && LastSpellShadowMagic < 7 && !pTarget->HasAura(VAMPIRIC_TOUCH, EFFECT_INDEX_0) && ai->GetManaPercent() >= 18) { ai->CastSpell(VAMPIRIC_TOUCH, pTarget); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (SHADOWFIEND > 0 && LastSpellShadowMagic < 8) { ai->CastSpell(SHADOWFIEND); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (MIND_SEAR > 0 && LastSpellShadowMagic < 9 && ai->GetManaPercent() >= 28) { ai->CastSpell(MIND_SEAR, pTarget); ai->SetIgnoreUpdateTime(5); SpellSequence = SPELL_DISCIPLINE; LastSpellShadowMagic = LastSpellShadowMagic + 1; break; } else if (LastSpellShadowMagic > 10) { LastSpellShadowMagic = 0; SpellSequence = SPELL_DISCIPLINE; break; } LastSpellShadowMagic = LastSpellShadowMagic + 1; //SpellSequence = SPELL_DISCIPLINE; //break; case SPELL_DISCIPLINE: if (FEAR_WARD > 0 && LastSpellDiscipline < 1 && ai->GetManaPercent() >= 3) { ai->CastSpell(FEAR_WARD, m_master); SpellSequence = SPELL_HOLY; LastSpellDiscipline = LastSpellDiscipline + 1; break; } else if (POWER_INFUSION > 0 && LastSpellDiscipline < 2 && ai->GetManaPercent() >= 16) { ai->CastSpell(POWER_INFUSION, m_master); SpellSequence = SPELL_HOLY; LastSpellDiscipline = LastSpellDiscipline + 1; break; } else if (MASS_DISPEL > 0 && LastSpellDiscipline < 3 && ai->GetManaPercent() >= 33) { ai->CastSpell(MASS_DISPEL); SpellSequence = SPELL_HOLY; LastSpellDiscipline = LastSpellDiscipline + 1; break; } else if (INNER_FOCUS > 0 && !m_bot->HasAura(INNER_FOCUS, EFFECT_INDEX_0) && LastSpellDiscipline < 4) { ai->CastSpell(INNER_FOCUS, m_bot); SpellSequence = SPELL_HOLY; LastSpellDiscipline = LastSpellDiscipline + 1; break; } else if (PENANCE > 0 && LastSpellDiscipline < 5 && ai->GetManaPercent() >= 16) { ai->CastSpell(PENANCE); SpellSequence = SPELL_HOLY; LastSpellDiscipline = LastSpellDiscipline + 1; break; } else if (LastSpellDiscipline > 6) { LastSpellDiscipline = 0; SpellSequence = SPELL_HOLY; break; } else { LastSpellDiscipline = LastSpellDiscipline + 1; SpellSequence = SPELL_HOLY; } } } // end DoNextCombatManeuver
void PlayerbotMageAI::DoNonCombatActions() { Player * m_bot = GetPlayerBot(); if (!m_bot) return; SpellSequence = SPELL_FROST; PlayerbotAI* ai = GetAI(); // buff myself if (DALARAN_INTELLECT > 0) (!m_bot->HasAura(DALARAN_INTELLECT, 0) && ai->GetManaPercent() >= 31 && ai->CastSpell (DALARAN_INTELLECT, *m_bot)); else if (ARCANE_INTELLECT > 0) (!m_bot->HasAura(ARCANE_INTELLECT, 0) && !m_bot->HasAura(DALARAN_INTELLECT, 0) && ai->GetManaPercent() >= 37 && ai->CastSpell (ARCANE_INTELLECT, *m_bot)); if (MAGE_ARMOR > 0) (!m_bot->HasAura(MAGE_ARMOR, 0) && ai->GetManaPercent() >= 31 && ai->CastSpell (MAGE_ARMOR, *m_bot)); else if (ICE_ARMOR > 0) (!m_bot->HasAura(ICE_ARMOR, 0) && !m_bot->HasAura(MAGE_ARMOR, 0) && ai->GetManaPercent() >= 34 && ai->CastSpell (ICE_ARMOR, *m_bot)); else if (FROST_ARMOR > 0) (!m_bot->HasAura(FROST_ARMOR, 0) && !m_bot->HasAura(MAGE_ARMOR, 0) && !m_bot->HasAura(ICE_ARMOR, 0) && ai->GetManaPercent() >= 34 && ai->CastSpell (FROST_ARMOR, *m_bot)); // buff master's group if (GetMaster()->GetGroup()) { Group::MemberSlotList const& groupSlot = GetMaster()->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++) { Player *tPlayer = objmgr.GetPlayer(uint64 (itr->guid)); if( !tPlayer || !tPlayer->isAlive() ) continue; // buff (!tPlayer->HasAura(ARCANE_INTELLECT,0) && !tPlayer->HasAura(DALARAN_INTELLECT,0) && ai->GetManaPercent() >= 37 && ai->CastSpell (ARCANE_INTELLECT, *tPlayer)); (!tPlayer->HasAura(DALARAN_INTELLECT,0) && ai->GetManaPercent() >= 31 && ai->CastSpell (DALARAN_INTELLECT, *tPlayer)); (!tPlayer->HasAura(DAMPEN_MAGIC,0) && !tPlayer->HasAura(AMPLIFY_MAGIC,0) && ai->GetManaPercent() >= 32 && ai->CastSpell (DAMPEN_MAGIC, *tPlayer)); (!tPlayer->HasAura(AMPLIFY_MAGIC,0) && !tPlayer->HasAura(DAMPEN_MAGIC,0) && ai->GetManaPercent() >= 32 && ai->CastSpell (AMPLIFY_MAGIC, *tPlayer)); } } // conjure food & water if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); Item* pItem = ai->FindDrink(); if (pItem == NULL && CONJURE_WATER && ai->GetBaseManaPercent() >= 48) { ai->TellMaster("I'm conjuring some water."); ai->CastSpell(CONJURE_WATER, *m_bot); ai->SetIgnoreUpdateTime(3); return; } else if (pItem != NULL && ai->GetManaPercent() < 15) { ai->TellMaster("I could use a drink."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } pItem = ai->FindFood(); if (pItem == NULL && CONJURE_FOOD && ai->GetBaseManaPercent() >= 48) { ai->TellMaster("I'm conjuring some food."); ai->CastSpell(CONJURE_FOOD, *m_bot); ai->SetIgnoreUpdateTime(3); } // hp check if (m_bot->getStandState() != UNIT_STAND_STATE_STAND) m_bot->SetStandState(UNIT_STAND_STATE_STAND); pItem = ai->FindFood(); if (pItem != NULL && ai->GetHealthPercent() < 15) { ai->TellMaster("I could use some food."); ai->UseItem(*pItem); ai->SetIgnoreUpdateTime(30); return; } } // end DoNonCombatActions