void SummonedCreatureJustDied(Creature* pSummoned)
    {
        if (pSummoned->GetEntry() == NPC_FLAMEWAKER_HEALER || pSummoned->GetEntry() == NPC_FLAMEWAKER_ELITE)
        {
            m_uiAddsKilled += 1;

            // Yell if only one Add alive
            if (m_uiAddsKilled == m_luiMajordomoAddsGUIDs.size() - 1)
                DoScriptText(SAY_LAST_ADD, m_creature);

            // All adds are killed, retreat
            else if (m_uiAddsKilled == m_luiMajordomoAddsGUIDs.size())
            {
                m_bHasEncounterFinished = true;
                m_creature->GetMotionMaster()->MoveTargetedHome();
            }
        }
    }
    void InitSentinelsNear(Unit* pTarget)
    {
        if (!m_lAssistList.empty())
        {
            for(GUIDList::const_iterator itr = m_lAssistList.begin(); itr != m_lAssistList.end(); ++itr)
            {
                if (*itr == m_creature->GetObjectGuid())
                    continue;

                if (Creature* pBuddy = m_creature->GetMap()->GetCreature(*itr))
                {
                    if (pBuddy->isAlive())
                        pBuddy->AI()->AttackStart(pTarget);
                }
            }

            return;
        }

        std::list<Creature*> lAssistList;
        GetCreatureListWithEntryInGrid(lAssistList, m_creature, m_creature->GetEntry(), 80.0f);

        if (lAssistList.empty())
            return;

        for(std::list<Creature*>::iterator iter = lAssistList.begin(); iter != lAssistList.end(); ++iter)
        {
            m_lAssistList.push_back((*iter)->GetObjectGuid());

            if ((*iter)->GetObjectGuid() == m_creature->GetObjectGuid())
                continue;

            (*iter)->AI()->AttackStart(pTarget);
        }

        if (m_lAssistList.size() != MAX_BUDDY)
            error_log("SSC: npc_anubisath_sentinel found too few/too many buddies, expected %u.", MAX_BUDDY);
    }
Exemplo n.º 3
0
    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim() || m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
            return;

        if (m_uiMark_Count >= 100)
            if (m_uiEnrage_Timer < uiDiff)
            {
                m_creature->InterruptNonMeleeSpells(false);
                DoCast(m_creature, SPELL_BERSERK, true);
                m_uiEnrage_Timer = 300000;
            }
            else
                m_uiEnrage_Timer -= uiDiff;

        // Mark of Blaumeux
        if (m_uiMark_Timer < uiDiff)
        {
            DoCastSpellIfCan(m_creature,SPELL_MARK_OF_BLAUMEUX,CAST_TRIGGERED);
            m_uiMark_Timer = 15000;
            m_uiMark_Count++;
        }
        else 
            m_uiMark_Timer -= uiDiff;

        // Shield Wall - All 4 horsemen will shield wall at 50% hp and 20% hp for 20 seconds
        if (m_bShieldWall1 && m_creature->GetHealthPercent() < 50.0f)
        {
            if (m_bShieldWall1)
            {
                DoCastSpellIfCan(m_creature,SPELL_SHIELDWALL);
                m_bShieldWall1 = false;
            }
        }
        else if (m_bShieldWall2 && m_creature->GetHealthPercent() < 20.0f)
        {
            if (m_bShieldWall2)
            {
                DoCastSpellIfCan(m_creature,SPELL_SHIELDWALL);
                m_bShieldWall2 = false;
            }
        }

        // Void Zone
        if (m_uiVoidZone_Timer < uiDiff)
        {
            // get random player in 45yard range (maybe this can be done easier?)
            ThreatList const& tList = m_creature->getThreatManager().getThreatList();

            if(!tList.empty())
            {
                GUIDList lClosePlayerList;
                lClosePlayerList.clear();

                for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr)
                    if(Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
                        if (m_creature->GetDistance2d(pUnit) < 45.f)
                            lClosePlayerList.push_back(pUnit->GetGUID());

                if(!lClosePlayerList.empty())
                {
                    GUIDList::iterator i = lClosePlayerList.begin();
                    advance(i, (rand() % lClosePlayerList.size()));
                    if(Player* pTarget = m_creature->GetMap()->GetPlayer(*i))
                        DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_VOIDZONE : H_SPELL_VOIDZONE, CAST_TRIGGERED);
                }
            }
            m_uiVoidZone_Timer = 12000;
        }
        else 
            m_uiVoidZone_Timer -= uiDiff;

        if (m_uiShadowBolt_Timer < uiDiff)
        {
            // cast on closest player
            ThreatList const& tList = m_creature->getThreatManager().getThreatList();
            if (!tList.empty())
            {
                Unit* pTarget = m_creature->GetMap()->GetUnit((*tList.begin())->getUnitGuid());
                for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr)
                    if (Unit* pUnit = m_creature->GetMap()->GetUnit((*itr)->getUnitGuid()))
                        if (pTarget && m_creature->GetDistance2d(pUnit) < m_creature->GetDistance2d(pTarget))
                            pTarget = pUnit;
                if (pTarget && m_creature->GetDistance2d(pTarget)< 45.0f)
                    DoCast(pTarget, m_bIsRegularMode ? SPELL_SHADOW_BOLT : H_SPELL_SHADOW_BOLT, true);
                else
                    DoCast(m_creature, SPELL_UNYIELDING_PAIN, true);
            }
            m_uiShadowBolt_Timer = 2000;
        }
        else
            m_uiShadowBolt_Timer -= uiDiff;

        DoMeleeAttackIfReady();
    }