本文整理汇总了C++中Pet::HasAuraType方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::HasAuraType方法的具体用法?C++ Pet::HasAuraType怎么用?C++ Pet::HasAuraType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::HasAuraType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NeedGroupBuff
/**
* NeedGroupBuff()
* return boolean Returns true if more than two targets in the bot's group need the group buff.
*
* params:groupBuffSpellId uint32 the spell ID of the group buff like Arcane Brillance
* params:singleBuffSpellId uint32 the spell ID of the single target buff equivalent of the group buff like Arcane Intellect for group buff Arcane Brillance
* return false if false is returned, the bot is expected to perform a buff check for the single target buff of the group buff.
*
*/
bool PlayerbotClassAI::NeedGroupBuff(uint32 groupBuffSpellId, uint32 singleBuffSpellId)
{
if (!m_bot) return false;
uint8 numberOfGroupTargets = 0;
// Check group players to avoid using regeant and mana with an expensive group buff
// when only two players or less need it
if (m_bot->GetGroup())
{
Group::MemberSlotList const& groupSlot = m_bot->GetGroup()->GetMemberSlots();
for (Group::member_citerator itr = groupSlot.begin(); itr != groupSlot.end(); itr++)
{
Player *groupMember = sObjectMgr.GetPlayer(itr->guid);
if (!groupMember || !groupMember->isAlive())
continue;
// Check if group member needs buff
if (!groupMember->HasAura(groupBuffSpellId, EFFECT_INDEX_0) && !groupMember->HasAura(singleBuffSpellId, EFFECT_INDEX_0))
numberOfGroupTargets++;
// Don't forget about pet
Pet * pet = groupMember->GetPet();
if (pet && !pet->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE) && (pet->HasAura(groupBuffSpellId, EFFECT_INDEX_0) || pet->HasAura(singleBuffSpellId, EFFECT_INDEX_0)))
numberOfGroupTargets++;
}
// treshold set to 2 targets because beyond that value, the group buff cost is cheaper in mana
if (numberOfGroupTargets < 3)
return false;
// In doubt, buff everyone
return true;
}
else
return false; // no group, no group buff
}
示例2: BuffHelper
// TODO: this and mage's BuffHelper are identical and thus could probably go in PlayerbotClassAI.cpp somewhere
bool PlayerbotPriestAI::BuffHelper(PlayerbotAI* ai, uint32 spellId, Unit *target)
{
if (!ai) return false;
if (spellId == 0) return false;
if (!target) return false;
Pet * pet = target->GetPet();
if (pet && !pet->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE) && ai->Buff(spellId, pet))
return true;
if (ai->Buff(spellId, target))
return true;
return false;
}
示例3: BuffPlayer
bool PlayerbotDruidAI::BuffPlayer(Player* target)
{
PlayerbotAI * ai = GetAI();
Pet * pet = target->GetPet();
if (pet && !pet->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
{
if (ai->Buff(MARK_OF_THE_WILD, pet, &(PlayerbotDruidAI::GoBuffForm)))
return true;
else if (ai->Buff(THORNS, pet, &(PlayerbotDruidAI::GoBuffForm)))
return true;
}
if (ai->Buff(MARK_OF_THE_WILD, target, &(PlayerbotDruidAI::GoBuffForm)))
return true;
else if (ai->Buff(THORNS, target, &(PlayerbotDruidAI::GoBuffForm)))
return true;
else
return false;
}
示例4: BuffHelper
/**
* BuffHelper
* BuffHelper is a static function, takes an AI, spellId (ignored for paladin) and a target and attempts to buff them as well as their pets as
* best as possible.
*
* Return bool - returns true if a buff took place.
*/
bool PlayerbotPaladinAI::BuffHelper(PlayerbotAI* ai, uint32 spellId, Unit* target)
{
if (!ai) return false;
if (spellId == 0) return false;
if (!target) return false;
PlayerbotPaladinAI* c = (PlayerbotPaladinAI*) ai->GetClassAI();
uint32 bigSpellId = 0;
Pet* pet = target->GetPet();
uint32 petSpellId = 0, petBigSpellId = 0;
// See which buff is appropriate according to class
// TODO: take into account other paladins in the group
switch (target->getClass())
{
case CLASS_DRUID:
case CLASS_SHAMAN:
case CLASS_PALADIN:
spellId = c->BLESSING_OF_MIGHT;
if (!spellId)
{
spellId = c->BLESSING_OF_KINGS;
if (!spellId)
{
spellId = c->BLESSING_OF_WISDOM;
if (!spellId)
{
spellId = c->BLESSING_OF_SANCTUARY;
if (!spellId)
return false;
}
}
}
break;
case CLASS_DEATH_KNIGHT:
case CLASS_HUNTER:
case CLASS_ROGUE:
case CLASS_WARRIOR:
spellId = c->BLESSING_OF_MIGHT;
if (!spellId)
{
spellId = c->BLESSING_OF_KINGS;
if (!spellId)
{
spellId = c->BLESSING_OF_SANCTUARY;
if (!spellId)
return false;
}
}
break;
case CLASS_WARLOCK:
case CLASS_PRIEST:
case CLASS_MAGE:
spellId = c->BLESSING_OF_WISDOM;
if (!spellId)
{
spellId = c->BLESSING_OF_KINGS;
if (!spellId)
{
spellId = c->BLESSING_OF_SANCTUARY;
if (!spellId)
return false;
}
}
break;
default:
// PET
/** Hunter pet
if (pet && ai->CanReceiveSpecificSpell(SPELL_BLESSING, pet) && !pet->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
{
petSpellId = c->BLESSING_OF_MIGHT;
if (!petSpellId)
{
petSpellId = c->BLESSING_OF_KINGS;
if (!petSpellId)
petSpellId = c->BLESSING_OF_SANCTUARY;
}
}*/
if (/*pet && ai->CanReceiveSpecificSpell(SPELL_BLESSING, pet) && */!target->HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
{
if (target->GetPowerType() == POWER_MANA)
spellId = c->BLESSING_OF_WISDOM;
else
spellId = c->BLESSING_OF_MIGHT;
if (!spellId)
{
spellId = c->BLESSING_OF_KINGS;
if (!spellId)
spellId = c->BLESSING_OF_SANCTUARY;
}
}
//.........这里部分代码省略.........
示例5: HandlePetAction
//.........这里部分代码省略.........
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
if (!spellInfo)
{
sLog.outError("WORLD: unknown PET spell id %i", spellid);
return;
}
if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
return;
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if (spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA
|| spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT
|| spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)
return;
}
// do not cast not learned spells
if (!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo))
return;
_player->SetInCombatState(true, unit_target);
pet->clearUnitState(UNIT_STAT_MOVING);
Spell* spell = new Spell(pet, spellInfo, false);
SpellCastResult result = spell->CheckPetCast(unit_target);
const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
if (unit_target && !(pet->IsWithinDistInMap(unit_target, sRange->maxRange) && pet->IsWithinLOSInMap(unit_target))
&& !(GetPlayer()->IsFriendlyTo(unit_target) || pet->HasAuraType(SPELL_AURA_MOD_POSSESS)))
{
pet->SetSpellOpener(spellid, sRange->minRange, sRange->maxRange);
spell->finish(false);
delete spell;
pet->AttackStop();
if (!pet->hasUnitState(UNIT_STAT_CONTROLLED))
{
pet->GetMotionMaster()->Clear();
pet->AI()->AttackStart(unit_target);
// 10% chance to play special warlock pet attack talk, else growl
if (pet->IsPet() && pet->getPetType() == SUMMON_PET && pet != unit_target && roll_chance_i(10))
pet->SendPetTalk((uint32)PET_TALK_ATTACK);
pet->SendPetAIReaction();
}
else
petUnit->Attack(unit_target, true);
return;
}
// auto turn to target unless possessed
if (result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->hasUnitState(UNIT_STAT_CONTROLLED))
{
if (unit_target)
{
pet->SetInFront(unit_target);
if (unit_target->GetTypeId() == TYPEID_PLAYER)
pet->SendCreateUpdateToPlayer((Player*)unit_target);