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


C++ DoMeleeAttackIfReady函数代码示例

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


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

示例1: UpdateEscortAI


//.........这里部分代码省略.........
                            DoScriptText(SAY_BLASTMASTER_3, me);
                            NextStep(3000, true);
                            break;
                        case 5:
                            DoScriptText(SAY_BLASTMASTER_4, me);
                            NextStep(3000, true);
                            break;
                        case 6:
                            SetInFace(true);
                            DoScriptText(SAY_BLASTMASTER_5, me);
                            Summon(1);
                            if (pInstance)
                                if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
                                    pInstance->HandleGameObject(NULL, true, pGo);
                            NextStep(3000, true);
                            break;
                        case 7:
                            DoScriptText(SAY_BLASTMASTER_6, me);
                            SetEscortPaused(false);
                            NextStep(0, false, 0);
                            break;
                        case 8:
                            me->HandleEmoteCommand(EMOTE_STATE_WORK);
                            NextStep(25000, true);
                            break;
                        case 9:
                            Summon(2);
                            NextStep(0, false);
                            break;
                        case 10:
                            Summon(4);
                            NextStep(0, false);
                            break;
                        case 11:
                            DoScriptText(SAY_BLASTMASTER_17, me);
                            NextStep(5000, true);
                            break;
                        case 12:
                            DoScriptText(SAY_BLASTMASTER_18, me);
                            NextStep(5000, true);
                            break;
                        case 13:
                            DoScriptText(SAY_BLASTMASTER_20, me);
                            CaveDestruction(true);
                            NextStep(8000, true);
                            break;
                        case 14:
                            DoScriptText(SAY_BLASTMASTER_21, me);
                            NextStep(8500, true);
                            break;
                        case 15:
                            DoScriptText(SAY_BLASTMASTER_22, me);
                            NextStep(2000, true);
                            break;
                        case 16:
                            DoScriptText(SAY_BLASTMASTER_23, me);
                            SetInFace(false);
                            if (pInstance)
                                if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
                                    pInstance->HandleGameObject(NULL, true, pGo);
                            NextStep(2000, true);
                            break;
                        case 17:
                            SetEscortPaused(false);
                            DoScriptText(SAY_BLASTMASTER_24, me);
                            Summon(6);
                            NextStep(0, false);
                            break;
                        case 18:
                            Summon(7);
                            NextStep(0, false);
                            break;
                        case 19:
                            SetInFace(false);
                            Summon(8);
                            DoScriptText(SAY_BLASTMASTER_25, me);
                            NextStep(0, false);
                            break;
                        case 20:
                            DoScriptText(SAY_BLASTMASTER_27, me);
                            NextStep(2000, true);
                            break;
                        case 21:
                            Summon(9);
                            NextStep(0, false);
                            break;
                        case 22:
                            CaveDestruction(false);
                            DoScriptText(SAY_BLASTMASTER_20, me);
                            NextStep(0, false);
                            break;
                    }
                } else uiTimer -= uiDiff;
            }

            if (!UpdateVictim())
                return;

            DoMeleeAttackIfReady();
        }
开发者ID:XEQT,项目名称:SkyFireEMU,代码行数:101,代码来源:gnomeregan.cpp

示例2: UpdateAI

    void UpdateAI(const uint32 uiDiff)
    {
        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
        {
            if (m_uiEquipTimer)
            {
                // decrease the cooldown in between equipment change phases
                if (m_uiEquipTimer > uiDiff)
                {
                    m_uiEquipTimer -= uiDiff;
                    return;
                }
                else
                    m_uiEquipTimer = 0;
            }

            switch(m_uiPhase)
            {
            case PHASE_EQUIP_START:
                PhaseEquipStart();
                break;
            case PHASE_EQUIP_PROCESS:
                PhaseEquipProcess();
                break;
            case PHASE_EQUIP_END:
                PhaseEquipEnd();
                break;
            }

            return;
        }

        // the normal combat phases
        switch(m_uiPhase)
        {
        case PHASE_1:
        {
            if (m_creature->GetHealthPercent() < 66.0f)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP) == CAST_OK)
                {
                    DoScriptText(SAY_PHASE_2, m_creature);
                    m_uiPhase = PHASE_EQUIP_START;
                    m_uiEquipTimer = 2500;

                    // will clear getVictim (m_attacking)
                    m_creature->AttackStop(true);
                    m_creature->RemoveAurasDueToSpell(SPELL_NIBLE_REFLEXES);
                }
                return;
            }
            break;
        }
        case PHASE_2:
        {
            if (m_creature->GetHealthPercent() < 33.0f)
            {
                if (DoCastSpellIfCan(m_creature, SPELL_SMITE_STOMP) == CAST_OK)
                {
                    DoScriptText(SAY_PHASE_3, m_creature);
                    m_uiPhase = PHASE_EQUIP_START;
                    m_uiEquipTimer = 2500;

                    m_creature->AttackStop(true);
                    m_creature->RemoveAurasDueToSpell(SPELL_THRASH);
                }
                return;
            }
            break;
        }
        case PHASE_3:
        {
            if (m_uiSlamTimer < uiDiff)
            {
                if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE_SLAM) == CAST_OK)
                    m_uiSlamTimer = 11000;
            }
            else
                m_uiSlamTimer -= uiDiff;

            break;
        }
        }

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

示例3: UpdateAllies

