Exemplo n.º 1
0
            void UpdateAI(const uint32 diff)
            {
                if (!SpeakerDead)
                {
                    if (!me->FindNearestCreature(NPC_SPEAKER, 100.0f, true))
                    {
                        me->GetMotionMaster()->MovePoint(0, -12196.3f, -1948.37f, 130.36f);
                        SpeakerDead = true;
                    }
                }

                if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && SpeakerDead)
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);

                if (!UpdateVictim())
                    return;

                if (me->getVictim() && me->isAlive())
                {
                    if (!CombatStart)
                    {
                        //At combat Start Mandokir is mounted so we must unmount it first
                        me->Dismount();

                        //And summon his raptor
                        me->SummonCreature(14988, me->getVictim()->GetPositionX(), me->getVictim()->GetPositionY(), me->getVictim()->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 35000);
                        CombatStart = true;
                    }

                    if (Watch_Timer <= diff)                         //Every 20 Sec Mandokir will check this
                    {
                        if (WatchTarget)                             //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him
                        {
                            Unit* unit = Unit::GetUnit(*me, WatchTarget);

                            if (unit && (
                                targetX != unit->GetPositionX() ||
                                targetY != unit->GetPositionY() ||
                                targetZ != unit->GetPositionZ() ||
                                unit->isInCombat()))
                            {
                                if (me->IsWithinMeleeRange(unit))
                                {
                                    DoCast(unit, 24316);
                                }
                                else
                                {
                                    DoCast(unit, SPELL_CHARGE);
                                    //me->SendMonsterMove(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0, true, 1);
                                    AttackStart(unit);
                                }
                            }
                        }
                        someWatched = false;
                        Watch_Timer = 20000;
                    } else Watch_Timer -= diff;

                    if ((Watch_Timer < 8000) && !someWatched)       //8 sec(cast time + expire time) before the check for the watch effect mandokir will cast watch debuff on a random target
                    {
                        if (Unit* p = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            Talk(SAY_WATCH, p->GetGUID());
                            DoCast(p, SPELL_WATCH);
                            WatchTarget = p->GetGUID();
                            someWatched = true;
                            endWatch = true;
                        }
                    }

                    if ((Watch_Timer < 1000) && endWatch)           //1 sec before the debuf expire, store the target position
                    {
                        Unit* unit = Unit::GetUnit(*me, WatchTarget);
                        if (unit)
                        {
                            targetX = unit->GetPositionX();
                            targetY = unit->GetPositionY();
                            targetZ = unit->GetPositionZ();
                        }
                        endWatch = false;
                    }

                    if (!someWatched)
                    {
                        //Cleave
                        if (Cleave_Timer <= diff)
                        {
                            DoCast(me->getVictim(), SPELL_CLEAVE);
                            Cleave_Timer = 7000;
                        } else Cleave_Timer -= diff;

                        //Whirlwind
                        if (Whirlwind_Timer <= diff)
                        {
                            DoCast(me, SPELL_WHIRLWIND);
                            Whirlwind_Timer = 18000;
                        } else Whirlwind_Timer -= diff;

                        //If more then 3 targets in melee range mandokir will cast fear
                        if (Fear_Timer <= diff)
                        {
                            TargetInRange = 0;

                            std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
                            for (; i != me->getThreatManager().getThreatList().end(); ++i)
                            {
                                Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
                                if (unit && me->IsWithinMeleeRange(unit))
                                    ++TargetInRange;
                            }

                            if (TargetInRange > 3)
                                DoCast(me->getVictim(), SPELL_FEAR);

                            Fear_Timer = 4000;
                        } else Fear_Timer -=diff;

                        //Mortal Strike if target below 50% hp
                        if (me->getVictim() && me->getVictim()->HealthBelowPct(50))
                        {
                            if (MortalStrike_Timer <= diff)
                            {
                                DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
                                MortalStrike_Timer = 15000;
                            } else MortalStrike_Timer -= diff;
                        }
                    }
                    //Checking if Ohgan is dead. If yes Mandokir will enrage.
                    if (Check_Timer <= diff)
                    {
                        if (instance)
                        {
                            if (instance->GetData(DATA_OHGAN) == DONE)
                            {
                                if (!RaptorDead)
                                {
                                    DoCast(me, SPELL_ENRAGE);
                                    RaptorDead = true;
                                }
                            }
                        }

                        Check_Timer = 1000;
                    } else Check_Timer -= diff;

                    DoMeleeAttackIfReady();
                }
            }
Exemplo n.º 2
0
        void UpdateAI(const uint32 diff)
        {
            if(!UpdateVictim())
                return;

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

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

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

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

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

                DoScriptText(SAY_DRINK, me);

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

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

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

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

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

                    uint32 Spells[3];
                    uint8 AvailableSpells = 0;

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

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

            if(SecondarySpellTimer <= diff)
            {
                switch(urand(0, 1))
                {
                    case 0:
                        DoCast(me, SPELL_AOE_CS);
                        break;
                    case 1:
                        if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            DoCast(target, SPELL_CHAINSOFICE);
                        break;
                }
                SecondarySpellTimer = urand(5000, 20000);
            } else SecondarySpellTimer -= diff;

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

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

                LastSuperSpell = Available[urand(0, 1)];

                switch(LastSuperSpell)
                {
                    case SUPER_AE:
                        DoScriptText(RAND(SAY_EXPLOSION1, SAY_EXPLOSION2), me);

                        DoCast(me, SPELL_BLINK_CENTER, true);
                        DoCast(me, SPELL_PLAYERPULL, true);
                        DoCast(me, SPELL_MASSSLOW, true);
                        DoCast(me, SPELL_AEXPLOSION, false);
                        break;
                    case SUPER_FLAME:
                        DoScriptText(RAND(SAY_FLAMEWREATH1, SAY_FLAMEWREATH2), me);

                        FlameWreathTimer = 20000;
                        FlameWreathCheckTime = 500;

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

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

                        if(Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000))
                        {
                            pSpawn->setFaction(me->getFaction());
                            pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false);
                        }
                        break;
                }

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

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

                for(uint32 i = 0; i < 4; ++i)
                {
                    if(Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
                    {
                        pUnit->Attack(me->getVictim(), true);
                        pUnit->setFaction(me->getFaction());
                    }
                }

                DoScriptText(SAY_ELEMENTALS, me);
            }

            if(BerserkTimer <= diff)
            {
                for(uint32 i = 0; i < 5; ++i)
                {
                    if(Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
                    {
                        pUnit->Attack(me->getVictim(), true);
                        pUnit->setFaction(me->getFaction());
                    }
                }

                DoScriptText(SAY_TIMEOVER, me);

                BerserkTimer = 60000;
            } else BerserkTimer -= diff;

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

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

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

            if(ArcaneCooldown && FireCooldown && FrostCooldown)
                DoMeleeAttackIfReady();
        }
Exemplo n.º 3
0
        void UpdateAI(const uint32 diff)
        {
            //Check if we have a target
            if (!UpdateVictim())
                return;

            //No instance
            if (!instance)
                return;

            uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE);
            if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM)
            {
                // EyeTentacleTimer
                if (EyeTentacleTimer <= diff)
                {
                    //Spawn the 8 Eye Tentacles in the corret spots
                    SpawnEyeTentacle(0, 20);                //south
                    SpawnEyeTentacle(10, 10);               //south west
                    SpawnEyeTentacle(20, 0);                //west
                    SpawnEyeTentacle(10, -10);              //north west

                    SpawnEyeTentacle(0, -20);               //north
                    SpawnEyeTentacle(-10, -10);             //north east
                    SpawnEyeTentacle(-20, 0);               // east
                    SpawnEyeTentacle(-10, 10);              // south east

                    EyeTentacleTimer = 45000;
                } else EyeTentacleTimer -= diff;
            }

            switch (currentPhase)
            {
                case PHASE_EYE_GREEN_BEAM:
                    //BeamTimer
                    if (BeamTimer <= diff)
                    {
                        //SPELL_GREEN_BEAM
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            me->InterruptNonMeleeSpells(false);
                            DoCast(target, SPELL_GREEN_BEAM);

                            //Correctly update our target
                            me->SetTarget(target->GetGUID());
                        }

                        //Beam every 3 seconds
                        BeamTimer = 3000;
                    } else BeamTimer -= diff;

                    //ClawTentacleTimer
                    if (ClawTentacleTimer <= diff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            Creature* Spawned = NULL;

                            //Spawn claw tentacle on the random target
                            Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500);

                            if (Spawned && Spawned->AI())
                                Spawned->AI()->AttackStart(target);
                        }

                        //One claw tentacle every 12.5 seconds
                        ClawTentacleTimer = 12500;
                    } else ClawTentacleTimer -= diff;

                    //PhaseTimer
                    if (PhaseTimer <= diff)
                    {
                        //Switch to Dark Beam
                        instance->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM);

                        me->InterruptNonMeleeSpells(false);
                        me->SetReactState(REACT_PASSIVE);

                        //Remove any target
                        me->SetTarget(0);

                        //Select random target for dark beam to start on
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            //Face our target
                            DarkGlareAngle = me->GetAngle(target);
                            DarkGlareTickTimer = 1000;
                            DarkGlareTick = 0;
                            ClockWise = RAND(true, false);
                        }

                        //Add red coloration to C'thun
                        DoCast(me, SPELL_RED_COLORATION, true);

                        //Freeze animation
                        DoCast(me, SPELL_FREEZE_ANIM);
                        me->SetOrientation(DarkGlareAngle);
                        me->StopMoving();
                        me->GetMotionMaster()->MoveRotate(35000, ClockWise ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);

                        //Darkbeam for 35 seconds
                        PhaseTimer = 35000;
                    } else PhaseTimer -= diff;

                    break;

                case PHASE_EYE_RED_BEAM:
                    if (DarkGlareTick < 35)
                    {
                        if (DarkGlareTickTimer <= diff)
                        {
                            //Set angle and cast
                            //if (ClockWise)
                            //    me->SetOrientation(DarkGlareAngle + DarkGlareTick * M_PI / 35);
                            //else
                            //    me->SetOrientation(DarkGlareAngle - DarkGlareTick * M_PI / 35);

                            //me->StopMoving();

                            //Actual dark glare cast, maybe something missing here?
                            DoCast(me, SPELL_DARK_GLARE, false);

                            //Increase tick
                            ++DarkGlareTick;

                            //1 second per tick
                            DarkGlareTickTimer = 1000;
                        } else DarkGlareTickTimer -= diff;
                    }

                    //PhaseTimer
                    if (PhaseTimer <= diff)
                    {
                        //Switch to Eye Beam
                        instance->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM);

                        BeamTimer = 3000;
                        ClawTentacleTimer = 12500;              //4 per Eye beam phase (unsure if they spawn during Dark beam)

                        me->InterruptNonMeleeSpells(false);

                        //Remove Red coloration from c'thun
                        me->RemoveAurasDueToSpell(SPELL_RED_COLORATION);
                        me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM);

                        //set it back to aggressive
                        me->SetReactState(REACT_AGGRESSIVE);

                        //Eye Beam for 50 seconds
                        PhaseTimer = 50000;
                    } else PhaseTimer -= diff;

                    break;

                //Transition phase
                case PHASE_CTHUN_TRANSITION:
                    //Remove any target
                    me->SetTarget(0);
                    me->SetHealth(0);
                    me->SetVisible(false);
                    break;

                //Dead phase
                case PHASE_CTHUN_DONE:
                    Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10);
                    if (pPortal)
                        pPortal->DespawnOrUnsummon();

                    me->DespawnOrUnsummon();
                    break;
            }
        }
        void UpdateAI(uint32 uiDiff) override
        {
            if (!UpdateVictim())
                return;

            //START NOT TRANSFORMED
            if (!m_bTransformed)
            {
                //MindBlast
                if (m_uiMindBlast_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_MINDBLAST);
                    m_uiMindBlast_Timer = urand(15000, 20000);
                } else m_uiMindBlast_Timer -= uiDiff;

                //CrusadersHammer
                if (m_uiCrusadersHammer_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_CRUSADERSHAMMER);
                    m_uiCrusadersHammer_Timer = 12000;
                } else m_uiCrusadersHammer_Timer -= uiDiff;

                //CrusaderStrike
                if (m_uiCrusaderStrike_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_CRUSADERSTRIKE);
                    m_uiCrusaderStrike_Timer = 15000;
                } else m_uiCrusaderStrike_Timer -= uiDiff;

                //HolyStrike
                if (m_uiHolyStrike_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_HOLYSTRIKE);
                    m_uiHolyStrike_Timer = 15000;
                } else m_uiHolyStrike_Timer -= uiDiff;

                //BalnazzarTransform
                if (HealthBelowPct(40))
                {
                    if (me->IsNonMeleeSpellCast(false))
                        me->InterruptNonMeleeSpells(false);

                    //restore hp, mana and stun
                    DoCast(me, SPELL_BALNAZZARTRANSFORM);
                    me->UpdateEntry(NPC_BALNAZZAR);
                    m_bTransformed = true;
                }
            }
            else
            {
                //MindBlast
                if (m_uiMindBlast_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_MINDBLAST);
                    m_uiMindBlast_Timer = urand(15000, 20000);
                } else m_uiMindBlast_Timer -= uiDiff;

                //ShadowShock
                if (m_uiShadowShock_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_SHADOWSHOCK);
                    m_uiShadowShock_Timer = 11000;
                } else m_uiShadowShock_Timer -= uiDiff;

                //PsychicScream
                if (m_uiPsychicScream_Timer <= uiDiff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        DoCast(target, SPELL_PSYCHICSCREAM);

                    m_uiPsychicScream_Timer = 20000;
                } else m_uiPsychicScream_Timer -= uiDiff;

                //DeepSleep
                if (m_uiDeepSleep_Timer <= uiDiff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        DoCast(target, SPELL_SLEEP);

                    m_uiDeepSleep_Timer = 15000;
                } else m_uiDeepSleep_Timer -= uiDiff;

                //MindControl
                if (m_uiMindControl_Timer <= uiDiff)
                {
                    DoCastVictim(SPELL_MINDCONTROL);
                    m_uiMindControl_Timer = 15000;
                } else m_uiMindControl_Timer -= uiDiff;
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 5
0
            void UpdateAI(const uint32 diff)
            {
                if (instance && instance->GetBossState(BOSS_MAJORDOMO_EXECUTUS) != DONE)
                {
                    if (!UpdateVictim())
                        return;

                    events.Update(diff);

                    if (!me->FindNearestCreature(NPC_FLAMEWAKER_HEALER, 100.0f) && !me->FindNearestCreature(NPC_FLAMEWAKER_ELITE, 100.0f))
                    {
                        instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, me->GetEntry(), me);
                        me->setFaction(35);
                        me->AI()->EnterEvadeMode();
                        DoScriptText(SAY_DEFEAT, me);
                        _JustDied();
                        events.ScheduleEvent(EVENT_OUTRO_1, 32000);
                        return;
                    }

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

                    if (HealthBelowPct(50))
                        DoCast(me, SPELL_AEGIS_OF_RAGNAROS, true);

                    while (uint32 eventId = events.ExecuteEvent())
                    {
                        switch (eventId)
                        {
                            case EVENT_MAGIC_REFLECTION:
                                DoCast(me, SPELL_MAGIC_REFLECTION);
                                events.ScheduleEvent(EVENT_MAGIC_REFLECTION, 30000);
                                break;
                            case EVENT_DAMAGE_REFLECTION:
                                DoCast(me, SPELL_DAMAGE_REFLECTION);
                                events.ScheduleEvent(EVENT_DAMAGE_REFLECTION, 30000);
                                break;
                            case EVENT_BLAST_WAVE:
                                DoCastVictim(SPELL_BLAST_WAVE);
                                events.ScheduleEvent(EVENT_BLAST_WAVE, 10000);
                                break;
                            case EVENT_TELEPORT:
                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1))
                                    DoCast(target, SPELL_TELEPORT);
                                events.ScheduleEvent(EVENT_TELEPORT, 20000);
                                break;
                            default:
                                break;
                        }
                    }

                    DoMeleeAttackIfReady();
                }
                else
                {
                    events.Update(diff);

                    while (uint32 eventId = events.ExecuteEvent())
                    {
                        switch (eventId)
                        {
                            case EVENT_OUTRO_1:
                                me->NearTeleportTo(RagnarosTelePos.GetPositionX(), RagnarosTelePos.GetPositionY(), RagnarosTelePos.GetPositionZ(), RagnarosTelePos.GetOrientation());
                                me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                                break;
                            case EVENT_OUTRO_2:
                                if (instance)
                                    instance->instance->SummonCreature(NPC_RAGNAROS, RagnarosSummonPos);
                                break;
                            case EVENT_OUTRO_3:
                                DoScriptText(SAY_ARRIVAL2_MAJ, me);
                                break;
                            default:
                                break;
                        }
                    }
                }
            }
Exemplo n.º 6
0
        void UpdateAI(uint32 const diff)
        {
            if(!UpdateVictim() || !CheckInRoom())
                return;

            events.Update(diff);

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

            while(uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                case EVENT_INHALE_BLIGHT:
                {
                    RemoveBlight();
                    if(_inhaleCounter == 3)
                    {
                        Talk(EMOTE_WARN_PUNGENT_BLIGHT);
                        Talk(SAY_PUNGENT_BLIGHT);
                        DoCast(me, SPELL_PUNGENT_BLIGHT);
                        _inhaleCounter = 0;
                        if(Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))
                            professor->AI()->DoAction(ACTION_FESTERGUT_GAS);
                        events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000));
                    }
                    else
                    {
                        DoCast(me, SPELL_INHALE_BLIGHT);
                        // just cast and dont bother with target, conditions will handle it
                        ++_inhaleCounter;
                        if(_inhaleCounter < 3)
                            me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID());
                    }

                    events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(33500, 35000));
                    break;
                }
                case EVENT_VILE_GAS:
                {
                    std::list<Unit*> targets;
                    uint32 minTargets = RAID_MODE<uint32>(3, 8, 3, 8);
                    SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -10.0f, true);
                    float minDist = 0.0f;
                    if(targets.size() >= minTargets)
                        minDist = -15.0f;

                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true))
                        DoCast(target, SPELL_VILE_GAS);
                    events.ScheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));
                    break;
                }
                case EVENT_GAS_SPORE:
                    Talk(EMOTE_WARN_GAS_SPORE);
                    Talk(EMOTE_GAS_SPORE);
                    me->CastCustomSpell(SPELL_GAS_SPORE, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 3, 2, 3), me);
                    events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000));
                    events.RescheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));
                    break;
                case EVENT_GASTRIC_BLOAT:
                    DoCastVictim(SPELL_GASTRIC_BLOAT);
                    events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(15000, 17500));
                    break;
                case EVENT_BERSERK:
                    DoCast(me, SPELL_BERSERK2);
                    Talk(SAY_BERSERK);
                    break;
                default:
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 7
0
            void UpdateAI(const uint32 diff)
            {
                  if (!UpdateVictim())
                    return;

                    if (HealthAbovePct(50))
                    {
                        if (Dispell_Timer <= diff)
                        {
                            DoCast(me, SPELL_DISPELL);
                            Dispell_Timer = 15000 + rand()%15000;
                        } else Dispell_Timer -= diff;

                        if (Renew_Timer <= diff)
                        {
                            DoCast(me, SPELL_RENEW);
                            Renew_Timer = 20000 + rand()%10000;
                        } else Renew_Timer -= diff;

                        if (HolyWrath_Timer <= diff)
                        {
                            DoCast(me->getVictim(), SPELL_HOLY_WRATH);
                            HolyWrath_Timer = 15000 + rand()%10000;
                        } else HolyWrath_Timer -= diff;

                        if (HolyNova_Timer <= diff)
                        {
                            TargetInRange = 0;
                            for (uint8 i = 0; i < 10; ++i)
                            {
                                if (Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, i))
                                    if (me->IsWithinMeleeRange(pTarget))
                                        ++TargetInRange;
                            }

                            if (TargetInRange > 1)
                            {
                                DoCast(me->getVictim(), SPELL_HOLY_NOVA);
                                HolyNova_Timer = 1000;
                            }
                            else
                            {
                                HolyNova_Timer = 2000;
                            }
                        } else HolyNova_Timer -= diff;

                        if (HolyFire_Timer < diff && TargetInRange < 3)
                        {
                            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                                DoCast(pTarget, SPELL_HOLY_FIRE);

                            HolyFire_Timer = 8000;
                        } else HolyFire_Timer -= diff;
                    }
                    else
                    {
                        if (!PhaseTwo)
                        {
                            DoScriptText(SAY_TRANSFORM, me);
                            me->InterruptNonMeleeSpells(false);
                            DoCast(me, SPELL_SNAKE_FORM);
                            me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
                            const CreatureInfo *cinfo = me->GetCreatureInfo();
                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25)));
                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25)));
                            me->UpdateDamagePhysical(BASE_ATTACK);
                            DoResetThreat();
                            PhaseTwo = true;
                        }

                        if (PhaseTwo && PoisonCloud_Timer <= diff)
                        {
                            DoCast(me->getVictim(), SPELL_POISON_CLOUD);
                            PoisonCloud_Timer = 15000;
                        }PoisonCloud_Timer -=diff;

                        if (PhaseTwo && VenomSpit_Timer <= diff)
                        {
                            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                                DoCast(pTarget, SPELL_VENOMSPIT);

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

                        if (PhaseTwo && HealthBelowPct(11))
                        {
                            if (!InBerserk)
                            {
                                me->InterruptNonMeleeSpells(false);
                                DoCast(me, SPELL_BERSERK);
                                InBerserk = true;
                            }
                        }
                    }
                    DoMeleeAttackIfReady();
            }
