コード例 #1
0
    void JustSummoned(Creature* pSummoned)
    {
        switch(pSummoned->GetEntry())
        {
            case NPC_HEARTHEN_GUARD:
            case NPC_SHARPSHOOTER_GUARD:
            case NPC_REAVER_GUARD:
                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    pSummoned->AI()->AttackStart(pTarget);

                m_vAddGuids.push_back(pSummoned->GetObjectGuid());
                break;
            case NPC_SHATTERED_ASSASSIN:
                m_vAssassinGuids.push_back(pSummoned->GetObjectGuid());
                break;
        }
    }
コード例 #2
0
    void SummonInfernal()
    {
        InfernalPoint *point = NULL;
        float posX,posY,posZ;
        if ((m_creature->GetMapId() != 532) || m_positions.empty())
        {
            m_creature->GetRandomPoint(m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 60, posX, posY, posZ);
        }
        else
        {
            std::vector<InfernalPoint*>::iterator itr = m_positions.begin()+rand()%m_positions.size();
            point = *itr;
            m_positions.erase(itr);

            posX = point->x;
            posY = point->y;
            posZ = INFERNAL_Z;
        }

        Creature *Infernal = m_creature->SummonCreature(NETHERSPITE_INFERNAL, posX, posY, posZ, 0, TEMPSUMMON_TIMED_DESPAWN, 180000);

        if (Infernal)
        {
            Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE);
            Infernal->setFaction(m_creature->getFaction());

            netherspite_infernalAI* pInfernalAI = dynamic_cast<netherspite_infernalAI*>(Infernal->AI());

            if (pInfernalAI)
            {
                if (point)
                    pInfernalAI->pPoint = point;

                pInfernalAI->m_malchezaarGuid = m_creature->GetObjectGuid();
            }

            m_vInfernalGuids.push_back(Infernal->GetObjectGuid());
            DoCastSpellIfCan(Infernal, SPELL_INFERNAL_RELAY);
        }

        DoScriptText(urand(0, 1) ? SAY_SUMMON1 : SAY_SUMMON2, m_creature);
    }