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


C++ Aura类代码示例

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


在下文中一共展示了Aura类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Aura

void AuraInterface::UpdateAuraStateAuras(uint32 oldflag)
{
	if( oldflag == AURASTATE_FLAG_STUNNED && m_Unit->IsPlayer() && m_Unit->HasDummyAura(SPELL_HASH_PRIMAL_TENACITY) && TO_PLAYER(m_Unit)->GetShapeShift() == FORM_CAT )
	{
		for(uint32 i = 0; i < TOTAL_AURAS; i++)
		{
			if(m_auras.find(i) != m_auras.end())
			{
				if( m_auras.at(i)->GetSpellProto()->NameHash == SPELL_HASH_PRIMAL_TENACITY )
				{
					Aura* aura = new Aura(m_auras.at(i)->GetSpellProto(), -1, TO_OBJECT(this), TO_UNIT(this));
					RemoveAuraBySlot(i);
					aura->AddMod(232, -31, 5, 0);
					aura->AddMod(SPELL_AURA_DUMMY, 0, 0, 2);
					aura->AddMod(SPELL_AURA_ADD_PCT_MODIFIER, -51, 14, 2);
					AddAura(aura);
					continue;
				}

				if( m_auras.at(i)->m_applied) // try to apply
					m_auras.at(i)->ApplyModifiers(true);

				if( m_auras.at(i)->m_applied) // try to remove, if we lack the aurastate
					m_auras.at(i)->RemoveIfNecessary();
			}
		}
	}
	else
	{
		for(uint32 i = 0; i < TOTAL_AURAS; i++)
		{
			if(m_auras.find(i) != m_auras.end())
			{
				if( !m_auras.at(i)->m_applied) // try to apply
					m_auras.at(i)->ApplyModifiers(true);

				if( m_auras.at(i)->m_applied) // try to remove, if we lack the aurastate
					m_auras.at(i)->RemoveIfNecessary();
			}
		}
	}
}
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:42,代码来源:AuraInterface.cpp

示例2: switch

void MountedChampionAI::executeEvent(uint32 eventID)
{
    uint32 timer = 0;

    switch (eventID)
    {
        case EVENT_SPELL_CHARGE:
        {
            if (Unit* pUnit = SelectTarget(SELECT_TARGET_FARTHEST))
            {
                DoResetThreat();
                me->AddThreat(pUnit, 5.0f);
                DoCast(pUnit, SPELL_CHARGE, true);
            }

            timer = 5000;
        }break;

        case EVENT_SPELL_SHIELD_BREAKER:
        {
            if (Unit* pUnit = SelectTarget(SELECT_TARGET_FARTHEST))
                DoCast(pUnit, SPELL_SHIELD_BREAKER, true);

            timer = 7 * IN_MILLISECONDS;
        }break;

        case EVENT_SPELL_SHIELD:
        {
            Aura* pAura = me->GetAura(SPELL_SHIELD);
            if (!pAura || pAura->GetStackAmount() < 3)
            {
                DoCast(SPELL_SHIELD);
                timer = urand(4 * IN_MILLISECONDS, 5 * IN_MILLISECONDS);
            }
            else
                timer = urand(1 * IN_MILLISECONDS, 2 * IN_MILLISECONDS);
        }break;
    }

    if (eventID && timer)
        eventMap.ScheduleEvent(eventID, timer);
}
开发者ID:Allowed,项目名称:Strawberry335,代码行数:42,代码来源:Vehicle_GrandChampions.cpp

示例3: AIUpdate

		void AIUpdate()
		{
			// Let's see if we are netted
			Aura* a = _unit->FindAura(38177);
			if(a != NULL)
			{
				Unit* Caster = a->GetUnitCaster();
				if(Caster->IsPlayer())
				{

					QuestLogEntry* qle = TO_PLAYER(Caster)->GetQuestLogForEntry(10747);
					if(qle != NULL)
					{
						// casting the spell that will create the item for the player
						_unit->CastSpell(Caster, 38178, true);
						_unit->Despawn(1000, 360000);
					}
				}
			}
		}