Exemplo n.º 8
0
        void UpdateAI(const uint32 diff)
        {
            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)
            {
                //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(me->getVictim(), SPELL_SHOCK_BLAST);
                    me->TauntApply(me->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 Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.
                    Unit *pTarget = NULL;
                    pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);

                    if (pTarget && !pTarget->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
                                                                //cast Static Charge every 2 seconds for 20 seconds
                            DoCast(pTarget, 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(me->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 (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);

                        Creature *pCreature;
                        for (uint8 i = 0; i < 4; ++i)
                        {
                            pCreature = me->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, me);
                    }
                }
                //Phase 3
                else
                {
                    //SummonSporebat_Timer
                    if (SummonSporebat_Timer <= diff)
                    {
                        Creature *Sporebat = NULL;
                        Sporebat = me->SummonCreature(TOXIC_SPOREBAT, SPOREBAT_X, SPOREBAT_Y, SPOREBAT_Z, SPOREBAT_O, TEMPSUMMON_CORPSE_DESPAWN, 0);

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

                        //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 *pTarget;
                    std::list<HostileReference *> t_list = me->getThreatManager().getThreatList();
                    for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
                    {
                        pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
                                                                //if in melee range
                        if (pTarget && pTarget->IsWithinDistInMap(me, 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 *pTarget = NULL;
                    pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);

                    if (!pTarget)
                        pTarget = me->getVictim();

                    DoCast(pTarget, SPELL_FORKED_LIGHTNING);

                    ForkedLightning_Timer = 2000+rand()%6000;   //blizzlike
                } else ForkedLightning_Timer -= diff;

                //EnchantedElemental_Timer
                if (EnchantedElemental_Timer <= diff)
                {
                    me->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)
                {
                    uint32 pos = rand()%8;
                    me->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 = 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)
                    {
                        Unit *pTarget = NULL;
                        pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                        if (pTarget)
                            CoilfangElite->AI()->AttackStart(pTarget);
                        else if (me->getVictim())
                            CoilfangElite->AI()->AttackStart(me->getVictim());
                    }
                    CoilfangElite_Timer = 45000+rand()%5000;
                } else CoilfangElite_Timer -= diff;

                //CoilfangStrider_Timer
                if (CoilfangStrider_Timer <= diff)
                {
                    uint32 pos = rand()%3;
                    Creature* CoilfangStrider = NULL;
                    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 (CoilfangStrider)
                    {
                        Unit *pTarget = NULL;
                        pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                        if (pTarget)
                            CoilfangStrider->AI()->AttackStart(pTarget);
                        else if (me->getVictim())
                            CoilfangStrider->AI()->AttackStart(me->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%
                        me->SetHealth(me->CountPctFromMaxHealth(50));

                        me->RemoveAurasDueToSpell(SPELL_MAGIC_BARRIER);

                        DoScriptText(SAY_PHASE3, me);

                        Phase = 3;

                        //return to the tank
                        me->GetMotionMaster()->MoveChase(me->getVictim());
                    }
                    Check_Timer = 1000;
                } else Check_Timer -= diff;
            }
        }
    void UpdateAI(const uint32 diff)
    {
        if (IsNihil)
        {
            if (NihilSpeech_Phase)
            {
                if (NihilSpeech_Timer <= diff)
                {
                    switch(NihilSpeech_Phase)
                    {
                        case 1:
                            DoScriptText(SAY_NIHIL_1, me);
                            ++NihilSpeech_Phase;
                            break;
                        case 2:
                            DoScriptText(SAY_NIHIL_2, me);
                            ++NihilSpeech_Phase;
                            break;
                        case 3:
                            DoScriptText(SAY_NIHIL_3, me);
                            ++NihilSpeech_Phase;
                            break;
                        case 4:
                            DoScriptText(SAY_NIHIL_4, me);
                            ++NihilSpeech_Phase;
                            break;
                        case 5:
                            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                                            // + MOVEFLAG_LEVITATING
                            me->AddUnitMovementFlag(MOVEFLAG_ONTRANSPORT);
                            //then take off to random location. creature is initially summoned, so don't bother do anything else.
                            me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+100, me->GetPositionY(), me->GetPositionZ()+100);
                            NihilSpeech_Phase = 0;
                            break;
                    }
                    NihilSpeech_Timer = 5000;
                } else NihilSpeech_Timer -=diff;
            }
            return;                                         //anything below here is not interesting for Nihil, so skip it
        }

        if (!UpdateVictim())
            return;

        if (IntangiblePresence_Timer <= diff)
        {
            DoCast(me->getVictim(),SPELL_INTANGIBLE_PRESENCE);
            IntangiblePresence_Timer = 15000+rand()%15000;
        } else IntangiblePresence_Timer -= diff;

        if (ManaBurn_Timer <= diff)
        {
            Unit* pTarget = me->getVictim();
            if (pTarget && pTarget->getPowerType() == POWER_MANA)
                DoCast(pTarget,SPELL_MANA_BURN);
            ManaBurn_Timer = 8000+rand()%8000;
        } else ManaBurn_Timer -= diff;

        if (ArcaneBlast_Timer <= diff)
        {
            DoCast(me->getVictim(),SPELL_ARCANE_BLAST);
            ArcaneBlast_Timer = 2500+rand()%5000;
        } else ArcaneBlast_Timer -= diff;

        DoMeleeAttackIfReady();
    }
 // Override Evade Mode event, recast buff that was removed by standard handler
 void EnterEvadeMode() override
 {
     npc_escortAI::EnterEvadeMode();
     DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
 }
        void UpdateAI(uint32 diff) override
        {
            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_BARADAS_TALK:
                        switch (step)
                        {
                            case 0:
                                me->SetFacingTo(1.513286f);

                                me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 3000);
                                step++;
                                break;
                            case 1:
                                DoCast(SPELL_BARADAS_COMMAND);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);
                                step++;
                                break;
                            case 2:
                                Talk(SAY_BARADA_3);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 7000);
                                step++;
                                break;
                            case 3:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_2);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 18000);
                                step++;
                                break;
                            case 4:
                                DoCast(SPELL_BARADA_FALTERS);
                                me->HandleEmoteCommand(EMOTE_STAND_STATE_NONE);

                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->DoAction(ACTION_JULES_HOVER);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 11000);
                                step++;
                                break;
                            case 5:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_3);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 13000);
                                step++;
                                break;
                            case 6:
                                Talk(SAY_BARADA_4);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);
                                step++;
                                break;
                            case 7:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_3);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 13000);
                                step++;
                                break;
                            case 8:
                                Talk(SAY_BARADA_4);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 12000);
                                step++;
                                break;
                            case 9:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_4);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 12000);
                                step++;
                                break;
                            case 10:
                                Talk(SAY_BARADA_4);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);
                                step++;
                                break;
                            case 11:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->DoAction(ACTION_JULES_FLIGHT);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 12:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_4);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 8000);
                                step++;
                                break;
                            case 13:
                                Talk(SAY_BARADA_5);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 14:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_4);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 15:
                                Talk(SAY_BARADA_6);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 16:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_5);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 17:
                                Talk(SAY_BARADA_7);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 18:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->AI()->Talk(SAY_JULES_3);

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 19:
                                Talk(SAY_BARADA_7);
                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 20:
                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                {
                                    jules->AI()->DoAction(ACTION_JULES_MOVE_HOME);
                                    jules->RemoveAura(SPELL_JULES_VOMITS_AURA);
                                }

                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);
                                step++;
                                break;
                            case 21:
                                //End
                                if (Player* player = ObjectAccessor::FindPlayer(playerGUID))
                                    player->KilledMonsterCredit(NPC_COLONEL_JULES, ObjectGuid::Empty);

                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))
                                    jules->RemoveAllAuras();

                                me->RemoveAura(SPELL_BARADAS_COMMAND);
                                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);

                                Talk(SAY_BARADA_8);
                                me->GetMotionMaster()->MoveTargetedHome();
                                EnterEvadeMode();
                                break;
                        }
                        break;
                }
            }
        }
        void UpdateAI(const uint32 diff)
        {
            if (ghost)
            {
                if (instance && instance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS)
                    me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
            }

            if (!UpdateVictim())
                return;

            if (AggroYell_Timer)
            {
                if (AggroYell_Timer <= diff)
                {
                    DoScriptText(YELL_DALRONN_AGGRO, me);

                    AggroYell_Timer = 0;
                } else AggroYell_Timer -= diff;
            }

            if (!ghost)
            {
                if (Check_Timer)
                {
                    if (Check_Timer <= diff)
                    {
                        Check_Timer = 5000;
                        Unit* skarvald = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_SKARVALD) : 0);
                        if (skarvald && skarvald->isDead())
                        {
                            Skarvald_isDead = true;
                            Response_Timer = 2000;
                            Check_Timer = 0;
                        }
                    } else Check_Timer -= diff;
                }

                if (Response_Timer && Skarvald_isDead)
                {
                    if (Response_Timer <= diff)
                    {
                        DoScriptText(YELL_DALRONN_SKA_DIEDFIRST, me);
                        Response_Timer = 0;
                    } else Response_Timer -= diff;
                }
            }

            if (ShadowBolt_Timer <= diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT);
                    ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells
                }
            } else ShadowBolt_Timer -= diff;

            if (Debilitate_Timer <= diff)
            {
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE);
                    Debilitate_Timer = 5000+rand()%5000;
                }
            } else Debilitate_Timer -= diff;

            if (IsHeroic())
            {
                if (Summon_Timer <= diff)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                    {
                        DoCast(me, H_SPELL_SUMMON_SKELETONS);
                        Summon_Timer = (rand()%10000) + 20000;
                    }
                } else Summon_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 13
0
        void UpdateAI(const uint32 uiDiff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (bEventInProgress)
            {
                if (uiResurrectTimer <= uiDiff)
                {
                    me->SetFullHealth();
                    DoCast(me, SPELL_BLACK_KNIGHT_RES, true);
                    uiPhase++;
                    uiResurrectTimer = 4000;
                    bEventInProgress = false;
                    me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
                } else uiResurrectTimer -= uiDiff;
            }

            switch (uiPhase)
            {
            case PHASE_UNDEAD:
            case PHASE_SKELETON:
            {
                if (uiIcyTouchTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_ICY_TOUCH);
                    uiIcyTouchTimer = urand(5000, 7000);
                } else uiIcyTouchTimer -= uiDiff;
                if (uiPlagueStrikeTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_ICY_TOUCH);
                    uiPlagueStrikeTimer = urand(12000, 15000);
                } else uiPlagueStrikeTimer -= uiDiff;
                if (uiObliterateTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_OBLITERATE);
                    uiObliterateTimer = urand(17000, 19000);
                } else uiObliterateTimer -= uiDiff;
                switch (uiPhase)
                {
                case PHASE_UNDEAD:
                {
                    if (uiDeathRespiteTimer <= uiDiff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        {
                            if (target && target->isAlive())
                                DoCast(target, SPELL_DEATH_RESPITE);
                        }
                        uiDeathRespiteTimer = urand(15000, 16000);
                    } else uiDeathRespiteTimer -= uiDiff;
                    break;
                }
                case PHASE_SKELETON:
                {
                    if (!bSummonArmy)
                    {
                        bSummonArmy = true;
                        me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
                        DoCast(me, SPELL_ARMY_DEAD);
                    }
                    if (!bDeathArmyDone)
                    {
                        if (uiDeathArmyCheckTimer <= uiDiff)
                        {
                            me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);
                            uiDeathArmyCheckTimer = 0;
                            bDeathArmyDone = true;
                        } else uiDeathArmyCheckTimer -= uiDiff;
                    }
                    if (uiDesecration <= uiDiff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        {
                            if (target && target->isAlive())
                                DoCast(target, SPELL_DESECRATION);
                        }
                        uiDesecration = urand(15000, 16000);
                    } else uiDesecration -= uiDiff;
                    if (uiGhoulExplodeTimer <= uiDiff)
                    {
                        DoCast(me, SPELL_GHOUL_EXPLODE);
                        uiGhoulExplodeTimer = 8000;
                    } else uiGhoulExplodeTimer -= uiDiff;
                    break;
                }
                break;
                }
                break;
            }
            case PHASE_GHOST:
            {
                if (uiDeathBiteTimer <= uiDiff)
                {
                    DoCastAOE(SPELL_DEATH_BITE);
                    uiDeathBiteTimer = urand (2000, 4000);
                } else uiDeathBiteTimer -= uiDiff;
                if (uiMarkedDeathTimer <= uiDiff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    {
                        if (target && target->isAlive())
                            DoCast(target, SPELL_MARKED_DEATH);
                    }
                    uiMarkedDeathTimer = urand (5000, 7000);
                } else uiMarkedDeathTimer -= uiDiff;
                break;
            }
            }

            if (!me->HasUnitState(UNIT_STATE_ROOT) && !me->HealthBelowPct(1))
                DoMeleeAttackIfReady();
        }
Exemplo n.º 14
0
    void UpdateAI(const uint32 diff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (AppearDelay)
        {
            m_creature->StopMoving();
            m_creature->AttackStop();

            if (AppearDelay_Timer < diff)
            {
                AppearDelay = false;

                if (Phase == 2)
                {
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    m_creature->SetVisibility(VISIBILITY_OFF);
                }

                AppearDelay_Timer = 2000;
            }else AppearDelay_Timer -= diff;
        }

        if (Phase == 1)
        {
            //ArcaneMissiles_Timer
            if (ArcaneMissiles_Timer < diff)
            {
                //Solarian casts Arcane Missiles on on random targets in the raid.
                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
                if (target && !m_creature->HasInArc(2.5f, target))
                    target = m_creature->getVictim();
                if (target)
                    DoCast(target, SPELL_ARCANE_MISSILES);

                ArcaneMissiles_Timer = 3000;
            }else ArcaneMissiles_Timer -= diff;

            //Wrath of the Astromancer targets a random player which will explode after 6 secondes
            if (m_uiWrathOfTheAstromancer_Timer < diff)
            {
                m_creature->InterruptNonMeleeSpells(false);

                //Target the tank ?
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
                {
                    if (pTarget->GetTypeId() == TYPEID_PLAYER)
                    {
                        DoCast(pTarget, SPELL_WRATH_OF_THE_ASTROMANCER);
                        m_uiWrathOfTheAstromancer_Timer = 25000;
                    }
                    else
                        m_uiWrathOfTheAstromancer_Timer = 1000;
                }
            }else m_uiWrathOfTheAstromancer_Timer -= diff;

            //BlindingLight_Timer
            if (BlindingLight_Timer < diff)
            {
                //She casts this spell every 45 seconds. It is a kind of Moonfire spell, which she strikes down on the whole raid simultaneously. It hits everyone in the raid for 2280 to 2520 arcane damage.
                DoCast(m_creature->getVictim(), SPELL_BLINDING_LIGHT);
                BlindingLight_Timer = 45000;
            }else BlindingLight_Timer -= diff;

            //Phase1_Timer
            if (Phase1_Timer < diff)
            {
                Phase = 2;
                Phase1_Timer = 50000;

                //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);

                for(int i = 0; i <= 2; ++i)
                {
                    if (!i)
                    {
                        Portals[i][0] = Portal_X(SMALL_PORTAL_RADIUS);
                        Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS);
                        Portals[i][2] = CENTER_Z;
                    }
                    else
                    {
                        Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS);
                        Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS);
                        Portals[i][2] = PORTAL_Z;
                    }
                }

                if ((abs(int(Portals[2][0]) - int(Portals[1][0])) < 7) && (abs(int(Portals[2][1]) - int(Portals[1][1])) < 7))
                {
                    int i = 1;
                    if (abs(int(CENTER_X) + int(26.0f) - int(Portals[2][0])) < 7)
                        i = -1;

                    Portals[2][0] = Portals[2][0]+7*i;
                    Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS);
                }

                for (int i = 0; i <= 2; ++i)
                {
                    if (Creature* Summoned = m_creature->SummonCreature(NPC_ASTROMANCER_SOLARIAN_SPOTLIGHT, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O, TEMPSUMMON_TIMED_DESPAWN, Phase2_Timer+Phase3_Timer+AppearDelay_Timer+1700))
                    {
                        Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        Summoned->CastSpell(Summoned, SPELL_SPOTLIGHT, false);
                    }
                }

                AppearDelay = true;
            }else Phase1_Timer -= diff;
        }
        else if (Phase == 2)
        {
            m_creature->AttackStop();
            m_creature->StopMoving();

            //Check Phase2_Timer
            if (Phase2_Timer < diff)
            {
                //10 seconds after Solarian disappears, 12 mobs spawn out of the three portals.
                Phase = 3;
                for (int i = 0; i <= 2; ++i)
                {
                    for (int j = 1; j <= 4; ++j)
                        SummonMinion(NPC_SOLARIUM_AGENT, Portals[i][0], Portals[i][1], Portals[i][2]);
                }

                DoScriptText(SAY_SUMMON1, m_creature);

                Phase2_Timer = 10000;
            } else Phase2_Timer -= diff;
        }
        else if (Phase == 3)
        {
            m_creature->AttackStop();
            m_creature->StopMoving();

            //Check Phase3_Timer
            if (Phase3_Timer < diff)
            {
                Phase = 1;

                //15 seconds later Solarian reappears out of one of the 3 portals. Simultaneously, 2 healers appear in the two other portals.
                int i = irand(0, 2);
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMap()->CreatureRelocation(m_creature, Portals[i][0], Portals[i][1], Portals[i][2], CENTER_O);

                for (int j = 0; j <= 2; ++j)
                    if (j != i)
                        SummonMinion(NPC_SOLARIUM_PRIEST, Portals[j][0], Portals[j][1], Portals[j][2]);

                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                m_creature->SetVisibility(VISIBILITY_ON);

                DoScriptText(SAY_SUMMON2, m_creature);

                AppearDelay = true;
                Phase3_Timer = 15000;
            }else Phase3_Timer -= diff;
        }
        else if (Phase == 4)
        {
            //Fear_Timer
            if (Fear_Timer < diff)
            {
                DoCast(m_creature, SPELL_FEAR);
                Fear_Timer = 20000;
            }else Fear_Timer -= diff;

            //VoidBolt_Timer
            if (VoidBolt_Timer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_VOID_BOLT);
                VoidBolt_Timer = 10000;
            }else VoidBolt_Timer -= diff;
        }

        //When Solarian reaches 20% she will transform into a huge void walker.
        if (Phase != 4 && ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth())<20))
        {
            Phase = 4;

            //To make sure she wont be invisible or not selecatble
            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            m_creature->SetVisibility(VISIBILITY_ON);

            DoScriptText(SAY_VOIDA, m_creature);
            DoScriptText(SAY_VOIDB, m_creature);

            m_creature->SetArmor(WV_ARMOR);
            m_creature->SetDisplayId(MODEL_VOIDWALKER);
            m_creature->SetFloatValue(OBJECT_FIELD_SCALE_X, defaultsize*2.5f);
        }

        DoMeleeAttackIfReady();
    }
