예제 #1
0
    Creature *RespawnNearbyBugsAndGetOne()
    {
        CreatureList lUnitList;
        GetCreatureListWithEntryInGrid(lUnitList,m_creature,15316,150.0f);
        GetCreatureListWithEntryInGrid(lUnitList,m_creature,15317,150.0f);

        if (lUnitList.empty())
            return NULL;

        Creature *nearb = NULL;

        for(CreatureList::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
        {
            Creature *c = (Creature *)(*iter);
            if (c->isDead())
            {
                c->Respawn();
                c->setFaction(7);
                c->RemoveAllAuras();
            }
            if (c->IsWithinDistInMap(m_creature, ABUSE_BUG_RANGE))
            {
                if (!nearb || !urand(0, 3))
                    nearb = c;
            }
        }
        return nearb;
    }
예제 #2
0
bool GOHello_go_altar_of_keepers(Player* pPlayer, GameObject* pGo)
{
    if (!pPlayer || !pGo)
        return false;

    pPlayer->CastSpell(pPlayer, SPELL_USE_ALTAR_VISUAL, true);

    CreatureList lStoneKeepers;
    GetCreatureListWithEntryInGrid(lStoneKeepers, pGo, NPC_STONE_KEEPER, HALL_RADIUS);

    if (!lStoneKeepers.empty())
    {
        for(CreatureList::iterator itr = lStoneKeepers.begin(); itr != lStoneKeepers.end(); ++itr)
        {
            if (*itr && (*itr)->isAlive())
            {
                (*itr)->setFaction(FACTION_TITAN_UNFRIENDLY);
                (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                (*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                if ((*itr)->AI())
                {
                    (*itr)->RemoveAurasDueToSpell(SPELL_STONED);
                    (*itr)->AI()->AttackStart(pPlayer);
                }
            }
        }
    }
    return false;
}
예제 #3
0
    void EnterEvadeMode()
    {
        CreatureList adds;
        GetCreatureListWithEntryInGrid(adds, m_creature, NPC_ADD, 50.0f);
        if (!adds.empty())
            for(CreatureList::iterator iter = adds.begin(); iter != adds.end(); ++iter)
                (*iter)->ForcedDespawn();

        m_creature->GetMotionMaster()->MoveTargetedHome();
    }
예제 #4
0
    void DespawnSphere()
    {
        CreatureList assistList;
        GetCreatureListWithEntryInGrid(assistList,m_creature, NPC_ETHEREAL_SPHERE ,150.0f);

        if (assistList.empty())
            return;
        for(CreatureList::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
            (*iter)->DealDamage((*iter), (*iter)->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
    }
예제 #5
0
    void DespawnAdds()
    {
        CreatureList pWorshippers;
        GetCreatureListWithEntryInGrid(pWorshippers, m_creature, NPC_WORSHIPPER, DEFAULT_VISIBILITY_INSTANCE);

        if (!pWorshippers.empty())
            for(CreatureList::iterator itr = pWorshippers.begin(); itr != pWorshippers.end(); ++itr)
            {
                (*itr)->ForcedDespawn();
            }

        CreatureList pFollower;
        GetCreatureListWithEntryInGrid(pFollower, m_creature, NPC_FOLLOWER, DEFAULT_VISIBILITY_INSTANCE);

        if (!pFollower.empty())
            for(CreatureList::iterator iter = pFollower.begin(); iter != pFollower.end(); ++iter)
            {
                (*iter)->ForcedDespawn();
            }
    }
예제 #6
0
    Creature* GetCreature(uint32 uiCreatureEntry)
    {
        if (!lCreatureList.empty())
        {
            for (auto& itr : lCreatureList)
            {
                if (itr->GetEntry() == uiCreatureEntry && itr->isAlive())
                    return itr;
            }
        }

        return nullptr;
    }
예제 #7
0
    Creature* SelectRandomCreatureOfEntryInRange(uint32 uiEntry, float fRange)
    {
        CreatureList lCreatureList;
        GetCreatureListWithEntryInGrid(lCreatureList, m_creature, uiEntry, fRange);

        if (lCreatureList.empty())
            return NULL;

        CreatureList::iterator iter = lCreatureList.begin();
        advance(iter, urand(0, lCreatureList.size()-1));

        return *iter;
    }
예제 #8
0
    void DoStartAttackMe()
    {
        if (!lCreatureList.empty())
        {
            for (auto& itr : lCreatureList)
            {
                if (itr->GetEntry() == NPC_REETHE)
                    continue;

                if (itr->isAlive())
                {
                    itr->setFaction(FACTION_THER_HOSTILE);
                    itr->AI()->AttackStart(m_creature);
                }
            }
        }
    }
예제 #9
0
Creature* instance_uldaman::GetClosestDwarfNotInCombat(Creature* pSearcher)
{
    CreatureList lTemp;

    for (GuidList::const_iterator itr = m_lWardens.begin(); itr != m_lWardens.end(); ++itr)
    {
        Creature* pTemp = instance->GetCreature(*itr);

        if (pTemp && pTemp->isAlive() && !pTemp->getVictim())
            lTemp.push_back(pTemp);
    }

    if (lTemp.empty())
        return nullptr;

    lTemp.sort(ObjectDistanceOrder(pSearcher));
    return lTemp.front();
}
예제 #10
0
    void PrepareSummonPlaces()
    {
        CreatureList lSummonList;
        m_pInstance->GetGothSummonPointCreatures(lSummonList, true);

        if (lSummonList.empty())
            return;

        // Trainees and Rider
        uint8 index = 0;
        uint8 uiTraineeCount = 3;
        lSummonList.sort(ObjectDistanceOrder(m_creature));
        for (auto& itr : lSummonList)
        {
            if (itr)
            {
                if (uiTraineeCount == 0)
                    break;
                if (index == 1)
                    m_lRiderSummonPosGuids.push_back(itr->GetObjectGuid());
                else
                {
                    m_lTraineeSummonPosGuids.push_back(itr->GetObjectGuid());
                    --uiTraineeCount;
                }
                index++;
            }
        }

        // DeathKnights
        uint8 uiDeathKnightCount = 2;
        lSummonList.sort(ObjectDistanceOrderReversed(m_creature));
        for (auto& itr : lSummonList)
        {
            if (itr)
            {
                if (uiDeathKnightCount == 0)
                    break;
                m_lDeathKnightSummonPosGuids.push_back(itr->GetObjectGuid());
                --uiDeathKnightCount;
            }
        }
    }
예제 #11
0
void instance_karazhan::DoPrepareChessEvent()
{
    // Allow all the chess pieces to init start position
    for (GuidList::const_iterator itr = m_lChessPiecesAlliance.begin(); itr != m_lChessPiecesAlliance.end(); ++itr)
    {
        if (Creature* pChessPiece = instance->GetCreature(*itr))
        {
            Creature* pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_BLACK, 2.0f);
            if (!pSquare)
                pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_WHITE, 2.0f);
            if (!pSquare)
            {
                script_error_log("Instance Karazhan: ERROR Failed to properly load the Chess square for %s.", pChessPiece->GetGuidStr().c_str());
                return;
            }

            // send event which will prepare the current square
            pChessPiece->AI()->SendAIEvent(AI_EVENT_CUSTOM_B, pSquare, pChessPiece);
        }
    }

    for (GuidList::const_iterator itr = m_lChessPiecesHorde.begin(); itr != m_lChessPiecesHorde.end(); ++itr)
    {
        if (Creature* pChessPiece = instance->GetCreature(*itr))
        {
            Creature* pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_BLACK, 2.0f);
            if (!pSquare)
                pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_WHITE, 2.0f);
            if (!pSquare)
            {
                script_error_log("Instance Karazhan: ERROR Failed to properly load the Chess square for %s.", pChessPiece->GetGuidStr().c_str());
                return;
            }

            // send event which will prepare the current square
            pChessPiece->AI()->SendAIEvent(AI_EVENT_CUSTOM_B, pSquare, pChessPiece);
        }
    }

    // add silence debuff
    Map::PlayerList const& players = instance->GetPlayers();
    for (const auto& player : players)
    {
        if (Player* pPlayer = player.getSource())
            pPlayer->CastSpell(pPlayer, SPELL_GAME_IN_SESSION, TRIGGERED_OLD_TRIGGERED);
    }

    m_uiAllianceStalkerCount = 0;
    m_uiHordeStalkerCount = 0;
    m_vHordeStalkers.clear();
    m_vAllianceStalkers.clear();

    // sort stalkers depending on side
    CreatureList lStalkers;
    for (GuidList::const_iterator itr = m_lChessHordeStalkerList.begin(); itr != m_lChessHordeStalkerList.end(); ++itr)
    {
        if (Creature* pTemp = instance->GetCreature(*itr))
            lStalkers.push_back(pTemp);
    }

    if (lStalkers.empty())
    {
        script_error_log("Instance Karazhan: ERROR Failed to properly load the horde side stalkers for the Chess Event.");
        return;
    }

    // get the proper statusBar npc
    Creature* pStatusBar = instance->GetCreature(m_HordeStatusGuid);
    if (!pStatusBar)
        return;

    lStalkers.sort(ObjectDistanceOrder(pStatusBar));
    for (CreatureList::const_iterator itr = lStalkers.begin(); itr != lStalkers.end(); ++itr)
        m_vHordeStalkers.push_back((*itr)->GetObjectGuid());

    lStalkers.clear();
    for (GuidList::const_iterator itr = m_lChessAllianceStalkerList.begin(); itr != m_lChessAllianceStalkerList.end(); ++itr)
    {
        if (Creature* pTemp = instance->GetCreature(*itr))
            lStalkers.push_back(pTemp);
    }

    if (lStalkers.empty())
    {
        script_error_log("Instance Karazhan: ERROR Failed to properly load the alliance side stalkers for the Chess Event.");
        return;
    }

    // get the proper statusBar npc
    pStatusBar = instance->GetCreature(m_AllianceStatusGuid);
    if (!pStatusBar)
        return;

    lStalkers.sort(ObjectDistanceOrder(pStatusBar));
    for (CreatureList::const_iterator itr = lStalkers.begin(); itr != lStalkers.end(); ++itr)
        m_vAllianceStalkers.push_back((*itr)->GetObjectGuid());
}
예제 #12
0
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        switch (m_uiPhase)
        {
            case PHASE_FAKE_DEATH:
                if (m_uiResurrectTimer < uiDiff)
                {
                    if (!m_pInstance)
                        return;

                    if (m_pInstance->GetData(TYPE_THEKAL) != SPECIAL || m_pInstance->GetData(TYPE_ZATH) != SPECIAL)
                    {
                        DoCastSpellIfCan(m_creature, SPELL_RESURRECT);
                        m_pInstance->SetData(TYPE_LORKHAN, IN_PROGRESS);
                    }

                    m_uiPhase = PHASE_WAITING;
                }
                else
                    m_uiResurrectTimer -= uiDiff;

            // no break needed here
            case PHASE_WAITING:
                return;

            case PHASE_NORMAL:
                if (m_uiDispelTimer < uiDiff)
                {
                    CreatureList pList = DoFindFriendlyCC(30.0f);

                    Creature* dispelTarget = nullptr;

                    if (!pList.empty())
                        for (auto& itr : pList)
                        {
                            dispelTarget = itr;
                            break;
                        }

                    if (!dispelTarget && (m_creature->isInRoots() || m_creature->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_DECREASE_SPEED)))
                        dispelTarget = m_creature;

                    if (dispelTarget && (DoCastSpellIfCan(dispelTarget, SPELL_DISPEL_MAGIC) == CAST_OK))
                        m_uiDispelTimer = urand(15000, 20000);
                }
                else
                    m_uiDispelTimer -= uiDiff;

                // Lightning_Shield_Timer
                if (m_uiLightningShieldTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_LIGHTNING_SHIELD) == CAST_OK)
                        m_uiLightningShieldTimer = 61000;
                }
                else
                    m_uiLightningShieldTimer -= uiDiff;

                // Casting Greatheal to Thekal or Zath if they are in meele range.
                // TODO - why this range check?
                if (m_uiGreatHealTimer < uiDiff)
                {
                    if (m_pInstance)
                    {
                        Creature* pThekal = m_pInstance->GetSingleCreatureFromStorage(NPC_THEKAL);
                        Creature* pZath = m_pInstance->GetSingleCreatureFromStorage(NPC_ZATH);

                        switch (urand(0, 1))
                        {
                            case 0:
                                if (pThekal && m_creature->IsWithinDistInMap(pThekal, 3 * ATTACK_DISTANCE))
                                    DoCastSpellIfCan(pThekal, SPELL_GREAT_HEAL);
                                break;
                            case 1:
                                if (pZath && m_creature->IsWithinDistInMap(pZath, 3 * ATTACK_DISTANCE))
                                    DoCastSpellIfCan(pZath, SPELL_GREAT_HEAL);
                                break;
                        }
                    }

                    m_uiGreatHealTimer = urand(15000, 20000);
                }
                else
                    m_uiGreatHealTimer -= uiDiff;

                // Disarm_Timer
                if (m_uiDisarmTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DISARM) == CAST_OK)
                        m_uiDisarmTimer = urand(15000, 25000);
                }
                else
                    m_uiDisarmTimer -= uiDiff;

                break;
        }

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        // Demoralizing Shout Timer
        if (m_uiDemoralizingShoutTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_DEMORALIZING_SHOUT) == CAST_OK)
                m_uiDemoralizingShoutTimer = urand(15000, 20000);
        }
        else
            m_uiDemoralizingShoutTimer -= uiDiff;

        // Inspire Timer
        if (m_uiInspireTimer < uiDiff)
        {
            Creature* pTarget = nullptr;
            CreatureList pList = DoFindFriendlyMissingBuff(45.0f, SPELL_INSPIRE);
            if (!pList.empty())
            {
                CreatureList::iterator i = pList.begin();
                advance(i, (rand() % pList.size()));
                pTarget = (*i);
            }

            if (!pTarget)
                pTarget = m_creature;

            if (DoCastSpellIfCan(pTarget, SPELL_INSPIRE) == CAST_OK)
                m_uiInspireTimer = 10000;
        }
        else
            m_uiInspireTimer -= uiDiff;

        // Hand of Ragnaros Timer
        if (m_uiKnockdownTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_HAND_OF_RAGNAROS) == CAST_OK)
                m_uiKnockdownTimer = urand(12000, 15000);
        }
        else
            m_uiKnockdownTimer -= uiDiff;

        // Flamespear Timer
        if (m_uiFlamespearTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_FLAMESPEAR) == CAST_OK)
                    m_uiFlamespearTimer = urand(12000, 16000);
            }
        }
        else
            m_uiFlamespearTimer -= uiDiff;

        // Dark Strike Timer
        if (m_uiDarkstrikeTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_DARK_STRIKE) == CAST_OK)
                m_uiDarkstrikeTimer = urand(15000, 18000);
        }
        else
            m_uiDarkstrikeTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
    void UpdateAI(const uint32 uiDiff) override
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiHealTimer < uiDiff)
        {
            if (Unit* pTarget = DoSelectLowestHpFriendly(50.0f))
            {
                if (DoCastSpellIfCan(pTarget, SPELL_FLASH_HEAL) == CAST_OK)
                    m_uiHealTimer = urand(15000, 20000);
            }
        }
        else
            m_uiHealTimer -= uiDiff;

        if (m_uiRenewTimer < uiDiff)
        {
            if (Unit* pTarget = DoSelectLowestHpFriendly(50.0f))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_RENEW : SPELL_RENEW_H) == CAST_OK)
                    m_uiRenewTimer = urand(5000, 10000);
            }
        }
        else
            m_uiRenewTimer -= uiDiff;

        if (m_uiShieldTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_SHIELD : SPELL_SHIELD_H) == CAST_OK)
                m_uiShieldTimer = urand(30000, 35000);
        }
        else
            m_uiShieldTimer -= uiDiff;

        if (m_uiDispelTimer < uiDiff)
        {
            Unit* pTarget = nullptr;
            CreatureList lTempList = DoFindFriendlyCC(50.0f);

            if (!lTempList.empty())
                pTarget = *(lTempList.begin());
            else
                pTarget = DoSelectLowestHpFriendly(50.0f);

            if (pTarget)
            {
                if (DoCastSpellIfCan(pTarget, SPELL_DISPEL_MAGIC) == CAST_OK)
                    m_uiDispelTimer = urand(12000, 15000);
            }
        }
        else
            m_uiDispelTimer -= uiDiff;

        // Use the Medallion if CC - only on heroic. Not sure how many times they are allowed to use it.
        if (!m_bIsRegularMode && m_uiMedallionTimer)
        {
            if (m_creature->isFrozen() || m_creature->hasUnitState(UNIT_STAT_CAN_NOT_REACT))
            {
                if (m_uiMedallionTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_MEDALLION, CAST_TRIGGERED) == CAST_OK)
                        m_uiMedallionTimer = 0;
                }
                else
                    m_uiMedallionTimer -= uiDiff;
            }
        }

        if (m_uiSWPainTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, nullptr, SELECT_FLAG_PLAYER))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_SHADOW_WORD_PAIN : SPELL_SHADOW_WORD_PAIN_H) == CAST_OK)
                    m_uiSWPainTimer = 10000;
            }
        }
        else
            m_uiSWPainTimer -= uiDiff;

        if (m_uiScreamTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_SCREAM) == CAST_OK)
                m_uiScreamTimer = urand(15000, 20000);
        }
        else
            m_uiScreamTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
    bool UpdateCompanionAI(const uint32 uiDiff)
    {
        if (m_uiGoblinDragonGunTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_GOBLIN_DRAGON_GUN : SPELL_GOBLIN_DRAGON_GUN_H) == CAST_OK)
                m_uiGoblinDragonGunTimer = urand(10000, 20000);
        }
        else
            m_uiGoblinDragonGunTimer -= uiDiff;

        if (m_uiRocketLaunchTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, nullptr, SELECT_FLAG_PLAYER))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_ROCKET_LAUNCH : SPELL_ROCKET_LAUNCH_H) == CAST_OK)
                    m_uiRocketLaunchTimer = 9000;
            }
        }
        else
            m_uiRocketLaunchTimer -= uiDiff;

        if (m_uiFelIronBombTimer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, nullptr, SELECT_FLAG_PLAYER))
            {
                if (DoCastSpellIfCan(pTarget, m_bIsRegularMode ? SPELL_FEL_IRON_BOMB : SPELL_FEL_IRON_BOMB_H) == CAST_OK)
                    m_uiFelIronBombTimer = 15000;
            }
        }
        else
            m_uiFelIronBombTimer -= uiDiff;

        if (m_uiRecombobulateTimer < uiDiff)
        {
            // Note: this should be casted only on Polyformed targets
            Unit* pTarget = nullptr;
            CreatureList lTempList = DoFindFriendlyCC(50.0f);

            if (!lTempList.empty())
                pTarget = *(lTempList.begin());
            else
                pTarget = DoSelectLowestHpFriendly(50.0f);

            if (pTarget)
            {
                if (DoCastSpellIfCan(pTarget, SPELL_RECOMBOBULATE) == CAST_OK)
                    m_uiRecombobulateTimer = 2000;
            }
        }
        else
            m_uiRecombobulateTimer -= uiDiff;

        if (m_uiHighExplosiveSheepTimer < uiDiff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_HIGH_EXPLOSIVE_SHEEP) == CAST_OK)
                m_uiHighExplosiveSheepTimer = 65000;
        }
        else
            m_uiHighExplosiveSheepTimer -= uiDiff;

        return true;
    }
