Esempio n. 1
0
void Scripted_NoMovementAI::AttackStart(Unit* pWho)
{
    if (!m_creature->CanAttackByItself())
        return;

    if (pWho && m_creature->Attack(pWho, true))
    {
        m_creature->AddThreat(pWho);
        m_creature->SetInCombatWith(pWho);
        pWho->SetInCombatWith(m_creature);

        DoStartNoMovement(pWho);
    }
}
Esempio n. 2
0
void Scripted_NoMovementAI::AttackStart(Unit* who)
{
    if (!who)
        return;

    if (m_creature->Attack(who, true))
    {
        m_creature->AddThreat(who, 0.0f);
        m_creature->SetInCombatWith(who);
        who->SetInCombatWith(m_creature);

        DoStartNoMovement(who);
    }
}
Esempio n. 3
0
        void Reset()
        {
            m_uiColdFlameTimer = 900;

            SpellEntry* spell = GET_SPELL(SPELL_COLD_FLAME);
            if (spell)
                spell->EffectRadiusIndex[0] = 16; //prevent stack damage
            DoCast(me, SPELL_COLD_FLAME);

            me->SetVisible(false);
            DoStartNoMovement(me->getVictim());

            m_uiStage = 1;
            m_uiRadius = 2;
            m_uiOwnerEntry = 0;
        }
Esempio n. 4
0
    void AttackStart(Unit* pWho) override
    {
        if (m_bIsIntroEvent || !m_bIsMainEvent)
            return;

        if (m_creature->Attack(pWho, true))
        {
            m_creature->AddThreat(pWho);
            m_creature->SetInCombatWith(pWho);
            pWho->SetInCombatWith(m_creature);

            if (m_bPhase)
                DoStartNoMovement(pWho);
            else
                DoStartMovement(pWho);
        }
    }
Esempio n. 5
0
    void AttackStart(Unit* who)
    {
        if (IsIntroEvent || !IsMainEvent)
            return;

        if (m_creature->Attack(who, true))
        {
            m_creature->AddThreat(who);
            m_creature->SetInCombatWith(who);
            who->SetInCombatWith(m_creature);

            if (Phase)
                DoStartNoMovement(who);
            else
                DoStartMovement(who);
        }
    }
Esempio n. 6
0
		void MoveInLineOfSight(Unit *who) {
			if (!who || me->getVictim())
				return;

			if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)
					&& me->IsHostileTo(who)) {
				float attackRadius = me->GetAttackDistance(who);
				if (me->IsWithinDistInMap(who, attackRadius)
						&& me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE
						&& me->IsWithinLOSInMap(who)) {
					if (!me->isInCombat()) {
						DoStartNoMovement(who);
					}
				}
			} else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)
					&& me->IsWithinDistInMap(who, 30)) {
				IntroStepCounter = 0;
			}
		}
        void MoveInLineOfSight(Unit* who) override
        {
            if (!who || me->GetVictim())
                return;

            if (me->CanCreatureAttack(who))
            {
                float attackRadius = me->GetAttackDistance(who);
                if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who))
                {
                    if (!me->IsInCombat())
                    {
                        DoStartNoMovement(who);
                    }
                }
            }
            else if (IntroStepCounter == 10 && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 30))
                IntroStepCounter = 0;
        }
Esempio n. 8
0
        void AttackStart(Unit * who, float /*dist*/ = 0)
        {
            if (!who)
                return;

            if (me->GetPositionZ() > 518.63f)
                DoStartNoMovement(who);

            if (me->GetPositionZ() < 518.63f)
            {
                if (me->Attack(who, true))
                {
                    DoScriptText(SayAggro[3], me);

                    me->SetInCombatWith(who);
                    who->SetInCombatWith(me);

                    me->GetMotionMaster()->MoveChase(who, 0, 0);
                }
            }
        }
Esempio n. 9
0
        void AttackStart(Unit* who)
        {
            if (!who)
                return;

            if (me->GetPositionZ() > 518.63f)
                DoStartNoMovement(who);

            if (me->GetPositionZ() < 518.63f)
            {
                if (me->Attack(who, true))
                {
                    Talk(SAY_AGGRO);

                    me->SetInCombatWith(who);
                    who->SetInCombatWith(me);

                    me->GetMotionMaster()->MoveChase(who, 0, 0);
                }
            }
        }
Esempio n. 10
0
            void EnterCombat(Unit* who)
            {
                events.Reset();
                events.SetPhase(PHASE_ONE);
                // phase-independent events
                events.ScheduleEvent(EVENT_BERSERK, 600000);
                events.ScheduleEvent(EVENT_DEATH_AND_DECAY, 10000);
                // phase one only
                events.ScheduleEvent(EVENT_P1_SUMMON_WAVE, 5000, 0, PHASE_ONE);
                events.ScheduleEvent(EVENT_P1_SHADOW_BOLT, urand(5500, 6000), 0, PHASE_ONE);
                events.ScheduleEvent(EVENT_P1_EMPOWER_CULTIST, urand(20000, 30000), 0, PHASE_ONE);
                if (getDifficulty() != RAID_DIFFICULTY_10MAN_NORMAL)
                    events.ScheduleEvent(EVENT_DOMINATE_MIND_H, 27000);

                DoScriptText(SAY_AGGRO, me);
                DoStartNoMovement(who);
                me->RemoveAurasDueToSpell(SPELL_SHADOW_CHANNELING);
                DoCast(me, SPELL_MANA_BARRIER, true);

                instance->SetBossState(DATA_LADY_DEATHWHISPER, IN_PROGRESS);
            }
Esempio n. 11
0
        void AttackStart(Unit* pWho)
        {
            if (!pWho)
                return;

            if (me->GetPositionZ() > 518.63f)
                DoStartNoMovement(pWho);

            if (me->GetPositionZ() < 518.63f)
            {
                if (me->Attack(pWho, true))
                {
                    DoScriptText(SayAggro[3], me);

                    me->SetInCombatWith(pWho);
                    pWho->SetInCombatWith(me);

                    me->GetMotionMaster()->MoveChase(pWho, 0, 0);
                }
            }
        }
