Exemplo n.º 1
0
        void UpdateAI(uint32 diff)
        {
            if (!pInstance)
                return;

            events.Update(diff);

            switch(events.GetEvent())
            {
                case 0:
                    break;
                case EVENT_SUMMON_KEEPER_OR_GUARDIAN:
                    bKorG = true;
                    spawned = true;
                    if (Creature *c = DoSummon(RAND(NPC_PORTAL_GUARDIAN, NPC_PORTAL_KEEPER), me, 2.0f, 0, TEMPSUMMON_DEAD_DESPAWN))
                        me->CastSpell(c, SPELL_PORTAL_CHANNEL, false);
                    events.PopEvent();
                    events.RescheduleEvent(EVENT_SUMMON_KEEPER_TRASH, 20000);
                    break;
                case EVENT_SUMMON_KEEPER_TRASH:
                    for (uint8 i=0; i<3+addValue; ++i)
                    {
                        uint32 entry = RAND(NPC_AZURE_INVADER_1, NPC_AZURE_INVADER_2, NPC_AZURE_SPELLBREAKER_1, NPC_AZURE_SPELLBREAKER_2, NPC_AZURE_MAGE_SLAYER_1, NPC_AZURE_MAGE_SLAYER_2, NPC_AZURE_BINDER_1, NPC_AZURE_BINDER_2);
                        DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN);
                    }
                    events.RepeatEvent(20000);
                    break;
                case EVENT_SUMMON_ELITES:
                    spawned = true;
                    for (uint8 i=0; i<2+addValue; ++i)
                    {
                        uint32 entry = RAND(NPC_AZURE_CAPTAIN, NPC_AZURE_RAIDER, NPC_AZURE_STALKER, NPC_AZURE_SORCEROR);
                        DoSummon(entry, me, 2.0f, 20000, TEMPSUMMON_DEAD_DESPAWN);
                    }
                    me->SetVisible(false);
                    events.PopEvent();
                    break;
                case EVENT_SUMMON_SABOTEOUR:
                    DoSummon(NPC_SABOTEOUR, me, 2.0f, 0, TEMPSUMMON_CORPSE_DESPAWN);
                    me->DespawnOrUnsummon(3000);
                    events.PopEvent();
                    break;
            }

            if (!spawned)
                return;

            if (bKorG)
            {
                if (!me->IsNonMeleeSpellCast(false)) // keeper/guardian died => channeled spell interrupted
                {
                    // if keeper/guard lost all victims, in enterevademode linking aura is removed, restore it:
                    if (pInstance)
                        for (SummonList::iterator itr = listOfMobs.begin(); itr != listOfMobs.end(); ++itr)
                            if (Creature* c = pInstance->instance->GetCreature(*itr))
                                if (c->IsAlive() && (c->GetEntry() == NPC_PORTAL_GUARDIAN || c->GetEntry() == NPC_PORTAL_KEEPER))
                                {
                                    me->CastSpell(c, SPELL_PORTAL_CHANNEL, false);
                                    return;
                                }
                    Unit::Kill(me, me, false);
                }
            }
            else
            {
                if (listOfMobs.empty())
                    Unit::Kill(me, me, false);
            }
        }