void PetAI::UpdateAI(uint32 diff)
{
    if (!me->isAlive() || !me->GetCharmInfo())
        return;

    Unit* owner = me->GetCharmerOrOwner();

    if (m_updateAlliesTimer <= diff)
        // UpdateAllies self set update timer
        UpdateAllies();
    else
        m_updateAlliesTimer -= diff;

    if (me->getVictim() && me->getVictim()->isAlive())
    {
        // is only necessary to stop casting, the pet must not exit combat
        if (me->getVictim()->HasBreakableByDamageCrowdControlAura(me))
        {
            me->InterruptNonMeleeSpells(false);
            return;
        }

        if (_needToStop())
        {
            sLog->outDebug(LOG_FILTER_GENERAL, "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
            _stopAttack();
            return;
        }

        // Check before attacking to prevent pets from leaving stay position
        if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
        {
            if (me->GetCharmInfo()->IsCommandAttack() || (me->GetCharmInfo()->IsAtStay() && me->IsWithinMeleeRange(me->getVictim())))
                DoMeleeAttackIfReady();
        }
        else
            DoMeleeAttackIfReady();
    }
    else
    {
        if (me->HasReactState(REACT_AGGRESSIVE) || me->GetCharmInfo()->IsAtStay())
        {
            // Every update we need to check targets only in certain cases
            // Aggressive - Allow auto select if owner or pet don't have a target
            // Stay - Only pick from pet or owner targets / attackers so targets won't run by
            //   while chasing our owner. Don't do auto select.
            // All other cases (ie: defensive) - Targets are assigned by AttackedBy(), OwnerAttackedBy(), OwnerAttacked(), etc.
            Unit* nextTarget = SelectNextTarget(me->HasReactState(REACT_AGGRESSIVE));

            if (nextTarget)
                AttackStart(nextTarget);
            else
                HandleReturnMovement();
        }
        else
            HandleReturnMovement();
    }

    // Autocast (casted only in combat or persistent spells in any state)
    if (!me->HasUnitState(UNIT_STATE_CASTING))
    {
        typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
        TargetSpellList targetSpellStore;

        for (uint8 i = 0; i < me->GetPetAutoSpellSize(); ++i)
        {
            uint32 spellID = me->GetPetAutoSpellOnPos(i);
            if (!spellID)
                continue;

            SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
            if (!spellInfo)
                continue;

            if (me->GetCharmInfo() && me->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
                continue;

            if (spellInfo->IsPositive())
            {
                if (spellInfo->CanBeUsedInCombat())
                {
                    // check spell cooldown
                    if (me->HasSpellCooldown(spellInfo->Id))
                        continue;

                    // Check if we're in combat or commanded to attack
                    if (!me->isInCombat() && !me->GetCharmInfo()->IsCommandAttack())
                        continue;
                }

                Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
                bool spellUsed = false;

                // Some spells can target enemy or friendly (DK Ghoul's Leap)
                // Check for enemy first (pet then owner)
                Unit* target = me->getAttackerForHelper();
                if (!target && owner)
                    target = owner->getAttackerForHelper();

                if (target)
//.........这里部分代码省略.........
开发者ID:Arphenion-Dev,项目名称:Source,代码行数:101,代码来源:PetAI.cpp

示例4: UpdateAI

        void UpdateAI(uint32 diff)
        {
            m_events.Update(diff);
            while (uint32 eventId = m_events.ExecuteEvent())
            {
                switch (eventId)
                {
                case 1:
                {
                    // if (GameObject* door = ObjectAccessor::GetGameObject(*me, m_instance->GetData64(DATA_FACTORY_DOOR)))
                    // door->UseDoorOrButton();

                    

                    m_events.ScheduleEvent(1, 10000);
                    break;
                }
                }
            }

            if (!UpdateVictim())
                return;

            if (phase == 1)
            {
                if (SpellTimer <= diff)
                {
                    switch (urand(0, 1))
                    {
                    case 0:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            DoCast(me, SPELL_FIST_OF_FLAME);
                        Talk(SAY_FISTS_OF_FLAME);
                        break;

                    case 1:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                            DoCast(me, SPELL_FIST_OF_FROST);
                        Talk(SAY_FISTS_OF_FROST);
                        break;
                    }

                    SpellTimer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
                }
                else SpellTimer -= diff;

                if (HealthBelowPct(50))
                {
                    phase = 2;
                    DoCast(me, SPELL_ARCANE_POWER);
                    Talk(SAY_ARCANE_POWER);
                }

                DoMeleeAttackIfReady();
            }
            else
            {
                if (SpellTimer <= diff)
                {
                    DoCast(me, urand(1, 2) == 1 ? SPELL_FROST_BLOSSOM : SPELL_FIRE_BLOSSOM);
                    SpellTimer = urand(10 * IN_MILLISECONDS, 25 * IN_MILLISECONDS);
                }
                else SpellTimer -= diff;
            }

            if (PhaseChangeTimer <= diff && Phase == PHASE_NORMAL)
            {
                if (PhaseChangeTimer <= diff)
                {
                    me->SetReactState(REACT_AGGRESSIVE);
                    elemental_fists = 20000;
                    blinkTimer = 12000;
                    Phase = PHASE_NORMAL;
                }
                else PhaseChangeTimer -= diff;

                if (elemental_fists <= diff && Phase == PHASE_NORMAL)
                {
                    if (elemental_fists <= diff)
                    {
                        DoCast(me, elemental_fists);
                        me->MonsterYell(SAY_FLAME, LANG_UNIVERSAL, NULL);
                        elemental_fists = 20000;
                    }
                    else elemental_fists -= diff;
                }

                if (blinkTimer <= diff && Phase == PHASE_NORMAL)
                {
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 10.0f, true))
                        DoCast(me, SPELL_BLINK);
                    blinkTimer = 12000;
                }
                else blinkTimer -= diff;

                DoMeleeAttackIfReady();
            }
        }
开发者ID:Arkania,项目名称:ArkCORE-NG,代码行数:98,代码来源:boss_glubtok.cpp

示例5: UpdateAI


//.........这里部分代码省略.........
                        ResetTimer = 10000;
                        bJustReset = false;
                    } else ResetTimer -= diff;
                    return;
                }
                if (!UpdateVictim())
                    return;

                if (CheckTimer <= diff)
                {
                    if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75)
                    {
                        me->AI()->EnterEvadeMode();
                        return;
                    }
                    if (HealthBelowPct(10) && !isEnraged)
                    {
                        if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
                            Sath->AI()->DoAction(DO_ENRAGE);
                        DoAction(DO_ENRAGE);
                    }
                    if (!isBanished && HealthBelowPct(1))
                    {
                        if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
                        {
                            if (Sath->HasAura(SPELL_BANISH))
                            {
                                Sath->DealDamage(Sath, Sath->GetHealth());
                                return;
                            }
                            else
                                DoAction(DO_BANISH);
                        }
                        else
                        {
                            sLog->outError(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted.");
                            EnterEvadeMode();
                            return;
                        }
                    }
                    CheckTimer = 1000;
                } else CheckTimer -= diff;

                if (ArcaneBuffetTimer <= diff)
                {
                    DoCastAOE(SPELL_ARCANE_BUFFET);
                    ArcaneBuffetTimer = 8000;
                } else ArcaneBuffetTimer -= diff;

                if (FrostBreathTimer <= diff)
                {
                    DoCastAOE(SPELL_FROST_BREATH);
                    FrostBreathTimer = 15000;
                } else FrostBreathTimer -= diff;

                if (TailLashTimer <= diff)
                {
                    DoCastAOE(SPELL_TAIL_LASH);
                    TailLashTimer = 15000;
                } else TailLashTimer -= diff;

                if (WildMagicTimer <= diff)
                {
                    DoCastAOE(WildMagic[rand()%6]);
                    WildMagicTimer = 20000;
                } else WildMagicTimer -= diff;

                if (SpectralBlastTimer <= diff)
                {
                    ThreatContainer::StorageType const& m_threatlist = me->getThreatManager().getThreatList();
                    std::list<Unit*> targetList;
                    for (ThreatContainer::StorageType::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
                    {
                        Unit* target = (*itr)->getTarget();
                        if (target
                                && target->GetTypeId() == TYPEID_PLAYER
                                && target->GetGUID() != me->getVictim()->GetGUID()
                                && target->GetPositionZ() > me->GetPositionZ() - 5
                                && !target->HasAura(AURA_SPECTRAL_EXHAUSTION))
                        {
                            targetList.push_back(target);
                        }
                    }
                    if (targetList.empty())
                    {
                        SpectralBlastTimer = 1000;
                        return;
                    }
                    std::list<Unit*>::const_iterator i = targetList.begin();
                    advance(i, rand()%targetList.size());
                    if ((*i))
                    {
                        (*i)->CastSpell((*i), SPELL_SPECTRAL_BLAST, true);
                        SpectralBlastTimer = 20000+rand()%5000;
                    } else SpectralBlastTimer = 1000;
                } else SpectralBlastTimer -= diff;

                DoMeleeAttackIfReady();
            }
        }
开发者ID:Kncspark,项目名称:Patchs,代码行数:101,代码来源:boss_kalecgos.cpp

示例6: UpdateAI

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

				events.Update(diff);
				if (me->HasUnitState(UNIT_STATE_CASTING))
					return;

				switch (events.ExecuteEvent())
				{
					case EVENT_SPELL_SHOCK_BLAST:
						me->CastSpell(me->GetVictim(), SPELL_SHOCK_BLAST, false);
						events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, urand(10000, 20000));
						break;
					case EVENT_SPELL_STATIC_CHARGE:
						if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 40.0f))
							me->CastSpell(target, SPELL_STATIC_CHARGE, false);
						events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 20000);
						break;
					case EVENT_SPELL_ENTANGLE:
						me->CastSpell(me, SPELL_ENTANGLE, false);
						events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 30000);
						break;
					case EVENT_CHECK_HEALTH:
						if (me->HealthBelowPct(71))
						{
							Talk(SAY_PHASE2);
							me->SetReactState(REACT_PASSIVE);
							me->GetMotionMaster()->MovePoint(POINT_HOME, me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ(), true, true);
							break;
						}
						events.ScheduleEvent(EVENT_CHECK_HEALTH, 1000);
						break;
					case EVENT_SPELL_FORKED_LIGHTNING:
						if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f))
							me->CastSpell(target, SPELL_FORKED_LIGHTNING, false);
						events.ScheduleEvent(EVENT_SPELL_FORKED_LIGHTNING, urand(2500, 5000));
						break;
					case EVENT_SUMMON_A:
						me->CastSpell(me, SPELL_SUMMON_ENCHANTED_ELEMENTAL, true);
						events.ScheduleEvent(EVENT_SUMMON_A, 2500);
						break;
					case EVENT_SUMMON_B:
						me->CastSpell(me, SPELL_SUMMON_COILFANG_ELITE, true);
						events.ScheduleEvent(EVENT_SUMMON_B, 45000);
						break;
					case EVENT_SUMMON_C:
						me->CastSpell(me, SPELL_SUMMON_COILFANG_STRIDER, true);
						events.ScheduleEvent(EVENT_SUMMON_C, 60000);
						break;
					case EVENT_SUMMON_D:
						me->CastSpell(me, SPELL_SUMMON_TAINTED_ELEMENTAL, true);
						events.ScheduleEvent(EVENT_SUMMON_D, 50000);
						break;
					case EVENT_CHECK_HEALTH2:
						if (!me->HasAura(SPELL_MAGIC_BARRIER))
						{
							Talk(SAY_PHASE3);
							me->SetReactState(REACT_AGGRESSIVE);
							me->GetMotionMaster()->MoveChase(me->GetVictim());
							events.Reset();
							events.ScheduleEvent(EVENT_SPELL_SHOCK_BLAST, 10000);
							events.ScheduleEvent(EVENT_SPELL_STATIC_CHARGE, 15000);
							events.ScheduleEvent(EVENT_SPELL_ENTANGLE, 20000);
							events.ScheduleEvent(EVENT_SUMMON_SPOREBAT, 5000);
							break;
						}
						events.ScheduleEvent(EVENT_CHECK_HEALTH2, 1000);
						break;
					case EVENT_SUMMON_SPOREBAT:
						me->CastSpell(me, SPELL_SUMMON_TOXIC_SPOREBAT, true);
						events.ScheduleEvent(EVENT_SUMMON_SPOREBAT, 20000 - 1000*std::min(count++, 16));
						break;
				}

				if (me->GetReactState() != REACT_AGGRESSIVE || !me->isAttackReady())
					return;

				if (!me->IsWithinMeleeRange(me->GetVictim()))
				{
					me->resetAttackTimer();
					me->SetSheath(SHEATH_STATE_RANGED);
					me->CastSpell(me->GetVictim(), roll_chance_i(33) ? SPELL_MULTI_SHOT : SPELL_SHOOT, false);
					if (roll_chance_i(15))
						Talk(SAY_BOWSHOT);
				}
				else
				{
					me->SetSheath(SHEATH_STATE_MELEE);
					DoMeleeAttackIfReady();
				}
			}
开发者ID:AlexHjelm,项目名称:sunwell,代码行数:94,代码来源:boss_lady_vashj.cpp

示例7: UpdateAI

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

        //BrainWashTotem_Timer
        if (BrainWashTotem_Timer <= diff)
        {
            DoCast(me, SPELL_BRAINWASHTOTEM);
            BrainWashTotem_Timer = 18000 + rand()%8000;
        } else BrainWashTotem_Timer -= diff;

        //HealingWard_Timer
        if (HealingWard_Timer <= diff)
        {
            //DoCast(me, SPELL_POWERFULLHEALINGWARD);
            me->SummonCreature(14987, me->GetPositionX()+3, me->GetPositionY()-2, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,30000);
            HealingWard_Timer = 14000 + rand()%6000;
        } else HealingWard_Timer -= diff;

        //Hex_Timer
        if (Hex_Timer <= diff)
        {
            DoCast(me->getVictim(), SPELL_HEX);

            if (DoGetThreat(me->getVictim()))
                DoModifyThreatPercent(me->getVictim(),-80);

            Hex_Timer = 12000 + rand()%8000;
        } else Hex_Timer -= diff;

        //Casting the delusion curse with a shade. So shade will attack the same target with the curse.
        if (Delusions_Timer <= diff)
        {
            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
            {
                DoCast(pTarget, SPELL_DELUSIONSOFJINDO);

                Creature *Shade = me->SummonCreature(14986, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Shade)
                    Shade->AI()->AttackStart(pTarget);
            }

            Delusions_Timer = 4000 + rand()%8000;
        } else Delusions_Timer -= diff;

        //Teleporting a random gamer and spawning 9 skeletons that will attack this gamer
        if (Teleport_Timer <= diff)
        {
            Unit *pTarget = NULL;
            pTarget = SelectUnit(SELECT_TARGET_RANDOM,0);
            if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
            {
                DoTeleportPlayer(pTarget, -11583.7783f,-1249.4278f,77.5471f,4.745f);

                if (DoGetThreat(me->getVictim()))
                    DoModifyThreatPercent(pTarget,-100);

                Creature *Skeletons;
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+2, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()-2, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+4, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()-4, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()+2, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()-2, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()+4, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX(), pTarget->GetPositionY()-4, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
                Skeletons = me->SummonCreature(14826, pTarget->GetPositionX()+3, pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
                if (Skeletons)
                    Skeletons->AI()->AttackStart(pTarget);
            }

            Teleport_Timer = 15000 + rand()%8000;
        } else Teleport_Timer -= diff;

        DoMeleeAttackIfReady();
    }