Esempio n. 12
0
    void UpdateAI(const uint32 diff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // Shoot
        if (m_uiShootTimer < diff)
        {
            if (m_creature->GetDistance2d(m_creature->getVictim()) >= 5.0f && DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT_2) == CAST_OK)
                m_uiShootTimer = urand(2500, 3500);
        }
        else 
            m_uiShootTimer -= diff;

        if (!IsCombatMovement())
        { //Melee
            if (!m_bInMelee && (m_creature->GetDistance2d(m_creature->getVictim()) < 5.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 95.0f || !m_creature->IsWithinLOSInMap(m_creature->getVictim())))
            {
                SetCombatMovement(true);
                DoStartMovement(m_creature->getVictim());
                m_bInMelee = true;
                return;
            }
        }
        else
        { //Range
            if (m_bInMelee && m_creature->GetDistance2d(m_creature->getVictim()) >= 5.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 95.0f && m_creature->IsWithinLOSInMap(m_creature->getVictim()))
            {
                SetCombatMovement(false);
                m_bInMelee = false;
                DoStartNoMovement(m_creature->getVictim());
                return;
            }
        }
        
        DoMeleeAttackIfReady();
    }
        void UpdateAI(const uint32 diff)
        {
            if (!Phase)
                return;

            if (me->getThreatManager().getThreatList().empty()) // Reset if event is begun and we don't have a threatlist
            {
                EnterEvadeMode();
                return;
            }

            Creature* Essence = NULL;
            if (EssenceGUID)
            {
                Essence = Unit::GetCreature(*me, EssenceGUID);
                if (!Essence)
                {
                    EnterEvadeMode();
                    return;
                }
            }

            if (Timer <= diff)
            {
                switch (Counter)
                {
                case 0:
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H);  // I R ANNNGRRRY!
                    DoStartNoMovement(me);
                    Timer = 3000;
                    break;
                case 1:
                    Timer = 2800;
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_SUBMERGE);  // Release the cube
                    DoCast(me, SPELL_SUBMERGE);
                    DoStartNoMovement(me);
                    break;
                case 2:
                    Timer = 5000;
                    if (Creature* Summon = DoSpawnCreature(23417+Phase, 0, 0, 0, 0, TEMPSUMMON_DEAD_DESPAWN, 0))
                    {
                        me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED);  // Ribs: open
                        Summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO, 0));
                        EssenceGUID = Summon->GetGUID();
                        DoStartNoMovement(me);
                    } else EnterEvadeMode();
                    break;
                case 3:
                    Timer = 1000;
                    if (Phase == 3)
                    {
                        if (!Essence->isAlive())
                            DoCast(me, 7, true);
                        else return;
                    }
                    else
                    {
                        if (Essence->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
                        {
                            MergeThreatList(Essence);
                            Essence->RemoveAllAuras();
                            Essence->DeleteThreatList();
                            Essence->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f);
                        } else return;
                    }
                    break;
                case 4:
                    Timer = 1500;
                    if (Essence->IsWithinDistInMap(me, 10))
                    {
                        Essence->SetUInt32Value(UNIT_NPC_EMOTESTATE, 374); //rotate and disappear
                        Timer = 2000;
                        me->RemoveAurasDueToSpell(SPELL_SUBMERGE);
                    }
                    else
                    {
                        MergeThreatList(Essence);
                        Essence->RemoveAllAuras();
                        Essence->DeleteThreatList();
                        Essence->GetMotionMaster()->MoveFollow(me, 0, 0);
                        return;
                    }
                    break;
                case 5:
                    if (Phase == 1)
                    {
                        DoScriptText(SUFF_SAY_AFTER, Essence);
                    }
                    else
                    {
                        DoScriptText(DESI_SAY_AFTER, Essence);
                    }
                    Essence->DespawnOrUnsummon();
                    me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0);
                    EssenceGUID = 0;
                    SoulCount = 0;
                    SoulDeathCount = 0;
                    Timer = 3000;
                    break;
                case 6:
                    if (SoulCount < NUMBER_ENSLAVED_SOUL)
                    {
                        if (SummonSoul())
                            ++SoulCount;
                        Timer = 500;
                        return;
                    }
                    break;
                case 7:
                    if (SoulDeathCount >= SoulCount)
                    {
                        Counter = 1;
                        ++Phase;
                        Timer = 5000;
                    }
                    return;
                default:
                    break;
                }
                ++Counter;
            } else Timer -= diff;
        }