开发者ID:Antares84,项目名称:arcemu,代码行数:20,代码来源:Quest_BladeEdge_Mountains.cpp

示例4: strtok

bool ChatHandler::HandleAuraUpdateRemove(const char* args, WorldSession* m_session)
{
    if (!args)
        return false;

    char* pArgs = strtok((char*)args, " ");
    if (!pArgs)
        return false;
    uint8 VisualSlot = (uint8)atoi(pArgs);
    Player* Pl = m_session->GetPlayer();
    Aura* AuraPtr = Pl->FindAura(Pl->m_auravisuals[VisualSlot]);
    if (!AuraPtr)
    {
        SystemMessage(m_session, "No auraid found in slot %u", VisualSlot);
        return true;
    }
    SystemMessage(m_session, "SMSG_AURA_UPDATE (remove): VisualSlot %u - SpellID 0", VisualSlot);
    AuraPtr->Remove();
    return true;
}
开发者ID:Declipe,项目名称:AscEmu,代码行数:20,代码来源:Level0.cpp

示例5: AH_642

SPELL_EFFECT_OVERRIDE_RETURNS AH_642( Aura *aur, bool apply, uint8 i )
{
    if( apply == true && aur->GetSpellProto()->eff[i].EffectApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY )
    {
        //remove dots from target
        Unit *t = aur->GetTarget();
        for(uint32 x=MAX_POSITIVE_AURAS; x<MAX_NEGATIVE_AURAS1(t); x++)
        {
            Aura *pAura = t->m_auras[i];
            if( pAura != aur && pAura != NULL && !pAura->IsPassive() && !pAura->IsPositive() && !(pAura->GetSpellProto()->Attributes & ATTRIBUTES_IGNORE_INVULNERABILITY) )
                pAura->Remove();
        }
        t->RemoveAurasByInterruptFlag( AURA_INTERRUPT_ON_INVINCIBLE );

        for(uint32 i = 0; i < SCHOOL_COUNT; i++)
            if( aur->mod->m_miscValue & (1<<i) )
                t->RemoveAurasOfSchool(i, false, true); //hmm, script this if you need. Cyclone does not need to remove DOTS, just make you immune to dmg
    }
    return SPELL_EFFECT_OVERRIDE_CONTINUE_EXECUTION;
}
开发者ID:Odiis,项目名称:Descent-core,代码行数:20,代码来源:SpellAuraHooks.cpp

示例6: UpdateAI

            void UpdateAI(uint32 const diff)
            {
                events.Update(diff);

                switch (events.ExecuteEvent())
                {
                    case EVENT_DUMMY_RECAST_DEFEND:
                        switch (me->GetEntry())
                        {
                            case NPC_CHARGE_TARGET:
                            {
                                if (!me->HasAura(SPELL_CHARGE_DEFEND))
                                    DoCast(SPELL_CHARGE_DEFEND);
                                break;
                            }
                            case NPC_RANGED_TARGET:
                            {
                                Aura* defend = me->GetAura(SPELL_RANGED_DEFEND);
                                if (!defend || defend->GetStackAmount() < 3 || defend->GetDuration() <= 8000)
                                    DoCast(SPELL_RANGED_DEFEND);
                                break;
                            }
                        }
                        isVulnerable = false;
                        events.ScheduleEvent(EVENT_DUMMY_RECAST_DEFEND, 5000);
                        break;
                    case EVENT_DUMMY_RESET:
                        if (UpdateVictim())
                        {
                            EnterEvadeMode();
                            events.ScheduleEvent(EVENT_DUMMY_RESET, 10000);
                        }
                        break;
                }

                if (!UpdateVictim())
                    return;

                if (!me->HasUnitState(UNIT_STATE_STUNNED))
                    me->SetControlled(true, UNIT_STATE_STUNNED);
            }
开发者ID:3kids,项目名称:TrinityCore,代码行数:41,代码来源:icecrown.cpp