开发者ID:LORDofDOOM,项目名称:MMOTBC,代码行数:93,代码来源:boss_jindo.cpp

示例8: UpdateAI

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

        switch (Phase)
        {
            case SKELETAL:
                if (uiCurseOfLifeTimer < diff)
                {
                    if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(pTarget, HEROIC(SPELL_CURSE_OF_LIFE, H_SPELL_CURSE_OF_LIFE));
                    uiCurseOfLifeTimer = urand(10000,15000);
                } else uiCurseOfLifeTimer -= diff;
                
                if (uiShadowVolleyTimer < diff)
                {
                    DoCastVictim(HEROIC(SPELL_SHADOW_VOLLEY,H_SPELL_SHADOW_VOLLEY));
                    uiShadowVolleyTimer = urand(8000,10000);
                } else uiShadowVolleyTimer -= diff;
                
                if (uiRainOfFireTimer < diff)
                {
                    DoCastAOE(HEROIC(SPELL_RAIN_OF_FIRE,H_SPELL_RAIN_OF_FIRE));
                    uiRainOfFireTimer = urand(14000,18000);
                } else uiRainOfFireTimer -= diff;
                
                if (uiPhaseTimer < diff)
                {
                    DoCast(SPELL_DECAY_FLESH);
                    Phase = GOING_FLESH;
                    uiPhaseTimer = 6000;
                } else uiPhaseTimer -= diff;

                DoMeleeAttackIfReady();
                break;
            case GOING_FLESH:
                if (uiPhaseTimer < diff)
                {
                    DoScriptText(RAND(SAY_FLESH_1,SAY_FLESH_2),m_creature);
                    m_creature->SetDisplayId(MODEL_FLESH);
                    std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
                    for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
                    {
                        Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
                        if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER)
                        {
                            m_creature->AddAura(SPELL_GIFT_OF_THARON_JA,pTemp);
                            pTemp->SetDisplayId(MODEL_SKELETON);
                        }
                    }
                    uiPhaseTimer = 20000;
                    uiLightningBreathTimer = urand(3000,4000);
                    uiEyeBeamTimer = urand(4000,8000);
                    uiPoisonCloudTimer = urand(6000,7000);
                    Phase = FLESH;
                } else uiPhaseTimer -= diff;
                break;
            case FLESH:
                if (uiLightningBreathTimer < diff)
                {
                    if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(pTarget, HEROIC(SPELL_LIGHTNING_BREATH, H_SPELL_LIGHTNING_BREATH));
                    uiLightningBreathTimer = urand(6000,7000);
                } else uiLightningBreathTimer -= diff;

                if (uiEyeBeamTimer < diff)
                {
                    if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        DoCast(pTarget, HEROIC(SPELL_EYE_BEAM, H_SPELL_EYE_BEAM));
                    uiEyeBeamTimer = urand(4000,6000);
                } else uiEyeBeamTimer -= diff;

                if (uiPoisonCloudTimer < diff)
                {
                    DoCastAOE(HEROIC(SPELL_POISON_CLOUD,H_SPELL_POISON_CLOUD));
                    uiPoisonCloudTimer = urand(10000,12000);
                } else uiPoisonCloudTimer -= diff;
                
                if (uiPhaseTimer < diff)
                {
                    DoCast(SPELL_RETURN_FLESH);
                    Phase = GOING_SKELETAL;
                    uiPhaseTimer = 6000;
                } else uiPhaseTimer -= diff;
                DoMeleeAttackIfReady();
                break;
            case GOING_SKELETAL:
                if (uiPhaseTimer < diff)
                {
                    DoScriptText(RAND(SAY_SKELETON_1,SAY_SKELETON_2), m_creature);
                    m_creature->DeMorph();
                    Phase = SKELETAL;
                    uiPhaseTimer = 20000;
                    uiCurseOfLifeTimer = 1000;
                    uiRainOfFireTimer = urand(14000,18000);
                    uiShadowVolleyTimer = urand(8000,10000);
                    std::list<HostilReference*>& threatlist = m_creature->getThreatManager().getThreatList();
                    for (std::list<HostilReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
//.........这里部分代码省略.........
开发者ID:artas,项目名称:quademu,代码行数:101,代码来源:boss_tharon_ja.cpp

示例9: UpdateAI


//.........这里部分代码省略.........
                                    DoCast(unit, SPELL_CHARGE);
                                    //me->SendMonsterMove(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0, true, 1);
                                    AttackStart(unit);
                                }
                            }
                        }
                        someWatched = false;
                        Watch_Timer = 20000;
                    } else Watch_Timer -= diff;

                    if ((Watch_Timer < 8000) && !someWatched)       //8 sec(cast time + expire time) before the check for the watch effect mandokir will cast watch debuff on a random target
                    {
                        if (Unit* p = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            DoScriptText(SAY_WATCH, me, p);
                            DoCast(p, SPELL_WATCH);
                            WatchTarget = p->GetGUID();
                            someWatched = true;
                            endWatch = true;
                        }
                    }

                    if ((Watch_Timer < 1000) && endWatch)           //1 sec before the debuf expire, store the target position
                    {
                        Unit* unit = Unit::GetUnit(*me, WatchTarget);
                        if (unit)
                        {
                            targetX = unit->GetPositionX();
                            targetY = unit->GetPositionY();
                            targetZ = unit->GetPositionZ();
                        }
                        endWatch = false;
                    }

                    if (!someWatched)
                    {
                        //Cleave
                        if (Cleave_Timer <= diff)
                        {
                            DoCast(me->getVictim(), SPELL_CLEAVE);
                            Cleave_Timer = 7000;
                        } else Cleave_Timer -= diff;

                        //Whirlwind
                        if (Whirlwind_Timer <= diff)
                        {
                            DoCast(me, SPELL_WHIRLWIND);
                            Whirlwind_Timer = 18000;
                        } else Whirlwind_Timer -= diff;

                        //If more then 3 targets in melee range mandokir will cast fear
                        if (Fear_Timer <= diff)
                        {
                            TargetInRange = 0;

                            std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
                            for (; i != me->getThreatManager().getThreatList().end(); ++i)
                            {
                                Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
                                if (unit && me->IsWithinMeleeRange(unit))
                                    ++TargetInRange;
                            }

                            if (TargetInRange > 3)
                                DoCast(me->getVictim(), SPELL_FEAR);

                            Fear_Timer = 4000;
                        } else Fear_Timer -=diff;

                        //Mortal Strike if target below 50% hp
                        if (me->getVictim() && me->getVictim()->HealthBelowPct(50))
                        {
                            if (MortalStrike_Timer <= diff)
                            {
                                DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
                                MortalStrike_Timer = 15000;
                            } else MortalStrike_Timer -= diff;
                        }
                    }
                    //Checking if Ohgan is dead. If yes Mandokir will enrage.
                    if (Check_Timer <= diff)
                    {
                        if (instance)
                        {
                            if (instance->GetData(DATA_OHGAN) == DONE)
                            {
                                if (!RaptorDead)
                                {
                                    DoCast(me, SPELL_ENRAGE);
                                    RaptorDead = true;
                                }
                            }
                        }

                        Check_Timer = 1000;
                    } else Check_Timer -= diff;

                    DoMeleeAttackIfReady();
                }
            }
