本文整理汇总了C++中SpellAuraHolder::GetSpellProto方法的典型用法代码示例。如果您正苦于以下问题:C++ SpellAuraHolder::GetSpellProto方法的具体用法?C++ SpellAuraHolder::GetSpellProto怎么用?C++ SpellAuraHolder::GetSpellProto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpellAuraHolder
的用法示例。
在下文中一共展示了SpellAuraHolder::GetSpellProto方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: HealTarget
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
示例3: GetDispelTarget
/**
* 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;
}
示例4: UpdateMasteryAuras
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);
}
}
}
示例5: Delay
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++);
}
}
示例6: HealPlayer
CombatManeuverReturns PlayerbotPaladinAI::HealPlayer(Player* target)
{
CombatManeuverReturns r = PlayerbotClassAI::HealPlayer(target);
if (r != RETURN_NO_ACTION_OK)
return r;
if (!target->isAlive())
{
if (REDEMPTION && m_ai->CastSpell(REDEMPTION, *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
}
if (PURIFY > 0 && (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_NODISPEL) == 0)
{
uint32 DISPEL = CLEANSE > 0 ? CLEANSE : PURIFY;
uint32 dispelMask = GetDispellMask(DISPEL_DISEASE);
uint32 dispelMask2 = GetDispellMask(DISPEL_POISON);
uint32 dispelMask3 = GetDispellMask(DISPEL_MAGIC);
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)
{
if (m_ai->CastSpell(DISPEL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
else if ((1 << holder->GetSpellProto()->Dispel) & dispelMask2)
{
if (holder->GetSpellProto()->Dispel == DISPEL_POISON)
{
if (m_ai->CastSpell(DISPEL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
else if ((1 << holder->GetSpellProto()->Dispel) & dispelMask3 & (DISPEL == CLEANSE))
{
if (holder->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
if (m_ai->CastSpell(DISPEL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
}
}
uint8 hp = target->GetHealthPercent();
// Everyone is healthy enough, return OK. MUST correlate to highest value below (should be last HP check)
if (hp >= 90)
return RETURN_NO_ACTION_OK;
if (hp < 25 && m_ai->CastSpell(LAY_ON_HANDS, *target))
return RETURN_CONTINUE;
// You probably want to save this for tank/healer trouble
if (hp < 30 && HAND_OF_PROTECTION > 0 && !target->HasAura(FORBEARANCE, EFFECT_INDEX_0)
&& !target->HasAura(HAND_OF_PROTECTION, EFFECT_INDEX_0) && !target->HasAura(DIVINE_PROTECTION, EFFECT_INDEX_0)
&& !target->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0) && (GetTargetJob(target) & (JOB_HEAL | JOB_TANK))
&& m_ai->CastSpell(HAND_OF_PROTECTION, *target))
return RETURN_CONTINUE;
// Isn't this more of a group heal spell?
if (hp < 40 && m_ai->CastSpell(FLASH_OF_LIGHT, *target))
return RETURN_CONTINUE;
if (hp < 60 && m_ai->CastSpell(HOLY_SHOCK, *target))
return RETURN_CONTINUE;
if (hp < 90 && m_ai->CastSpell(HOLY_LIGHT, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_UNKNOWN;
} // end HealTarget
示例7: HandleCancelAuraOpcode
void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
{
uint32 spellId;
recvPacket >> spellId;
if (spellId == 23182 || spellId == 25040 || spellId == 23205)
return;
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)
{
if (spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS ||
spellInfo->EffectApplyAuraName[k] == 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);
}
示例8: HealPlayer
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
示例9: HealPlayer
CombatManeuverReturns PlayerbotPaladinAI::HealPlayer(Player* target)
{
CombatManeuverReturns r = PlayerbotClassAI::HealPlayer(target);
if (r != RETURN_NO_ACTION_OK)
return r;
if (!target->isAlive())
{
if (REDEMPTION && m_ai->CastSpell(REDEMPTION, *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
}
if (PURIFY > 0 && (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_NODISPEL) == 0)
{
uint32 DISPEL = CLEANSE > 0 ? CLEANSE : PURIFY;
uint32 dispelMask = GetDispellMask(DISPEL_DISEASE);
uint32 dispelMask2 = GetDispellMask(DISPEL_POISON);
uint32 dispelMask3 = GetDispellMask(DISPEL_MAGIC);
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)
{
if (m_ai->CastSpell(DISPEL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
else if ((1 << holder->GetSpellProto()->Dispel) & dispelMask2)
{
if (holder->GetSpellProto()->Dispel == DISPEL_POISON)
{
if (m_ai->CastSpell(DISPEL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
else if ((1 << holder->GetSpellProto()->Dispel) & dispelMask3 & (DISPEL == CLEANSE))
{
if (holder->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
if (m_ai->CastSpell(DISPEL, *target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
}
}
// Define a tank bot will look at
Unit* pMainTank = GetHealTarget(JOB_TANK);
// If target is out of range (40 yards) and is a tank: move towards it
// Other classes have to adjust their position to the healers
// TODO: This code should be common to all healers and will probably
// move to a more suitable place
if (pMainTank && !m_ai->In_Reach(pMainTank, FLASH_OF_LIGHT))
{
m_bot->GetMotionMaster()->MoveFollow(target, 39.0f, m_bot->GetOrientation());
return RETURN_CONTINUE;
}
uint8 hp = target->GetHealthPercent();
// Everyone is healthy enough, return OK. MUST correlate to highest value below (should be last HP check)
if (hp >= 90)
return RETURN_NO_ACTION_OK;
if (hp < 10 && LAY_ON_HANDS && !m_bot->HasSpellCooldown(LAY_ON_HANDS) && m_ai->In_Reach(target,LAY_ON_HANDS) && m_ai->CastSpell(LAY_ON_HANDS, *target))
return RETURN_CONTINUE;
// Target is a moderately wounded healer or a badly wounded not tank? Blessing of Protection!
if (BLESSING_OF_PROTECTION > 0
&& ((hp < 25 && (GetTargetJob(target) & JOB_HEAL)) || (hp < 15 && !(GetTargetJob(target) & JOB_TANK)))
&& !m_bot->HasSpellCooldown(BLESSING_OF_PROTECTION) && m_ai->In_Reach(target,BLESSING_OF_PROTECTION)
&& !target->HasAura(FORBEARANCE, EFFECT_INDEX_0)
&& !target->HasAura(BLESSING_OF_PROTECTION, EFFECT_INDEX_0) && !target->HasAura(DIVINE_PROTECTION, EFFECT_INDEX_0)
&& !target->HasAura(DIVINE_SHIELD, EFFECT_INDEX_0)
&& m_ai->CastSpell(BLESSING_OF_PROTECTION, *target))
return RETURN_CONTINUE;
// Low HP : activate Divine Favor to make next heal a critical heal
if (hp < 25 && DIVINE_FAVOR > 0 && !m_bot->HasAura(DIVINE_FAVOR, EFFECT_INDEX_0) && !m_bot->HasSpellCooldown(DIVINE_FAVOR) && m_ai->CastSpell (DIVINE_FAVOR, *m_bot))
return RETURN_CONTINUE;
if (hp < 40 && FLASH_OF_LIGHT && m_ai->In_Reach(target,FLASH_OF_LIGHT) && m_ai->CastSpell(FLASH_OF_LIGHT, *target))
return RETURN_CONTINUE;
if (hp < 60 && HOLY_SHOCK && m_ai->In_Reach(target,HOLY_SHOCK) && m_ai->CastSpell(HOLY_SHOCK, *target))
return RETURN_CONTINUE;
//.........这里部分代码省略.........
示例10: HealPlayer
CombatManeuverReturns PlayerbotDruidAI::HealPlayer(Player* target)
{
CombatManeuverReturns r = PlayerbotClassAI::HealPlayer(target);
if (r != RETURN_NO_ACTION_OK)
return r;
if (!target->isAlive())
{
if (m_bot->isInCombat())
{
// TODO: Add check for cooldown
if (REBIRTH && m_ai->In_Reach(target,REBIRTH) && m_ai->CastSpell(REBIRTH, *target))
{
std::string msg = "Resurrecting ";
msg += target->GetName();
m_bot->Say(msg, LANG_UNIVERSAL);
return RETURN_CONTINUE;
}
}
else
{
if (REVIVE && m_ai->In_Reach(target,REVIVE) && m_ai->CastSpell(REVIVE, *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
}
//If spell exists and orders say we should be dispelling
if ((REMOVE_CURSE > 0 || ABOLISH_POISON > 0) && (m_ai->GetCombatOrder() & PlayerbotAI::ORDERS_NODISPEL) == 0)
{
//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))
{
if (CastSpell(REMOVE_CURSE, target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
else if ((1 << holder->GetSpellProto()->Dispel) & dispelMask2)
{
if ((holder->GetSpellProto()->Dispel == DISPEL_POISON) & (ABOLISH_POISON > 0))
{
if (CastSpell(ABOLISH_POISON, target))
return RETURN_CONTINUE;
return RETURN_NO_ACTION_ERROR;
}
}
}
}
uint8 hp = target->GetHealthPercent();
// Everyone is healthy enough, return OK. MUST correlate to highest value below (should be last HP check)
if (hp >= 90)
return RETURN_NO_ACTION_OK;
// Reset form if needed
if (!m_bot->HasAura(TREE_OF_LIFE) || TREE_OF_LIFE == 0)
GoBuffForm(GetPlayerBot());
// Start heals. Do lowest HP checks at the top
if (hp < 30)
{
// TODO: Use in conjunction with Nature's Swiftness
if (HEALING_TOUCH > 0 && m_ai->In_Reach(target,HEALING_TOUCH) && (NOURISH == 0 /*|| CastSpell(NATURES_SWIFTNESS)*/ ) && CastSpell(HEALING_TOUCH, target))
return RETURN_CONTINUE;
if (NOURISH > 0 && m_ai->In_Reach(target,NOURISH) && CastSpell(NOURISH, target))
return RETURN_CONTINUE;
}
if (hp < 45 && WILD_GROWTH > 0 && m_ai->In_Reach(target,WILD_GROWTH) && !target->HasAura(WILD_GROWTH) && CastSpell(WILD_GROWTH, target))
return RETURN_CONTINUE;
if (hp < 50 && SWIFTMEND > 0 && m_ai->In_Reach(target,SWIFTMEND) && (target->HasAura(REJUVENATION) || target->HasAura(REGROWTH)) && CastSpell(SWIFTMEND, target))
return RETURN_CONTINUE;
if (hp < 60 && REGROWTH > 0 && m_ai->In_Reach(target,REGROWTH) && !target->HasAura(REGROWTH) && CastSpell(REGROWTH, target))
return RETURN_CONTINUE;
if (hp < 65 && LIFEBLOOM > 0 && m_ai->In_Reach(target,LIFEBLOOM) && !target->HasAura(LIFEBLOOM) && CastSpell(LIFEBLOOM, target))
return RETURN_CONTINUE;
//.........这里部分代码省略.........
示例11: HealTarget
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