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


C++ DoStartMovement函数代码示例

本文整理汇总了C++中DoStartMovement函数的典型用法代码示例。如果您正苦于以下问题:C++ DoStartMovement函数的具体用法?C++ DoStartMovement怎么用?C++ DoStartMovement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: UpdateAI


//.........这里部分代码省略.........
                }else Fly_Timer -= diff;
            }
        }

        if (phase == 2)
        {
            if (Icebolt_Timer < diff && Icebolt_Count < 5)
            {
                if (Icebolt_Count == 1 || Icebolt_Count == 3)
                    if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
                    {
                        DoCast(target, SPELL_ICEBOLT);
                        targets.push_back(target);
                    }

                ++Icebolt_Count;
                Icebolt_Timer = 4000;
            }else Icebolt_Timer -= diff;

            if (Icebolt_Count == 5 && !landoff)
            {
                if (FrostBreath_Timer < diff)
                {
                    // apply immune
                    ThreatList const& tList = m_creature->getThreatManager().getThreatList();
                    for (ThreatList::const_iterator iter = tList.begin();iter != tList.end(); ++iter)
                    {
                        Unit* pUnit = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid());
                        if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER) && pUnit->isAlive())
                        {
                            if (!pUnit->HasAura(SPELL_ICEBOLT))
                            {
                                for(std::vector<Unit*>::iterator itr = targets.begin(); itr!= targets.end(); ++itr)
                                {
                                    if (*itr)
                                    {
                                        if(!(*itr)->isAlive())
                                            return;
                                        if (pUnit->GetDistance2d(*itr) <= 5 && (*itr)->HasAura(SPELL_ICEBOLT))
                                            pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
                                    }
                                }
                            }
                        }
                    }

                    DoScriptText(EMOTE_BREATH, m_creature);
                    DoCast(m_creature->getVictim(),m_bIsRegularMode ? SPELL_FROST_BREATH : SPELL_FROST_BREATH_H);
                    land_Timer = 2000;
                    landoff = true;
                    FrostBreath_Timer = 6000;
                }else FrostBreath_Timer -= diff;
            }

            if (landoff)
            {
                if (land_Timer < diff)
                {
                    phase = 1;
                    m_creature->HandleEmote(EMOTE_ONESHOT_LAND);
                    m_creature->SetHover(false);
                    m_creature->GetMotionMaster()->Clear(false);
                    m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());

                    ThreatList const& tList = m_creature->getThreatManager().getThreatList();
                    for (ThreatList::const_iterator iter = tList.begin();iter != tList.end(); ++iter)
                    {
                        Unit* pUnit = m_creature->GetMap()->GetUnit((*iter)->getUnitGuid());
                        if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
                            pUnit->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, false);
                    }

                    targets.clear();
                    Fly_Timer = 67000;
                    isAtGround = false;
                    land_time = 3500;
                }else land_Timer -= diff;
            }
        }
        if(phase == 1 && isAtGround == false)
        {
            if(land_time < diff)
            {
                isAtGround = true;
                DoStartMovement(m_creature->getVictim());
            }else land_time -=diff;
        }
        if (Beserk_Timer < diff)
        {
            if (DoCastSpellIfCan(m_creature, SPELL_BESERK) == CAST_OK)
            {
                DoScriptText(EMOTE_GENERIC_ENRAGED, m_creature);
                Beserk_Timer = 300000;
            }
        }else Beserk_Timer -= diff;


        if (phase!=2 && isAtGround == true)
            DoMeleeAttackIfReady();
    }
开发者ID:DeadZoneNet,项目名称:DeadZone.Net-ScriptDev2-,代码行数:101,代码来源:boss_sapphiron.cpp

示例2: UpdateAI

            void UpdateAI(uint32 diff)
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);

                if (me->HasUnitState(UNIT_STATE_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_BERSERK:
                            Talk(SAY_BRUNDIR_BERSERK);
                            DoCast(SPELL_BERSERK);
                            events.CancelEvent(EVENT_BERSERK);
                            break;
                        case EVENT_CHAIN_LIGHTNING:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                DoCast(target, SPELL_CHAIN_LIGHTNING);
                            events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, urand(7000, 10000));
                            break;
                        case EVENT_OVERLOAD:
                            Talk(EMOTE_BRUNDIR_OVERLOAD);
                            Talk(SAY_BRUNDIR_SPECIAL);
                            DoCast(SPELL_OVERLOAD);
                            events.ScheduleEvent(EVENT_OVERLOAD, urand(60000, 120000));
                            break;
                        case EVENT_LIGHTNING_WHIRL:
                            DoCast(SPELL_LIGHTNING_WHIRL);
                            events.ScheduleEvent(EVENT_LIGHTNING_WHIRL, urand(15000, 20000));
                            break;
                        case EVENT_LIGHTNING_TENDRILS:
                            Talk(SAY_BRUNDIR_FLIGHT);
                            DoCast(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M));
                            DoCast(SPELL_LIGHTNING_TENDRILS_VISUAL);
                            me->AttackStop();
                            //me->SetLevitate(true);
                            me->GetMotionMaster()->Initialize();
                            me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FINAL_FLIGHT_Z);
                            events.DelayEvents(35000);
                            events.ScheduleEvent(EVENT_FLIGHT, 2500);
                            events.ScheduleEvent(EVENT_ENDFLIGHT, 32500);
                            events.ScheduleEvent(EVENT_LIGHTNING_TENDRILS, 90000);
                            break;
                        case EVENT_FLIGHT:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                me->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), FINAL_FLIGHT_Z);
                            events.ScheduleEvent(EVENT_FLIGHT, 6000);
                            break;
                        case EVENT_ENDFLIGHT:
                            me->GetMotionMaster()->Initialize();
                            me->GetMotionMaster()->MovePoint(0, 1586.920166f, 119.848984f, FINAL_FLIGHT_Z);
                            events.CancelEvent(EVENT_FLIGHT);
                            events.CancelEvent(EVENT_ENDFLIGHT);
                            events.ScheduleEvent(EVENT_LAND, 4000);
                            break;
                        case EVENT_LAND:
                            me->GetMotionMaster()->Initialize();
                            me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), FLOOR_Z);
                            events.CancelEvent(EVENT_LAND);
                            events.ScheduleEvent(EVENT_GROUND, 2500);
                            break;
                        case EVENT_GROUND:
                            //me->SetLevitate(false);
                            me->RemoveAurasDueToSpell(RAID_MODE(SPELL_LIGHTNING_TENDRILS_10M, SPELL_LIGHTNING_TENDRILS_25M));
                            me->RemoveAurasDueToSpell(SPELL_LIGHTNING_TENDRILS_VISUAL);
                            DoStartMovement(me->getVictim());
                            events.CancelEvent(EVENT_GROUND);
                            me->getThreatManager().resetAllAggro();
                            break;
                        case EVENT_MOVE_POSITION:
                            if (me->IsWithinMeleeRange(me->getVictim()))
                            {
                                float x = float(irand(-25, 25));
                                float y = float(irand(-25, 25));
                                me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + x, me->GetPositionY() + y, FLOOR_Z);
                                // Prevention to go outside the room or into the walls
                                if (Creature* trigger = me->FindNearestCreature(NPC_WORLD_TRIGGER, 100.0f, true))
                                    if (me->GetDistance(trigger) >= 50.0f)
                                        me->GetMotionMaster()->MovePoint(0, trigger->GetPositionX(), trigger->GetPositionY(), FLOOR_Z);
                            }
                            events.ScheduleEvent(EVENT_MOVE_POSITION, urand(7500, 10000));
                            break;
                        default:
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
开发者ID:Asandru,项目名称:Script-Land,代码行数:93,代码来源:boss_assembly_of_iron.cpp