Esempio n. 14
0
        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;

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

            if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM))
            {
                if (m_uiBoneSpikeGraveyardTimer < uiDiff)
                {
                    for (uint8 i = 1; i <= m_uiBoneCount; ++i)
                    {
                        if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true, -SPELL_SPIKE_IMPALING))
                        {
                            Creature* pBone = me->SummonCreature(CREATURE_BONE_SPIKE, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 999999);
                            CAST_AI(npc_bone_spike::npc_bone_spikeAI, pBone->AI())->SetPrisoner(pTarget->GetGUID());
                            pTarget->AddAura(SPELL_SPIKE_IMPALING, pTarget);
                        }
                    }
                    DoScriptText(RAND(SAY_SPIKE_1,SAY_SPIKE_2,SAY_SPIKE_3), me);
                    m_uiBoneSpikeGraveyardTimer = 15000;
                } else m_uiBoneSpikeGraveyardTimer -= uiDiff;
            }

            if (!me->HasAura(SPELL_BONE_STORM))
            {
                if (m_uiBoneStormTimer <= uiDiff)
                {
                    DoCast(SPELL_BONE_STORM);
                    DoScriptText(SAY_STORM, me);
                    DoScriptText(STORM_EMOTE, me);
                    DoStartNoMovement(me->getVictim());
                    me->SetSpeed(MOVE_RUN, fBaseSpeed*3.0f, true);
                    m_uiBoneStormTimer = 45000; //bone storm 30 second + other spell casting time
                } else m_uiBoneStormTimer -= uiDiff;

                if (m_uiColdFlameTimer <= uiDiff)
                {
                    if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, -8.0f, true))
                    {
                        pInstance->SetData(DATA_ANGLE, (me->GetAngle(pTarget)*1000));
                        DoCast(pTarget, SPELL_COLD_FLAME_SPAWN);
                    }
                    else
                    {
                        pInstance->SetData(DATA_ANGLE, (me->GetAngle(me->getVictim())*1000));
                        DoCast(me->getVictim(), SPELL_COLD_FLAME_SPAWN);
                    }
                    m_uiColdFlameTimer = 10000;
                } else m_uiColdFlameTimer -= uiDiff;

                if (m_uiSaberSlashTimer <= uiDiff)
                {
                    DoCast(me->getVictim(), SPELL_SABER_SLASH);
                    m_uiSaberSlashTimer = 7000;
                } else m_uiSaberSlashTimer -= uiDiff;
            }
            else
            {
                if (m_uiBoneStormRemoveTimer <= uiDiff)
                {
                    me->RemoveAurasDueToSpell(SPELL_BONE_STORM);
                    DoStartMovement(me->getVictim());
                    me->SetSpeed(MOVE_RUN, fBaseSpeed, true);
                    m_uiBoneStormRemoveTimer = RAID_MODE(20000,30000,20000,30000);
                } else m_uiBoneStormRemoveTimer -= uiDiff;

                if(m_uiMoveTimer <= uiDiff)
                {
                    float x, y, z;
                    if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    {
                        pTarget->GetPosition(x, y, z);
                        me->GetMotionMaster()->MovePoint(0, x, y, z);
                    }
                    DoCast(SPELL_COLD_FLAME_SPAWN_B);
                    m_uiMoveTimer = 5000;
                } else m_uiMoveTimer -= uiDiff;
            }

            DoMeleeAttackIfReady();
        }
		void UpdateAI(const uint32 diff)
		{
			if (!UpdateVictim())
				return;

			if (!m_pInstance || m_pInstance->GetData(DATA_VALITHRIA_DREAMWALKER_EVENT) != IN_PROGRESS)
				summons.DespawnAll();

			if (m_uiResetTimer <= diff)
			{
				if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 90)
					EnterEvadeMode();
				m_uiResetTimer = 5000;
			} else m_uiResetTimer -= diff;


			if (Phase == 1)
			{
				DoStartNoMovement(me->getVictim());
				me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
				m_uiEndTimer = 999999999;

				if (m_uiSummonTimer <= diff)
				{
					if (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_10MAN_HEROIC)
					{
						DoSummon(CREATURE_ZOMBIE, Pos[RAND(0,4)]);
						DoSummon(CREATURE_SKELETON, Pos[RAND(0,4)]);
						DoSummon(CREATURE_ARCHMAGE, Pos[RAND(0,4)]);
						DoSummon(CREATURE_SUPPRESSER, Pos[RAND(0,4)]);
						DoSummon(CREATURE_ABOMINATION, Pos[RAND(0,4)]);
					}

					if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
					{
						DoSummon(CREATURE_ZOMBIE, Pos[RAND(0,1,2,3)]);
						DoSummon(CREATURE_SKELETON, Pos[RAND(0,1,2,3)]);
						DoSummon(CREATURE_ARCHMAGE, Pos[RAND(0,1,2,3)]);
						DoSummon(CREATURE_SUPPRESSER, Pos[RAND(0,1,2,3)]);
						DoSummon(CREATURE_ABOMINATION, Pos[RAND(0,1,2,3)]);
					}

					m_uiSummonTimer = 28000;
				} else m_uiSummonTimer -= diff;

				if (m_uiPortalTimer <= diff)
				{
					DoScriptText(SAY_OPEN_PORTAL, me);
					me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+15, me->GetPositionY()+15, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
					me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+10, me->GetPositionY()+25, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
					me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+15, me->GetPositionY()-25, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
					m_uiPortalTimer = 30000;
				} else m_uiPortalTimer -= diff;

				if (!ABOVEHP && (me->GetHealth()*100 / me->GetMaxHealth()) > 75)
				{
					DoScriptText(SAY_ABOVE_75, me);
					ABOVEHP = true;
				}

				if (!BELOWHP && (me->GetHealth()*100 / me->GetMaxHealth()) < 25)
				{
					DoScriptText(SAY_BELOW_25, me);
					BELOWHP = true;
				}

				if ((me->GetHealth()*100 / me->GetMaxHealth()) > 99)
				{
					Phase = 2;
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
					me->RemoveAurasDueToSpell(SPELL_CORRUPTION);
					end = true;
				}


				if ((me->GetHealth()*100 / me->GetMaxHealth()) > 2)
				{
					Phase = 4;
					m_uiEndTimer = 2000;
					me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
					me->SetReactState(REACT_PASSIVE);
					me->RemoveAurasDueToSpell(SPELL_CORRUPTION);
				}
			}

			if (Phase == 2)
			{
				Phase = 3;
				m_uiEnd2Timer = 1000;
				m_uiEnd3Timer = 8000;
				DoScriptText(SAY_END, me);
			}

			if (Phase == 4)
			{
				if (m_uiEndTimer <= diff)
				{
					Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
					if(pTarget && !pTarget->IsFriendlyTo(me))
					{
						DoScriptText(SAY_BERSERK , me);
						DoCast(pTarget, SPELL_RAGE);
					}
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					m_uiEndTimer = 50000;
				} else m_uiEndTimer -= diff;
			}

			if (Phase == 3)
			{
				if (m_uiEnd2Timer <= diff)
				{
					combat_trigger->ForcedDespawn();
					me->CastSpell(me, SPELL_DREAM_SLIP, true, 0, 0, 0);
					m_uiEnd2Timer = 50000;
				} else m_uiEnd2Timer -= diff;

				if (m_uiEnd3Timer <= diff)
				{
					Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
					if(pTarget && !pTarget->IsFriendlyTo(me))
					{
						DoCast(pTarget, SPELL_RAGE);
					}
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					m_uiEnd3Timer = 50000;
				} else m_uiEnd3Timer -= diff;
			}

			if (me->HasAura(SPELL_DREAM_SLIP))
			{
				me->ForcedDespawn();

				if (m_pInstance)
					m_pInstance->SetData(DATA_VALITHRIA_DREAMWALKER_EVENT, DONE);
			}
		}
Esempio n. 16
0
            void UpdateAI(const uint32 uiDiff)
            {
                if(m_uiPhase == 1)
                    DoStartNoMovement(me->getVictim());
                else if(m_uiPhase == 2)
                    DoStartMovement(me->getVictim());

                if (m_uiIntroTimer <= uiDiff && bIntro && m_uiIntroPhase < 7)
                {
                    switch (m_uiIntroPhase)
                    {
                        case 1: DoScriptText(SAY_INTRO_2, me); m_uiIntroTimer = 10000; break;
                        case 2: DoScriptText(SAY_INTRO_3, me); m_uiIntroTimer = 7000;  break;
                        case 3: DoScriptText(SAY_INTRO_4, me); m_uiIntroTimer = 12000; break;
                        case 4: DoScriptText(SAY_INTRO_5, me); m_uiIntroTimer = 7000;  break;
                        case 5: DoScriptText(SAY_INTRO_6, me); m_uiIntroTimer = 11000; break;
                        case 6: DoScriptText(SAY_INTRO_7, me); m_uiIntroTimer = 20000; break;
                    }
                    ++m_uiIntroPhase;
                } else m_uiIntroTimer -= uiDiff;

                if (!UpdateVictim())
                    return;

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

                if (m_uiCultTimer < uiDiff)
                {
                    EmpowerCultist();
                    m_uiCultTimer = urand(20000, 23000);
                } else m_uiCultTimer -= uiDiff;

                if (m_uiDeathandDecayTimer < uiDiff)
                {
                    if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
                        DoCast(pTarget, SPELL_DEATH_AND_DECAY);
                    m_uiDeathandDecayTimer = 11000;
                } else m_uiDeathandDecayTimer -= uiDiff;

                if (m_uiDominateMindTimer < uiDiff)
                {
                    for (uint8 i = 1; i <= RAID_MODE(0,1,1,3); ++i)
                    {
                        if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_DOMINATE_MIND))
                            DoCast(pTarget, SPELL_DOMINATE_MIND);
                    }
                    DoScriptText(SAY_DOMINATE_MIND, me);
                    m_uiDominateMindTimer = 15000;
                } else m_uiDominateMindTimer -= uiDiff;

                if (m_uiPhase == 1)
                {
                    if (m_uiShadowBoltTimer < uiDiff)
                    {
                        if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
                            DoCast(pTarget, SPELL_SHADOW_BOLT);
                        m_uiShadowBoltTimer = 6000;
                    } else m_uiShadowBoltTimer -= uiDiff;

                    if (m_uiSummonWaveTimer < uiDiff)
                    {
                        if (Difficulty() == RAID_DIFFICULTY_10MAN_NORMAL || Difficulty() == RAID_DIFFICULTY_10MAN_HEROIC)
                            RandomSpawn();
                        else
                        {
                            DoSummon(CREATURE_FANATIC, SpawnLoc[0]);
                            DoSummon(CREATURE_ADHERENT, SpawnLoc[1]);
                            DoSummon(CREATURE_FANATIC, SpawnLoc[2]);
                            DoSummon(CREATURE_ADHERENT, SpawnLoc[3]);
                            DoSummon(CREATURE_FANATIC, SpawnLoc[4]);
                            DoSummon(CREATURE_ADHERENT, SpawnLoc[5]);
                            DoSummon(RAND(CREATURE_FANATIC,CREATURE_ADHERENT), SpawnLoc[6]);
                        }
                        bFirstSummon = false ? true : true;
                        m_uiSummonWaveTimer = !bFirstSummon ? 10000 : 60000;
                    } else m_uiSummonWaveTimer -= uiDiff;
                }

                if (m_uiPhase == 2)
                {
                    if (m_uiFrostBoltTimer < uiDiff)
                    {
                        DoCast(me->getVictim(), SPELL_FROST_BOLT);
                        m_uiFrostBoltTimer = 10000;
                    } else m_uiFrostBoltTimer -= uiDiff;

                    if (m_uiFrostValleyTimer < uiDiff)
                    {
                        DoCast(SPELL_FROST_BOLT_VALLEY);
                        m_uiFrostValleyTimer = 19000;
                    } else m_uiFrostValleyTimer -= uiDiff;

                    if (m_uiInsignificanceTimer < uiDiff)
                    {
                        DoCast(me->getVictim(), SPELL_INSIGNIFICANCE);
                        m_uiInsignificanceTimer = 8000;
                    } else m_uiInsignificanceTimer -= uiDiff;

                    if (m_uiSummonWaveTimer < uiDiff)
                    {
                        if (Difficulty() == RAID_DIFFICULTY_10MAN_HEROIC)
                            DoSummon(RAND(CREATURE_FANATIC,CREATURE_ADHERENT), SpawnLoc[6]);
                        if (Difficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
                            RandomSpawn();
                        m_uiSummonWaveTimer = 60000;
                    } else m_uiSummonWaveTimer -= uiDiff;

                    if (m_uiShadeTimer < uiDiff)
                    {
                        DoCast(SPELL_SUMMON_SHADE);
                        m_uiShadeTimer = 15000;
                    } else m_uiShadeTimer -= uiDiff;

                    DoMeleeAttackIfReady();
                }
            }
Esempio n. 17
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (CloseDoorTimer)
        {
            if (CloseDoorTimer <= diff)
            {
                if (pInstance)
                {
                    pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false);
                    CloseDoorTimer = 0;
                }
            }
            else CloseDoorTimer -= diff;
        }

        //Cooldowns for casts
        if (ArcaneCooldown)
        {
            if (ArcaneCooldown >= diff)
                ArcaneCooldown -= diff;
            else ArcaneCooldown = 2000;
        }

        if (FireCooldown)
        {
            if (FireCooldown >= diff)
                FireCooldown -= diff;
            else FireCooldown = 2000;
        }

        if (FrostCooldown)
        {
            if (FrostCooldown >= diff)
                FrostCooldown -= diff;
            else FrostCooldown = 2000;
        }

        if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA) * 100 / me->GetMaxPower(POWER_MANA)) < 20)
        {
            Drinking = true;
            me->InterruptNonMeleeSpells(false);

            DoScriptText(SAY_DRINK, me);

            if (!DrinkInturrupted)
            {
                DoCast(me, SPELL_MASS_POLY, true);
                DoCast(me, SPELL_CONJURE, false);
                DoCast(me, SPELL_DRINK, false);
                me->SetStandState(UNIT_STAND_STATE_SIT);
                DrinkInturruptTimer = 10000;
            }
        }

        //Drink Inturrupt
        if (Drinking && DrinkInturrupted)
        {
            Drinking = false;
            me->RemoveAurasDueToSpell(SPELL_DRINK);
            me->SetStandState(UNIT_STAND_STATE_STAND);
            me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA) - 32000);
            DoCast(me, SPELL_POTION, false);
        }

        //Drink Inturrupt Timer
        if (Drinking && !DrinkInturrupted)
            if (DrinkInturruptTimer >= diff)
                DrinkInturruptTimer -= diff;
            else
            {
                me->SetStandState(UNIT_STAND_STATE_STAND);
                DoCast(me, SPELL_POTION, true);
                DoCast(me, SPELL_AOE_PYROBLAST, false);
                DrinkInturrupted = true;
                Drinking = false;
            }

        //Don't execute any more code if we are drinking
        if (Drinking)
            return;

        //Normal casts
        if (NormalCastTimer <= diff)
        {
            if (!me->IsNonMeleeSpellCast(false))
            {
                Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                if (!target)
                    return;

                uint32 Spells[3];
                uint8 AvailableSpells = 0;

                //Check for what spells are not on cooldown
                if (!ArcaneCooldown)
                {
                    Spells[AvailableSpells] = SPELL_ARCMISSLE;
                    ++AvailableSpells;
                }
                if (!FireCooldown)
                {
                    Spells[AvailableSpells] = SPELL_FIREBALL;
                    ++AvailableSpells;
                }
                if (!FrostCooldown)
                {
                    Spells[AvailableSpells] = SPELL_FROSTBOLT;
                    ++AvailableSpells;
                }

                //If no available spells wait 1 second and try again
                if (AvailableSpells)
                {
                    CurrentNormalSpell = Spells[rand() % AvailableSpells];
                    SetImmune(false);
                    DoCast(target, CurrentNormalSpell);
                }
            }
            NormalCastTimer = 2500;
        }
        else NormalCastTimer -= diff;

        if (SecondarySpellTimer <= diff)
        {
            switch (urand(0, 1))
            {
            case 0:
                DoCast(me, SPELL_AOE_CS);
                break;
            case 1:
                if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    DoCast(pUnit, SPELL_CHAINSOFICE);
                break;
            case 2:
                if (Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0))
                    DoCast(pUnit, SPELL_DRAGONSBREATH);
                break;
            }
            SecondarySpellTimer = urand(3000, 8000);
        }
        else SecondarySpellTimer -= diff;

        if (SuperCastTimer <= diff)
        {
            uint8 Available[2];

            switch (LastSuperSpell)
            {
                case SUPER_AE:
                    Available[0] = SUPER_FLAME;
                    Available[1] = SUPER_BLIZZARD;
                    break;
                case SUPER_FLAME:
                    Available[0] = SUPER_AE;
                    Available[1] = SUPER_BLIZZARD;
                    break;
                case SUPER_BLIZZARD:
                    Available[0] = SUPER_FLAME;
                    Available[1] = SUPER_AE;
                    break;
            }

            LastSuperSpell = Available[urand(0, 1)];
            SetImmune(true);
 
            Map::PlayerList const &PlayerList = pInstance->instance->GetPlayers();
            WorldPacket data;
            switch (LastSuperSpell)
            {
            case SUPER_AE:
                DoScriptText(RAND(SAY_EXPLOSION1, SAY_EXPLOSION2), me);

                DoCast(me, SPELL_BLINK_CENTER, true);
                DoCast(me, SPELL_PLAYERPULL, true);
                DoCast(me, SPELL_MASSSLOW, true);
                DoCast(me, SPELL_ARCANE_BUBBLE, true);
                me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                AETimer = 1500;
                CastAE = true;
                break;

            case SUPER_FLAME:
                DoScriptText(RAND(SAY_FLAMEWREATH1, SAY_FLAMEWREATH2), me);

                FlameWreathTimer = 20000;
                FlameWreathCheckTime = 500;

                FlameWreathTarget[0] = 0;
                FlameWreathTarget[1] = 0;
                FlameWreathTarget[2] = 0;

                FlameWreathEffect();
                SecondarySpellTimer = 20500;
                break;

            case SUPER_BLIZZARD:
                DoScriptText(RAND(SAY_BLIZZARD1, SAY_BLIZZARD2), me);

                Creature* Blizzard = NULL;
                Blizzard = me->SummonCreature(NPC_ARAN_BLIZZARD, -11179.080f, -1905.279f, 232.008f, 2.9f, TEMPSUMMON_TIMED_DESPAWN, 25000);
                if (Blizzard)
                {
                    Blizzard->SetInCombatWithZone();
                    Blizzard->SetFaction(me->GetFaction());
                    me->CastSpell(Blizzard, SPELL_SUMMON_BLIZZ, false);
                    Blizzard->CastSpell(Blizzard, SPELL_CIRCULAR_BLIZZARD, false);
                    Blizzard->GetMotionMaster()->MovePath(110110101, false);
                }
                break;
            }

            SuperCastTimer = urand(35000, 40000);
        }
        else SuperCastTimer -= diff;

        if (!ElementalsSpawned && HealthBelowPct(40))
        {
            ElementalsSpawned = true;

            Creature* ElementalOne   = NULL;
            Creature* ElementalTwo   = NULL;
            Creature* ElementalThree = NULL;
            Creature* ElementalFour  = NULL;

            ElementalOne     = me->SummonCreature(NPC_WATER_ELEMENTAL, -11168.1f, -1939.29f, 232.092f, 1.46f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
            ElementalTwo     = me->SummonCreature(NPC_WATER_ELEMENTAL, -11138.2f, -1915.38f, 232.092f, 3.00f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
            ElementalThree   = me->SummonCreature(NPC_WATER_ELEMENTAL, -11161.7f, -1885.36f, 232.092f, 4.59f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
            ElementalFour    = me->SummonCreature(NPC_WATER_ELEMENTAL, -11192.4f, -1909.36f, 232.092f, 6.19f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);

            if (ElementalOne)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                if (!pTarget)
                    return;

                DoStartNoMovement(pTarget);
                ElementalOne->SetInCombatWithZone();
                ElementalOne->CombatStart(pTarget);
                ElementalOne->SetFaction(me->GetFaction());
                ElementalOne->SetRooted(true);
                ElementalOne->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
                ElementalOne->SetModifierValue(UNIT_MOD_RESISTANCE_FROST,  BASE_VALUE, 0);
            }

            if (ElementalTwo)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                if (!pTarget)
                    return;

                DoStartNoMovement(pTarget);
                ElementalTwo->SetInCombatWithZone();
                ElementalTwo->CombatStart(pTarget);
                ElementalTwo->SetFaction(me->GetFaction());
                ElementalTwo->SetRooted(true);
                ElementalTwo->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
                ElementalTwo->SetModifierValue(UNIT_MOD_RESISTANCE_FROST,  BASE_VALUE, 0);
            }

            if (ElementalThree)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                if (!pTarget)
                    return;

                DoStartNoMovement(pTarget);
                ElementalThree->SetInCombatWithZone();
                ElementalThree->CombatStart(pTarget);
                ElementalThree->SetFaction(me->GetFaction());
                ElementalThree->SetRooted(true);
                ElementalThree->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
                ElementalThree->SetModifierValue(UNIT_MOD_RESISTANCE_FROST,  BASE_VALUE, 0);
            }

            if (ElementalFour)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                if (!pTarget)
                    return;

                DoStartNoMovement(pTarget);
                ElementalFour->SetInCombatWithZone();
                ElementalFour->CombatStart(pTarget);
                ElementalFour->SetFaction(me->GetFaction());
                ElementalFour->SetRooted(true);
                ElementalFour->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
                ElementalFour->SetModifierValue(UNIT_MOD_RESISTANCE_FROST,  BASE_VALUE, 0);
            }

            DoScriptText(SAY_ELEMENTALS, me);
            DoScriptText(SAY_TIMEOVER, me);

            BerserkTimer = 60000;
        }
        else BerserkTimer -= diff;

        //Flame Wreath check
        if (FlameWreathTimer)
        {
            if (FlameWreathTimer >= diff)
                FlameWreathTimer -= diff;
            else FlameWreathTimer = 0;

            if (FlameWreathCheckTime <= diff)
            {
                for (uint8 i = 0; i < 3; ++i)
                {
                    if (!FlameWreathTarget[i])
                        continue;

                    Unit* unit = Unit::GetUnit(*me, FlameWreathTarget[i]);
                    if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
                    {
                        unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID());
                        unit->CastSpell(unit, 11027, true);
                        FlameWreathTarget[i] = 0;
                    }
                }
                FlameWreathCheckTime = 500;
            }
            else FlameWreathCheckTime -= diff;
        }

        if (ArcaneCooldown && FireCooldown && FrostCooldown && DragonsbreathCooldown)
            DoMeleeAttackIfReady();

        if (CastAE)
            if (AETimer < diff)
            {
                me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                me->CastSpell(me, SPELL_AEXPLOSION, false);
                AETimer = 1500;
                CastAE = false;
            }
            else AETimer -= diff;
    }
Esempio n. 18
0
            void UpdateAI(const uint32 diff)
            {
                ResetEvent();

                if (pInstance && pInstance->GetData(DATA_VALITHRIA_DREAMWALKER_EVENT) == IN_PROGRESS)
                {
                    DoStartNoMovement(me->getVictim());

                    if (m_uiSummonTimer <= diff)
                    {
                        uint8 location = RAID_MODE(1,3,1,3);
                        for (uint8 i = 0; i < location; ++i)
                        {
                            HeroicSummon(i);
                        }
                        m_uiSummonTimer = 20000;
                    } else m_uiSummonTimer -= diff;

                    if (m_uiPortalTimer <= diff)
                    {
                        DoScriptText(SAY_OPEN_PORTAL, me);

                        me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+15, me->GetPositionY()+15, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
                        me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+10, me->GetPositionY()+25, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
                        me->SummonCreature(CREATURE_PORTAL, me->GetPositionX()+15, me->GetPositionY()-25, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
                        m_uiPortalTimer = 30000;
                    } else m_uiPortalTimer -= diff;

                    if (!bAboveHP && (HealthAbovePct(74)))
                    {
                        DoScriptText(SAY_ABOVE_75, me);
                        bAboveHP = true;
                    }

                    if (!bBelowHP && (HealthBelowPct(26)))
                    {
                        DoScriptText(SAY_BELOW_25, me);
                        bBelowHP = true;
                    }

                    if ((HealthAbovePct(99)) && !bEnd)
                    {
                        DoScriptText(SAY_END, me);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
                        me->SetReactState(REACT_PASSIVE);
                        me->RemoveAurasDueToSpell(SPELL_CORRUPTION);

                        bEnd = true;
                    }

                    if(bEnd)
                    {
                        if (m_uiEndTimer <= diff)
                        {
                            switch(m_uiStage)
                            {
                                case 1:
                                    DoScriptText(SAY_BERSERK , me);
                                    DoCast(me, SPELL_RAGE);
                                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                    ++m_uiStage;
                                    m_uiEndTimer = 6000;
                                    break;
                                case 2:
                                    {
                                        combat_trigger->ForcedDespawn();
                                        DoCast(me, SPELL_DREAM_SLIP, true);
                                        ++m_uiStage;
                                        m_uiEndTimer = 1000;
                                    }
                                    break;
                                case 3:
                                    if (pInstance)
                                        pInstance->SetData(DATA_VALITHRIA_DREAMWALKER_EVENT, DONE);
                                    me->ForcedDespawn();
                                    m_uiEndTimer = 1000;
                                    bEnd = false;
                                    ++m_uiStage;
                                    break;
                            }
                        } else m_uiEndTimer -= diff;
                    }
                }
            }
Esempio n. 19
0
		  void EnterCombat(Unit* who)
    {   
		me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
		DoStartNoMovement(me->getVictim()); 
    }
Esempio n. 20
0
	     void UpdateAI(const uint32 diff)
		 {
        if (!UpdateVictim())
            return;    
 
          if (Phase == 1) 
	 {
        DoStartNoMovement(me->getVictim()); 
		me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); 
		End_Timer = 999999999; 
		
    
	if (Summon_Timer <= diff) 
	{  
    DoSummon(ZOMBIE, Pos[RAND(0,1,2,3)]);  
	DoSummon(SKELETON, Pos[RAND(0,1,2,3)]);  
	DoSummon(ARCHMAGE, Pos[RAND(0,1,2,3)]);  
	DoSummon(SUPPRESSER, Pos[RAND(0,1,2,3)]);  
	DoSummon(ABOMINATION, Pos[RAND(0,1,2,3)]);   
	Summon_Timer = 30000;
	}else Summon_Timer -= diff;

	if  (Portal_Timer <= diff) 
	{  
		DoScriptText(OPENPORTAL,me);
        me->SummonCreature(PORTAL,me->GetPositionX()+15,me->GetPositionY()+15,me->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 15000);  
		me->SummonCreature(PORTAL,me->GetPositionX()+10,me->GetPositionY()+25,me->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 15000);  
		me->SummonCreature(PORTAL,me->GetPositionX()+15,me->GetPositionY()-25,me->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 15000);   
		Portal_Timer = 30000;
	}else Portal_Timer -= diff;

    if (!ABOVEHP && (me->GetHealth()*100 / me->GetMaxHealth()) > 75) 
	{ 
	DoScriptText(ABOVE75PCTS,me); 
	ABOVEHP = true; 
	} 
	 
	    if (!BELOWHP && (me->GetHealth()*100 / me->GetMaxHealth()) < 25) 
	{ 
	DoScriptText(BELOW25PCTS,me); 
	BELOWHP = true; 
	}

    	if ((me->GetHealth()*100 / me->GetMaxHealth()) > 99)
		{     
			Phase = 2; 
            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);  
			me->SetReactState(REACT_PASSIVE);
			me->RemoveAurasDueToSpell(CORRUPTION);       
			

			end = true; 
			} 
		  }
	 
	 if (Phase == 2)
		{    
		Phase = 3; 
		End_Timer = 1000; 
		End2_Timer = 6000;
		DoScriptText(ENDEVENT , me); 
		 }

     if (Phase == 3) 
	 { 
	  if (End_Timer <= diff) 
	  { 
	  
	  combat_trigger->CastSpell(combat_trigger,RAGE,true,0,0,0); 
	  combat_trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
	  End_Timer = 50000;   
	  
	  }else End_Timer -= diff; 
	    
	  if (End2_Timer <= diff) 
	  { 
	  combat_trigger->ForcedDespawn(); 
	  me->CastSpell(me,DREAM_SLIP,true,0,0,0); 
	  End2_Timer = 50000; 
	  }else End2_Timer -= diff;

	 }
	  

      if (me->HasAura(DREAM_SLIP))
	  {  
          me->ForcedDespawn();  
		  me->SummonGameObject(LOOT_CHEST,LOOT_X,LOOT_Y,LOC_Z,0,0,0,0,0,-10); 
          	if (pInstance) 
			{ 
            pInstance->SetData(DATA_VALITHRIA_DREAMWALKER_EVENT, DONE);  
			} 
	  }
	 
		 }
Esempio n. 21
0
        void UpdateAI(const uint32 diff)
        {
            if(!UpdateVictim())
                return;

            events.Update(diff);

            if(enrageTimer <= diff)
            {
                DoCast(SPELL_BERSERK);
                enrageTimer = 600000;
            }else enrageTimer -= diff;

            if(uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_LAVA_SPEW:
                        DoCast(me, SPELL_LAVA_SPEW);
                        events.ScheduleEvent(EVENT_LAVA_SPEW, urand(15000, 20000), 0, PHASE_NORMAL);
                        break;
                    case EVENT_MAGMA_SPIT:
                        if(Unit * victim = me->GetVictim())
                        {
                            float dist = me->GetDistance(victim);
                            if(dist >= 60.0f)
                                EnterEvadeMode();
                            else if(dist >= INTERACTION_DISTANCE)
                                DoCast(victim, SPELL_MAGMA_SPIT, true);
                        }
                        events.ScheduleEvent(EVENT_MAGMA_SPIT, urand(3000, 5000), 0, PHASE_NORMAL);
                        break;
                    case EVENT_PILLAR_OF_FLAME:
                        {
                            Unit * target = SelectTarget(SELECT_TARGET_RANDOM, 0, -15.0f, true);
                            if(!target)
                                target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
                            if(target)
                                me->SummonCreature(NPC_PILLAR_OF_FLAME_TRIGGER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 20000);
                            Talk(EMOTE_PILLAR);
                            DoCast(me, SPELL_PILLAR_OF_FLAME);
                            events.ScheduleEvent(EVENT_PILLAR_OF_FLAME, 30000, 0, PHASE_NORMAL);
                        }
                        break;
                    case EVENT_MANGLE:
                        DoCastVictim(SPELL_MANGLE, true);
                        SetIdle();

                        events.ScheduleEvent(EVENT_MANGLE, 95000);
                        events.ScheduleEvent(EVENT_IGNITION, 2000);
                        events.SetPhase(PHASE_HEAD);
                        break;
                    case EVENT_IGNITION:
                    {
                        bool pos = urand(0, 1);
                        Movement::MoveSplineInit init(me);
                        init.SetFacing(pos ? 4.7f : 3.47f);

                        std::list<Position> summonPos;
                          for (uint8 i = 0; i < 8; i++)
                            me->SummonCreature(NPC_IGNITION_TRIGGER, me->GetPositionX() + i, me->GetPositionY() + i, me->GetPositionZ(), 1.5f, TEMPSUMMON_TIMED_DESPAWN, 65100);
                            summonPos.clear();
                        events.DelayEvents(10000);
                        events.ScheduleEvent(EVENT_MASSIVE_CRASH, 3000);
                        events.ScheduleEvent(EVENT_EJECT, 40000);
                        break;
                    }
                    case EVENT_MASSIVE_CRASH:
                        Talk(EMOTE_CRASH);
                        DoCast(SPELL_MASSIVE_CRASH);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        SetPincers(true);
                        events.ScheduleEvent(EVENT_MASSIVE_CRASH_END, 10000);
                        break;
                    case EVENT_IMPALE_END:
                        if(Unit * head = veh->GetPassenger(4)) // make the head unattackable
                        {
                            head->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                            head->CastSpell(head, SPELL_QUEST_INVIS_5, true);
                        }
                        me->RemoveAurasDueToSpell(SPELL_CHAIN_R);
                        me->RemoveAurasDueToSpell(SPELL_CHAIN_L);
                        events.RescheduleEvent(EVENT_MAGMA_SPIT, 5000);
                        events.RescheduleEvent(EVENT_LAVA_SPEW, 8000);
                        events.RescheduleEvent(EVENT_MAGMA_SPIT, urand(8000, 10000));
                        events.RescheduleEvent(EVENT_PILLAR_OF_FLAME, urand(8000, 12000));
                        events.RescheduleEvent(EVENT_MANGLE, urand(25000, 30000));
                    case EVENT_MASSIVE_CRASH_END:
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        me->SetReactState(REACT_AGGRESSIVE);
                        events.SetPhase(PHASE_NORMAL);
                        if(Unit * victim = me->GetVictim()) // resume combat
                        {
                            DoStartNoMovement(victim);
                            me->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
                        }
                        break;
                    case EVENT_EJECT:
                        // Tank in seat 3 will be dead by then
                        SetPincers(false);
                        break;
                    case EVENT_BLAZING_INFERNO:
                        if(Creature * nefarian = me->GetCreature(*me, nefarianGUID))
                            if(Unit * target = SelectTarget(SELECT_TARGET_RANDOM, 0, -5.0f, true))
                                nefarian->CastSpell(target, SPELL_BLAZING_INFERNO, true);
                        events.ScheduleEvent(EVENT_BLAZING_INFERNO, urand(20000, 25000));
                        break;
                    case EVENT_SHADOWFLAME_BARRAGE:
                        if(Creature * nefarian = me->GetCreature(*me, nefarianGUID))
                        {
                            if(nefarian->HasUnitState(UNIT_STATE_CASTING))
                                events.ScheduleEvent(EVENT_SHADOWFLAME_BARRAGE, 200);
                            else
                            {
                                nefarian->CastSpell(nefarian, SPELL_SHADOWFLAME_BARRAGE, false);
                                events.ScheduleEvent(EVENT_SHADOWFLAME_BARRAGE, 2100);
                            }
                        }
                        break;
                    default:
                        break;
                }
            }
            DoMeleeAttackIfReady();
        }
Esempio n. 22
0
        void UpdateAI(const uint32 diff)
        {
            if (IntroStepCounter < 9)
            {
                if (IntroYellTimer <= diff)
                {
                    IntroYellTimer = IntroStep(++IntroStepCounter);
                } else IntroYellTimer -= diff;
            }

            if (!SisterDeath)
            {
                if (instance)
                {
                    Unit* Temp = NULL;
                    Temp = Unit::GetUnit((*me), instance->GetData64(DATA_SACROLASH));
                    if (Temp && Temp->isDead())
                    {
                        DoScriptText(YELL_SISTER_SACROLASH_DEAD, me);
                        DoCast(me, SPELL_EMPOWER);
                        me->InterruptSpell(CURRENT_GENERIC_SPELL);
                        SisterDeath = true;
                    }
                }
            }
            if (!me->getVictim())
            {
                if (instance)
                {
                    Creature* sisiter = Unit::GetCreature((*me), instance->GetData64(DATA_SACROLASH));
                    if (sisiter && !sisiter->isDead() && sisiter->getVictim())
                    {
                        me->AddThreat(sisiter->getVictim(), 0.0f);
                        DoStartNoMovement(sisiter->getVictim());
                        me->Attack(sisiter->getVictim(), false);
                    }
                }
            }

            if (!UpdateVictim())
                return;

            if (SisterDeath)
            {
                if (ShadownovaTimer <= diff)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                    {
                        Unit* target = NULL;
                        target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                        if (target)
                            DoCast(target, SPELL_SHADOW_NOVA);
                        ShadownovaTimer= 30000+(rand()%5000);
                    }
                } else ShadownovaTimer -=diff;
            }
            else
            {
                if (ConflagrationTimer <= diff)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                    {
                        me->InterruptSpell(CURRENT_GENERIC_SPELL);
                        Unit* target = NULL;
                        target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                        if (target)
                            DoCast(target, SPELL_CONFLAGRATION);
                        ConflagrationTimer = 30000+(rand()%5000);

                        if (!SisterDeath)
                        {
                            if (target)
                                DoScriptText(EMOTE_CONFLAGRATION, me, target);
                            DoScriptText(YELL_CANFLAGRATION, me);
                        }

                        BlazeTimer = 4000;
                    }
                } else ConflagrationTimer -= diff;
            }

            if (FlamesearTimer <= diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, SPELL_FLAME_SEAR);
                    FlamesearTimer = 15000;
                }
            } else FlamesearTimer -=diff;

            if (PyrogenicsTimer <= diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me, SPELL_PYROGENICS, true);
                    PyrogenicsTimer = 15000;
                }
            } else PyrogenicsTimer -= diff;

            if (BlazeTimer <= diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(me->getVictim(), SPELL_BLAZE);
                    BlazeTimer = 3800;
                }
            } else BlazeTimer -= diff;

            if (EnrageTimer < diff && !Enraged)
            {
                me->InterruptSpell(CURRENT_GENERIC_SPELL);
                DoScriptText(YELL_BERSERK, me);
                DoCast(me, SPELL_ENRAGE);
                Enraged = true;
            } else EnrageTimer -= diff;
        }
Esempio n. 23
0
 void Reset()
 {
     DoCast(SPELL_MANA_VOID);
     me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
     DoStartNoMovement(me->getVictim());
 }