예제 #16
0
    void UpdateAI(const uint32 uiDiff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiPhase == 1 || m_uiPhase == 2)
        {
            // tank out of range
            if (m_creature->GetDistance2d(m_creature->getVictim()) > m_creature->GetAttackDistance(m_creature->getVictim()))
            {
                if (m_uiRange_Timer <= uiDiff)
                {
                    DoCast(m_creature, SPELL_FROST_BREATH);
                    m_uiRange_Timer = 10000;
                }m_uiRange_Timer -= uiDiff;
            }else m_uiRange_Timer = 10000;
            
            //Pull
            if (m_uiPullTimer < uiDiff)
            {
                PullAll();
                m_uiPullTimer = 15000;
            }
            else m_uiPullTimer -= uiDiff;

            //Smash
            if (m_uiSmashTimer < uiDiff)
            {
                DoCast(m_creature, SPELL_SMASH);
                m_uiSmashTimer = 17000;
            }
            else m_uiSmashTimer -= uiDiff;

            //Cleave
            if (m_uiCleaveTimer < uiDiff)
            {
                DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE);
                m_uiCleaveTimer = urand(5000, 8000);
            }
            else m_uiCleaveTimer -= uiDiff;
            
            if (m_uiPhase == 1 && m_creature->GetHealthPercent() <= 50.0f)
            {
                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                m_creature->RemoveAllAuras();
                m_creature->CastSpell(m_creature, SPELL_ICE_BLOCK, true);
                SpawnAdds();
                m_uiPhase = 2;
                return;
            }
        }
        else if (m_uiPhase == 2)
        {
            if (m_uiAddCheck_Timer <= uiDiff)
            {
                CreatureList adds;
                GetCreatureListWithEntryInGrid(adds, m_creature, NPC_ADD, 5.0f);
                if (!adds.empty())
                {
                    adds.clear();
                    GetCreatureListWithEntryInGrid(adds, m_creature, NPC_ADD, 45.0f);
                    for(CreatureList::iterator iter = adds.begin(); iter != adds.end(); ++iter)
                    {
                        if (!(*iter)->isAlive())
                            continue;
                        (*iter)->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
                        m_creature->CastSpell(*iter, SPELL_LINK, true);
                        m_creature->CastSpell(m_creature, SPELL_DMG, true);
                    }
                    m_uiPhase = 3;
                    m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    m_creature->RemoveAllAuras();
                    PullAll();
                    m_uiPullTimer = 15000;
                    m_uiSmashTimer = 17000;
                    m_uiCleaveTimer = urand(5000, 8000);
                    m_uiRange_Timer = 10000;
                    return;
                }
                m_uiAddCheck_Timer = 2000;
            }else m_uiAddCheck_Timer -= uiDiff;
            
            if (m_uiBlizzard_Timer <= uiDiff)
            {
                if (Unit* target = m_creature->SelectAttackingPlayer(ATTACKING_TARGET_RANDOM, 0))
                    DoCast(target,SPELL_BLIZZARD);
                m_uiBlizzard_Timer = 10000;
            }else m_uiBlizzard_Timer -= uiDiff;
            
            //we dont wanna melee
            return;
        }
        
        DoMeleeAttackIfReady();
    }
예제 #17
0
    void MoveInLineOfSight(Unit* pWho) override
    {
        if (HasEscortState(STATE_ESCORT_ESCORTING) && pWho->GetEntry() == NPC_REETHE && lCreatureList.empty())
            lCreatureList.push_back((Creature*)pWho);

        npc_escortAI::MoveInLineOfSight(pWho);
    }
예제 #18
0
bool EffectDummyCreature_spell_anchor(Unit* /*pCaster*/, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/)
{
    if (uiEffIndex != EFFECT_INDEX_0 || pCreatureTarget->GetEntry() != NPC_SUB_BOSS_TRIGGER)
        return true;

    instance_naxxramas* pInstance = (instance_naxxramas*)pCreatureTarget->GetInstanceData();

    if (!pInstance)
        return true;

    switch (uiSpellId)
    {
        case SPELL_A_TO_ANCHOR_1:                           // trigger mobs at high right side
        case SPELL_B_TO_ANCHOR_1:
        case SPELL_C_TO_ANCHOR_1:
        {
            if (Creature* pAnchor2 = pInstance->GetClosestAnchorForGoth(pCreatureTarget, false))
            {
                uint32 uiTriggered = SPELL_A_TO_ANCHOR_2;

                if (uiSpellId == SPELL_B_TO_ANCHOR_1)
                    uiTriggered = SPELL_B_TO_ANCHOR_2;
                else if (uiSpellId == SPELL_C_TO_ANCHOR_1)
                    uiTriggered = SPELL_C_TO_ANCHOR_2;

                pCreatureTarget->CastSpell(pAnchor2, uiTriggered, TRIGGERED_OLD_TRIGGERED);
            }

            return true;
        }
        case SPELL_A_TO_ANCHOR_2:                           // trigger mobs at high left side
        case SPELL_B_TO_ANCHOR_2:
        case SPELL_C_TO_ANCHOR_2:
        {
            CreatureList lTargets;
            pInstance->GetGothSummonPointCreatures(lTargets, false);

            if (!lTargets.empty())
            {
                CreatureList::iterator itr = lTargets.begin();
                uint32 uiPosition = urand(0, lTargets.size() - 1);
                advance(itr, uiPosition);

                if (Creature* pTarget = (*itr))
                {
                    uint32 uiTriggered = SPELL_A_TO_SKULL;

                    if (uiSpellId == SPELL_B_TO_ANCHOR_2)
                        uiTriggered = SPELL_B_TO_SKULL;
                    else if (uiSpellId == SPELL_C_TO_ANCHOR_2)
                        uiTriggered = SPELL_C_TO_SKULL;

                    pCreatureTarget->CastSpell(pTarget, uiTriggered, TRIGGERED_OLD_TRIGGERED);
                }
            }
            return true;
        }
        case SPELL_A_TO_SKULL:                              // final destination trigger mob
        case SPELL_B_TO_SKULL:
        case SPELL_C_TO_SKULL:
        {
            if (Creature* pGoth = pInstance->GetSingleCreatureFromStorage(NPC_GOTHIK))
            {
                uint32 uiNpcEntry = NPC_SPECT_TRAINEE;

                if (uiSpellId == SPELL_B_TO_SKULL)
                    uiNpcEntry = NPC_SPECT_DEATH_KNIGHT;
                else if (uiSpellId == SPELL_C_TO_SKULL)
                    uiNpcEntry = NPC_SPECT_RIDER;

                pGoth->SummonCreature(uiNpcEntry, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), pCreatureTarget->GetOrientation(), TEMPSPAWN_DEAD_DESPAWN, 0);

                if (uiNpcEntry == NPC_SPECT_RIDER)
                    pGoth->SummonCreature(NPC_SPECT_HORSE, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), pCreatureTarget->GetOrientation(), TEMPSPAWN_DEAD_DESPAWN, 0);
            }
            return true;
        }
    }

    return true;
};