示例7: HandleDeserterAdd

    /**
    * @brief Applies the Deserter Debuff to a player
    *
    * This function applies a Deserter Debuff of the given type (Instance or BG) to the
    * selected player, with the provided duration in seconds.
    *
    * @param handler The ChatHandler, passed by the system.
    * @param args The provided duration in seconds.
    * @param isInstance provided by the relaying functions, so we don't have
    * to write that much code :)
    *
    * @return true if everything was correct, false if an error occured.
    *
    * Example Usage:
    * @code
    * .deserter instance add 3600 (one hour)
    * -or-
    * .deserter bg add 3600 (one hour)
    * @endcode
    */
    static bool HandleDeserterAdd(ChatHandler* handler, char const* args, bool isInstance)
    {
        if (!*args)
            return false;

        Player* player = handler->getSelectedPlayer();
        if (!player)
        {
            handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
            handler->SetSentErrorMessage(true);
            return false;
        }
        char* timeStr = strtok((char*)args, " ");
        if (!timeStr)
        {
            handler->SendSysMessage(LANG_BAD_VALUE);
            handler->SetSentErrorMessage(true);
            return false;
        }
        uint32 time = atoi(timeStr);

        if (!time)
        {
            handler->SendSysMessage(LANG_BAD_VALUE);
            handler->SetSentErrorMessage(true);
            return false;
        }

        Aura* aura = player->AddAura(isInstance ? LFG_SPELL_DUNGEON_DESERTER : BG_SPELL_DESERTER, player);

        if (!aura)
        {
            handler->SendSysMessage(LANG_BAD_VALUE);
            handler->SetSentErrorMessage(true);
            return false;
        }
        aura->SetDuration(time * IN_MILLISECONDS);

        return true;
    }
开发者ID:Exodius,项目名称:chuspi,代码行数:60,代码来源:cs_deserter.cpp

示例8: HandleScriptEffect

        void HandleScriptEffect(SpellEffIndex effIndex)
        {
            Unit* caster = GetCaster();
            Unit* unitTarget = GetHitUnit();
            if (!unitTarget)
                return;

            uint32 spellId = 0;
            int32 basePoint = 0;
            Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
            for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
            {
                Aura* aura = i->second->GetBase();
                if (aura->GetCasterGUID() != caster->GetGUID())
                    continue;

                // Search only Serpent Sting, Viper Sting, Scorpid Sting auras
                flag96 familyFlag = aura->GetSpellProto()->SpellFamilyFlags;
                if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
                    continue;
                if (AuraEffect const * aurEff = aura->GetEffect(0))
                {
                    // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
                    if (familyFlag[0] & 0x4000)
                    {
                        int32 TickCount = aurEff->GetTotalTicks();
                        spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT;
                        basePoint = aurEff->GetAmount() * TickCount * 40 / 100;
                    }
                    // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
                    else if (familyFlag[1] & 0x00000080)
                    {
                        int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
                        spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER;

                        // Amount of one aura tick
                        basePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 100 ;
                        int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50 ;
                        if (basePoint > casterBasePoint)
                            basePoint = casterBasePoint;
                        basePoint = basePoint * TickCount * 60 / 100;
                    }
                    // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
                    else if (familyFlag[0] & 0x00008000)
                        spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID;
                    // ?? nothing say in spell desc (possibly need addition check)
                    //if (familyFlag & 0x0000010000000000LL || // dot
                    //    familyFlag & 0x0000100000000000LL)   // stun
                    //{
                    //    spellId = 53366; // 53366 Chimera Shot - Wyvern
                    //}

                    // Refresh aura duration
                    aura->RefreshDuration();
                }
                break;
            }
            if (spellId)
                caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, false);
        }
开发者ID:Meandro,项目名称:wowcore,代码行数:60,代码来源:spell_hunter.cpp

示例9: GetSpellStore

