本文整理汇总了C++中SpellAuraHolder类的典型用法代码示例。如果您正苦于以下问题:C++ SpellAuraHolder类的具体用法?C++ SpellAuraHolder怎么用?C++ SpellAuraHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpellAuraHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EffectScriptEffectCreature_spell_unstable_ooze
bool EffectScriptEffectCreature_spell_unstable_ooze(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
if (uiSpellId == SPELL_UNSTABLE_OOZE && uiEffIndex == EFFECT_INDEX_2 && pCreatureTarget->GetEntry() == NPC_BIG_OOZE)
{
// send AI event on 5 stacks of unstable Ooze
SpellAuraHolder* pOozeHolder = pCreatureTarget->GetSpellAuraHolder(uiSpellId);
if (pOozeHolder)
{
// Note: stacks are increased after the effect is processed, so we need to use (stacks - 1)
switch (pOozeHolder->GetStackAmount())
{
case 1:
DoScriptText(EMOTE_OOZE_GROW_1, pCreatureTarget);
break;
case 2:
DoScriptText(EMOTE_OOZE_GROW_2, pCreatureTarget);
break;
case 4:
pCreatureTarget->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, pCaster, pCreatureTarget);
// no break;
case 3:
DoScriptText(EMOTE_OOZE_GROW_3, pCreatureTarget);
break;
}
}
return true;
}
return false;
}
示例2: UpdateAI
void UpdateAI(const uint32 diff) override
{
if (!zealot)
{
if (Unit* owner = m_creature->GetCreator())
zealot = owner;
}
if (channelTarget == NULL/* || lastTarget == NULL */|| zealot == NULL)
return;
if (zealot->HasAura(SPELL_TWILIGHT_EVOLUTION) || zealot->isDead())
return;
if (uiCheckPlayerIsBetween <= diff)
{
channelTarget = zealot;
Map::PlayerList const &PlayerList = m_creature->GetMap()->GetPlayers();
if (!PlayerList.isEmpty())
{
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if(i->getSource()->IsInBetween(m_creature, zealot, 1.0f))
channelTarget = i->getSource();
}
}
SpellAuraHolder* holder = channelTarget->GetSpellAuraHolder(SPELL_EVOLUTION, zealot->GetObjectGuid());
if (!holder)
holder = channelTarget->_AddAura(SPELL_EVOLUTION, 15000, zealot);
if (holder)
{
holder->ModStackAmount(1);
holder->RefreshHolder();
if (holder->GetStackAmount() >= holder->GetSpellProto()->GetStackAmount())
{
if(channelTarget == zealot)
channelTarget->RemoveAllAuras();
zealot->CastSpell(channelTarget, SPELL_TWILIGHT_EVOLUTION, true);
}
}
uiCheckPlayerIsBetween = 500;
}
else
uiCheckPlayerIsBetween -= diff;
if (uiNetherEssenceVisual <= diff)
{
m_creature->CastSpell(m_creature, SPELL_NETHERESSENCE_VISUAL, true);
uiNetherEssenceVisual = urand(3500,4000);
}
else
uiNetherEssenceVisual -= diff;
}
示例3: HandleCancelAuraOpcode
void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
{
uint32 spellId;
recvPacket >> spellId;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
if (!spellInfo)
return;
if (spellInfo->HasAttribute(SPELL_ATTR_CANT_CANCEL))
return;
if (IsPassiveSpell(spellInfo))
return;
if (!IsPositiveSpell(spellId))
{
// ignore for remote control state
if (!_player->IsSelfMover())
{
// except own aura spells
bool allow = false;
for (int k = 0; k < MAX_EFFECT_INDEX; ++k)
{
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(k));
if (spellEffect && (spellEffect->EffectApplyAuraName == SPELL_AURA_MOD_POSSESS ||
spellEffect->EffectApplyAuraName == SPELL_AURA_MOD_POSSESS_PET))
{
allow = true;
break;
}
}
// this also include case when aura not found
if (!allow)
return;
}
else
return;
}
// channeled spell case (it currently casted then)
if (IsChanneledSpell(spellInfo))
{
if (Spell* curSpell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
if (curSpell->m_spellInfo->Id == spellId)
_player->InterruptSpell(CURRENT_CHANNELED_SPELL);
return;
}
SpellAuraHolder* holder = _player->GetSpellAuraHolder(spellId);
// not own area auras can't be cancelled (note: maybe need to check for aura on holder and not general on spell)
if (holder && holder->GetCasterGuid() != _player->GetObjectGuid() && HasAreaAuraEffect(holder->GetSpellProto()))
return;
// non channeled case
_player->RemoveAurasDueToSpellByCancel(spellId);
}
示例4: GetTargetJob
/**
* GetDispelTarget()
* return Unit* Returns unit to be dispelled. First checks 'critical' Healer(s), next Tank(s), next Master (if different from:), next DPS.
*
* return NULL If NULL is returned, no healing is required. At all.
*
* Will need extensive re-write for co-operation amongst multiple healers. As it stands, multiple healers would all pick the same 'ideal'
* healing target.
*/
Player* PlayerbotClassAI::GetDispelTarget(DispelType dispelType, JOB_TYPE type, bool bMustBeOOC)
{
if (!m_ai) return nullptr;
if (!m_bot) return nullptr;
if (!m_bot->isAlive() || m_bot->IsInDuel()) return nullptr;
if (bMustBeOOC && m_bot->isInCombat()) return nullptr;
// First, fill the list of targets
if (m_bot->GetGroup())
{
// define seperately for sorting purposes - DO NOT CHANGE ORDER!
std::vector<heal_priority> targets;
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;
JOB_TYPE job = GetTargetJob(groupMember);
if (job & type)
{
uint32 dispelMask = GetDispellMask(dispelType);
Unit::SpellAuraHolderMap const& auras = groupMember->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
SpellAuraHolder *holder = itr->second;
// Only return group members with negative magic effect
if (dispelType == DISPEL_MAGIC && holder->IsPositive())
continue;
// poison, disease and curse are always negative: return everyone
if ((1 << holder->GetSpellProto()->Dispel) & dispelMask)
targets.push_back( heal_priority(groupMember, 0, job) );
}
}
}
// Sorts according to type: Healers first, tanks next, then master followed by DPS, thanks to the order of the TYPE enum
std::sort(targets.begin(), targets.end());
if (targets.size())
return targets.at(0).p;
}
return nullptr;
}
示例5: SetFloatValue
void Player::UpdateMasteryAuras()
{
if (!HasAuraType(SPELL_AURA_MASTERY))
{
SetFloatValue(PLAYER_MASTERY, 0.0f);
return;
}
float masteryValue = GetTotalAuraModifier(SPELL_AURA_MASTERY) + GetRatingBonusValue(CR_MASTERY);
SetFloatValue(PLAYER_MASTERY, masteryValue);
std::vector<uint32> const* masterySpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]);
if (!masterySpells)
return;
for (uint32 i = 0; i < masterySpells->size(); ++i)
{
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
if (!holder)
continue;
SpellEntry const* spellEntry = holder->GetSpellProto();
// calculate mastery scaling coef
int32 masteryCoef = GetMasteryCoefficient(spellEntry);
if (!masteryCoef)
continue;
// update aura modifiers
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
{
Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(j));
if (!aura)
continue;
if (spellEntry->CalculateSimpleValue(SpellEffectIndex(j)))
continue;
aura->ApplyModifier(false, false);
aura->GetModifier()->m_amount = int32(masteryValue * masteryCoef / 100.0f);
aura->ApplyModifier(true, false);
}
}
}
示例6: GOGossipSelect_go_ulduar_teleporter
bool GOGossipSelect_go_ulduar_teleporter(Player *pPlayer, GameObject* pGo, uint32 sender, uint32 action)
{
int32 damage = 0;
if(sender != GOSSIP_SENDER_MAIN) return false;
if(!pPlayer->getAttackers().empty()) return false;
if(action >= 0 && action <= PORTALS_COUNT)
pPlayer->TeleportTo(PortalLoc[action].map_num, PortalLoc[action].x, PortalLoc[action].y, PortalLoc[action].z, PortalLoc[action].o);
if (PortalLoc[action].spellID != 0 )
if (SpellEntry const* spell = (SpellEntry *)GetSpellStore()->LookupEntry(PortalLoc[action].spellID))
{
SpellAuraHolder *holder = CreateSpellAuraHolder(spell, pPlayer, pPlayer);
Aura *aura = CreateAura(spell, EFFECT_INDEX_2, NULL, holder, pPlayer);
holder->AddAura(aura, EFFECT_INDEX_2);
}
pPlayer->CLOSE_GOSSIP_MENU();
return true;
}
示例7: GetMap
void DynamicObject::Delay(int32 delaytime)
{
m_aliveDuration -= delaytime;
for(AffectedSet::iterator iter = m_affected.begin(); iter != m_affected.end(); )
{
Unit *target = GetMap()->GetUnit((*iter));
if (target)
{
SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid().GetRawValue());
if (!holder)
{
++iter;
continue;
}
bool foundAura = false;
for (int32 i = m_effIndex + 1; i < MAX_EFFECT_INDEX; ++i)
{
SpellEffectEntry const* effect = holder->GetSpellProto()->GetSpellEffect(SpellEffectIndex(i));
if(!effect)
continue;
if ((effect->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA || effect->Effect == SPELL_EFFECT_ADD_FARSIGHT) && holder->m_auras[i])
{
foundAura = true;
break;
}
}
if (foundAura)
{
++iter;
continue;
}
target->DelaySpellAuraHolder(m_spellId, delaytime, GetCasterGuid().GetRawValue());
++iter;
}
else
m_affected.erase(iter++);
}
}
示例8: GetAI
bool PlayerbotPriestAI::HealTarget(Unit* target)
{
PlayerbotAI* ai = GetAI();
uint8 hp = target->GetHealth() * 100 / target->GetMaxHealth();
if (CURE_DISEASE > 0 && ai->GetCombatOrder() != PlayerbotAI::ORDERS_NODISPEL)
{
uint32 dispelMask = GetDispellMask(DISPEL_DISEASE);
Unit::SpellAuraHolderMap const& auras = target->GetSpellAuraHolderMap();
for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
SpellAuraHolder *holder = itr->second;
if ((1<<holder->GetSpellProto()->Dispel) & dispelMask)
{
if(holder->GetSpellProto()->Dispel == DISPEL_DISEASE)
ai->CastSpell(CURE_DISEASE, *target);
return false;
}
}
}
if (hp >= 80)
return false;
if (hp < 25 && FLASH_HEAL && ai->CastSpell(FLASH_HEAL, *target))
return true;
else if (hp < 30 && GREATER_HEAL > 0 && ai->CastSpell(GREATER_HEAL, *target))
return true;
else if (hp < 33 && BINDING_HEAL > 0 && ai->CastSpell(BINDING_HEAL, *target))
return true;
else if (hp < 40 && PRAYER_OF_HEALING > 0 && ai->CastSpell(PRAYER_OF_HEALING, *target))
return true;
else if (hp < 50 && CIRCLE_OF_HEALING > 0 && ai->CastSpell(CIRCLE_OF_HEALING, *target))
return true;
else if (hp < 60 && HEAL > 0 && ai->CastSpell(HEAL, *target))
return true;
else if (hp < 80 && RENEW > 0 && !target->HasAura(RENEW) && ai->CastSpell(RENEW, *target))
return true;
else
return false;
} // end HealTarget
示例9: EffectAuraDummy_spell_aura_dummy_living_flare
bool EffectAuraDummy_spell_aura_dummy_living_flare(const Aura* pAura, bool bApply)
{
if (pAura->GetId() == SPELL_LIVING_FLARE_MASTER && pAura->GetEffIndex() == EFFECT_INDEX_0 && bApply)
{
if (Creature* pTarget = (Creature*)pAura->GetTarget())
{
pTarget->CastSpell(pTarget, SPELL_FEL_FLAREUP, TRIGGERED_OLD_TRIGGERED);
SpellAuraHolder* pHolder = pTarget->GetSpellAuraHolder(SPELL_FEL_FLAREUP);
if (pHolder)
{
if (pHolder->GetStackAmount() >= MAX_FLAREUP_STACKS)
pTarget->AI()->SendAIEvent(AI_EVENT_CUSTOM_A, pTarget, pTarget);
// Note: cosmetic aura is removed, so we need to add it back. This needs to be fixed
else
pTarget->CastSpell(pTarget, SPELL_LIVING_COSMETIC, TRIGGERED_OLD_TRIGGERED);
}
}
}
return true;
}
示例10: UpdateAI
void UpdateAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
// Unstable Ooze
if (m_uiUnstableExplosionCheckTimer)
{
if (m_uiUnstableExplosionCheckTimer <= uiDiff)
{
m_uiUnstableExplosionCheckTimer = 1000;
SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(SPELL_UNSTABLE_OOZE);
if (holder && holder->GetStackAmount() >= 5)
{
if (DoCastSpellIfCan(m_creature, SPELL_UNSTABLE_EXPLOSION) == CAST_OK)
{
if (m_pInstance)
{
if (Creature* pRotface = m_pInstance->GetSingleCreatureFromStorage(NPC_ROTFACE))
DoScriptText(SAY_OOZE_EXPLODE, pRotface);
}
}
}
}
else
m_uiUnstableExplosionCheckTimer -= uiDiff;
}
// Sticky Ooze
if (m_uiStickyOozeTimer <= uiDiff)
{
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_STICKY_OOZE) == CAST_OK)
m_uiStickyOozeTimer = urand(10000, 15000);
}
else
m_uiStickyOozeTimer -= uiDiff;
DoMeleeAttackIfReady();
}
示例11: error_log
bool BSWScriptedAI::_doAura(uint8 m_uiSpellIdx, Unit* pTarget, SpellEffectIndex index)
{
SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx];
if (!pTarget || !pTarget->IsInMap(m_creature) || !pTarget->isAlive())
{
error_log("BSW: FAILED adding aura of spell number %u - no target or target not in map or target is dead",pSpell->m_uiSpellEntry[currentDifficulty]);
return false;
}
if (_hasAura(m_uiSpellIdx,pTarget))
debug_log("BSW: adding aura stack from spell %u index %u",pSpell->m_uiSpellEntry[currentDifficulty], index);
else debug_log("BSW: adding new aura from spell %u index %u",pSpell->m_uiSpellEntry[currentDifficulty], index);
SpellEntry const *spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty]);
if (spell && spell->Effect[index] < TOTAL_SPELL_EFFECTS)
{
if (IsSpellAppliesAura(spell, (1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2)) || IsSpellHaveEffect(spell, SPELL_EFFECT_PERSISTENT_AREA_AURA))
{
SpellAuraHolder *holder = CreateSpellAuraHolder(spell, pTarget, pTarget);
int32 basepoint = pSpell->varData ? pSpell->varData - 1 : spell->EffectBasePoints[index] + 1;
if ( IsAreaAuraEffect(spell->Effect[index]) ||
spell->Effect[index] == SPELL_EFFECT_APPLY_AURA ||
spell->Effect[index] == SPELL_EFFECT_PERSISTENT_AREA_AURA )
{
Aura *aura = CreateAura(spell, SpellEffectIndex(index), &basepoint, holder, pTarget);
holder->AddAura(aura, SpellEffectIndex(index));
return true;
}
}
}
error_log("BSW: FAILED adding aura from spell %u index %u",pSpell->m_uiSpellEntry[currentDifficulty], index);
return false;
};
示例12: if
//.........这里部分代码省略.........
if (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_TANK && TAUNT > 0 && m_bot->IsSpellReady(TAUNT) && m_ai->CastSpell(TAUNT, *pTarget))
return RETURN_CONTINUE;
}
// If tank is on the verge of dying but "I DON'T WANT TO DIE !!! :'-(("
// TODO: should behaviour (or treshold) be different between elite and normal mobs? We don't want bots to burn such precious cooldown needlessly
if (m_bot->GetHealthPercent() < 10)
{
// Cast Last Stand first because it has lower cooldown
if (LAST_STAND > 0 && !m_bot->HasAura(LAST_STAND, EFFECT_INDEX_0) && m_ai->CastSpell(LAST_STAND, *m_bot))
{
m_ai->TellMaster("I'm using LAST STAND");
return RETURN_CONTINUE;
}
// Cast Shield Wall only if Last Stand is on cooldown and not active
if (SHIELD_WALL > 0 && (!m_bot->IsSpellReady(LAST_STAND) || LAST_STAND == 0) && !m_bot->HasAura(LAST_STAND, EFFECT_INDEX_0) && !m_bot->HasAura(SHIELD_WALL, EFFECT_INDEX_0) && m_ai->CastSpell(SHIELD_WALL, *m_bot))
{
m_ai->TellMaster("I'm using SHIELD WALL");
return RETURN_CONTINUE;
}
}
// Try to interrupt spell if target is casting one and target is not a worldboss (they are almost all immune to interrupt)
if (pTarget->IsNonMeleeSpellCasted(true) && !m_ai->IsElite(pTarget, true))
{
if (SHIELD_BASH > 0 && m_ai->CastSpell(SHIELD_BASH, *pTarget))
return RETURN_CONTINUE;
}
//Do not waste rage applying Sunder Armor if it is already stacked 5 times
if (SUNDER_ARMOR > 0)
{
if (!pTarget->HasAura(SUNDER_ARMOR) && m_ai->CastSpell(SUNDER_ARMOR, *pTarget)) // no stacks: cast it
return RETURN_CONTINUE;
else
{
SpellAuraHolder* holder = pTarget->GetSpellAuraHolder(SUNDER_ARMOR);
if (holder && (holder->GetStackAmount() < 5) && m_ai->CastSpell(SUNDER_ARMOR, *pTarget))
return RETURN_CONTINUE;
}
}
if (REVENGE > 0 && m_bot->IsSpellReady(REVENGE))
{
uint8 base = pTarget->RollMeleeOutcomeAgainst(m_bot, BASE_ATTACK, SPELL_SCHOOL_MASK_NORMAL);
uint8 off = pTarget->RollMeleeOutcomeAgainst(m_bot, OFF_ATTACK, SPELL_SCHOOL_MASK_NORMAL);
if (base == MELEE_HIT_PARRY || base == MELEE_HIT_DODGE || base == MELEE_HIT_BLOCK || off == MELEE_HIT_PARRY || off == MELEE_HIT_DODGE || off == MELEE_HIT_BLOCK)
if (m_ai->CastSpell(REVENGE, *pTarget))
return RETURN_CONTINUE;
}
if (REND > 0 && !pTarget->HasAura(REND, EFFECT_INDEX_0) && m_ai->CastSpell(REND, *pTarget))
return RETURN_CONTINUE;
if (DEMORALIZING_SHOUT > 0 && !pTarget->HasAura(DEMORALIZING_SHOUT, EFFECT_INDEX_0) && m_ai->CastSpell(DEMORALIZING_SHOUT, *pTarget))
return RETURN_CONTINUE;
// check that target is dangerous (elite) before casting shield block: preserve bot cooldowns
if (SHIELD_BLOCK > 0 && m_ai->IsElite(pTarget) && !m_bot->HasAura(SHIELD_BLOCK, EFFECT_INDEX_0) && m_ai->CastSpell(SHIELD_BLOCK, *m_bot))
return RETURN_CONTINUE;
// TODO: only cast disarm if target has equipment?
if (DISARM > 0 && !pTarget->HasAura(DISARM, EFFECT_INDEX_0) && m_ai->CastSpell(DISARM, *pTarget))
return RETURN_CONTINUE;
if (CONCUSSION_BLOW > 0 && m_bot->IsSpellReady(CONCUSSION_BLOW) && m_ai->CastSpell(CONCUSSION_BLOW, *pTarget))
return RETURN_CONTINUE;
if (SHIELD_SLAM > 0 && m_bot->IsSpellReady(SHIELD_SLAM) && m_ai->CastSpell(SHIELD_SLAM, *pTarget))
return RETURN_CONTINUE;
if (HEROIC_STRIKE > 0 && m_ai->CastSpell(HEROIC_STRIKE, *pTarget))
return RETURN_CONTINUE;
}
/* case WarriorBattle:
if (SWEEPING_STRIKES > 0 && m_ai->GetAttackerCount() >= 2 && !m_bot->HasAura(SWEEPING_STRIKES, EFFECT_INDEX_0) && m_ai->CastSpell(SWEEPING_STRIKES, *m_bot))
return RETURN_CONTINUE;
if (INTIMIDATING_SHOUT > 0 && m_ai->GetAttackerCount() > 5 && m_ai->CastSpell(INTIMIDATING_SHOUT, *pTarget))
return RETURN_CONTINUE;
if (CHALLENGING_SHOUT > 0 && pVictim != m_bot && m_ai->GetHealthPercent() > 25 && !pTarget->HasAura(MOCKING_BLOW, EFFECT_INDEX_0) && !pTarget->HasAura(CHALLENGING_SHOUT, EFFECT_INDEX_0) && m_ai->CastSpell(CHALLENGING_SHOUT, *pTarget))
return RETURN_CONTINUE;
if (CLEAVE > 0 && m_ai->CastSpell(CLEAVE, *pTarget))
return RETURN_CONTINUE;
if (PIERCING_HOWL > 0 && && m_ai->GetAttackerCount() >= 3 && !pTarget->HasAura(WAR_STOMP, EFFECT_INDEX_0) && !pTarget->HasAura(PIERCING_HOWL, EFFECT_INDEX_0) && !pTarget->HasAura(SHOCKWAVE, EFFECT_INDEX_0) && !pTarget->HasAura(CONCUSSION_BLOW, EFFECT_INDEX_0) && m_ai->CastSpell(PIERCING_HOWL, *pTarget))
return RETURN_CONTINUE;
if (MOCKING_BLOW > 0 && pVictim != m_bot && m_ai->GetHealthPercent() > 25 && !pTarget->HasAura(MOCKING_BLOW, EFFECT_INDEX_0) && !pTarget->HasAura(CHALLENGING_SHOUT, EFFECT_INDEX_0) && m_ai->CastSpell(MOCKING_BLOW, *pTarget))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_TAUREN && !pTarget->HasAura(WAR_STOMP, EFFECT_INDEX_0) && !pTarget->HasAura(PIERCING_HOWL, EFFECT_INDEX_0) && !pTarget->HasAura(CONCUSSION_BLOW, EFFECT_INDEX_0) && m_ai->CastSpell(WAR_STOMP, *pTarget))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_HUMAN && m_bot->hasUnitState(UNIT_STAT_STUNNED) || m_bot->HasAuraType(SPELL_AURA_MOD_FEAR) || m_bot->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || m_bot->HasAuraType(SPELL_AURA_MOD_CHARM) && m_ai->CastSpell(EVERY_MAN_FOR_HIMSELF, *m_bot))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_UNDEAD && m_bot->HasAuraType(SPELL_AURA_MOD_FEAR) || m_bot->HasAuraType(SPELL_AURA_MOD_CHARM) && m_ai->CastSpell(WILL_OF_THE_FORSAKEN, *m_bot))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_DWARF && m_bot->HasAuraState(AURA_STATE_DEADLY_POISON) && m_ai->CastSpell(STONEFORM, *m_bot))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_GNOME && m_bot->hasUnitState(UNIT_STAT_STUNNED) || m_bot->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) && m_ai->CastSpell(ESCAPE_ARTIST, *m_bot))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_ORC && !m_bot->HasAura(BLOOD_FURY, EFFECT_INDEX_0) && m_ai->CastSpell(BLOOD_FURY, *m_bot))
return RETURN_CONTINUE;
if (m_bot->getRace() == RACE_TROLL && !m_bot->HasAura(BERSERKING, EFFECT_INDEX_0) && m_ai->CastSpell(BERSERKING, *m_bot))
return RETURN_CONTINUE;
break;*/
return RETURN_NO_ACTION_OK;
}
示例13: GetDispellMask
CombatManeuverReturns PlayerbotShamanAI::HealPlayer(Player* target)
{
CombatManeuverReturns r = PlayerbotClassAI::HealPlayer(target);
if (r != RETURN_NO_ACTION_OK)
return r;
if (!target->isAlive())
{
if (ANCESTRAL_SPIRIT && m_ai->CastSpell(ANCESTRAL_SPIRIT, *target))
{
std::string msg = "Resurrecting ";
msg += target->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return RETURN_CONTINUE;
}
return RETURN_NO_ACTION_ERROR; // not error per se - possibly just OOM
}
// Dispel if necessary
if ((CURE_DISEASE_SHAMAN > 0 || CURE_POISON_SHAMAN > 0) && (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_NODISPEL) == 0)
{
uint32 dispelMask = GetDispellMask(DISPEL_POISON);
uint32 dispelMask2 = GetDispellMask(DISPEL_DISEASE);
Unit::SpellAuraHolderMap const& auras = target->GetSpellAuraHolderMap();
for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
SpellAuraHolder *holder = itr->second;
if ((1 << holder->GetSpellProto()->Dispel) & dispelMask)
{
if (holder->GetSpellProto()->Dispel == DISPEL_POISON)
{
if (m_ai->CastSpell(CURE_POISON_SHAMAN, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
else if ((1 << holder->GetSpellProto()->Dispel) & dispelMask2)
{
if (holder->GetSpellProto()->Dispel == DISPEL_DISEASE)
{
if (m_ai->CastSpell(CURE_DISEASE_SHAMAN, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
}
}
// Everyone is healthy enough, return OK. MUST correlate to highest value below (should be last HP check)
if (target->GetHealthPercent() >= 80)
return RETURN_NO_ACTION_OK;
// Technically the best rotation is CHAIN + LHW + LHW subbing in HW for trouble (bad mana efficiency)
if (target->GetHealthPercent() < 30 && HEALING_WAVE > 0 && m_ai->CastSpell(HEALING_WAVE, *target))
return RETURN_CONTINUE;
if (target->GetHealthPercent() < 50 && LESSER_HEALING_WAVE > 0 && m_ai->CastSpell(LESSER_HEALING_WAVE, *target))
return RETURN_CONTINUE;
if (target->GetHealthPercent() < 80 && CHAIN_HEAL > 0 && m_ai->CastSpell(CHAIN_HEAL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_UNKNOWN;
} // end HealTarget
示例14: GetAI
bool PlayerbotDruidAI::HealTarget(Unit *target)
{
PlayerbotAI* ai = GetAI();
uint8 hp = target->GetHealth() * 100 / target->GetMaxHealth();
//If spell exists and orders say we should be dispelling
if ((REMOVE_CURSE > 0 || ABOLISH_POISON > 0) && ai->GetCombatOrder() != PlayerbotAI::ORDERS_NODISPEL)
{
//This does something important(lol)
uint32 dispelMask = GetDispellMask(DISPEL_CURSE);
uint32 dispelMask2 = GetDispellMask(DISPEL_POISON);
//Get a list of all the targets auras(spells affecting target)
Unit::SpellAuraHolderMap const& auras = target->GetSpellAuraHolderMap();
//Iterate through the auras
for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
SpellAuraHolder *holder = itr->second;
//I dont know what this does but it doesn't work without it
if ((1<<holder->GetSpellProto()->Dispel) & dispelMask)
{
//If the spell is dispellable and we can dispel it, do so
if((holder->GetSpellProto()->Dispel == DISPEL_CURSE) & (REMOVE_CURSE > 0))
ai->CastSpell(REMOVE_CURSE, *target);
return false;
}
else if ((1<<holder->GetSpellProto()->Dispel) & dispelMask2)
{
if((holder->GetSpellProto()->Dispel == DISPEL_POISON) & (ABOLISH_POISON > 0))
ai->CastSpell(ABOLISH_POISON, *target);
return false;
}
}
}
if (hp >= 70)
return false;
// Reset form if needed
GoBuffForm(GetPlayerBot());
if (hp < 70 && REJUVENATION > 0 && ai->In_Reach(target,REJUVENATION) && !target->HasAura(REJUVENATION) && ai->CastSpell(REJUVENATION, *target))
return true;
if (hp < 60 && LIFEBLOOM > 0 && ai->In_Reach(target,LIFEBLOOM) && !target->HasAura(LIFEBLOOM) && ai->CastSpell(LIFEBLOOM, *target))
return true;
if (hp < 55 && REGROWTH > 0 && ai->In_Reach(target,REGROWTH) && !target->HasAura(REGROWTH) && ai->CastSpell(REGROWTH, *target))
return true;
if (hp < 50 && SWIFTMEND > 0 && ai->In_Reach(target,SWIFTMEND) && (target->HasAura(REJUVENATION) || target->HasAura(REGROWTH)) && ai->CastSpell(SWIFTMEND, *target))
return true;
if (hp < 45 && WILD_GROWTH > 0 && ai->In_Reach(target,WILD_GROWTH) && !target->HasAura(WILD_GROWTH) && ai->CastSpell(WILD_GROWTH, *target))
return true;
if (hp < 30 && NOURISH > 0 && ai->In_Reach(target,NOURISH) && ai->CastSpell(NOURISH, *target))
return true;
if (hp < 25 && HEALING_TOUCH > 0 && ai->In_Reach(target,HEALING_TOUCH) && ai->CastSpell(HEALING_TOUCH, *target))
return true;
return false;
} // end HealTarget
示例15: error_log
bool BSWScriptedAI::_doAura(uint32 SpellID, Unit* pTarget, SpellEffectIndex index, int32 basepoint, bool isStack)
{
if (!pTarget || !pTarget->IsInMap(m_creature) || !pTarget->isAlive())
{
error_log("BSW: FAILED adding aura of spell number %u - no target or target not in map or target is dead",SpellID);
return false;
}
if (_hasAura(SpellID,pTarget))
debug_log("BSW: adding aura stack from spell %u index %u",SpellID, index);
else debug_log("BSW: adding new aura from spell %u index %u",SpellID, index);
SpellEntry const *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SpellID);
if (spell)
{
if (IsSpellAppliesAura(spell, (1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2)) || IsSpellHaveEffect(spell, SPELL_EFFECT_PERSISTENT_AREA_AURA))
{
int32 _basepoint = basepoint ? basepoint - 1 : spell->EffectBasePoints[index] + 1;
bool addedToExisting = true;
SpellAuraHolder* holder = pTarget->GetSpellAuraHolder(SpellID, pTarget->GetGUID());
Aura* aura = NULL;
if (!holder)
{
holder = CreateSpellAuraHolder(spell, pTarget, pTarget);
addedToExisting = false;
}
if (aura = holder->GetAuraByEffectIndex(index))
{
if (isStack)
holder->ModStackAmount(1);
}
else
{
aura = CreateAura(spell, index, &_basepoint, holder, pTarget);
aura->SetAuraDuration(aura->GetAuraMaxDuration());
holder->AddAura(aura, index);
}
if (addedToExisting)
{
pTarget->AddAuraToModList(aura);
holder->SetInUse(true);
aura->ApplyModifier(true,true);
holder->SetInUse(false);
}
else
pTarget->AddSpellAuraHolder(holder);
return true;
}
}
error_log("BSW: FAILED adding aura from spell %u index %u",SpellID, index);
return false;
};