コード例 #1
0
    // Wrapper to handle the drakkari invaders summon
    void DoSummonDrakkariInvaders()
    {
        if (!m_pInstance)
            return;

        // check if there are there are at least 2 triggers in the vector
        if (m_vTriggers.size() < 2)
            return;

        if (roll_chance_i(30))
        {
            // Summon a troll in the corner and 2 trolls in the air
            if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->GetTrollgoreCornerTrigger()))
                pTrigger->CastSpell(pTrigger, roll_chance_i(20) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());

            // get two random outside triggers
            uint8 uiMaxTriggers = m_vTriggers.size();
            uint8 uiPos1 = urand(0, uiMaxTriggers  - 1);
            uint8 uiPos2 = (uiPos1 + urand(1, uiMaxTriggers  - 1)) % uiMaxTriggers;

            if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTriggers[uiPos1]))
                pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
            if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTriggers[uiPos2]))
                pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
        }
        else
        {
            // Summon 3 trolls in the air
            for (auto m_vTrigger : m_vTriggers)
            {
                if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_vTrigger))
                    pTrigger->CastSpell(pTrigger, roll_chance_i(30) ? SPELL_SUMMON_INVADER_1 : SPELL_SUMMON_INVADER_2, TRIGGERED_OLD_TRIGGERED, nullptr, nullptr, m_creature->GetObjectGuid());
            }
        }
    }
コード例 #2
0
ファイル: boss_falric.cpp プロジェクト: mynew4/RustEmu-Core
 void CallFallSoldier()
 {
     for (uint8 i = 0; i < 4 && m_uiSummonGUID.size(); i++)
     {
         if(Creature* Summon = m_pInstance->instance->GetCreature(m_uiSummonGUID.back()))
         {
            Summon->setFaction(14);
            Summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            Summon->SetInCombatWithZone();
         }
         m_uiSummonGUID.pop_back();
     }
 }
コード例 #3
0
ファイル: boss_gothik.cpp プロジェクト: AllThing/TrinityCore
            void EnterCombat(Unit* /*who*/) override
            {
                for (uint32 i = 0; i < POS_LIVE; ++i)
                    if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonLive[i]))
                        LiveTriggerGUID.push_back(trigger->GetGUID());
                for (uint32 i = 0; i < POS_DEAD; ++i)
                    if (Creature* trigger = DoSummon(WORLD_TRIGGER, PosSummonDead[i]))
                        DeadTriggerGUID.push_back(trigger->GetGUID());

                if (LiveTriggerGUID.size() < POS_LIVE || DeadTriggerGUID.size() < POS_DEAD)
                {
                    TC_LOG_ERROR("scripts", "Script Gothik: cannot summon triggers!");
                    EnterEvadeMode();
                    return;
                }

                _EnterCombat();
                waveCount = 0;
                events.ScheduleEvent(EVENT_SUMMON, 30000);
                DoTeleportTo(PosPlatform);
                Talk(SAY_SPEECH);
                instance->SetData(DATA_GOTHIK_GATE, GO_STATE_READY);
            }
コード例 #4
0
    void DoSetupAdds()
    {
        m_uiSetupAddsTimer = 0;

        if (!m_pInstance)
            return;

        GuidList lAddGuids;
        m_pInstance->GetKelidanAddList(lAddGuids);

        // Sort Adds to vector if not already done
        if (!lAddGuids.empty())
        {
            m_vAddGuids.reserve(lAddGuids.size());
            std::list<Creature*> lAdds;
            for (GuidList::const_iterator itr = lAddGuids.begin(); itr != lAddGuids.end(); ++itr)
            {
                if (Creature* pAdd = m_pInstance->instance->GetCreature(*itr))
                    lAdds.push_back(pAdd);
            }
            // Sort them by angle
            lAdds.sort(SortByAngle(m_creature));
            for (std::list<Creature*>::const_iterator itr = lAdds.begin(); itr != lAdds.end(); ++itr)
                m_vAddGuids.push_back((*itr)->GetObjectGuid());
        }

        // Respawn killed adds and reset counter
        m_uiKilledAdds = 0;
        for (GuidVector::const_iterator itr = m_vAddGuids.begin(); itr != m_vAddGuids.end(); ++itr)
        {
            Creature* pAdd = m_pInstance->instance->GetCreature(*itr);
            if (pAdd && !pAdd->isAlive())
                pAdd->Respawn();
        }

        // Cast pentagram
        uint8 s = m_vAddGuids.size();
        for (uint8 i = 0; i < s; ++i)
        {
            Creature* pCaster = m_pInstance->instance->GetCreature(m_vAddGuids[i]);
            Creature* pTarget = m_pInstance->instance->GetCreature(m_vAddGuids[(i + 2) % s]);
            if (pCaster && pTarget)
                pCaster->CastSpell(pTarget, SPELL_CHANNELING, TRIGGERED_NONE);
        }

        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
    }
コード例 #5
0
    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;
    }
コード例 #6
0
ファイル: boss_eregos.cpp プロジェクト: AwkwardDev/mangos-d3
    void JustSummoned(Creature* pSummoned) override
    {
        if (pSummoned->GetEntry() == NPC_PLANAR_ANOMALY)
        {
            pSummoned->CastSpell(pSummoned, SPELL_PLANAR_ANOMALY_AGGRO, true);

            // If this happens then something is really wrong
            if (m_vAnomalyTargets.empty())
                return;

            if (Unit* pTarget = m_creature->GetMap()->GetUnit(m_vAnomalyTargets[m_uiAnomalyTargetIndex]))
                pSummoned->GetMotionMaster()->MoveFollow(pTarget, 0, 0);

            if (m_uiAnomalyTargetIndex < m_vAnomalyTargets.size() - 1)
                ++m_uiAnomalyTargetIndex;
        }
        else if (pSummoned->GetEntry() == NPC_GREATER_LEY_WHELP)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                pSummoned->AI()->AttackStart(pTarget);
        }
    }
コード例 #7
0
    // Wrapper to summon the npcs for the epilogue
    void DoSummonBrokenAshtongue()
    {
        if (!m_pInstance)
            return;

        float fX, fY, fZ;

        // Spawn 4 Broken in the center and behind the column
        for (uint8 i = 0; i < countof(afBrokenSpawnLoc); ++i)
        {
            for (uint8 j = 0; j < 4; ++j)
            {
                fX = afBrokenSpawnLoc[i].m_fX;
                fY = afBrokenSpawnLoc[i].m_fY + (j * 7);
                fZ = afBrokenSpawnLoc[i].m_fZ;

                m_creature->SummonCreature(NPC_ASH_BROKEN, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 10 * MINUTE * IN_MILLISECONDS);
            }
        }

        GuidVector vGeneratorsVect;
        m_pInstance->GetGeneratorGuidVector(vGeneratorsVect);

        // Spawn 4 Broken at each generator
        for (uint8 i = 0; i < vGeneratorsVect.size(); ++i)
        {
            if (Creature* pGenerator = m_creature->GetMap()->GetCreature(vGeneratorsVect[i]))
            {
                for (uint8 j = 0; j < 4; ++j)
                {
                    pGenerator->GetRandomPoint(pGenerator->GetPositionX(), pGenerator->GetPositionY(), pGenerator->GetPositionZ(), 10.0f, fX, fY, fZ);
                    m_creature->SummonCreature(NPC_ASH_BROKEN, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 10 * MINUTE * IN_MILLISECONDS);
                }
            }
        }
    }
コード例 #8
0
ファイル: boss_xt_002.cpp プロジェクト: AwkwardDev/mangos-d3
    void UpdateAI(const uint32 uiDiff) override
    {
        if (m_uiRobotTimer)
        {
            if (m_uiRobotTimer <= uiDiff)
            {
                // visual effect on XT (script target)
                DoCastSpellIfCan(m_creature, SPELL_LIGHTNING_TETHER, CAST_TRIGGERED);

                // cast the enerby orb on each pile one by one
                if (Creature* pToyPile = m_creature->GetMap()->GetCreature(m_vToyPileGuids[urand(0, m_vToyPileGuids.size() - 1)]))
                    DoCastSpellIfCan(pToyPile, SPELL_ENERGY_ORB, CAST_TRIGGERED);

                // reset timer after the overload aura expires
                if (m_creature->HasAura(SPELL_EXPOSED_HEART))
                    m_uiRobotTimer = urand(1000, 3000);
                else
                    m_uiRobotTimer = 0;
            }
            else
                m_uiRobotTimer -= uiDiff;
        }
    }
コード例 #9
0
    void MovementInform(uint32 uiMotionType, uint32 uiPointId) override
    {
        if (uiMotionType != POINT_MOTION_TYPE || !uiPointId)
            return;

        // move to another random stalker
        if (Creature* pStalker = m_creature->GetMap()->GetCreature(m_vStalkersGuids[urand(0, m_vStalkersGuids.size() - 1)]))
            m_creature->GetMotionMaster()->MovePoint(1, pStalker->GetPositionX(), pStalker->GetPositionY(), pStalker->GetPositionZ());
    }
コード例 #10
0
    void Reset() override
    {
        // get the list of summoned stalkers and move to a randome one
        if (m_pInstance)
            m_pInstance->GetStalkersGUIDVector(m_vStalkersGuids);

        if (m_vStalkersGuids.empty())
            return;

        m_creature->SetWalk(false);
        if (Creature* pStalker = m_creature->GetMap()->GetCreature(m_vStalkersGuids[urand(0, m_vStalkersGuids.size() - 1)]))
            m_creature->GetMotionMaster()->MovePoint(1, pStalker->GetPositionX(), pStalker->GetPositionY(), pStalker->GetPositionZ());
    }