当前位置: 首页>>代码示例>>C++>>正文


C++ SpellAuraHolder::ModStackAmount方法代码示例

本文整理汇总了C++中SpellAuraHolder::ModStackAmount方法的典型用法代码示例。如果您正苦于以下问题:C++ SpellAuraHolder::ModStackAmount方法的具体用法?C++ SpellAuraHolder::ModStackAmount怎么用?C++ SpellAuraHolder::ModStackAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpellAuraHolder的用法示例。


在下文中一共展示了SpellAuraHolder::ModStackAmount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
    }
开发者ID:Calixa,项目名称:murlocs_434,代码行数:59,代码来源:boss_corla.cpp

示例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;
};
开发者ID:MichaelFurth,项目名称:RSD2,代码行数:63,代码来源:BSW_ai.cpp

示例3: _doRemove

bool BSWScriptedAI::_doRemove(uint8 m_uiSpellIdx, Unit* pTarget, uint8 index)
{
    SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx];

    debug_log("BSW: Removing effects of spell %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget);

        switch (pSpell->m_CastTarget) 
        {
                case DO_NOTHING: 
                                 return true;
                case SUMMON_NORMAL:
                case SUMMON_TEMP:
                case SUMMON_INSTANT:
                                 return false;

                case CAST_ON_SELF:
                case APPLY_AURA_SELF:
                         pTarget = m_creature;
                     break;

                case CAST_ON_SUMMONS:
                case CAST_ON_VICTIM:
                case CAST_ON_BOTTOMAGGRO:
                case CAST_ON_TARGET:
                case APPLY_AURA_TARGET:
                         if (!pTarget) return false;
                     break;

                case CAST_ON_RANDOM:
                case CAST_ON_RANDOM_PLAYER:
                case APPLY_AURA_ALLPLAYERS:
                case CAST_ON_ALLPLAYERS:
                     {
                         Map::PlayerList const& pPlayers = pMap->GetPlayers();
                         for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr)
                         {
                             pTarget = itr->getSource();
                             if (_hasAura(m_uiSpellIdx,pTarget))
                                 pTarget->RemoveAurasDueToSpell(pSpell->m_uiSpellEntry[currentDifficulty]);
                          }
                          return true;
                      }
                      break;
                  default: 
                      debug_log("BSW: FAILED Removing effects of spell %u type %u - unsupported type",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget);
                      return false;
        }

    if (!pTarget || !pTarget->IsInMap(m_creature) || !pTarget->isAlive())
        {
           error_log("BSW: FAILED removing effects of spell number %u - no target or target not in map or target is dead",pSpell->m_uiSpellEntry[currentDifficulty]);
           return false;
        }

        if (index == EFFECT_INDEX_ALL)
        {
            pTarget->RemoveAurasDueToSpell(pSpell->m_uiSpellEntry[currentDifficulty]);
            return true;
        }

        if (_auraCount(m_uiSpellIdx,pTarget,(SpellEffectIndex)index) > 1)
        {
            SpellAuraHolder *holder = pTarget->GetSpellAuraHolder(pSpell->m_uiSpellEntry[currentDifficulty], pTarget->GetGUID());
            if (holder->ModStackAmount(-1))
            {
                pTarget->RemoveSpellAuraHolder(holder, AURA_REMOVE_BY_DISPEL);
                return true;
            } else return false;
        } else pTarget->RemoveAurasDueToSpell(pSpell->m_uiSpellEntry[currentDifficulty]);
    return true;
};
开发者ID:Subv,项目名称:diamondcore,代码行数:71,代码来源:sc_boss_spell_worker.cpp


注:本文中的SpellAuraHolder::ModStackAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。