当前位置: 首页>>代码示例>>C++>>正文


C++ Map::GetPlayers方法代码示例

本文整理汇总了C++中Map::GetPlayers方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetPlayers方法的具体用法?C++ Map::GetPlayers怎么用?C++ Map::GetPlayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Map的用法示例。


在下文中一共展示了Map::GetPlayers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DoAction

            void DoAction(int32 const action)
            {
                switch (action)
                {
                    case START_INTRO:
                    {
                        if (Creature* baxter = ObjectAccessor::GetCreature(*me, _instance? _instance->GetData64(DATA_BAXTER) : 0))
                            baxter->AI()->DoAction(START_INTRO);
                        if (Creature* frye = ObjectAccessor::GetCreature(*me, _instance ? _instance->GetData64(DATA_FRYE) : 0))
                            frye->AI()->DoAction(START_INTRO);

                        _phase = PHASE_INTRO;
                        me->SetReactState(REACT_PASSIVE);
                        me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        SetInCombat(me);
                        break;
                    }
                    case START_FIGHT:
                    {
                        _phase = PHASE_NORMAL;
                        me->setFaction(FACTION_HOSTIL);
                        me->SetReactState(REACT_AGGRESSIVE);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                        SetInCombat(me);
                        _instance->SetData(TYPE_CROWN, IN_PROGRESS);
                        break;
                    }
                    case APOTHECARY_DIED:
                    {
                        ++_deadCount;
                        if (_deadCount > 2) // all 3 apothecarys dead, set lootable
                        {
                            _summons.DespawnAll();
                            me->SetCorpseDelay(90); // set delay
                            me->setDeathState(JUST_DIED); // update delay
                            _instance->SetData(TYPE_CROWN, DONE);
                            me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);

                            Map* map = me->GetMap();
                            if (map && map->IsDungeon())
                            {
                                Map::PlayerList const& players = map->GetPlayers();
                                if (!players.isEmpty())
                                    for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
                                        if (Player* player = i->getSource())
                                            if (player->GetDistance(me) < 120.0f)
                                                sLFGMgr->RewardDungeonDoneFor(288, player);
                            }
                        }
                        else
                        {
                            if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
                                me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
                        }
                        break;
                    }
                    case SPAWN_CRAZED:
                    {
                        uint8 i = urand(0, 3);
                        if (Creature* crazed = me->SummonCreature(NPC_CRAZED_APOTHECARY, Loc[i], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3*IN_MILLISECONDS))
                        {
                            crazed->setFaction(FACTION_HOSTIL);
                            crazed->SetReactState(REACT_PASSIVE);
                            crazed->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                            crazed->GetMotionMaster()->MovePoint(1, Loc[i + 4]);
                        }

                        if (!_firstCrazed)
                        {
                            DoScriptText(SAY_SUMMON_ADDS, me);
                            _firstCrazed = true;
                        }
                        break;
                    }
                }
            }
开发者ID:Shutokill,项目名称:ProjectRisingDarkness,代码行数:77,代码来源:boss_apothecary_trio.cpp

示例2: NextStep

    uint32 NextStep(uint32 Step)
    {
        Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);
        Map* pMap = me->GetMap();
        switch(Step)
        {
        case 0: return 9999999;
        case 1:
            me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL);
            return 10000;
        case 2:
            if (arca)
                CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL);
            return 20000;
        case 3:
            me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL);
            return 10000;
        case 4:
            if (arca)
                CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL);
            return 20000;
        case 5:
            me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
            return 20000;
        case 6:
            if (arca)
                CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_6, LANG_UNIVERSAL, NULL);
            return 10000;
        case 7:
            FireArcanagosTimer = 500;
            return 5000;
        case 8:
            FireMedivhTimer = 500;
            DoCast(me, SPELL_MANA_SHIELD);
            return 10000;
        case 9:
            me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false);
            return 10000;
        case 10:
            if (arca)
                DoCast(arca, SPELL_CONFLAGRATION_BLAST, false);
            return 1000;
        case 11:
            if (arca)
                CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_8, LANG_UNIVERSAL, NULL);
            return 5000;
        case 12:
            arca->GetMotionMaster()->MovePoint(0, -11010.82,-1761.18, 156.47);
            arca->setActive(true);
            arca->InterruptNonMeleeSpells(true);
            arca->SetSpeed(MOVE_FLIGHT, 2.0f);
            return 10000;
        case 13:
            me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
            return 10000;
        case 14:
            me->SetVisibility(VISIBILITY_OFF);
            me->ClearInCombat();

            if (pMap->IsDungeon())
            {
                InstanceMap::PlayerList const &PlayerList = pMap->GetPlayers();
                for (InstanceMap::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                {
                    if (i->getSource()->isAlive())
                    {
                        if (i->getSource()->GetQuestStatus(9645) == QUEST_STATUS_INCOMPLETE)
                            i->getSource()->CompleteQuest(9645);
                    }
                }
            }
            return 50000;
        case 15:
            arca->DealDamage(arca,arca->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
            return 5000;
        default : return 9999999;
        }

    }
开发者ID:,项目名称:,代码行数:79,代码来源:

示例3: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!CanStartEvent)//boss is invisible, don't attack
            {
                if (CheckCanStart())
                {
                    if (Submerged)
                    {
                        me->SetVisible(true);
                        Submerged = false;
                        WaitTimer2 = 500;
                    }
                    if (!Submerged && WaitTimer2 <= diff)//wait 500ms before emerge anim
                    {
                        me->RemoveAllAuras();
                        me->RemoveFlag(UNIT_NPC_EMOTESTATE,EMOTE_STATE_SUBMERGED);
                        DoCast(me, SPELL_EMERGE, false);
                        WaitTimer2 = 60000;//never reached
                        WaitTimer = 3000;
                    } else WaitTimer2 -= diff;

                    if (WaitTimer <= diff)//wait 3secs for emerge anim, then attack
                    {
                        WaitTimer = 3000;
                        CanStartEvent=true;//fresh fished from pool
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    } else WaitTimer -= diff;
                }
                return;
            }

            if (me->getThreatManager().getThreatList().empty())//check if should evade
            {
                if (me->isInCombat())
                    EnterEvadeMode();
                return;
            }
            if (!Submerged)
            {
                if (PhaseTimer <= diff)
                {
                    me->InterruptNonMeleeSpells(false);
                    DoCast(me, SPELL_SUBMERGE);
                    PhaseTimer = 60000;//60secs submerged
                    Submerged = true;
                } else PhaseTimer-=diff;

                if (SpoutTimer <= diff)
                {
                    me->MonsterTextEmote(EMOTE_SPOUT,0,true);
                    me->SetReactState(REACT_PASSIVE);
                    me->GetMotionMaster()->MoveRotate(20000, rand()%2 ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);
                    SpoutTimer = 45000;
                    WhirlTimer = 20000;//whirl directly after spout
                    RotTimer = 20000;
                    return;
                } else SpoutTimer -= diff;

                //Whirl directly after a Spout and at random times
                if (WhirlTimer <= diff)
                {
                    WhirlTimer = 18000;
                    DoCast(me, SPELL_WHIRL);
                } else WhirlTimer -= diff;

                if (CheckTimer <= diff)//check if there are players in melee range
                {
                    InRange = false;
                    Map* pMap = me->GetMap();
                    Map::PlayerList const &PlayerList = pMap->GetPlayers();
                    if (!PlayerList.isEmpty())
                    {
                        for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        {
                            if (me->IsWithinMeleeRange(i->getSource()))
                                InRange = true;
                        }
                    }
                    CheckTimer = 2000;
                } else CheckTimer -= diff;

                if (RotTimer)
                {
                    Map* pMap = me->GetMap();
                    if (pMap->IsDungeon())
                    {
                        Map::PlayerList const &PlayerList = pMap->GetPlayers();
                        for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        {
                            if (i->getSource() && i->getSource()->isAlive() && me->HasInArc(float(diff/20000*M_PI*2),i->getSource()) && me->IsWithinDist(i->getSource(), SPOUT_DIST) && !i->getSource()->IsInWater())
                                DoCast(i->getSource(), SPELL_SPOUT, true);//only knock back palyers in arc, in 100yards, not in water
                        }
                    }

                    if (SpoutAnimTimer <= diff)
                    {
                        DoCast(me, SPELL_SPOUT_ANIM, true);
                        SpoutAnimTimer = 1000;
                    } else SpoutAnimTimer -= diff;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: UpdateAI

    void UpdateAI(const uint32 diff)
    {
        if (pInstance)
        {
            if (!leotherasGUID)
                leotherasGUID = pInstance->GetData64(DATA_LEOTHERAS);

            if (!me->isInCombat() && pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
            {
                Unit *victim = NULL;
                victim = Unit::GetUnit(*me, pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
                if (victim)
                    AttackStart(victim);
            }
        }

        if (!UpdateVictim())
        {
            CastChanneling();
            return;
        }

        if (pInstance && !pInstance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
        {
            EnterEvadeMode();
            return;
        }

        if (Mindblast_Timer <= diff)
        {
            Unit *pTarget = NULL;
            pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);

            if (pTarget)DoCast(pTarget, SPELL_MINDBLAST);

            Mindblast_Timer = 10000 + rand()%5000;
        } else Mindblast_Timer -= diff;

        if (Earthshock_Timer <= diff)
        {
            Map* pMap = me->GetMap();
            Map::PlayerList const &PlayerList = pMap->GetPlayers();
            for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
            {
                if (Player* i_pl = itr->getSource())
                {
                    bool isCasting = false;
                    for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
                        if (i_pl->GetCurrentSpell(i))
                            isCasting = true;

                    if (isCasting)
                    {
                        DoCast(i_pl, SPELL_EARTHSHOCK);
                        break;
                    }
                }
            }
            Earthshock_Timer = 8000 + rand()%7000;
        } else Earthshock_Timer -= diff;
        DoMeleeAttackIfReady();
    }
开发者ID:Asandru,项目名称:Script-Land,代码行数:62,代码来源:boss_leotheras_the_blind.cpp

示例5: UpdateAI

        void UpdateAI(const uint32 uiDiff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (m_bIsAura)
            {
                // workaround for PULSING_SHOCKWAVE
                if (m_uiPulsingShockwave_Timer <= uiDiff)
                {
                    Map* pMap = me->GetMap();
                    if (pMap->IsDungeon())
                    {
                        Map::PlayerList const &PlayerList = pMap->GetPlayers();

                        if (PlayerList.isEmpty())
                            return;

                        for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                            if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack())
                            {
                                int32 dmg;
                                float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ());

                                dmg = DUNGEON_MODE(100, 150); // need to correct damage
                                if (m_fDist > 1.0f) // Further from 1 yard
                                    dmg = int32(dmg*m_fDist);

                                me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false);
                            }
                    }
                    m_uiPulsingShockwave_Timer = 2000;
                } else m_uiPulsingShockwave_Timer -= uiDiff;
            }
            else
            {
                if (m_uiResumePulsingShockwave_Timer <= uiDiff)
                {
                    //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement?
                    DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true);

                    DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support
                    m_bIsAura = true;
                    m_uiResumePulsingShockwave_Timer = 0;
                }
                else
                    m_uiResumePulsingShockwave_Timer -= uiDiff;
            }

            if (m_uiArcLightning_Timer <= uiDiff)
            {
                if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
                    DoCast(pTarget, SPELL_ARC_LIGHTNING);

                m_uiArcLightning_Timer = 15000 + rand()%1000;
            }
            else
                m_uiArcLightning_Timer -= uiDiff;

            if (m_uiLightningNova_Timer <= uiDiff)
            {
                DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), me);
                DoScriptText(EMOTE_NOVA, me);
                DoCast(me, SPELL_LIGHTNING_NOVA_N);

                m_bIsAura = false;
                m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura
                m_uiLightningNova_Timer = 20000 + rand()%1000;
            }
            else
                m_uiLightningNova_Timer -= uiDiff;

            // Health check
            if (HealthBelowPct(100 - 25 * m_uiHealthAmountModifier))
            {
                switch(m_uiHealthAmountModifier)
                {
                    case 1: DoScriptText(SAY_75HEALTH, me); break;
                    case 2: DoScriptText(SAY_50HEALTH, me); break;
                    case 3: DoScriptText(SAY_25HEALTH, me); break;
                }

                ++m_uiHealthAmountModifier;
            }

            DoMeleeAttackIfReady();
        }
开发者ID:A-Metaphysical-Drama,项目名称:BloodyCore,代码行数:88,代码来源:boss_loken.cpp

示例6: UpdateAI

            void UpdateAI(const uint32 diff)
            {
                if (isFlameBreathing)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                        isFlameBreathing = false;
                    else
                        return;
                }

                if (isBombing)
                {
                    if (BombSequenceTimer <= diff)
                        HandleBombSequence();
                    else
                        BombSequenceTimer -= diff;
                    return;
                }

                if (!UpdateVictim())
                    return;

                //enrage if under 25% hp before 5 min.
                if (!enraged && HealthBelowPct(25))
                    EnrageTimer = 0;

                if (EnrageTimer <= diff)
                {
                    if (!enraged)
                    {
                        DoCast(me, SPELL_ENRAGE, true);
                        enraged = true;
                        EnrageTimer = 300000;
                    }
                    else
                    {
                        DoScriptText(SAY_BERSERK, me);
                        DoCast(me, SPELL_BERSERK, true);
                        EnrageTimer = 300000;
                    }
                } else EnrageTimer -= diff;

                if (BombTimer <= diff)
                {
                    DoScriptText(SAY_FIRE_BOMBS, me);

                    me->AttackStop();
                    me->GetMotionMaster()->Clear();
                    DoTeleportTo(JanalainPos[0][0], JanalainPos[0][1], JanalainPos[0][2]);
                    me->StopMoving();
                    DoCast(me, SPELL_FIRE_BOMB_CHANNEL, false);
                    //DoTeleportPlayer(me, JanalainPos[0][0], JanalainPos[0][1], JanalainPos[0][2], 0);
                    //DoCast(me, SPELL_TELE_TO_CENTER, true);

                    FireWall();
                    SpawnBombs();
                    isBombing = true;
                    BombSequenceTimer = 100;

                    //Teleport every Player into the middle
                    Map* map = me->GetMap();
                    if (!map->IsDungeon()) return;
                    Map::PlayerList const &PlayerList = map->GetPlayers();
                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        if (Player* i_pl = i->getSource())
                            if (i_pl->isAlive())
                                DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
                    //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
                    return;
                } else BombTimer -= diff;

                if (!noeggs)
                {
                    if (HealthBelowPct(35))
                    {
                        DoScriptText(SAY_ALL_EGGS, me);

                        me->AttackStop();
                        me->GetMotionMaster()->Clear();
                        DoTeleportTo(JanalainPos[0][0], JanalainPos[0][1], JanalainPos[0][2]);
                        me->StopMoving();
                        DoCast(me, SPELL_HATCH_ALL, false);
                        HatchAllEggs(2);
                        noeggs = true;
                    }
                    else if (HatcherTimer <= diff)
                    {
                        if (HatchAllEggs(0))
                        {
                            DoScriptText(SAY_SUMMON_HATCHER, me);
                            me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[0][0][0], hatcherway[0][0][1], hatcherway[0][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
                            me->SummonCreature(MOB_AMANI_HATCHER, hatcherway[1][0][0], hatcherway[1][0][1], hatcherway[1][0][2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
                            HatcherTimer = 90000;
                        }
                        else
                            noeggs = true;
                    } else HatcherTimer -= diff;
                }

                EnterEvadeIfOutOfCombatArea(diff);
//.........这里部分代码省略.........
开发者ID:Pulsedriver,项目名称:TrinityCore,代码行数:101,代码来源:boss_janalai.cpp

示例7: UpdateAI

    void UpdateAI(const uint32 diff)
    {
        if(InciteChaos)
        {
            if(InciteChaosWait_Timer < diff)
            {
                InciteChaos = false;
                DoZoneInCombat();
                DoResetThreat();

                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true);
                if(target)
                    AttackStart(target);
            }
            else
                InciteChaosWait_Timer -= diff;

            return;
        }

        if (!UpdateVictim())
            return;
        else
            TrashAggro();

        if(InciteChaos_Timer < diff)
        {
            DoCast(me, SPELL_INCITE_CHAOS);

            Map *map = me->GetMap();
            Map::PlayerList const &PlayerList = map->GetPlayers();

            if(PlayerList.isEmpty())
                return;

            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                Player *plr = i->getSource();
                Player *target = (Player*)SelectUnit(SELECT_TARGET_RANDOM, 0, 100, true, plr->GetGUID());

                if(plr && plr->IsAIEnabled && target)
                    plr->AI()->AttackStart(target);
            }

            //DoResetThreat();
            InciteChaos = true;
            InciteChaos_Timer = 40000;
            InciteChaosWait_Timer = 16000;
            return;
        }
        else
            InciteChaos_Timer -= diff;

        //Charge_Timer
        if (Charge_Timer < diff)
        {
            if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 50, true))
                DoCast(target, SPELL_CHARGE);
            Charge_Timer = 25000;
        }
        else
            Charge_Timer -= diff;

        //Knockback_Timer
        if (Knockback_Timer < diff)
        {
            DoCast(me, SPELL_WAR_STOMP);
            Knockback_Timer = 20000;
        }
        else
            Knockback_Timer -= diff;

        DoMeleeAttackIfReady();
    }
开发者ID:Xadras,项目名称:looking4group-core,代码行数:74,代码来源:boss_blackheart_the_inciter.cpp

示例8: UpdateAI

    void UpdateAI(const uint32 uiDiff)
    {
        //Return since we have no target
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_bIsAura)
        {
            // workaround for PULSING_SHOCKWAVE
            if (m_uiPulsingShockwave_Timer < uiDiff)
            {
                Map *map = m_creature->GetMap();
                if (map->IsDungeon())
                {
                    Map::PlayerList const &PlayerList = map->GetPlayers();

                    if (PlayerList.isEmpty())
                        return;

                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        if (i->getSource()->isAlive() && i->getSource()->isTargetableForAttack())
                        {
                            int32 dmg;
                            float m_fDist = m_creature->GetDistance(i->getSource());

                            if (m_fDist <= 1.0f) // Less than 1 yard
                                dmg = (m_bIsRegularMode ? 800 : 850); // need to correct damage
                            else // Further from 1 yard
                                dmg = ((m_bIsRegularMode ? 200 : 250) * m_fDist) + (m_bIsRegularMode ? 800 : 850); // need to correct damage

                            m_creature->CastCustomSpell(i->getSource(), (m_bIsRegularMode ? 52942 : 59837), &dmg, 0, 0, false);
                        }
                }
                m_uiPulsingShockwave_Timer = 2000;
            }else m_uiPulsingShockwave_Timer -= uiDiff;
        }
        else
        {
            if (m_uiResumePulsingShockwave_Timer < uiDiff)
            {
                //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement?
                //m_creature->CastSpell(m_creature, SPELL_PULSING_SHOCKWAVE_AURA, true);

                  //DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_PULSING_SHOCKWAVE_N : SPELL_PULSING_SHOCKWAVE_H); // need core support
                m_bIsAura = true;
                m_uiResumePulsingShockwave_Timer = 0;
            }
            else
                m_uiResumePulsingShockwave_Timer -= uiDiff;
        }

        if (m_uiArcLightning_Timer < uiDiff)
        {
            if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                DoCastSpellIfCan(pTarget, SPELL_ARC_LIGHTNING);

            m_uiArcLightning_Timer = urand(15000, 16000);
        }
        else
            m_uiArcLightning_Timer -= uiDiff;

        if (m_uiLightningNova_Timer < uiDiff)
        {
            switch(urand(0, 2))
            {
                case 0: DoScriptText(SAY_NOVA_1, m_creature);break;
                case 1: DoScriptText(SAY_NOVA_2, m_creature);break;
                case 2: DoScriptText(SAY_NOVA_3, m_creature);break;
            }

            DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_LIGHTNING_NOVA_N : SPELL_LIGHTNING_NOVA_H);

            m_bIsAura = false;
            m_uiResumePulsingShockwave_Timer = (m_bIsRegularMode ? 5000 : 4000); // Pause Pulsing Shockwave aura
            m_uiLightningNova_Timer = urand(20000, 21000);
        }
        else
            m_uiLightningNova_Timer -= uiDiff;

        // Health check
        if (m_creature->GetHealthPercent() < float(100 - 25*m_uiHealthAmountModifier))
        {
            switch(m_uiHealthAmountModifier)
            {
                case 1: DoScriptText(SAY_75HEALTH, m_creature); break;
                case 2: DoScriptText(SAY_50HEALTH, m_creature); break;
                case 3: DoScriptText(SAY_25HEALTH, m_creature); break;
            }

            ++m_uiHealthAmountModifier;
        }

        DoMeleeAttackIfReady();
    }
开发者ID:Heuristicks,项目名称:scriptdev2,代码行数:94,代码来源:boss_loken.cpp

示例9: GordokTributeEvent

/*
Tribute Event
*/
void instance_dire_maul::GordokTributeEvent(uint32 diff)
{
	if(1<2)return;
	Creature* pChoRush = instance->GetCreature(m_uiChoRushGUID);
	Creature* pMizzle = instance->GetCreature(m_uiMizzleGUID);
	Creature* pTrigger = instance->GetCreature(m_uiTributeTriggerGUID);

	Map* pMap;
	pMap = pChoRush->GetMap();

	Map::PlayerList const &PlayerList = pMap->GetPlayers();

	if ((GetData(TYPE_KING_GORDOK) == DONE) && pMap->GetCreature(m_uiChoRushGUID)->isAlive() && !pChoRushHome)
	{
		pChoRush->SetFlag(UNIT_NPC_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE);
		pChoRush->setFaction(35);
		pChoRush->DeleteThreatList();
		pChoRush->CombatStop();
		pChoRush->SetCanAttackPlayer(false);
		pChoRush->AI()->EnterEvadeMode();

		pChoRushHome = true;
		GossipStepGordok = 1;
		Text_Timer_Event = 1000;
	}
	else if ((TYPE_KING_GORDOK == DONE) && pMap->GetCreature(m_uiChoRushGUID)->isDead())
	{
		for(Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
		{
			Player* pPlayer = itr->getSource();
			if (pPlayer->IsWithinDistInMap(pTrigger, 30.0f))
					pTrigger->CastSpell(pPlayer, SPELL_KING_OF_GORDOK, false);
		}
	}

	if(pChoRushHome)
	{
		if (Text_Timer_Event<diff)
		{
			switch (GossipStepGordok)
			{
				case 1:
				DoScriptText(ChoRush_SAY_1, pChoRush);
				pChoRush->HandleEmote(EMOTE_STATE_TALK);
				pChoRush->SummonCreature(NPC_MIZZLE_THE_CRAFTY, 817.666f, 478.371f, 37.3182f, 3.07057f, TEMPSUMMON_TIMED_DESPAWN, 9000000);
				Text_Timer_Event = 5000;
				break;

				case 2:
				pChoRush->HandleEmote(EMOTE_STATE_SIT);
				DoScriptText(Mizzle_SAY_1, pMizzle);
				pMizzle->HandleEmote(EMOTE_STATE_TALK);
				Text_Timer_Event = 5000;
				break;

				case 3:
				DoScriptText(Mizzle_SAY_2, pMizzle);
				pMizzle->HandleEmote(EMOTE_STATE_TALK);
				Text_Timer_Event = 8000;
				break;

				case 4:
				for(Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
				{
					Player* pPlayer = itr->getSource();
					if (pPlayer->IsWithinDistInMap(pMizzle, 50.0f))
							pMizzle->CastSpell(pPlayer, SPELL_KING_OF_GORDOK, false);
				}
				if (pMap->GetCreature(m_uiMoldarGUID)->isAlive() && pMap->GetCreature(m_uiMizzleGUID)->isAlive() && pMap->GetCreature(m_uiFengusGUID)->isAlive())
				{
					pMizzle->SummonObject(pMap, GO_GORDOK_TRIBUTE, 809.899719f, 482.306366f, 37.318359f, 0.212846f);
					pMizzle->HandleEmote(EMOTE_ONESHOT_APPLAUD);
				}
				pChoRushHome = false;
				break;
			}
		}
		else Text_Timer_Event -= diff;
	}
}
开发者ID:yyhhrr,项目名称:mangospriv,代码行数:83,代码来源:instance_dire_maul.cpp

示例10: NetherBeam

    bool NetherBeam(int beamerID) {
                if(beamerID < 0 || beamerID > 2)
                        return false;
 
                Map *map = m_creature->GetMap();
        if(!map->IsDungeon())
                        return false;
 
        Unit* uBeamer = Unit::GetUnit(*m_creature, BeamerGUID[beamerID]);
                if(!uBeamer)
                        return false;
 
        Unit* uBeamerHelp = Unit::GetUnit(*m_creature, BeamerhelpGUID[beamerID]);
                if(!uBeamerHelp)
                        return false;
 
        CandidatesGUID[beamerID] = m_creature->GetGUID();
        Unit* uCandidate = Unit::GetUnit(*m_creature, CandidatesGUID[beamerID]);
                if(!uCandidate)
                        return false;
 
                int spell_exhaustion    = -1;
                Unit* uLastCandidate    = NULL;
                int creature_portal             = -1;
                int spell_plr                   = -1;
                int spell_creature              = -1;
                int spell_beam                  = -1;
 
                // switch beam specific settings/variables
                uLastCandidate = Unit::GetUnit(*m_creature, LastCandidatesGUID[beamerID]);
                switch(beamerID) {
                case 0: // blue
                        spell_exhaustion        = SPELL_EXHAUSTION_DOM;
                        //uLastCandidate                = lastDOMcandidate;
                        creature_portal         = CREATURE_BLUEPORTAL;
                        spell_plr                       = SPELL_DOMINANCE_PLR;
                        spell_creature          = SPELL_DOMINANCE_NS;
                        spell_beam                      = SPELL_BEAM_DOM;
                        break;
                case 1: // green
                        spell_exhaustion        = SPELL_EXHAUSTION_SER;
                        //uLastCandidate                = lastSERcandidate;
                        creature_portal         = CREATURE_GREENPORTAL;
                        spell_plr                       = SPELL_SERENITY_PLR;
                        spell_creature          = SPELL_SERENITY_NS;
                        spell_beam                      = SPELL_BEAM_SER;
                        break;
                case 2: // red
                        spell_exhaustion        = SPELL_EXHAUSTION_PER;
                        //uLastCandidate                = lastPERcandidate;
                        creature_portal         = CREATURE_REDPORTAL;
                        spell_plr                       = SPELL_PERSEVERENCE_PLR;
                        spell_creature          = SPELL_PERSEVERENCE_NS;
                        spell_beam                      = SPELL_BEAM_PER;
                        break;
                default:
                        return false; // oO? something got wrong...
                }
 
                // step throught each player in the list and check, if he is in the beam
        Map::PlayerList const &PlayerList = map->GetPlayers();
        for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) {
            if(i->getSource() && i->getSource()->isAlive()) {
                                plr = Unit::GetUnit(*m_creature, i->getSource()->GetGUID());
                                BossDist = m_creature->GetDistance2d(uBeamer);
                                BossAngle = m_creature->GetAngle(uBeamer);
                                PlrDist = plr->GetDistance2d(uBeamer);
                                PlrAngle = plr->GetAngle(uBeamer);
 
                                if((BossAngle - degrad10) < PlrAngle    // is in range?
                                &&  PlrAngle < (BossAngle + degrad10)   // is in range?
                                &&  PlrDist < BossDist                                  // is in range?
                                && !plr->HasAura(spell_exhaustion,0)    // hasn't yet the spell?
                                &&  plr->isAlive())     {                                       // is alive?
                                        uCandidate = plr;                                       // ok, take him as candidate
                                        if(beamerID==2) // red beam
                                                PLRonRedBeam = true;
                                }
                        }
        }
 
                if(uCandidate == m_creature) {
                        if(uCandidate != uLastCandidate) {
                                if(uBeamer) {
                    uBeamer->DealDamage(uBeamerHelp, uBeamerHelp->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                    if(uBeamerHelp) {
                        BeamerhelpGUID[beamerID] = 0;
                        uBeamerHelp = NULL;
                        uBeamerHelp = uBeamer->SummonCreature(creature_portal,RandomedCoords[beamerID][0],RandomedCoords[beamerID][1],RandomedCoords[beamerID][2],0,TEMPSUMMON_CORPSE_DESPAWN,0);
                        BeamerhelpGUID[beamerID] = uBeamerHelp->GetGUID();
                        uBeamerHelp->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11686);
                        uBeamerHelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        uBeamerHelp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    }
                }
                uLastCandidate = uCandidate;
            }
 
            uBeamerHelp = Unit::GetUnit(*m_creature, BeamerhelpGUID[beamerID]);
            if(uBeamer)
//.........这里部分代码省略.........
开发者ID:RareSoul,项目名称:andeeria,代码行数:101,代码来源:boss_netherspite.cpp

示例11: _BSWSpellSelector

CanCastResult BSWScriptedAI::_BSWSpellSelector(uint8 m_uiSpellIdx, Unit* pTarget)
{

    BSWRecord* pSpell = &m_BSWRecords[m_uiSpellIdx];

    Unit* pSummon = NULL;

    CanCastResult result = CAST_FAIL_OTHER;

    debug_log("BSW: Casting spell number %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget);

        if (pSpell->m_uiSpellTimerMax[currentDifficulty] >= HOUR*IN_MILLISECONDS)
            m_creature->InterruptNonMeleeSpells(true);

        switch (pSpell->m_CastTarget) {

            case DO_NOTHING: 
                   result = CAST_OK;
                   break;

            case CAST_ON_SELF:
                   result = _BSWCastOnTarget(m_creature, m_uiSpellIdx);
                   break;

            case CAST_ON_SUMMONS:
                   result = _BSWCastOnTarget(pTarget, m_uiSpellIdx);
                   break;

            case CAST_ON_VICTIM:
                   pTarget = m_creature->getVictim();
                   result = _BSWCastOnTarget(pTarget, m_uiSpellIdx);
                   break;

            case CAST_ON_RANDOM:
                   pTarget = _doSelect(0, false, 60.0f);
                   result = _BSWCastOnTarget(pTarget, m_uiSpellIdx);
                   break;

            case CAST_ON_BOTTOMAGGRO:
                   pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_BOTTOMAGGRO,0);
                   result = _BSWCastOnTarget(pTarget, m_uiSpellIdx);
                   break;

            case CAST_ON_TARGET:
                   result = _BSWCastOnTarget(pTarget, m_uiSpellIdx);
                   break;

            case APPLY_AURA_SELF:
                       if (_doAura(m_uiSpellIdx, m_creature, EFFECT_INDEX_0))
                           result = CAST_OK;
                       else result = CAST_FAIL_OTHER;
                   break;

            case APPLY_AURA_TARGET:
                   if (!pTarget || !pTarget->IsInMap(m_creature)) 
                   {
                       result = CAST_FAIL_OTHER;
                       break;
                   }
                   if (_doAura(m_uiSpellIdx, pTarget, EFFECT_INDEX_0))
                       result = CAST_OK;
                   else result = CAST_FAIL_OTHER;
                   break;

            case SUMMON_NORMAL:
                   pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
                   if(pSummon) result = CAST_OK;
                       else result = CAST_FAIL_OTHER;
                   break;

            case SUMMON_TEMP:
                   pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,
                                        urand(pSpell->m_uiSpellTimerMin[currentDifficulty],pSpell->m_uiSpellTimerMax[currentDifficulty]));
                   if(pSummon) result = CAST_OK;
                       else result = CAST_FAIL_OTHER;
                   break;

            case SUMMON_INSTANT:
                   pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_MANUAL_DESPAWN,0);
                   if(pSummon) result = CAST_OK;
                       else result = CAST_FAIL_OTHER;
                   break;

            case CAST_ON_ALLPLAYERS:
                   {
                       Map* pMap = m_creature->GetMap();
                       Map::PlayerList const& pPlayers = pMap->GetPlayers();
                       if (!pPlayers.isEmpty())
                       {
                           for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr)
                           {
                               pTarget = itr->getSource();
                               if (pTarget && pTarget->isAlive() && pTarget->IsWithinDistInMap(m_creature, pSpell->LocData.x))
                               {
                                   if (!pSpell->m_IsBugged) 
                                   {
                                       m_creature->CastSpell(pTarget, pSpell->m_uiSpellEntry[currentDifficulty], false);
                                   }
                                   else
                                   {
//.........这里部分代码省略.........
开发者ID:MichaelFurth,项目名称:RSD2,代码行数:101,代码来源:BSW_ai.cpp

示例12: SetData

    void SetData(uint32 type, uint32 data)
    {
        switch (type)
        {
            case DATA_RAGEWINTERCHILLEVENT: Encounters[0] = data; break;
            case DATA_ANETHERONEVENT:
                Encounters[1] = data;
                break;
            case DATA_KAZROGALEVENT:        Encounters[2] = data; break;
            case DATA_AZGALOREVENT:
                {
                    Encounters[3] = data;
                    if (data == DONE)
                    {
                        if (ArchiYell)break;
                        ArchiYell = true;

                        Creature* pCreature = instance->GetCreature(Azgalor);
                        if (pCreature)
                        {
                            Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000);

                            Map* pMap = pCreature->GetMap();
                            if (pMap->IsDungeon() && pUnit)
                            {
                                pUnit->SetVisibility(VISIBILITY_OFF);
                                Map::PlayerList const &PlayerList = pMap->GetPlayers();
                                if (PlayerList.isEmpty())
                                     return;

                                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                {
                                     if (i->getSource())
                                     {
                                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                                        pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID());
                                        i->getSource()->GetSession()->SendPacket(&data);

                                        WorldPacket data2(SMSG_PLAY_SOUND, 4);
                                        data2 << 10986;
                                        i->getSource()->GetSession()->SendPacket(&data2);
                                     }
                                }
                            }
                        }
                    }
                }
                break;
            case DATA_ARCHIMONDEEVENT:      Encounters[4] = data; break;
            case DATA_RESET_TRASH_COUNT:    Trash = 0;            break;

            case DATA_TRASH:
                if (data) Trash = data;
                else     Trash--;
                UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
                break;
            case DATA_ALLIANCE_RETREAT:
                allianceRetreat = data;
                OpenDoor(HordeGate,true);
                SaveToDB();
                break;
            case DATA_HORDE_RETREAT:
                hordeRetreat = data;
                OpenDoor(ElfGate,true);
                SaveToDB();
                break;
            case DATA_RAIDDAMAGE:
                RaidDamage += data;
                if (RaidDamage >= MINRAIDDAMAGE)
                    RaidDamage = MINRAIDDAMAGE;
                break;
            case DATA_RESET_RAIDDAMAGE:
                RaidDamage = 0;
                break;
        }

         debug_log("BSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data);

        if (data == DONE)
            SaveToDB();
    }
开发者ID:morno,项目名称:blizzlikecore,代码行数:81,代码来源:instance_hyjal.cpp

示例13: UpdateAI

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

        if (m_uiAchievCheck)
        {
            if (m_uiAchievCheck < uiDiff)
            {
                Map *map = m_creature->GetMap();
                if (map->IsDungeon())
                {
                    Map::PlayerList const &PlayerList = map->GetPlayers();
                    for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                    {
                        if (i->getSource()->GetTotalAuraModValue(UNIT_MOD_RESISTANCE_FROST) > 100.0f)
                        {
                            if (m_pInstance)
                            {
                                m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_HUNDRED_CLUB, false);
                                m_uiAchievCheck = 0;
                            }
                        }
                    }
                    m_uiAchievCheck = 1000;
                }
            } else
                m_uiAchievCheck -= uiDiff;
        }

        switch (m_Phase)
        {
            case PHASE_GROUND:
                if (m_uiCleaveTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CLEAVE) == CAST_OK)
                        m_uiCleaveTimer = urand(5000, 10000);
                }
                else
                    m_uiCleaveTimer -= uiDiff;

                if (m_uiTailSweepTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_TAIL_SWEEP : SPELL_TAIL_SWEEP_H) == CAST_OK)
                        m_uiTailSweepTimer = urand(7000, 10000);
                }
                else
                    m_uiTailSweepTimer -= uiDiff;

                if (m_uiLifeDrainTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_LIFE_DRAIN : SPELL_LIFE_DRAIN_H) == CAST_OK)
                        m_uiLifeDrainTimer = 23000;
                }
                else
                    m_uiLifeDrainTimer -= uiDiff;

                if (m_uiBlizzardTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_SUMMON_BLIZZARD) == CAST_OK)
                        m_uiBlizzardTimer = 20000;
                }
                else
                    m_uiBlizzardTimer -= uiDiff;

                if (m_creature->GetHealthPercent() > 10.0f)
                {
                    if (m_uiFlyTimer < uiDiff)
                    {
                        m_Phase = PHASE_LIFT_OFF;
                        m_creature->InterruptNonMeleeSpells(false);
                        SetCombatMovement(false);
                        m_creature->GetMotionMaster()->Clear(false);
                        m_creature->GetMotionMaster()->MovePoint(1, aLiftOffPosition[0], aLiftOffPosition[1], aLiftOffPosition[2]);
                        // TODO This should clear the target, too

                        return;
                    }
                    else
                        m_uiFlyTimer -= uiDiff;
                }

                // Only Phase in which we have melee attack!
                DoMeleeAttackIfReady();
                break;
            case PHASE_LIFT_OFF:
                break;
            case PHASE_AIR_BOLTS:
                // WOTLK Changed, originally was 5
                if (m_uiIceboltCount == (uint32)(m_bIsRegularMode ? 2 : 3))
                {
                    if (m_uiFrostBreathTimer < uiDiff)
                    {
                        m_Phase = PHASE_AIR_BREATH;
                        DoScriptText(EMOTE_BREATH, m_creature);
                        DoCastSpellIfCan(m_creature, SPELL_FROST_BREATH_DUMMY);
                        m_uiFrostBreathTimer = 7000;
                    }
                    else
                        m_uiFrostBreathTimer -= uiDiff;
//.........这里部分代码省略.........
开发者ID:Reamer,项目名称:scriptdev2,代码行数:101,代码来源:boss_sapphiron.cpp

示例14: UpdateAI

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

        switch (stage) 
        {
            case 0:
            {
                bsw->timedCast(SPELL_FEROCIOUS_BUTT, uiDiff);
                bsw->timedCast(SPELL_ARCTIC_BREATH, uiDiff);
                bsw->timedCast(SPELL_WHIRL, uiDiff);
                if (bsw->timedQuery(SPELL_MASSIVE_CRASH, uiDiff)) stage = 1;
                bsw->timedCast(SPELL_FROTHING_RAGE, uiDiff);
                DoMeleeAttackIfReady();
                break;
            }
            case 1:
            {
                 if (bsw->doCast(SPELL_MASSIVE_CRASH) == CAST_OK)
                     stage = 2;
                 break;
            }
            case 2:
            {
                if (pTarget = bsw->SelectUnit())
                {
                    TrampleCasted = false;
                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                    stage = 3;
                    bsw->resetTimer(SPELL_TRAMPLE);
                    DoScriptText(-1713506,m_creature,pTarget);
                    SetCombatMovement(false);
                    m_creature->GetMotionMaster()->MoveIdle();
                }
                break;
            }
            case 3:
            {
                if (bsw->timedQuery(SPELL_TRAMPLE,uiDiff))
                {
                    pTarget->GetPosition(fPosX, fPosY, fPosZ);
                    TrampleCasted = false;
                    MovementStarted = true;
                    m_creature->GetMotionMaster()->MovePoint(1, fPosX, fPosY, fPosZ);
                    DoScriptText(-1713508,m_creature);
                    bsw->doCast(SPELL_ADRENALINE);
                    stage = 4;
                }
                break;
            }
            case 4:
            {
                if (MovementStarted)
                {
                    Map* pMap = m_creature->GetMap();
                    Map::PlayerList const &lPlayers = pMap->GetPlayers();
                    for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
                    {
                        Unit* pPlayer = itr->getSource();
                        if (!pPlayer) continue;
                        if (pPlayer->isAlive() && pPlayer->IsWithinDistInMap(m_creature, 5.0f))
                        {
                            bsw->doCast(SPELL_TRAMPLE, pPlayer);
                            TrampleCasted = true;
                            MovementStarted = false;
                            m_creature->GetMotionMaster()->MovementExpired();
                            m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                        }
                    }

                } else stage = 5;
                if (TrampleCasted) stage = 5;
                break;
            }
            case 5:
            {
                if (!TrampleCasted)
                {
                    bsw->doCast(SPELL_STAGGERED_DAZE);
                    DoScriptText(-1713507,m_creature);
                }
                MovementStarted = false;
                m_creature->GetMotionMaster()->MovementExpired();
                m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
                SetCombatMovement(true);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                stage = 0;
                break;
            }
        }
    }
