Ejemplo n.º 1
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            if (m_bIsIntroDone)
                return;

            if (pArthas && pArthas->isAlive())
            {
                if (m_uiIntroTimer < uiDiff)
                {
                    m_uiIntroTimer = 10000;

                    switch (m_uiIntroCount)
                    {
                        case 0:
                            DoScriptText(SAY_INTRO_1, m_creature);
                            break;
                        case 1:
                            DoScriptText(SAY_INTRO_2_ARTHAS, pArthas);
                            break;
                        case 2:
                            pArthas->CastSpell(m_creature, SPELL_TRANSFORMING_CHANNEL, false);
                            m_creature->CastSpell(m_creature, SPELL_TRANSFORMING_FLOATING, false);
                            DoMoveToPosition();
                            break;
                        case 3:
                            m_creature->CastSpell(m_creature, SPELL_TRANSFORMING, false);
                            DoScriptText(SAY_INTRO_3, m_creature);
                            break;
                        case 4:
                            DoScriptText(SAY_INTRO_4_ARTHAS, pArthas);
                            break;
                        case 5:
                            DoScriptText(SAY_INTRO_5, m_creature);
                            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            m_bIsIntroDone = true;
                            break;
                    }

                    ++m_uiIntroCount;
                }
                else
                    m_uiIntroTimer -= uiDiff;
            }

            return;
        }

        DoMeleeAttackIfReady();
    }
Ejemplo n.º 2
0
    void UpdateIntro(const uint32 uiDiff)
    {
        if (m_bIsIntroDone)
            return;
        Unit* pArthas = SummonMgr.GetFirstFoundSummonWithId(NPC_ARTHAS_IMAGE);

        if (pArthas && pArthas->isAlive())
        {
            if (m_uiIntroTimer < uiDiff)
            {
                m_uiIntroTimer = 10000;

                switch(m_uiIntroCount)
                {
                    case 0:
                        DoScriptText(SAY_INTRO_1, m_creature);
                        break;
                    case 1:
                        DoScriptText(SAY_INTRO_2_ARTHAS, pArthas);
                        break;
                    case 2:
                        pArthas->CastSpell(m_creature, SPELL_TRANSFORMING_CHANNEL, false);
                        m_creature->CastSpell(m_creature, SPELL_TRANSFORMING_FLOATING, false);
                        DoMoveToPosition();
                        break;
                    case 3:
                        m_creature->CastSpell(m_creature, SPELL_TRANSFORMING, false);
                        DoScriptText(SAY_INTRO_3, m_creature);
                        break;
                    case 4:
                        DoScriptText(SAY_INTRO_4_ARTHAS, pArthas);
                        break;
                    case 5:
                        DoScriptText(SAY_INTRO_5, m_creature);
                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        m_bIsIntroDone = true;
                        break;
                }

                ++m_uiIntroCount;
            }
            else
                m_uiIntroTimer -= uiDiff;
        }

    }
Ejemplo n.º 3
0
 void JustReachedHome()
 {
     DoMoveToPosition();
 }
Ejemplo n.º 4
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            if (m_bIsIntroDone)
                return;

            if (pArthas && pArthas->isAlive())
            {
                if (m_uiIntroTimer < uiDiff)
                {
                    m_uiIntroTimer = 10000;

                    switch (m_uiIntroCount)
                    {
                    case 0:
                        DoScriptText(SAY_INTRO_1, m_creature);
                        break;
                    case 1:
                        DoScriptText(SAY_INTRO_2_ARTHAS, pArthas);
                        break;
                    case 2:
                        DoCastSpellIfCan(m_creature, SPELL_TRANSFORMING_FLOATING);
                        pArthas->CastSpell(m_creature, SPELL_TRANSFORMING_CHANNEL, false);
                        DoMoveToPosition();
                        break;
                    case 3:
                        DoCastSpellIfCan(m_creature, SPELL_TRANSFORMING);
                        DoScriptText(SAY_INTRO_3, m_creature);
                        break;
                    case 4:
                        DoScriptText(SAY_INTRO_4_ARTHAS, pArthas);
                        break;
                    case 5:
                        DoScriptText(SAY_INTRO_5, m_creature);
                        break;
                    case 6:
                        m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        m_bIsIntroDone = true;
                        break;
                    }

                    ++m_uiIntroCount;
                }
                else
                    m_uiIntroTimer -= uiDiff;
            }

            return;
        }

        if (m_uiSinisterStrikeTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), m_bIsRegularMode ? SPELL_SINISTER_STRIKE : SPELL_SINISTER_STRIKE_H) == CAST_OK)
                m_uiSinisterStrikeTimer = 10000;
        }
        else
            m_uiSinisterStrikeTimer -= uiDiff;

        if (m_uiCallFlamesTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_CALL_FLAMES) == CAST_OK)
                m_uiCallFlamesTimer = urand(10000, 20000);
        }
        else
            m_uiCallFlamesTimer -= uiDiff;

        if (m_uiRitualStrikeTimer)
        {
            if (m_uiRitualStrikeTimer <= uiDiff)
            {
                DoCastSpellIfCan(m_creature, SPELL_RITUAL_STRIKE, CAST_INTERRUPT_PREVIOUS);
                DoCastSpellIfCan(m_creature, SPELL_RITUAL_DISARM, CAST_TRIGGERED);
                m_uiRitualStrikeTimer = 0;
            }
            else
                m_uiRitualStrikeTimer -= uiDiff;
        }

        // As from patch notes: Svala Sorrowgrave now casts Ritual of the Sword 1 time during the encounter, down from 3.
        if (m_creature->GetHealthPercent() < 50.0f && !m_bHasDoneRitual)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_RITUAL_OF_SWORD, SELECT_FLAG_PLAYER))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_RITUAL_OF_SWORD) == CAST_OK)
                {
                    m_ritualTargetGuid = pTarget->GetObjectGuid();

                    // summon channelers
                    DoCastSpellIfCan(m_creature, SPELL_SUMMON_CHANNELER_1, CAST_TRIGGERED);
                    DoCastSpellIfCan(m_creature, SPELL_SUMMON_CHANNELER_2, CAST_TRIGGERED);
                    DoCastSpellIfCan(m_creature, SPELL_SUMMON_CHANNELER_3, CAST_TRIGGERED);

                    switch (urand(0, 3))
                    {
                    case 0:
                        DoScriptText(SAY_SACRIFICE_1, m_creature);
                        break;
                    case 1:
                        DoScriptText(SAY_SACRIFICE_2, m_creature);
                        break;
                    case 2:
                        DoScriptText(SAY_SACRIFICE_3, m_creature);
                        break;
                    case 3:
                        DoScriptText(SAY_SACRIFICE_4, m_creature);
                        break;
                    }

                    m_uiRitualStrikeTimer = 1000;
                    m_bHasDoneRitual = true;
                }
            }
        }

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

            if (pArthas && pArthas->isAlive())
            {
                if (m_uiIntroTimer < uiDiff)
                {
                    m_uiIntroTimer = 10000;

                    switch(m_uiIntroCount)
                    {
                        case 0:
                            DoScriptText(SAY_INTRO_1, m_creature);
                            break;
                        case 1:
                            DoScriptText(SAY_INTRO_2_ARTHAS, pArthas);
                            break;
                        case 2:
                            pArthas->CastSpell(m_creature, SPELL_TRANSFORMING_CHANNEL, false);
                            m_creature->CastSpell(m_creature, SPELL_TRANSFORMING_FLOATING, false);
                            DoMoveToPosition();
                            break;
                        case 3:
                            m_creature->CastSpell(m_creature, SPELL_TRANSFORMING, false);
                            DoScriptText(SAY_INTRO_3, m_creature);
                            break;
                        case 4:
                            DoScriptText(SAY_INTRO_4_ARTHAS, pArthas);
                            break;
                        case 5:
                            DoScriptText(SAY_INTRO_5, m_creature);
                            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            m_bIsIntroDone = true;
                            break;
                    }

                    ++m_uiIntroCount;
                }
                else
                    m_uiIntroTimer -= uiDiff;
            }

            return;
        }

        if(m_uiSacrificeEndTimer < uiDiff && m_bIsSacrifice)
        {
            for(uint8 i=0; i<3; ++i)
            {
                Unit* pAdd = m_creature->GetMap()->GetUnit(m_uiAddsGUID[i]);
                if(pAdd && pAdd->isAlive())
                {
                    Unit* pPlayer = m_creature->GetMap()->GetUnit(m_uiPlayerGUID);
                    if(pPlayer)
                        m_creature->CastSpell(pPlayer, SPELL_KILL, false);

                    for(uint8 k=0; k<3; ++k)
                    {
                        Unit* pAdd = m_creature->GetMap()->GetUnit(m_uiAddsGUID[i]);
                        if(pAdd && pAdd->isAlive())
                        {
                            pAdd->SetVisibility(VISIBILITY_OFF);
                        }
                        m_uiAddsGUID[k].Clear();
                    }
                    m_bIsSacrifice = false;
                    return;
                }
            }
            m_uiPlayerGUID = 0;
            m_bIsSacrifice = false;
            m_creature->setFaction(21);
        }else m_uiSacrificeEndTimer -= uiDiff;

        if(m_uiSinisterStrikeTimer < uiDiff)
        {
            if(m_creature->getVictim())
                m_creature->CastSpell(m_creature->getVictim(), m_bIsRegularMode ? SPELL_SINISTER_STRIKE : SPELL_SINISTER_STRIKE_H, false);
            m_uiSinisterStrikeTimer = urand(10000,20000);
        }else m_uiSinisterStrikeTimer -= uiDiff;

        if(m_uiCallFlamesTimer < uiDiff)
        {
            std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
            for(std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
            {
                Unit *TargetedPlayer = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid());  
                if(TargetedPlayer && TargetedPlayer->isAlive())
                    m_creature->CastSpell(TargetedPlayer, SPELL_BOLT, true);
            }
            m_uiCallFlamesTimer = urand(15000,25000);
        }else m_uiCallFlamesTimer -= uiDiff;

        if(m_uiSacrificeTimer < uiDiff)
        {
            m_uiPlayerGUID = 0;
            if(Unit* pPlayer = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
            {
                m_uiPlayerGUID = pPlayer->GetGUID();
                DoTeleportPlayer(pPlayer, fCoord[0][0], fCoord[0][1], fCoord[0][2], pPlayer->GetOrientation());
                m_uiSacrificeEndTimer = 10000;

                for(uint8 i=0; i<3; ++i)
                    if(Creature* pAdd = m_creature->SummonCreature(NPC_CHANNELER, fCoord[i][0], fCoord[i][1], fCoord[i][2], fCoord[i][3], TEMPSUMMON_TIMED_DESPAWN, 9000))
                    {
                        m_uiAddsGUID[i] = pAdd->GetObjectGuid();
                        pAdd->AI()->AttackStart(pPlayer);
                        pAdd->CastSpell(pPlayer, SPELL_PARALYZE, false);
                    }
            }
            m_bIsSacrifice = true;
            m_uiSacrificeTimer = 24000;
        }else m_uiSacrificeTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }