void UpdateAI(uint32 diff) { ReduceCD(diff); if (IAmDead()) return; if (!me->GetVictim()) Evade(); if (clearcast && !me->IsNonMeleeSpellCast(false)) { if (Aura* potency = me->GetAura(ARCANE_POTENCY_BUFF)) { if (potency->GetCharges() == 1) clearcast = false; potency->DropCharge(AURA_REMOVE_BY_EXPIRE); if (me->HasAura(CLEARCASTBUFF)) { me->ModifyPower(POWER_MANA, cost); me->RemoveAurasDueToSpell(CLEARCASTBUFF, me->GetGUID(), 0, AURA_REMOVE_BY_EXPIRE); } } } CheckAuras(); if (wait == 0) wait = GetWait(); else return; BreakCC(diff); if (CCed(me) && (!ICEBLOCK || !me->HasAura(ICEBLOCK))) return;//TODO CheckBlink(diff); CheckPoly(diff); CheckPots(diff); //CureTarget(master, REMOVE_CURSE, diff); //CureTarget(me, REMOVE_CURSE, diff); CureGroup(master, REMOVE_CURSE, diff); FocusMagic(diff); BuffAndHealGroup(master, diff); if (!me->IsInCombat()) DoNonCombatActions(diff); if (!CheckAttackTarget(CLASS_MAGE)) return; CheckPoly2();//this should go AFTER getting opponent Counter(); CheckSpellSteal(diff); DoNormalAttack(diff); }
void UpdateAI(uint32 diff) { ReduceCD(diff); if (!GlobalUpdate(diff)) return; CheckAttackState(); CheckAuras(); if (wait == 0) wait = GetWait(); else return; BreakCC(diff); if (CCed(me)) return; ////if pet is dead or unreachable //Creature* m_botsPet = me->GetBotsPet(); //if (!m_botsPet || m_botsPet->FindMap() != master->GetMap() || (me->GetDistance2d(m_botsPet) > sWorld->GetMaxVisibleDistanceOnContinents() - 20.f)) // if (master->getLevel() >= 10 && !me->IsInCombat() && !IsCasting() && !me->IsMounted()) // SummonBotsPet(PET_VOIDWALKER); //TODO: implement healthstone if (Potion_cd <= diff && GetHealthPCT(me) < 67) { temptimer = GC_Timer; if (doCast(me, HEALINGPOTION)) { Potion_cd = POTION_CD; GC_Timer = temptimer; } } if (Potion_cd <= diff && GetManaPCT(me) < 50) { temptimer = GC_Timer; if (doCast(me, MANAPOTION)) { Potion_cd = POTION_CD; GC_Timer = temptimer; } } if (!me->IsInCombat()) DoNonCombatActions(); if (!CheckAttackTarget(BOT_CLASS_WARLOCK)) return; DoNormalAttack(diff); }
void UpdateAI(const uint32 diff) { DoMeleeAttackIfReady(); if (IAmDead()) return; ReduceCD(diff); opponent = me->getVictim(); if (!opponent ) { ResetOrGetNextTarget(); DoNonCombatActions(); return; } me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true); if (me->GetHealth() < me->GetMaxHealth()*0.5 && isTimerReady(uiPotion_Timer)) { doCast(me, SPELL_HEALING_POTION); uiPotion_Timer = 60000; } oom_spam = false; //buff and heal master's group if (master->GetGroup()) { BuffAndHealGroup(master); CureGroup(master); } // Heal myself HealTarget (me, me->GetHealth() * 100 / me->GetMaxHealth()); DoNormalAttack(diff); Counter(diff); ScriptedAI::UpdateAI(diff); }
void UpdateAI(uint32 diff) { ReduceCD(diff); if (IAmDead()) return; CheckAttackState(); CheckAuras(); if (wait == 0) wait = GetWait(); else return; if (CCed(me)) return; //TODO: add checks to help owner if (!me->IsInCombat()) DoNonCombatActions(); if (!CheckAttackTarget(PET_TYPE_VOIDWALKER)) return; DoNormalAttack(diff); }
void UpdateAI(uint32 const diff) { ReduceCD(diff); if (IAmDead()) return; if (!me->isInCombat()) DoNonCombatActions(diff); //if (pet && pet != NULL && pet->isDead()) //{ // me->SetBotsPetDied(); // pet = NULL; //} //if we think we have a pet, but master doesn't, it means we teleported //if (pet && !me->getBotsPet()) //{ // me->SetBotsPetDied(); // pet = NULL; //} DoNormalAttack(diff); ScriptedAI::UpdateAI(diff); //if low on health, drink a potion if (GetHealthPCT(me) < 65) { if (doCast(me, HEALINGPOTION)) Potion_cd = POTION_CD; } //if low on mana, drink a potion if (GetManaPCT(me) < 65 && Potion_cd <= diff) { if (doCast(me, MANAPOTION)) Potion_cd = POTION_CD; } opponent = SelectTarget(SELECT_TARGET_TOPAGGRO, 0); if (!opponent && !me->getVictim()) { me->CombatStop(); //ResetOrGetNextTarget(); //to reduce the number of crashes, remove pet whenever we are not in combat //if (pet != NULL && pet->isAlive()) //{ // me->SetBotsPetDied(); // pet = NULL; //} return; } //if (pet == NULL) // CreatePet(); //if (pet && pet->isAlive() && // !pet->isInCombat() && // me->getVictim()) //{ // pet->Attack (me->getVictim(), true); // pet->GetMotionMaster()->MoveChase(me->getVictim(), 1, 0); //} }
void UpdateAI(const uint32 diff) { DoMeleeAttackIfReady(); decrementTimers(); if (IAmDead()) return; if (me->GetPower(POWER_MANA) < 400 && isTimerReady(uiPotion_Timer)) { doCast(me, SPELL_MANA_POTION); uiPotion_Timer = 150; } if (me->GetPower(POWER_MANA)/me->GetMaxPower(POWER_MANA) < 10) { if (uiOom_Timer == 0) uiOom_Timer = 1; } BuffAndHealGroup(master); // Heal myself HealTarget (me, me->GetHealth() * 100 / me->GetMaxHealth()); //the rest are combat so return if not fighting opponent = SelectTarget(SELECT_TARGET_TOPAGGRO, 0); if (!opponent && !me->getVictim()) { DoNonCombatActions(); ResetOrGetNextTarget(); return; } //Cast totems. if (me->isInCombat() && isTimerReady(uiEarthTotem_Timer) && !master->HasAura(SPELL_STONE_SKIN_AURA, 0)) { doCast(me, SPELL_STONE_SKIN_TOTEM); GiveManaBack(); uiEarthTotem_Timer = 90; return; } if (me->isInCombat() && isTimerReady(uiFireTotem_Timer)) { doCast(me, SPELL_SEARING_TOTEM); GiveManaBack(); uiFireTotem_Timer = 180; return; } if (me->isInCombat() && isTimerReady(uiWindTotem_Timer)) { doCast(me, SPELL_WINDFURY_TOTEM); GiveManaBack(); uiWindTotem_Timer = 180; return; } if (me->isInCombat()) { switch(master->getClass()) { case CLASS_WARRIOR: case CLASS_DEATH_KNIGHT: case CLASS_ROGUE: if (isTimerReady(uiWaterTotem_Timer) && !master->HasAura(SPELL_HEALING_STREAM_AURA)) { doCast(me, SPELL_HEALING_STREAM_TOTEM); uiWaterTotem_Timer = 90; GiveManaBack(); return; } break; default: //everyone else gets a mana totem if (isTimerReady (uiWaterTotem_Timer) && !master->HasAura(SPELL_MANA_SPRING_AURA, 0)) { doCast(me, SPELL_MANA_SPRING_TOTEM); uiWaterTotem_Timer = 90; GiveManaBack(); return; } } } if (isTimerReady(uiFlameShock_Timer)) { doCast(opponent, SPELL_FLAME_SHOCK); uiFlameShock_Timer = 120; return; } if (isTimerReady(uiLightningBolt_Timer)) { doCast(opponent, SPELL_LIGHTNING_BOLT); uiLightningBolt_Timer = 180; return; } if (isTimerReady(uiEarthShock_Timer)) { doCast(opponent, SPELL_EARTH_SHOCK); uiEarthShock_Timer = 250; return; } //now try to heal bots and pets. DoSelectLowestHpFriendly will get //everyone in group including bots and pets. Unfortunately it can //not be triggered for % of lost HP, so we just set it to -1000. //This means low level players wont be healed because they wont have //enough HP. Unit* target = DoSelectLowestHpFriendly(40, 1000); if (target) { if (CanCast(target, GetSpellStore()->LookupEntry (SPELL_CHAIN_HEAL))) { doCast(target, SPELL_CHAIN_HEAL, false); uiOthersHeal_Timer = 50; } } else { target = DoSelectLowestHpFriendly(40, 500); //now try someone with less HP lost if (target) { if (CanCast(target, GetSpellStore()->LookupEntry (SPELL_CHAIN_HEAL))) { doCast(target, SPELL_CHAIN_HEAL, false); uiOthersHeal_Timer = 100; } } } ScriptedAI::UpdateAI(diff); }
void UpdateAI(const uint32 diff) { ReduceCD(diff); if(IAmDead()) return; if(!m_creature->isInCombat()) { DoNonCombatActions(); } if(pet && pet != NULL && pet->isDead()) { master->SetBotsPetDied(); pet = NULL; } //if we think we have a pet, but master doesn't, it means we teleported if(pet && master->m_botHasPet == false) { master->SetBotsPetDied(); pet = NULL; } DoNormalAttack(diff); ScriptedAI::UpdateAI(diff); //if low on health, drink a potion if(m_creature->GetHealth() < m_creature->GetMaxHealth()*0.6 && isTimerReady(Potion_cd)) { doCast(m_creature, HEALINGPOTION); Potion_cd = 1500; } //if low on mana, drink a potion if(m_creature->GetPower(POWER_MANA) < m_creature->GetMaxPower(POWER_MANA)*0.2) { if(isTimerReady(Potion_cd)) { doCast(m_creature, MANAPOTION); //MonsterSay("MANA POTION", LANG_UNIVERSAL, NULL); Potion_cd = 1500; } } opponent = SelectUnit(SELECT_TARGET_TOPAGGRO, 0); if(!opponent && !m_creature->getVictim()) { ResetOrGetNextTarget(); //to reduce the number of crashes, remove pet whenever we are not in combat if(pet != NULL && pet->isAlive()) { master->SetBotsPetDied(); pet = NULL; } return; } if(pet == NULL) CreatePet(); if (pet && pet->isAlive() && !pet->isInCombat() && m_creature->getVictim()) { pet->Attack (m_creature->getVictim(), true); pet->GetMotionMaster()->MoveChase(m_creature->getVictim(), 1, 0); } }
void UpdateAI(const uint32 diff) { decrementTimers(); if (IAmDead()) return; if (!me->isInCombat()) DoNonCombatActions(); //buff and heal master's group BuffAndHealGroup(master); //check group members Group::MemberSlotList const &a =((Player*)master)->GetGroup()->GetMemberSlots(); for (Group::member_citerator itr = a.begin(); itr != a.end(); itr++) { Player *tPlayer = ((Player *)master)->GetObjPlayer(itr->guid); if (tPlayer == NULL) continue; } //if low on mana, drink a potion if (me->GetPower(POWER_MANA) < 400 && isTimerReady(uiPotion_Timer)) { doCast(me, SPELL_MANA_POTION, true); uiPotion_Timer = 1500; } //if after drinking a potion still low on mana //let everyone know that you are oom. if (me->GetPower(POWER_MANA)/me->GetMaxPower(POWER_MANA) < 10) { if (uiOom_Timer == 0) uiOom_Timer = 1; } // Heal myself if (me->GetHealth() * 100 / me->GetMaxHealth() < 90) { if (uiFade_Timer <= 0 && me->isInCombat() && isTimerReady(uiFade_Timer)) { doCast(me, SPELL_FADE); uiFade_Timer = 30; return; } HealTarget (me, me->GetHealth() * 100 / me->GetMaxHealth()); } //now try to heal bots and pets. DoSelectLowestHpFriendly will get //everyone in group including bots and pets. Unfortunately it can //not be triggered for % of lost HP, so we just set it to -1000. //This means low level players wont be healed because they wont have //enough HP. if (isTimerReady(uiOthersHeal_Timer)) { Unit* target; if (target = DoSelectLowestHpFriendly(40, 1000)) { doCast(target, SPELL_HEAL, false); GiveManaBack(); uiOthersHeal_Timer = 50; } else if (target = DoSelectLowestHpFriendly(40, 500)) { if (!target->HasAura(SPELL_RENEW, 0)) { doCast(target, SPELL_RENEW, false); GiveManaBack(); uiOthersHeal_Timer = 100; } } } }