示例3: UpdateAI

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

        if (m_uiDeathCheckTimer < diff)
        {
			Map* pMap = m_creature->GetMap();
			if(pMap)
			{
				Map::PlayerList const &lPlayers = pMap->GetPlayers();
				for (Map::PlayerList::const_iterator iter = lPlayers.begin(); iter != lPlayers.end(); ++iter)
				{
					Player* pPlayer = iter->getSource();

					if(!pPlayer->isAlive())
						m_bIsPlayerDeath = true;
				}
			}
            m_uiDeathCheckTimer = 1000;
        }else m_uiDeathCheckTimer -= diff;

        if (m_uiEvadeCheckCooldown < diff)
        {
            if (m_creature->GetDistance2d(2769.68f, -3684.61f) > 48.0f)
                EnterEvadeMode();

            m_uiEvadeCheckCooldown = 2000;
        }else m_uiEvadeCheckCooldown -= diff;

        if (m_bDelay)
        {
            m_bDelay = false;
            DoCast(m_creature, SPELL_PLAGUED_CLOUD);
        }

        if (Phase_Timer < diff)
        {
            if (m_bCombatPhase)
            {
                m_creature->InterruptNonMeleeSpells(true);
                m_creature->StopMoving();
                m_creature->GetMotionMaster()->Clear(false);
                m_creature->GetMotionMaster()->MoveIdle();
                m_creature->GetMap()->CreatureRelocation(m_creature, PLATFORM_X, PLATFORM_Y, PLATFORM_Z, PLATFORM_O);
                m_creature->SendMonsterMove(PLATFORM_X, PLATFORM_Y, PLATFORM_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0);
                SetCombatMovement(false);
                m_bDelay = true;
                Phase_Timer = 45000;
            }
            else
            {
                SetCombatMovement(true);
                DoStartMovement(m_creature->getVictim());
                Phase_Timer = 90000;
                Disruption_Timer = 0;
            }

            m_bCombatPhase = !m_bCombatPhase;
            m_uiSafeSection = 0;
            Erupt_Timer = 10000;
            m_bEruptDirection = false;

        }
        else
            Phase_Timer -= diff;

        if (Erupt_Timer < diff)
        {
            for (std::list<uint64>::iterator itr = m_PlagueFissureGUID[m_uiSafeSection].begin(); itr != m_PlagueFissureGUID[m_uiSafeSection].end(); ++itr)
            {
                if (GameObject* pGo = m_creature->GetMap()->GetGameObject(*itr))

                if (pGo)
                {
                    WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4);
                    data << pGo->GetGUID();
                    data << 0;
                    pGo->SendMessageToSet(&data,true);
                    if (Creature* pTemp = m_creature->SummonCreature(14667, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100))
                    {
                        pTemp->SetLevel(80);
                        pTemp->CastSpell(pTemp, SPELL_ERUPTION, true);
                    }
                }
            }

            if (m_uiSafeSection == 0 || m_uiSafeSection == 3)
                m_bEruptDirection = !m_bEruptDirection;


            m_bEruptDirection ? ++m_uiSafeSection : --m_uiSafeSection;

            m_bCombatPhase ? Erupt_Timer = 10000 : Erupt_Timer = 3000;

            // Teleport "cheaters" to center of room (until LOS with GOs will be implemented)
            Map* map = m_creature->GetMap();
            if (map->IsDungeon())
            {
                Map::PlayerList const &PlayerList = map->GetPlayers();
//.........这里部分代码省略.........
开发者ID:xXNembiXx,项目名称:scriptdev2_335,代码行数:101,代码来源:boss_heigan.cpp

示例4: UpdateAI

    void UpdateAI(const uint32 uiDiff) override
    {
        // Banish the boss before combat
        if (m_uiBanishTimer)
        {
            if (m_uiBanishTimer <= uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_LEOTHERAS_BANISH) == CAST_OK)
                    m_uiBanishTimer = 0;
            }
            else
                m_uiBanishTimer -= uiDiff;
        }

        // Return since we have no target
        if (!SelectHostileTarget() || !m_creature->getVictim())
            return;

        if (m_uiFinalFormTimer)
        {
            if (m_uiFinalFormTimer <= uiDiff)
            {
                DoSpawnCreature(NPC_SHADOW_LEO, 0, 0, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                SetCombatMovement(true);
                DoStartMovement(m_creature->getVictim());
                m_uiFinalFormTimer = 0;
            }
            else
                m_uiFinalFormTimer -= uiDiff;

            // Wait until we finish the transition
            return;
        }

        // Human form spells
        if (!m_bDemonForm)
        {
            if (m_uiWhirlwindTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_WHIRLWIND) == CAST_OK)
                    m_uiWhirlwindTimer = 32000;
            }
            else
                m_uiWhirlwindTimer -= uiDiff;

            if (!m_bIsFinalForm)
            {
                if (m_uiSwitchTimer < uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_METAMORPHOSIS) == CAST_OK)
                    {
                        DoScriptText(SAY_SWITCH_TO_DEMON, m_creature);

                        SetCombatMovement(false);
                        m_creature->GetMotionMaster()->Clear();
                        m_creature->GetMotionMaster()->MoveIdle();
                        DoResetThreat();
                        m_bDemonForm = true;

                        m_uiInnerDemonTimer = 27500;
                        m_uiSwitchTimer = 60000;
                    }
                }
                else
                    m_uiSwitchTimer -= uiDiff;
            }

            DoMeleeAttackIfReady();
        }
        // Demon form spells
        else
        {
            if (m_uiInnerDemonTimer)
            {
                if (m_uiInnerDemonTimer <= uiDiff)
                {
                    if (DoCastSpellIfCan(m_creature, SPELL_INSIDIOUS_WHISPER, CAST_INTERRUPT_PREVIOUS) == CAST_OK)
                    {
                        DoScriptText(SAY_INNER_DEMONS, m_creature);
                        m_uiInnerDemonTimer = 0;
                    }
                }
                else
                    m_uiInnerDemonTimer -= uiDiff;
            }

            if (m_uiChaosBlastTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_CHAOS_BLAST) == CAST_OK)
                    m_uiChaosBlastTimer = urand(2000, 3000);
            }
            else
                m_uiChaosBlastTimer -= uiDiff;

            if (m_uiSwitchTimer < uiDiff)
            {
                if (m_creature->IsNonMeleeSpellCasted(false))
                    m_creature->InterruptNonMeleeSpells(false);
//.........这里部分代码省略.........
开发者ID:Jahdere,项目名称:TBC,代码行数:101,代码来源:boss_leotheras_the_blind.cpp

示例5: HandleFlightSequence


//.........这里部分代码省略.........
                }

                events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000);
                break;
            }
            case 3:
            {
                DespawnSummons(MOB_VAPOR_TRAIL);
                //DoCast(me, SPELL_VAPOR_SELECT); need core support

                Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                if (!target)
                    target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0);

                if (!target)
                {
                    EnterEvadeMode();
                    return;
                }

                //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support
                Creature* pVapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                if (pVapor)
                {
                    if (pVapor->AI())
                        pVapor->AI()->AttackStart(target);
                    me->InterruptNonMeleeSpells(false);
                    DoCast(pVapor, SPELL_VAPOR_CHANNEL, false); // core bug
                    pVapor->CastSpell(pVapor, SPELL_VAPOR_TRIGGER, true);
                }

                events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000);
                break;
            }
            case 4:
                DespawnSummons(MOB_VAPOR_TRAIL);
                events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1);
                break;
            case 5:
            {
                Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                if (!target)
                    target = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_PLAYER_GUID) : 0);

                if (!target)
                {
                    EnterEvadeMode();
                    return;
                }

                breathX = target->GetPositionX();
                breathY = target->GetPositionY();
                float x, y, z;
                target->GetContactPoint(me, x, y, z, 70);
                me->GetMotionMaster()->MovePoint(0, x, y, z+10);
                break;
            }
            case 6:
                me->SetOrientation(me->GetAngle(breathX, breathY));
                me->StopMoving();
                //DoTextEmote("takes a deep breath.", NULL);
                events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000);
                break;
            case 7:
            {
                DoCast(me, SPELL_FOG_BREATH, true);
                float x, y, z;
                me->GetPosition(x, y, z);
                x = 2 * breathX - x;
                y = 2 * breathY - y;
                me->GetMotionMaster()->MovePoint(0, x, y, z);
                events.ScheduleEvent(EVENT_SUMMON_FOG, 1);
                break;
            }
            case 8:
                me->CastStop(SPELL_FOG_BREATH);
                me->RemoveAurasDueToSpell(SPELL_FOG_BREATH);
                ++uiBreathCount;
                events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 1);
                if (uiBreathCount < 3)
                    uiFlightCount = 4;
                break;
            case 9:
                if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO))
                    DoStartMovement(target);
                else
                {
                    EnterEvadeMode();
                    return;
                }
                break;
            case 10:
                me->SetLevitate(false);
                me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                EnterPhase(PHASE_GROUND);
                AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO));
                break;
            }
            ++uiFlightCount;
        }
开发者ID:Jorex,项目名称:SkyFireEMU,代码行数:101,代码来源:boss_felmyst.cpp

示例6: UpdateAI


//.........这里部分代码省略.........
                }
                else
                    m_uiShackleTimer -= uiDiff;

                break;
            case PHASE_GROUNDED:

                if (m_uiGroundedTimer < uiDiff)
                {
                    switch (m_uiGroundedStep)
                    {
                        case 0:
                            m_creature->RemoveAurasDueToSpell(SPELL_STUN);
                            if (DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_FLAME_BREATH : SPELL_FLAME_BREATH_H) == CAST_OK)
                            {
                                DoScriptText(EMOTE_BREATH, m_creature);
                                m_uiGroundedTimer = 2500;
                            }
                            break;
                        case 1:
                            if (DoCastSpellIfCan(m_creature, SPELL_WING_BUFFET) == CAST_OK)
                                m_uiGroundedTimer = 1500;
                            break;
                        case 2:
                            if (DoCastSpellIfCan(m_creature, SPELL_FIREBOLT) == CAST_OK)
                                m_uiGroundedTimer = 2000;
                            break;
                        case 3:
                            // if fully grounded then go to ground phase
                            if (m_bIsGrounded)
                            {
                                SetCombatMovement(true);
                                DoResetThreat();
                                DoStartMovement(m_creature->getVictim());
                                m_uiPhase = PHASE_ONLY_GROUND;
                            }
                            // resume air phase
                            else
                            {
                                m_creature->SetLevitate(true);
                                m_creature->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_FLY_ANIM);

                                float fX, fY, fZ;
                                m_creature->GetRespawnCoord(fX, fY, fZ);

                                // use upgraded speed rate for FlyOrLand. This isn't supported by DB but it's confirmed to happen on retail
                                uint32 uiSpeedRate = m_creature->GetSpeedRate(MOVE_RUN);
                                m_creature->SetSpeedRate(MOVE_RUN, SPEED_RATE_RAZORSCALE);
                                m_creature->GetMotionMaster()->MoveFlyOrLand(1, fX, fY, fZ, true);
                                m_creature->SetSpeedRate(MOVE_RUN, uiSpeedRate);

                                // reset timers
                                m_uiPhase               = PHASE_AIR;
                                m_uiCurrentHarpoon      = 0;
                                m_uiHarpoonsUsed        = 0;
                                m_uiRepairHarpoonTimer  = 20000;
                                m_uiFireballTimer       = 5000;
                                m_uiDevouringFlameTimer = 10000;
                                ++m_uiFlyPhaseCount;

                                // set achiev criteria as failed
                                if (m_uiFlyPhaseCount >= 2 && m_pInstance)
                                    m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_QUICK_SHAVE, false);
                            }

                            // make the Trappers evade or move to home position
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:67,代码来源:boss_razorscale.cpp

