Пример #1
0
        void Reset()
        {
            uiSinsterStrikeTimer = 7 * IN_MILLISECONDS;
            uiCallFlamesTimer = 10 * IN_MILLISECONDS;
            uiRitualOfSwordTimer = 20 * IN_MILLISECONDS;
            uiSacrificeTimer = 8 * IN_MILLISECONDS;

            bSacrificed = false;

            Phase = NORMAL;

            DoTeleportTo(296.632f, -346.075f, 90.6307f);
            me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);

            summons.DespawnAll();

            if (pInstance)
            {
                pInstance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, NOT_STARTED);
                pInstance->SetData64(DATA_SACRIFICED_PLAYER, 0);
            }
        }
Пример #2
0
    void SpellHit(Unit * caster, const SpellEntry * spell)
    {
        if (spell->Id == SPELL_SUMMON_BLIZZARD)
        {
            uint64 AranGUID = 0;
            if (instance)
                AranGUID = instance->GetData64(DATA_SHADE_OF_ARAN);
            me->CastSpell(me, SPELL_CIRCULAR_BLIZZARD, false, 0, 0, AranGUID);

            ChangeBlizzardWaypointsOrder(urand(0, 7));

            pos.m_positionX = blizzardWaypoints[0][0];
            pos.m_positionY = blizzardWaypoints[1][0];
            pos.m_positionZ = me->GetPositionZ();

            DoTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());

            currentWaypoint = 0;
            waypointTimer = 0;
            move = true;
        }
    }
Пример #3
0
            void EnterCombat(Unit* /*who*/) override
            {
                for (uint32 i = 0; i < POS_LIVE; ++i)
                    if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i]))
                        LiveTriggerGUID.push_back(trigger->GetGUID());
                for (uint32 i = 0; i < POS_DEAD; ++i)
                    if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i]))
                        DeadTriggerGUID.push_back(trigger->GetGUID());

                if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
                {
                    TC_LOG_ERROR("scripts", "Script Gothik: cannot summon triggers!");
                    EnterEvadeMode();
                    return;
                }

                _EnterCombat();
                waveCount = 0;
                events.ScheduleEvent(EVENT_SUMMON, 30000);
                DoTeleportTo(PosPlatform);
                Talk(SAY_SPEECH);
                instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
            }
Пример #4
0
    void UpdateAI(const uint32 diff)
    {
        if (bPointReached)
        {
            if (bClockwise)
            {
                y = my - r * sin(c);
                x = mx - r * cos(c);
            }
            else
            {
                y = my + r * sin(c);
                x = mx + r * cos(c);
            }
            bPointReached = false;
            uiCheckTimer = 1000;
            me->GetMotionMaster()->MovePoint(1,x, y, SHIELD_ORB_Z);
            c += M_PI/32;
            if (c >= 2*M_PI) c = 0;
        }
        else
        {
            if (uiCheckTimer <= diff)
            {
                DoTeleportTo(x,y,SHIELD_ORB_Z);
                bPointReached = true;
            }
            else uiCheckTimer -= diff;
        }

        if (uiTimer <= diff)
        {
            if (Unit* random = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_PLAYER_GUID) : 0))
                DoCast(random, SPELL_SHADOW_BOLT, false);
            uiTimer = urand(500,1000);
        } else uiTimer -= diff;
    }
Пример #5
0
        void UpdateAI(uint32 diff) override
        {
            if (MustDie)
            {
                if (MustDieTimer <= diff)
                {
                    me->DespawnOrUnsummon();
                    return;
                } else MustDieTimer -= diff;
            }

            if (!Escape)
            {
                if (!PlayerGUID)
                    return;

                if (SpellEscapeTimer <= diff)
                {
                    DoCast(me, SPELL_RIZZLE_ESCAPE, false);
                    SpellEscapeTimer = 10000;
                } else SpellEscapeTimer -= diff;

                if (TeleportTimer <= diff)
                {
                    // temp solution - unit can't be teleported by core using spelleffect 5, only players
                    DoTeleportTo(3706.39f, -3969.15f, 35.9118f);

                    //begin swimming and summon depth charges
                    Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
                    if (!player)
                        return;

                    Talk(MSG_ESCAPE_NOTICE, player);
                    DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE);
                    me->SetHover(true);
                    me->SetSwim(true);
                    me->SetSpeedRate(MOVE_RUN, 0.85f);
                    me->GetMotionMaster()->MovementExpired();
                    me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]);
                    Escape = true;
                } else TeleportTimer -= diff;

                return;
            }

            if (ContinueWP)
            {
                me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP]);
                ContinueWP = false;
            }

            if (GrenadeTimer <= diff)
            {
                if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
                {
                   Talk(SAY_RIZZLE_GRENADE, player);
                   DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true);
                }
                GrenadeTimer = 30000;
            } else GrenadeTimer -= diff;

            if (CheckTimer <= diff)
            {
                Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
                if (!player)
                {
                    me->DespawnOrUnsummon();
                    return;
                }

                if (me->IsWithinDist(player, 10) && me->GetPositionX() > player->GetPositionX() && !Reached)
                {
                    Talk(SAY_RIZZLE_FINAL);
                    me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
                    me->setFaction(35);
                    me->GetMotionMaster()->MoveIdle();
                    me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE);
                    Reached = true;
                }

                CheckTimer = 1000;
            } else CheckTimer -= diff;
        }
Пример #6
0
		void UpdateAI(const uint32 diff) {
			if (Phase == NORMAL) {
				//Return since we have no target
				if (!UpdateVictim())
					return;

				if (uiSinsterStrikeTimer <= diff) {
					DoCast(me->getVictim(), SPELL_SINSTER_STRIKE);
					uiSinsterStrikeTimer = urand(5 * IN_MILLISECONDS,
							9 * IN_MILLISECONDS);
				} else
					uiSinsterStrikeTimer -= diff;

				if (uiCallFlamesTimer <= diff) {
					if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) {
						DoCast(pTarget, SPELL_CALL_FLAMES);
						uiCallFlamesTimer = urand(8 * IN_MILLISECONDS,
								12 * IN_MILLISECONDS);
					}
				} else
					uiCallFlamesTimer -= diff;

				if (!bSacrificed) {
					if (uiRitualOfSwordTimer <= diff) {
						if (Unit* pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) {
							DoScriptText(
									RAND(SAY_SACRIFICE_PLAYER_1,
											SAY_SACRIFICE_PLAYER_2,
											SAY_SACRIFICE_PLAYER_3,
											SAY_SACRIFICE_PLAYER_4,
											SAY_SACRIFICE_PLAYER_5), me);
							DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD);
							//Spell doesn't teleport
							DoTeleportPlayer(pSacrificeTarget, 296.632f,
									-346.075f, 90.63f, 4.6f);
							me->SetUnitMovementFlags(MOVEMENTFLAG_CAN_FLY);
							DoTeleportTo(296.632f, -346.075f, 120.85f);
							Phase = SACRIFICING;
							if (pInstance) {
								pInstance->SetData64(DATA_SACRIFICED_PLAYER,
										pSacrificeTarget->GetGUID());

								for (uint8 i = 0; i < 3; ++i)
									if (Creature* pSummon = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000))
										pSummon->AI()->DoAction(0);
							}

							bSacrificed = true;
						}
					} else
						uiRitualOfSwordTimer -= diff;
				}

				DoMeleeAttackIfReady();
			} else //SACRIFICING
			{
				if (uiSacrificeTimer <= diff) {
					Unit* pSacrificeTarget =
							pInstance ?
									Unit::GetUnit(
											*me,
											pInstance->GetData64(
													DATA_SACRIFICED_PLAYER)) :
									NULL;
					if (pInstance && !summons.empty() && pSacrificeTarget
							&& pSacrificeTarget->isAlive())
						me->Kill(pSacrificeTarget, false); // durability damage?

					//go down
					Phase = NORMAL;
					pSacrificeTarget = NULL;
					me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);
					if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
						me->GetMotionMaster()->MoveChase(pTarget);

					uiSacrificeTimer = 8 * IN_MILLISECONDS;
				} else
					uiSacrificeTimer -= diff;
			}
		}
Пример #7
0
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

                //Invisible_Timer
                if (Invisible_Timer <= diff)
                {
                    me->InterruptSpell(CURRENT_GENERIC_SPELL);

                    SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
                    me->SetDisplayId(11686);

                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    Invisible = true;

                    Invisible_Timer = urand(15000, 30000);
                } else Invisible_Timer -= diff;

                if (Invisible)
                {
                    if (Ambush_Timer <= diff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                        {
                            DoTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
                            DoCast(target, SPELL_AMBUSH);
                        }

                        Ambushed = true;
                        Ambush_Timer = 3000;
                    } else Ambush_Timer -= diff;
                }

                if (Ambushed)
                {
                    if (Visible_Timer <= diff)
                    {
                        me->InterruptSpell(CURRENT_GENERIC_SPELL);

                        me->SetDisplayId(15268);
                        SetEquipmentSlots(false, EQUIP_ID_MAIN_HAND, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);

                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        Invisible = false;

                        Visible_Timer = 4000;
                    } else Visible_Timer -= diff;
                }

                //Resetting some aggro so he attacks other gamers
                if (!Invisible)
                {
                    if (Aggro_Timer <= diff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                        {
                            if (DoGetThreat(me->GetVictim()))
                                DoModifyThreatPercent(me->GetVictim(), -50);
                            AttackStart(target);
                        }

                        Aggro_Timer = urand(7000, 20000);
                    } else Aggro_Timer -= diff;

                    if (ThousandBlades_Timer <= diff)
                    {
                        DoCastVictim(SPELL_THOUSANDBLADES);
                        ThousandBlades_Timer = urand(7000, 12000);
                    } else ThousandBlades_Timer -= diff;
                }

                DoMeleeAttackIfReady();
            }
Пример #8
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (Blink)
        {
            DoCast(m_creature,HEROIC(SPELL_ARCANE_EXPLOSION, H_SPELL_ARCANE_EXPLOSION));
            m_creature->CastSpell(m_creature,SPELL_ARCANE_BUBBLE,true);
            Blink = false;
        }

        if (ArcaneVolley_Timer < diff)
        {
            DoCast(m_creature,HEROIC(SPELL_ARCANE_VOLLEY, H_SPELL_ARCANE_VOLLEY));
            ArcaneVolley_Timer = 7000+rand()%5000;
        }else ArcaneVolley_Timer -= diff;

        if (Sheep_Timer < diff)
        {
            //second top aggro target in normal, random target in heroic correct?
            Unit *target = NULL;
            target = HeroicMode ? SelectUnit(SELECT_TARGET_RANDOM,0) : SelectUnit(SELECT_TARGET_TOPAGGRO,1);
            if (target)
                DoCast(target,HEROIC(SPELL_POLYMORPH, H_SPELL_POLYMORPH));
            Sheep_Timer = 15000+rand()%2500;
        }else Sheep_Timer -= diff;

        //may not be correct time to cast
        if (!ManaShield && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 20))
        {
            DoCast(m_creature,SPELL_MANA_SHIELD);
            ManaShield = true;
        }

        if (HeroicMode)
        {
            if (Slow_Timer < diff)
            {
                DoCast(m_creature,H_SPELL_SLOW);
                Slow_Timer = 15000+rand()%25000;
            }else Slow_Timer -= diff;
        }

        if (Blink_Timer < diff)
        {
            DoScriptText(EMOTE_ARCANE_EXP, m_creature);

            if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0))
            {
                if (m_creature->IsNonMeleeSpellCasted(false))
                    m_creature->InterruptNonMeleeSpells(false);

                //Spell doesn't work, but we use for visual effect at least
                DoCast(target,SPELL_BLINK);

                float X = target->GetPositionX();
                float Y = target->GetPositionY();
                float Z = target->GetPositionZ();

                DoTeleportTo(X,Y,Z);

                DoCast(target,SPELL_BLINK_TELEPORT);
                Blink = true;
            }
            Blink_Timer = 35000+rand()%5000;
        }else Blink_Timer -= diff;

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

            //Only do this if we haven't spawned nef yet
            if (SpawnedAdds < 42)
            {
                //ShadowBoltTimer
                if (ShadowBoltTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_SHADOWBOLT);

                    ShadowBoltTimer = urand(3000, 10000);
                } else ShadowBoltTimer -= diff;

                //FearTimer
                if (FearTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_FEAR);

                    FearTimer = 10000 + (rand()%10000);
                } else FearTimer -= diff;

                //Add spawning mechanism
                if (AddSpawnTimer <= diff)
                {
                    //Spawn 2 random types of creatures at the 2 locations
                    uint32 CreatureID;
                    Creature* Spawned = NULL;
                    Unit* target = NULL;

                    //1 in 3 chance it will be a chromatic
                    if (urand(0, 2) == 0)
                        CreatureID = CREATURE_CHROMATIC_DRAKANOID;
                    else
                        CreatureID = DrakType1;

                    ++SpawnedAdds;

                    //Spawn Creature and force it to start attacking a random target
                    Spawned = me->SummonCreature(CreatureID, ADD_X1, ADD_Y1, ADD_Z1, 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                    if (target && Spawned)
                    {
                        Spawned->AI()->AttackStart(target);
                        Spawned->setFaction(103);
                    }

                    //1 in 3 chance it will be a chromatic
                    if (urand(0, 2) == 0)
                        CreatureID = CREATURE_CHROMATIC_DRAKANOID;
                    else
                        CreatureID = DrakType2;

                    ++SpawnedAdds;

                    Spawned = me->SummonCreature(CreatureID, ADD_X2, ADD_Y2, ADD_Z2, 5.000f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                    if (target && Spawned)
                    {
                        Spawned->AI()->AttackStart(target);
                        Spawned->setFaction(103);
                    }

                    //Begin phase 2 by spawning Nefarian and what not
                    if (SpawnedAdds >= 42)
                    {
                        //Teleport Victor Nefarius way out of the map
                        //sMapMgr->GetMap(me->GetMapId(), me)->CreatureRelocation(me, 0, 0, -5000, 0);

                        //Interrupt any spell casting
                        me->InterruptNonMeleeSpells(false);

                        //Root self
                        DoCast(me, 33356);

                        //Make super invis
                        DoCast(me, 8149);

                        //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues)
                        DoTeleportTo(HIDE_X, HIDE_Y, HIDE_Z);
                        me->AddUnitState(UNIT_STATE_FLEEING);

                        //Spawn nef and have him attack a random target
                        Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN, NEF_X, NEF_Y, NEF_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000);
                        target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                        if (target && Nefarian)
                        {
                            Nefarian->AI()->AttackStart(target);
                            Nefarian->setFaction(103);
                            NefarianGUID = Nefarian->GetGUID();
                        }
                        else sLog->outError("TSCR: Blackwing Lair: Unable to spawn nefarian properly.");
                    }

                    AddSpawnTimer = 4000;
                } else AddSpawnTimer -= diff;
            }
            else if (NefarianGUID)
            {
                if (NefCheckTime <= diff)
                {
                    Unit* Nefarian = Unit::GetCreature((*me), NefarianGUID);

                    //If nef is dead then we die to so the players get out of combat
                    //and cannot repeat the event
                    if (!Nefarian || !Nefarian->isAlive())
                    {
                        NefarianGUID = 0;
                        me->DespawnOrUnsummon();
                    }

                    NefCheckTime = 2000;
                } else NefCheckTime -= diff;
            }
        }
Пример #10
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || !CheckInRoom())
                return;

            events.Update(diff);

            if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo)
            {
                thirtyPercentReached = true;
                if (instance)
                    instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
            }

            if (me->HasUnitState(UNIT_STAT_CASTING))
                return;

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                    case EVENT_SUMMON:
                        if (waves[waveCount].entry)
                        {
                            if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
                               DoGothikSummon(waves[waveCount].entry);
                            else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
                                DoGothikSummon(waves[waveCount].entry);
                            else if (waves[waveCount].mode == 1)
                                DoGothikSummon(waves[waveCount].entry);

                            // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11)
                            if (waveCount == 11)
                            {
                                if (!CheckGroupSplitted())
                                {
                                    if (instance)
                                        instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
                                    summons.DoAction(0, 0);
                                    summons.DoZoneInCombat();
                                    mergedSides = true;
                                }
                            }

                            if (waves[waveCount].mode == 1)
                                events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
                            else if ((waves[waveCount].mode == 2) && (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))
                                events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
                            else if ((waves[waveCount].mode == 0) && (getDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))
                                events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);
                            else
                                events.ScheduleEvent(EVENT_SUMMON, 0);

                            ++waveCount;
                        }
                        else
                        {
                            phaseTwo = true;
                            DoScriptText(SAY_TELEPORT, me);
                            DoTeleportTo(PosGroundLiveSide);
                            me->SetReactState(REACT_AGGRESSIVE);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
                            summons.DoAction(0, 0);
                            summons.DoZoneInCombat();
                            events.ScheduleEvent(EVENT_BOLT, 1000);
                            events.ScheduleEvent(EVENT_HARVEST, urand(3000, 15000));
                            events.ScheduleEvent(EVENT_TELEPORT, 20000);
                        }
                        break;
                    case EVENT_BOLT:
                        DoCast(me->getVictim(), RAID_MODE(SPELL_SHADOW_BOLT, H_SPELL_SHADOW_BOLT));
                        events.ScheduleEvent(EVENT_BOLT, 1000);
                        break;
                    case EVENT_HARVEST:
                        DoCast(me->getVictim(), SPELL_HARVEST_SOUL, true);
                        events.ScheduleEvent(EVENT_HARVEST, urand(20000, 25000));
                        break;
                    case EVENT_TELEPORT:
                        if (!thirtyPercentReached)
                        {
                            me->AttackStop();
                            if (IN_LIVE_SIDE(me))
                            {
                                DoTeleportTo(PosGroundDeadSide);
                            }
                            else
                            {
                                DoTeleportTo(PosGroundLiveSide);
                            }

                            me->getThreatManager().resetAggro(NotOnSameSide(me));
                            if (Unit *pTarget = SelectTarget(SELECT_TARGET_NEAREST, 0))
                            {
                                me->getThreatManager().addThreat(pTarget, 100.0f);
                                AttackStart(pTarget);
                            }

                            events.ScheduleEvent(EVENT_TELEPORT, 20000);
                        }
                        break;
                }
            }

            DoMeleeAttackIfReady();
        }
Пример #11
0
        void UpdateAI(uint32 const Diff) 
        {
            if (!UpdateVictim())
                return;

            // Waterspout on 60% and 30% of health
            if((me->GetHealthPct() < 60 && !WaterSpoutCounter && me->GetHealthPct() > 30) || (me->GetHealthPct() < 30 && WaterSpoutCounter))
            {
                Talk(WaterSpoutCounter ? SAY_33_PRECENT : SAY_66_PRECENT);

                WaterSpoutCounter = !WaterSpoutCounter;
                IsWaterSpoutPhase = true;
                WaterSpoutPhaseTimer = 60000;

                if (IsHeroic())
                    DoTeleportTo(192.056f, 802.527f, 807.638f, 3.13f);

                // Stop movement
                SetCombatMovement(false);

                for(uint8 i = 0; i < 3; ++i)
                    if (Creature * creature = me->SummonCreature(Info[i].entry, Info[i].x, Info[i].y, Info[i].z, Info[i].o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
                    {
                        DoZoneInCombat(creature);
                        float x,y,z;
                        creature->GetClosePoint(x, y, z, creature->GetObjectSize(), 10);
                        creature->GetMotionMaster()->MoveJump(x, y, 807.638f, 15, 15);
                    }

                SummonCount = 3;

                me->CastSpell(me, SPELL_WATERSPOUT, false);
                // On heroic apply aura to summon tornado periodically
                if (IsHeroic())
                    me->AddAura(SPELL_WATERSPOUT_SUMMON, me);
            }

            if (IsWaterSpoutPhase)
            {
                if (WaterSpoutPhaseTimer < Diff || SummonCount == 0)
                {
                    me->RemoveAurasDueToSpell(SPELL_WATERSPOUT);
                    me->RemoveAurasDueToSpell(SPELL_WATERSPOUT_SUMMON);
                    SetCombatMovement(true);
                    IsWaterSpoutPhase = false;
                }
                else
                    WaterSpoutPhaseTimer -= Diff;

                return;
            }

            if (ShockBlastTimer <= Diff)
            {
                if (me->IsNonMeleeSpellCasted(false))
                    return;

                DoCastVictim(SPELL_SHOCK_BLAST);
                ShockBlastTimer = 16000;
            }
            else
                ShockBlastTimer -= Diff;

            if (GeyserTimer <= Diff)
            {
                if (me->IsNonMeleeSpellCasted(false))
                    return;

                if (Unit * pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    me->CastSpell(pTarget, SPELL_SUMMON_GEYSER, false);

                GeyserTimer = urand(9000, 14000);
            }
            else
                GeyserTimer -= Diff;

            if (FungalSporeTimer <= Diff)
            {
                if (me->IsNonMeleeSpellCasted(false))
                    return;

                if (Unit * pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    me->CastSpell(pTarget, SPELL_FUNGAL_SPORE, false);

                FungalSporeTimer = urand(12000, 16000);
            }
            else
                FungalSporeTimer -= Diff;

            DoMeleeAttackIfReady();
        }
Пример #12
0
    void UpdateAI(const uint32 diff)
    {
        if (Must_Die)
        {
            if (Must_Die_Timer <= diff)
            {
                Despawn();
                return;
            }
            else Must_Die_Timer -= diff;
        }

        if (!Escape)
        {
            if (!PlayerGUID)
                return;

            if (spellEscape_Timer <= diff)
            {
                DoCast(me, SPELL_RIZZLE_ESCAPE, false);
                spellEscape_Timer = 10000;
            }
            else spellEscape_Timer -= diff;

            if (Teleport_Timer <= diff)
            {
                // temp solution - unit can't be teleported by core using spelleffect 5, only players
                DoTeleportTo(3706.39f, -3969.15f, 35.9118f);

                //begin swimming and summon depth charges
                Player* player = Unit::GetPlayer(*me, PlayerGUID);
                if (!player)
                    return;

                DoScriptText(EMOTE_START, me);
                DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE);
                me->SetSwim(true);
                me->SetSpeed(MOVE_RUN, 0.85f, true);
                me->GetMotionMaster()->MovementExpired();
                me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]);
                Escape = true;
            }
            else Teleport_Timer -= diff;

            return;
        }

        if (ContinueWP)
        {
            me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]);
            ContinueWP = false;
        }

        if (Grenade_Timer <= diff)
        {
            Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID);
            if (pPlayer)
            {
                DoScriptText(SAY_RIZZLE_GRENADE, me, pPlayer);
                DoCast(pPlayer, SPELL_RIZZLE_FROST_GRENADE, true);
            }
            Grenade_Timer = 30000;
        }
        else Grenade_Timer -= diff;

        if (Check_Timer <= diff)
        {
            Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID);
            if (!pPlayer)
            {
                Despawn();
                return;
            }
            float dist = me->GetDistance(pPlayer);
            if (dist < 10 && me->GetPositionX() > pPlayer->GetPositionX() && !Reached)
            {
                DoScriptText(SAY_RIZZLE_FINAL, me);
                me->SetUInt32Value(UNIT_NPC_FLAGS, 1);
                me->SetFaction(35);
                me->GetMotionMaster()->MoveIdle();
                me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE);
                Reached = true;
            }

            Check_Timer = 1000;
        }
        else Check_Timer -= diff;

    }
Пример #13
0
    void UpdateAI(const uint32 diff)
    {
        if(isFlameBreathing)
        {
            if(!m_creature->IsNonMeleeSpellCasted(false))
            {
                isFlameBreathing = false;
            }else 
            {
                if(EnrageTimer > diff)
                    EnrageTimer -= diff;
                else
                    EnrageTimer = 0;
                if(HatcherTimer > diff)
                    HatcherTimer -= diff;
                else
                    HatcherTimer = 0;
                return;
            }
        }

        if(isBombing)
        {
            if(BombSequenceTimer < diff)
            {
                HandleBombSequence();
            }else 
                BombSequenceTimer -= diff;
    
            if(EnrageTimer > diff)
                EnrageTimer -= diff;
            else
                EnrageTimer = 0;
            if(HatcherTimer > diff)
                HatcherTimer -= diff;
            else
                HatcherTimer = 0;
            return;
        }

        if(!UpdateVictim())
            return;

        if (checkTimer < diff)
        {
            if (!m_creature->IsWithinDistInMap(&wLoc, 25))
                EnterEvadeMode();
            else
                DoZoneInCombat();
            checkTimer = 3000;
        }
        else
            checkTimer -= diff;

        //enrage if under 25% hp before 5 min.
        if(!enraged && m_creature->GetHealth() * 4 < m_creature->GetMaxHealth())
            EnrageTimer = 0;

        if(EnrageTimer < diff)
        {
            if(!enraged)
            {
                m_creature->CastSpell(m_creature, SPELL_ENRAGE, true);
                enraged = true;
                EnrageTimer = 300000;
            }
            else
            {
                DoScriptText(SAY_BERSERK, m_creature);
                m_creature->CastSpell(m_creature, SPELL_BERSERK, true);
                EnrageTimer = 300000;
            }
        }else EnrageTimer -= diff;

        if(BombTimer < diff)
        {
            DoScriptText(SAY_FIRE_BOMBS, m_creature);

            m_creature->AttackStop();
            m_creature->GetMotionMaster()->Clear();
            DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
            m_creature->StopMoving();
            m_creature->CastSpell(m_creature, SPELL_FIRE_BOMB_CHANNEL, false);
            //DoTeleportPlayer(m_creature, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0);
            //m_creature->CastSpell(m_creature, SPELL_TELE_TO_CENTER, true);

            FireWall();
            SpawnBombs();
            isBombing = true;
            BombSequenceTimer = 100;

            //Teleport every Player into the middle
            Map *map = m_creature->GetMap();
            if(!map->IsDungeon()) return;
            Map::PlayerList const &PlayerList = map->GetPlayers();
            for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                if (Player* i_pl = i->getSource())
                    if(i_pl->isAlive())
                        DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
            }
            //m_creature->CastSpell(Temp, SPELL_SUMMON_PLAYERS, true); // core bug, spell does not work if too far
            return;
        }else BombTimer -= diff;

        if(!noeggs)
        {
            if(100 * m_creature->GetHealth() < 35 * m_creature->GetMaxHealth())
            {
                DoScriptText(SAY_ALL_EGGS, m_creature);

                m_creature->AttackStop();
                m_creature->GetMotionMaster()->Clear();
                DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
                m_creature->StopMoving();
                m_creature->CastSpell(m_creature, SPELL_HATCH_ALL, false);
                HatchAllEggs(2);
                noeggs = true;
            }
            else if(HatcherTimer < diff)
            {
                if(HatchAllEggs(0))
                {
                    DoScriptText(SAY_SUMMON_HATCHER, m_creature);
                    m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                    m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                    HatcherTimer = 90000;
                }
                else
                    noeggs = true;
            }else HatcherTimer -= diff;
        }

        if(ResetTimer < diff)
        {
            float x, y, z, o;
            m_creature->GetHomePosition(x, y, z, o);
            if(m_creature->GetPositionZ() <= z-7)
            {
                EnterEvadeMode();
                return;
            }
            ResetTimer = 5000;
        }else ResetTimer -= diff;

        DoMeleeAttackIfReady();

        if(FireBreathTimer < diff)
        {
            if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0, GetSpellMaxRange(SPELL_FLAME_BREATH), true))
            {
                me->SetSelection(target->GetGUID());
                me->SetInFront(target);
                m_creature->CastSpell(target, SPELL_FLAME_BREATH, false);
                isFlameBreathing = true;
            }
            FireBreathTimer = 8000;
        }else FireBreathTimer -= diff;
    }
Пример #14
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (m_checkTimer < diff)
        {
            if (me->IsWithinDistInMap(&wLoc, 100.0f))
                DoZoneInCombat();
            else
            {
                EnterEvadeMode();
                return;
            }

            uint32 damage = 0;
            SharedRule(damage);
            me->SetSpeed(MOVE_RUN, 2.0);
            // move always after stun recovery
            if (!me->hasUnitState(UNIT_STAT_STUNNED) && !me->HasAura(SPELL_VANISH, 1))
                DoStartMovement(me->getVictim());
            m_checkTimer = 1000;
        }
        else
            m_checkTimer -= diff;

        if (m_vanishTimer < diff)
        {
            if (me->HasAuraType(SPELL_AURA_MOD_STUN))    // remove stun
                me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STUN);

            if (me->HasAuraType(SPELL_AURA_MOD_STALKED)) // remove Hunter's Marks and similar trackers
                me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED);

            me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true);

            ForceSpellCast(me, SPELL_VANISH, INTERRUPT_AND_CAST_INSTANTLY);
            ForceSpellCast(me, SPELL_DEADLY_POISON, INTERRUPT_AND_CAST_INSTANTLY);

            Position dest;
            if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 35.0f, true))
                target->GetValidPointInAngle(dest, 5.0f, frand(0.0f, 2*M_PI), true);
            else
                me->GetValidPointInAngle(dest, 30.0f, frand(0.0f, 2*M_PI), true);

            DoTeleportTo(dest.x, dest.y, dest.z);

            // drop movement :P
            me->GetMotionMaster()->MoveIdle();

            m_vanishTimer = 60000;
        }
        else
                m_vanishTimer -= diff;

        if (me->HasAura(SPELL_VANISH, 1))
            return;

        DoMeleeAttackIfReady();
        CastNextSpellIfAnyAndReady();
    }
