您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DoStartMovement函数代码示例

51自学网 2021-06-01 20:29:09
  C++
这篇教程C++ DoStartMovement函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例16: UpdateAI

    void UpdateAI(const uint32 diff)    {        if (isTeleported)        {            if (Teleport_Timer < diff)            {                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);                m_creature->GetMap()->CreatureRelocation(m_creature, LastX, LastY, LastZ, 0);                m_creature->SendMonsterMove(LastX, LastY, LastZ, 0, MONSTER_MOVE_NONE, 0);                DoStartMovement(m_creature->getVictim());                LastX = 0;                LastY = 0;                LastZ = 0;                isTeleported = false;                Teleport_Timer = 120000;            }else Teleport_Timer -= diff;            if (SecondPhase_Timer < diff)            {                switch (SecondPhaseCounter)                {                    case 0:                        for(uint8 i = 0; i < (m_bIsHeroicMode ? 4 : 2); i++)                            m_creature->SummonCreature(NPC_PLAGUED_CHAMPIONS,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000);                        break;                    case 1:                    case 2:                        for(uint8 i = 0; i < (m_bIsHeroicMode ? 4 : 2) - (m_bIsHeroicMode ? 2 : 1); i++)                            m_creature->SummonCreature(NPC_PLAGUED_CHAMPIONS,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000);                        for(uint8 i = 0; i < (m_bIsHeroicMode ? 2 : 1); i++)                            m_creature->SummonCreature(NPC_PLAGUED_GUARDIANS,2684.804,-3502.517,261.313,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,80000);                        break;                }                SecondPhaseCounter ++;                SecondPhase_Timer = 22000;            } else SecondPhase_Timer -= diff;            return;        }        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())            return;        //Blink_Timer        if (Blink_Timer < diff)        {            DoCast(m_creature->getVictim(), m_bIsHeroicMode ? SPELL_CRIPPLE_H : SPELL_CRIPPLE);            //DoCast(m_creature, SPELL_BLINK);            m_creature->GetMap()->CreatureRelocation(m_creature, 2670.804 + rand()%30, -3517.517 + rand()%30, 261.313, m_creature->GetOrientation());            DoResetThreat();            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))                AttackStart(pTarget);            Blink_Timer = 25000;        }else Blink_Timer -= diff;        //Curse_Timer        if (Curse_Timer < diff)        {            DoCast(m_creature->getVictim(),SPELL_CURSE_PLAGUEBRINGER);            Curse_Timer = 28000;        }else Curse_Timer -= diff;        //Summon_Timer        if (Summon_Timer < diff)        {            DoScriptText(SAY_SUMMON, m_creature);            for(uint8 i = 0; i < (m_bIsHeroicMode ? 3 : 2); ++i)                m_creature->SummonCreature(NPC_PLAGUED_WARRIOR, 2672.804 + rand()%15,-3509.517 + rand()%15, 261.313, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 80000);            Summon_Timer = 30000;        } else Summon_Timer -= diff;        if (Teleport_Timer < diff)        {            m_creature->InterruptNonMeleeSpells(true);            LastX = m_creature->GetPositionX();            LastY = m_creature->GetPositionY();            LastZ = m_creature->GetPositionZ();            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);            m_creature->StopMoving();            m_creature->GetMotionMaster()->Clear(false);            m_creature->GetMotionMaster()->MoveIdle();            m_creature->GetMap()->CreatureRelocation(m_creature, TELE_X, TELE_Y, TELE_Z, TELE_O);            m_creature->SendMonsterMove(TELE_X, TELE_Y, TELE_Z, TELE_O, MONSTER_MOVE_NONE, 0);            isTeleported = true;            SecondPhaseCounter = 0;            SecondPhase_Timer = 0;            Teleport_Timer = 70000;            return;        }else Teleport_Timer -= diff;        DoMeleeAttackIfReady();    }
开发者ID:Numnut,项目名称:mangos,代码行数:95,


示例17: UpdateAI

        void UpdateAI(uint32 const diff)        {            if (!UpdateVictim())                return;            events.Update(diff);            if (me->HasUnitState(UNIT_STATE_CASTING))                return;            while (uint32 eventId = events.ExecuteEvent())            {                switch (eventId)                {                case EVENT_STALACTITE:                    events.DelayEvents(20000);                    me->SetReactState(REACT_PASSIVE);                    me->SetUInt64Value(UNIT_FIELD_TARGET, 0);                    me->GetMotionMaster()->Clear();                    me->SetHover(true);                    me->SendMovementHover();                    me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);                    events.ScheduleEvent(EVENT_STALACTITE_CAST, 3000);                    events.ScheduleEvent(EVENT_STALACTITE_LAND, 13000);                    break;                case EVENT_STALACTITE_CAST:                    me->SetCanFly(true);                    me->SetDisableGravity(true);                    me->MonsterMoveWithSpeed(x,y,z + 10.0f, 0, false , false);                    me->AddAura(SPELL_STALACTITE, me);                    break;                case EVENT_STALACTITE_LAND:                    me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);                    me->SetHover(false);                    me->SendMovementHover();                    if (IsHeroic())                    {                        events.ScheduleEvent(EVENT_CRYSTAL_STORM, 4000);                        events.ScheduleEvent(EVENT_STALACTITE_LAND_END, 8000);                    }                    else                        events.ScheduleEvent(EVENT_STALACTITE_LAND_END, 1500);                    break;                case EVENT_STALACTITE_LAND_END:                    me->SetReactState(REACT_AGGRESSIVE);                    if (Unit * victim = me->GetVictim())                    {                        me->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());                        DoStartMovement(victim);                    }                    events.ScheduleEvent(EVENT_STALACTITE, urand(25000, 30000));                    break;                case EVENT_SAND_BLAST:                    DoCast(SPELL_SAND_BLAST);                    events.ScheduleEvent(EVENT_SAND_BLAST, urand(12000, 15000));                    break;                case EVENT_LAVA_FISSURE:                    {                        DoCastRandom(SPELL_LAVA_FISSURE, 0.0f);                        uint32 cd = IsHeroic() ? urand(5000, 7000) : urand(7000, 10000);                        events.ScheduleEvent(EVENT_LAVA_FISSURE, cd);                    }                    break;                case EVENT_CRYSTAL_STORM:                    if (Unit * victim = me->GetVictim())                        me->SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());                    DoCast(me, SPELL_CRYSTAL_STORM_REQ, true);                    DoCast(me, SPELL_CRYSTAL_STORM, false);                    break;                }            }            DoMeleeAttackIfReady();        }
开发者ID:Caydan,项目名称:DeathCore,代码行数:74,


示例18: UpdateAI

            void UpdateAI(uint32 const diff)            {                if (!UpdateVictim() || !CheckInRoom())                    return;                events.Update(diff);                if (me->HasUnitState(UNIT_STAT_CASTING))                    return;                while (uint32 eventId = events.ExecuteEvent())                {                    switch (eventId)                    {                        case EVENT_BONE_SPIKE_GRAVEYARD:                            if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM))                                DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD);                            events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL);                            break;                        case EVENT_COLDFLAME:                            _coldflameLastPos.Relocate(me);                            _coldflameTarget = 0LL;                            if (!me->HasAura(SPELL_BONE_STORM))                                DoCastAOE(SPELL_COLDFLAME_NORMAL);                            else                                DoCast(me, SPELL_COLDFLAME_BONE_STORM);                            events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL);                            break;                        case EVENT_WARN_BONE_STORM:                            _boneSlice = false;                            Talk(EMOTE_BONE_STORM);                            me->FinishSpell(CURRENT_MELEE_SPELL, false);                            DoCast(me, SPELL_BONE_STORM);                            events.DelayEvents(3000, EVENT_GROUP_SPECIAL);                            events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050);                            events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(90000, 95000));                            break;                        case EVENT_BONE_STORM_BEGIN:                            if (Aura* pStorm = me->GetAura(SPELL_BONE_STORM))                                pStorm->SetDuration(int32(_boneStormDuration));                            me->SetSpeed(MOVE_RUN, _baseSpeed*3.0f, true);                            Talk(SAY_BONE_STORM);                            events.ScheduleEvent(EVENT_BONE_STORM_END, _boneStormDuration+1);                            // no break here                        case EVENT_BONE_STORM_MOVE:                        {                            events.ScheduleEvent(EVENT_BONE_STORM_MOVE, _boneStormDuration/3);                            Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me));                            if (!unit)                                unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);                            if (unit)                                me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());                            break;                        }                        case EVENT_BONE_STORM_END:                            if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)                                me->GetMotionMaster()->MovementExpired();                            DoStartMovement(me->getVictim());                            me->SetSpeed(MOVE_RUN, _baseSpeed, true);                            events.CancelEvent(EVENT_BONE_STORM_MOVE);                            events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000);                            if (!IsHeroic())                                events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, urand(15000, 20000), EVENT_GROUP_SPECIAL);                            break;                        case EVENT_ENABLE_BONE_SLICE:                            _boneSlice = true;                            break;                        case EVENT_ENRAGE:                            DoCast(me, SPELL_BERSERK, true);                            Talk(SAY_BERSERK);                            break;                    }                }                // We should not melee attack when storming                if (me->HasAura(SPELL_BONE_STORM))                    return;                // 10 seconds since encounter start Bone Slice replaces melee attacks                if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL))                    DoCastVictim(SPELL_BONE_SLICE);                DoMeleeAttackIfReady();            }