Esempio n. 24
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (IntroText == 1 || IntroText == 2)
        {
            if (IntroText_Timer < uiDiff)
            {
                switch(IntroText)
                {
                    case 1: DoScriptText(SAY_INTRO2, m_creature); break;
                    case 2: DoScriptText(SAY_INTRO3, m_creature); break;
                }
                IntroText++;
                IntroText_Timer = 8000;
            }
            else IntroText_Timer -= uiDiff;
        }

        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (Phase == 1)
        {
            if ((m_creature->GetPower(POWER_MANA)*100 / m_creature->GetMaxPower(POWER_MANA)) < 1)
            {
                DoScriptText(SAY_PHASE2, m_creature);
                Phase = 2;
                return;
            }

            if (!m_creature->HasAura(SPELL_MANA_BARRIER))
                 DoCastSpellIfCan(m_creature, SPELL_MANA_BARRIER);

            if (Summon_Cult_Timer < uiDiff)
            {
                if (SpawnLeft)
                {
                    m_creature->SummonCreature(NPC_CULT_FANATIC,ADD_1X,ADD_1Y,ADD_1Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
                    m_creature->SummonCreature(NPC_CULT_ADHERENT,ADD_2X,ADD_2Y,ADD_2Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
                    m_creature->SummonCreature(NPC_CULT_FANATIC,ADD_3X,ADD_3Y,ADD_3Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
                    SpawnLeft = false;
                }
                else
                {
                    m_creature->SummonCreature(NPC_CULT_ADHERENT,ADD_4X,ADD_4Y,ADD_4Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
                    m_creature->SummonCreature(NPC_CULT_FANATIC,ADD_5X,ADD_5Y,ADD_5Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
                    m_creature->SummonCreature(NPC_CULT_ADHERENT,ADD_6X,ADD_6Y,ADD_6Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
                    SpawnLeft = true;
                }

                Summon_Cult_Count++;
                Summon_Cult_Timer = 60000;
            }
            else Summon_Cult_Timer -= uiDiff;

            if (ShadowBolt_Timer < uiDiff)
            {
                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
                     DoCastSpellIfCan(target, m_bIsRegularMode ? SPELL_SHADOW_BOLT : H_SPELL_SHADOW_BOLT);
                ShadowBolt_Timer = 5000;
            }
            else ShadowBolt_Timer -= uiDiff;

            DoStartNoMovement(m_creature->getVictim());
        }

        if (Phase == 2)
        {
            if (m_creature->HasAura(SPELL_MANA_BARRIER))
                m_creature->RemoveAurasDueToSpell(SPELL_MANA_BARRIER);

            if (Insignificance_Timer < uiDiff)
            {
                 DoCastSpellIfCan(m_creature->getVictim(), SPELL_INSIGNIFICANCE);
                Insignificance_Timer = 5000+rand()%40000;
            }
            else Insignificance_Timer -= uiDiff;

            if (FrostboltVolley_Timer < uiDiff)
            {
                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
                     DoCastSpellIfCan(target, m_bIsRegularMode ? SPELL_FROSTBOLT_VOLLEY : H_SPELL_FROSTBOLT_VOLLEY);
                FrostboltVolley_Timer = 40000;
            }
            else FrostboltVolley_Timer -= uiDiff;

            if (Summon_Shade_Count < Summon_Cult_Count)
            {
                if (Summon_Shade_Timer < uiDiff)
                {
                     DoCastSpellIfCan(m_creature, SPELL_VENGEFUL_SHADE);
                    Summon_Shade_Count++;
                    Summon_Shade_Timer = 25000;
                }
                else Summon_Shade_Timer -= uiDiff;
            }

            if (Frostbolt_Timer < uiDiff)
            {
                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
                     DoCastSpellIfCan(target, m_bIsRegularMode ? SPELL_FROSTBOLT : H_SPELL_FROSTBOLT);
                Frostbolt_Timer = 15000;
            }
            else Frostbolt_Timer -= uiDiff;

            DoMeleeAttackIfReady();
        }

        if (DeathAndDecay_Timer < uiDiff)
        {
            if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
                 DoCastSpellIfCan(target, m_bIsRegularMode ? SPELL_DEATH_AND_DECAY : H_SPELL_DEATH_AND_DECAY);
            DeathAndDecay_Timer = 30000;
        }
        else DeathAndDecay_Timer -= uiDiff;
    }
Esempio n. 25
0
 void AttackStart(Unit * target)
 {
     if (me->Attack(target, true))
         DoStartNoMovement(target);
 }
Esempio n. 26
0
    void UpdateAI(const uint32 diff) override
    {
        //Return since we have no target
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // Pummel
        if (m_uiPummelTimer < diff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_PUMMEL) == CAST_OK)
                m_uiPummelTimer = 12000;
        }
        else 
            m_uiPummelTimer -= diff;

        // Knock Away
        if (m_uiKnockAwayTimer < diff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_KNOCK_AWAY) == CAST_OK)
                m_uiKnockAwayTimer = urand(15000, 20000);
        }
        else 
            m_uiKnockAwayTimer -= diff;

        // Summon Rifleman
        if (m_uiSummonRiflemanTimer < diff)
        {
            //Cast
            switch (urand(0, 8))
            {
                case 0:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_1X,ADD_1Y,ADD_1Z,ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_2X,ADD_2Y,ADD_2Z,ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_4X,ADD_4Y,ADD_4Z,ADD_4O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 1:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_2X,ADD_2Y,ADD_2Z,ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_3X,ADD_3Y,ADD_3Z,ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_5X,ADD_5Y,ADD_5Z,ADD_5O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 2:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_3X,ADD_3Y,ADD_3Z,ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_4X,ADD_4Y,ADD_4Z,ADD_4O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_6X,ADD_6Y,ADD_6Z,ADD_6O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 3:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_4X,ADD_4Y,ADD_4Z,ADD_4O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_5X,ADD_5Y,ADD_5Z,ADD_5O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_7X,ADD_7Y,ADD_7Z,ADD_7O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 4:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_5X,ADD_5Y,ADD_5Z,ADD_5O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_6X,ADD_6Y,ADD_6Z,ADD_6O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_8X,ADD_8Y,ADD_8Z,ADD_8O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 5:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_6X,ADD_6Y,ADD_6Z,ADD_6O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_7X,ADD_7Y,ADD_7Z,ADD_7O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_9X,ADD_9Y,ADD_9Z,ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 6:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_7X,ADD_7Y,ADD_7Z,ADD_7O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_8X,ADD_8Y,ADD_8Z,ADD_8O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_1X,ADD_1Y,ADD_1Z,ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 7:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_8X,ADD_8Y,ADD_8Z,ADD_8O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_9X,ADD_9Y,ADD_9Z,ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_2X,ADD_2Y,ADD_2Z,ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
                case 8:
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_9X,ADD_9Y,ADD_9Z,ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_1X,ADD_1Y,ADD_1Z,ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    m_creature->SummonCreature(NPC_CRIMSON_RIFLEMAN, ADD_3X,ADD_3Y,ADD_3Z,ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 240000);
                    break;
            }            
            m_uiSummonRiflemanTimer = 10000;
        }
        else 
            m_uiSummonRiflemanTimer -= diff;

        // Shoot
        if (m_uiShootTimer < diff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHOOT) == CAST_OK)
                m_uiShootTimer = urand(2500, 3500);
        }
        else 
            m_uiShootTimer -= diff;

        if (!IsCombatMovement())
        { //Melee
            if (!m_bInMelee && (m_creature->GetDistance2d(m_creature->getVictim()) < 8.0f || m_creature->GetDistance2d(m_creature->getVictim()) > 27.0f || !m_creature->IsWithinLOSInMap(m_creature->getVictim())))
            {
                SetCombatMovement(true);
                DoStartMovement(m_creature->getVictim());
                m_bInMelee = true;
                return;
            }
        }
        else
        { //Range
            if (m_bInMelee && m_creature->GetDistance2d(m_creature->getVictim()) >= 8.0f && m_creature->GetDistance2d(m_creature->getVictim()) <= 27.0f && m_creature->IsWithinLOSInMap(m_creature->getVictim()))
            {
                SetCombatMovement(false);
                m_bInMelee = false;
                DoStartNoMovement(m_creature->getVictim());
                return;
            }
        }

        DoMeleeAttackIfReady();
    }