bool PlayerbotClassAI::castDispel (uint32 dispelSpell, Unit *dTarget, bool checkFirst, bool castExistingAura, bool skipFriendlyCheck, bool skipEquipStanceCheck)
{
    if (dispelSpell == 0 || !dTarget ) return false;
    //if (!canCast(dispelSpell, dTarget, true)) return false; //Needless cpu cycles wasted, usually a playerbot can cast a dispell
    const SpellEntry *dSpell = GetSpellStore()->LookupEntry(dispelSpell);
    if (!dSpell) return false;

    for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i)
    {
        if (dSpell->Effect[i] != (uint32)SPELL_EFFECT_DISPEL) continue;
        uint32 dispel_type = dSpell->EffectMiscValue[i];
        uint32 dispelMask  = GetDispellMask(DispelType(dispel_type));
        Unit::AuraMap const& auras = dTarget->GetOwnedAuras();
        for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); itr++)
        {
            Aura * aura = itr->second;
            AuraApplication * aurApp = aura->GetApplicationOfTarget(dTarget->GetGUID());
            if (!aurApp)
                continue;

            if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
            {
                if(aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
                {
                    bool positive = aurApp->IsPositive() ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR0_UNK7)) : false;

                    // do not remove positive auras if friendly target
                    //               negative auras if non-friendly target
                    if(positive == dTarget->IsFriendlyTo(GetPlayerBot()))
                        continue;
                }
                // If there is a successfull match return, else continue searching.
                if (CastSpell(dSpell, dTarget, checkFirst, castExistingAura, skipFriendlyCheck, skipEquipStanceCheck)) {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:Sharki,项目名称:TC,代码行数:40,代码来源:PlayerbotClassAI.cpp

示例10: SpellHitTarget

 void SpellHitTarget(Unit* who, SpellInfo const* spell)
 {
     if (spell->Id == SPELL_UNLEASHED_LIGHT_HELPER)
     {
         if (who->HasAura(SPELL_LIGHT_ESSENCE_HELPER))
         {
             // need to do the things in this order, else players might have 100 charges of Powering Up without anything happening
             Aura* pAura = who->GetAura(SPELL_POWERING_UP_HELPER);
             if (pAura)
             {
                 pAura->ModStackAmount(int(spell->Effects[EFFECT_0].CalcValue() * 0.001) - 1);
                 who->CastSpell(who, SPELL_POWERING_UP_HELPER, true);
             }
             else
             {
                 who->CastSpell(who, SPELL_POWERING_UP_HELPER, true);
                 if (Aura* pTemp = who->GetAura(SPELL_POWERING_UP_HELPER))
                     pTemp->ModStackAmount(int(spell->Effects[EFFECT_0].CalcValue() * 0.001) - 1);
             }
         }
     }
 }
开发者ID:mynew1,项目名称:FuckerCrazyEmu,代码行数:22,代码来源:boss_twin_valkyr.cpp

示例11: SpellTargetDummyTarget

/// Spell Target Handling for type 38: Dummy Target (Server-side script effect)
void Spell::SpellTargetDummyTarget(uint32 i, uint32 j)
{
	//TargetsList *tmpMap=&m_targetUnits[i];
	if( m_spellInfo->Id == 51699 )
	{
		if( p_caster )
		{
			Aura* aur = p_caster->FindAura( 52916 );
			if( aur && aur->GetUnitCaster() )
			{
				_AddTargetForced(aur->GetUnitCaster()->GetGUID(), i);
				return;
			}
		}
	}
	else if( m_spellInfo->Id == 12938 )
	{
		//FIXME:this ll be immortal targets
		FillAllTargetsInArea(i,m_targets.m_destX,m_targets.m_destY,m_targets.m_destZ,GetDBCCastTime(i));
	}
	_AddTargetForced(m_caster->GetGUID(), i);
}
开发者ID:Bootz,项目名称:arcticdev,代码行数:23,代码来源:SpellTarget.cpp

示例12: HandleProc

            void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
            {
                PreventDefaultAction();

                Unit* caster = eventInfo.GetActor();
                Unit* target = eventInfo.GetProcTarget();

                // try to find spell Flame Shock on the target
                AuraEffect* flameShock = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, flag128(0x10000000), caster->GetGUID());
                if (!flameShock)
                    return;

                Aura* flameShockAura = flameShock->GetBase();

                int32 maxDuration = flameShockAura->GetMaxDuration();
                int32 newDuration = flameShockAura->GetDuration() + aurEff->GetAmount() * IN_MILLISECONDS;

                flameShockAura->SetDuration(newDuration);
                // is it blizzlike to change max duration for FS?
                if (newDuration > maxDuration)
                    flameShockAura->SetMaxDuration(newDuration);
            }
开发者ID:Lyill,项目名称:TrinityCore,代码行数:22,代码来源:spell_shaman.cpp

示例13: HandleScript

            void HandleScript(SpellEffIndex /*effIndex*/)
            {
                if (!(GetHitCreature() && GetHitCreature()->IsAlive()))
                    return;

                Aura *unstable = GetCaster()->GetAura(SPELL_UNSTABLE_OOZE);
                if (unstable != NULL)
                {
                    Aura *targetAura = GetHitCreature()->GetAura(SPELL_UNSTABLE_OOZE);
                    if (targetAura != NULL)
                        unstable->ModStackAmount(targetAura->GetStackAmount());
                    else
                        unstable->ModStackAmount(1);

                    // no idea why, but this does not trigger explosion on retail (only small+large do)
                }

                // just for safety
                GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_BUFF_COMBINE);
                GetHitCreature()->RemoveAurasDueToSpell(SPELL_LARGE_OOZE_COMBINE);
                GetHitCreature()->DespawnOrUnsummon();
            }
开发者ID:Exodius,项目名称:chuspi,代码行数:22,代码来源:boss_rotface.cpp

示例14: HandleScriptEffect

            void HandleScriptEffect(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();
                if (Unit* unitTarget = GetHitUnit())
                    if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID, 0x00000002, 0, 0, caster->GetGUID()))
                    {
                        Aura* aura = aurEff->GetBase();

                        uint32 countMin = aura->GetMaxDuration();
                        uint32 countMax = 18000;
                        if (caster->HasAura(DRUID_INCREASED_MOONFIRE_DURATION))
                            countMax += 3000;
                        if (caster->HasAura(DRUID_NATURES_SPLENDOR))
                            countMax += 3000;

                        if (countMin < countMax)
                        {
                            aura->SetDuration(uint32(aura->GetDuration() + 3000));
                            aura->SetMaxDuration(countMin + 3000);
                        }
                    }
            }
开发者ID:AlexTheBest,项目名称:ACore,代码行数:22,代码来源:spell_druid.cpp

示例15: BuildAuraUpdateAllPacket

bool AuraInterface::BuildAuraUpdateAllPacket(WorldPacket* data)
{
	if(!m_auras.size())
		return false;

	bool res = false;
	Aura* aur = NULL;
	for (uint32 i=0; i<MAX_AURAS; i++)
	{
		if(m_auras.find(i) != m_auras.end())
		{
			res = true;
			aur = m_auras.at(i);
			aur->BuildAuraUpdate();
			uint8 flags = aur->GetAuraFlags();

			*data << uint8(aur->m_auraSlot);
			int32 stack = aur->stackSize;
			if(aur->procCharges > stack && stack != 0)
				stack = aur->procCharges;
			if(stack < 0)
			{
				*data << uint32(0);
				continue;
			}

			*data << uint32(aur->GetSpellId());
			*data << uint8(flags);
			*data << uint8(aur->GetUnitCaster() ? aur->GetUnitCaster()->getLevel() : 0);
			*data << uint8(stack);

			if(!(flags & AFLAG_NOT_GUID))
				FastGUIDPack(*data, aur->GetCasterGUID());

			if(flags & AFLAG_HAS_DURATION)
			{
				*data << aur->GetDuration();
				*data << aur->GetTimeLeft();
			}
		}
	}
	return res;
}
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:43,代码来源:AuraInterface.cpp


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