Exemple #1
0
 void JustDied(Unit* /*killer*/) override
 {
     LiveTriggerGUID.clear();
     DeadTriggerGUID.clear();
     _JustDied();
     Talk(SAY_DEATH);
     instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
 }
Exemple #2
0
            void Reset() override
            {
                LiveTriggerGUID.clear();
                DeadTriggerGUID.clear();

                me->SetReactState(REACT_PASSIVE);
                instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);
                _Reset();
                Initialize();
            }
void ScriptedAI::DespawnGuids(GuidVector& spawns)
{
    for (ObjectGuid& guid : spawns)
        if (Creature* spawn = m_creature->GetMap()->GetCreature(guid))
            spawn->ForcedDespawn();
    spawns.clear();
}
    void Reset() override
    {
        m_Phase                  = PHASE_GROUND;
        m_PhaseSwitchTimer       = 80000;
        m_uiFreezingSlashTimer   = 20000;
        m_uiPenetratingColdTimer = urand(15000, 25000);
        m_uiBurrowerSummonTimer  = 10000;
        m_uiBerserkTimer         = 10 * MINUTE * IN_MILLISECONDS;

        m_vSpheresGuidVector.clear();
        m_vSpheresGuidVector.resize(MAX_FROSTSPHERES, ObjectGuid());
    }
    void Reset() override
    {
        m_bIsEventInProgress = false;

        m_uiEventTimer = 1000;
        m_uiChallengerCount = 0;
        m_uiStep = 0;

        m_playerGuid.Clear();
        m_bigWillGuid.Clear();
        m_vAffrayChallengerGuidsVector.clear();
    }
        // Note: this should be done by creature linkin in core
        void DoDespawnAdds()
        {
            for (GuidVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr)
            {
                if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
                {
                    pTemp->ForcedDespawn();
                }
            }

            m_vAddGuids.clear();

            for (GuidVector::const_iterator itr = m_vAssassinGuids.begin(); itr != m_vAssassinGuids.end(); ++itr)
            {
                if (Creature* pTemp = m_creature->GetMap()->GetCreature(*itr))
                {
                    pTemp->ForcedDespawn();
                }
            }

            m_vAssassinGuids.clear();
        }
        void InfernalCleanup()
        {
            //Infernal Cleanup
            for (GuidVector::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
                if (Unit* pInfernal = ObjectAccessor::GetUnit(*me, *itr))
                    if (pInfernal->IsAlive())
                    {
                        pInfernal->SetVisible(false);
                        pInfernal->setDeathState(JUST_DIED);
                    }

            infernals.clear();
        }
    uint8 playersInsideCircles()
    {
        uint32 tmpAuras[5] = {
            SPELL_VIMGOL_POP_TEST_A, SPELL_VIMGOL_POP_TEST_B, SPELL_VIMGOL_POP_TEST_C,
            SPELL_VIMGOL_POP_TEST_D, SPELL_VIMGOL_POP_TEST_E
        };
        uint8 tmpCounter = 0;

        if (m_uiBunnyGuids.size() < 5 && m_pMap)
        {
            m_uiBunnyGuids.clear();
            m_pMap->GetCreatureGuidVectorFromStorage(NPC_VIMGOL_VISUAL_BUNNY, m_uiBunnyGuids);
        }

        for (int i = 0; i < 5; i++)
            m_uiActiveCircles[i] = false;

        std::list<Player*> playerList;
        GetPlayerListWithEntryInWorld(playerList, m_creature, 30);
        for (auto itr = playerList.begin(); itr != playerList.end(); ++itr)
        {
            if (!(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_A) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_B) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_C) &&
                !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_D) && !(*itr)->HasAura(SPELL_VIMGOL_POP_TEST_E))
                continue;

            for (auto it = m_uiBunnyGuids.begin(); it != m_uiBunnyGuids.end(); ++it)
            {
                for (int i = 0; i < 5; ++i)
                {
                    if (!(*itr)->GetAura(tmpAuras[i], SpellEffectIndex(0)))
                        continue;

                    if ((*it) != (*itr)->GetAura(tmpAuras[i], SpellEffectIndex(0))->GetCasterGuid())
                        continue;

                    m_uiActiveCircles[std::distance(m_uiBunnyGuids.begin(), it)] = true;
                }
            }
        }

        for (int i = 0; i < 5; i++)
            if (m_uiActiveCircles[i])
                ++tmpCounter;

        return tmpCounter;
    }
    void Reset() override
    {
        m_uiPhase                   = PHASE_GROUND;
        m_uiFlightPhase             = 1;
        m_bCombatStarted            = false;

        m_uiBellowingRoarTimer      = urand(30000, 45000);
        m_uiCharredEarthTimer       = urand(10000, 15000);
        m_uiSmolderingBreathTimer   = urand(9000, 13000);
        m_uiTailSweepTimer          = urand(12000, 15000);
        m_uiCleavetimer             = urand(4000, 8000);

        SetCombatMovement(true);
        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
        m_creature->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_FLY_ANIM);
        m_creature->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
        m_creature->SetCanFly(false);
        m_creature->SetHover(false);
        m_creature->SetLevitate(true);

        m_skeletons.clear();
    }
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // When Solarian reaches 20% she will transform into a huge void walker.
        if (m_Phase != PHASE_VOID && m_creature->GetHealthPercent() < 20.0f)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_SOLARIAN_TRANSFORM) == CAST_OK)
            {
                DoScriptText(SAY_VOIDA, m_creature);
                m_uiDelayTimer = 2000;

                m_creature->SetArmor(WV_ARMOR);
                m_Phase = PHASE_VOID;

                if (m_creature->GetVisibility() != VISIBILITY_ON)
                    m_creature->SetVisibility(VISIBILITY_ON);

                // Stop the combat for a small delay
                SetCombatMovement(false);
                m_creature->GetMotionMaster()->MoveIdle();
            }
        }

        // Handle delays between combat phases
        if (m_uiDelayTimer)
        {
            if (m_uiDelayTimer <= uiDiff)
            {
                if (m_Phase == PHASE_SPLIT)
                {
                    // select two different numbers between 0 and 7 so we will get different spawn points for the spotlights
                    uint8 uiPos1 = urand(0, 7);
                    uint8 uiPos2 = (uiPos1 + urand(1, 7)) % 8;

                    // summon 3 spotlights
                    m_vSpotLightsGuidVector.clear();
                    DoSummonSpotlight(fSpotlightRadius[0], M_PI_F / 2, urand(0, 3));
                    DoSummonSpotlight(fSpotlightRadius[1], M_PI_F / 4, uiPos1);
                    DoSummonSpotlight(fSpotlightRadius[1], M_PI_F / 4, uiPos2);

                    m_creature->SetVisibility(VISIBILITY_OFF);

                    DoScriptText(urand(0, 1) ? SAY_SUMMON1 : SAY_SUMMON2, m_creature);
                    m_uiSummonAgentsTimer = 5000;
                }
                else if (m_Phase == PHASE_VOID)
                {
                    DoScriptText(SAY_VOIDB, m_creature);

                    SetCombatMovement(true);
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                }

                m_uiDelayTimer = 0;
            }
            else
                m_uiDelayTimer -= uiDiff;

            // Combat is still on hold
            return;
        }

        switch (m_Phase)
        {
            case PHASE_NORMAL:
                // Phase 1 Timer
                if (m_uiSplitTimer <= uiDiff)
                {
                    m_Phase = PHASE_SPLIT;

                    // After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.
                    // ToDo: check if there are some spells involved in this event!
                    m_creature->GetMotionMaster()->MoveIdle();
                    SetCombatMovement(false);
                    m_creature->NearTeleportTo(fRoomCenter[0], fRoomCenter[1], fRoomCenter[2], fRoomCenter[3], true);

                    m_uiDelayTimer = 1000;
                    m_uiSplitTimer = 75000;
                    // Do nothing more, if phase switched
                    return;
                }
                else
                    m_uiSplitTimer -= uiDiff;

                // Wrath of the Astromancer targets a random player which will explode after 6 secondes
                if (m_uiWrathOfTheAstromancerTimer <= uiDiff)
                {
                    // Target the tank ?
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, SPELL_WRATH_OF_THE_ASTROMANCER, SELECT_FLAG_PLAYER))
                    {
                        if (DoCastSpellIfCan(pTarget, SPELL_WRATH_OF_THE_ASTROMANCER) == CAST_OK)
                            m_uiWrathOfTheAstromancerTimer = urand(12000, 18000);
                    }
                    else
                        m_uiWrathOfTheAstromancerTimer = 10000;
                }
                else
                    m_uiWrathOfTheAstromancerTimer -= uiDiff;

                // Blinding Light Timer
                if (m_uiBlindingLightTimer <= uiDiff)
                {
                    // She casts this spell every 45 seconds. It is a kind of Moonfire spell, which she strikes down on the whole raid simultaneously. It hits everyone in the raid for 2280 to 2520 arcane damage.
                    if (DoCastSpellIfCan(m_creature, SPELL_BLINDING_LIGHT) == CAST_OK && DoCastSpellIfCan(m_creature, SPELL_MARK_OF_SOLARIAN) == CAST_OK)
                        m_uiBlindingLightTimer = 20000;
                }
                else
                    m_uiBlindingLightTimer -= uiDiff;

                // Arcane Missiles Timer
                if (m_uiArcaneMissilesTimer <= uiDiff)
                {
                    // Solarian casts Arcane Missiles on on random targets in the raid.
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_ARCANE_MISSILES, SELECT_FLAG_PLAYER))
                    {
                        DoCastSpellIfCan(pTarget, SPELL_ARCANE_MISSILES);
                        m_uiArcaneMissilesTimer = urand(3000, 3500);
                        return;
                    }
                }
                else
                    m_uiArcaneMissilesTimer -= uiDiff;

                DoMeleeAttackIfReady();
                break;

            case PHASE_SPLIT:
                // Summon 4 Agents on each portal
                if (m_uiSummonAgentsTimer)
                {
                    if (m_uiSummonAgentsTimer <= uiDiff)
                    {
                        for (uint8 i = 0; i < MAX_SPOTLIGHTS; ++i)
                        {
                            if (Creature* pSpotlight = m_creature->GetMap()->GetCreature(m_vSpotLightsGuidVector[i]))
                            {
                                for (uint8 j = 0; j < MAX_AGENTS; ++j)
                                    m_creature->SummonCreature(NPC_SOLARIUM_AGENT, pSpotlight->GetPositionX(), pSpotlight->GetPositionY(), pSpotlight->GetPositionZ(), 0, TEMPSPAWN_DEAD_DESPAWN, 0);
                            }
                        }
                        m_uiSummonAgentsTimer  = 0;
                        m_uiSummonPriestsTimer = 16000;
                    }
                    else
                        m_uiSummonAgentsTimer -= uiDiff;
                }

                if (m_uiSummonPriestsTimer)
                {
                    if (m_uiSummonPriestsTimer <= uiDiff)
                    {
                        m_Phase = PHASE_NORMAL;
                        // Randomize the portals
                        std::random_shuffle(m_vSpotLightsGuidVector.begin(), m_vSpotLightsGuidVector.end());
                        // Summon 2 priests
                        for (uint8 i = 0; i < 2; ++i)
                        {
                            if (Creature* pSpotlight = m_creature->GetMap()->GetCreature(m_vSpotLightsGuidVector[i]))
                                m_creature->SummonCreature(NPC_SOLARIUM_PRIEST, pSpotlight->GetPositionX(), pSpotlight->GetPositionY(), pSpotlight->GetPositionZ(), 0, TEMPSPAWN_DEAD_DESPAWN, 0);
                        }
                        // Teleport the boss at the last portal
                        if (Creature* pSpotlight = m_creature->GetMap()->GetCreature(m_vSpotLightsGuidVector[2]))
                            m_creature->NearTeleportTo(pSpotlight->GetPositionX(), pSpotlight->GetPositionY(), pSpotlight->GetPositionZ(), pSpotlight->GetOrientation(), true);

                        SetCombatMovement(true);
                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());

                        // Set as visible and reset spells timers
                        m_creature->SetVisibility(VISIBILITY_ON);
                        m_uiArcaneMissilesTimer        = 0;
                        m_uiSummonPriestsTimer         = 0;
                        m_uiBlindingLightTimer         = 20000;
                        m_uiWrathOfTheAstromancerTimer = urand(20000, 25000);
                    }
                    else
                        m_uiSummonPriestsTimer -= uiDiff;
                }

                break;

            case PHASE_VOID:
                // Fear Timer
                if (m_uiFearTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_PSYHIC_SCREAM) == CAST_OK)
                        m_uiFearTimer = 20000;
                }
                else
                    m_uiFearTimer -= uiDiff;

                // Void Bolt Timer
                if (m_uiVoidBoltTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_VOID_BOLT) == CAST_OK)
                        m_uiVoidBoltTimer = 10000;
                }
                else
                    m_uiVoidBoltTimer -= uiDiff;

                DoMeleeAttackIfReady();
                break;
        }
    }
Exemple #11
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_creature->HasAura(SPELL_PLANAR_SHIFT))
            return;

        if (m_creature->GetHealthPercent() < m_fHpPercent)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_PLANAR_SHIFT) == CAST_OK)
            {
                // Get all the vehicle entries which are in combat with the boss
                m_vAnomalyTargets.clear();
                m_uiAnomalyTargetIndex = 0;

                ThreatList const& threatList = m_creature->getThreatManager().getThreatList();
                for (ThreatList::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
                {
                    if (Unit* pTarget = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
                    {
                        if (pTarget->GetEntry() == NPC_RUBY_DRAKE || pTarget->GetEntry() == NPC_AMBER_DRAKE || pTarget->GetEntry() == NPC_EMERALD_DRAKE)
                            m_vAnomalyTargets.push_back(pTarget->GetObjectGuid());
                    }
                }

                // This will summon an anomaly for each player (vehicle)
                DoCastSpellIfCan(m_creature, SPELL_PLANAR_ANOMALIES, CAST_TRIGGERED);

                switch (urand(0, 2))
                {
                    case 0: DoScriptText(SAY_ARCANE_SHIELD, m_creature); break;
                    case 1: DoScriptText(SAY_FIRE_SHIELD, m_creature); break;
                    case 2: DoScriptText(SAY_NATURE_SHIELD, m_creature); break;
                }
                DoScriptText(EMOTE_ASTRAL_PLANE, m_creature);

                // set next phase to 20%
                m_fHpPercent -= 40;
            }
        }

        if (m_uiArcaneBarrageTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_ARCANE_BARRAGE : SPELL_ARCANE_BARRAGE_H) == CAST_OK)
                    m_uiArcaneBarrageTimer = urand(2000, 3000);
            }
        }
        else
            m_uiArcaneBarrageTimer -= uiDiff;

        if (m_uiSummonWhelpsTimer < uiDiff)
        {
            // ToDo: the number of whelps summoned may be different based on difficulty. Needs research!
            for (uint8 i = 0; i < 4; ++i)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_LEY_WHELP, CAST_TRIGGERED) == CAST_OK)
                    m_uiSummonWhelpsTimer = 20000;
            }
        }
        else
            m_uiSummonWhelpsTimer -= uiDiff;

        if (m_uiArcaneVolleyTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_ARCANE_VOLLEY : SPELL_ARCANE_VOLLEY_H) == CAST_OK)
                m_uiArcaneVolleyTimer = urand(10000, 15000);
        }
        else
            m_uiArcaneVolleyTimer -= uiDiff;

        if (m_uiEnrageTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_ENRAGED_ASSAULT) == CAST_OK)
            {
                DoScriptText(SAY_FRENZY, m_creature);
                m_uiEnrageTimer = urand(40000, 50000);
            }
        }
        else
            m_uiEnrageTimer -= uiDiff;
    }
    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_uiInciteChaosWaitTimer)
        {
            if (m_uiInciteChaosWaitTimer <= uiDiff)
            {
                // Restart attack on all targets
                for (GuidVector::const_iterator itr = m_vTargetsGuids.begin(); itr != m_vTargetsGuids.end(); ++itr)
                {
                    if (Unit* pTarget = m_creature->GetMap()->GetUnit(*itr))
                        AttackStart(pTarget);
                }

                m_creature->HandleEmote(EMOTE_STATE_NONE);
                m_uiInciteChaosWaitTimer = 0;
            }
            else
                m_uiInciteChaosWaitTimer -= uiDiff;
        }

        // Return since we have no pTarget
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiInciteChaosTimer < uiDiff)
        {
            // Store the threat list
            m_vTargetsGuids.clear();
            m_creature->FillGuidsListFromThreatList(m_vTargetsGuids);

            if (DoCastSpellIfCan(m_creature, SPELL_INCITE_CHAOS) == CAST_OK)
            {
                m_creature->HandleEmote(EMOTE_STATE_LAUGH);
                m_uiInciteChaosTimer = 55000;
                m_uiInciteChaosWaitTimer = 16000;
                return;
            }
        }
        else
            m_uiInciteChaosTimer -= uiDiff;

        // Charge Timer
        if (m_uiChargeTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1, SPELL_CHARGE, SELECT_FLAG_NOT_IN_MELEE_RANGE))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_CHARGE) == CAST_OK)
                    m_uiChargeTimer = urand(30000, 43000);
            }
        }
        else
            m_uiChargeTimer -= uiDiff;

        // Knockback Timer
        if (m_uiKnockbackTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_WAR_STOMP) == CAST_OK)
                m_uiKnockbackTimer = urand(15000, 30000);
        }
        else
            m_uiKnockbackTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }