本文整理汇总了C++中PlayerbotAI::GetManaPercent方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetManaPercent方法的具体用法?C++ PlayerbotAI::GetManaPercent怎么用?C++ PlayerbotAI::GetManaPercent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetManaPercent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
// ------- 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);
//.........这里部分代码省略.........
示例2: DoNonCombatActions
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)
{
//.........这里部分代码省略.........
示例3: DoNextCombatManeuver
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
//.........这里部分代码省略.........
示例4: DoNonCombatActions
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) )
//.........这里部分代码省略.........
示例5: 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))
//.........这里部分代码省略.........
示例6: 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;
}
}
}
示例7: DoNextCombatManeuver
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
//.........这里部分代码省略.........
示例8: 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;
//.........这里部分代码省略.........
示例9: DoNonCombatActions
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;
}
//.........这里部分代码省略.........
示例10: DoNonCombatActions
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
示例11: DoNextCombatManeuver
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)
//.........这里部分代码省略.........
示例12: 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);
//.........这里部分代码省略.........
示例13: DoNonCombatActions
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;
}
}
//.........这里部分代码省略.........
示例14: DoNextCombatManeuver
//.........这里部分代码省略.........
// 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
示例15: 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);
//.........这里部分代码省略.........