Example #1
0
            void OnPeriodic(AuraEffect const* aurEff)
            {
                Unit* target = GetTarget();
                if (target->HasAura(SPELL_EXHAUSTED_RAM))
                    return;

                switch (GetId())
                {
                    case SPELL_RAM_LEVEL_NEUTRAL:
                        if (Aura* aura = target->GetAura(SPELL_RAM_FATIGUE))
                            aura->ModStackAmount(-4);
                        break;
                    case SPELL_RAM_TROT: // green
                        if (Aura* aura = target->GetAura(SPELL_RAM_FATIGUE))
                            aura->ModStackAmount(-2);
                        if (aurEff->GetTickNumber() == 4)
                            target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_GREEN, true);
                        break;
                    case SPELL_RAM_CANTER:
                        target->CastCustomSpell(SPELL_RAM_FATIGUE, SPELLVALUE_AURA_STACK, 1, target, TRIGGERED_FULL_MASK);
                        if (aurEff->GetTickNumber() == 8)
                            target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_YELLOW, true);
                        break;
                    case SPELL_RAM_GALLOP:
                        target->CastCustomSpell(SPELL_RAM_FATIGUE, SPELLVALUE_AURA_STACK, target->HasAura(SPELL_RAM_FATIGUE) ? 4 : 5 /*Hack*/, target, TRIGGERED_FULL_MASK);
                        if (aurEff->GetTickNumber() == 8)
                            target->CastSpell(target, SPELL_BREWFEST_QUEST_SPEED_BUNNY_RED, true);
                        break;
                    default:
                        break;
                }

            }
Example #2
0
            void HandleScriptEffect(SpellEffIndex /*effIndex*/)
            {
                int32 extraDuration = GetEffectValue();
                Unit* target = GetHitUnit();
                ObjectGuid casterGUID = GetCaster()->GetGUID();

                if (Aura* ff = target->GetAura(SPELL_DK_FROST_FEVER, casterGUID))
                {
                    int32 newDuration = std::min(ff->GetDuration() + extraDuration, 2 * MINUTE * IN_MILLISECONDS); // caps at 2min.
                    ff->SetDuration(newDuration);
                    ff->SetMaxDuration(newDuration);
                }

                if (Aura* bp = target->GetAura(SPELL_DK_BLOOD_PLAGUE, casterGUID))
                {
                    int32 newDuration = std::min(bp->GetDuration() + extraDuration, 2 * MINUTE * IN_MILLISECONDS); // caps at 2min.
                    bp->SetDuration(newDuration);
                    bp->SetMaxDuration(newDuration);
                }

                if (Aura* coi = target->GetAura(SPELL_DK_CHAINS_OF_ICE, casterGUID))
                {
                    int32 newDuration = std::min(coi->GetDuration() + extraDuration, 20 * IN_MILLISECONDS); // is 20sec cap? couldnt manage to get runes up to pass 20.
                    coi->SetDuration(newDuration);
                    coi->SetMaxDuration(newDuration);
                }
            }
Example #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()));
            }
Example #4
0
            void HandleDummy(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
            {
                PreventDefaultAction();

                // Remove +% AP aura
                Unit* pet = eventInfo.GetActor();
                Aura* aura = pet->GetAura(SPELL_PET_SWOOP, pet->GetGUID());
                if (!aura)
                    aura = pet->GetAura(SPELL_PET_CHARGE, pet->GetGUID());

                if (!aura)
                    return;

                aura->DropCharge(AURA_REMOVE_BY_EXPIRE);
            }
Example #5
0
        void HandleScript(SpellEffIndex /*effIndex*/)
        {
            Unit* caster = GetCaster();
            Unit* target = GetHitUnit();

            if (!caster || !target)
                return;

            if (AuraPtr smash = caster->GetAura(SPELL_SMASH_AURA))
            {
                int32 stacks = smash->GetStackAmount();
                if (stacks)
                {
                    if (stacks > 1)
                        smash->SetStackAmount(stacks - 1);
                    else
                        caster->RemoveAurasDueToSpell(SPELL_SMASH_AURA);
                }
            }

            const SpellInfo* SmashSpell = sSpellMgr->GetSpellInfo(SPELL_SMASH, caster->GetMap()->GetDifficulty());
            if (SmashSpell)
            {
                std::list<Creature*> verminList;
                GetCreatureListWithEntryInGrid(verminList, caster, NPC_BOPPER,   6.0f);
                GetCreatureListWithEntryInGrid(verminList, caster, NPC_HOPPER,   6.0f);
                GetCreatureListWithEntryInGrid(verminList, caster, NPC_HOPPLING, 6.0f);

                if (!verminList.empty())
                    for (auto vermin: verminList)
                        caster->DealDamage(vermin, vermin->GetHealth(), NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SmashSpell);
            }
        }
Example #6
0
            void HandlePeriodic(constAuraEffectPtr aurEff)
            {
                Unit* caster = GetCaster();
                Unit* target = GetTarget();
                const SpellInfo* spell = GetSpellInfo();
                Player* linkedPlayer = sObjectAccessor->GetPlayer(*target, playerLinkedGuid);

                if (!caster || !target || !spell || !linkedPlayer || !linkedPlayer->isAlive() || !linkedPlayer->HasAura(spell->Id))
                    if (AuraPtr myaura = GetAura())
                    {
                        myaura->Remove();
                        return;
                    }

                if (target->GetDistance(linkedPlayer) > spell->Effects[EFFECT_0].BasePoints)
                {
                    if (AuraPtr aura = target->GetAura(spell->Id))
                    {
                        if (aura->GetStackAmount() >= 15)
                        {
                            aura->Remove();
                            return;
                        }
                    }
                    
                    caster->AddAura(spell->Id, target);
                    target->CastSpell(linkedPlayer, SPELL_JASPER_CHAINS_DAMAGE, true);
                }
                else
                    target->CastSpell(linkedPlayer, SPELL_JASPER_CHAINS_VISUAL, true);
            }
Example #7
0
            void HandleScript(SpellEffIndex /*effIndex*/)
            {
                Creature* caster = GetCaster()->ToCreature();
                Unit* target = GetHitUnit();

                if (!target || !caster)
                    return;

                if (target->HasAura(SPELL_KILL_COUNTER_VISUAL_MAX))
                    return;

                if (Aura const* aura = target->GetAura(GetSpellInfo()->Id))
                {
                    switch (aura->GetStackAmount())
                    {
                        case 10:
                            caster->AI()->Talk(EMOTE_TURKEY_HUNTER, target);
                            break;
                        case 20:
                            caster->AI()->Talk(EMOTE_TURKEY_DOMINATION, target);
                            break;
                        case 30:
                            caster->AI()->Talk(EMOTE_TURKEY_SLAUGHTER, target);
                            break;
                        case 40:
                            caster->AI()->Talk(EMOTE_TURKEY_TRIUMPH, target);
                            target->CastSpell(target, SPELL_KILL_COUNTER_VISUAL_MAX, true);
                            target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
                            break;
                        default:
                            return;
                    }
                    target->CastSpell(target, SPELL_KILL_COUNTER_VISUAL, true);
                }
            }
Example #8
0
        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim())
                return;

            if (uiGripOfSladRanTimer <= diff)
            {
                Unit* target = me->GetVictim();

                DoCast(target, SPELL_GRIP_OF_SLAD_RAN);
                uiGripOfSladRanTimer = urand(3, 6)*IN_MILLISECONDS;

                Aura* grip = target->GetAura(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID());
                if (grip && grip->GetStackAmount() == 5)
                {
                    target->RemoveAurasDueToSpell(SPELL_GRIP_OF_SLAD_RAN, me->GetGUID());
                    target->CastSpell(target, SPELL_SNAKE_WRAP, true);

                    if (TempSummon* _me = me->ToTempSummon())
                        if (Unit* summoner = _me->GetSummoner())
                            if (Creature* sladran = summoner->ToCreature())
                                sladran->AI()->SetGUID(target->GetGUID(), DATA_SNAKES_WHYD_IT_HAVE_TO_BE_SNAKES);

                    me->DespawnOrUnsummon();
                }
            } else uiGripOfSladRanTimer -= diff;
        }
Example #9
0
     void UpdateAI(const uint32 uiDiff)
     {
         if (m_uiRangeCheckTimer < uiDiff)
         {
             if (Unit* target = me->SelectNearestTarget(3.0f))
             {
                 if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive())
                 {
                     if (target->HasAura(SPELL_DARK_ESSENCE))
                     {
                         DoCastAOE(SPELL_UNLEASHED_LIGHT);
                         me->GetMotionMaster()->MoveIdle();
                         me->DespawnOrUnsummon();
                     }
                     else if (target->HasAura(SPELL_LIGHT_ESSENCE))
                     {
                         std::list<Unit*> targetList;
 
                         SelectTargetList(targetList, 100, SELECT_TARGET_NEAREST, 6.0f, true, SPELL_LIGHT_ESSENCE);
                         if (!targetList.empty())
                         {
                             for (std::list<Unit* >::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
                             {
                                 Unit* pUnit = (*itr);
                                 if (pUnit && pUnit->isAlive())
                                 {
                                     if (!pUnit->HasAura(SPELL_POWER_UP))
                                         pUnit->AddAura(SPELL_POWER_UP, pUnit);
 
                                     if (Aura* aur = pUnit->GetAura(SPELL_POWER_UP))
                                     {
                                         if (aur->GetStackAmount() + 6 > 100)
                                         {
                                             pUnit->RemoveAurasDueToSpell(SPELL_POWER_UP);
                                             pUnit->CastSpell(pUnit, SPELL_EMPOWERED_LIGHT, true);
                                         }
                                         else
                                         {
                                             if (urand(0, 100) <= 15)
                                                 pUnit->CastSpell(pUnit, SPELL_SPEED, true);
 
                                             aur->SetStackAmount(aur->GetStackAmount() + 6);
                                         }
                                     }
                                 }
                             }
                         }
 
                         me->GetMotionMaster()->MoveIdle();
                         me->DespawnOrUnsummon();
                     }
                 }
             }
             m_uiRangeCheckTimer = 500;
         }
         else m_uiRangeCheckTimer -= uiDiff;
     }
Example #10
0
		void UpdateAI(const uint32 diff) {
			if (!UpdateVictim())
				return;

			if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold) {
				std::list<HostileReference*> ThreatList =
						me->getThreatManager().getThreatList();
				for (std::list<HostileReference*>::const_iterator itr =
						ThreatList.begin(); itr != ThreatList.end(); ++itr) {
					Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
					if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER)
						continue;

					Aura *AuraIntenseCold = pTarget->GetAura(
							SPELL_INTENSE_COLD_TRIGGERED);
					if (AuraIntenseCold
							&& AuraIntenseCold->GetStackAmount() > 2) {
						bMoreThanTwoIntenseCold = true;
						break;
					}
				}
				uiCheckIntenseColdTimer = 2 * IN_MILLISECONDS;
			} else
				uiCheckIntenseColdTimer -= diff;

			if (!bEnrage && HealthBelowPct(25)) {
				DoScriptText(SAY_ENRAGE, me);
				DoCast(me, SPELL_ENRAGE);
				bEnrage = true;
			}

			if (uiCrystalfireBreathTimer <= diff) {
				DoCast(me->getVictim(), SPELL_CRYSTALFIRE_BREATH);
				uiCrystalfireBreathTimer = 14 * IN_MILLISECONDS;
			} else
				uiCrystalfireBreathTimer -= diff;

			if (uiTailSweepTimer <= diff) {
				DoCast(me, SPELL_TAIL_SWEEP);
				uiTailSweepTimer = 5 * IN_MILLISECONDS;
			} else
				uiTailSweepTimer -= diff;

			if (uiCrystalChainsCrystalizeTimer <= diff) {
				DoScriptText(SAY_CRYSTAL_NOVA, me);
				if (IsHeroic())
					DoCast(me, SPELL_CRYSTALIZE);
				else if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
					DoCast(pTarget, SPELL_CRYSTAL_CHAINS);
				uiCrystalChainsCrystalizeTimer = DUNGEON_MODE(
						30 * IN_MILLISECONDS, 11 * IN_MILLISECONDS);
			} else
				uiCrystalChainsCrystalizeTimer -= diff;

			DoMeleeAttackIfReady();
		}
Example #11
0
    void UpdateAI(const uint32 diff) 
    {
        if (!UpdateVictim())
            return;

        if (CheckIntenseColdTimer < diff && !MoreThanTwoIntenseCold)
        {
            std::list<HostilReference*> ThreatList = m_creature->getThreatManager().getThreatList();
            for(std::list<HostilReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++)
            {
                Unit *target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
                if (!target || target->GetTypeId() != TYPEID_PLAYER)
                    continue;

                Aura *AuraIntenseCold = target->GetAura(SPELL_INTENSE_COLD_TRIGGERED);
                if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2)
                {
                    MoreThanTwoIntenseCold = true;
                    break;
                }
            }
            CheckIntenseColdTimer = 2000;
        }else CheckIntenseColdTimer -= diff;

        if (!Enrage && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25))
        {
            DoScriptText(SAY_ENRAGE , m_creature);
            DoCast(m_creature, SPELL_ENRAGE);
            Enrage = true;
        }

        if (CRYSTALFIRE_BREATH_Timer < diff)
        {
            DoCast(m_creature->getVictim(), HeroicMode ? SPELL_CRYSTALFIRE_BREATH_H : SPELL_CRYSTALFIRE_BREATH_N);
            CRYSTALFIRE_BREATH_Timer = 14000;
        }else CRYSTALFIRE_BREATH_Timer -=diff;

        if (TAIL_SWEEP_Timer < diff)
        {
            DoCast(m_creature, SPELL_TAIL_SWEEP);
            TAIL_SWEEP_Timer = 5000;
        }else TAIL_SWEEP_Timer -=diff;

        if (CRYSTAL_CHAINS_CRYSTALIZE_Timer < diff)
        {
            DoScriptText(SAY_CRYSTAL_NOVA , m_creature);
            if (HeroicMode)
                DoCast(m_creature, SPELL_CRYSTALIZE);
            else
                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    DoCast(target, SPELL_CRYSTAL_CHAINS);
            CRYSTAL_CHAINS_CRYSTALIZE_Timer = HeroicMode ? 30000 : 11000;
        }else CRYSTAL_CHAINS_CRYSTALIZE_Timer -= diff;

        DoMeleeAttackIfReady();    
    }
Example #12
0
        void HandleScriptEffect(SpellEffIndex /*effIndex*/)
        {
            Unit* target = GetHitUnit();

            if (!target)
                return;

            if (Aura* renew = target->GetAura(PRIEST_SPELL_RENEW, GetCaster()->GetGUID()))
                renew->RefreshDuration();
        }
Example #13
0
    void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
    {
        PreventDefaultAction();
        Unit* healer = eventInfo.GetProcTarget();
        if (healer->HasAura(SPELL_VITAL_FLAME))
            return;

        bool is25ManHeroic = healer->GetMap()->IsHeroic() && healer->GetMap()->Is25ManRaid();
        uint32 stacks = healer->GetAuraCount(SPELL_VITAL_SPARK) + std::min(uint8(ceil(GetStackAmount() / (is25ManHeroic ? 5.0 : 3.0))), uint8(255));

        healer->SetAuraStack(SPELL_VITAL_SPARK, healer, stacks);
        if (Aura* aura = healer->GetAura(SPELL_VITAL_SPARK))
            aura->RefreshDuration();
    }
