Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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
				}
			}
		}
	}
}
Ejemplo n.º 3
0
            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()));
            }
Ejemplo n.º 4
0
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;
}
Ejemplo n.º 5
0
    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;
    }
Ejemplo n.º 6
0
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;
}
Ejemplo n.º 7
0
            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);
                        }
                    }
            }
Ejemplo n.º 8
0
            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);
            }
Ejemplo n.º 9
0
            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);
            }
Ejemplo n.º 10
0
//////////////////////////////////////////////////////////////
/// 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 f****r, 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);
}
Ejemplo n.º 11
0
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
					{
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_SUMMON_IMP &&
							spi->NameHash != SPELL_HASH_SUMMON_VOIDWALKER &&
							spi->NameHash != SPELL_HASH_SUMMON_SUCCUBUS &&
							spi->NameHash != SPELL_HASH_SUMMON_FELHUNTER &&
							spi->NameHash != SPELL_HASH_SUMMON_FELGUARD )
							continue;
					}break;
				case 46916: // Bloodsurge
					{
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_SLAM )
							continue;
					}break;
				case 14177: // Cold Blood
					{
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && !(spi->c_is_flags & SPELL_FLAG_IS_DAMAGING) && spi->NameHash != SPELL_HASH_MUTILATE )
							continue;
					}break;
				case 31834: // Light's Grace
					{
						if( m_Unit->GetCurrentSpell() != NULL && m_Unit->GetCurrentSpell()->GetSpellProto()->NameHash == SPELL_HASH_HOLY_LIGHT )
							continue;

						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && spi->NameHash != SPELL_HASH_HOLY_LIGHT )
							continue;
					}break;
				// Shadowstep
				case 44373:
				case 36563:
					{
						SpellEntry *spi = dbcSpell.LookupEntry( skip );
						if( spi != NULL && !(spi->c_is_flags & SPELL_FLAG_IS_DAMAGING) )
							continue;
					}break;
				}
			}
			RemoveAuraBySlot(x);
		}
	}
}
Ejemplo n.º 12
0
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;
}