예제 #1
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // Berserk
        if (m_uiBerserkTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
            {
                DoScriptText(SAY_BERSERK, m_creature);
                m_uiBerserkTimer = 5 * MINUTE * IN_MILLISECONDS;
            }
        }
        else
            m_uiBerserkTimer -= uiDiff;

        // Gastric Bloat
        if (m_uiGastricBloatTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_GASTRIC_BLOAT_TRIG) == CAST_OK)
                m_uiGastricBloatTimer = 10000;
        }
        else
            m_uiGastricBloatTimer -= uiDiff;

        // Inhale Blight, Pungent Blight
        if (m_uiInhaleBlightTimer <= uiDiff)
        {
            // check for Pungent Blight
            SpellAuraHolderPtr holder = m_creature->GetSpellAuraHolder(SPELL_INHALED_BLIGHT_10);
            if (!holder)
                holder = m_creature->GetSpellAuraHolder(SPELL_INHALED_BLIGHT_25);
            if (holder)
            {
                if (holder->GetStackAmount() >= 3)
                {
                    // can't inhale anymore...
                    if (DoCastSpellIfCan(m_creature, SPELL_PUNGENT_BLIGHT) == CAST_OK)
                    {
                        DoScriptText(SAY_PUNGUENT_BLIGHT_EMOTE, m_creature);
                        DoScriptText(SAY_PUNGUENT_BLIGHT, m_creature);
                        m_uiInhaleBlightTimer = 35000;
                    }

                    return;
                }
            }

            if (DoCastSpellIfCan(m_creature, SPELL_INHALE_BLIGHT) == CAST_OK)
            {
                if (m_pInstance)
                {
                    if (Creature *pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE))
                        DoScriptText(SAY_BLIGHT, pProfessor);
                }
                m_uiInhaleBlightTimer = 30000;
            }
        }
        else
            m_uiInhaleBlightTimer -= uiDiff;

        // Gas Spore
        if (m_uiGasSporeTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_GAS_SPORE) == CAST_OK)
            {
                DoScriptText(SAY_SPORE, m_creature);
                m_uiGasSporeTimer = 40000;

                // make sure Vile Gas is not cast when players are gathered near Gas Spore
                if (m_uiVileGasTimer < 12000)
                    m_uiVileGasTimer = 12000;
            }
        }
        else
            m_uiGasSporeTimer -= uiDiff;

        // Vile Gas
        if (m_uiVileGasTimer <= uiDiff)
        {
            // DoCastSpellIfCan(m_creature, SPELL_VILE_GAS_SUMMON, CAST_TRIGGERED);
            // DoCastSpellIfCan(m_creature, SPELL_VILE_GAS, CAST_TRIGGERED);

            if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
            {
                pTarget->CastSpell(pTarget, SPELL_VILE_GAS_SUMMON_TRIG, true);
                DoCastSpellIfCan(m_creature, SPELL_VILE_GAS, CAST_TRIGGERED);
                m_uiVileGasTimer = 30000;
            }
        }
        else
            m_uiVileGasTimer -= uiDiff;

        // Malleable Goo
        if (m_bIsHeroic)
        {
            if (m_uiMalleableGooTimer <= uiDiff)
            {
                if (Creature *pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE))
                {
                    if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                    {
                        // pProfessor->CastSpell(m_creature, SPELL_MALLEABLE_GOO_SUMMON, true);
                        // pProfessor->CastSpell(m_creature, SPELL_MALLEABLE_GOO, true);

                        float x, y, z;
                        pTarget->GetPosition(x, y, z);
                        if (Creature *pTmp = m_creature->SummonCreature(NPC_MALLEABLE_GOO, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 20000))
                        {
                            pProfessor->CastSpell(pTmp, SPELL_MALLEABLE_GOO_MISSILE, false);
                            m_uiMalleableGooTimer = urand(15000, 20000);
                        }
                    }
                }
            }
            else
                m_uiMalleableGooTimer -= uiDiff;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 uiDiff)
    {
        // must move teleporting of profesor after assisting to scripts of the other bosses (to their JustDied)
        // m_creature->NearTeleportTo(SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z, SpawnLoc[0].o);

        if (m_bIsAssistingOnly)
            return;

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

        // Enrage
        if (m_uiEnrageTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
            {
                DoScriptText(SAY_BERSERK, m_creature);
                m_uiEnrageTimer = 30 * MINUTE * IN_MILLISECONDS;
            }
        }
        else
            m_uiEnrageTimer -= uiDiff;

        switch(m_uiPhase)
        {
            case PHASE_ONE:
            {
                // health check
                if (m_uiHealthCheckTimer <= uiDiff)
                {
                    if (m_creature->GetHealthPercent() <= 80.0f)
                    {
                        if (m_bIsHeroic)
                        {
                            DoCastSpellIfCan(m_creature, SPELL_VOLATILE_EXPERIMENT);
                            DoExperiment(true, true);
                            DoScriptText(SAY_PHASE_CHANGE, m_creature);
                        }
                        else
                        {
                            DoCastSpellIfCan(m_creature, SPELL_TEAR_GAS, CAST_TRIGGERED);
                            DoCastSpellIfCan(m_creature, SPELL_TEAR_GAS_1, CAST_TRIGGERED);
                        }

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

                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MovePoint(POINT_PUTRICIDE_SPAWN, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z);
                        m_uiPhase = PHASE_RUNNING_ONE;
                        return;
                    }
                    m_uiHealthCheckTimer = 1000;
                }
                else
                    m_uiHealthCheckTimer -= uiDiff;

                // Unbound Plague
                if (m_bIsHeroic)
                {
                    if (m_uiUnboundPlagueTimer <= uiDiff)
                    {
                        if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_UNBOUND_PLAGUE, SELECT_FLAG_PLAYER))
                        {
                            if (DoCastSpellIfCan(pTarget, SPELL_UNBOUND_PLAGUE) == CAST_OK)
                                m_uiUnboundPlagueTimer = 70000;
                        }
                    }
                    else
                        m_uiUnboundPlagueTimer -= uiDiff;
                }

                // Slime Puddle
                if (m_uiPuddleTimer <= uiDiff)
                {
                    for (int i = 0; i < 2; ++i)
                    {
                        if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_SLIME_PUDDLE_SUMMON, SELECT_FLAG_PLAYER))
                            DoCastSpellIfCan(pTarget, SPELL_SLIME_PUDDLE, CAST_TRIGGERED);
                    }

                    m_uiPuddleTimer = 30000;
                }
                else
                    m_uiPuddleTimer -= uiDiff;

                // Unstable Experiment
                if (m_uiUnstableExperimentTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_UNSTABLE_EXPERIMENT) == CAST_OK)
                    {
                        DoExperiment(m_bIsGreenOoze);
                        m_uiUnstableExperimentTimer = 30000;
                        m_bIsGreenOoze = !m_bIsGreenOoze;
                    }
                }
                else
                    m_uiUnstableExperimentTimer -= uiDiff;

                break;
            }
            case PHASE_TRANSITION_ONE:
            {
                if (m_uiTransitionTimer <= uiDiff)
                {
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                    m_uiTransitionTimer = 15000;
                    m_uiPhase = PHASE_TWO;

                    if (m_pInstance)
                            m_pInstance->SetData(TYPE_PUTRICIDE, IN_PROGRESS);

                    if (m_bIsHeroic)
                    {
                        DoCastSpellIfCan(m_creature, SPELL_CREATE_CONCOCTION);
                        DoScriptText(SAY_TRANSFORM_1, m_creature);
                    }
                    else
                        DoCastSpellIfCan(m_creature, SPELL_TEAR_GAS_CANCEL, CAST_TRIGGERED);
                }
                else
                    m_uiTransitionTimer -= uiDiff;

                return;
            }
            case PHASE_TWO:
            {
                // health check
                if (m_uiHealthCheckTimer <= uiDiff)
                {
                    if (m_creature->GetHealthPercent() <= 35.0f)
                    {
                        if (m_bIsHeroic)
                        {
                            DoCastSpellIfCan(m_creature, SPELL_VOLATILE_EXPERIMENT);
                            DoExperiment(true, true);
                            DoScriptText(SAY_PHASE_CHANGE, m_creature);
                        }
                        else
                        {
                            DoCastSpellIfCan(m_creature, SPELL_TEAR_GAS, CAST_TRIGGERED);
                            DoCastSpellIfCan(m_creature, SPELL_TEAR_GAS_1, CAST_TRIGGERED);
                        }

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

                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MovePoint(POINT_PUTRICIDE_SPAWN, SpawnLoc[0].x, SpawnLoc[0].y, SpawnLoc[0].z);
                        m_uiPhase = PHASE_RUNNING_TWO;
                        return;
                    }
                    m_uiHealthCheckTimer = 1000;
                }
                else
                    m_uiHealthCheckTimer -= uiDiff;

                // Unbound Plague
                if (m_bIsHeroic)
                {
                    if (m_uiUnboundPlagueTimer <= uiDiff)
                    {
                        if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_UNBOUND_PLAGUE, SELECT_FLAG_PLAYER))
                        {
                            if (DoCastSpellIfCan(pTarget, SPELL_UNBOUND_PLAGUE) == CAST_OK)
                                m_uiUnboundPlagueTimer = 70000;
                        }
                    }
                    else
                        m_uiUnboundPlagueTimer -= uiDiff;
                }

                // Slime Puddle
                if (m_uiPuddleTimer <= uiDiff)
                {
                    for (int i = 0; i < 2; ++i)
                    {
                        if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_SLIME_PUDDLE_SUMMON, SELECT_FLAG_PLAYER))
                            DoCastSpellIfCan(pTarget, SPELL_SLIME_PUDDLE, CAST_TRIGGERED);
                    }

                    m_uiPuddleTimer = 30000;
                }
                else
                    m_uiPuddleTimer -= uiDiff;

                // Unstable Experiment
                if (m_uiUnstableExperimentTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_UNSTABLE_EXPERIMENT) == CAST_OK)
                    {
                        DoExperiment(m_bIsGreenOoze);
                        m_uiUnstableExperimentTimer = 30000;
                        m_bIsGreenOoze = !m_bIsGreenOoze;
                    }
                }
                else
                    m_uiUnstableExperimentTimer -= uiDiff;

                // Malleable Goo
                if (m_uiMalleableGooTimer <= uiDiff)
                {
                    for (int i = 0; i < (m_bIs25Man ? 2 : 1); ++i)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            float x, y, z;
                            pTarget->GetPosition(x, y, z);
                            if (Creature *pTmp = m_creature->SummonCreature(NPC_MALLEABLE_GOO, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 20000))
                            {
                                DoCastSpellIfCan(pTmp, SPELL_MALLEABLE_GOO_MISSILE);
                                m_uiMalleableGooTimer = 20000;
                            }
                        }
                    }
                }
                else
                    m_uiMalleableGooTimer -= uiDiff;

                // Choking Gas
                if (m_uiChokingGasBombTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_CHOKING_GAS_BOMB) == CAST_OK)
                        m_uiChokingGasBombTimer = urand(25000, 30000);
                }
                else
                    m_uiChokingGasBombTimer -= uiDiff;

                break;
            }
            case PHASE_TRANSITION_TWO:
            {
                if (m_uiTransitionTimer <= uiDiff)
                {
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                    m_uiTransitionTimer = 15000;
                    m_uiPhase = PHASE_THREE;

                    if (m_pInstance)
                            m_pInstance->SetData(TYPE_PUTRICIDE, IN_PROGRESS);

                    if (m_bIsHeroic)
                    {
                        DoCastSpellIfCan(m_creature, SPELL_GUZZLE_POTIONS);
                        DoScriptText(SAY_TRANSFORM_2, m_creature);
                    }
                    else
                        DoCastSpellIfCan(m_creature, SPELL_TEAR_GAS_CANCEL, CAST_TRIGGERED);
                }
                else
                    m_uiTransitionTimer -= uiDiff;

                return;
            }
            case PHASE_THREE:
            {
                // Unbound Plague
                if (m_bIsHeroic)
                {
                    if (m_uiUnboundPlagueTimer <= uiDiff)
                    {
                        if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_UNBOUND_PLAGUE, SELECT_FLAG_PLAYER))
                        {
                            if (DoCastSpellIfCan(pTarget, SPELL_UNBOUND_PLAGUE) == CAST_OK)
                                m_uiUnboundPlagueTimer = 70000;
                        }
                    }
                    else
                        m_uiUnboundPlagueTimer -= uiDiff;
                }

                // Mutated Plague (proc cooldown for creatures doesn't work)
                if (m_uiMutatedPlagueTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MUTATED_PLAGUE) == CAST_OK)
                        m_uiMutatedPlagueTimer = 10000;
                }
                else
                    m_uiMutatedPlagueTimer -= uiDiff;

                // Slime Puddle
                if (m_uiPuddleTimer <= uiDiff)
                {
                    for (int i = 0; i < 2; ++i)
                    {
                        if (Unit *pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_SLIME_PUDDLE_SUMMON, SELECT_FLAG_PLAYER))
                            DoCastSpellIfCan(pTarget, SPELL_SLIME_PUDDLE, CAST_TRIGGERED);
                    }

                    m_uiPuddleTimer = 30000;
                }
                else
                    m_uiPuddleTimer -= uiDiff;

                // Malleable Goo
                if (m_uiMalleableGooTimer <= uiDiff)
                {
                    for (int i = 0; i < (m_bIs25Man ? 2 : 1); ++i)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            float x, y, z;
                            pTarget->GetPosition(x, y, z);
                            if (Creature *pTmp = m_creature->SummonCreature(NPC_MALLEABLE_GOO, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 20000))
                            {
                                DoCastSpellIfCan(pTmp, SPELL_MALLEABLE_GOO_MISSILE);
                                m_uiMalleableGooTimer = 20000;
                            }
                        }
                    }
                }
                else
                    m_uiMalleableGooTimer -= uiDiff;

                // Choking Gas
                if (m_uiChokingGasBombTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_CHOKING_GAS_BOMB) == CAST_OK)
                        m_uiChokingGasBombTimer = urand(25000, 30000);
                }
                else
                    m_uiChokingGasBombTimer -= uiDiff;

                break;
            }
            case PHASE_RUNNING_ONE:
            case PHASE_RUNNING_TWO:
                // wait for arriving at the table (during phase transition)
                break;
        }

        DoMeleeAttackIfReady();
    }
