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


C++ Aura::GetDuration方法代码示例

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


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

示例1: TryBeneficCast

bool AI_SUPPORT_TOWER::TryBeneficCast( Unit *target )
{
	if( target->IsPlayer() && TickNow > SpellInstances[ STSI_TEAM_BUFF1 ].cooldown_finished )
	{
		Aura *a = target->FindAura( SpellBook[ STSI_TEAM_BUFF1 ].spell_id );
		if( a != NULL && a->GetDuration() < SpellBook[ STSI_TEAM_BUFF1 ].spell_duration_fixed )
		{
			a->Remove();
			a = NULL;
		}
		if( a == NULL )
		{
			CastSpellBookSpell( STSI_TEAM_BUFF1, target );
			return true;
		}
	}
	if( target->IsPlayer() && TickNow > SpellInstances[ STSI_TEAM_BUFF2 ].cooldown_finished )
	{
		Aura *a = target->FindAura( SpellBook[ STSI_TEAM_BUFF2 ].spell_id );
		if( a != NULL && a->GetDuration() < SpellBook[ STSI_TEAM_BUFF2 ].spell_duration_fixed )
		{
			a->Remove();
			a = NULL;
		}
		if( a == NULL )
		{
			CastSpellBookSpell( STSI_TEAM_BUFF2, target );
			return true;
		}
	}
	if( target->GetUInt32Value( UNIT_FIELD_HEALTH ) <  target->GetUInt32Value( UNIT_FIELD_MAXHEALTH )&& TickNow > SpellInstances[ STSI_TEAM_HEAL ].cooldown_finished )
	{
		Aura *a = target->FindAura( SpellBook[ STSI_TEAM_HEAL ].spell_id );
		if( a != NULL && a->GetDuration() < SpellBook[ STSI_TEAM_HEAL ].spell_duration_fixed )
		{
			a->Remove();
			a = NULL;
		}
		if( a == NULL )
		{
			CastSpellBookSpell( STSI_TEAM_HEAL, target );
			return true;
		}
	}
	//try to remove nerf so only weakest would be active on our players near us
//	target->RemoveAura( 14535 );
	return false;
}
开发者ID:AtVirus,项目名称:Descent-Scripts,代码行数:48,代码来源:AISupportTower.cpp

示例2: SpellStealAuras

void AuraInterface::SpellStealAuras(Unit* caster, int32 MaxSteals)
{
	Aura* aur = NULL;
	int32 spells_to_steal = MaxSteals > 1 ? MaxSteals : 1;
	for(uint32 x = 0; x < MAX_POSITIVE_AURAS; x++)
	{
		if(m_auras.find(x) != m_auras.end())
		{
			aur = m_auras.at(x);
			if(aur != NULL && aur->GetSpellId() != 15007 && !aur->IsPassive() && aur->IsPositive()) //Nothing can dispel resurrection sickness
			{
				if(aur->GetSpellProto()->DispelType == DISPEL_MAGIC && aur->GetDuration() > 0)
				{
					WorldPacket data(SMSG_SPELLDISPELLOG, 16);
					data << caster->GetNewGUID();
					data << m_Unit->GetNewGUID();
					data << uint32(1);
					data << aur->GetSpellId();
					caster->SendMessageToSet(&data,true);

					Aura* aura = new Aura(aur->GetSpellProto(), (aur->GetDuration()>120000) ? 120000 : aur->GetDuration(), caster, caster);
					aura->stackSize = aur->stackSize;

					// copy the mods across
					for( uint32 m = 0; m < aur->GetModCount(); ++m )
					{
						Modifier *mod = aur->GetMod(m);
						aura->AddMod(mod->m_type, mod->m_baseAmount, mod->m_miscValue, mod->i);
					}

					caster->AddAura(aura);
					RemoveAuraBySlot(x);
					if( --spells_to_steal <= 0 )
						break; //exit loop now
				}
			}
		}
	}
}
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:39,代码来源:AuraInterface.cpp

示例3: OnHitTarget

            void OnHitTarget(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();
                Unit* target = GetHitUnit();
                Aura* aura = target->GetAura(SPELL_WARLOCK_UNSTABLE_AFFLICTION, caster->GetGUID());
                if (!aura)
                    aura = target->GetAura(SPELL_WARLOCK_IMMOLATE, caster->GetGUID());

                if (!aura)
                    return;

                int32 newDuration = aura->GetDuration() + GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 1000;
                aura->SetDuration(std::min(newDuration, aura->GetMaxDuration()));
            }
开发者ID:PavelDev,项目名称:wodnetcore,代码行数:14,代码来源:spell_warlock.cpp

示例4: TryNerfCast

bool AI_SUPPORT_TOWER::TryNerfCast( Unit *target )
{
//	TickNow = GetTickCount();
	if( target->IsPlayer() && TickNow > SpellInstances[ STSI_ENEMY_NERF1 ].cooldown_finished 
		)
	{
		Aura *a = target->FindAura( SpellBook[ STSI_ENEMY_NERF1 ].spell_id );
		if( a != NULL && a->GetDuration() < SpellBook[ STSI_ENEMY_NERF1 ].spell_duration_fixed )
		{
			a->Remove();
			a = NULL;
		}
		if( a == NULL )
		{
			CastSpellBookSpell( STSI_ENEMY_NERF1, target );
			return true;
		}
	}
	if( target->IsPlayer()	&& TickNow > SpellInstances[ STSI_ENEMY_NERF2 ].cooldown_finished 
		&& RollDiceForSpellCast( STSI_ENEMY_NERF2 ) == true 
		)
	{
		Aura *a = target->FindAura( SpellBook[ STSI_ENEMY_NERF2 ].spell_id );
		if( a != NULL && a->GetDuration() < SpellBook[ STSI_ENEMY_NERF1 ].spell_duration_fixed )
		{
			a->Remove();
			a = NULL;
		}
		if( a == NULL )
		{
			CastSpellBookSpell( STSI_ENEMY_NERF2, target );
			return true;
		}
	}
	return false;
}
开发者ID:AtVirus,项目名称:Descent-Scripts,代码行数:36,代码来源:AISupportTower.cpp

示例5: DoEffect

    bool DoEffect(Unit* victim, SpellInfo* CastingSpell, uint32 flag, uint32 dmg, uint32 abs, int* dmg_overwrite, uint32 weapon_damage_type)
    {
        Aura* aura = mTarget->FindAuraByNameHash(SPELL_HASH_SLICE_AND_DICE);
        if (aura)
        {
            // Duration of 5 combo maximum
            int32 dur = 21 * MSTIME_SECOND;

            spellModFlatIntValue(mTarget->SM_FDur, &dur, aura->GetSpellInfo()->SpellGroupType);
            spellModPercentageIntValue(mTarget->SM_PDur, &dur, aura->GetSpellInfo()->SpellGroupType);

            // Set new aura's duration, reset event timer and set client visual aura
            aura->SetDuration(dur);
            sEventMgr.ModifyEventTimeLeft(aura, EVENT_AURA_REMOVE, aura->GetDuration());
            mTarget->ModVisualAuraStackCount(aura, 0);
        }

        return true;
    }
开发者ID:master312,项目名称:AscEmu,代码行数:19,代码来源:SpellProc_ClassScripts.cpp

示例6: 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

示例7: HandleScriptEffect

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

                        uint32 countMin = aura->GetMaxDuration();
                        uint32 countMax = aura->GetSpellInfo()->GetMaxDuration() + 9000;
                        if (caster->HasAura(SPELL_DRUID_INCREASED_MOONFIRE_DURATION))
                            countMax += 3000;

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

示例8: 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

示例9: 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

示例10: HandleSpiritHealerActivateOpcode

//////////////////////////////////////////////////////////////
/// This function handles CMSG_SPIRIT_HEALER_ACTIVATE:
//////////////////////////////////////////////////////////////
void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
{
	if(!_player->IsInWorld() ||!_player->isDead()) return;
	GetPlayer( )->DeathDurabilityLoss(0.25);
	GetPlayer( )->ResurrectPlayer();

	Aura *aur = GetPlayer()->FindAura(15007);

	if(aur) // If the player already have the aura, just extend it.
	{
		GetPlayer()->SetAurDuration(15007,aur->GetDuration());
	}
	else // else add him one, that fucker, he think he will get away!?
	{
		SpellEntry *spellInfo = sSpellStore.LookupEntry( 15007 );//resurrectin sickness
		SpellCastTargets targets;
		targets.m_unitTarget = GetPlayer()->GetGUID();
		Spell*sp=new Spell(_player,spellInfo,true,NULL);
		sp->prepare(&targets);
	}

	GetPlayer( )->SetUInt32Value(UNIT_FIELD_HEALTH, GetPlayer()->GetUInt32Value(UNIT_FIELD_MAXHEALTH)/2);
}
开发者ID:jameyboor,项目名称:Antrix,代码行数:26,代码来源:NPCHandler.cpp

示例11: RemoveAllAurasByInterruptFlagButSkip

