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