开发者ID:aedansilver,项目名称:CzechFunCore,代码行数:84,


示例19: UpdateAI

            void UpdateAI(uint32 const diff)            {                if (!UpdateVictim() || !CheckInRoom())                    return;                events.Update(diff);                if (me->HasUnitState(UNIT_STATE_CASTING))                    return;                while (uint32 eventId = events.ExecuteEvent())                {                    switch (eventId)                    {                        case EVENT_CHECK_PLAYERS:                            instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TANK_MARKER);                            events.ScheduleEvent(EVENT_CHECK_PLAYERS, 2000);                            break;                        case EVENT_PREPARE_BONE_SPIKE_GRAVEYARD:                            events.CancelEvent(EVENT_CHECK_PLAYERS);                            break;                        case EVENT_BONE_SPIKE_GRAVEYARD:                            if (IsHeroic() || !me->HasAura(SPELL_BONE_STORM))                                DoCast(me, SPELL_BONE_SPIKE_GRAVEYARD);                            events.ScheduleEvent(EVENT_PREPARE_BONE_SPIKE_GRAVEYARD, 12000, EVENT_GROUP_SPECIAL);                            events.ScheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 18000, EVENT_GROUP_SPECIAL);                            events.ScheduleEvent(EVENT_CHECK_PLAYERS, 4000);                            break;                        case EVENT_COLDFLAME:                            _coldflameLastPos.Relocate(me);                            _coldflameTarget = 0LL;                            if (!me->HasAura(SPELL_BONE_STORM))                                DoCastAOE(SPELL_COLDFLAME_NORMAL);                            else                                DoCast(me, SPELL_COLDFLAME_BONE_STORM);                            events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL);                            break;                        case EVENT_WARN_BONE_STORM:                            _boneSlice = false;                            Talk(EMOTE_BONE_STORM);                            me->FinishSpell(CURRENT_MELEE_SPELL, false);                            DoCast(me, SPELL_BONE_STORM);                            events.DelayEvents(3000, EVENT_GROUP_SPECIAL);                            me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);                            me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);                            events.ScheduleEvent(EVENT_BONE_STORM_BEGIN, 3050);                            events.ScheduleEvent(EVENT_WARN_BONE_STORM, 90000);                            break;                        case EVENT_BONE_STORM_BEGIN:                            if (AuraPtr pStorm = me->GetAura(SPELL_BONE_STORM))                                pStorm->SetDuration(int32(_boneStormDuration));                            me->SetSpeed(MOVE_RUN, _baseSpeed*3.0f, true);                            Talk(SAY_BONE_STORM);                            events.ScheduleEvent(EVENT_BONE_STORM_END, _boneStormDuration+1);                            // no break here                        case EVENT_BONE_STORM_MOVE:                        {                            events.ScheduleEvent(EVENT_BONE_STORM_MOVE, IsHeroic() ? _boneStormDuration/5 : _boneStormDuration/4);                            Unit* unit = SelectTarget(SELECT_TARGET_FARTHEST, 0, 60.0f);                            if (!unit || unit->isPet() || unit->isTotem() || !me->IsWithinLOSInMap(unit))                                unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);                            if (unit)                                if (unit->isPet() || unit->isTotem() || !me->IsWithinLOSInMap(unit))                                    unit = SelectTarget(SELECT_TARGET_RANDOM, 1);                                else                                     me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());                            break;                        }                        case EVENT_BONE_STORM_END:                            if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)                                me->GetMotionMaster()->MovementExpired();                            me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false);                            me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false);                            DoStartMovement(me->getVictim());                            me->SetSpeed(MOVE_RUN, _baseSpeed, true);                            events.CancelEvent(EVENT_BONE_STORM_MOVE);                            events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000);                            if (!IsHeroic())                                events.RescheduleEvent(EVENT_BONE_SPIKE_GRAVEYARD, 15000, EVENT_GROUP_SPECIAL);                            break;                        case EVENT_ENABLE_BONE_SLICE:                            _boneSlice = true;                            break;                        case EVENT_BERSERK:                            DoCast(me, SPELL_BERSERK, true);                            Talk(SAY_BERSERK);                            break;                    }                }                // We should not melee attack when storming                if (me->HasAura(SPELL_BONE_STORM))                    return;                // 10 seconds since encounter start Bone Slice replaces melee attacks                if (_boneSlice && !me->GetCurrentSpell(CURRENT_MELEE_SPELL))                    DoCastVictim(SPELL_BONE_SLICE);                DoMeleeAttackIfReady();            }
开发者ID:Cailiaock,项目名称:5.4.7-Wow-source,代码行数:100,


示例20: UpdateAI

        void UpdateAI(const uint32 diff)        {            if (Phase == NORMAL)            {                if (!bMove && uiMoveTimer > diff)                {                    uiMoveTimer -= diff;                    return;                }                else if (!bMove)                {                    DoStartMovement(me->getVictim());                    pSacrificeTarget = NULL;                    bMove = true;                }                //Return since we have no target                if (!UpdateVictim())                    return;                if (uiSinsterStrikeTimer <= diff)                {                    DoCast(me->getVictim(), DUNGEON_MODE(SPELL_SINISTER_STRIKE, H_SPELL_SINISTER_STRIKE));                    uiSinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS);                } else uiSinsterStrikeTimer -= diff;                if (uiCallFlamesTimer <= diff) //move to send event scripts?                {                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))                    {                        if (!bFlames)                    {                        DoCast(target, SPELL_CALL_FLAMES);                            bFlames = true;                        }                        if (uiFlamesCount < 3)                        {                            if (Creature* pBrazier = Creature::GetCreature(*me, RAND(uiFlameBrazier_1, uiFlameBrazier_2)))                            {                                if (IsHeroic())   // find correct spell                                {                                    int dmg = 3825 + rand()%1350;                                    pBrazier->CastCustomSpell(pBrazier, SPELL_BALL_OF_FLAME, &dmg, 0, 0, true);                                }                                else                                    pBrazier->CastSpell(pBrazier, SPELL_BALL_OF_FLAME, true);                            }                            uiCallFlamesTimer = 1*IN_MILLISECONDS;                            ++uiFlamesCount;                        }                        else                        {                            bFlames = false;                        uiCallFlamesTimer = urand(8 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);                            uiFlamesCount = 0;                        }                    }                } else uiCallFlamesTimer -= diff;                if ((me->GetHealth()*100 / me->GetMaxHealth()) < (100-(25*uiHealthAmountModifier)))                    {                    ++uiHealthAmountModifier;                    pSacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);                    if (pSacrificeTarget)                        {                            DoScriptText(RAND(SAY_SACRIFICE_PLAYER_1, SAY_SACRIFICE_PLAYER_2, SAY_SACRIFICE_PLAYER_3, SAY_SACRIFICE_PLAYER_4, SAY_SACRIFICE_PLAYER_5), me);                        me->GetMotionMaster()->Clear();                            DoCast(pSacrificeTarget, SPELL_RITUAL_OF_THE_SWORD);                            DoTeleportPlayer(pSacrificeTarget, 296.632f, -346.075f, 90.63f, 4.6f);                            Phase = SACRIFICING;                                for (uint8 i = 0; i < 3; ++i)                            if (Creature* pRitualChanneler = me->SummonCreature(CREATURE_RITUAL_CHANNELER, RitualChannelerPos[i], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 100*HOUR))                                if (pRitualChanneler->AI())                                    pRitualChanneler->AI()->SetGUID(pSacrificeTarget->GetGUID());                    }                }                DoMeleeAttackIfReady();            }            else  //SACRIFICING            {                if (uiSacrificeTimer <= diff)                {                    Creature* target = Creature::GetCreature(*me, uiRitualTarget);                    if (target)                    {                        DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true);                        DoCast(me, SPELL_RITUAL_OF_THE_SWORD_DISARM, true);                    }                    bMove = false;                    Phase = NORMAL;                    uiMoveTimer = 23*IN_MILLISECONDS;                    uiSacrificeTimer = 2*IN_MILLISECONDS;                    uiSinsterStrikeTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);                    uiCallFlamesTimer = urand(13*IN_MILLISECONDS, 18*IN_MILLISECONDS);                }                else uiSacrificeTimer -= diff;            }//.........这里部分代码省略.........
开发者ID:PaladMaster,项目名称:ArkCORE,代码行数:101,


示例21: UpdateAI

    void UpdateAI(const uint32 uiDiff)    {        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())            return;        // Start drinking when below 20% mana        if (!m_bIsDrinking && m_creature->getPowerType() == POWER_MANA && (m_creature->GetPower(POWER_MANA) * 100 / m_creature->GetMaxPower(POWER_MANA)) < 20)        {            if (DoCastSpellIfCan(m_creature, SPELL_MASS_POLYMORPH) == CAST_OK)            {                DoScriptText(SAY_DRINK, m_creature);                SetCombatMovement(false);                m_creature->GetMotionMaster()->MoveIdle();                m_uiManaRecoveryStage = 0;                m_uiManaRecoveryTimer = 2000;                m_bDrinkInturrupted   = false;                m_bIsDrinking = true;                return;            }        }        if (m_bIsDrinking)        {            // Do the mana recovery process            if (m_uiManaRecoveryTimer < uiDiff)            {                switch (m_uiManaRecoveryStage)                {                    case 0:                        if (DoCastSpellIfCan(m_creature, SPELL_CONJURE_WATER) == CAST_OK)                            m_uiManaRecoveryTimer = 2000;                        break;                    case 1:                        if (DoCastSpellIfCan(m_creature, SPELL_DRINK) == CAST_OK)                        {                            m_creature->SetStandState(UNIT_STAND_STATE_SIT);                            m_uiManaRecoveryTimer = 5000;                        }                        break;                    case 2:                        if (DoCastSpellIfCan(m_creature, SPELL_PYROBLAST) == CAST_OK)                        {                            SetCombatMovement(true);                            DoStartMovement(m_creature->getVictim());                            m_creature->SetStandState(UNIT_STAND_STATE_STAND);                            m_uiManaRecoveryTimer = 2000;                            m_bIsDrinking = false;                        }                        break;                }                ++m_uiManaRecoveryStage;            }            else                m_uiManaRecoveryTimer -= uiDiff;            // no other spells during mana recovery            return;        }        // Normal spell casts        if (m_uiNormalCastTimer < uiDiff)        {            if (!m_creature->IsNonMeleeSpellCasted(false))            {                Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0);                if (!pTarget)                    return;                uint8 uiCurrentSpell = urand(0, 2);                uint32 uiCurrentSpellId = 0;                // randomize so it won't be the same spell twice in a row                while (uiCurrentSpell == m_uiLastNormalSpell)                    uiCurrentSpell = urand(0, 2);                m_uiLastNormalSpell = uiCurrentSpell;                switch (uiCurrentSpell)                {                    case 0:                        uiCurrentSpellId = SPELL_ARCANE_MISSILES;                        m_uiNormalCastTimer = urand(6000, 7000);                        break;                    case 1:                        uiCurrentSpellId = SPELL_FIREBALL;                        m_uiNormalCastTimer = urand(2000, 3000);                        break;                    case 2:                        uiCurrentSpellId = SPELL_FROSTBOLT;                        m_uiNormalCastTimer = urand(2000, 3000);                        break;                }                if (uiCurrentSpellId)                    DoCastSpellIfCan(pTarget, uiCurrentSpellId);            }        }        else//.........这里部分代码省略.........
开发者ID:Naincapable,项目名称:scriptdev2,代码行数:101,


示例22: UpdateAI

            void UpdateAI(const uint32 uiDiff)            {                if(m_uiPhase == 1)                    DoStartNoMovement(me->getVictim());                else if(m_uiPhase == 2)                    DoStartMovement(me->getVictim());                if (m_uiIntroTimer <= uiDiff && bIntro && m_uiIntroPhase < 7)                {                    switch (m_uiIntroPhase)                    {                        case 1: DoScriptText(SAY_INTRO_2, me); m_uiIntroTimer = 10000; break;                        case 2: DoScriptText(SAY_INTRO_3, me); m_uiIntroTimer = 7000;  break;                        case 3: DoScriptText(SAY_INTRO_4, me); m_uiIntroTimer = 12000; break;                        case 4: DoScriptText(SAY_INTRO_5, me); m_uiIntroTimer = 7000;  break;                        case 5: DoScriptText(SAY_INTRO_6, me); m_uiIntroTimer = 11000; break;                        case 6: DoScriptText(SAY_INTRO_7, me); m_uiIntroTimer = 20000; break;                    }                    ++m_uiIntroPhase;                } else m_uiIntroTimer -= uiDiff;                if (!UpdateVictim())                    return;                if (m_uiBerserkTimer < uiDiff)                {                    DoCast(me, SPELL_BERSERK);                    DoScriptText(SAY_BERSERK, me);                    m_uiBerserkTimer = 600000;                } else m_uiBerserkTimer -= uiDiff;                if (m_uiCultTimer < uiDiff)                {                    EmpowerCultist();                    m_uiCultTimer = urand(20000, 23000);                } else m_uiCultTimer -= uiDiff;                if (m_uiDeathandDecayTimer < uiDiff)                {                    if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))                        DoCast(pTarget, SPELL_DEATH_AND_DECAY);                    m_uiDeathandDecayTimer = 11000;                } else m_uiDeathandDecayTimer -= uiDiff;                if (m_uiDominateMindTimer < uiDiff)                {                    for (uint8 i = 1; i <= RAID_MODE(0,1,1,3); ++i)                    {                        if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true, -SPELL_DOMINATE_MIND))                            DoCast(pTarget, SPELL_DOMINATE_MIND);                    }                    DoScriptText(SAY_DOMINATE_MIND, me);                    m_uiDominateMindTimer = 15000;                } else m_uiDominateMindTimer -= uiDiff;                if (m_uiPhase == 1)                {                    if (m_uiShadowBoltTimer < uiDiff)                    {                        if(Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))                            DoCast(pTarget, SPELL_SHADOW_BOLT);                        m_uiShadowBoltTimer = 6000;                    } else m_uiShadowBoltTimer -= uiDiff;                    if (m_uiSummonWaveTimer < uiDiff)                    {                        if (Difficulty() == RAID_DIFFICULTY_10MAN_NORMAL || Difficulty() == RAID_DIFFICULTY_10MAN_HEROIC)                            RandomSpawn();                        else                        {                            DoSummon(CREATURE_FANATIC, SpawnLoc[0]);                            DoSummon(CREATURE_ADHERENT, SpawnLoc[1]);                            DoSummon(CREATURE_FANATIC, SpawnLoc[2]);                            DoSummon(CREATURE_ADHERENT, SpawnLoc[3]);                            DoSummon(CREATURE_FANATIC, SpawnLoc[4]);                            DoSummon(CREATURE_ADHERENT, SpawnLoc[5]);                            DoSummon(RAND(CREATURE_FANATIC,CREATURE_ADHERENT), SpawnLoc[6]);                        }                        bFirstSummon = false ? true : true;                        m_uiSummonWaveTimer = !bFirstSummon ? 10000 : 60000;                    } else m_uiSummonWaveTimer -= uiDiff;                }                if (m_uiPhase == 2)                {                    if (m_uiFrostBoltTimer < uiDiff)                    {                        DoCast(me->getVictim(), SPELL_FROST_BOLT);                        m_uiFrostBoltTimer = 10000;                    } else m_uiFrostBoltTimer -= uiDiff;                    if (m_uiFrostValleyTimer < uiDiff)                    {                        DoCast(SPELL_FROST_BOLT_VALLEY);                        m_uiFrostValleyTimer = 19000;                    } else m_uiFrostValleyTimer -= uiDiff;                    if (m_uiInsignificanceTimer < uiDiff)                    {                        DoCast(me->getVictim(), SPELL_INSIGNIFICANCE);//.........这里部分代码省略.........
开发者ID:ice74,项目名称:blizzwow,代码行数:101,


示例23: UpdateAI

    void UpdateAI(const uint32 diff)    {        if (!UpdateVictim())            return;        if (((me->GetHealth()*100 / me->GetMaxHealth()) < 60) && (Phase == 1))        {            Phase = 2;            me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);            me->AddUnitMovementFlag(MOVEFLAG_LEVITATING | MOVEFLAG_ONTRANSPORT);            me->SetHover(true);            me->GetMotionMaster()->Clear(false);            me->GetMotionMaster()->MoveIdle();            DoScriptText(SAY_PHASE_2_TRANS, me);        }        if (((me->GetHealth()*100 / me->GetMaxHealth()) < 40) && (Phase == 2))        {            Phase = 3;            me->RemoveUnitMovementFlag(MOVEFLAG_LEVITATING | MOVEFLAG_ONTRANSPORT);            me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);            me->SetHover(false);            me->GetMotionMaster()->MovePoint(0, -10.6155f, -219.357f, -87.7344f);            DoStartMovement(me->getVictim());            me->RemoveUnitMovementFlag(MOVEFLAG_WALK_MODE);            DoScriptText(SAY_PHASE_3_TRANS, me);        }        if (Phase == 1 || Phase == 3)        {            if (FlameBreathTimer <= diff)            {                DoCast(me->getVictim(), SPELL_FLAMEBREATH);                FlameBreathTimer = 15000;            } else FlameBreathTimer -= diff;            if (TailSweepTimer <= diff)            {                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);                if (pTarget && !me->HasInArc(M_PI, pTarget))                    DoCast(pTarget, SPELL_TAILSWEEP);                TailSweepTimer = 10000;            } else TailSweepTimer -= diff;            if (CleaveTimer <= diff)            {                DoCast(me->getVictim(), SPELL_CLEAVE);                CleaveTimer = 10000;            } else CleaveTimer -= diff;            if (WingBuffetTimer <= diff)            {                DoCast(me->getVictim(), SPELL_WINGBUFFET);                WingBuffetTimer = 7000 + ((rand()%8)*1000);            } else WingBuffetTimer -= diff;            if (KnockAwayTimer <= diff)            {                if (rand() <= 30)                {                    DoCast(me->getVictim(), SPELL_KNOCK_AWAY);                }                KnockAwayTimer = 15000;            } else KnockAwayTimer -= diff;            if (Phase == 3)            {                if (BellowingRoarTimer <= diff)                {                    DoCast(me->getVictim(), SPELL_BELLOWINGROAR);                    BellowingRoarTimer = 30000;                } else BellowingRoarTimer -= diff;                if (SummonWhelpsTimer <= diff)                {                    SummonWhelps(Phase);                    SummonWhelpsTimer = 45000;                } else SummonWhelpsTimer -= diff;            }            DoMeleeAttackIfReady();        }        if (Phase == 2)        {            if (InitialSpawn)            {                InitialSpawn = false;                for (uint32 i = 0; i < 10; ++i)                {                    uint32 random = rand()%4;                    Creature* Whelp = me->SummonCreature(CREATURE_WHELP, SpawnLocations[random][0], SpawnLocations[random][1], SpawnLocations[random][2], 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 30000);                    if (Whelp)                        Whelp->AI()->AttackStart(SelectUnit(SELECT_TARGET_RANDOM, 0));                }            }//.........这里部分代码省略.........
开发者ID:Suwai,项目名称:SunfireCore,代码行数:101,


示例24: UpdateAI

    void UpdateAI(const uint32 diff)    {        if (!UpdateVictim())        {            if (UnsummonCheck <= diff && me->isAlive())            {                me->SetLootRecipient(NULL);                me->SetVisibility(VISIBILITY_OFF);                me->DealDamage(me, me->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);                me->RemoveCorpse();            } else UnsummonCheck -= diff;            return;        }        if (Fireball_Timer <= diff)        {            if (Unit *victim = SelectUnit(SELECT_TARGET_RANDOM, 0))                DoCast(victim, SPELL_FIREBALL, true);            Fireball_Timer = 4000+rand()%3000;        } else Fireball_Timer -= diff;        if (flight) // phase 1 - the flight        {            Creature *Vazruden = Unit::GetCreature(*me, VazrudenGUID);            if (Fly_Timer <= diff || !(Vazruden && Vazruden->isAlive() && (Vazruden->GetHealth()*5 > Vazruden->GetMaxHealth())))            {                flight = false;                BellowingRoar_Timer = 6000;                ConeOfFire_Timer = 12000;                me->RemoveUnitMovementFlag(MOVEFLAG_ONTRANSPORT | MOVEFLAG_LEVITATING);                me->AddUnitMovementFlag(MOVEFLAG_WALK_MODE);                me->GetMotionMaster()->Clear();                if (Unit *victim = SelectUnit(SELECT_TARGET_NEAREST, 0))                    me->AI()->AttackStart(victim);                DoStartMovement(me->getVictim());                DoScriptText(EMOTE, me);                return;            } else Fly_Timer -= diff;            if (Turn_Timer <= diff)            {                uint32 waypoint = (Fly_Timer/10000)%2;                if (me->GetDistance(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 (HeroicMode && BellowingRoar_Timer <= diff)            {                DoCast(me, SPELL_BELLOWING_ROAR);                BellowingRoar_Timer = 45000;            } else BellowingRoar_Timer -= diff;            DoMeleeAttackIfReady();        }    }
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:65,


示例25: UpdateAI

//.........这里部分代码省略.........                Netherburn_timer = 5000;            }else Netherburn_timer -= diff;             if(Voidzone_timer < diff && !BanishPhase) {                //function for spawning the Void Zones around the position of Netherspite                voidZones_random = rand()%4;                                 float fTmp1 = (rand()%2==0) ? -1 : 1;                                float fTmp2 = (rand()%2==0) ? -1 : 1;                                 ZoneCoords[0]= m_creature->GetPositionX() + 5*fTmp1 + rand()%10;                                ZoneCoords[1]= m_creature->GetPositionY() + 5*fTmp2 + rand()%10;                 /*switch(voidZones_random) {                case 0 :                    ZoneCoords[0]= m_creature->GetPositionX() +  5 + rand()%10;                    ZoneCoords[1]= m_creature->GetPositionY() +  5 + rand()%10;                    break;                 case 1:                    ZoneCoords[0]= m_creature->GetPositionX() +  5 + rand()%10;                    ZoneCoords[1]= m_creature->GetPositionY() - (5 + rand()%10);                    break;                 case 2:                    ZoneCoords[0]= m_creature->GetPositionX() - (5 + rand()%10);                    ZoneCoords[1]= m_creature->GetPositionY() +  5 + rand()%10;                    break;                 case 3:                    ZoneCoords[0]= m_creature->GetPositionX() - (5 + rand()%10);                    ZoneCoords[1]= m_creature->GetPositionY() - (5 + rand()%10);                    break;                } */                                                                Creature* uVoidZone = m_creature->SummonCreature(CREATURE_VOID_ZONE, ZoneCoords[0], ZoneCoords[1], m_creature->GetPositionZ() , 0 , TEMPSUMMON_CORPSE_DESPAWN, 0);                              if(uVoidZone)                    VoidZone[voidZones_counter++] = uVoidZone->GetGUID();                if(voidZones_counter >= 6)                   voidZones_counter=0;                            // use this, when the spell is fixed (you've to overwork this then):                /* Unit* Zonetarget = SelectUnit(SELECT_TARGET_RANDOM,0);       // No longer necessary                if(Zonetarget)                    ZonetargetGUID = Zonetarget->GetGUID();                     Zonetarget = Unit::GetUnit((*m_creature), ZonetargetGUID);                 if(Zonetarget->IsHostileTo(m_creature))                    DoCast(Zonetarget,SPELL_VOIDZONE); */                     Voidzone_timer = 15000;                             }else Voidzone_timer -= diff;        }            if(BanishPhase) {            if(BanishPhase_timer < diff) {                m_creature->RemoveAura(SPELL_BANISH_VISUAL,0);                PortalPhase = true;                BanishPhase = false;                PortalsSpawned = false;                PLRonRedBeam = false;                BanishPhase_timer = 30000;                DoResetThreat();                (*m_creature).GetMotionMaster()->MoveChase(m_creature->getVictim());                DoScriptText(EMOTE_PHASE_BANISH, m_creature);            }else BanishPhase_timer -= diff;             if(Netherbreath_timer < diff) {                if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))                    DoCast(target, SPELL_NETHERBREATH);                Netherbreath_timer = 2500;            }else Netherbreath_timer -= diff;        }         if(!PLRonRedBeam) {            DoMeleeAttackIfReady();                } else {                        Unit* uTmp = Unit::GetUnit(*m_creature,CandidatesGUID[2]);                        //if(uTmp && uTmp->IsHostileTo(m_creature))                                //DoStartAttackAndMovement(uTmp); /* after rev. 698: DoStartMovement() */                        if (m_creature->Attack(uTmp, true))                        {                                m_creature->AddThreat(uTmp, 0.0f);                                m_creature->SetInCombatWith(uTmp);                                uTmp->SetInCombatWith(m_creature);                                 if (!InCombat)                                {                                        InCombat = true;                                        Aggro(uTmp);                                }                                 DoStartMovement(uTmp);                        }        }    }
开发者ID:RareSoul,项目名称:andeeria,代码行数:101,



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


C++ DoStartNoMovement函数代码示例
C++ DoSpellAttackIfReady函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。