Exemplo n.º 15
0
        void UpdateAI(const uint32 diff)
        {
            //Only if not incombat check if the event is started
            if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
            {
                Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK));

                if (target)
                {
                    AttackStart(target);
                }
            }

            //Return since we have no target
            if (!UpdateVictim())
                return;

            //someone evaded!
            if (instance && !instance->GetData(DATA_MAULGAREVENT))
            {
                EnterEvadeMode();
                return;
            }

            //GreaterFireball_Timer
            if (GreaterFireball_Timer < diff || me->IsWithinDist(me->GetVictim(), 30))
            {
                DoCastVictim(SPELL_GREATER_FIREBALL);
                GreaterFireball_Timer = 2000;
            } else GreaterFireball_Timer -= diff;

            //SpellShield_Timer
            if (SpellShield_Timer <= diff)
            {
                me->InterruptNonMeleeSpells(false);
                DoCastVictim(SPELL_SPELLSHIELD);
                SpellShield_Timer = 30000;
            } else SpellShield_Timer -= diff;

            //BlastWave_Timer
            if (BlastWave_Timer <= diff)
            {
                Unit* target = NULL;
                std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
                std::vector<Unit*> target_list;
                for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
                {
                    target = Unit::GetUnit(*me, (*itr)->getUnitGuid());
                                                                //15 yard radius minimum
                    if (target && target->IsWithinDist(me, 15, false))
                        target_list.push_back(target);
                    target = NULL;
                }
                if (!target_list.empty())
                    target = *(target_list.begin()+rand()%target_list.size());

                me->InterruptNonMeleeSpells(false);
                DoCast(target, SPELL_BLAST_WAVE);
                BlastWave_Timer = 60000;
            } else BlastWave_Timer -= diff;
        }
Exemplo n.º 16
0
    void UpdateAI(const uint32 diff)
    {
        if (IsEvent)
        {
            //Must update npc_escortAI
            npc_escortAI::UpdateAI(diff);
            if(!go)
            {
                go = true;
                if(pInstance)
                {
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91,    -2404.61,    1462.63);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76,    -2460.87,    1469.55);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58,    -2514.66,    1476.12);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16,    -2567.23,    1479.90);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67,    -2625.99,    1480.89);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16,    -2659.2,    1480.15);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62,    -2704.05,    1482.18);
                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04,    -2726.26,    1485.10);
                    ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);
                    ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);
                }
            }
        }

        //Return since we have no target
        if (!UpdateVictim() )
            return;

        if(RainTimer < diff)
        {
            DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE);
            RainTimer = 20000+rand()%15000;
        }else RainTimer -= diff;

        if(DoomTimer < diff)
        {
            DoCast(SelectUnit(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank
            DoomTimer = 45000+rand()%5000;
        }else DoomTimer -= diff;

        if(HowlTimer < diff)
        {
            DoCast(m_creature, SPELL_HOWL_OF_AZGALOR);
            HowlTimer = 30000;
        }else HowlTimer -= diff;

        if(CleaveTimer < diff)
        {
            DoCast(m_creature->getVictim(), SPELL_CLEAVE);
            CleaveTimer = 10000+rand()%5000;
        }else CleaveTimer -= diff;

        if(EnrageTimer < diff && !enraged)
        {
            m_creature->InterruptNonMeleeSpells(false);
            DoCast(m_creature, SPELL_BERSERK, true);
            enraged = true;
            EnrageTimer = 600000;
        }else EnrageTimer -= diff;

        DoMeleeAttackIfReady();
    }
Exemplo n.º 17
0
 void Reset()
 {
     BossAI::Reset();
     DoCast(me, SPELL_MAGMASPLASH, true);
 }
Exemplo n.º 18
0
        void UpdateAI(const uint32 uiDiff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (bEventInProgress)
            {
                if (uiResurrectTimer <= uiDiff)
                {
                        me->SetHealth(me->GetMaxHealth());
                        me->AttackStop();
                        switch(uiPhase)
                        {
                            case PHASE_UNDEAD:
                                DoScriptText(SAY_DEATH_1, me);
                                break;
                            case PHASE_SKELETON:
                                DoScriptText(SAY_DEATH, me);
                                break;
                        }
                    DoCast(me,SPELL_BLACK_KNIGHT_RES,true);
                        me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);
                    uiPhase++;
                    uiResurrectTimer = 4000;
                    bEventInProgress = false;
                    me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);
                } else uiResurrectTimer -= uiDiff;
            }

            switch(uiPhase)
            {
                case PHASE_UNDEAD:
                case PHASE_SKELETON:
                {
                    if (uiIcyTouchTimer <= uiDiff)
                    {
                        if (IsHeroic())
                            DoCastVictim(SPELL_ICY_TOUCH_H);
                        else
                            DoCastVictim(SPELL_ICY_TOUCH);
                        uiIcyTouchTimer = urand(5000,7000);
                    } else uiIcyTouchTimer -= uiDiff;
                    if (uiPlagueStrikeTimer <= uiDiff)
                    {
                        if (IsHeroic())
                            DoCastVictim(SPELL_PLAGUE_STRIKE);
                        else
                            DoCastVictim(SPELL_PLAGUE_STRIKE_H);
                        uiPlagueStrikeTimer = urand(12000,15000);
                    } else uiPlagueStrikeTimer -= uiDiff;

                    if (uiObliterateTimer <= uiDiff)
                    {
                        if (IsHeroic())
                            DoCastVictim(SPELL_OBLITERATE_H);
                        else
                            DoCastVictim(SPELL_OBLITERATE);
                        uiObliterateTimer = urand(17000,19000);
                    } else uiObliterateTimer -= uiDiff;
                    switch(uiPhase)
                    {
                        case PHASE_UNDEAD:
                        {
                            if (uiDeathRespiteTimer <= uiDiff)
                            {
                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                                {
                                    if (target && target->isAlive())
                                    {
                                        if (IsHeroic())
                                            DoCast(target,SPELL_DEATH_RESPITE_H);
                                        else
                                            DoCast(target,SPELL_DEATH_RESPITE);
                                    }
                                }
                                uiDeathRespiteTimer = urand(15000,16000);
                            } else uiDeathRespiteTimer -= uiDiff;
                        break;
                    }
                        case PHASE_SKELETON:
                    {
                        if (!bSummonArmy)
                        {
                            bSummonArmy = true;
                            me->AddUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);
                            me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);
                            if (IsHeroic())
                                DoCast(me, SPELL_ARMY_DEAD_H);
                            else
                            DoCast(me, SPELL_ARMY_DEAD);
                        }

                        if (!bDeathArmyDone)
                            {
                            if (uiDeathArmyCheckTimer <= uiDiff)
                            {
                                me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);
                                me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);
                                uiDeathArmyCheckTimer = 0;
                                bDeathArmyDone = true;
                            } else uiDeathArmyCheckTimer -= uiDiff;
                            }
                        if (uiDesecration1Timer <= uiDiff)
                        {
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            {
                                if (target && target->isAlive())
                                    {
                                        if (IsHeroic())
                                            DoCast(target,SPELL_DESECRATION_H);
                                        else
                                            DoCast(target,SPELL_DESECRATION);
                                    }
                            }
                            uiDesecration1Timer = urand(15000,16000);
                        } else uiDesecration1Timer -= uiDiff;

                        if (uiGhoulExplodeTimer <= uiDiff)
                        {
                            DoCast(me, SPELL_GHOUL_EXPLODE);
                            uiGhoulExplodeTimer = 8000;
                        } else uiGhoulExplodeTimer -= uiDiff;
                            break;
                        }
                            break;
                    }
                    break;
                }
                case PHASE_GHOST:
                {
                    if (uiDeathBiteTimer <= uiDiff)
                    {
                            SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE);
                        if (IsHeroic())
                            DoCastAOE(SPELL_DEATH_BITE);
                        else
                            DoCastAOE(SPELL_DEATH_BITE_H);
                        uiDeathBiteTimer = urand (2000, 4000);
                    } else uiDeathBiteTimer -= uiDiff;

                    if (uiMarkedDeathTimer <= uiDiff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        {
                            if (target && target->isAlive())
                            {
                                if (IsHeroic())
                                    DoCast(target,SPELL_MARKED_DEATH);
                                else
                                    DoCast(target,SPELL_MARKED_DEATH_H);
                            }
                        }
                        uiMarkedDeathTimer = urand (5000, 7000);
                    } else uiMarkedDeathTimer -= uiDiff;
                    break;
                }
            }

                if (!me->HasUnitState(UNIT_STAT_ROOT) && !me->GetHealth()*100 / me->GetMaxHealth() <= 0)
                DoMeleeAttackIfReady();
        }