开发者ID:16898500,项目名称:SkyFireEMU,代码行数:101,代码来源:boss_mandokir.cpp

示例10: UpdateAI


//.........这里部分代码省略.........
                    case WE_DUMMY:
                    default:
                        break;
                    }

                    WaitEvent = WE_NONE;
                    WaitTimer = 0;
                } else WaitTimer -= diff;
            }
            return;
        }

        if (Phase1)
        {
            if (me->getThreatManager().getThreatList().empty())
            {
                EnterEvadeMode();
                return;
            }

            if (Platforms_Move_Timer <= diff)
            {
                if (cur_wp == 4)
                {
                    cur_wp = 0;
                    WaitEvent = WE_PLATFORM;
                }
                else
                {
                    if (rand()%5) // next platform
                    {
                        DoSpawnCreature(CREATURE_EMBER_OF_ALAR, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                        if (cur_wp == 3)
                            cur_wp = 0;
                        else
                            cur_wp++;
                        WaitEvent = WE_PLATFORM;
                    }
                    else // flame quill
                    {
                        cur_wp = 4;
                        WaitEvent = WE_QUILL;
                    }
                }
                ForceMove = true;
                ForceTimer = 5000;
                me->GetMotionMaster()->MovePoint(0, waypoint[cur_wp][0], waypoint[cur_wp][1], waypoint[cur_wp][2]);
                WaitTimer = 0;
                return;
            } else Platforms_Move_Timer -= diff;
        }
        else
        {
            if (Charge_Timer <= diff)
            {
                Unit* pTarget= SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
                if (pTarget)
                    DoCast(pTarget, SPELL_CHARGE);
                Charge_Timer = 30000+rand()%20000;
            } else Charge_Timer -= diff;

            if (MeltArmor_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_MELT_ARMOR);
                MeltArmor_Timer = 60000;
            } else MeltArmor_Timer -= diff;

            if (DiveBomb_Timer <= diff)
            {
                me->AttackStop();
                me->GetMotionMaster()->MovePoint(6, waypoint[4][0], waypoint[4][1], waypoint[4][2]);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, 50);
                WaitEvent = WE_METEOR;
                WaitTimer = 0;
                DiveBomb_Timer = 30000+rand()%30000;
                return;
            } else DiveBomb_Timer -= diff;

            if (FlamePatch_Timer <= diff)
            {
                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                {
                    Creature* Summoned = me->SummonCreature(CREATURE_FLAME_PATCH_ALAR, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 120000);
                    if (Summoned)
                    {
                        Summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        Summoned->SetFloatValue(OBJECT_FIELD_SCALE_X, Summoned->GetFloatValue(OBJECT_FIELD_SCALE_X)*2.5f);
                        Summoned->SetDisplayId(11686);
                        Summoned->setFaction(me->getFaction());
                        Summoned->SetLevel(me->getLevel());
                        Summoned->CastSpell(Summoned, SPELL_FLAME_PATCH, false);
                    }
                }
                FlamePatch_Timer = 30000+rand()%20000; //30 sec to cooldown
            } else FlamePatch_Timer -= diff;
        }

        DoMeleeAttackIfReady();
    }
开发者ID:Dudelzack,项目名称:blizzlikecore,代码行数:101,代码来源:boss_alar.cpp

示例11: UpdateAI


//.........这里部分代码省略.........
        {
            //Become unbanished again
            m_creature->setFaction(14);
            m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            m_bShades = false;
        }
        else if (m_bShades)
        {
            m_uiShades_Timer -= uiDiff;
            //Do nothing while banished
            return;
        }

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

        //Sleep_Timer
        if (m_uiSleep_Timer < uiDiff)
        {
            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                DoCast(pTarget, SPELL_SLEEP);

            m_uiSleep_Timer = urand(8000, 15000);
        }
        else
            m_uiSleep_Timer -= uiDiff;

        //NoxiousBreath_Timer
        if (m_uiNoxiousBreath_Timer < uiDiff)
        {
            DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH);
            m_uiNoxiousBreath_Timer = urand(14000, 20000);
        }
        else
            m_uiNoxiousBreath_Timer -= uiDiff;

        //Tailsweep every 2 seconds
        if (m_uiTailSweep_Timer < uiDiff)
        {
            DoCast(m_creature, SPELL_TAILSWEEP);
            m_uiTailSweep_Timer = 2000;
        }
        else
            m_uiTailSweep_Timer -= uiDiff;

        //MarkOfNature_Timer
        //if (m_uiMarkOfNature_Timer < uiDiff)
        //{
        //    DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE);
        //    m_uiMarkOfNature_Timer = 45000;
        //}
        //else
            //m_uiMarkOfNature_Timer -= uiDiff;

        //ArcaneBlast_Timer
        if (m_uiArcaneBlast_Timer < uiDiff)
        {
            DoCast(m_creature->getVictim(), SPELL_ARCANEBLAST);
            m_uiArcaneBlast_Timer = urand(7000, 12000);
        }
        else
            m_uiArcaneBlast_Timer -= uiDiff;

        //BellowingRoar_Timer
        if (m_uiBellowingRoar_Timer < uiDiff)
        {
            DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR);
            m_uiBellowingRoar_Timer = urand(20000, 30000);
        }
        else
            m_uiBellowingRoar_Timer -= uiDiff;

        //Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again)
        if (!m_bShades && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned)))
        {
            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
            {
                //Inturrupt any spell casting
                m_creature->InterruptNonMeleeSpells(false);

                //horrible workaround, need to fix
                m_creature->setFaction(35);
                m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

                DoScriptText(SAY_SUMMONSHADE, m_creature);

                int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32);

                for(int i = 0; i < iSize; ++i)
                    m_creature->CastSpell(pTarget, m_auiSpellSummonShade[i], true);

                ++m_uiShadesSummoned;                       // prevent casting twice at same health
                m_bShades = true;
            }
            m_uiShades_Timer = 60000;
        }

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

示例12: UpdateAI

    void UpdateAI(const uint32 uiDiff)
    {
        if (!pEntered)
        {
            if (m_uiFlyPoint_Timer <= uiDiff)
            {
                switch (point_id)
                {
                    case 21:
                        float x,y,z;
                        m_creature->GetClosePoint(x, y, z, m_creature->GetObjectBoundingRadius(), 15.0f, 0.0f);
                        if (Creature* pTemp = m_creature->SummonCreature(NPC_HEAD, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0))
                            HeadGUID = pTemp->GetGUID();
                        else
                        {
                            error_log("Headless Horsemann could't summon his head so abording the event");
                            m_creature->ForcedDespawn();
                        }
                        pEntered = true;
                        break;
                    default:
                        m_creature->SendMonsterMove(FlightPoint[point_id][0], FlightPoint[point_id][1], FlightPoint[point_id][2], SPLINETYPE_NORMAL, SPLINEFLAG_WALKMODE,999);
                        ++point_id;
                        break;
                }
                m_uiFlyPoint_Timer = 1000;
            }else m_uiFlyPoint_Timer -= uiDiff;
        }

        if (!m_pInstance)
            return;

        Creature* pHead = m_creature->GetMap()->GetCreature(HeadGUID);
        if (pEntered && !pHead)
        {
            error_log("Debug: Headless Horseman aggroed but no Head of Horseman found so abording!");
            m_creature->ForcedDespawn();
        }

        switch (m_pInstance->GetData(TYPE_HALLOWSEND_EVENT))
        {
            //Phase 1a
            case 0:
                if (!m_creature->HasAura(SPELL_HEAD))
                    DoCast(m_creature,SPELL_HEAD,false);

                if (((m_creature->GetHealth()*100) / (m_creature->GetMaxHealth())) <= 1)
                    m_pInstance->SetData(TYPE_HALLOWSEND_EVENT,1);

                if (m_uiCleave_Timer <= uiDiff)
                {
                    m_creature->CastSpell(m_creature->getVictim(),SPELL_CLEAVE_PROC,false);
                    m_uiCleave_Timer = 5000;
                }else m_uiCleave_Timer -= uiDiff;
                DoMeleeAttackIfReady();
                break;

            //Phase 1b
            case 1:
                if (m_creature->HasAura(SPELL_HEAD))
                {
                    m_creature->RemoveAurasDueToSpell(SPELL_HEAD);
                    m_creature->CastSpell(pHead,SPELL_SEND_HEAD,false);
                }

                ApplyRegenAuras();

                if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    if (pHead->AI())
                        pHead->AI()->AttackStart(pTarget);

                if ((pHead->GetHealth()*100) / (pHead->GetMaxHealth()) <= 66)
                {
                    RemoveRegenAuras();

                    if ((m_creature->GetHealth()*100) / (m_creature->GetMaxHealth()) < 100)
                        m_pInstance->SetData(TYPE_HALLOWSEND_EVENT,2);
                    else
                        m_pInstance->SetData(TYPE_HALLOWSEND_EVENT,0);
                    pHead->SetHealth(pHead->GetMaxHealth()*0.7);
                }
                break;

            //Phase 2a
            case 2:
                if (((m_creature->GetHealth()*100) / (m_creature->GetMaxHealth())) <= 1)
                    m_pInstance->SetData(TYPE_HALLOWSEND_EVENT,3);

                if (m_uiConflageration_Timer <= uiDiff)
                {
                    if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
                    {
                        DoScriptText(SAY_CONFLAGRATION,m_creature);
                        pTarget->CastSpell(pTarget,SPELL_CONFLAGRATION,false);
                    }
                    m_uiConflageration_Timer = 15000;
                }else m_uiConflageration_Timer -= uiDiff;

                DoMeleeAttackIfReady();
                break;
//.........这里部分代码省略.........
开发者ID:cbcs,项目名称:ChgSD2,代码行数:101,代码来源:boss_headless_horseman.cpp

示例13: UpdateAI

            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;
                // Pounding
                if (Pounding_Timer <= diff)
                {
                    DoCastVictim(SPELL_POUNDING);
                    Talk(SAY_POUNDING);
                    Pounding_Timer = 15000; //cast time(3000) + cooldown time(12000)
                }
                else
                    Pounding_Timer -= diff;
                // Arcane Orb
                if (ArcaneOrb_Timer <= diff)
                {
                    Unit* target = NULL;
                    std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
                    std::vector<Unit*> target_list;
                    for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
                    {
                        target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
                        if (!target)
                            continue;
                        // exclude pets & totems, 18 yard radius minimum
                        if (target->GetTypeId() == TYPEID_PLAYER && target->IsAlive() && !target->IsWithinDist(me, 18, false))
                            target_list.push_back(target);
                        target = NULL;
                    }

                    if (!target_list.empty())
                        target = *(target_list.begin() + rand32() % target_list.size());
                    else
                        target = me->GetVictim();

                    if (target)
                        me->CastSpell(target, SPELL_ARCANE_ORB, false, NULL, NULL);
                    ArcaneOrb_Timer = 3000;
                }
                else
                    ArcaneOrb_Timer -= diff;
                // Single Target knock back, reduces aggro
                if (KnockAway_Timer <= diff)
                {
                    DoCastVictim(SPELL_KNOCK_AWAY);
                    //Drop 25% aggro
                    if (DoGetThreat(me->GetVictim()))
                        DoModifyThreatPercent(me->GetVictim(), -25);
                    KnockAway_Timer = 30000;
                }
                else
                    KnockAway_Timer -= diff;
                //Berserk
                if (Berserk_Timer < diff && !Enraged)
                {
                    DoCast(me, SPELL_BERSERK);
                    Enraged = true;
                }
                else
                    Berserk_Timer -= diff;

                DoMeleeAttackIfReady();
            }
开发者ID:AwkwardDev,项目名称:RE,代码行数:63,代码来源:boss_void_reaver.cpp

示例14: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (uiCheckTimer <= diff)
            {
                if (CheckPlayersInDistance())
                {
                    if (!me->isInCombat())
                    {
                        SummonAdds();
                    }
                }
                else if (me->isInCombat())
                {
                    Summons.DespawnAll();
                    EnterEvadeMode();
                }

                uiCheckTimer = 2*IN_MILLISECONDS;
            } else uiCheckTimer -= diff;

            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (!bClosedDoor)
            {
                if (uiSummonTimer <= diff)
                {
                    SummonAdds();
                    uiSummonTimer = 5*IN_MILLISECONDS;
                } else uiSummonTimer -= diff;

                if (uiDoorsTimer <= diff)
                {
                    bClosedDoor = true;
                } else uiDoorsTimer -= diff;
            }

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

            if (uiPierceTimer <= diff)
            {
                DoCast(me->getVictim(), SPELL_PIERCE_ARMOR);
                uiPierceTimer = 8*IN_MILLISECONDS;
            } else uiPierceTimer -= diff;

            if (uiAcidTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(target, SPELL_ACID_CLOUD);

                uiAcidTimer = urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS);
            } else uiAcidTimer -= diff;

            if (uiLeechTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(target, SPELL_LEECH_POISON);

                uiLeechTimer = urand(11*IN_MILLISECONDS, 14*IN_MILLISECONDS);
            } else uiLeechTimer -= diff;

            if (uiGrabTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) // Draws all players (and attacking Mobs) to itself.
                    DoCast(target, SPELL_WEB_GRAB);

                uiGrabTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS);
            } else uiGrabTimer -= diff;

            DoMeleeAttackIfReady();
        }