示例7: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (SayTimer <= diff)
            {
                if (Event)
                    SayTimer = NextStep(++Step);
            } else SayTimer -= diff;

            if (Attack)
            {
                Player* player = Unit::GetPlayer(*me, PlayerGUID);
                me->setFaction(14);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                if (player)
                {
                Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
                if (Creepjack)
                {
                    Creepjack->Attack(player, true);
                    Creepjack->setFaction(14);
                    Creepjack->GetMotionMaster()->MoveChase(player);
                    Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
                if (Malone)
                {
                    Malone->Attack(player, true);
                    Malone->setFaction(14);
                    Malone->GetMotionMaster()->MoveChase(player);
                    Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                    DoStartMovement(player);
                    AttackStart(player);
                }
                Attack = false;
            }

            if (HealthBelowPct(5) && !Done)
            {
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                me->RemoveAllAuras();

                Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
                if (Creepjack)
                {
                    CAST_CRE(Creepjack)->AI()->EnterEvadeMode();
                    Creepjack->setFaction(1194);
                    Creepjack->GetMotionMaster()->MoveTargetedHome();
                    Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
                if (Malone)
                {
                    CAST_CRE(Malone)->AI()->EnterEvadeMode();
                    Malone->setFaction(1194);
                    Malone->GetMotionMaster()->MoveTargetedHome();
                    Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                }
                me->setFaction(1194);
                Done = true;
                DoScriptText(SAY_GIVEUP, me, NULL);
                me->DeleteThreatList();
                me->CombatStop();
                me->GetMotionMaster()->MoveTargetedHome();
                Player* player = Unit::GetPlayer(*me, PlayerGUID);
                if (player)
                    CAST_PLR(player)->GroupEventHappens(QUEST_WBI, me);
            }
            DoMeleeAttackIfReady();
        }
开发者ID:48jir,项目名称:SkyFireEMU,代码行数:70,代码来源:shattrath_city.cpp

示例8: HandleFlightSequence


//.........这里部分代码省略.........
                    {
                        Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                        if (Vapor)
                        {
                            Vapor->AI()->AttackStart(target);
                            me->InterruptNonMeleeSpells(false);
                            me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                            Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
                        }
                    }
                    else
                        Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                    break;
                }
                case 3:
                {
                    DespawnSummons(MOB_VAPOR_TRAIL);
                    sLog->outError(LOG_FILTER_TSCR, "Summon Vapor case3");
                    Unit* target;
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                    if (!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID));
                    if (target)
                    {
                        Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                        if (Vapor)
                        {
                            Vapor->AI()->AttackStart(target);
                            me->InterruptNonMeleeSpells(false);
                            me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                            Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
                        }
                    }
                    else
                        Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                    break;
                }
                case 4:
                    DespawnSummons(MOB_VAPOR_TRAIL);
                    Timer[EVENT_FLIGHT_SEQUENCE] = 1;
                    break;
                case 5:
                {
                    float x, y, z;
                    GetRandFlyPos(x,y,z);
                    me->GetMotionMaster()->MovePoint(0, x,y,z);
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                }
                case 6:
                    me->SetOrientation(me->GetAngle(me->GetPositionX(), MIDDLE_Y));
                    me->StopMoving();
                    Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                    break;
                case 7:
                    me->CastSpell(me, SPELL_FOG_BREATH, true);
                    {
                        float x, y, z;
                        GetNextFlyPos(x,y,z);
                        me->GetMotionMaster()->MovePoint(5, x, y, z);
                    }
                    Timer[EVENT_SUMMON_FOG] = 1;
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                case 8:
                    me->RemoveAurasDueToSpell(SPELL_FOG_BREATH);
                    BreathCount++;
                    Timer[EVENT_SUMMON_FOG] = 0;
                    Timer[EVENT_FLIGHT_SEQUENCE] = 1;
                    if (BreathCount < 3) FlightCount = 5;
                    break;
                case 9:
                    if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
                    {
                        float x, y, z;
                        target->GetContactPoint(me, x, y, z);
                        me->GetMotionMaster()->MovePoint(0, x, y, z);
                    }
                    else
                    {
                        float x,y,z;

                        x = 1435;
                        y = MIDDLE_Y;
                        z = 0;
                        me->UpdateGroundPositionZ(x, y, z);
                        me->GetMotionMaster()->MovePoint(0, x, y, z);
                    }
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                case 10:
                    me->SetDisableGravity(true);
                    me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                    EnterPhase(PHASE_GROUND);
                    DoStartMovement(SelectTarget(SELECT_TARGET_TOPAGGRO, 0));
                    break;
                default:
                    break;
            }
            FlightCount++;
        }
开发者ID:FirstCore,项目名称:Battle,代码行数:101,代码来源:boss_felmyst.cpp

示例9: UpdateAI

        void UpdateAI(uint32 const diff)
        {
            if(!UpdateVictim())
                return;

            events.Update(diff);

            if(me->HasUnitState(UNIT_STATE_CASTING))
                return;

            if(uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                case EVENT_CURSE_OF_BLOOD:
                    DoCastVictim(SPELL_CURSE_OF_BLOOD);
                    events.ScheduleEvent(EVENT_CURSE_OF_BLOOD, urand(8000, 10000), 0, PHASE_NORMAL);
                    break;
                case EVENT_FORCE_GRIP:
                    vehicle->SetVehicleId(VEHICLE_GRIP);
                    DoCastVictim(SPELL_FORCE_GRIP);
                    events.ScheduleEvent(EVENT_FORCE_GRIP, urand(15000, 20000), 0, PHASE_NORMAL);
                    break;
                case EVENT_GRAVITY_WELL:
                    DoCastRandom(SPELL_SUMMON_GRAVITY_WELL, 100.0f, false);
                    events.ScheduleEvent(EVENT_GRAVITY_WELL, urand(15000, 20000), 0, PHASE_NORMAL);
                    break;
                case EVENT_SEISMIC_SHARD:
                    if(Unit * target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
                    {
                        target->GetPosition(&shardPos);
                        DoCast(SPELL_SEISMIC_SHARD_PULL);
                        me->CastSpell(shardPos.GetPositionX(), shardPos.GetPositionY(), shardPos.GetPositionZ(), SPELL_SEISMIC_SHARD_TAR, false);
                        DoCast(SPELL_SEISMIC_SHARD_THROW);
                        events.ScheduleEvent(EVENT_SEISMIC_SHARD_THROW, 3000);
                    }
                    if(seismicShards < 2)
                    {
                        ++seismicShards;
                        events.ScheduleEvent(EVENT_SEISMIC_SHARD, 7000);
                    }
                    break;
                case EVENT_SEISMIC_SHARD_THROW:
                    if(Unit* passenger = vehicle->GetPassenger((first ? 0 : 1)))
                    {
                        if (passenger)
                        {
                            passenger->ExitVehicle();
                            passenger->CastSpell(shardPos.GetPositionX(), shardPos.GetPositionY(), shardPos.GetPositionZ(), SPELL_SEISMIC_SHARD_CHARGE, false);
                            passenger->ToCreature()->DespawnOrUnsummon(3000);
                            first = false;
                        }
                    }
                    break;
                case EVENT_ENERGY_SHIELD:
                    Talk(SAY_SHIELD);
                    me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
                    me->GetMotionMaster()->Clear();
                    me->GetMotionMaster()->MoveIdle();
                    vehicle->SetVehicleId(VEHICLE_NORMAL);
                    me->SetReactState(REACT_PASSIVE);
                    me->SetUInt64Value(UNIT_FIELD_TARGET, 0);
                    events.SetPhase(PHASE_SHIELD);
                    DoCast(SPELL_ENERGY_SHIELD);
                    seismicShards = 0;
                    events.ScheduleEvent(EVENT_ENERGY_SHIELD_END, 2000);
                    break;
                case EVENT_ENERGY_SHIELD_END: // fly up
                    me->GetMotionMaster()->MoveJump(me->GetHomePosition(), 30.0f, 30.0f, POINT_PLATFORM);
                    break;
                case EVENT_SHIELD_PHASE_END:
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
                    me->RemoveAurasDueToSpell(SPELL_SEISMIC_SHARD);
                    me->RemoveAurasDueToSpell(SPELL_ENERGY_SHIELD);
                    if(Unit * victim = me->GetVictim())
                    {
                        me->SetReactState(REACT_AGGRESSIVE);
                        DoStartMovement(victim);
                    }
                    events.SetPhase(PHASE_NORMAL);
                    events.RescheduleEvent(EVENT_CURSE_OF_BLOOD, urand(8000, 10000), 0, PHASE_NORMAL);
                    events.RescheduleEvent(EVENT_GRAVITY_WELL, urand(15000, 20000), 0, PHASE_NORMAL);
                    events.RescheduleEvent(EVENT_FORCE_GRIP, urand(10000, 12000), 0, PHASE_NORMAL);
                    events.ScheduleEvent(EVENT_ENERGY_SHIELD, urand(40000, 45000), 0, PHASE_NORMAL);
                    break;
                case EVENT_ADDS_SUMMON:
                    {
                        if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
                        {
                            uint8 amount = 3;
                            uint8 pos = urand(0, 1);
                            if(events.IsInPhase(PHASE_SHIELD))
                                amount = urand(8, 10);
                            for(int i=0; i < amount; ++i)
                            {
                                Position tarPos;
                                me->GetRandomPoint(summonPos[pos], 5.0f, tarPos);
                                if(Creature * summon = me->SummonCreature(NPC_FOLLOWER, tarPos, TEMPSUMMON_DEAD_DESPAWN, 1000))
                                {
                                    summon->AI()->AttackStart(target);
//.........这里部分代码省略.........
开发者ID:beyourself,项目名称:Wow-4.3.4,代码行数:101,代码来源:boss_high_priestess_azil.cpp

示例10: UpdateAI

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

        if (m_bDelay)
        {
            DoStartMovement(m_creature->getVictim());
            m_bDelay = false;
        }

        if (isTeleported)
        {
            if (Teleport_Timer < diff)
            {
                m_creature->MonsterTextEmote("%s teleports back into the battle!", 0, true);
                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, CENTER_Z, 0);
                m_creature->SendMonsterMove(CENTER_X, CENTER_Y, CENTER_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0);
                isTeleported = false;
                m_bDelay = true;
                Teleport_Timer = 120000;
            }
            else
                Teleport_Timer -= diff;

            if (SecondPhase_Timer < diff)
            {
                m_creature->MonsterTextEmote("%s raises more skeletons!", 0, true);
                for (uint8 i = 1; i <= (m_bIsRegularMode ? 2 : 4); ++i)
                {
                    uint32 uiAdd = NPC_PLAGUED_CHAMPION;
                    if (SecondPhaseCounter != 1 && i%2 == 0)
                        uiAdd = NPC_PLAGUED_GUARDIAN;
                    uint8 uiI = urand(0, 4);
                    m_creature->SummonCreature(uiAdd, adds_coords[uiI][0], adds_coords[uiI][1], adds_coords[uiI][2], adds_coords[uiI][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                }
                SecondPhase_Timer = 35000;
            }
            else
                SecondPhase_Timer -= diff;

            return;
        }

        //Blink_Timer
        if (!m_bIsRegularMode)
            if (Blink_Timer < diff)
            {
                DoCast(m_creature->getVictim(), SPELL_CRIPPLE);
                uint8 uiRX = urand(0, 60);
                uint8 uiRY = urand(0, 60);
                m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X-30+uiRX, CENTER_Y-30+uiRY, CENTER_Z, 0);
                m_creature->SendMonsterMove(CENTER_X-30+uiRX, CENTER_Y-30+uiRY, CENTER_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0);
                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                {
                    DoResetThreat();
                    AttackStart(pTarget);
                }
                Blink_Timer = urand(20000, 30000);
                m_bDelay = true;
            }
            else
                Blink_Timer -= diff;

        //Curse_Timer
        if (Curse_Timer < diff)
        {
            DoCast(m_creature->getVictim(), m_bIsRegularMode ? SPELL_CURSE_PLAGUEBRINGER : SPELL_CURSE_PLAGUEBRINGER_H);
            Curse_Timer = urand (25000, 30000);
        }
        else
            Curse_Timer -= diff;

        //Summon_Timer
        if (Summon_Timer < diff)
        {
            DoScriptText(SAY_SUMMON, m_creature);
            m_creature->MonsterTextEmote("%s summons the Skeletal Warriors!", 0, true);

            for (uint8 i = 0; i < (m_bIsRegularMode ? 2 : 3); ++i)
            {
                uint8 uiI = urand(0, 4);
                m_creature->SummonCreature(NPC_PLAGUED_WARRIOR, adds_coords[uiI][0], adds_coords[uiI][1], adds_coords[uiI][2], adds_coords[uiI][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
            }

            Summon_Timer = 30000;
        }
        else
            Summon_Timer -= diff;

        if (!m_bIsEnraged)
            if (Teleport_Timer < diff)
                if (SecondPhaseCounter < 3)
                {
                    m_creature->MonsterTextEmote("%s teleports to the balcony above!", 0, true);
                    m_creature->InterruptNonMeleeSpells(false);
                    m_creature->StopMoving();
                    m_creature->GetMotionMaster()->Clear();
                    m_creature->GetMotionMaster()->MoveIdle();
//.........这里部分代码省略.........
开发者ID:xXNembiXx,项目名称:scriptdev2_335,代码行数:101,代码来源:boss_noth.cpp

示例11: UpdateAI

	void UpdateAI(const uint32 diff)
	{
		if (WaitTimer)
			if (WaitTimer <= diff)
			{
				if (Intro)
				{
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

					if (MovePhase >= 7)
					{
						me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
						me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
						me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
						me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]);
					}
					else
					{
						me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]);
						++MovePhase;
					}
				}

				if (Flying)
				{
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

					if (MovePhase >= 7)
					{
						me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
						me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
						me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
						me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]);
					}
					else
					{
						me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]);
						++MovePhase;
					}
				}

				WaitTimer = 0;
			}
			else WaitTimer -= diff;

			if (!UpdateVictim())
				return;

			if (Flying)
				return;

			//  Phase 1 "GROUND FIGHT"
			if (Phase == 1)
			{
				if (Movement)
				{
					DoStartMovement(me->getVictim());
					Movement = false;
				}

				if (BellowingRoarTimer <= diff)
				{
					DoCast(me->getVictim(), SPELL_BELLOWING_ROAR);
					BellowingRoarTimer = urand(30000, 40000);
				}
				else BellowingRoarTimer -= diff;

				if (SmolderingBreathTimer <= diff)
				{
					DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH);
					SmolderingBreathTimer = 20000;
				}
				else SmolderingBreathTimer -= diff;

				if (DistractingAshTimer <= diff)
				{
					if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
						DoCast(pTarget, SPELL_DISTRACTING_ASH);
					DistractingAshTimer = urand(15000, 28000); //timer wrong
				}
				else DistractingAshTimer -= diff;

				if (CharredEarthTimer <= diff)
				{
					if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
						DoCast(pTarget, SPELL_CHARRED_EARTH);
					CharredEarthTimer = 20000;
				}
				else CharredEarthTimer -= diff;

				if (TailSweepTimer <= diff)
				{
					if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
						if (!me->HasInArc(float(M_PI), pTarget))
							DoCast(pTarget, SPELL_TAIL_SWEEP);
					TailSweepTimer = 15000;
				}
				else TailSweepTimer -= diff;

				if (SearingCindersTimer <= diff)
//.........这里部分代码省略.........
开发者ID:Leandros,项目名称:OregonCore,代码行数:101,代码来源:boss_nightbane.cpp

示例12: UpdateAI

            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

                if (Fireball_Timer <= diff)
                {
                    if (Unit* victim = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        DoCast(victim, SPELL_FIREBALL, true);
                    Fireball_Timer = urand(4000, 7000);
                }
                else
                    Fireball_Timer -= diff;

                if (flight) // phase 1 - the flight
                {
                    Creature* Vazruden = ObjectAccessor::GetCreature(*me, VazrudenGUID);
                    if (Fly_Timer < diff || !(Vazruden && Vazruden->IsAlive() && Vazruden->HealthAbovePct(20)))
                    {
                        flight = false;
                        BellowingRoar_Timer = 6000;
                        ConeOfFire_Timer = 12000;
                        me->SetDisableGravity(false);
                        me->SetWalk(true);
                        me->GetMotionMaster()->Clear();
                        if (Unit* victim = SelectTarget(SELECT_TARGET_NEAREST, 0))
                            AttackStart(victim);
                        DoStartMovement(me->GetVictim());
                        Talk(EMOTE);
                        return;
                    }
                    else
                        Fly_Timer -= diff;

                    if (Turn_Timer <= diff)
                    {
                        uint32 waypoint = (Fly_Timer/10000)%2;
                        if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5))
                            me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]);
                        Turn_Timer = 10000;
                    }
                    else
                        Turn_Timer -= diff;
                }
                else // phase 2 - land fight
                {
                    if (ConeOfFire_Timer <= diff)
                    {
                        DoCast(me, SPELL_CONE_OF_FIRE);
                        ConeOfFire_Timer = 12000;
                        Fireball_Timer = 4000;
                    }
                    else
                        ConeOfFire_Timer -= diff;

                    if (IsHeroic())
                    {
                        if (BellowingRoar_Timer <= diff)
                        {
                            DoCast(me, SPELL_BELLOWING_ROAR);
                            BellowingRoar_Timer = 45000;
                        }
                        else
                            BellowingRoar_Timer -= diff;
                    }

                    DoMeleeAttackIfReady();
                }
            }
开发者ID:Rastrian,项目名称:DeathCore_3.3.5,代码行数:69,代码来源:boss_vazruden_the_herald.cpp

示例13: UpdateAI

    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (m_checkTimer < diff)
        {
            if (me->IsWithinDistInMap(&wLoc, 100.0f))
                DoZoneInCombat();
            else
            {
                EnterEvadeMode();
                return;
            }

            uint32 damage = 0;
            SharedRule(damage);
            me->SetSpeed(MOVE_RUN, 2.0);
            // move always after stun recovery
            if (!me->hasUnitState(UNIT_STAT_STUNNED) && !me->HasAura(SPELL_VANISH, 1))
                DoStartMovement(me->getVictim());
            m_checkTimer = 1000;
        }
        else
            m_checkTimer -= diff;

        if (m_vanishTimer < diff)
        {
            if (me->HasAuraType(SPELL_AURA_MOD_STUN))    // remove stun
                me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STUN);

            if (me->HasAuraType(SPELL_AURA_MOD_STALKED)) // remove Hunter's Marks and similar trackers
                me->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED);

            me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true);

            ForceSpellCast(me, SPELL_VANISH, INTERRUPT_AND_CAST_INSTANTLY);
            ForceSpellCast(me, SPELL_DEADLY_POISON, INTERRUPT_AND_CAST_INSTANTLY);

            Position dest;
            if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 35.0f, true))
                target->GetValidPointInAngle(dest, 5.0f, frand(0.0f, 2*M_PI), true);
            else
                me->GetValidPointInAngle(dest, 30.0f, frand(0.0f, 2*M_PI), true);

            DoTeleportTo(dest.x, dest.y, dest.z);

            // drop movement :P
            me->GetMotionMaster()->MoveIdle();

            m_vanishTimer = 60000;
        }
        else
                m_vanishTimer -= diff;

        if (me->HasAura(SPELL_VANISH, 1))
            return;

        DoMeleeAttackIfReady();
        CastNextSpellIfAnyAndReady();
    }
开发者ID:Dolmero,项目名称:L4G_Core,代码行数:61,代码来源:illidari_council.cpp

示例14: UpdateAI

        void UpdateAI(uint32 diff)
        {
            if (Intro)
            {
                if (MovePhase)
                {
                    if (MovePhase >= 7)
                    {
                        me->SetDisableGravity(false);
                        me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                        me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]);
                    }
                    else
                    {
                        me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]);
                    }
                    MovePhase = 0;
                }
                return;
            }

            if (Flying && MovePhase)
            {
                if (MovePhase >= 7)
                {
                    me->SetDisableGravity(false);
                    me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                    me->GetMotionMaster()->MovePoint(8, IntroWay[7][0], IntroWay[7][1], IntroWay[7][2]);
                }
                else
                    me->GetMotionMaster()->MovePoint(MovePhase, IntroWay[MovePhase][0], IntroWay[MovePhase][1], IntroWay[MovePhase][2]);

                MovePhase = 0;
            }

            if (!UpdateVictim())
                return;

            if (Flying)
                return;

            //  Phase 1 "GROUND FIGHT"
            if (Phase == 1)
            {
                if (Movement)
                {
                    DoStartMovement(me->GetVictim());
                    Movement = false;
                }

                if (BellowingRoarTimer <= diff)
                {
                    DoCastVictim(SPELL_BELLOWING_ROAR);
                    BellowingRoarTimer = urand(30000, 40000);
                } else BellowingRoarTimer -= diff;

                if (SmolderingBreathTimer <= diff)
                {
                    DoCastVictim(SPELL_SMOLDERING_BREATH);
                    SmolderingBreathTimer = 20000;
                } else SmolderingBreathTimer -= diff;

                if (CharredEarthTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_CHARRED_EARTH);
                    CharredEarthTimer = 20000;
                } else CharredEarthTimer -= diff;

                if (TailSweepTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        if (!me->HasInArc(M_PI, target))
                            DoCast(target, SPELL_TAIL_SWEEP);
                    TailSweepTimer = 15000;
                } else TailSweepTimer -= diff;

                if (SearingCindersTimer <= diff)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(target, SPELL_SEARING_CINDERS);
                    SearingCindersTimer = 10000;
                } else SearingCindersTimer -= diff;

                uint32 Prozent = uint32(me->GetHealthPct());

                if (Prozent < 75 && FlyCount == 0) // first take off 75%
                    TakeOff();

                if (Prozent < 50 && FlyCount == 1) // secound take off 50%
                    TakeOff();

                if (Prozent < 25 && FlyCount == 2) // third take off 25%
                    TakeOff();

                DoMeleeAttackIfReady();
            }

            //Phase 2 "FLYING FIGHT"
            if (Phase == 2)
//.........这里部分代码省略.........
开发者ID:Keader,项目名称:Sunwell,代码行数:101,代码来源:boss_nightbane.cpp

示例15: MovementInform

    void MovementInform(uint32 uiMoveType, uint32 uiPointId) override
    {
        if (uiMoveType != POINT_MOTION_TYPE)
            return;

        switch (uiPointId)
        {
            case PHASE_GROUND:
                m_creature->SetWalk(false);
                // ToDo: start WP movement here. Currently disabled because of some MMaps issues
                // m_creature->GetMotionMaster()->MoveWaypoint();
                break;
            case PHASE_AIR:
                // switch from ground transition to flight phase
                m_uiPhase = PHASE_AIR;
                break;
            case SUBPHASE_VAPOR:
                // After the third breath land and resume phase 1
                if (m_uiCorruptionCount == 3)
                {
                    m_uiPhase = PHASE_TRANSITION;
                    float fGroundZ = m_creature->GetMap()->GetHeight(m_creature->GetPhaseMask(), m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
                    m_creature->GetMotionMaster()->MovePoint(PHASE_TRANSITION, m_creature->getVictim()->GetPositionX(), m_creature->getVictim()->GetPositionY(), fGroundZ, false);
                    return;
                }

                // prepare to move to flight trigger
                ++m_uiCorruptionCount;
                m_uiCorruptionTimer = 5000;
                m_uiSubPhase = SUBPHASE_BREATH_PREPARE;
                break;
            case SUBPHASE_BREATH_PREPARE:
                // move across the arena
                if (!m_pInstance)
                    return;

                // Fly to the other side, casting the breath. Keep the same trigger index
                if (Creature* pTrigger = m_creature->GetMap()->GetCreature(m_pInstance->SelectFelmystFlightTrigger(!m_bIsLeftSide, m_uiCorruptionIndex)))
                {
                    DoScriptText(EMOTE_DEEP_BREATH, m_creature);
                    DoCastSpellIfCan(m_creature, SPELL_SPEED_BURST, CAST_TRIGGERED);
                    DoCastSpellIfCan(m_creature, SPELL_FOG_CORRUPTION, CAST_TRIGGERED);
                    m_creature->GetMotionMaster()->MovePoint(SUBPHASE_BREATH_MOVE, pTrigger->GetPositionX(), pTrigger->GetPositionY(), pTrigger->GetPositionZ(), false);
                }
                break;
            case SUBPHASE_BREATH_MOVE:
                if (!m_pInstance)
                    return;

                // remove speed aura
                m_creature->RemoveAurasDueToSpell(SPELL_SPEED_BURST);

                // Get to the flight trigger on the same side of the arena
                if (Creature* pTrigger = m_pInstance->GetSingleCreatureFromStorage(!m_bIsLeftSide ? NPC_FLIGHT_TRIGGER_LEFT : NPC_FLIGHT_TRIGGER_RIGHT))
                    m_creature->GetMotionMaster()->MovePoint(SUBPHASE_VAPOR, pTrigger->GetPositionX(), pTrigger->GetPositionY(), pTrigger->GetPositionZ(), false);

                // switch sides
                m_bIsLeftSide = !m_bIsLeftSide;
                break;
            case PHASE_TRANSITION:
                // switch back to ground combat from flight transition
                m_uiPhase = PHASE_GROUND;
                SetCombatMovement(true);
                m_creature->SetLevitate(false);
                DoStartMovement(m_creature->getVictim());
                break;
        }
    }
开发者ID:Phatcat,项目名称:mangos-wotlk,代码行数:68,代码来源:boss_felmyst.cpp


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