Пример #15
0
        void UpdateAI(uint32 diff) override
        {
            if (!CanAttack && Intro)
            {
                if (AggroTimer <= diff)
                {
                    CanAttack = true;
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    AggroTimer=19000;
                }
                else
                {
                    AggroTimer-=diff;
                    return;
                }
            }
            // to prevent abuses during phase 2
            if (Phase == 2 && !me->GetVictim() && me->IsInCombat())
            {
                EnterEvadeMode();
                return;
            }
            // Return since we have no target
            if (!UpdateVictim())
                return;

            if (Phase == 1 || Phase == 3)
            {
                // ShockBlastTimer
                if (ShockBlastTimer <= diff)
                {
                    // Shock Burst
                    // Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list.
                    DoCastVictim(SPELL_SHOCK_BLAST);
                    me->TauntApply(me->GetVictim());

                    ShockBlastTimer = 1000 + rand32() % 14000;       // random cooldown
                } else ShockBlastTimer -= diff;

                // StaticChargeTimer
                if (StaticChargeTimer <= diff)
                {
                    // Static Charge
                    // Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);
                    if (target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
                        DoCast(target, SPELL_STATIC_CHARGE_TRIGGER); // cast Static Charge every 2 seconds for 20 seconds

                    StaticChargeTimer = 10000 + rand32() % 20000;
                } else StaticChargeTimer -= diff;

                // EntangleTimer
                if (EntangleTimer <= diff)
                {
                    if (!Entangle)
                    {
                        // Entangle
                        // Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom.
                        DoCastVictim(SPELL_ENTANGLE);
                        Entangle = true;
                        EntangleTimer = 10000;
                    }
                    else
                    {
                        CastShootOrMultishot();
                        Entangle = false;
                        EntangleTimer = 20000 + rand32() % 5000;
                    }
                } else EntangleTimer -= diff;

                // Phase 1
                if (Phase == 1)
                {
                    // Start phase 2
                    if (HealthBelowPct(70))
                    {
                        // Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable.
                        Phase = 2;

                        me->GetMotionMaster()->Clear();
                        DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z);

                        for (uint8 i = 0; i < 4; ++i)
                            if (Creature* creature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0],  ShieldGeneratorChannelPos[i][1],  ShieldGeneratorChannelPos[i][2],  ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0))
                                ShieldGeneratorChannel[i] = creature->GetGUID();

                        Talk(SAY_PHASE2);
                    }
                }
                // Phase 3
                else
                {
                    // SummonSporebatTimer
                    if (SummonSporebatTimer <= diff)
                    {
                        if (Creature* sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                sporebat->AI()->AttackStart(target);

                        // summon sporebats faster and faster
                        if (SummonSporebatStaticTimer > 1000)
                            SummonSporebatStaticTimer -= 1000;

                        SummonSporebatTimer = SummonSporebatStaticTimer;

                        if (SummonSporebatTimer < 5000)
                            SummonSporebatTimer = 5000;

                    } else SummonSporebatTimer -= diff;
                }

                // Melee attack
                DoMeleeAttackIfReady();

                // CheckTimer - used to check if somebody is in melee range
                if (CheckTimer <= diff)
                {
                    bool inMeleeRange = false;
                    std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
                    for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
                    {
                        Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
                        if (target && target->IsWithinDistInMap(me, 5)) // if in melee range
                        {
                            inMeleeRange = true;
                            break;
                        }
                    }

                    // if nobody is in melee range
                    if (!inMeleeRange)
                        CastShootOrMultishot();

                    CheckTimer = 5000;
                } else CheckTimer -= diff;
            }
            // Phase 2
            else
            {
                // ForkedLightningTimer
                if (ForkedLightningTimer <= diff)
                {
                    // Forked Lightning
                    // Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage.
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);

                    if (!target)
                        target = me->GetVictim();

                    DoCast(target, SPELL_FORKED_LIGHTNING);

                    ForkedLightningTimer = 2000 + rand32() % 6000;
                } else ForkedLightningTimer -= diff;

                // EnchantedElementalTimer
                if (EnchantedElementalTimer <= diff)
                {
                    me->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElementalPos][0], ElementPos[EnchantedElementalPos][1], ElementPos[EnchantedElementalPos][2], ElementPos[EnchantedElementalPos][3], TEMPSUMMON_CORPSE_DESPAWN, 0);

                    if (EnchantedElementalPos == 7)
                        EnchantedElementalPos = 0;
                    else
                        ++EnchantedElementalPos;

                    EnchantedElementalTimer = 10000 + rand32() % 5000;
                } else EnchantedElementalTimer -= diff;

                // TaintedElementalTimer
                if (TaintedElementalTimer <= diff)
                {
                    uint32 pos = rand32() % 8;
                    me->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0);

                    TaintedElementalTimer = 120000;
                } else TaintedElementalTimer -= diff;

                // CoilfangEliteTimer
                if (CoilfangEliteTimer <= diff)
                {
                    uint32 pos = rand32() % 3;
                    Creature* coilfangElite = me->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    if (coilfangElite)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            coilfangElite->AI()->AttackStart(target);
                        else if (me->GetVictim())
                            coilfangElite->AI()->AttackStart(me->GetVictim());
                    }
                    CoilfangEliteTimer = 45000 + rand32() % 5000;
                } else CoilfangEliteTimer -= diff;

                // CoilfangStriderTimer
                if (CoilfangStriderTimer <= diff)
                {
                    uint32 pos = rand32() % 3;
                    if (Creature* CoilfangStrider = me->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            CoilfangStrider->AI()->AttackStart(target);
                        else if (me->GetVictim())
                            CoilfangStrider->AI()->AttackStart(me->GetVictim());
                    }
                    CoilfangStriderTimer = 60000 + rand32() % 10000;
                } else CoilfangStriderTimer -= diff;

                // CheckTimer
                if (CheckTimer <= diff)
                {
                    // Start Phase 3
                    if (instance->GetData(DATA_CANSTARTPHASE3))
                    {
                        // set life 50%
                        me->SetHealth(me->CountPctFromMaxHealth(50));

                        me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER);

                        Talk(SAY_PHASE3);

                        Phase = 3;

                        // return to the tank
                        me->GetMotionMaster()->MoveChase(me->GetVictim());
                    }
                    CheckTimer = 1000;
                } else CheckTimer -= diff;
            }
        }
Пример #16
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        //Invisible_Timer
        if (Invisible_Timer <= diff)
        {
            me->InterruptSpell(CURRENT_GENERIC_SPELL);

            me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 0);
            me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218171138);
            me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO + 1, 3);
            me->SetDisplayId(11686);

            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            Invisible = true;

            Invisible_Timer = 15000 + rand()%15000;
        } else Invisible_Timer -= diff;

        if (Invisible)
        {
            if (Ambush_Timer <= diff)
            {
                Unit* pTarget = NULL;
                pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
                if (pTarget)
                {
                    DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ());
                    DoCast(pTarget, SPELL_AMBUSH);
                }

                Ambushed = true;
                Ambush_Timer = 3000;
            } else Ambush_Timer -= diff;
        }

        if (Ambushed)
        {
            if (Visible_Timer <= diff)
            {
                me->InterruptSpell(CURRENT_GENERIC_SPELL);

                me->SetDisplayId(15268);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, 31818);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, 218171138);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO + 1, 3);

                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                Invisible = false;

                Visible_Timer = 4000;
            } else Visible_Timer -= diff;
        }

        //Resetting some aggro so he attacks other gamers
        if (!Invisible)
        {
            if (Aggro_Timer <= diff)
            {
                Unit* pTarget = NULL;
                pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);

                if (DoGetThreat(me->getVictim()))
                    DoModifyThreatPercent(me->getVictim(),-50);

                if (pTarget)
                    AttackStart(pTarget);

                Aggro_Timer = 7000 + rand()%13000;
            } else Aggro_Timer -= diff;
        }

        if (!Invisible)
        {
            if (ThousandBlades_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_THOUSANDBLADES);
                ThousandBlades_Timer = 7000 + rand()%5000;
            } else ThousandBlades_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
Пример #17
0
    void UpdateAI(const uint32 diff)
    {
        if(!CanAttack && Intro)
        {
            if(AggroTimer < diff)
            {
                CanAttack = true;
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                AggroTimer=19000;
            }else
            {
                AggroTimer-=diff;
                return;
            }
        }
        //to prevent abuses during phase 2
        if(Phase == 2 && !m_creature->getVictim() && InCombat)
        {
            EnterEvadeMode();
            return;
        }
        //Return since we have no target
        if (!UpdateVictim() )
            return;

        if(Phase == 1 || Phase == 3)
        {
            //ShockBlast_Timer
            if (ShockBlast_Timer < diff)
            {
                //Shock Burst
                //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list.
                DoCast(m_creature->getVictim(), SPELL_SHOCK_BLAST);
                m_creature->TauntApply(m_creature->getVictim());

                ShockBlast_Timer = 1000+rand()%14000;       //random cooldown
            }else ShockBlast_Timer -= diff;

            //StaticCharge_Timer
            if(StaticCharge_Timer < diff)
            {
                //Static Charge
                //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of 3s, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.
                Unit *target = NULL;
                target = SelectUnit(SELECT_TARGET_RANDOM, 0);

                if(target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER, 0) && target->GetTypeId() == TYPEID_PLAYER && !target->isDead())
                                                            //cast Static Charge every 2 seconds for 20 seconds
                        DoCast(target, SPELL_STATIC_CHARGE_TRIGGER);

                StaticCharge_Timer = 10000+rand()%20000;    //blizzlike
            }else StaticCharge_Timer -= diff;

            //Entangle_Timer
            if (Entangle_Timer < diff)
            {
                if(!Entangle)
                {
                    //Entangle
                    //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom.
                    DoCast(m_creature->getVictim(), SPELL_ENTANGLE);
                    Entangle = true;
                    Entangle_Timer = 10000;
                }
                else
                {
                    CastShootOrMultishot();
                    Entangle = false;
                    Entangle_Timer = 20000+rand()%5000;
                }
            }else Entangle_Timer -= diff;

            //Phase 1
            if(Phase == 1)
            {
                //Start phase 2
                if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 70)
                {
                    //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable.
                    Phase = 2;

                    m_creature->GetMotionMaster()->Clear();
                    DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z);

                    Creature *pCreature;
                    for(uint8 i = 0; i < 4; i++)
                    {
                        pCreature = m_creature->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0],  ShieldGeneratorChannelPos[i][1],  ShieldGeneratorChannelPos[i][2],  ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0);
                        if (pCreature)
                            ShieldGeneratorChannel[i] = pCreature->GetGUID();
                    }
                    DoScriptText(SAY_PHASE2, m_creature);
                }
            }
            //Phase 3
            else
            {
                //SummonSporebat_Timer
                if(SummonSporebat_Timer < diff)
                {
                    Creature *Sporebat = NULL;
                    Sporebat = m_creature->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0);

                    if(Sporebat)
                    {
                        Unit *target = NULL;
                        target = SelectUnit(SELECT_TARGET_RANDOM, 0);
                        if(target)
                            Sporebat->AI()->AttackStart(target);
                    }

                    //summon sporebats faster and faster
                    if(SummonSporebat_StaticTimer > 1000)
                        SummonSporebat_StaticTimer -= 1000;

                    SummonSporebat_Timer = SummonSporebat_StaticTimer;

                    if(SummonSporebat_Timer < 5000)
                        SummonSporebat_Timer = 5000;

                }else SummonSporebat_Timer -= diff;
            }

            //Melee attack
            DoMeleeAttackIfReady();

            //Check_Timer - used to check if somebody is in melee range
            if(Check_Timer < diff)
            {
                bool InMeleeRange = false;
                Unit *target;
                std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
                for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
                {
                    target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
                                                            //if in melee range
                    if(target && target->IsWithinDistInMap(m_creature, 5))
                    {
                        InMeleeRange = true;
                        break;
                    }
                }

                //if nobody is in melee range
                if(!InMeleeRange)
                CastShootOrMultishot();

                Check_Timer = 5000;
            }else Check_Timer -= diff;
        }
        //Phase 2
        else
        {
            //ForkedLightning_Timer
            if(ForkedLightning_Timer < diff)
            {
                //Forked Lightning
                //Used constantly in Phase 2, it shoots out completely randomly targeted bolts of lightning which hit everybody in a roughtly 60 degree cone in front of Vashj for 2313-2687 nature damage.
                Unit *target = NULL;
                target = SelectUnit(SELECT_TARGET_RANDOM, 0);

                if(!target)
                    target = m_creature->getVictim();
                    
                DoCast(target, SPELL_FORKED_LIGHTNING);    
                
                ForkedLightning_Timer = 2000+rand()%6000;   //blizzlike
            }else ForkedLightning_Timer -= diff;

            //EnchantedElemental_Timer
            if(EnchantedElemental_Timer < diff)
            {
                Creature *Elemental;
                Elemental = m_creature->SummonCreature(ENCHANTED_ELEMENTAL, ElementPos[EnchantedElemental_Pos][0], ElementPos[EnchantedElemental_Pos][1], ElementPos[EnchantedElemental_Pos][2], ElementPos[EnchantedElemental_Pos][3], TEMPSUMMON_CORPSE_DESPAWN, 0);

                if(EnchantedElemental_Pos == 7)
                    EnchantedElemental_Pos = 0;
                else
                    EnchantedElemental_Pos++;

                EnchantedElemental_Timer = 10000+rand()%5000;
            }else EnchantedElemental_Timer -= diff;

            //TaintedElemental_Timer
            if(TaintedElemental_Timer < diff)
            {
                Creature *Tain_Elemental;
                uint32 pos = rand()%8;
                Tain_Elemental = m_creature->SummonCreature(TAINTED_ELEMENTAL, ElementPos[pos][0], ElementPos[pos][1], ElementPos[pos][2], ElementPos[pos][3], TEMPSUMMON_DEAD_DESPAWN, 0);

                TaintedElemental_Timer = 120000;
            }else TaintedElemental_Timer -= diff;

            //CoilfangElite_Timer
            if(CoilfangElite_Timer < diff)
            {
                uint32 pos = rand()%3;
                Creature* CoilfangElite = NULL;
                CoilfangElite = m_creature->SummonCreature(COILFANG_ELITE, CoilfangElitePos[pos][0], CoilfangElitePos[pos][1], CoilfangElitePos[pos][2], CoilfangElitePos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                if(CoilfangElite)
                {
                    Unit *target = NULL;
                    target = SelectUnit(SELECT_TARGET_RANDOM, 0);
                    if(target)
                        CoilfangElite->AI()->AttackStart(target);
                    else if(m_creature->getVictim())
                        CoilfangElite->AI()->AttackStart(m_creature->getVictim());
                }
                CoilfangElite_Timer = 45000+rand()%5000;
            }else CoilfangElite_Timer -= diff;

            //CoilfangStrider_Timer
            if(CoilfangStrider_Timer < diff)
            {
                uint32 pos = rand()%3;
                Creature* CoilfangStrider = NULL;
                CoilfangStrider = m_creature->SummonCreature(COILFANG_STRIDER, CoilfangStriderPos[pos][0], CoilfangStriderPos[pos][1], CoilfangStriderPos[pos][2], CoilfangStriderPos[pos][3], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                 if(CoilfangStrider)
                {
                    Unit *target = NULL;
                    target = SelectUnit(SELECT_TARGET_RANDOM, 0);
                    if(target)
                        CoilfangStrider->AI()->AttackStart(target);
                    else if(m_creature->getVictim())
                        CoilfangStrider->AI()->AttackStart(m_creature->getVictim());
                }
                CoilfangStrider_Timer = 60000+rand()%10000;
            }else CoilfangStrider_Timer -= diff;

            //Check_Timer
            if(Check_Timer < diff)
            {
                //Start Phase 3
                if(pInstance && pInstance->GetData(DATA_CANSTARTPHASE3))
                {
                    //set life 50%
                    m_creature->SetHealth(m_creature->GetMaxHealth()/2);

                    m_creature->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER);

                    DoScriptText(SAY_PHASE3, m_creature);

                    Phase = 3;

                    //return to the tank
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                }
                
                
                  // check item tainted core. if player has item, cast root. if not has item and is rooted, remove root          
        InstanceMap::PlayerList const &playerliste = ((InstanceMap*)m_creature->GetMap())->GetPlayers();
        InstanceMap::PlayerList::const_iterator it;
        Map::PlayerList const &PlayerList = ((InstanceMap*)m_creature->GetMap())->GetPlayers();
        for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                    {
                    Player* i_pl = i->getSource();
                    {
                    if(i_pl->HasItemCount(31088, 1, false))
                    {
                            if(i_pl->HasAura(39666,0)) i_pl->RemoveAurasDueToSpell(39666); // cloak of shadowx
                            if(!i_pl->HasAura(38132,0))
                                i_pl->CastSpell(i_pl, 38132, false); // spell root
                    }
                        else if(i_pl->HasAura(38132,0))
                            i_pl->RemoveAurasDueToSpell(38132);
                    }
                    }
                    
                
                
                
                Check_Timer = 1000;
            }else Check_Timer -= diff;
        }
    }
Пример #18
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (SpawnCount == 0 && Phase == PHASE_WATERSPOUT)
            {
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false);
                SpawnCount = 3;
                SetCombatMovement(true);
                Phase = PHASE_NORMAL;
                Phased = false;
                FungalSporesTimer = urand(8000,13000);
                ShockBlastTimer = 22000;
                SummonGeyserTimer = urand(11000,16000);
                me->RemoveAurasDueToSpell(SPELL_WATERSPOUT);
                me->RemoveAurasDueToSpell(SPELL_WATERSPOUT_SUMMON);
            }

            if (me->HealthBelowPct(67) && Phase == PHASE_NORMAL && PhaseCount == 0)
            {
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                DoScriptText(SAY_66_PRECENT, me);

                PhaseCount++;
                SetCombatMovement(false);
                Phase = PHASE_WATERSPOUT;
                DoTeleportTo(192.056f, 802.527f, 807.638f, 3);
                DoCast(me, SPELL_WATERSPOUT);
                me->AddAura(SPELL_WATERSPOUT_SUMMON, me);
                Position pos;
                me->GetPosition(&pos);
                me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
                me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
                me->SummonCreature(NPC_SUMMONED_GUARD, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
                Phase2EndTimer = 60000;
            }

            if (me->HealthBelowPct(34) && Phase == PHASE_NORMAL && PhaseCount == 1)
            {
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                DoScriptText(SAY_33_PRECENT, me);

                PhaseCount++;
                SetCombatMovement(false);
                Phase = PHASE_WATERSPOUT;
                DoTeleportTo(192.056f, 802.527f, 807.638f, 3);
                DoCast(me, SPELL_WATERSPOUT);
                me->AddAura(SPELL_WATERSPOUT_SUMMON, me);
                Position pos;
                me->GetPosition(&pos);
                me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
                me->SummonCreature(NPC_SUMMONED_WITCH, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
                me->SummonCreature(NPC_SUMMONED_GUARD, pos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
                Phase2EndTimer = 60000;
            }

            if (FungalSporesTimer <= diff && Phase == PHASE_NORMAL)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(target, SPELL_FUNGAL_SPORES);
                FungalSporesTimer = urand(5000,7000);
            } else FungalSporesTimer -= diff;

            if (ShockBlastTimer <= diff && Phase == PHASE_NORMAL)
            {
                DoCastVictim(SPELL_SHOCK_BLAST);
                ShockBlastTimer = urand(12000,15000);
            } else ShockBlastTimer -= diff;

            if (SummonGeyserTimer <= diff && Phase == PHASE_NORMAL)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
                    DoCast(target, SPELL_SUMMON_GEYSER);
                SummonGeyserTimer = urand(13000,16000);
            } else SummonGeyserTimer -= diff;

            if (Phase == PHASE_WATERSPOUT)
            {
                if (Phase2EndTimer <= diff)
                {
                    SpawnCount = 3;
                    SetCombatMovement(true);
                    Phase = PHASE_NORMAL;
                    Phased = false;
                    FungalSporesTimer = urand(8000,13000);
                    ShockBlastTimer = 22000;
                    SummonGeyserTimer = urand(11000,16000);
                    me->RemoveAurasDueToSpell(SPELL_WATERSPOUT);
                    me->RemoveAurasDueToSpell(SPELL_WATERSPOUT_SUMMON);
                } else Phase2EndTimer -= diff;
            }

            DoMeleeAttackIfReady();
        }
            void UpdateAI(const uint32 diff)
            {
                if (isFlameBreathing)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                        isFlameBreathing = false;
                    else
                        return;
                }

                if (isBombing)
                {
                    if (BombSequenceTimer <= diff)
                        HandleBombSequence();
                    else
                        BombSequenceTimer -= diff;
                    return;
                }

                if (!UpdateVictim())
                    return;

                //enrage if under 25% hp before 5 min.
                if (!enraged && HealthBelowPct(25))
                    EnrageTimer = 0;

                if (EnrageTimer <= diff)
                {
                    if (!enraged)
                    {
                        DoCast(me, SPELL_ENRAGE, true);
                        enraged = true;
                        EnrageTimer = 300000;
                    }
                    else
                    {
                        DoScriptText(SAY_BERSERK, me);
                        DoCast(me, SPELL_BERSERK, true);
                        EnrageTimer = 300000;
                    }
                } else EnrageTimer -= diff;

                if (BombTimer <= diff)
                {
                    DoScriptText(SAY_FIRE_BOMBS, me);

                    me->AttackStop();
                    me->GetMotionMaster()->Clear();
                    DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
                    me->StopMoving();
                    DoCast(me, SPELL_FIRE_BOMB_CHANNEL, false);
                    //DoTeleportPlayer(me, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0);
                    //DoCast(me, SPELL_TELE_TO_CENTER, true);

                    FireWall();
                    SpawnBombs();
                    isBombing = true;
                    BombSequenceTimer = 100;

                    //Teleport every Player into the middle
                    Map* pMap = me->GetMap();
                    if (!pMap->IsDungeon()) return;
                    Map::PlayerList const &PlayerList = pMap->GetPlayers();
                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        if (Player* i_pl = i->getSource())
                            if (i_pl->isAlive())
                                DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
                    //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
                    return;
                } else BombTimer -= diff;

                if (!noeggs)
                {
                    if (HealthBelowPct(35))
                    {
                        DoScriptText(SAY_ALL_EGGS, me);

                        me->AttackStop();
                        me->GetMotionMaster()->Clear();
                        DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
                        me->StopMoving();
                        DoCast(me, SPELL_HATCH_ALL, false);
                        HatchAllEggs(2);
                        noeggs = true;
                    }
                    else if (HatcherTimer <= diff)
                    {
                        if (HatchAllEggs(0))
                        {
                            DoScriptText(SAY_SUMMON_HATCHER, me);
                            me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                            me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                            HatcherTimer = 90000;
                        }
                        else
                            noeggs = true;
                    } else HatcherTimer -= diff;
                }

                EnterEvadeIfOutOfCombatArea(diff);

                DoMeleeAttackIfReady();

                if (FireBreathTimer <= diff)
                {
                    if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0))
                    {
                        me->AttackStop();
                        me->GetMotionMaster()->Clear();
                        DoCast(pTarget, SPELL_FLAME_BREATH, false);
                        me->StopMoving();
                        isFlameBreathing = true;
                    }
                    FireBreathTimer = 8000;
                } else FireBreathTimer -= diff;
            }
Пример #20
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            if (SpawnCount == 0 && Phase == PHASE_SUMMONS)
            {
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, false);
                SpawnCount = 10;
                SetCombatMovement(true);
                Phase = PHASE_NORMAL;
                Phased = false;
                CurseBloodTimer = urand(8000,13000);
                ForceGripTimer = 22000;
                SummonGravityWellTimer = urand(11000,16000);
                SummonDevoutTimer = urand(19000,27000);
                me->RemoveAurasDueToSpell(DUNGEON_MODE(SPELL_ENERGY_SHIELD_N,SPELL_ENERGY_SHIELD_H));
            }

            if (me->HealthBelowPct(67) && Phase == PHASE_NORMAL && PhaseCount == 0)
            {
                me->MonsterYell(SAY_P2, LANG_UNIVERSAL, NULL);

                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                PhaseCount++;
                SetCombatMovement(false);
                Phase = PHASE_SUMMONS;
                DoTeleportTo(1337.89f, 963.287f, 214.184f, 1.8407);
                DoCast(me, DUNGEON_MODE(SPELL_ENERGY_SHIELD_N,SPELL_ENERGY_SHIELD_H));
                DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true), SPELL_SEISMIC_SHARD);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                Phase2EndTimer = 60000;
            }

            if (me->HealthBelowPct(34) && Phase == PHASE_NORMAL && PhaseCount == 1)
            {
                me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_INTERRUPT, true);
                me->MonsterYell(SAY_P2, LANG_UNIVERSAL, NULL);

                PhaseCount++;
                SetCombatMovement(false);
                Phase = PHASE_SUMMONS;
                DoTeleportTo(1337.89f, 963.287f, 214.184f, 1.8407);
                DoCast(me, DUNGEON_MODE(SPELL_ENERGY_SHIELD_N,SPELL_ENERGY_SHIELD_H));
                DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true), SPELL_SEISMIC_SHARD);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                Phase2EndTimer = 60000;
            }

            if (CurseBloodTimer <= diff && Phase == PHASE_NORMAL)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(target, DUNGEON_MODE(SPELL_CURSE_OF_BLOOD_N,SPELL_CURSE_OF_BLOOD_H));
                CurseBloodTimer = urand(5000,7000);
            } else CurseBloodTimer -= diff;

            if (ForceGripTimer <= diff && Phase == PHASE_NORMAL)
            {
                me->InterruptNonMeleeSpells(true);
                DoCastVictim(SPELL_FORCE_GRIP);
                ForceGripTimer = urand(12000,15000);
            } else ForceGripTimer -= diff;

            if (SummonGravityWellTimer <= diff && Phase == PHASE_NORMAL)
            {
                me->MonsterYell(SAY_EARTH, LANG_UNIVERSAL, NULL);
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
                    DoCast(target, SPELL_SUMMON_GRAVITY_WELL);
                SummonGravityWellTimer = urand(13000,16000);
            } else SummonGravityWellTimer -= diff;
			
            if (SummonDevoutTimer <= diff && Phase == PHASE_NORMAL)
            {
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[0].GetPositionX(),addSpawnLocations[0].GetPositionY(),addSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                me->SummonCreature(MOB_DEVOUT_FOLLOWER, addSpawnLocations[1].GetPositionX(),addSpawnLocations[1].GetPositionY(),addSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN);
                SummonDevoutTimer = urand(19000,27000);
            } else SummonDevoutTimer -= diff;

            if (Phase == PHASE_SUMMONS)
            {
                if (Phase2EndTimer <= diff)
                {
                    SpawnCount = 10;
                    SetCombatMovement(true);
                    Phase = PHASE_NORMAL;
                    Phased = false;
                    CurseBloodTimer = urand(8000,13000);
                    ForceGripTimer = 22000;
                    SummonGravityWellTimer = urand(11000,16000);
                    SummonDevoutTimer = urand(19000,27000);
                    me->RemoveAurasDueToSpell(DUNGEON_MODE(SPELL_ENERGY_SHIELD_N,SPELL_ENERGY_SHIELD_H));
                } else Phase2EndTimer -= diff;
            }

            DoMeleeAttackIfReady();
        }
Пример #21
0
        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim())
                return;

            if (Blink)
            {
                DoCast(me, SPELL_ARCANE_EXPLOSION);
                DoCast(me, SPELL_ARCANE_BUBBLE, true);
                Blink = false;
            }

            if (ArcaneVolley_Timer <= diff)
            {
                DoCast(me, SPELL_ARCANE_VOLLEY);
                ArcaneVolley_Timer = 7000 + rand32() % 5000;
            } else ArcaneVolley_Timer -= diff;

            if (Sheep_Timer <= diff)
            {
                Unit* target;

                //second top aggro target in normal, random target in heroic correct?
                if (IsHeroic())
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                else
                    target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1);

                if (target)
                    DoCast(target, SPELL_POLYMORPH);
                Sheep_Timer = 15000 + rand32() % 2500;
            } else Sheep_Timer -= diff;

            //may not be correct time to cast
            if (!ManaShield && HealthBelowPct(20))
            {
                DoCast(me, SPELL_MANA_SHIELD);
                ManaShield = true;
            }

            if (IsHeroic())
            {
                if (Slow_Timer <= diff)
                {
                    DoCast(me, H_SPELL_SLOW);
                    Slow_Timer = 15000 + rand32() % 25000;
                } else Slow_Timer -= diff;
            }

            if (Blink_Timer <= diff)
            {
                Talk(EMOTE_ARCANE_EXP);

                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                {
                    if (me->IsNonMeleeSpellCast(false))
                        me->InterruptNonMeleeSpells(false);

                    //Spell doesn't work, but we use for visual effect at least
                    DoCast(target, SPELL_BLINK);

                    float X = target->GetPositionX();
                    float Y = target->GetPositionY();
                    float Z = target->GetPositionZ();

                    DoTeleportTo(X, Y, Z);

                    DoCast(target, SPELL_BLINK_TELEPORT);
                    Blink = true;
                }
                Blink_Timer = 35000 + rand32() % 5000;
            } else Blink_Timer -= diff;

            if (!Blink)
                DoMeleeAttackIfReady();
        }
Пример #22
0
    void UpdateAI(const uint32 diff)
    {
        if (Phase == NORMAL)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (uiSinsterStrikeTimer <= diff)
            {
                DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_SINSTER_STRIKE, H_SPELL_SINSTER_STRIKE));
                uiSinsterStrikeTimer = urand(5000,9000);
            } else uiSinsterStrikeTimer -= diff;

            if (uiCallFlamesTimer <= diff)
            {
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                {
                    DoCast(pTarget, SPELL_CALL_FLAMES);
                    uiCallFlamesTimer = urand(8000,12000);
                }
            } else uiCallFlamesTimer -= diff;

            if (!bSacrificed)
                if (uiRitualOfSwordTimer <= diff)
                {
                    pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                    if (pSacrificeTarget)
                    {
                        DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1,SAY_SACRIFICE_PLAYER_2,SAY_SACRIFICE_PLAYER_3,SAY_SACRIFICE_PLAYER_4,SAY_SACRIFICE_PLAYER_5),m_creature);
                        DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD);
                        //Spell doesn't teleport
                        DoTeleportPlayer(pSacrificeTarget, 296.632, -346.075, 90.63, 4.6);
                        m_creature->SetUnitMovementFlags(MOVEMENTFLAG_FLY_MODE);
                        DoTeleportTo(296.632, -346.075, 120.85);
                        Phase = SACRIFICING;

                        for (uint8 i = 0; i < 3; ++i)
                            if (Creature* pRitualChanneler = m_creature->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 360000))
                                if (pRitualChanneler->AI())
                                    pRitualChanneler->AI()->SetGUID(pSacrificeTarget->GetGUID());

                        bSacrificed = true;
                    }
                } else uiRitualOfSwordTimer -= diff;

            DoMeleeAttackIfReady();
        }
        else  //SACRIFICING
        {
            if (uiSacrificeTimer <= diff)
            {
                if (!summons.empty() && pSacrificeTarget && pSacrificeTarget->isAlive())
                    m_creature->Kill(pSacrificeTarget, false); // durability damage?

                //go down
                Phase = NORMAL;
                pSacrificeTarget = NULL;
                m_creature->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    m_creature->GetMotionMaster()->MoveChase(pTarget);

                uiSacrificeTimer = 8000;
            }
            else uiSacrificeTimer -= diff;
        }
    }