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

        // Pounding
        if (Pounding_Timer <= diff)
        {
            DoCast(m_creature->getVictim(), SPELL_POUNDING);

            DoScriptText(RAND(SAY_POUNDING1,SAY_POUNDING2), m_creature);
            Pounding_Timer = 15000;                         //cast time(3000) + cooldown time(12000)
        } else Pounding_Timer -= diff;

        // Arcane Orb
        if (ArcaneOrb_Timer <= diff)
        {
            Unit *pTarget = NULL;
            std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
            std::vector<Unit *> target_list;
            for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
            {
                pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
                if (!pTarget)
                    continue;

                // exclude pets & totems
                if (pTarget->GetTypeId() != TYPEID_PLAYER)
                    continue;

                //18 yard radius minimum
                if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->isAlive() && !pTarget->IsWithinDist(m_creature, 18, false))
                    target_list.push_back(pTarget);
                pTarget = NULL;
            }

            if (target_list.size())
                pTarget = *(target_list.begin()+rand()%target_list.size());
            else
                pTarget = m_creature->getVictim();

            if (pTarget)
                m_creature->CastSpell(pTarget->GetPositionX(),pTarget->GetPositionY(),pTarget->GetPositionZ(), SPELL_ARCANE_ORB, false, NULL, NULL, NULL, pTarget);

            ArcaneOrb_Timer = 3000;
        } else ArcaneOrb_Timer -= diff;

        // Single Target knock back, reduces aggro
        if (KnockAway_Timer <= diff)
        {
            DoCast(m_creature->getVictim(), SPELL_KNOCK_AWAY);

            //Drop 25% aggro
            if (DoGetThreat(m_creature->getVictim()))
                DoModifyThreatPercent(m_creature->getVictim(),-25);

            KnockAway_Timer = 30000;
        } else KnockAway_Timer -= diff;

        //Berserk
        if (Berserk_Timer < diff && !Enraged)
        {
            DoCast(m_creature, SPELL_BERSERK);
            Enraged = true;
        } else Berserk_Timer -= diff;

        DoMeleeAttackIfReady();

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

        if (PhaseTwo)
        {
            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            me->setDeathState(JUST_DIED);
            me->SetHealth(0);
            me->GetMotionMaster()->Clear();
            me->clearUnitState(UNIT_STAT_ALL_STATE);
            me->LoadCreaturesAddon(true);
            return;
        }

        if (ZathDead)
            return;

        // Resurrect
        if (ThekalDead || LorkhanDead)
            if (!IsResurrecting && (CheckDeath_Timer - 2000) <= diff)
            {
                if (LorkhanDead)
                    if (Unit* pLorkhan = Unit::GetUnit(*me, LorkhanGUID))
                        pLorkhan->CastSpell(pLorkhan, SPELL_RESURRECT, false, 0, 0, pLorkhan->GetGUID());
                if (ThekalDead)
                    if (Unit* pThekal = Unit::GetUnit(*me, ThekalGUID))
                        pThekal->CastSpell(pThekal, SPELL_RESURRECT, false, 0, 0, pThekal->GetGUID());
                IsResurrecting = true;
            }
            else
            if (LorkhanDead && ThekalDead)
                CheckDeath_Timer -= diff;

        // Sweeping Strikes Timer
        if (SweepingStrikes_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_SWEEPINGSTRIKES);
            SweepingStrikes_Timer = 22000 + rand()%4000;
        }
        else
            SweepingStrikes_Timer -= diff;

        // Sinister Strike Timer
        if (SinisterStrike_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_SINISTERSTRIKE);
            SinisterStrike_Timer = 8000 + rand()%8000;
        }
        else
            SinisterStrike_Timer -= diff;

        // Gouge Timer
        if (Gouge_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_GOUGE);

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

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

        // Kick Timer
        if (Kick_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_KICK);
            Kick_Timer = 15000 + rand()%10000;
        }
        else
            Kick_Timer -= diff;

        // Blind Timer
        if (Blind_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_BLIND);
            Blind_Timer = 10000 + rand()%10000;
        }
        else
            Blind_Timer -= diff;

        DoMeleeAttackIfReady();
    }
Esempio n. 3
0
 void _ResetThreat(Unit* target)
 {
     DoModifyThreatPercent(target, -100);
     me->AddThreat(target, _tempThreat);
 }
Esempio n. 4
0
        void UpdateAI(const uint32 diff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

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

            //Summon 1-3 Spawns of Fankriss at random time.
            if (SpawnSpawns_Timer <= diff)
            {
                switch (urand(0, 2))
                {
                    case 0:
                        SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0));
                        break;
                    case 1:
                        SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0));
                        SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0));
                        break;
                    case 2:
                        SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0));
                        SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0));
                        SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0));
                        break;
                }
                SpawnSpawns_Timer = 30000 + rand()%30000;
            } else SpawnSpawns_Timer -= diff;

            // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer.
            //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot.
            if (HealthAbovePct(3))
            {
                if (SpawnHatchlings_Timer <= diff)
                {
                    Unit *pTarget = NULL;
                    pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                    if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
                    {
                        DoCast(pTarget, SPELL_ROOT);

                        if (DoGetThreat(pTarget))
                            DoModifyThreatPercent(pTarget, -100);

                        switch(urand(0, 2))
                        {
                            case 0:
                                DoTeleportPlayer(pTarget, -8106.0142f, 1289.2900f, -74.419533f, 5.112f);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                break;
                            case 1:
                                DoTeleportPlayer(pTarget, -7990.135354f, 1155.1907f, -78.849319f, 2.608f);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                break;
                            case 2:
                                DoTeleportPlayer(pTarget, -8159.7753f, 1127.9064f, -76.868660f, 0.675f);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Hatchling)
                                    Hatchling->AI()->AttackStart(pTarget);
                                break;
                        }
                    }
                    SpawnHatchlings_Timer = 45000 + rand()%15000;
                } else SpawnHatchlings_Timer -= diff;
            }

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

        if(!m_creature->HasAura(SPELL_BERSERK, 0))
        {
            if(EnrageTimer < diff)
            {
                DoCast(m_creature, SPELL_BERSERK);
                switch(rand()%2)
                {
                case 0: DoScriptText(SAY_ENRAGE1, m_creature); break;
                case 1: DoScriptText(SAY_ENRAGE2, m_creature); break;
                }
            }else EnrageTimer -= diff;
        }

        if(ArcingSmashTimer < diff)
        {
            DoCast(m_creature->getVictim(),Phase1 ? SPELL_ARCING_SMASH_1 : SPELL_ARCING_SMASH_2);
            ArcingSmashTimer = 10000;
        }else ArcingSmashTimer -= diff;

        if(FelBreathTimer < diff)
        {
            DoCast(m_creature->getVictim(),Phase1 ? SPELL_FELBREATH_1 : SPELL_FELBREATH_2);
            FelBreathTimer = 25000;
        }else FelBreathTimer -= diff;

        if(EjectTimer < diff)
        {
            DoCast(m_creature->getVictim(),Phase1 ? SPELL_EJECT_1 : SPELL_EJECT_2);
            EjectTimer = 15000;
        }else EjectTimer -= diff;


        if(Charge_Timer < diff)
        {
            if(m_creature->GetDistance2d(m_creature->getVictim()) > 15)
                DoCast(m_creature->getVictim(),SPELL_CHARGE);
            Charge_Timer = 10000;
        }else Charge_Timer -= diff;

        if(Phase1)
        {
            if(BewilderingStrikeTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_BEWILDERING_STRIKE);
                BewilderingStrikeTimer = 20000;
            }else BewilderingStrikeTimer -= diff;

            if(BloodboilTimer < diff)
            {
                if(BloodboilCount < 5)                      // Only cast it five times.
                {
                    CastBloodboil(); // Causes issues on windows, so is commented out.
                    //DoCast(m_creature->getVictim(), SPELL_BLOODBOIL);
                    ++BloodboilCount;
                    BloodboilTimer = 10000;
                }
            }else BloodboilTimer -= diff;
        }

        if(!Phase1)
        {
            if(FelGeyserTimer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_FEL_GEYSER);
                FelGeyserTimer = 30000;
            }else FelGeyserTimer -= diff;

            if(m_creature->getVictim()->IsImmunedToDamage(SPELL_SCHOOL_MASK_ALL,true))
                m_creature->getThreatManager().modifyThreatPercent(m_creature->getVictim(),-100);
        }

        if(PhaseChangeTimer < diff)
        {
            if(Phase1)
            {
                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0,100,true);
                if(target && target->isAlive())
                {
                    Phase1 = false;

                    TargetThreat = DoGetThreat(target);
                    TargetGUID = target->GetGUID();
                    if(DoGetThreat(target))
                        DoModifyThreatPercent(target, -100);
                    m_creature->AddThreat(target, 50000000.0f);
                    target->CastSpell(m_creature, SPELL_TAUNT_GURTOGG, true);
                    m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
                    m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true);

                    // If VMaps are disabled, this spell can call the whole instance
                    DoCast(m_creature, SPELL_INSIGNIFIGANCE, true);
                    DoCast(target,SPELL_FEL_RAGE_1, true);
                    DoCast(target,SPELL_FEL_RAGE_2, true);
                    DoCast(target,SPELL_FEL_RAGE_3, true);
                    DoCast(target,SPELL_FEL_RAGE_SCALE, true);

                    //Cast this without triggered so that it appears in combat logs and shows visual.
                    DoCast(m_creature, SPELL_FEL_RAGE_SELF);

                    switch(rand()%2)
                    {
                    case 0: DoScriptText(SAY_SPECIAL1, m_creature); break;
                    case 1: DoScriptText(SAY_SPECIAL2, m_creature); break;
                    }

                    FelGeyserTimer = 1000;
                    PhaseChangeTimer = 30000;
                }
            }else                                           // Encounter is a loop pretty much. Phase 1 -> Phase 2 -> Phase 1 -> Phase 2 till death or enrage
            {
                if(TargetGUID)
                    RevertThreatOnTarget(TargetGUID);
                TargetGUID = 0;
                Phase1 = true;
                BloodboilTimer = 10000;
                BloodboilCount = 0;
                ArcingSmashTimer += 2000;
                FelBreathTimer += 2000;
                EjectTimer += 2000;
                PhaseChangeTimer = 65000;
                m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false);
                m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false);
            }
        }else PhaseChangeTimer -= diff;

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

            if (ArcingSmashTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCING_SMASH);
                ArcingSmashTimer = 10000;
            } else ArcingSmashTimer -= diff;

            if (FelAcidTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_FEL_ACID);
                FelAcidTimer = 25000;
            } else FelAcidTimer -= diff;

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

            if (Phase1)
            {
                if (BewilderingStrikeTimer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_BEWILDERING_STRIKE);
                    float mt_threat = DoGetThreat(me->getVictim());
                    if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1))
                        me->AddThreat(target, mt_threat);
                    BewilderingStrikeTimer = 20000;
                } else BewilderingStrikeTimer -= diff;

                if (EjectTimer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_EJECT1);
                    DoModifyThreatPercent(me->getVictim(), -40);
                    EjectTimer = 15000;
                } else EjectTimer -= diff;

                if (AcidicWoundTimer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_ACIDIC_WOUND);
                    AcidicWoundTimer = 10000;
                } else AcidicWoundTimer -= diff;

                if (BloodboilTimer <= diff)
                {
                    if (BloodboilCount < 5)                      // Only cast it five times.
                    {
                        //CastBloodboil(); // Causes issues on windows, so is commented out.
                        DoCast(me->getVictim(), SPELL_BLOODBOIL);
                        ++BloodboilCount;
                        BloodboilTimer = 10000*BloodboilCount;
                    }
                } else BloodboilTimer -= diff;
            }

            if (!Phase1)
            {
                if (AcidGeyserTimer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_ACID_GEYSER);
                    AcidGeyserTimer = 30000;
                } else AcidGeyserTimer -= diff;

                if (EjectTimer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_EJECT2);
                    EjectTimer = 15000;
                } else EjectTimer -= diff;
            }

            if (PhaseChangeTimer <= diff)
            {
                if (Phase1)
                {
                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                    if (target && target->isAlive())
                    {
                        Phase1 = false;

                        TargetThreat = DoGetThreat(target);
                        TargetGUID = target->GetGUID();
                        target->CastSpell(me, SPELL_TAUNT_GURTOGG, true);
                        if (DoGetThreat(target))
                            DoModifyThreatPercent(target, -100);
                        me->AddThreat(target, 50000000.0f);
                        me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
                        me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
                                                                // If VMaps are disabled, this spell can call the whole instance
                        DoCast(me, SPELL_INSIGNIFIGANCE, true);
                        DoCast(target, SPELL_FEL_RAGE_TARGET, true);
                        DoCast(target, SPELL_FEL_RAGE_2, true);
                        /* These spells do not work, comment them out for now.
                        DoCast(target, SPELL_FEL_RAGE_2, true);
                        DoCast(target, SPELL_FEL_RAGE_3, true);*/

                        //Cast this without triggered so that it appears in combat logs and shows visual.
                        DoCast(me, SPELL_FEL_RAGE_SELF);

                        DoScriptText(RAND(SAY_SPECIAL1, SAY_SPECIAL2), me);

                        AcidGeyserTimer = 1000;
                        PhaseChangeTimer = 30000;
                    }
                } else                                           // Encounter is a loop pretty much. Phase 1 -> Phase 2 -> Phase 1 -> Phase 2 till death or enrage
                {
                    if (TargetGUID)
                        RevertThreatOnTarget(TargetGUID);
                    TargetGUID = 0;
                    Phase1 = true;
                    BloodboilTimer = 10000;
                    BloodboilCount = 0;
                    AcidicWoundTimer += 2000;
                    ArcingSmashTimer += 2000;
                    FelAcidTimer += 2000;
                    EjectTimer += 2000;
                    PhaseChangeTimer = 60000;
                    me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false);
                    me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false);
                }
            } else PhaseChangeTimer -= diff;

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

        if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that
        {
            EnfeebleResetHealth();
            EnfeebleResetTimer = 0;
        } else EnfeebleResetTimer -= diff;

        if (me->hasUnitState(UNIT_STAT_STUNNED))      // While shifting to phase 2 malchezaar stuns himself
            return;

        if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID())
            me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID());

        if (phase == 1)
        {
            if ((me->GetHealth()*100) / me->GetMaxHealth() < 60)
            {
                me->InterruptNonMeleeSpells(false);

                phase = 2;

                //animation
                DoCast(me, SPELL_EQUIP_AXES);

                //text
                DoScriptText(SAY_AXE_TOSS1, me);

                //passive thrash aura
                DoCast(me, SPELL_THRASH_AURA, true);

                //models
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, AXE_EQUIP_MODEL);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, AXE_EQUIP_INFO);

                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY+1, AXE_EQUIP_MODEL);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, AXE_EQUIP_INFO);

                //damage
                const CreatureInfo *cinfo = me->GetCreatureInfo();
                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg);
                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg);
                me->UpdateDamagePhysical(BASE_ATTACK);

                me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg);
                me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg);
                //Sigh, updating only works on main attack, do it manually ....
                me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg);
                me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg);

                me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100);
            }
        }
        else if (phase == 2)
        {
            if ((me->GetHealth()*100) / me->GetMaxHealth() < 30)
            {
                InfernalTimer = 15000;

                phase = 3;

                ClearWeapons();

                //remove thrash
                me->RemoveAurasDueToSpell(SPELL_THRASH_AURA);

                DoScriptText(SAY_AXE_TOSS2, me);

                Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                for (uint8 i = 0; i < 2; ++i)
                {
                    Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
                    if (axe)
                    {
                        axe->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, AXE_EQUIP_MODEL);
                        axe->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, AXE_EQUIP_INFO);

                        axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        axe->setFaction(me->getFaction());
                        axes[i] = axe->GetGUID();
                        if (pTarget)
                        {
                            axe->AI()->AttackStart(pTarget);
                            //axe->getThreatManager().tauntApply(pTarget); //Taunt Apply and fade out does not work properly
                                                            // So we'll use a hack to add a lot of threat to our target
                            axe->AddThreat(pTarget, 10000000.0f);
                        }
                    }
                }

                if (ShadowNovaTimer > 35000)
                    ShadowNovaTimer = EnfeebleTimer + 5000;

                return;
            }

            if (SunderArmorTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_SUNDER_ARMOR);
                SunderArmorTimer = urand(10000,18000);

            } else SunderArmorTimer -= diff;

            if (Cleave_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_CLEAVE);
                Cleave_Timer = urand(6000,12000);

            } else Cleave_Timer -= diff;
        }
        else
        {
            if (AxesTargetSwitchTimer <= diff)
            {
                AxesTargetSwitchTimer = urand(7500,20000);

                if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                {
                    for (uint8 i = 0; i < 2; ++i)
                    {
                        if (Unit *axe = Unit::GetUnit(*me, axes[i]))
                        {
                            if (axe->getVictim())
                                DoModifyThreatPercent(axe->getVictim(), -100);
                            if (pTarget)
                                axe->AddThreat(pTarget, 1000000.0f);
                            //axe->getThreatManager().tauntFadeOut(axe->getVictim());
                            //axe->getThreatManager().tauntApply(pTarget);
                        }
                    }
                }
            } else AxesTargetSwitchTimer -= diff;

            if (AmplifyDamageTimer <= diff)
            {
                if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(pTarget, SPELL_AMPLIFY_DAMAGE);
                AmplifyDamageTimer = urand(20000,30000);
            } else AmplifyDamageTimer -= diff;
        }

        //Time for global and double timers
        if (InfernalTimer <= diff)
        {
            SummonInfernal(diff);
            InfernalTimer = phase == 3 ? 14500 : 44500;    // 15 secs in phase 3, 45 otherwise
        } else InfernalTimer -= diff;

        if (ShadowNovaTimer <= diff)
        {
            DoCast(me->getVictim(), SPELL_SHADOWNOVA);
            ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1);
        } else ShadowNovaTimer -= diff;

        if (phase != 2)
        {
            if (SWPainTimer <= diff)
            {
                Unit *pTarget = NULL;
                if (phase == 1)
                    pTarget = me->getVictim();        // the tank
                else                                          // anyone but the tank
                    pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);

                if (pTarget)
                    DoCast(pTarget, SPELL_SW_PAIN);

                SWPainTimer = 20000;
            } else SWPainTimer -= diff;
        }

        if (phase != 3)
        {
            if (EnfeebleTimer <= diff)
            {
                EnfeebleHealthEffect();
                EnfeebleTimer = 30000;
                ShadowNovaTimer = 5000;
                EnfeebleResetTimer = 9000;
            } else EnfeebleTimer -= diff;
        }

        if (phase == 2)
            DoMeleeAttacksIfReady();
        else
            DoMeleeAttackIfReady();
    }
        void UpdateAI(uint32 diff) override
        {
            if (!UpdateVictim())
                return;

            if (EnfeebleResetTimer && EnfeebleResetTimer <= diff) // Let's not forget to reset that
            {
                EnfeebleResetHealth();
                EnfeebleResetTimer = 0;
            } else EnfeebleResetTimer -= diff;

            if (me->HasUnitState(UNIT_STATE_STUNNED))      // While shifting to phase 2 malchezaar stuns himself
                return;

            if (me->GetVictim() && me->GetTarget() != me->EnsureVictim()->GetGUID())
                me->SetTarget(me->EnsureVictim()->GetGUID());

            if (phase == 1)
            {
                if (HealthBelowPct(60))
                {
                    me->InterruptNonMeleeSpells(false);

                    phase = 2;

                    //animation
                    DoCast(me, SPELL_EQUIP_AXES);

                    //text
                    Talk(SAY_AXE_TOSS1);

                    //passive thrash aura
                    DoCast(me, SPELL_THRASH_AURA, true);

                    //models
                    SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE);

                    me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100);
                    me->SetCanDualWield(true);
                }
            }
            else if (phase == 2)
            {
                if (HealthBelowPct(30))
                {
                    InfernalTimer = 15000;

                    phase = 3;

                    ClearWeapons();

                    //remove thrash
                    me->RemoveAurasDueToSpell(SPELL_THRASH_AURA);

                    Talk(SAY_AXE_TOSS2);

                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
                    for (uint8 i = 0; i < 2; ++i)
                    {
                        Creature* axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
                        if (axe)
                        {
                            axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                            axe->setFaction(me->getFaction());
                            axes[i] = axe->GetGUID();
                            if (target)
                            {
                                axe->AI()->AttackStart(target);
                                //axe->getThreatManager().tauntApply(target); //Taunt Apply and fade out does not work properly
                                                                // So we'll use a hack to add a lot of threat to our target
                                axe->AddThreat(target, 10000000.0f);
                            }
                        }
                    }

                    if (ShadowNovaTimer > 35000)
                        ShadowNovaTimer = EnfeebleTimer + 5000;

                    return;
                }

                if (SunderArmorTimer <= diff)
                {
                    DoCastVictim(SPELL_SUNDER_ARMOR);
                    SunderArmorTimer = urand(10000, 18000);
                } else SunderArmorTimer -= diff;

                if (Cleave_Timer <= diff)
                {
                    DoCastVictim(SPELL_CLEAVE);
                    Cleave_Timer = urand(6000, 12000);
                } else Cleave_Timer -= diff;
            }
            else
            {
                if (AxesTargetSwitchTimer <= diff)
                {
                    AxesTargetSwitchTimer = urand(7500, 20000);

                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    {
                        for (uint8 i = 0; i < 2; ++i)
                        {
                            if (Unit* axe = ObjectAccessor::GetUnit(*me, axes[i]))
                            {
                                if (axe->GetVictim())
                                    DoModifyThreatPercent(axe->GetVictim(), -100);
                                if (target)
                                    axe->AddThreat(target, 1000000.0f);
                                //axe->getThreatManager().tauntFadeOut(axe->GetVictim());
                                //axe->getThreatManager().tauntApply(target);
                            }
                        }
                    }
                } else AxesTargetSwitchTimer -= diff;

                if (AmplifyDamageTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_AMPLIFY_DAMAGE);
                    AmplifyDamageTimer = urand(20000, 30000);
                } else AmplifyDamageTimer -= diff;
            }

            //Time for global and double timers
            if (InfernalTimer <= diff)
            {
                SummonInfernal(diff);
                InfernalTimer = phase == 3 ? 14500 : 44500;    // 15 secs in phase 3, 45 otherwise
            } else InfernalTimer -= diff;

            if (ShadowNovaTimer <= diff)
            {
                DoCastVictim(SPELL_SHADOWNOVA);
                ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1);
            } else ShadowNovaTimer -= diff;

            if (phase != 2)
            {
                if (SWPainTimer <= diff)
                {
                    Unit* target = NULL;
                    if (phase == 1)
                        target = me->GetVictim();        // the tank
                    else                                          // anyone but the tank
                        target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);

                    if (target)
                        DoCast(target, SPELL_SW_PAIN);

                    SWPainTimer = 20000;
                } else SWPainTimer -= diff;
            }

            if (phase != 3)
            {
                if (EnfeebleTimer <= diff)
                {
                    EnfeebleHealthEffect();
                    EnfeebleTimer = 30000;
                    ShadowNovaTimer = 5000;
                    EnfeebleResetTimer = 9000;
                } else EnfeebleTimer -= diff;
            }

            if (phase == 2)
                DoMeleeAttacksIfReady();
            else
                DoMeleeAttackIfReady();
        }
        void UpdateAI(const uint32 diff)
        {
            // World Notify Cooldown
            if (notifyCooldown >= diff)
                notifyCooldown -= diff;
            else
                notifyCooldown = 0;

            if (!UpdateVictim())
                return;

            // Defender Quest Credit
            if (!defenderCredit)
                if (me->getThreatManager().getThreatList().size() >= 5 && me->GetHealthPct() < 90.f) // Anti-Farming Conditions
                    defenderCredit = true;

            // Boss rescaling
            if (rescaleTimer <= diff)
            {
                HandleScaling();
                rescaleTimer = 10000;
            } else rescaleTimer -= diff;

            events.Update(diff);

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case SPELL_BLIZZARD:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
                            DoCast(target, SPELL_BLIZZARD);
                        events.ScheduleEvent(SPELL_BLIZZARD, urand(15000, 18000));
                        break;
                    case SPELL_FIRE_BLAST:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true))
                            DoCast(target, SPELL_FIRE_BLAST);
                        events.ScheduleEvent(SPELL_FIRE_BLAST, urand(5000, 8000));
                        break;
                    case SPELL_FIREBALL:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
                            DoCast(target, SPELL_FIREBALL);
                        events.ScheduleEvent(SPELL_FIREBALL, urand(7000, 10000));
                        break;
                    case SPELL_SUMMON_WATER_ELEMENT:
                        if (Summons.size() < 4)
                            DoCast(me, SPELL_SUMMON_WATER_ELEMENT);
                        events.ScheduleEvent(SPELL_SUMMON_WATER_ELEMENT, urand(20000, 30000));
                        break;
                    case SPELL_TELEPORT:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 50.0f, true))
                        {
                            DoModifyThreatPercent(target, 100); // Delete Target from Threat List
                            DoCast(target, SPELL_TELEPORT);
                        }
                        events.ScheduleEvent(SPELL_TELEPORT, urand(37000, 52000));
                        break;
                }
            }

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

            //ArcaneMissiles_Timer
            if (ArcaneMissiles_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCANEMISSILES);
                ArcaneMissiles_Timer = 8000;
            }
            else
                ArcaneMissiles_Timer -= diff;

            //ShadowShield_Timer
            if (ShadowShield_Timer <= diff)
            {
                DoCast(me, SPELL_SHADOWSHIELD);
                ShadowShield_Timer = urand(14000, 28000);
            }
            else
                ShadowShield_Timer -= diff;

            //Curse_Timer
            if (Curse_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_CURSE);
                Curse_Timer = urand(15000, 27000);
            }
            else
                Curse_Timer -= diff;

            //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer.
            //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot.
            if (HealthAbovePct(3))
            {
                if (Teleport_Timer <= diff)
                {
                    Unit* target = NULL;
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                    if (target && target->GetTypeId() == TYPEID_PLAYER)
                    {
                        if (DoGetThreat(target))
                            DoModifyThreatPercent(target, -100);

                        Creature* Summoned = NULL;
                        switch (rand()%6)
                        {
                        case 0:
                            DoTeleportPlayer(target, 250.0696f, 0.3921f, 84.8408f, 3.149f);
                            Summoned = me->SummonCreature(16119, 254.2325f, 0.3417f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 257.7133f, 4.0226f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 258.6702f, -2.60656f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            break;
                        case 1:
                            DoTeleportPlayer(target, 181.4220f, -91.9481f, 84.8410f, 1.608f);
                            Summoned = me->SummonCreature(16119, 184.0519f, -73.5649f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 179.5951f, -73.7045f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 180.6452f, -78.2143f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 283.2274f, -78.1518f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            break;
                        case 2:
                            DoTeleportPlayer(target, 95.1547f, -1.8173f, 85.2289f, 0.043f);
                            Summoned = me->SummonCreature(16119, 100.9404f, -1.8016f, 85.2289f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 101.3729f, 0.4882f, 85.2289f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 101.4596f, -4.4740f, 85.2289f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            break;
                        case 3:
                            DoTeleportPlayer(target, 250.0696f, 0.3921f, 72.6722f, 3.149f);
                            Summoned = me->SummonCreature(16119, 240.34481f, 0.7368f, 72.6722f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 240.3633f, -2.9520f, 72.6722f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 240.6702f, 3.34949f, 72.6722f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            break;
                        case 4:
                            DoTeleportPlayer(target, 181.4220f, -91.9481f, 70.7734f, 1.608f);
                            Summoned = me->SummonCreature(16119, 184.0519f, -73.5649f, 70.7734f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 179.5951f, -73.7045f, 70.7734f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 180.6452f, -78.2143f, 70.7734f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 283.2274f, -78.1518f, 70.7734f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            break;
                        case 5:
                            DoTeleportPlayer(target, 106.1541f, -1.8994f, 75.3663f, 0.043f);
                            Summoned = me->SummonCreature(16119, 115.3945f, -1.5555f, 75.3663f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 257.7133f, 1.8066f, 75.3663f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            Summoned = me->SummonCreature(16119, 258.6702f, -5.1001f, 75.3663f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                            if (Summoned)
                                Summoned->AI()->AttackStart(target);
                            break;
                        }
                    }
                    Teleport_Timer = urand(20000, 35000);
                }
                else
                    Teleport_Timer -= diff;
            }
            DoMeleeAttackIfReady();
        }
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_POUNDING:
                            DoCastVictim(SPELL_POUNDING);
                            Talk(SAY_POUNDING);
                            events.ScheduleEvent(EVENT_POUNDING, 15000);
                            break;
                        case EVENT_ARCANE_ORB:
                        {
                            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 = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
                                if (!target)
                                    continue;
                                // exclude pets & totems, 18 yard radius minimum
                                if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive() && !target->IsWithinDist(me, 18, false))
                                    target_list.push_back(target);
                                target = NULL;
                            }

                            if (!target_list.empty())
                                target = *(target_list.begin() + rand32() % target_list.size());
                            else
                                target = me->GetVictim();

                            if (target)
                                me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL);

                            events.ScheduleEvent(EVENT_ARCANE_ORB, 3000);
                            break;
                        }
                        case EVENT_KNOCK_AWAY:
                            DoCastVictim(SPELL_KNOCK_AWAY);
                            // Drop 25% aggro
                            if (DoGetThreat(me->GetVictim()))
                                DoModifyThreatPercent(me->GetVictim(), -25);

                            events.ScheduleEvent(EVENT_KNOCK_AWAY, 30000);
                            break;
                        case EVENT_BERSERK:
                            if (!Enraged)
                            {
                                DoCast(me, SPELL_BERSERK);
                                Enraged = true;
                            }
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();

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

        // Pounding
        if(Pounding_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_POUNDING);

            switch(rand()%2)
            {
            case 0: DoScriptText(SAY_POUNDING1, m_creature); break;
            case 1: DoScriptText(SAY_POUNDING2, m_creature); break;
            }
             Pounding_Timer = 15000;                         //cast time(3000) + cooldown time(12000)
        }else Pounding_Timer -= diff;

        // Arcane Orb
        if(ArcaneOrb_Timer < diff)
        {
            Unit *target = NULL;
            std::list<HostilReference *> t_list = m_creature->getThreatManager().getThreatList();
            std::vector<Unit *> target_list;
            for(std::list<HostilReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
            {
                target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
                                                            //18 yard radius minimum
                if(target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive() && target->GetDistance2d(m_creature) >= 18)
                    target_list.push_back(target);
                target = NULL;
            }
            if(target_list.size())
                target = *(target_list.begin()+rand()%target_list.size());

            if (target)
                m_creature->CastSpell(target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(), SPELL_ARCANE_ORB, false);

            ArcaneOrb_Timer = 3000;
        }else ArcaneOrb_Timer -= diff;

        // Single Target knock back, reduces aggro
        if(KnockAway_Timer < diff)
        {
            DoCast(m_creature->getVictim(),SPELL_KNOCK_AWAY);

            //Drop 25% aggro
            if(DoGetThreat(m_creature->getVictim()))
                DoModifyThreatPercent(m_creature->getVictim(),-25);

            KnockAway_Timer = 30000;
        }else KnockAway_Timer -= diff;

        //Berserk
        if(Berserk_Timer < diff && !Enraged)
        {
            DoCast(m_creature,SPELL_BERSERK);
            Enraged = true;
        }else Berserk_Timer -= diff;

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

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SPAWN_START_SPIDERS:

                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                Talk(SAY_SPIDER_SPAWN);
                                Creature* Spider = NULL;
                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Spider)
                                    Spider->AI()->AttackStart(target);
                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Spider)
                                    Spider->AI()->AttackStart(target);
                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Spider)
                                    Spider->AI()->AttackStart(target);
                                Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Spider)
                                    Spider->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO);
                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO);
                            events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000);
                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000);
                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO);
                            events.SetPhase(PHASE_TWO);
                            break;
                        case EVENT_POISON_VOLLEY:
                            DoCastVictim(SPELL_POISON_VOLLEY, true);
                            events.ScheduleEvent(EVENT_POISON_VOLLEY, urand(10000, 20000));
                            break;
                        case EVENT_ASPECT_OF_MARLI:
                            DoCastVictim(SPELL_ASPECT_OF_MARLI, true);
                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, urand(13000, 18000), 0, PHASE_TWO);
                            break;
                        case EVENT_SPAWN_SPIDER:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Spider)
                                    Spider->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, urand(12000, 17000));
                            break;
                        case EVENT_TRANSFORM:
                            {
                                Talk(SAY_TRANSFORM);
                                DoCast(me, SPELL_SPIDER_FORM);
                                const CreatureTemplate* cinfo = me->GetCreatureTemplate();
                                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
                                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
                                me->UpdateDamagePhysical(BASE_ATTACK);
                                DoCast(me->getVictim(), SPELL_ENVOLWINGWEB);
                                if (DoGetThreat(me->getVictim()))
                                    DoModifyThreatPercent(me->getVictim(), -100);
                                events.ScheduleEvent(EVENT_CHARGE_PLAYER, 1500, 0, PHASE_THREE);
                                events.ScheduleEvent(EVENT_TRANSFORM_BACK, 25000, 0, PHASE_THREE);
                                events.SetPhase(PHASE_THREE);
                                break;
                            }
                        case EVENT_CHARGE_PLAYER:
                            {
                                Unit* target = NULL;
                                int i = 0;
                                while (i < 3) // max 3 tries to get a random target with power_mana
                                {
                                    ++i;
                                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);  // not aggro leader
                                    if (target && target->getPowerType() == POWER_MANA)
                                        i = 3;
                                }
                                if (target)
                                {
                                    DoCast(target, SPELL_CHARGE);
                                    //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
                                    //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1);
                                    AttackStart(target);
                                }
                                events.ScheduleEvent(EVENT_CHARGE_PLAYER, 8000, 0, PHASE_THREE);
                                break;
                            }
                        case EVENT_TRANSFORM_BACK:
                            {
                                me->SetDisplayId(MODEL_MARLI);
                                const CreatureTemplate* cinfo = me->GetCreatureTemplate();
                                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1)));
                                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1)));
                                me->UpdateDamagePhysical(BASE_ATTACK);
                                events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO);
                                events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO);
                                events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000);
                                events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000);
                                events.ScheduleEvent(EVENT_TRANSFORM, urand(35000, 60000), 0, PHASE_TWO);
                                events.SetPhase(PHASE_TWO);
                                break;
                            }
                        default:
                            break;
                    }
                }

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

        if( m_creature->getVictim() && m_creature->isAlive())
        {
            if (!PhaseTwo && ShadowWordPain_Timer < diff)
            {
                DoCast(m_creature->getVictim(),SPELL_SHADOWWORDPAIN);
                ShadowWordPain_Timer = 15000;
            }else ShadowWordPain_Timer -= diff;

            if (!PhaseTwo && Mark_Timer < diff)
            {
                markedTarget = SelectUnit(SELECT_TARGET_RANDOM,0);

                DoCast(markedTarget,SPELL_MARK);
                Mark_Timer = 15000;
            }else Mark_Timer -= diff;

            if (Summon_Timer < diff && Counter < 31)
            {
                Unit* target = NULL;
                target = SelectUnit(SELECT_TARGET_RANDOM,0);

                Panther = m_creature->SummonCreature(15101,-11532.79980,-1649.6734,41.4800,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);

                if(markedTarget && Panther )
                {
                    DoScriptText(SAY_FEAST_PANTHER, m_creature, markedTarget);
                    Panther ->AI()->AttackStart(markedTarget);
                }else if(Panther && target) Panther ->AI()->AttackStart(target);

                Panther = m_creature->SummonCreature(15101,-11532.9970,-1606.4840,41.2979,0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);

                if(markedTarget && Panther )
                    Panther ->AI()->AttackStart(markedTarget);
                else if(Panther && target)
                     Panther ->AI()->AttackStart(target);

                Counter++;
                Summon_Timer = 5000;
            }else Summon_Timer -= diff;

            if (Vanish_Timer < diff)
            {
                //Invisble Model
                m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,11686);
                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                //m_creature->CombatStop();
                DoResetThreat();
                VanishedOnce = true;
                Vanish_Timer = 45000;
                Visible_Timer = 6000;
            }else Vanish_Timer -= diff;

            if (VanishedOnce)
            {
                if(Visible_Timer < diff)
                {
                    Unit* target = NULL;
                    target = SelectUnit(SELECT_TARGET_RANDOM,0);
                    //The Panther Model
                    m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,15215);
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                    const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
                    m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
                    m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
                    m_creature->UpdateDamagePhysical(BASE_ATTACK);
                    if(target)
                        AttackStart(target);
                    //The Panther Model
                    m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,15215);
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    PhaseTwo = true;
                }else Visible_Timer -= diff;
            }

            //Cleave_Timer
            if(PhaseTwo && Cleave_Timer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_CLEAVE);
                Cleave_Timer = 16000;
            }Cleave_Timer -=diff;

            //Gouge_Timer
            if(PhaseTwo && Gouge_Timer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_GOUGE);
                if(DoGetThreat(m_creature->getVictim()))
                    DoModifyThreatPercent(m_creature->getVictim(),-80);

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

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

                if (!m_bIsPhaseTwo)
                {
                    if (m_uiShadowWordPain_Timer <= uiDiff)
                    {
                        DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN);
                        m_uiShadowWordPain_Timer = 15000;
                    }
                    else
                        m_uiShadowWordPain_Timer -= uiDiff;

                    if (m_uiMark_Timer <= uiDiff)
                    {
                        Unit *pMarkedTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);

                        if (pMarkedTarget)
                        {
                            DoCast(pMarkedTarget, SPELL_MARK);
                            MarkedTargetGUID = pMarkedTarget->GetGUID();
                        }
                        else
                            sLog.outError("TSCR: boss_arlokk could not accuire pMarkedTarget.");

                        m_uiMark_Timer = 15000;
                    }
                    else
                        m_uiMark_Timer -= uiDiff;
                }
                else
                {
                    //Cleave_Timer
                    if (m_uiCleave_Timer <= uiDiff)
                    {
                        DoCast(me->getVictim(), SPELL_CLEAVE);
                        m_uiCleave_Timer = 16000;
                    }
                    else
                        m_uiCleave_Timer -= uiDiff;

                    //Gouge_Timer
                    if (m_uiGouge_Timer <= uiDiff)
                    {
                        DoCast(me->getVictim(), SPELL_GOUGE);

                        DoModifyThreatPercent(me->getVictim(), -80);

                        m_uiGouge_Timer = 17000+rand()%10000;
                    }
                    else
                        m_uiGouge_Timer -= uiDiff;
                }

                if (m_uiSummonCount <= 30)
                {
                    if (m_uiSummon_Timer <= uiDiff)
                    {
                        DoSummonPhanters();
                        m_uiSummon_Timer = 5000;
                    }
                    else
                        m_uiSummon_Timer -= uiDiff;
                }

                if (m_uiVanish_Timer <= uiDiff)
                {
                    //Invisble Model
                    me->SetDisplayId(MODEL_ID_BLANK);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                    me->AttackStop();
                    DoResetThreat();

                    m_bIsVanished = true;

                    m_uiVanish_Timer = 45000;
                    m_uiVisible_Timer = 6000;
                }
                else
                    m_uiVanish_Timer -= uiDiff;

                if (m_bIsVanished)
                {
                    if (m_uiVisible_Timer <= uiDiff)
                    {
                        //The Panther Model
                        me->SetDisplayId(MODEL_ID_PANTHER);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                        const CreatureInfo *cinfo = me->GetCreatureInfo();
                        me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
                        me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
                        me->UpdateDamagePhysical(BASE_ATTACK);

                        if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            AttackStart(pTarget);

                        m_bIsPhaseTwo = true;
                        m_bIsVanished = false;
                    }
                    else
                        m_uiVisible_Timer -= uiDiff;
                }
                else
                    DoMeleeAttackIfReady();
            }
Esempio n. 16
0
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
                return;

            //ArcaneMissiles_Timer
            if (ArcaneMissiles_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCANEMISSILES);
                ArcaneMissiles_Timer = 8000;
            } else ArcaneMissiles_Timer -= diff;

            //ShadowShield_Timer
            if (ShadowShield_Timer <= diff)
            {
                DoCast(me, SPELL_SHADOWSHIELD);
                ShadowShield_Timer = 14000 + rand()%14000;
            } else ShadowShield_Timer -= diff;

            //Curse_Timer
            if (Curse_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_CURSE);
                Curse_Timer = 15000 + rand()%12000;
            } else Curse_Timer -= diff;

            //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer.
            //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot.
            if (me->GetHealth()*100 / me->GetMaxHealth() > 3)
            {
                if (Teleport_Timer <= diff)
                {
                    Unit *pTarget = NULL;
                    pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
                    if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
                    {
                        if (DoGetThreat(pTarget))
                            DoModifyThreatPercent(pTarget, -100);

                        Creature *Summoned = NULL;
                        switch(rand()%6)
                        {
                            case 0:
                                DoTeleportPlayer(pTarget, 250.0696,0.3921,84.8408,3.149);
                                Summoned = me->SummonCreature(16119,254.2325,0.3417,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,257.7133,4.0226,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,258.6702,-2.60656,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 1:
                                DoTeleportPlayer(pTarget, 181.4220,-91.9481,84.8410,1.608);
                                Summoned = me->SummonCreature(16119,184.0519,-73.5649,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,179.5951,-73.7045,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,180.6452,-78.2143,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,283.2274,-78.1518,84.8407,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 2:
                                DoTeleportPlayer(pTarget, 95.1547,-1.8173,85.2289,0.043);
                                Summoned = me->SummonCreature(16119,100.9404,-1.8016,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,101.3729,0.4882,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,101.4596,-4.4740,85.2289,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 3:
                                DoTeleportPlayer(pTarget, 250.0696,0.3921,72.6722,3.149);
                                Summoned = me->SummonCreature(16119,240.34481,0.7368,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,240.3633,-2.9520,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,240.6702,3.34949,72.6722,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 4:
                                DoTeleportPlayer(pTarget, 181.4220,-91.9481,70.7734,1.608);
                                Summoned = me->SummonCreature(16119,184.0519,-73.5649,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,179.5951,-73.7045,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,180.6452,-78.2143,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,283.2274,-78.1518,70.7734,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 5:
                                DoTeleportPlayer(pTarget, 106.1541,-1.8994,75.3663,0.043);
                                Summoned = me->SummonCreature(16119,115.3945,-1.5555,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,257.7133,1.8066,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119,258.6702,-5.1001,75.3663,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                        }
                    }
                    Teleport_Timer = 20000 + rand()%15000;
                } else Teleport_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }
        void UpdateAI(const uint32 diff)
        {
            if (Invisible && Invisible_Timer <= diff)
            {
                //Become visible again
                me->setFaction(14);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetDisplayId(11073);     //Jandice Model
                Invisible = false;
            } else if (Invisible)
            {
                Invisible_Timer -= diff;
                //Do nothing while invisible
                return;
            }

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

            //CurseOfBlood_Timer
            if (CurseOfBlood_Timer <= diff)
            {
                //Cast
                DoCast(me->getVictim(), SPELL_CURSEOFBLOOD);

                //45 seconds
                CurseOfBlood_Timer = 30000;
            } else CurseOfBlood_Timer -= diff;

            //Illusion_Timer
            if (!Invisible && Illusion_Timer <= diff)
            {
                //Interrupt any spell casting
                me->InterruptNonMeleeSpells(false);
                me->setFaction(35);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetDisplayId(11686);  // Invisible Model
                DoModifyThreatPercent(me->getVictim(), -99);

                //Summon 10 Illusions attacking random gamers
                Unit *pTarget = NULL;
                for (uint8 i = 0; i < 10; ++i)
                {
                    pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                    if (pTarget)
                        SummonIllusions(pTarget);
                }
                Invisible = true;
                Invisible_Timer = 3000;

                //25 seconds until we should cast this agian
                Illusion_Timer = 25000;
            } else Illusion_Timer -= diff;

            //            //Illusion_Timer
            //            if (Illusion_Timer <= diff)
            //            {
            //                  //Cast
            //                DoCast(me->getVictim(), SPELL_ILLUSION);
            //
            //                  //3 Illusion will be summoned
            //                  if (Illusioncounter < 3)
            //                  {
            //                    Illusion_Timer = 500;
            //                    ++Illusioncounter;
            //                  }
            //                  else {
            //                      //15 seconds until we should cast this again
            //                      Illusion_Timer = 15000;
            //                      Illusioncounter = 0;
            //                  }
            //
            //            } else Illusion_Timer -= diff;

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

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BRAINWASHTOTEM:
                            DoCast(me, SPELL_BRAINWASHTOTEM);
                            events.ScheduleEvent(EVENT_BRAINWASHTOTEM, urand(18000, 26000));
                            break;
                        case EVENT_POWERFULLHEALINGWARD: // HACK
                            //DoCast(me, SPELL_POWERFULLHEALINGWARD);
                            me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
                            events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, urand(14000, 20000));
                            break;
                        case EVENT_HEX:
                            if (Unit* target = me->GetVictim())
                            {
                                DoCast(target, SPELL_HEX, true);
                                if (DoGetThreat(target))
                                    DoModifyThreatPercent(target, -80);
                            }
                            events.ScheduleEvent(EVENT_HEX, urand(12000, 20000));
                            break;
                        case EVENT_DELUSIONSOFJINDO: // HACK
                            // Casting the delusion curse with a shade so shade will attack the same target with the curse.
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                DoCast(target, SPELL_DELUSIONSOFJINDO);
                                Creature* Shade = me->SummonCreature(NPC_SHADE_OF_JINDO, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (Shade)
                                    Shade->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_DELUSIONSOFJINDO, urand(4000, 12000));
                            break;
                        case EVENT_TELEPORT: // Possible HACK
                            // Teleports a random player and spawns 9 Sacrificed Trolls to attack player
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                DoTeleportPlayer(target, TeleportLoc.m_positionX, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, TeleportLoc.m_orientation);
                                if (DoGetThreat(me->GetVictim()))
                                    DoModifyThreatPercent(target, -100);
                                Creature* SacrificedTroll;
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                                SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                                if (SacrificedTroll)
                                    SacrificedTroll->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_TELEPORT, urand(15000, 23000));
                            break;
                        default:
                            break;
                    }
                }

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

        //BrainWashTotem_Timer
        if (BrainWashTotem_Timer < diff)
        {
            DoCast(m_creature, SPELL_BRAINWASHTOTEM);
            BrainWashTotem_Timer = 18000 + rand()%8000;
        }
        else
            BrainWashTotem_Timer -= diff;

        //HealingWard_Timer
        if (HealingWard_Timer < diff)
        {
            DoCast(m_creature, SPELL_POWERFULLHEALINGWARD);
            HealingWard_Timer = 14000 + rand()%6000;
        }
        else
            HealingWard_Timer -= diff;

        //Hex_Timer
        if (Hex_Timer < diff)
        {
            DoCast(m_creature->getVictim(), SPELL_HEX);

            if(DoGetThreat(m_creature->getVictim()))
                DoModifyThreatPercent(m_creature->getVictim(),-80);

            Hex_Timer = 12000 + rand()%8000;
        }
        else
            Hex_Timer -= diff;

        //Casting the delusion curse with a shade. So shade will attack the same target with the curse.
        if(Delusions_Timer < diff)
        {
            if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0, GetSpellMaxRange(SPELL_DELUSIONSOFJINDO), true))
            {
                DoCast(target, SPELL_DELUSIONSOFJINDO);

                Shade = m_creature->SummonCreature(14986, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Shade)
                    Shade->AI()->AttackStart(target);
            }
            Delusions_Timer = 4000 + rand()%8000;
        }
        else
            Delusions_Timer -= diff;

        //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer
        if(Teleport_Timer < diff)
        {
            if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0, 200, true))
            {
                DoTeleportPlayer(target, -11583.7783,-1249.4278,77.5471,4.745);

                if(DoGetThreat(m_creature->getVictim()))
                    DoModifyThreatPercent(target,-100);

                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
                Skeletons = m_creature->SummonCreature(14826, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if(Skeletons)
                    Skeletons->AI()->AttackStart(target);
            }

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

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

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SPAWN_START_SPIDERS:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                Talk(SAY_SPIDER_SPAWN);
                                for (uint8 i = 0; i < 4; ++i)
                                    if (Creature* spider = me->SummonCreature(NPC_SPIDER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
                                        spider->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO);
                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO);
                            events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000);
                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000);
                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO);
                            events.SetPhase(PHASE_TWO);
                            break;
                        case EVENT_POISON_VOLLEY:
                            DoCastVictim(SPELL_POISON_VOLLEY, true);
                            events.ScheduleEvent(EVENT_POISON_VOLLEY, urand(10000, 20000));
                            break;
                        case EVENT_ASPECT_OF_MARLI:
                            DoCastVictim(SPELL_ASPECT_OF_MARLI, true);
                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, urand(13000, 18000), 0, PHASE_TWO);
                            break;
                        case EVENT_SPAWN_SPIDER:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                if (Creature* spider = me->SummonCreature(NPC_SPIDER, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
                                    spider->AI()->AttackStart(target);
                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, urand(12000, 17000));
                            break;
                        case EVENT_TRANSFORM:
                        {
                            Talk(SAY_TRANSFORM);
                            DoCast(me, SPELL_SPIDER_FORM); // SPELL_AURA_TRANSFORM
                            /*
                            CreatureTemplate const* cinfo = me->GetCreatureTemplate();
                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
                            me->UpdateDamagePhysical(BASE_ATTACK);
                            */
                            me->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, 35.0f, true); // hack
                            DoCastVictim(SPELL_ENVOLWINGWEB);
                            if (DoGetThreat(me->GetVictim()))
                                DoModifyThreatPercent(me->GetVictim(), -100);
                            events.ScheduleEvent(EVENT_CHARGE_PLAYER, 1500, 0, PHASE_THREE);
                            events.ScheduleEvent(EVENT_TRANSFORM_BACK, 25000, 0, PHASE_THREE);
                            events.SetPhase(PHASE_THREE);
                            break;
                        }
                        case EVENT_CHARGE_PLAYER:
                        {
                            Unit* target = NULL;
                            int i = 0;
                            while (i++ < 3) // max 3 tries to get a random target with power_mana
                            {
                                target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);  // not aggro leader
                                if (target && target->getPowerType() == POWER_MANA)
                                    break;
                            }
                            if (target)
                            {
                                DoCast(target, SPELL_CHARGE);
                                AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_CHARGE_PLAYER, 8000, 0, PHASE_THREE);
                            break;
                        }
                        case EVENT_TRANSFORM_BACK:
                        {
                            me->RemoveAura(SPELL_SPIDER_FORM);
                            /*
                            CreatureTemplate const* cinfo = me->GetCreatureTemplate();
                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1)));
                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1)));
                            me->UpdateDamagePhysical(BASE_ATTACK);
                            */
                            me->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, 35.0f, false); // hack
                            events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 12000, 0, PHASE_TWO);
                            events.ScheduleEvent(EVENT_TRANSFORM, 45000, 0, PHASE_TWO);
                            events.ScheduleEvent(EVENT_POISON_VOLLEY, 15000);
                            events.ScheduleEvent(EVENT_SPAWN_SPIDER, 30000);
                            events.ScheduleEvent(EVENT_TRANSFORM, urand(35000, 60000), 0, PHASE_TWO);
                            events.SetPhase(PHASE_TWO);
                            break;
                        }
                        default:
                            break;
                    }
                }

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

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BRAIN_WASH_TOTEM:
                            DoCast(me, SPELL_BRAIN_WASH_TOTEM);
                            events.ScheduleEvent(EVENT_BRAIN_WASH_TOTEM, urand(18000, 26000));
                            break;
                        case EVENT_POWERFULL_HEALING_WARD:
                            DoCast(me, SPELL_POWERFULL_HEALING_WARD);
                            events.ScheduleEvent(EVENT_POWERFULL_HEALING_WARD, urand(14000, 20000));
                            break;
                        case EVENT_HEX:
                            if (Unit* target = me->GetVictim())
                            {
                                DoCast(target, SPELL_HEX, true);
                                if (DoGetThreat(target))
                                    DoModifyThreatPercent(target, -80);
                            }
                            events.ScheduleEvent(EVENT_HEX, urand(12000, 20000));
                            break;
                        case EVENT_DELUSIONS_OF_JINDO:
                            // Casting the delusion curse with a shade so shade will attack the same target with the curse.
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                            {
                                DoCast(target, SPELL_SHADE_OF_JINDO, true);
                                DoCast(target, SPELL_DELUSIONS_OF_JINDO);
                            }
                            events.ScheduleEvent(EVENT_DELUSIONS_OF_JINDO, urand(4000, 12000));
                            break;
                        case EVENT_TELEPORT:
                            // Teleports a random player and spawns 9 Sacrificed Trolls to attack player
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                            {
                                DoTeleportPlayer(target, TeleportLoc.GetPositionX(), TeleportLoc.GetPositionY(), TeleportLoc.GetPositionZ(), TeleportLoc.GetOrientation());
                                if (DoGetThreat(me->GetVictim()))
                                    DoModifyThreatPercent(target, -100);

                                // Summon a formation of trolls
                                for (uint8 i = 0; i < 10; ++i)
                                    if (Creature* SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, Formation[i].GetPositionX(), Formation[i].GetPositionY(), Formation[i].GetPositionZ(), Formation[i].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000))
                                        SacrificedTroll->AI()->AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_TELEPORT, urand(15000, 23000));
                            break;
                        default:
                            break;
                    }
                }

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

        if (!m_bIsPhaseTwo)
        {
            if (m_uiShadowWordPain_Timer <= uiDiff)
            {
                DoCastVictim( SPELL_SHADOWWORDPAIN);
                m_uiShadowWordPain_Timer = 15000;
            }
            else
                m_uiShadowWordPain_Timer -= uiDiff;

            if (m_uiMark_Timer <= uiDiff)
            {
                Unit* pMarkedTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);

                if (pMarkedTarget)
                {
                    DoCast(pMarkedTarget, SPELL_MARK);
                    MarkedTargetGUID = pMarkedTarget->GetGUID();
                }
                else
                    error_log("OSCR: boss_arlokk could not acquire pMarkedTarget.");

                m_uiMark_Timer = 15000;
            }
            else
                m_uiMark_Timer -= uiDiff;
        }
        else
        {
            // Thrash Timer
            if (m_uiThrash_Timer <= uiDiff)
            {
                DoCast(me, SPELL_THRASH);
                m_uiThrash_Timer = urand(5000, 9000);
            }
            else
                m_uiThrash_Timer -= uiDiff;

            // Ravage Timer
            if (m_uiRavage_Timer <= uiDiff)
            {
                DoCastVictim( SPELL_RAVAGE);
                m_uiRavage_Timer = 16000;
            }
            else
                m_uiRavage_Timer -= uiDiff;

            // Whirlwind_Timer
            if (m_uiWhirlwind_Timer <= uiDiff)
            {
                DoCastVictim( SPELL_WHIRLWIND);
                m_uiWhirlwind_Timer = 16000;
            }
            else
                m_uiWhirlwind_Timer -= uiDiff;

            // Gouge_Timer
            if (m_uiGouge_Timer <= uiDiff)
            {
                DoCastVictim( SPELL_GOUGE);

                if (DoGetThreat(me->GetVictim()))
                    DoModifyThreatPercent(me->GetVictim(), -80);

                m_uiGouge_Timer = 17000 + rand() % 10000;
            }
            else
                m_uiGouge_Timer -= uiDiff;
        }

        if (m_uiSummonCount <= 30)
        {
            if (m_uiSummon_Timer <= uiDiff)
            {
                DoSummonPhanters();
                m_uiSummon_Timer = 5000;
            }
            else
                m_uiSummon_Timer -= uiDiff;
        }

        if (m_uiVanish_Timer <= uiDiff)
        {
            // Invisible Model
            me->SetDisplayId(MODEL_ID_BLANK);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

            me->AttackStop();
            DoResetThreat();

            m_bIsVanished = true;

            m_uiVanish_Timer = 45000;
            m_uiVisible_Timer = 6000;
        }
        else
            m_uiVanish_Timer -= uiDiff;

        if (m_bIsVanished)
        {
            if (m_uiVisible_Timer <= uiDiff)
            {
                // The Panther Model
                me->SetDisplayId(MODEL_ID_PANTHER);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                const CreatureInfo* cinfo = me->GetCreatureTemplate();
                CreatureBaseStats const* cCLS = sObjectMgr.GetCreatureClassLvlStats(me->getLevel(), cinfo->unit_class, cinfo->exp);
                float basedamage = cCLS->BaseDamage;

                float weaponBaseMinDamage = basedamage;
                float weaponBaseMaxDamage = basedamage * 1.5;

                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (weaponBaseMinDamage + ((weaponBaseMinDamage / 100) * 35)));
                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (weaponBaseMaxDamage + ((weaponBaseMaxDamage / 100) * 35)));
                me->UpdateDamagePhysical(BASE_ATTACK);

                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                {
                    AttackStart(pTarget);
                    DoCast(pTarget, SPELL_BACKSTAB);
                }

                m_bIsPhaseTwo = true;
                m_bIsVanished = false;
                me->SetObjectScale(1.7f);
            }
            else
                m_uiVisible_Timer -= uiDiff;
        }
        else
            DoMeleeAttackIfReady();
    }