예제 #3
0
    void UpdateAI(const uint32 uiDiff)
    {

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

        // Enrage
        if (m_uiEnrageTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
            {
                DoScriptText(SAY_BERSERK, m_creature);
                m_uiEnrageTimer = (5 * MINUTE + 30) * IN_MILLISECONDS;
            }
        }
        else
            m_uiEnrageTimer -= uiDiff;

        switch (m_uiPhase)
        {
            case PHASE_GROUND:
            {
                // phase change timer
                if (m_uiPhaseTimer <= uiDiff)
                {
                    m_uiPhase = PHASE_RUNNING;
                    SetCombatMovement(false);
                    m_creature->GetMotionMaster()->MovePoint(POINT_CENTER_GROUND, QueenLocs[0].x, QueenLocs[0].y, QueenLocs[0].z);
                    m_uiPhaseTimer = 13000;
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                // Blood Mirror
                if (m_uiBloodMirrorTimer <= uiDiff)
                {
                    if (Unit *pVictim = SelectClosestFriendlyTarget(m_creature->getVictim()))
                    {
                        pVictim->CastSpell(m_creature->getVictim(), SPELL_BLOOD_MIRROR, true, 0, 0, pVictim->GetObjectGuid());
                        m_uiBloodMirrorTimer = 5000;
                    }
                }
                else
                    m_uiBloodMirrorTimer -= uiDiff;

                // Delirious Slash
                if (m_uiDeliriousSlashTimer <= uiDiff)
                {
                    /**
                     * Spell that handles targeting - we can do this here.
                     * if (DoCastSpellIfCan(m_creature, SPELL_DELIRIOUS_SLASH) == CAST_OK)
                     */
                    if (Unit *pTarget = SelectClosestFriendlyTarget(m_creature->getVictim()))
                    {
                        uint32 spell = SPELL_DELIRIOUS_SLASH_1;

                        // if target is not in 5yd range then cast spell with charge effect
                        if (!m_creature->IsWithinDist(pTarget, 5.0f))
                            spell = SPELL_DELIRIOUS_SLASH_2;

                        if (DoCastSpellIfCan(pTarget, spell) == CAST_OK)
                            m_uiDeliriousSlashTimer = 15000;
                    }
                }
                else
                    m_uiDeliriousSlashTimer -= uiDiff;

                // Vampiric Bite
                if (!m_bHasBitten)
                {
                    if (m_uiVampiricBiteTimer <= uiDiff)
                    {
                        /**
                         * Spell handles targeting, but we can do this here.
                         * if (DoCastSpellIfCan(m_creature, SPELL_VAMPIRIC_BITE) == CAST_OK)
                         */
                        if (Unit *pTarget = SelectVampiricBiteTarget())
                        {
                            if (DoCastSpellIfCan(pTarget, SPELL_VAMPIRIC_BITE_TRIGGERED) == CAST_OK)
                            {
                                m_bHasBitten = true;
                                DoScriptText(SAY_BITE_1 - urand(0, 1), m_creature);
                            }
                        }
                    }
                    else
                        m_uiVampiricBiteTimer -= uiDiff;
                }

                // Twilight Bloodbolt
                if (m_uiBloodboltTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_TWILIGHT_BLOODBOLT) == CAST_OK)
                        m_uiBloodboltTimer = urand(15000, 20000);
                }
                else
                    m_uiBloodboltTimer -= uiDiff;

                // Pact of the Darkfallen
                if (m_uiPactTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_PACT_OF_THE_DARKFALLEN) == CAST_OK)
                    {
                        m_uiPactTimer = urand(20000, 25000);
                        DoScriptText(SAY_PACT, m_creature);
                    }
                }
                else
                    m_uiPactTimer -= uiDiff;

                // Swarming Shadows
                if (m_uiSwarmingShadowsTimer <= uiDiff)
                {
                    /**
                     * spell which handles picking targets
                     * but we can use SelectAttackingTarget() here
                     * if (DoCastSpellIfCan(m_creature, SPELL_SWARMING_SHADOWS) == CAST_OK)
                     */
                    if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                    {
                        if (DoCastSpellIfCan(pTarget, SPELL_SWARMING_SHADOWS_TRIGGERED) == CAST_OK)
                        {
                            m_uiSwarmingShadowsTimer = urand(30000, 35000);
                            DoScriptText(SAY_SHADOWS, m_creature);
                        }
                    }
                }
                else
                    m_uiSwarmingShadowsTimer -= uiDiff;

                DoMeleeAttackIfReady();

                break;
            }
            case PHASE_RUNNING:
            case PHASE_FLYING:
            {
                // wait for arriving at the point
                break;
            }
            case PHASE_AIR:
            {
                // phase change timer
                if (m_uiPhaseTimer <= uiDiff)
                {
                    m_uiPhase = PHASE_FLYING;
                    m_uiPhaseTimer = 2 * MINUTE * IN_MILLISECONDS - 13000; // substract the air phase duration
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MovePoint(POINT_CENTER_GROUND, QueenLocs[0].x, QueenLocs[0].y, QueenLocs[0].z);
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;
            }
        }
    }
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiBloodMirrorCheckTimer < uiDiff)
        {
            if (Unit *pOff = SelectClosestFriendlyTarget(m_creature->getVictim()))
            {
                if(m_creature->getVictim()->HasAura(SPELL_BLOOD_MIRROR_OFF))
                    m_creature->getVictim()->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_OFF);

                if(pOff->HasAura(SPELL_BLOOD_MIRROR_TANK))
                    pOff->RemoveAurasDueToSpell(SPELL_BLOOD_MIRROR_TANK);

                if (!m_creature->getVictim()->HasAura(SPELL_BLOOD_MIRROR_TANK))
                {
                    pOff->CastSpell(m_creature->getVictim(), SPELL_BLOOD_MIRROR_TANK, true);
                    /*if (pOff->HasAura(SPELL_SHADOWS_EDGE) && !pOff->HasAura(SPELL_GUSHING_WOUND) && m_bIs25Man)
                        pOff->CastSpell(pOff, SPELL_GUSHING_WOUND, true);*/
                }
                if (!pOff->HasAura(SPELL_BLOOD_MIRROR_OFF))
                {
                    m_creature->getVictim()->CastSpell(pOff, SPELL_BLOOD_MIRROR_OFF, true);
                    /*if (m_creature->getVictim()->HasAura(SPELL_SHADOWS_EDGE) && !m_creature->getVictim()->HasAura(SPELL_GUSHING_WOUND) && m_bIs25Man)
                        m_creature->getVictim()->CastSpell(m_creature->getVictim(), SPELL_GUSHING_WOUND, true);*/
                }
            }
            m_uiBloodMirrorCheckTimer = 500;
        }
        else m_uiBloodMirrorCheckTimer -= uiDiff;

        if (m_uiEnrageTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_BERSERK, CAST_TRIGGERED) == CAST_OK)
            {
                DoScriptText(SAY_BERSERK,m_creature);
                m_uiEnrageTimer = 5.5 * MINUTE * IN_MILLISECONDS;
            }
        }
        else m_uiEnrageTimer -= uiDiff;

        switch (m_uiPhase)
        {
        case PHASE_GROUND:
            if (m_uiTwilightTimer < uiDiff)
            {
                if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                {
                    if (DoCastSpellIfCan(pTarget, SPELL_TWILIGHT_BLOODBOLT) == CAST_OK)
                        m_uiTwilightTimer = urand(12000, 17000);
                }
            }
            else m_uiTwilightTimer -= uiDiff;

            // Delirious Slash
            if (m_uiDeliriousSlashTimer <= uiDiff)
            {
                /**
                 * Spell that handles targeting - we can do this here.
                 * if (DoCastSpellIfCan(m_creature, SPELL_DELIRIOUS_SLASH) == CAST_OK)
                 */
                if (Unit *pTarget = SelectClosestFriendlyTarget(m_creature->getVictim()))
                {
                    uint32 spell = SPELL_DELIRIOUS_SLASH_1;

                    // if target is not in 5yd range then cast spell with charge effect
                    if (!m_creature->IsWithinDist(pTarget, 5.0f))
                        spell = SPELL_DELIRIOUS_SLASH_2;

                    if (DoCastSpellIfCan(pTarget, spell) == CAST_OK)
                        m_uiDeliriousSlashTimer = 15000;
                }
            }
            else
                m_uiDeliriousSlashTimer -= uiDiff;

            /*if (m_uiDeliriousSlashTimer < uiDiff)
            {
                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,2))
                {
                    if (DoCastSpellIfCan(pTarget, SPELL_DELIRIOUS_SLASH) == CAST_OK)
                        m_uiDeliriousSlashTimer = urand(15000, 20000);
                }
            }
            else m_uiDeliriousSlashTimer -= uiDiff;*/

            if (m_uiPactTimer < uiDiff)
            {
                //if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                //{
                    if (DoCastSpellIfCan(m_creature, SPELL_PACT_OF_DARKFALLEN) == CAST_OK)
                    {
                        DoScriptText(SAY_PACT, m_creature);
                        m_uiPactTimer = 30000;
                    }
                //}
            }
            else m_uiPactTimer -= uiDiff;

            if (m_uiShadowsTimer < uiDiff)
            {
                if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                {
                    if (DoCastSpellIfCan(pTarget, SPELL_SWARMING_SHADOWS) == CAST_OK)
                    {
                        DoScriptText(SAY_SHADOWS,m_creature);
                        m_uiShadowsTimer = 30000;
                    }
                }
            }
            else m_uiShadowsTimer -= uiDiff;

            if (m_uiBiteTimer < uiDiff && !m_bBite)
            {
                if (Unit* pTarget = SelectVampiricBiteTarget())
                {
                    if (DoCastSpellIfCan(pTarget, SPELL_VAMPIRIC_BITE) == CAST_OK)
                    {
                        m_bBite = true;
                        DoScriptText(SAY_BITE_1, m_creature);
                    }
                }
            }
            else m_uiBiteTimer -= uiDiff;

            if (m_uiPhaseTimer < uiDiff && m_creature->GetHealthPercent() >= 5)
            {
                m_uiPhase = PHASE_MOVING_CENTER;
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMotionMaster()->MovePoint(POINT_CENTER_GROUND, QueenLocs[0].x, QueenLocs[0].y, QueenLocs[0].z);
                SetCombatMovement(false);
                m_uiPhaseTimer = 13000;
            }
            else m_uiPhaseTimer -= uiDiff;

            DoMeleeAttackIfReady();
            break;
        case PHASE_MOVING_CENTER:
            break;
        case PHASE_FLYING:
            m_creature->HandleEmote(EMOTE_ONESHOT_LAND);
            break;
        case PHASE_AIR:
            // phase change timer
            if (m_uiPhaseTimer <= uiDiff)
            {
                m_uiPhase = PHASE_FLYING;
                m_uiPhaseTimer = 2 * MINUTE * IN_MILLISECONDS - 13000; // substract the air phase duration
                m_creature->GetMotionMaster()->Clear();
                m_creature->GetMotionMaster()->MovePoint(POINT_CENTER_GROUND, QueenLocs[0].x, QueenLocs[0].y, QueenLocs[0].z);
            }
            else
                m_uiPhaseTimer -= uiDiff;

            break;
        }
    }
