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


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

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


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

示例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;
    }
开发者ID:Calixa,项目名称:murlocs_434,代码行数:59,代码来源:boss_corla.cpp

示例3: 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;
}
开发者ID:BThallid,项目名称:mangos,代码行数:21,代码来源:hellfire_peninsula.cpp

示例4: 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();
    }
开发者ID:jviljoen82,项目名称:ScriptDev3,代码行数:40,代码来源:boss_rotface.cpp

示例5: UpdateAI

    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (!m_pInstance)
            return;

        // Berserk
        if (m_uiBerserkTimer)
        {
            if (m_uiBerserkTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
                {
                    DoScriptText(SAY_BERSERK, m_creature);
                    m_uiBerserkTimer = 0;
                }
            }
            else
                m_uiBerserkTimer -= uiDiff;
        }

        if (m_uiGaseousBlightTimer)
        {
            if (m_uiGaseousBlightTimer <= uiDiff)
            {
                // two stage event; first trigger all the puddle stalkers around then set the room in gas
                switch (m_uiGaseousBlightStage)
                {
                    case 0:
                        if (Creature* pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE))
                        {
                            pProfessor->HandleEmote(EMOTE_ONESHOT_TALK_NOSHEATHE);
                            pProfessor->CastSpell(pProfessor, SPELL_GASEOUS_BLIGHT_INIT, true);
                            DoScriptText((m_pInstance->GetData(TYPE_ROTFACE) == DONE && m_pInstance->IsHeroicDifficulty()) ? SAY_BLIGHT_ROTFACE_DEAD : SAY_BLIGHT, pProfessor);
                        }
                        m_uiGaseousBlightTimer = 1000;
                        break;
                    case 1:
                        if (DoCastSpellIfCan(m_creature, SPELL_GASEOUS_BLIGHT_1) == CAST_OK)
                            m_uiGaseousBlightTimer = 0;
                        break;
                }
                ++m_uiGaseousBlightStage;
            }
            else
                m_uiGaseousBlightTimer -= uiDiff;
        }

        // Inhale Blight and Pungent Blight
        if (m_uiInhaleBlightTimer < uiDiff)
        {
            SpellAuraHolder* pHolder = m_creature->GetSpellAuraHolder(m_pInstance->Is25ManDifficulty() ? SPELL_INHALED_BLIGHT_25 : SPELL_INHALED_BLIGHT_10);

            // inhale the gas or if already have 3 stacks - release it
            if (pHolder && pHolder->GetStackAmount() >= 3)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_PUNGENT_BLIGHT) == CAST_OK)
                {
                    DoScriptText(SAY_PUNGUENT_BLIGHT, m_creature);
                    m_uiInhaleBlightTimer = 38000;
                }
            }
            else
            {
                if (DoCastSpellIfCan(m_creature, SPELL_INHALE_BLIGHT) == CAST_OK)
                    m_uiInhaleBlightTimer = 36000;
            }
        }
        else
            m_uiInhaleBlightTimer -= uiDiff;

        // Gas Spore
        if (m_uiGasSporeTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_GAS_SPORE) == CAST_OK)
            {
                DoScriptText(EMOTE_SPORES, m_creature);
                m_uiGasSporeTimer = 40000;
            }
        }
        else
            m_uiGasSporeTimer -= uiDiff;

        // Vile Gas
        if (m_uiVileGasTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_VILE_GAS) == CAST_OK)
                m_uiVileGasTimer = 30000;
        }
        else
            m_uiVileGasTimer -= uiDiff;

        // Heroic spells
        if (m_pInstance->IsHeroicDifficulty())
        {
            if (m_uiMalleableGooTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_MALLEABLE_GOO_SUMMON) == CAST_OK)
//.........这里部分代码省略.........
开发者ID:Lankytim,项目名称:mangos-wotlk,代码行数:101,代码来源:boss_festergut.cpp

示例6: DoNextCombatManeuverPVE


//.........这里部分代码省略.........
            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;
}
开发者ID:keyshuwen,项目名称:mangos-classic,代码行数:101,代码来源:PlayerbotWarriorAI.cpp

示例7: UpdateAI

        void UpdateAI(const uint32 uiDiff) override
        {
            if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
                return;

            // Berserk
            if (m_uiBerserkTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
                {
                    DoScriptText(SAY_BERSERK, m_creature);
                    m_uiBerserkTimer = 5 * MINUTE * IN_MILLISECONDS;
                }
            }
            else
                m_uiBerserkTimer -= uiDiff;

            // Inhale Blight and Pungent Blight
            if (m_uiInhaleBlightTimer <= uiDiff)
            {
                SpellAuraHolder* holder = m_creature->GetSpellAuraHolder(SPELL_INHALED_BLIGHT_10);

                if (!holder)
                    holder = m_creature->GetSpellAuraHolder(SPELL_INHALED_BLIGHT_25);

                // inhale the gas or if already have 3 stacks - release it
                if (holder && holder->GetStackAmount() >= 3)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_PUNGENT_BLIGHT) == CAST_OK)
                    {
                        DoScriptText(SAY_PUNGUENT_BLIGHT_EMOTE, m_creature);
                        DoScriptText(SAY_PUNGUENT_BLIGHT, m_creature);
                        m_uiInhaleBlightTimer = 35000;
                    }
                }
                else if (DoCastSpellIfCan(m_creature, SPELL_INHALE_BLIGHT) == CAST_OK)
                {
                    if (m_pInstance)
                    {
                        if (Creature* pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE))
                            DoScriptText(SAY_BLIGHT, pProfessor);
                    }
                    m_uiInhaleBlightTimer = 30000;
                }
            }
            else
                m_uiInhaleBlightTimer -= uiDiff;

            // Gas Spore
            if (m_uiGasSporeTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_GAS_SPORE) == CAST_OK)
                {
                    DoScriptText(SAY_SPORE, m_creature);
                    m_uiGasSporeTimer = 40000;
                }
            }
            else
                m_uiGasSporeTimer -= uiDiff;

            // Vile Gas
            if (m_uiVileGasTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_VILE_GAS_SUMMON, CAST_TRIGGERED) == CAST_OK)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_VILE_GAS) == CAST_OK)
                        m_uiVileGasTimer = 30000;
                }
            }
            else
                m_uiVileGasTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
开发者ID:Chuck5ta,项目名称:ScriptDev3,代码行数:74,代码来源:boss_festergut.cpp


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