Esempio n. 23
0
            void UpdateAI(const uint32 diff)
            {
                if (!UpdateVictim())
                    return;

                if (me->getVictim() && me->isAlive())
                {
                    if (PoisonVolley_Timer <= diff)
                    {
                        DoCast(me->getVictim(), SPELL_POISONVOLLEY);
                        PoisonVolley_Timer = urand(10000, 20000);
                    } else PoisonVolley_Timer -= diff;

                    if (!PhaseTwo && Aspect_Timer <= diff)
                    {
                        DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI);
                        Aspect_Timer = urand(13000, 18000);
                    } else Aspect_Timer -= diff;

                    if (!Spawned && SpawnStartSpiders_Timer <= diff)
                    {
                        DoScriptText(SAY_SPIDER_SPAWN, me);

                        Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                        if (!target)
                            return;

                        Creature* Spider = NULL;

                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Spider)
                            Spider->AI()->AttackStart(target);
                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Spider)
                            Spider->AI()->AttackStart(target);
                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Spider)
                            Spider->AI()->AttackStart(target);
                        Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Spider)
                            Spider->AI()->AttackStart(target);

                        Spawned = true;
                    } else SpawnStartSpiders_Timer -= diff;

                    if (SpawnSpider_Timer <= diff)
                    {
                        Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                        if (!target)
                            return;

                        Creature* Spider = me->SummonCreature(15041, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Spider)
                            Spider->AI()->AttackStart(target);
                        SpawnSpider_Timer = urand(12000, 17000);
                    } else SpawnSpider_Timer -= diff;

                    if (!PhaseTwo && Transform_Timer <= diff)
                    {
                        DoScriptText(SAY_TRANSFORM, me);
                        DoCast(me, SPELL_SPIDER_FORM);
                        const CreatureTemplate* cinfo = me->GetCreatureInfo();
                        me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35)));
                        me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35)));
                        me->UpdateDamagePhysical(BASE_ATTACK);
                        DoCast(me->getVictim(), SPELL_ENVOLWINGWEB);

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

                        PhaseTwo = true;
                        Transform_Timer = urand(35000, 60000);
                    } else Transform_Timer -= diff;

                    if (PhaseTwo)
                    {
                        if (Charge_Timer <= diff)
                        {
                            Unit* target = NULL;
                            int i = 0;
                            while (i < 3)                           // max 3 tries to get a random target with power_mana
                            {
                                ++i;
                                target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);  // not aggro leader
                                if (target && target->getPowerType() == POWER_MANA)
                                        i = 3;
                            }
                            if (target)
                            {
                                DoCast(target, SPELL_CHARGE);
                                //me->SetPosition(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
                                //me->SendMonsterMove(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, true, 1);
                                AttackStart(target);
                            }

                            Charge_Timer = 8000;
                        } else Charge_Timer -= diff;

                        if (TransformBack_Timer <= diff)
                        {
                            me->SetDisplayId(15220);
                            const CreatureTemplate* cinfo = me->GetCreatureInfo();
                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1)));
                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1)));
                            me->UpdateDamagePhysical(BASE_ATTACK);

                            PhaseTwo = false;
                            TransformBack_Timer = urand(25000, 40000);
                        } else TransformBack_Timer -= diff;

                    }

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

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

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

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

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

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

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

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

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

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

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

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

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

                if (pTarget)
                    AttackStart(pTarget);

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

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

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

                //SweepingStrikes_Timer
                if (SweepingStrikes_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_SWEEPINGSTRIKES);
                    SweepingStrikes_Timer = 22000+rand()%4000;
                } else SweepingStrikes_Timer -= diff;

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

                //Gouge_Timer
                if (Gouge_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_GOUGE);

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

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

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

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

                //Check_Timer for the death of LorKhan and Zath.
                if (!FakeDeath && Check_Timer <= diff)
                {
                    if (m_pInstance)
                    {
                        if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL)
                        {
                            //Resurrect LorKhan
                            if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN)))
                            {
                                pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                pLorKhan->setFaction(14);
                                pLorKhan->SetFullHealth();
                            }
                        }

                        if (m_pInstance->GetData(TYPE_THEKAL) == SPECIAL)
                        {
                            //Resurrect Thekal
                            if (Unit *pThekal = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_THEKAL)))
                            {
                                pThekal->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                pThekal->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                pThekal->setFaction(14);
                                pThekal->SetFullHealth();
                            }
                        }
                    }

                    Check_Timer = 5000;
                } else Check_Timer -= diff;

                if (!HealthAbovePct(5))
                {
                    me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
                    me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
                    me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    me->SetStandState(UNIT_STAND_STATE_SLEEP);
                    me->setFaction(35);
                    me->AttackStop();

                    if (m_pInstance)
                        m_pInstance->SetData(TYPE_ZATH, SPECIAL);

                    FakeDeath = true;
                }

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

                //BrainWashTotem_Timer
                if (BrainWashTotem_Timer <= diff)
                {
                    DoCast(me, SPELL_BRAINWASHTOTEM);
                    BrainWashTotem_Timer = urand(18000, 26000);
                } else BrainWashTotem_Timer -= diff;

                //HealingWard_Timer
                if (HealingWard_Timer <= diff)
                {
                    //DoCast(me, SPELL_POWERFULLHEALINGWARD);
                    me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000);
                    HealingWard_Timer = urand(14000, 20000);
                } else HealingWard_Timer -= diff;

                //Hex_Timer
                if (Hex_Timer <= diff)
                {
                    DoCast(me->getVictim(), SPELL_HEX);

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

                    Hex_Timer = urand(12000, 20000);
                } else Hex_Timer -= diff;

                //Casting the delusion curse with a shade. So shade will attack the same target with the curse.
                if (Delusions_Timer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                    {
                        DoCast(target, SPELL_DELUSIONSOFJINDO);

                        Creature* Shade = me->SummonCreature(14986, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Shade)
                            Shade->AI()->AttackStart(target);
                    }

                    Delusions_Timer = urand(4000, 12000);
                } else Delusions_Timer -= diff;

                //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer
                if (Teleport_Timer <= diff)
                {
                    Unit* target = NULL;
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0);
                    if (target && target->GetTypeId() == TYPEID_PLAYER)
                    {
                        DoTeleportPlayer(target, -11583.7783f, -1249.4278f, 77.5471f, 4.745f);

                        if (DoGetThreat(me->getVictim()))
                            DoModifyThreatPercent(target, -100);

                        Creature* Skeletons;
                        Skeletons = me->SummonCreature(14826, target->GetPositionX()+2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX()-2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX()+4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX()-4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()+4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX(), target->GetPositionY()-4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                        Skeletons = me->SummonCreature(14826, target->GetPositionX()+3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                        if (Skeletons)
                            Skeletons->AI()->AttackStart(target);
                    }

                    Teleport_Timer = urand(15000, 23000);
                } else Teleport_Timer -= diff;

                DoMeleeAttackIfReady();
            }