开发者ID:eviljared,项目名称:diamondcore,代码行数:92,代码来源:boss_northrend_beasts.cpp

示例15: SetData

        void SetData(uint32 type, uint32 data)
        {
            switch(type)
            {
                case DATA_RAGEWINTERCHILLEVENT: m_auiEncounter[0] = data; break;
                case DATA_ANETHERONEVENT:
                    m_auiEncounter[1] = data;
                    break;
                case DATA_KAZROGALEVENT:        m_auiEncounter[2] = data; break;
                case DATA_AZGALOREVENT:
                    {
                        m_auiEncounter[3] = data;
                        if (data == DONE)
                        {
                            if (ArchiYell)break;
                            ArchiYell = true;

                            Creature* creature = instance->GetCreature(Azgalor);
                            if (creature)
                            {
                                Creature* pUnit = creature->SummonCreature(21987,creature->GetPositionX(),creature->GetPositionY(),creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000);

                                Map* pMap = creature->GetMap();
                                if (pMap->IsDungeon() && pUnit)
                                {
                                    pUnit->SetVisible(false);
                                    Map::PlayerList const &PlayerList = pMap->GetPlayers();
                                    if (PlayerList.isEmpty())
                                         return;

                                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                    {
                                         if (i->getSource())
                                         {
                                            WorldPacket data(SMSG_MESSAGECHAT, 200);
                                            pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID());
                                            i->getSource()->GetSession()->SendPacket(&data);

                                            WorldPacket data2(SMSG_PLAY_SOUND, 4);
                                            data2 << 10986;
                                            i->getSource()->GetSession()->SendPacket(&data2);
                                         }
                                    }
                                }
                            }
                        }
                    }
                    break;
                case DATA_ARCHIMONDEEVENT:      m_auiEncounter[4] = data; break;
                case DATA_RESET_TRASH_COUNT:    Trash = 0;            break;

                case DATA_TRASH:
                    if (data) Trash = data;
                    else     Trash--;
                    DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
                    break;
                case TYPE_RETREAT:
                    if (data == SPECIAL)
                    {
                        if (!m_uiAncientGemGUID.empty())
                        {
                            for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
                            {
                                //don't know how long it expected
                                DoRespawnGameObject(*itr,DAY);
                            }
                        }
                    }
                    break;
                case DATA_ALLIANCE_RETREAT:
                    allianceRetreat = data;
                    HandleGameObject(HordeGate, true);
                    SaveToDB();
                    break;
                case DATA_HORDE_RETREAT:
                    hordeRetreat = data;
                    HandleGameObject(ElfGate, true);
                    SaveToDB();
                    break;
                case DATA_RAIDDAMAGE:
                    RaidDamage += data;
                    if (RaidDamage >= MINRAIDDAMAGE)
                        RaidDamage = MINRAIDDAMAGE;
                    break;
                case DATA_RESET_RAIDDAMAGE:
                    RaidDamage = 0;
                    break;
            }

             sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data);

            if (data == DONE)
            {
                OUT_SAVE_INST_DATA;

                std::ostringstream saveStream;
                saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
                    << m_auiEncounter[3] << " " << m_auiEncounter[4]
                    << " " << allianceRetreat << " " << hordeRetreat
                    << " " << RaidDamage;
//.........这里部分代码省略.........
开发者ID:AlexTheBest,项目名称:ACore,代码行数:101,代码来源:instance_hyjal.cpp


注:本文中的Map::GetPlayers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。