Exemplo n.º 19
0
 void EnterCombat(Unit* /*target*/)
 {
     DoCast(me, SPELL_PLAGUE_STENCH);
 }
Exemplo n.º 20
0
 void JustDied(Unit* /*who*/)
 {
     DoCast(SPELL_HALLUCINATION_2);
 }
Exemplo n.º 21
0
 void Reset()
 {
     DoCast(me, SPELL_SPIRIT_SPAWNIN);
     me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
 }
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

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

            //Randomly cast one beam.
            if (BeamTimer <= diff)
            {
                Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);
                if (!pTarget || !pTarget->isAlive())
                    return;

                BeamTimer = 9000;

                switch(CurrentBeam)
                {
                    case 0:
                        DoCast(pTarget, SPELL_BEAM_SINISTER);
                        break;
                    case 1:
                        DoCast(pTarget, SPELL_BEAM_VILE);
                        break;
                    case 2:
                        DoCast(pTarget, SPELL_BEAM_WICKED);
                        break;
                    case 3:
                        DoCast(pTarget, SPELL_BEAM_SINFUL);
                        break;
                }
                ++BeamCount;
                uint32 Beam = CurrentBeam;
                if (BeamCount > 3)
                    while (CurrentBeam == Beam)
                        CurrentBeam = rand()%3;

            } else BeamTimer -= diff;

            // Random Prismatic Shield every 15 seconds.
            if (PrismaticShieldTimer <= diff)
            {
                uint32 random = rand()%6;
                if (PrismaticAuras[random])
                    DoCast(me, PrismaticAuras[random]);
                PrismaticShieldTimer = 15000;
            } else PrismaticShieldTimer -= diff;

            // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other.
            if (FatalAttractionTimer <= diff)
            {
                ExplosionCount = 0;

                TeleportPlayers();

                DoScriptText(RAND(SAY_SPELL2,SAY_SPELL3), me);
                FatalAttractionExplodeTimer = 2000;
                FatalAttractionTimer = 40000 + rand()%31 * 1000;
            } else FatalAttractionTimer -= diff;

            if (FatalAttractionExplodeTimer <= diff)
            {
                // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later.
                if (ExplosionCount < 3)
                {
                    for (uint8 i = 0; i < 3; ++i)
                    {
                        Unit* pUnit = NULL;
                        if (TargetGUID[i])
                        {
                            pUnit = Unit::GetUnit((*me), TargetGUID[i]);
                            if (pUnit)
                                pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true);
                            TargetGUID[i] = 0;
                        }
                    }

                    ++ExplosionCount;
                    FatalAttractionExplodeTimer = 1000;
                }
                else
                {
                    FatalAttractionExplodeTimer = FatalAttractionTimer + 2000;
                    ExplosionCount = 0;
                }
            } else FatalAttractionExplodeTimer -= diff;

            if (ShriekTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_SILENCING_SHRIEK);
                ShriekTimer = 25000+rand()%10 * 1000;
            } else ShriekTimer -= diff;

            if (SaberTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_SABER_LASH);
                SaberTimer = 25000+rand()%10 * 1000;
            } else SaberTimer -= diff;

            //Enrage
            if (!me->HasAura(SPELL_BERSERK))
            {
                if (EnrageTimer <= diff)
                {
                    DoCast(me, SPELL_BERSERK);
                    DoScriptText(SAY_ENRAGE, me);
                } else EnrageTimer -= diff;
            }

            //Random taunts
            if (RandomYellTimer <= diff)
            {
                DoScriptText(RAND(SAY_TAUNT1,SAY_TAUNT2,SAY_TAUNT3), me);
                RandomYellTimer = 60000 + rand()%91 * 1000;
            } else RandomYellTimer -= diff;

            DoMeleeAttackIfReady();
        }
Exemplo n.º 23
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (!isInVanish && !isInVampyrMode)
            // Summon Flame Orb
            if(summonFlameOrbTimer <= uiDiff)
            {
                for(int i = 0; i < 3; ++i)
                {
                    m_creature->SummonCreature(NPC_FLAME_ORB, m_creature->GetPositionX(), m_creature->GetPositionY(), FLAME_ORB_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
                    if(m_bIsRegularMode)
                        break;
                }
                DoCast(m_creature, SPELL_CONJURE_FLAME_ORB);
                vanishTimer += 10000;
                summonFlameOrbTimer = 16000 + rand()%10000;
            }else summonFlameOrbTimer -= uiDiff;


        if (!isInVampyrMode)
            if(vanishTimer < uiDiff)
            {
                m_creature->CastSpell(m_creature,SPELL_VANISH,true);
                isInVanish = true;
                embraceOfTheVampyrTimer = 2400;
                vanishTimer = 200000;
            }else vanishTimer -= uiDiff;
        
        if (isInVanish)
        {
            if (embraceOfTheVampyrTimer < uiDiff)
            {
                Player* pPlayer;

                // get player enemy
                do
                {
                    pPlayer = (Player*) m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0);
                }
                while (!pPlayer);

                m_creature->NearTeleportTo(pPlayer->GetPositionX() + 3.0f, pPlayer->GetPositionY() + 3.0f, pPlayer->GetPositionZ(), pPlayer->GetOrientation());
                m_creature->RemoveAurasDueToSpell(SPELL_VANISH);
                DoCastSpellIfCan(pPlayer, m_bIsRegularMode ? SPELL_EMBRACE_OF_THE_VAMPYR : SPELL_EMBRACE_OF_THE_VAMPYR_H);
                isInVampyrMode = true;
                summonFlameOrbTimer += 20000;
                isInVanish = false;
                vanishTimer = 25000;
            }else embraceOfTheVampyrTimer -= uiDiff;
        }

        // set VampyrMode false when Spell not stopped by damage
        if(isInVampyrMode)
            if(embraceOfTheVampyrFinishedTimer < uiDiff)
            {
                isInVampyrMode = false;
                embraceOfTheVampyrFinishedTimer = 20000;
            } else embraceOfTheVampyrFinishedTimer -= uiDiff;
            
        if(!isInVampyrMode && !isInVanish)
            if (bloodthirstTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature->getVictim(), SPELL_BLOODTHIRST); 
                bloodthirstTimer = m_bIsRegularMode ? 15000 : 8000;
            }else bloodthirstTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
Exemplo n.º 24
0
        void UpdateAI(const uint32 diff)
        {
            //Return since we have no target
            if(!UpdateVictim())
                return;

            //ArcaneExplosion_Timer
            if(ArcaneExplosion_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
                ArcaneExplosion_Timer = 8000 + rand()%10000;
            } else ArcaneExplosion_Timer -= diff;

            //If we are within range melee the target
            if(me->IsWithinMeleeRange(me->getVictim()))
            {
                //Make sure our attack is ready and we arn't currently casting
                if(me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
                {
                    me->AttackerStateUpdate(me->getVictim());
                    me->resetAttackTimer();
                }
            } else
            {
                //EarthShock_Timer
                if(EarthShock_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_EARTH_SHOCK);
                    EarthShock_Timer = 1000;
                } else EarthShock_Timer -= diff;
            }

            //Blink_Timer
            if(Blink_Timer <= diff)
            {
                //DoCast(me, SPELL_BLINK);
                switch(urand(0, 2))
                {
                    case 0:
                        me->GetMap()->CreatureRelocation(me, -8340.782227f, 2083.814453f, 125.648788f, 0.0f);
                        DoResetThreat();
                        break;
                    case 1:
                        me->GetMap()->CreatureRelocation(me, -8341.546875f, 2118.504639f, 133.058151f, 0.0f);
                        DoResetThreat();
                        break;
                    case 2:
                        me->GetMap()->CreatureRelocation(me, -8318.822266f, 2058.231201f, 133.058151f, 0.0f);
                        DoResetThreat();
                        break;
                }
                DoStopAttack();

                Blink_Timer= 20000 + rand()%20000;
            } else Blink_Timer -= diff;

            int procent = (int) (me->GetHealthPct() + 0.5f);

            //Summoning 2 Images and teleporting to a random position on 75% health
            if((!Images75 && !IsImage) && (procent <= 75 && procent > 70))
                DoSplit(75);

            //Summoning 2 Images and teleporting to a random position on 50% health
            if((!Images50 && !IsImage) && (procent <= 50 && procent > 45))
                DoSplit(50);

            //Summoning 2 Images and teleporting to a random position on 25% health
            if((!Images25 && !IsImage) && (procent <= 25 && procent > 20))
                DoSplit(25);

            //Invisible_Timer
            if(Invisible)
            {
                if(Invisible_Timer <= diff)
                {
                    //Making Skeram visible after telporting
                    me->SetVisible(true);
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                    Invisible_Timer = 2500;
                    Invisible = false;
                } else Invisible_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 25
0
    void UpdateAI(const uint32 diff)
    {
        if (Intro && !Done)
        {
            if (AggroTimer <= diff)
            {
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                DoScriptText(SAY_AGGRO, me);
                me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
                Done = true;
                if (AggroTargetGUID)
                {
                    Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID);
                    if (pUnit)
                        AttackStart(pUnit);

                    DoZoneInCombat();
                }
                else
                {
                    EnterEvadeMode();
                    return;
                }
            } else AggroTimer -= diff;
        }

        if (!UpdateVictim() || !Done)
            return;

        if (SummonShadowsTimer <= diff)
        {
            //MindControlGhost();

            for (uint8 i = 0; i < 2; ++i)
            {
                Creature* Shadow = NULL;
                float X = CalculateRandomLocation(me->GetPositionX(), 10);
                Shadow = me->SummonCreature(CREATURE_SHADOWY_CONSTRUCT, X, me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 0);
                if (Shadow)
                {
                    Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
                    if (!pTarget)
                        pTarget = me->getVictim();

                    if (pTarget)
                        Shadow->AI()->AttackStart(pTarget);
                }
            }
            SummonShadowsTimer = 60000;
        } else SummonShadowsTimer -= diff;

        if (SummonDoomBlossomTimer <= diff)
        {
            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
            {
                float X = CalculateRandomLocation(pTarget->GetPositionX(), 20);
                float Y = CalculateRandomLocation(pTarget->GetPositionY(), 20);
                float Z = pTarget->GetPositionZ();
                Z = me->GetMap()->GetHeight(X, Y, Z);
                Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000);
                if (DoomBlossom)
                {
                    DoomBlossom->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    DoomBlossom->setFaction(me->getFaction());
                    DoomBlossom->AddThreat(pTarget, 1.0f);
                    CAST_AI(mob_doom_blossomAI, DoomBlossom->AI())->SetTeronGUID(me->GetGUID());
                    pTarget->CombatStart(DoomBlossom);
                    SetThreatList(DoomBlossom);
                    SummonDoomBlossomTimer = 35000;
                }
            }
        } else SummonDoomBlossomTimer -= diff;

        if (IncinerateTimer <= diff)
        {
            Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
            if (!pTarget)
                pTarget = me->getVictim();

            if (pTarget)
            {
                DoScriptText(RAND(SAY_SPECIAL1,SAY_SPECIAL2), me);
                DoCast(pTarget, SPELL_INCINERATE);
                IncinerateTimer = 20000 + rand()%31 * 1000;
            }
        } else IncinerateTimer -= diff;

        if (CrushingShadowsTimer <= diff)
        {
            Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
            if (pTarget && pTarget->isAlive())
                DoCast(pTarget, SPELL_CRUSHING_SHADOWS);
            CrushingShadowsTimer = 10000 + rand()%16 * 1000;
        } else CrushingShadowsTimer -= diff;

        /*** NOTE FOR FUTURE DEV: UNCOMMENT BELOW ONLY IF MIND CONTROL IS FULLY IMPLEMENTED **/
        /*if (ShadowOfDeathTimer <= diff)
        {
            Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);

            if (!pTarget)
               pTarget = me->getVictim();

            if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER)
            {
                DoCast(pTarget, SPELL_SHADOW_OF_DEATH);
                GhostGUID = pTarget->GetGUID();
                ShadowOfDeathTimer = 30000;
                SummonShadowsTimer = 53000; // Make it VERY close but slightly less so that we can check if the aura is still on the player
            }
        } else ShadowOfDeathTimer -= diff;*/

        if (RandomYellTimer <= diff)
        {
            DoScriptText(RAND(SAY_SPELL1,SAY_SPELL2), me);
            RandomYellTimer = 50000 + rand()%51 * 1000;
        } else RandomYellTimer -= diff;

        if (!me->HasAura(SPELL_BERSERK))
        {
            if (EnrageTimer <= diff)
            {
                DoCast(me, SPELL_BERSERK);
                DoScriptText(SAY_ENRAGE, me);
            } else EnrageTimer -= diff;
        }

        DoMeleeAttackIfReady();
    }
Exemplo n.º 26
0
            void UpdateAI(const uint32 diff)
            {
                if (!UpdateVictim())
                    return;

                //BloodSiphon_Timer
                if (BloodSiphon_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_BLOODSIPHON);
                    BloodSiphon_Timer = 90000;
                } else BloodSiphon_Timer -= diff;

                //CorruptedBlood_Timer
                if (CorruptedBlood_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_CORRUPTEDBLOOD);
                    CorruptedBlood_Timer = 30000 + rand()%15000;
                } else CorruptedBlood_Timer -= diff;

                //CauseInsanity_Timer
                /*if (CauseInsanity_Timer <= diff)
                {
                if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                DoCast(pTarget, SPELL_CAUSEINSANITY);

                CauseInsanity_Timer = 35000 + rand()%8000;
                } else CauseInsanity_Timer -= diff;*/

                //WillOfHakkar_Timer
                if (WillOfHakkar_Timer <= diff)
                {
                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                        DoCast(pTarget, SPELL_WILLOFHAKKAR);

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

                if (!Enraged && Enrage_Timer <= diff)
                {
                    DoCast(me, SPELL_ENRAGE);
                    Enraged = true;
                } else Enrage_Timer -= diff;

                //Checking if Jeklik is dead. If not we cast her Aspect
                if (CheckJeklik_Timer <= diff)
                {
                    if (m_pInstance)
                    {
                        if (m_pInstance->GetData(TYPE_JEKLIK) != DONE)
                        {
                            if (AspectOfJeklik_Timer <= diff)
                            {
                                DoCast(me->getVictim(), SPELL_ASPECT_OF_JEKLIK);
                                AspectOfJeklik_Timer = 10000 + rand()%4000;
                            } else AspectOfJeklik_Timer -= diff;
                        }
                    }
                    CheckJeklik_Timer = 1000;
                } else CheckJeklik_Timer -= diff;

                //Checking if Venoxis is dead. If not we cast his Aspect
                if (CheckVenoxis_Timer <= diff)
                {
                    if (m_pInstance)
                    {
                        if (m_pInstance->GetData(TYPE_VENOXIS) != DONE)
                        {
                            if (AspectOfVenoxis_Timer <= diff)
                            {
                                DoCast(me->getVictim(), SPELL_ASPECT_OF_VENOXIS);
                                AspectOfVenoxis_Timer = 8000;
                            } else AspectOfVenoxis_Timer -= diff;
                        }
                    }
                    CheckVenoxis_Timer = 1000;
                } else CheckVenoxis_Timer -= diff;

                //Checking if Marli is dead. If not we cast her Aspect
                if (CheckMarli_Timer <= diff)
                {
                    if (m_pInstance)
                    {
                        if (m_pInstance->GetData(TYPE_MARLI) != DONE)
                        {
                            if (AspectOfMarli_Timer <= diff)
                            {
                                DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI);
                                AspectOfMarli_Timer = 10000;
                            } else AspectOfMarli_Timer -= diff;

                        }
                    }
                    CheckMarli_Timer = 1000;
                } else CheckMarli_Timer -= diff;

                //Checking if Thekal is dead. If not we cast his Aspect
                if (CheckThekal_Timer <= diff)
                {
                    if (m_pInstance)
                    {
                        if (m_pInstance->GetData(TYPE_THEKAL) != DONE)
                        {
                            if (AspectOfThekal_Timer <= diff)
                            {
                                DoCast(me, SPELL_ASPECT_OF_THEKAL);
                                AspectOfThekal_Timer = 15000;
                            } else AspectOfThekal_Timer -= diff;
                        }
                    }
                    CheckThekal_Timer = 1000;
                } else CheckThekal_Timer -= diff;

                //Checking if Arlokk is dead. If yes we cast her Aspect
                if (CheckArlokk_Timer <= diff)
                {
                    if (m_pInstance)
                    {
                        if (m_pInstance->GetData(TYPE_ARLOKK) != DONE)
                        {
                            if (AspectOfArlokk_Timer <= diff)
                            {
                                DoCast(me, SPELL_ASPECT_OF_ARLOKK);
                                DoResetThreat();

                                AspectOfArlokk_Timer = 10000 + rand()%5000;
                            } else AspectOfArlokk_Timer -= diff;
                        }
                    }
                    CheckArlokk_Timer = 1000;
                } else CheckArlokk_Timer -= diff;

                DoMeleeAttackIfReady();
            }
Exemplo n.º 27
0
        void UpdateAI(const uint32 diff)
        {
            //Check if we have a target
            if (!UpdateVictim())
                return;

            //EvadeTimer
            if (!me->IsWithinMeleeRange(me->getVictim()))
            {
                if (EvadeTimer <= diff)
                {
                    if (Unit* p = Unit::GetUnit(*me, Portal))
                        p->Kill(p);

                    //Dissapear and reappear at new position
                    me->SetVisible(false);

                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                    if (!target)
                    {
                        me->Kill(me);
                        return;
                    }

                    if (!target->HasAura(SPELL_DIGESTIVE_ACID))
                    {
                        me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
                        if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN))
                        {
                            pPortal->SetReactState(REACT_PASSIVE);
                            Portal = pPortal->GetGUID();
                        }

                        GroundRuptureTimer = 500;
                        HamstringTimer = 2000;
                        ThrashTimer = 5000;
                        EvadeTimer = 5000;
                        AttackStart(target);
                    }
                    me->SetVisible(true);
                } else EvadeTimer -= diff;
            }

            //GroundRuptureTimer
            if (GroundRuptureTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_GROUND_RUPTURE);
                GroundRuptureTimer = 30000;
            } else GroundRuptureTimer -= diff;

            //ThrashTimer
            if (ThrashTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_THRASH);
                ThrashTimer = 10000;
            } else ThrashTimer -= diff;

            //HamstringTimer
            if (HamstringTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_HAMSTRING);
                HamstringTimer = 10000;
            } else HamstringTimer -= diff;

            DoMeleeAttackIfReady();
        }
Exemplo n.º 28
0
        void UpdateAI(const uint32 diff)
        {
            //Only if not incombat check if the event is started
            if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))
            {
                Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK));

                if (target)
                {
                    AttackStart(target);
                    GetCouncil();
                }
            }

            //Return since we have no target
            if (!UpdateVictim())
                return;

            //someone evaded!
            if (instance && !instance->GetData(DATA_MAULGAREVENT))
            {
                EnterEvadeMode();
                return;
            }

            //ArcingSmash_Timer
            if (ArcingSmash_Timer <= diff)
            {
                DoCastVictim(SPELL_ARCING_SMASH);
                ArcingSmash_Timer = 10000;
            } else ArcingSmash_Timer -= diff;

            //Whirlwind_Timer
                   if (Whirlwind_Timer <= diff)
                   {
                        DoCastVictim(SPELL_WHIRLWIND);
                        Whirlwind_Timer = 55000;
                   } else Whirlwind_Timer -= diff;

            //MightyBlow_Timer
            if (MightyBlow_Timer <= diff)
            {
                DoCastVictim(SPELL_MIGHTY_BLOW);
                MightyBlow_Timer = 30000+rand()%10000;
            } else MightyBlow_Timer -= diff;

            //Entering Phase 2
            if (!Phase2 && HealthBelowPct(50))
            {
                Phase2 = true;
                Talk(SAY_ENRAGE);

                DoCast(me, SPELL_DUAL_WIELD, true);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0);
            }

            if (Phase2)
            {
                //Charging_Timer
                if (Charging_Timer <= diff)
                {
                    Unit* target = NULL;
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                    if (target)
                    {
                        AttackStart(target);
                        DoCast(target, SPELL_BERSERKER_C);
                    }
                    Charging_Timer = 20000;
                } else Charging_Timer -= diff;

                //Intimidating Roar
                if (Roar_Timer <= diff)
                {
                    DoCast(me, SPELL_ROAR);
                    Roar_Timer = 40000+(rand()%10000);
                } else Roar_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }
Exemplo n.º 29
0
        void UpdateAI(const uint32 diff)
        {
            //Check if we have a target
            if (!UpdateVictim())
            {
                //No target so we'll use this section to do our random wispers instance wide
                //WisperTimer
                if (WisperTimer <= diff)
                {
                    Map* map = me->GetMap();
                    if (!map->IsDungeon())
                        return;

                    //Play random sound to the zone
                    Map::PlayerList const &PlayerList = map->GetPlayers();

                    if (!PlayerList.isEmpty())
                    {
                        for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
                        {
                            if (Player* pPlr = itr->getSource())
                                pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER, pPlr);
                        }
                    }

                    //One random wisper every 90 - 300 seconds
                    WisperTimer = urand(90000, 300000);
                } else WisperTimer -= diff;

                return;
            }

            me->SetTarget(0);

            //No instance
            if (!instance)
                return;

            uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE);
            if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK)
            {
                // EyeTentacleTimer
                if (EyeTentacleTimer <= diff)
                {
                    //Spawn the 8 Eye Tentacles in the corret spots
                    SpawnEyeTentacle(0, 20);                //south
                    SpawnEyeTentacle(10, 10);               //south west
                    SpawnEyeTentacle(20, 0);                //west
                    SpawnEyeTentacle(10, -10);              //north west

                    SpawnEyeTentacle(0, -20);               //north
                    SpawnEyeTentacle(-10, -10);             //north east
                    SpawnEyeTentacle(-20, 0);               // east
                    SpawnEyeTentacle(-10, 10);              // south east

                    EyeTentacleTimer = 30000; // every 30sec in phase 2
                } else EyeTentacleTimer -= diff;
            }

            switch (currentPhase)
            {
                //Transition phase
                case PHASE_CTHUN_TRANSITION:
                    //PhaseTimer
                    if (PhaseTimer <= diff)
                    {
                        //Switch
                        instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH);

                        //Switch to c'thun model
                        me->InterruptNonMeleeSpells(false);
                        DoCast(me, SPELL_TRANSFORM, false);
                        me->SetFullHealth();

                        me->SetVisible(true);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);

                        //Emerging phase
                        //AttackStart(Unit::GetUnit(*me, HoldpPlayer));
                        DoZoneInCombat();

                        //Place all units in threat list on outside of stomach
                        Stomach_Map.clear();

                        for (std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
                            Stomach_Map[(*i)->getUnitGuid()] = false;   //Outside stomach

                        //Spawn 2 flesh tentacles
                        FleshTentaclesKilled = 0;

                        //Spawn flesh tentacle
                        for (uint8 i = 0; i < 2; i++)
                        {
                            Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN);
                            if (!spawned)
                                ++FleshTentaclesKilled;
                        }

                        PhaseTimer = 0;
                    } else PhaseTimer -= diff;

                    break;

                //Body Phase
                case PHASE_CTHUN_STOMACH:
                    //Remove Target field
                    me->SetTarget(0);

                    //Weaken
                    if (FleshTentaclesKilled > 1)
                    {
                        instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK);

                        DoScriptText(EMOTE_WEAKENED, me);
                        PhaseTimer = 45000;

                        DoCast(me, SPELL_PURPLE_COLORATION, true);

                        UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin();

                        //Kick all players out of stomach
                        while (i != Stomach_Map.end())
                        {
                            //Check for valid player
                            Unit* unit = Unit::GetUnit(*me, i->first);

                            //Only move units in stomach
                            if (unit && i->second == true)
                            {
                                //Teleport each player out
                                DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));

                                //Cast knockback on them
                                DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);

                                //Remove the acid debuff
                                unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);

                                i->second = false;
                            }
                            ++i;
                        }

                        return;
                    }

                    //Stomach acid
                    if (StomachAcidTimer <= diff)
                    {
                        //Apply aura to all players in stomach
                        UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin();

                        while (i != Stomach_Map.end())
                        {
                            //Check for valid player
                            Unit* unit = Unit::GetUnit(*me, i->first);

                            //Only apply to units in stomach
                            if (unit && i->second == true)
                            {
                                //Cast digestive acid on them
                                DoCast(unit, SPELL_DIGESTIVE_ACID, true);

                                //Check if player should be kicked from stomach
                                if (unit->IsWithinDist3d(&KickPos, 15.0f))
                                {
                                    //Teleport each player out
                                    DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));

                                    //Cast knockback on them
                                    DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);

                                    //Remove the acid debuff
                                    unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);

                                    i->second = false;
                                }
                            }
                            ++i;
                        }

                        StomachAcidTimer = 4000;
                    } else StomachAcidTimer -= diff;

                    //Stomach Enter Timer
                    if (StomachEnterTimer <= diff)
                    {
                        if (Unit* target = SelectRandomNotStomach())
                        {
                            //Set target in stomach
                            Stomach_Map[target->GetGUID()] = true;
                            target->InterruptNonMeleeSpells(false);
                            target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID());
                            StomachEnterTarget = target->GetGUID();
                            StomachEnterVisTimer = 3800;
                        }

                        StomachEnterTimer = 13800;
                    } else StomachEnterTimer -= diff;

                    if (StomachEnterVisTimer && StomachEnterTarget)
                    {
                        if (StomachEnterVisTimer <= diff)
                        {
                            //Check for valid player
                            Unit* unit = Unit::GetUnit(*me, StomachEnterTarget);

                            if (unit)
                            {
                                DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
                            }

                            StomachEnterTarget = 0;
                            StomachEnterVisTimer = 0;
                        } else StomachEnterVisTimer -= diff;
                    }

                    //GientClawTentacleTimer
                    if (GiantClawTentacleTimer <= diff)
                    {
                        if (Unit* target = SelectRandomNotStomach())
                        {
                            //Spawn claw tentacle on the random target
                            if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500))
                                if (spawned->AI())
                                    spawned->AI()->AttackStart(target);
                        }

                        //One giant claw tentacle every minute
                        GiantClawTentacleTimer = 60000;
                    } else GiantClawTentacleTimer -= diff;

                    //GiantEyeTentacleTimer
                    if (GiantEyeTentacleTimer <= diff)
                    {
                        if (Unit* target = SelectRandomNotStomach())
                        {
                            //Spawn claw tentacle on the random target
                            if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500))
                                if (spawned->AI())
                                    spawned->AI()->AttackStart(target);
                        }

                        //One giant eye tentacle every minute
                        GiantEyeTentacleTimer = 60000;
                    } else GiantEyeTentacleTimer -= diff;

                    break;

                //Weakened state
                case PHASE_CTHUN_WEAK:
                    //PhaseTimer
                    if (PhaseTimer <= diff)
                    {
                        //Switch
                        instance->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH);

                        //Remove purple coloration
                        me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION);

                        //Spawn 2 flesh tentacles
                        FleshTentaclesKilled = 0;

                        //Spawn flesh tentacle
                        for (uint8 i = 0; i < 2; i++)
                        {
                            Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN);
                            if (!spawned)
                                ++FleshTentaclesKilled;
                        }

                        PhaseTimer = 0;
                    } else PhaseTimer -= diff;

                    break;
            }
        }
Exemplo n.º 30
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        if (Teleport_Timer <= diff)
        {
            DoScriptText(SAY_TELEPORT, me);
            std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
            std::list<HostileReference*>::iterator i = m_threatlist.begin();
            for (i = m_threatlist.begin(); i != m_threatlist.end();++i)
            {
                Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
                if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
                {
                    DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation());
                }
            }

            DoResetThreat();
            Teleport_Timer = 30000;
        } else Teleport_Timer -= diff;

        //        //MarkOfFrost_Timer
        //        if (MarkOfFrost_Timer <= diff)
        //        {
        //            DoCast(me->getVictim(),SPELL_MARKOFFROST);
        //            MarkOfFrost_Timer = 25000;
        //        } else MarkOfFrost_Timer -= diff;

        //Chill_Timer
        if (Chill_Timer <= diff)
        {
            DoCast(me->getVictim(),SPELL_CHILL);
            Chill_Timer = 13000 + rand()%12000;
        } else Chill_Timer -= diff;

        //Breath_Timer
        if (Breath_Timer <= diff)
        {
            DoCast(me->getVictim(),SPELL_FROSTBREATH);
            Breath_Timer = 10000 + rand()%5000;
        } else Breath_Timer -= diff;

        //ManaStorm_Timer
        if (ManaStorm_Timer <= diff)
        {
            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                DoCast(pTarget,SPELL_MANASTORM);
            ManaStorm_Timer = 7500 + rand()%5000;
        } else ManaStorm_Timer -= diff;

        //Reflect_Timer
        if (Reflect_Timer <= diff)
        {
            DoCast(me,SPELL_REFLECT);
            Reflect_Timer = 20000 + rand()%15000;
        } else Reflect_Timer -= diff;

        //Cleave_Timer
        if (Cleave_Timer <= diff)
        {
            DoCast(me->getVictim(),SPELL_CLEAVE);
            Cleave_Timer = 7000;
        } else Cleave_Timer -= diff;

        //Enrage_Timer
        if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged)
        {
            DoCast(me, SPELL_ENRAGE);
            Enraged = true;
        }

        DoMeleeAttackIfReady();
    }