Esempio n. 27
0
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;
                // Pounding
                if (Pounding_Timer <= diff)
                {
                    DoCastVictim(SPELL_POUNDING);
                    Talk(SAY_POUNDING);
                    Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000)
                }
                else
                    Pounding_Timer -= diff;
                // Arcane Orb
                if (ArcaneOrb_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 = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
                        if (!target)
                            continue;
                        // exclude pets & totems, 18 yard radius minimum
                        if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive() && !target->IsWithinDist(me, 18, false))
                            target_list.push_back(target);
                        target = NULL;
                    }

                    if (!target_list.empty())
                        target = *(target_list.begin()+rand()%target_list.size());
                    else
                        target = me->GetVictim();

                    if (target)
                        me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL, 0);
                    ArcaneOrb_Timer = 3000;
                }
                else
                    ArcaneOrb_Timer -= diff;
                // Single Target knock back, reduces aggro
                if (KnockAway_Timer <= diff)
                {
                    DoCastVictim(SPELL_KNOCK_AWAY);
                    //Drop 25% aggro
                    if (DoGetThreat(me->GetVictim()))
                        DoModifyThreatPercent(me->GetVictim(), -25);
                    KnockAway_Timer = 30000;
                }
                else
                    KnockAway_Timer -= diff;
                //Berserk
                if (Berserk_Timer < diff && !Enraged)
                {
                    DoCast(me, SPELL_BERSERK);
                    Enraged = true;
                }
                else
                    Berserk_Timer -= diff;

                DoMeleeAttackIfReady();

                EnterEvadeIfOutOfCombatArea(diff);
            }
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        //START NOT TRANSFORMED
        if (!Transformed)
        {
            //CrusadersHammer
            if (CrusadersHammer_Timer <= diff && !me->IsNonMeleeSpellCasted(false))
            {
                //Cast
                if (rand()%100 < 75) //50% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_CRUSADERSHAMMER);
                }
                //15 seconds until we should cast this again
                CrusadersHammer_Timer = 12000;
            } else CrusadersHammer_Timer -= diff;

            //CrusaderStrike
            if (CrusaderStrike_Timer <= diff && !me->IsNonMeleeSpellCasted(false))
            {
                //Cast
                if (rand()%100 < 60) //50% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_CRUSADERSTRIKE);
                }
                //15 seconds until we should cast this again
                CrusaderStrike_Timer = 15000;
            } else CrusaderStrike_Timer -= diff;

            //MindBlast
            if (MindBlast_Timer <= diff && !me->IsNonMeleeSpellCasted(false))
            {
                //Cast
                if (rand()%100 < 70) //70% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_MINDBLAST);
                }
                //15 seconds until we should cast this again
                MindBlast_Timer = 10000;
            } else MindBlast_Timer -= diff;

            //HolyStrike
            if (HolyStrike_Timer <= diff && !me->IsNonMeleeSpellCasted(false))
            {
                //Cast
                if (rand()%100 < 50) //50% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_HOLYSTRIKE);
                }
                //15 seconds until we should cast this again
                HolyStrike_Timer = 15000;
            } else HolyStrike_Timer -= diff;

            //Dazed
            if (Dazed_Timer <= diff && !me->IsNonMeleeSpellCasted(false))
            {
                //Cast
                if (rand()%100 < 50) //50% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_DAZED);
                }
                //15 seconds until we should cast this again
                Dazed_Timer = 15000;
            } else Dazed_Timer -= diff;

            //BalnazzarTransform
            if (me->GetHealth()*100 / me->GetMaxHealth() < 40)
            {
                //Cast
                DoCast(me,SPELL_BALNAZZARTRANSFORM); //restore hp, mana and stun
                me->SetUInt32Value(UNIT_FIELD_DISPLAYID,10691); //then change disaply id
                me->SetFloatValue(OBJECT_FIELD_SCALE_X, 3.00f); //then, change size
                Transformed = true;
            }

            //START ELSE TRANSFORMED
        } else {


            //MindBlast
            if (MindBlast_Timer <= diff && !me->IsNonMeleeSpellCasted(false))
            {
                //Cast
                if (rand()%100 < 60) //70% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_MINDBLAST);
                }
                //15 seconds until we should cast this again
                MindBlast_Timer = 10000;
            } else MindBlast_Timer -= diff;

            //ShadowShock
            if (ShadowShock_Timer <= diff)
            {
                //Cast
                if (rand()%100 < 80) //80% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_SHADOWSHOCK);
                }
                //15 seconds until we should cast this again
                ShadowShock_Timer = 11000;
            } else ShadowShock_Timer -= diff;

            //PsychicScream
            if (PsychicScream_Timer <= diff)
            {
                //Cast
                if (rand()%100 < 60) //60% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_PSYCHICSCREAM);
                    if (DoGetThreat(me->getVictim()))
                        DoModifyThreatPercent(me->getVictim(),-50);
                }
                //15 seconds until we should cast this again
                PsychicScream_Timer = 20000;
            } else PsychicScream_Timer -= diff;

            //DeepSleep
            if (DeepSleep_Timer <= diff)
            {
                //Cast
                if (rand()%100 < 55) //55% chance to cast
                {
                    //Cast
                    Unit *pTarget = NULL;

                    pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
                    if (pTarget)
                    DoCast(pTarget,SPELL_DEEPSLEEP);
                }
                //15 seconds until we should cast this again
                DeepSleep_Timer = 15000;
            } else DeepSleep_Timer -= diff;

            //ShadowBoltVolley
            if (ShadowBoltVolley_Timer <= diff)
            {
                //Cast
                if (rand()%100 < 75) //75% chance to cast
                {
                    DoCast(me->getVictim(),SPELL_SHADOWBOLTVOLLEY);
                }
                //15 seconds until we should cast this again
                ShadowBoltVolley_Timer = 13000;
            } else ShadowBoltVolley_Timer -= diff;

            //MindControl
            //            if (MindControl_Timer <= diff)
            //            {
            //Cast
            //                if (rand()%100 < 50) //50% chance to cast
            //                {
            //                DoCast(me->getVictim(),SPELL_MINDCONTROL);
            //                }
            //15 seconds until we should cast this again
            //                MindControl_Timer = 15000;
            //            } else MindControl_Timer -= diff;

            //END ELSE TRANSFORMED
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if (me->getVictim() && me->isAlive())
        {
            if (!PhaseTwo && DrainLife_Timer <= diff)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                DoCast(pTarget, SPELL_DRAIN_LIFE);
                DrainLife_Timer = 20000;
            }
            else
                DrainLife_Timer -= diff;

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

            if (!PhaseTwo && Aspect_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI);
                Aspect_Timer = 13000 + rand()%5000;
            }
            else
                Aspect_Timer -= diff;

            if (!Spawned && SpawnStartSpiders_Timer <= diff)
            {
                DoScriptText(SAY_SPIDER_SPAWN, me);

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

                Creature* Spider = NULL;

                Spider = me->SummonCreature(15041, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Spider)
                    Spider->AI()->AttackStart(pTarget);
                Spider = me->SummonCreature(15041, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Spider)
                    Spider->AI()->AttackStart(pTarget);
                Spider = me->SummonCreature(15041, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Spider)
                    Spider->AI()->AttackStart(pTarget);
                Spider = me->SummonCreature(15041, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Spider)
                    Spider->AI()->AttackStart(pTarget);

                Spawned = true;
            }
            else
                SpawnStartSpiders_Timer -= diff;

            if (SpawnSpider_Timer <= diff)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                if (!pTarget)
                    return;

                Creature* Spider = me->SummonCreature(15041, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Spider)
                    Spider->AI()->AttackStart(pTarget);
                SpawnSpider_Timer = 12000 + rand()%5000;
            }
            else
                SpawnSpider_Timer -= diff;

            if (!PhaseTwo && Transform_Timer <= diff)
            {
                me->InterruptNonMeleeSpells(false);
                DoScriptText(SAY_TRANSFORM, me);
                DoCast(me, SPELL_SPIDER_FORM);
                const CreatureInfo *cinfo = me->GetCreatureInfo();
                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg / 100) * 35)));
                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg / 100) * 35)));
                me->UpdateDamagePhysical(BASE_ATTACK);
                DoCast(me->getVictim(), SPELL_ENVOLWINGWEB);

                PhaseTwo = true;
                Transform_Timer = 35000 + rand()%25000;
            }
            else
                Transform_Timer -= diff;

            if (PhaseTwo)
            {
                if (Charge_Timer <= diff)
                {
                    Unit* pTarget = NULL;
                    int i = 0;
                    while (i < 3)                           // max 3 tries to get a random target with power_mana
                    {
                        ++i;
                        pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);  // not aggro leader
                        if (pTarget && pTarget->getPowerType() == POWER_MANA)
                            i = 3;
                    }
                    if (pTarget)
                    {
                        DoCast(pTarget, SPELL_CHARGE);

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

                        AttackStart(pTarget);
                    }

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

                if (Thrash_Timer <= diff)
                {
                    DoCast(me, SPELL_THRASH);
                    Thrash_Timer = urand(5000, 9000);
                }
                else
                    Thrash_Timer -= diff;

                if (TransformBack_Timer <= diff)
                {
                    me->SetDisplayId(15220);
                    const CreatureInfo *cinfo = me->GetCreatureInfo();
                    me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg + ((cinfo->mindmg / 100) * 1)));
                    me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg + ((cinfo->maxdmg / 100) * 1)));
                    me->UpdateDamagePhysical(BASE_ATTACK);
                    Charge_Timer = 1500;  // reset charge timer so each transform she charges

                    PhaseTwo = false;
                    TransformBack_Timer = 25000 + rand()%15000;
                }
                else
                    TransformBack_Timer -= diff;

            }

            DoMeleeAttackIfReady();
        }
    }