开发者ID:Marchmalo,项目名称:TrinityElron103,代码行数:73,代码来源:boss_hadronox.cpp

示例15: UpdateAI


//.........这里部分代码省略.........
                                                    player->CastSpell(pTarget, SPELL_MOONFIRE, false);
                                                else
                                                    player->CastSpell(me, SPELL_LIFEBLOOM, false);
                                                break;
                                            case CLASS_HUNTER:
                                                player->CastSpell(pTarget, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false);
                                                break;
                                            case CLASS_MAGE:
                                                player->CastSpell(pTarget, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false);
                                                break;
                                            case CLASS_WARLOCK:
                                                player->CastSpell(pTarget, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true);
                                                break;
                                            case CLASS_WARRIOR:
                                                player->CastSpell(pTarget, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false);
                                                break;
                                            case CLASS_PALADIN:
                                                if (urand(0,1))
                                                    player->CastSpell(pTarget, SPELL_HAMMER_OF_JUSTICE, false);
                                                else
                                                    player->CastSpell(me, SPELL_HOLY_SHOCK, false);
                                                break;
                                            case CLASS_PRIEST:
                                                if (urand(0,1))
                                                    player->CastSpell(pTarget, SPELL_VAMPIRIC_TOUCH, false);
                                                else
                                                    player->CastSpell(me, SPELL_RENEW, false);
                                                break;
                                            case CLASS_SHAMAN:
                                                if (urand(0,1))
                                                    player->CastSpell(pTarget, SPELL_EARTH_SHOCK, false);
                                                else
                                                    player->CastSpell(me, SPELL_HEALING_WAVE, false);
                                                break;
                                            case CLASS_ROGUE:
                                                player->CastSpell(pTarget, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false);
                                                break;
                                            case CLASS_DEATH_KNIGHT:
                                                if (urand(0,1))
                                                    player->CastSpell(pTarget, SPELL_PLAGUE_STRIKE, true);
                                                else
                                                    player->CastSpell(pTarget, SPELL_HOWLING_BLAST, true);
                                                break;
                                        }
                                    }
                                }
                                ++itr;
                            }

                            if (chained.empty())
                                events.PopEvent();
                            else
                                events.RepeatEvent(5000);

                            break;
                        }
                        case EVENT_DETONATE:
                        {
                            std::vector<Unit*> unitList;
                            std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList();
                            for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr)
                            {
                                if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER
                                    && (*itr)->getTarget()->getPowerType() == POWER_MANA
                                    && (*itr)->getTarget()->GetPower(POWER_MANA))
                                    unitList.push_back((*itr)->getTarget());
                            }

                            if (!unitList.empty())
                            {
                                std::vector<Unit*>::const_iterator itr = unitList.begin();
                                advance(itr, rand()%unitList.size());
                                DoCast(*itr, SPELL_MANA_DETONATION);
                                DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2,SAY_SPECIAL_3), me);
                            }

                            events.RepeatEvent(urand(20000,50000));
                            break;
                        }
                        case EVENT_FISSURE:
                            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                                DoCast(pTarget, SPELL_SHADOW_FISURE);
                            events.RepeatEvent(urand(10000,45000));
                            break;
                        case EVENT_BLAST:
                            if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1,0), 0, true))
                                DoCast(pTarget, SPELL_FROST_BLAST);
                            if (rand()%2)
                                DoScriptText(SAY_FROST_BLAST, me);
                            events.RepeatEvent(urand(30000,90000));
                            break;
                        default:
                            events.PopEvent();
                            break;
                    }
                }

                DoMeleeAttackIfReady();
            }
        }
开发者ID:InkVisible,项目名称:wow,代码行数:101,代码来源:boss_kelthuzad.cpp


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