예제 #5
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_bIsAssistingOnly)
            return;

        if (m_uiEventTimer <= uiDiff)
        {
            switch (m_uiStep)
            {
            case 0:
                {
                    if (m_uiUnstableExperimentTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                            UnstableExperiment(pTarget);
                    }
                    else m_uiUnstableExperimentTimer -= uiDiff;

                    if (m_uiSlimePuddleTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            DoCastSpellIfCan(pTarget, SPELL_SLIME_PUDDLE_BOTTLE, CAST_TRIGGERED);
                            m_uiSlimePuddleTimer = 30000;
                        }
                    }
                    else m_uiSlimePuddleTimer -= uiDiff;
                    DoMeleeAttackIfReady();

                    if (m_creature->GetHealthPercent() <= 80)
                        NextStep();
                    break;
                }
            case 1:
                {
                    SetCombatMovement(false);
                    m_creature->AttackStop();
                    if (!m_bIsHeroic)
                    {
                        CastOnAllPlayers(SPELL_TEAR_GAS_1);
                        DoScriptText(SAY_BLIGHT,m_creature);
                    }
                    if (m_bIsHeroic)
                    {
                        if (Unit *pTarget1 = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        {
                            if (Unit *pTarget2 = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
                            {
                                VolatileExperiment(pTarget1, pTarget2);
                                DoScriptText(SAY_PHASE_CHANGE, m_creature);
                            }
                        }
                    }
                    StartMovement(0);
                    NextStep(0);
                    break;
                }
            case 2:
                {
                    if (m_bMovementStarted)
                        return;
                    m_creature->CastSpell(m_creature, SPELL_CREATE_CONCOCTION, false);
                    NextStep(4000);
                    break;
                }
            case 3:
                {
                    if (m_creature->IsNonMeleeSpellCasted(true))
                        return;
                    if (Unit *pTentacle1 = GetClosestCreatureWithEntry(m_creature, NPC_OOZE_TENTACLE, 100.0f))
                        pTentacle1->CastSpell(pTentacle1, SPELL_ORANGE_BOTTLE_0, false);
                    if (Unit *pTentacle2 = GetClosestCreatureWithEntry(m_creature, NPC_SLIMY_TENTACLE, 100.0f))
                        pTentacle2->CastSpell(pTentacle2, SPELL_GREEN_BOTTLE_0, false);
                    NextStep(12000);
                    break;
                }
            case 4:
                {
                    DoScriptText(SAY_TRANSFORM_1,m_creature);
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                    NextStep(0);
                    break;
                }
            case 5:
                {
                    SetCombatMovement(true);
                    if (m_uiUnstableExperimentTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                            UnstableExperiment(pTarget);
                    }
                    else m_uiUnstableExperimentTimer -= uiDiff;

                    if (m_uiSlimePuddleTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            DoCastSpellIfCan(pTarget, SPELL_SLIME_PUDDLE_BOTTLE, CAST_TRIGGERED);
                            m_uiSlimePuddleTimer = 30000;
                        }
                    }
                    else m_uiSlimePuddleTimer -= uiDiff;

                    if (m_uiChokingGasTimer < uiDiff)
                    {
                        if(DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUMMON_CHOKING_GAS) == CAST_OK)
                            m_uiChokingGasTimer = urand(15000, 25000);
                    }
                    else m_uiChokingGasTimer -= uiDiff;

                    if (m_uiMalleableGooTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            DoCastSpellIfCan(pTarget, SPELL_MALLEABLE_GOO);
                            m_uiMalleableGooTimer = urand(15000,20000);
                        }
                    }
                    else m_uiMalleableGooTimer -= uiDiff;
                    DoMeleeAttackIfReady();

                    if (m_creature->GetHealthPercent() <= 35)
                        NextStep();
                    break;
                }
            case 6:
                {
                    SetCombatMovement(false);
                    m_creature->AttackStop();
                    if (!m_bIsHeroic)
                    {
                        CastOnAllPlayers(SPELL_TEAR_GAS_1);
                        DoScriptText(SAY_BLIGHT,m_creature);
                    }
                    if (m_bIsHeroic)
                    {
                        if (Unit *pTarget1 = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        {
                            if (Unit *pTarget2 = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1))
                            {
                                VolatileExperiment(pTarget1, pTarget2);
                                DoScriptText(SAY_PHASE_CHANGE, m_creature);
                            }
                        }
                    }
                    StartMovement(0);
                    NextStep(0);
                    break;
                }
            case 7:
                {
                    if (m_bMovementStarted)
                        return;
                    m_creature->CastSpell(m_creature, SPELL_GUZZLE_POTIONS, false);
                    NextStep(4000);
                    break;
                }
            case 8:
                {
                    if (m_creature->IsNonMeleeSpellCasted(true))
                        return;
                    m_creature->RemoveAurasDueToSpell(SPELL_GUZZLE_POTIONS_1);
                    DoCastSpellIfCan(m_creature, SPELL_MUTATED_STRENGTH, CAST_TRIGGERED);
                    if (Unit *pTentacle1 = GetClosestCreatureWithEntry(m_creature, NPC_OOZE_TENTACLE, 100.0f))
                        pTentacle1->CastSpell(pTentacle1, SPELL_ORANGE_BOTTLE_1, false);
                    //if (Unit *pTentacle2 = GetClosestCreatureWithEntry(m_creature, NPC_SLIMY_TENTACLE, 100.0f))
                    //    pTentacle2->CastSpell(pTentacle2, SPELL_GREEN_BOTTLE_1, false);
                    NextStep(12000);
                    break;
                }
            case 9:
                {
                    DoScriptText(SAY_TRANSFORM_2,m_creature);
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                    NextStep(0);
                    break;
                }
            case 10:
                {
                    SetCombatMovement(true);
                    m_creature->getVictim()->RemoveAurasDueToSpell(SPELL_MUTATED_PLAGUE);
                    if (m_uiMutatedPlagueTimer < uiDiff)
                    {
                        m_creature->getVictim()->_AddAura(SPELL_MUTATED_PLAGUE);
                        m_uiMutatedPlagueTimer = 10000;
                    }
                    else m_uiMutatedPlagueTimer -= uiDiff;

                    if (m_uiSlimePuddleTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            DoCastSpellIfCan(pTarget, SPELL_SLIME_PUDDLE_BOTTLE, CAST_TRIGGERED);
                            m_uiSlimePuddleTimer = 30000;
                        }
                    }
                    else m_uiSlimePuddleTimer -= uiDiff;

                    if (m_uiChokingGasTimer < uiDiff)
                    {
                        if(DoCastSpellIfCan(m_creature->getVictim(), SPELL_SUMMON_CHOKING_GAS) == CAST_OK)
                            m_uiChokingGasTimer = urand(15000, 25000);
                    }
                    else m_uiChokingGasTimer -= uiDiff;

                    if (m_uiMalleableGooTimer < uiDiff)
                    {
                        if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                        {
                            DoCastSpellIfCan(pTarget, SPELL_MALLEABLE_GOO);
                            m_uiMalleableGooTimer = urand(15000,20000);
                        }
                    }
                    else m_uiMalleableGooTimer -= uiDiff;
                    DoMeleeAttackIfReady();
                    break;
                }
            default:
                break;
            }
        }
        else
            m_uiEventTimer -= uiDiff;
    }
예제 #6
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // Berserk
        if (m_uiBerserkTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_BERSERK) == CAST_OK)
            {
                DoScriptText(SAY_BERSERK, m_creature);
                m_uiBerserkTimer = 5 * MINUTE * IN_MILLISECONDS;
            }
        }
        else
            m_uiBerserkTimer -= uiDiff;

        // Slime Spray
        if (m_uiSlimeSprayTimer <= uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_SLIME_SPRAY_SUMMON, CAST_TRIGGERED) == CAST_OK)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_SLIME_SPRAY) == CAST_OK)
                {
                    DoScriptText(SAY_SLIME_SPRAY, m_creature);
                    m_uiSlimeSprayTimer = 20000;
                }
            }
        }
        else
            m_uiSlimeSprayTimer -= uiDiff;

        // Mutated Infection - faster with time
        // implemented this instead of phases
        if (m_uiInfectionsRate < 5)
        {
            if (m_uiMutatedInfectionTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, uiMutatedInfections[m_uiInfectionsRate], CAST_TRIGGERED) == CAST_OK)
                {
                    m_creature->RemoveAurasDueToSpell(uiMutatedInfections[m_uiInfectionsRate - 1]);
                    m_uiMutatedInfectionTimer = 50000;
                    ++m_uiInfectionsRate;
                }
            }
            else
                m_uiMutatedInfectionTimer -= uiDiff;
        }

        // Vile Gas
        if (m_bIsHeroic)
        {
            if (m_uiVileGasTimer <= uiDiff)
            {
                if (Creature *pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE))
                {
                    if (Unit *pTarget = SelectRandomRangedTarget(m_creature))
                    {
                        if (DoCastSpellIfCan(pTarget, SPELL_VILE_GAS_SUMMON_TRIG, CAST_TRIGGERED) == CAST_OK)
                        {
                            pProfessor->CastSpell(pProfessor, SPELL_VILE_GAS, true);
                            m_uiVileGasTimer = 20000;
                        }
                    }
                }
            }
            else
                m_uiVileGasTimer -= uiDiff;
        }

        // Slime Flow
        if (m_uiSlimeFlowTimer <= uiDiff)
        {
            if (Creature *pProfessor = m_pInstance->GetSingleCreatureFromStorage(NPC_PROFESSOR_PUTRICIDE))
                DoScriptText(SAY_SLIME_FLOW_1 - urand(0, 1), pProfessor);

            m_uiSlimeFlowTimer = 20000;
        }
        else
            m_uiSlimeFlowTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }