示例#1
0
    void JustSummoned(Creature* pSummoned) override
    {
        if (pSummoned->GetEntry() == NPC_HULKING_CORPSE || pSummoned->GetEntry() == NPC_FETID_TROLL_CORPSE || pSummoned->GetEntry() == NPC_RISON_SHADOWCASTER)
        {
            // Let them move down the stairs
            float fX, fY, fZ;

            // The end of the stairs is approximately at 1/3 of the way between summoning-position and novos, height of Novos
            if (Creature* pNovos = m_pInstance->GetSingleCreatureFromStorage(NPC_NOVOS))
            {
                m_creature->GetRandomPoint(0.70 * pNovos->GetPositionX() + 0.30 * pSummoned->GetPositionX(), 0.70 * pNovos->GetPositionY() + 0.30 * pSummoned->GetPositionY(), pNovos->GetPositionZ() + 1.5f, 4.0f, fX, fY, fZ);
                pSummoned->GetMotionMaster()->MovePoint(1, fX, fY, fZ);
            }
        }
    }
示例#2
0
    void UpdateAI(const uint32 uiDiff) override
    {
        switch (m_uiPhase)
        {
            case PHASE_IDLE:
                // no actions during this phase
                return;
            case PHASE_SHIELDED:                            // Event Phase, only summoning of mobs
                if (m_uiSummonHandlerTimer < uiDiff)
                {
                    float fX, fY, fZ;
                    ++m_uiSummonedHandlers;
                    m_creature->GetRandomPoint(aHandlerSummonPos[m_uiSummonedHandlers % 2][0], aHandlerSummonPos[m_uiSummonedHandlers % 2][1], aHandlerSummonPos[m_uiSummonedHandlers % 2][2], 10.0f, fX, fY, fZ);
                    m_creature->SummonCreature(NPC_CRYSTAL_HANDLER, fX, fY, fZ, 0.0f, TEMPSPAWN_DEAD_DESPAWN, 0);

                    DoScriptText(SAY_ADDS, m_creature);
                    DoScriptText(EMOTE_ASSISTANCE, m_creature);

                    m_uiSummonHandlerTimer = 40000;
                }
                else
                    m_uiSummonHandlerTimer -= uiDiff;

                if (m_uiSummonShadowcasterTimer < uiDiff)
                {
                    if (m_pInstance)
                        if (Creature* pSummoner = m_pInstance->GetSummonDummy())
                            pSummoner->CastSpell(pSummoner, SPELL_SUMMON_RISON_SHADOWCASTER, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
                    m_uiSummonShadowcasterTimer = 25000;
                }
                else
                    m_uiSummonShadowcasterTimer -= uiDiff;

                if (m_uiSummonFetidTrollTimer < uiDiff)
                {
                    if (m_pInstance)
                        if (Creature* pSummoner = m_pInstance->GetSummonDummy())
                            pSummoner->CastSpell(pSummoner, SPELL_SUMMON_FETID_TROLL_CORPSE, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
                    m_uiSummonFetidTrollTimer = 5000;
                }
                else
                    m_uiSummonFetidTrollTimer -= uiDiff;

                if (m_uiSummonHulkingCorpseTimer < uiDiff)
                {
                    if (m_pInstance)
                        if (Creature* pSummoner = m_pInstance->GetSummonDummy())
                            pSummoner->CastSpell(pSummoner, SPELL_SUMMON_HULKING_CORPSE, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
                    m_uiSummonHulkingCorpseTimer = 30000;
                }
                else
                    m_uiSummonHulkingCorpseTimer -= uiDiff;

                break;

            case PHASE_WAITING:                             // Short delay between last destroyed crystal and entering combat
                if (m_uiPhaseTimer < uiDiff)
                {
                    m_uiPhase = PHASE_NORMAL;
                    // Remove Immunity and Shield Aura
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    m_creature->RemoveAllAuras();

                    if (!m_bIsRegularMode)
                        DoCastSpellIfCan(m_creature, SPELL_SUMMON_MINIONS_H, CAST_INTERRUPT_PREVIOUS);
                    else
                        m_creature->InterruptNonMeleeSpells(true);
                }
                else
                    m_uiPhaseTimer -= uiDiff;

                break;

            case PHASE_NORMAL:                              // Normal Phase, attack enemies
                if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
                    return;

                if (m_uiArcaneBlastTimer < uiDiff)
                {
                    // TODO - might be possible that this spell is only casted, when there is an enemy in range
                    if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_ARCANE_BLAST : SPELL_ARCANE_BLAST_H) == CAST_OK)
                        m_uiArcaneBlastTimer = urand(7000, 9000);
                }
                else
                    m_uiArcaneBlastTimer -= uiDiff;

                if (m_uiBlizzardTimer < uiDiff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_BLIZZARD : SPELL_BLIZZARD_H) == CAST_OK)
                            m_uiBlizzardTimer = urand(9000, 13500);
                }
                else
                    m_uiBlizzardTimer -= uiDiff;

                if (m_uiWrathTimer < uiDiff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_WRATH_OF_MISERY : SPELL_WRATH_OF_MISERY_H) == CAST_OK)
                            m_uiWrathTimer = urand(12500, 17200);
                }
                else
                    m_uiWrathTimer -= uiDiff;

                if (!m_creature->IsNonMeleeSpellCasted(true))       // TODO Use this additional check, because might want to change the random target to be a target that is in LoS (which then is expensive)
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                        DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_FROSTBOLT : SPELL_FROSTBOLT_H);

                break;
        }
    }
示例#3
0
 void JustReachedHome() override
 {
     if (m_pInstance)
         m_pInstance->SetData(TYPE_NOVOS, FAIL);
 }
示例#4
0
 void JustReachedHome() override
 {
     if (m_pInstance)
         m_pInstance->SetData(TYPE_TROLLGORE, FAIL);
 }