Example #14
0
            void HandleDummy(SpellEffIndex /*effIndex*/)
            {
                Unit* caster = GetCaster();
                Unit* target = GetHitUnit();

                if (ffDuration)
                    caster->CastSpell(target, SPELL_DK_FROST_FEVER, true);
                if (bpDuration)
                    caster->CastSpell(target, SPELL_DK_BLOOD_PLAGUE, true);

                if (!caster->HasAura(SPELL_DK_SCENT_OF_BLOOD))
                {
                    if (Aura* bp = target->GetAura(SPELL_DK_BLOOD_PLAGUE, caster->GetGUID()))
                    {
                        bp->SetDuration(bpDuration);
                        bp->SetMaxDuration(bpDuration);
                    }
                    if (Aura* ff = target->GetAura(SPELL_DK_FROST_FEVER, caster->GetGUID()))
                    {
                        ff->SetDuration(ffDuration);
                        ff->SetMaxDuration(ffDuration);
                    }
                }
            }
		void UpdateAI(uint32 diff)
		{
			if (channelTarget == NULL/* || lastTarget == NULL */|| zealot == NULL)
				return;

			if(zealot && (zealot->HasAura(SPELL_TWILIGHT_EVOLUTION) || zealot->isDead()))
				return;

			if (uiCheckPlayerIsBetween <= diff)
			{
				channelTarget = zealot;
				Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();

				if (!PlayerList.isEmpty())
				{
					for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
					{
						if(i->getSource()->IsInBetween(me, zealot, 1.0f))
							channelTarget = i->getSource();
					}
				}

				zealot->SetAuraStack(SPELL_EVOLUTION,channelTarget,channelTarget->GetAuraCount(SPELL_EVOLUTION)+1);
				
                if (channelTarget->HasAura(SPELL_EVOLUTION))
                    channelTarget->GetAura(SPELL_EVOLUTION)->RefreshDuration();

				if(channelTarget->GetAuraCount(SPELL_EVOLUTION) == 100)
				{
					if(channelTarget == zealot)
                    {
					    channelTarget->RemoveAllAuras();
    					zealot->CastSpell(channelTarget, SPELL_TWILIGHT_EVOLUTION, true);
                    }

                    if (channelTarget->ToPlayer())
                        channelTarget->Kill(channelTarget, true);
				}

				uiCheckPlayerIsBetween = 175;
			} else uiCheckPlayerIsBetween -= diff;

			if (uiNetherEssenceVisual <= diff)
			{
				me->CastSpell(me, SPELL_NETHERESSENCE_VISUAL, true);
				uiNetherEssenceVisual = urand(3500,4000);
			} else uiNetherEssenceVisual -= diff;
		}
void HammerOfRighteousScript::HandleBeforeHit()
{
    Unit* caster = GetCaster();
    Unit* target = GetExplTargetUnit();

    if (!caster || !target)
        return;

    Aura* hammerJustice = target->GetAura(SPELL_HAMMER_JUSTICE_STUN);

    // Target isn't affected by HoJ so is able to pickup the Hammer
    if (!hammerJustice)
    {
        caster->CastSpell(target, SPELL_HAMMER_RIGHTEOUS_P);
        PreventHitDamage();
    }
}
Example #17
0
void ThreatManager::doAddThreat(Unit* victim, float threat)
{
    uint32 reducedThreadPercent = victim->GetReducedThreatPercent();

    // must check > 0.0f, otherwise dead loop
    if (threat > 0.0f && reducedThreadPercent)
    {
        Unit* redirectTarget = victim->GetMisdirectionTarget();
        if (redirectTarget)
            if (Aura* glyphAura = redirectTarget->GetAura(63326)) // Glyph of Vigilance
                reducedThreadPercent += glyphAura->GetSpellInfo()->Effects[0].CalcValue();

        float reducedThreat = threat * reducedThreadPercent / 100.0f;
        threat -= reducedThreat;
        if (redirectTarget)
            _addThreat(redirectTarget, reducedThreat);
    }

    _addThreat(victim, threat);
}
Example #18
0
void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
{
    //function deals with adding threat and adding players and pets into ThreatList
    //mobs, NPCs, guards have ThreatList and HateOfflineList
    //players and pets have only InHateListOf
    //HateOfflineList is used co contain unattackable victims (in-flight, in-water, GM etc.)

    // not to self
    if (pVictim == getOwner())
        return;

    // not to GM
    if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster()))
        return;

    // not to dead and not for dead
    if (!pVictim->isAlive() || !getOwner()->isAlive())
        return;

    ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT);

    float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, schoolMask, pThreatSpell);

    // must check > 0.0f, otherwise dead loop
    if (threat > 0.0f && pVictim->GetReducedThreatPercent())
    {
        uint32 reducedThreadPercent = pVictim->GetReducedThreatPercent();

        Unit *unit = pVictim->GetMisdirectionTarget();
        if (unit)
            if (Aura* pAura = unit->GetAura(63326)) // Glyph of Vigilance
                reducedThreadPercent += SpellMgr::CalculateSpellEffectAmount(pAura->GetSpellProto(), 0);

        float reducedThreat = threat * reducedThreadPercent / 100;
        threat -= reducedThreat;
        if (unit)
            _addThreat(unit, reducedThreat);
    }

    _addThreat(pVictim, threat);
}
Example #19
0
void Pet::UpdateResistances(uint32 school)
{
    if (school > SPELL_SCHOOL_NORMAL)
    {
        float value  = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school));

        Unit *owner = GetOwner();
        // hunter and warlock pets gain 40% of owner's resistance
        if (owner && (getPetType() == HUNTER_PET || getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK))
            value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;

        // Void Star Talisman's resistance bonus
        if (owner && getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)
            if (Aura *aura = owner->GetAura(37386, 0))
                value += float(aura->GetModifierValue());

        SetResistance(SpellSchools(school), int32(value));
    }
    else
        UpdateArmor();
}
Example #20
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;
            
        if (me->getVictim() && !me->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself())
            me->Kill(me->getVictim());

        events.Update(diff);
        
        if (me->hasUnitState(UNIT_STAT_CASTING))
            return;
                    
        if (uiCheckIntenseColdTimer < diff && !bMoreThanTwoIntenseCold)
        {
            std::list<HostileReference*> ThreatList = me->getThreatManager().getThreatList();
            for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
            {
                Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
                if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER)
                    continue;

                Aura *AuraIntenseCold = pTarget->GetAura(SPELL_BITING_COLD_TRIGGERED);
                if (AuraIntenseCold && AuraIntenseCold->GetStackAmount() > 2)
                {
                    bMoreThanTwoIntenseCold = true;
                    break;
                }
            }
            uiCheckIntenseColdTimer = 2000;
        } else uiCheckIntenseColdTimer -= diff;

        while(uint32 eventId = events.ExecuteEvent())
        {
            switch(eventId)
            {
                case EVENT_FREEZE:
                    DoCastAOE(SPELL_FREEZE);
                    events.ScheduleEvent(EVENT_FREEZE, urand(30000, 35000));
                    break;
                case EVENT_ICICLE:
                    if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        if (pTarget->isAlive())
                            DoCast(pTarget, SPELL_ICICLE);
                    events.ScheduleEvent(EVENT_ICICLE, 2000);
                    break;
                case EVENT_FLASH_CAST:
                    DoScriptText(SAY_FLASH_FREEZE, me);
                    me->MonsterTextEmote(EMOTE_FREEZE, 0, true);
                    for (uint32 i = 0; i < RAID_MODE(2,3); ++i)
                        if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            if (pTarget->isAlive())
                                pTarget->CastSpell(pTarget, SPELL_ICICLE_SNOWDRIFT, true);
                    DoCast(SPELL_FLASH_FREEZE);
                    events.RescheduleEvent(EVENT_ICICLE, 15000);
                    events.ScheduleEvent(EVENT_FLASH_CAST, 50000);
                    events.ScheduleEvent(EVENT_FLASH_EFFECT, 9000);
                    break;
                case EVENT_FLASH_EFFECT:
                    DoCast(SPELL_FLASH_FREEZE_VISUAL);
                    FlashFreeze();
                    events.CancelEvent(EVENT_FLASH_EFFECT);
                    break;
                case EVENT_BLOWS:
                    DoScriptText(SAY_STALACTITE, me);
                    me->MonsterTextEmote(EMOTE_BLOWS, 0, true);
                    DoCast(me, RAID_MODE(SPELL_FROZEN_BLOWS_10, SPELL_FROZEN_BLOWS_25));
                    events.ScheduleEvent(EVENT_BLOWS, urand(60000, 65000));
                    break;
                case EVENT_RARE_CACHE:
                    DoScriptText(SAY_HARD_MODE_MISSED, me);
                    RareCache = false;
                    events.CancelEvent(EVENT_RARE_CACHE);
                    break;
                case EVENT_BERSERK:
                    DoCast(me, SPELL_BERSERK, true);
                    DoScriptText(SAY_BERSERK, me);
                    events.CancelEvent(EVENT_BERSERK);
                    break;
            }
        }

        DoMeleeAttackIfReady();
    }
Example #21
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_instance || !UpdateVictim())
            return;

        if (m_instance->GetData(DATA_HEALTH_TWIN_SHARED) != 0)
            me->SetHealth(m_instance->GetData(DATA_HEALTH_TWIN_SHARED));
        else if (me->getVictim())
        {
            me->LowerPlayerDamageReq(me->GetMaxHealth());
            me->getVictim()->Kill(me);
            return;
        }
        else
            me->SetHealth(1);

        if (m_uiSpecialAbilityTimer <= uiDiff)
        {
            me->InterruptNonMeleeSpells(false);

            if (urand(0, 1))
            {
                DoScriptText(m_uiVortexEmote, me);
                DoScriptText(m_uiVortexSay, me);
                DoCastAOE(m_uiVortexSpellId);

                std::list<Unit*> targetList;

                SelectTargetList(targetList, 100, SELECT_TARGET_NEAREST, 150.0f, true, m_uiMyEssenceSpellId);
                if (!targetList.empty())
                {
                    for (std::list<Unit* >::const_iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
                    {
                        Unit* pUnit = (*itr);
                        if (pUnit && pUnit->isAlive())
                        {
                            if (!pUnit->HasAura(SPELL_POWER_UP))
                                pUnit->AddAura(SPELL_POWER_UP, pUnit);

                            if (Aura* aur = pUnit->GetAura(SPELL_POWER_UP))
                            {
                                if (aur->GetStackAmount() + 30 > 100)
                                {
                                    pUnit->RemoveAurasDueToSpell(SPELL_POWER_UP);
                                    pUnit->CastSpell(pUnit, me->GetEntry() == NPC_LIGHTBANE ? SPELL_EMPOWERED_LIGHT : SPELL_EMPOWERED_DARK, true);
                                }
                                else
                                {
                                    if (urand(0, 100) <= 15)
                                        pUnit->CastSpell(pUnit, SPELL_SPEED, true);

                                    aur->SetStackAmount(aur->GetStackAmount() + 30);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                DoScriptText(EMOTE_SHIELD, me);
                DoScriptText(SAY_SHIELD, me);

                if (Creature* Sister = GetSister())
                    Sister->CastSpell(Sister, SPELL_TWIN_POWER, true);

                DoCast(me, m_uiShieldSpellId);
                me->CastCustomSpell(me, m_uiTwinPactSpellId, 0, 0, 0, false);
            }

            m_uiSpecialAbilityTimer = 80000;

        } else m_uiSpecialAbilityTimer -= uiDiff;

        if (m_uiSpikeTimer <= uiDiff)
        {
            DoCastVictim(m_uiSpikeSpellId);
            m_uiSpikeTimer = 20*1000;
        } else m_uiSpikeTimer -= uiDiff;

        if (IsHeroic())
        {
            if (m_uiTouchTimer <= uiDiff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true, m_uiOtherEssenceSpellId))
                {
                    if (!target->HasAura(m_uiTouchSpellId))
                    {
                        target->AddAura(m_uiTouchSpellId, target);
                    }
                }
                m_uiTouchTimer = urand(10, 15)*1000;
            } else m_uiTouchTimer -= uiDiff;
        }

        if (m_uiColorballsTimer <= uiDiff)
        {
            if (m_uiWaveCount >= 2)
            {
                SummonColorballs(15);
                m_uiWaveCount = 0;
            } 
            else
            {
                SummonColorballs(2);
                m_uiWaveCount++;
            }
            m_uiColorballsTimer = 15*1000;
        } else m_uiColorballsTimer -= uiDiff;

        if (m_uiBerserkTimer <= uiDiff)
        {
            if (!m_bIsBerserk)
            {
                DoCast(me, SPELL_BERSERK);
                DoScriptText(SAY_BERSERK, me);
                m_bIsBerserk = true;
            }
        } else m_uiBerserkTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
Example #22
0
 void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& eventInfo)
 {
     PreventDefaultAction();
     Unit* target = eventInfo.GetProcTarget();
     target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
     target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
     target->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
 }