void AuraInterface::RemoveAllAurasByInterruptFlagButSkip(uint32 flag, uint32 skip)
{
	Aura* a = NULL;
	for(uint32 x = 0; x < MAX_AURAS; x++)
	{
		a = NULL;
		if(m_auras.find(x) == m_auras.end())
			continue;

		a = m_auras.at(x);
		if( a->GetDuration() > 0 && (int32)(a->GetTimeLeft()+500) > a->GetDuration() )
			continue;//pretty new aura, don't remove

		//some spells do not get removed all the time only at specific intervals
		if((a->m_spellProto->AuraInterruptFlags & flag) && (a->m_spellProto->Id != skip) && a->m_spellProto->proc_interval==0)
		{
			//the black sheeps of sociaty
			if(a->m_spellProto->AuraInterruptFlags & AURA_INTERRUPT_ON_CAST_SPELL)
			{
				switch(a->GetSpellProto()->Id)
				{
				// priest - holy conc
				case 34754:
					{
						if( m_Unit->GetCurrentSpell() !=NULL &&
								!(m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_FLASH_HEAL ||
								m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_BINDING_HEAL ||
								m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_GREATER_HEAL))
							continue;
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_FLASH_HEAL && spi->NameHash != SPELL_HASH_BINDING_HEAL && spi->NameHash != SPELL_HASH_GREATER_HEAL)
							continue;
					}break;
				//Arcane Potency
				case 57529:
				case 57531:
					{
						if( m_Unit->GetCurrentSpell() != NULL && !(m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_PRESENCE_OF_MIND
							|| m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_CLEARCASTING ))
							continue;

						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL || !(spi->c_is_flags & SPELL_FLAG_IS_DAMAGING) )
							continue;

					}break;
				//paladin - Art of war
				case 53489:
				case 59578:
					{
						if( m_Unit->GetCurrentSpell() != NULL && m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_FLASH_OF_LIGHT )
							continue;
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_FLASH_OF_LIGHT )
							continue;
					}break;
				//paladin - Infusion of light
				case 53672:
				case 54149:
					{
						if( m_Unit->GetCurrentSpell() != NULL && !(m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_FLASH_OF_LIGHT
							|| m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_HOLY_LIGHT))
							continue;
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_FLASH_OF_LIGHT && spi->NameHash != SPELL_HASH_HOLY_LIGHT)
							continue;
					}break;
				//Mage - Firestarter
				case 54741:
					{
						if( m_Unit->GetCurrentSpell() != NULL && m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_FLAMESTRIKE )
							continue;
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_FLAMESTRIKE )
							continue;
					}break;
				case 34936:		// Backlash
					{
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_SHADOW_BOLT && spi->NameHash != SPELL_HASH_INCINERATE )
							continue;
					}break;

				case 17941: //Shadow Trance
					{
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_SHADOW_BOLT )
							continue;
					}break;
				// Glyph of Revenge Proc
				case 58363:
					{
						if( m_Unit->GetCurrentSpell() != NULL && m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_HEROIC_STRIKE )
							continue;
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_HEROIC_STRIKE )
							continue;
					}break;
				case 18708: //Fel Domination
					{
//.........这里部分代码省略.........
开发者ID:Refuge89,项目名称:Hearthstone,代码行数:101,代码来源:AuraInterface.cpp

示例12: PainAndSufferingProc

bool PainAndSufferingProc(uint8_t /*effectIndex*/, Spell* pSpell)
{
    Player* caster = pSpell->p_caster;
    if (caster == NULL)
        return true;

    Unit* target = pSpell->GetUnitTarget();
    if (target == NULL)
        return true;

    uint32 shadowWordPain[] =
    {
        //SPELL_HASH_SHADOW_WORD__PAIN
        589,
        594,
        970,
        992,
        2767,
        10892,
        10893,
        10894,
        11639,
        14032,
        15654,
        17146,
        19776,
        23268,
        23952,
        24212,
        25367,
        25368,
        27605,
        30854,
        30898,
        34441,
        34941,
        34942,
        37275,
        41355,
        46560,
        48124,
        48125,
        57778,
        59864,
        60005,
        60446,
        65541,
        68088,
        68089,
        68090,
        72318,
        72319,
        0
    };
    Aura* aura = target->getAuraWithIdForGuid(shadowWordPain, caster->getGuid());
    if (aura == nullptr)
        return true;

    // Set new aura's duration, reset event timer and set client visual aura
    aura->SetDuration(aura->GetDuration());
    sEventMgr.ModifyEventTimeLeft(aura, EVENT_AURA_REMOVE, aura->GetDuration());
    target->ModVisualAuraStackCount(aura, 0);

    return true;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:65,代码来源:PriestSpells.cpp


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