Exemplo n.º 2
0
    void OozesMeetCheck()
    {
        if (summons.empty() || summons.size()==1)
            return;

        for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
        {
            Creature* ooze = ObjectAccessor::GetCreatureOrPetOrVehicle((*me), (*itr));
            if (!ooze || !ooze->isAlive())
                continue;
            if (ooze->GetEntry() != CREATURE_LITTLE_OOZE && ooze->GetEntry() != CREATURE_OOZE_BIG)
                continue;

            bool little = (ooze->GetEntry() == CREATURE_LITTLE_OOZE);

            for(SummonList::const_iterator itr2 = summons.begin(); itr2 != summons.end(); ++itr2)
            {
                Creature* ooze2 = ObjectAccessor::GetCreatureOrPetOrVehicle((*me), (*itr2));
                if (!ooze2 || !ooze2->isAlive())
                    continue;
                if (ooze2->GetEntry() != CREATURE_LITTLE_OOZE && ooze2->GetEntry() != CREATURE_OOZE_BIG)
                    continue;
                if (ooze2 == ooze)
                    continue;

                if (ooze->GetDistance2d(ooze2) > 5.0f)
                    continue;

                bool little2 = (ooze2->GetEntry() == CREATURE_LITTLE_OOZE);

                //if first ooze is big ooze
                if (!little)
                {
                    //and if second ooze is little
                    if (little2)
                    {
                        ooze->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);

                        if (ooze->GetAura(SPELL_UNSTABLE_OOZE) && ooze->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
                            ooze->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);

                        continue;
                    }
                    else //big ooze meet another big ooze, check wich one have more buff stack and despawn second one
                    {
                        uint8 stack1, stack2 = 0;
                        if (Aura* aura = ooze->GetAura(SPELL_UNSTABLE_OOZE))
                            stack1 = aura->GetStackAmount();
                        if (Aura* aura = ooze2->GetAura(SPELL_UNSTABLE_OOZE))
                            stack2 = aura->GetStackAmount();

                        if (stack1 < stack2)
                        {
                            ooze2->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);

                            if (ooze2->GetAura(SPELL_UNSTABLE_OOZE) && ooze2->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
                                ooze2->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);

                            break;
                        }
                        else
                        {
                            ooze->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);

                            if (ooze->GetAura(SPELL_UNSTABLE_OOZE) && ooze->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
                                ooze->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);
                            continue;
                        }
                    }
                }
                else  //if first ooze is little
                {
                    if (little2) //and second ooze is little, despawn both and summon big ooze
                    {
                        DoSummon(CREATURE_OOZE_BIG, (*ooze));
                        break;
                    }
                    else
                    {
                        ooze2->CastSpell(ooze, SPELL_UNSTABLE_OOZE, false);

                        if (ooze2->GetAura(SPELL_UNSTABLE_OOZE) && ooze2->GetAura(SPELL_UNSTABLE_OOZE)->GetStackAmount() >= 5)
                            ooze2->CastSpell(ooze2->getVictim(), SPELL_UNSTABLE_EXPLOSION, true);
                        break;
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
        void UpdateAI(const uint32 uiDiff)
        {
            if (!UpdateVictim())
                return;

            if (!bIsFrenzy && HealthBelowPct(25) && !bIsExploded)
            {
                DoScriptText(SAY_ENRAGE, me);
                DoCast(me, DUNGEON_MODE(SPELL_FRENZY,SPELL_FRENZY_H), true);
                bIsFrenzy = true;
            }

            if (!bIsFrenzy)
            {
                if (uiBubbleCheckerTimer <= uiDiff)
                {
                    if (!bIsExploded)
                    {
                        if (!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0))
                        {
                            DoScriptText(SAY_SHATTER, me);
                            DoCast(me, SPELL_DRAINED);
                            DoCast(me, SPELL_BURST, true);
                            bIsExploded = true;
                            me->AttackStop();
                            me->SetVisible(false);
                            for (uint8 i = 0; i < 10; i++)
                            {
                                int tmp = urand(0, MAX_SPAWN_LOC-1);
                                me->SummonCreature(NPC_ICHOR_GLOBULE, SpawnLoc[tmp], TEMPSUMMON_CORPSE_DESPAWN);
                            }
                        }
                    }
                    else
                    {
                        bool bIsWaterElementsAlive = false;
                        if (!m_waterElements.empty())
                        {
                            for (std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr)
                                if (Creature* pTemp = Unit::GetCreature(*me, *itr))
                                    if (pTemp->isAlive())
                                    {
                                        bIsWaterElementsAlive = true;
                                        break;
                                    }
                        }

                        if (!bIsWaterElementsAlive)
                            DoExplodeCompleted();
                    }
                    uiBubbleCheckerTimer = 1000;
                }
                else uiBubbleCheckerTimer -= uiDiff;
            }

            if (!bIsExploded)
            {
                if (uiWaterBoltVolleyTimer <= uiDiff)
                {
                    if(!me->IsNonMeleeSpellCasted(false))
                    {
                        DoCast(me, DUNGEON_MODE(SPELL_WATER_BOLT_VOLLEY,SPELL_WATER_BOLT_VOLLEY_H));
                        uiWaterBoltVolleyTimer = urand(10000, 15000);
                    }
                }
                else uiWaterBoltVolleyTimer -= uiDiff;

                if (uiWaterBlastTimer <= uiDiff)
                {
                    if(!me->IsNonMeleeSpellCasted(false))
                    {
                        DoCast(me->getVictim(), DUNGEON_MODE(SPELL_WATER_BLAST,SPELL_WATER_BLAST_H));
                        uiWaterBlastTimer = urand(10000, 15000);
                    }
                }
                else uiWaterBlastTimer -= uiDiff;

                DoMeleeAttackIfReady();
            }
        }
Exemplo n.º 4
0
			void UpdateAI(uint32 diff)
			{
				events2.Update(diff);
				switch (events2.ExecuteEvent())
				{
					case EVENT_AKAMA_START_ENCOUNTER:
						me->RemoveAura(SPELL_STEALTH);
						me->SetWalk(true);
						me->GetMotionMaster()->MovePoint(POINT_START, 517.4877f, 400.7993f, 112.7837f, false);
						events2.ScheduleEvent(EVENT_AKAMA_START_CHANNEL, 11000);
						break;
					case EVENT_AKAMA_START_CHANNEL:
						me->CastSpell(me, SPELL_AKAMA_SOUL_CHANNEL, false);
						if (Creature* shade = ObjectAccessor::GetCreature(*me, instance->GetData64(NPC_SHADE_OF_AKAMA)))
						{
							shade->AI()->AttackStart(me);
							shade->GetMotionMaster()->Clear();
							shade->AI()->DoAction(ACTION_START_ENCOUNTER);
						}
						break;
					case EVENT_AKAMA_SCENE0:
						me->SetWalk(true);
						me->GetMotionMaster()->MovePoint(POINT_CHANNEL_SOUL, 467.0f, 400.7993f, 118.537f);
						break;
					case EVENT_AKAMA_SCENE1:
						me->CastSpell(me, SPELL_AKAMA_SOUL_RETRIEVE, true);
						break;
					case EVENT_AKAMA_SCENE2:
						Talk(SAY_BROKEN_FREE_0);
						break;
					case EVENT_AKAMA_SCENE3:
						me->SummonCreatureGroup(SUMMON_GROUP_BROKENS);
						break;
					case EVENT_AKAMA_SCENE4:
						Talk(SAY_BROKEN_FREE_1);
						break;
					case EVENT_AKAMA_SCENE5:
						for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
							if (Creature* broken = ObjectAccessor::GetCreature(*me, *itr))
								broken->SetStandState(UNIT_STAND_STATE_KNEEL);
						Talk(SAY_BROKEN_FREE_2);
						break;
					case EVENT_AKAMA_SCENE6:
						if (Creature* broken = summons.GetCreatureWithEntry(NPC_ASHTONGUE_BROKEN))
							broken->AI()->Talk(SAY_BROKEN_S1);
						break;
					case EVENT_AKAMA_SCENE7:
						for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
							if (Creature* broken = ObjectAccessor::GetCreature(*me, *itr))
								broken->AI()->Talk(SAY_BROKEN_S2);
						break;
				}

				if (!UpdateVictim())
					return;

				events.Update(diff);
				if (me->HasUnitState(UNIT_STATE_CASTING))
					return;

				switch (events.ExecuteEvent())
				{
					case EVENT_SPELL_CHAIN_LIGHTNING:
						me->CastSpell(me->GetVictim(), SPELL_CHAIN_LIGHTNING, false);
						events.ScheduleEvent(EVENT_SPELL_CHAIN_LIGHTNING, urand(10000, 15000));
						break;
					case EVENT_SPELL_DESTRUCTIVE_POISON:
						me->CastSpell(me, SPELL_DESTRUCTIVE_POISON, false);
						events.ScheduleEvent(EVENT_SPELL_DESTRUCTIVE_POISON, urand(4000, 5000));
						break;
				}

				DoMeleeAttackIfReady();
			}