• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HealthBelowPct函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: UpdateAI

        void UpdateAI(uint32 diff) override
        {
            events.Update(diff);

            // Speech
            if (!UpdateVictim())
            {
                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SPEECH_1:
                            Talk(SAY_LINE1);
                            me->SetStandState(UNIT_STAND_STATE_STAND);
                            me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
                            events.ScheduleEvent(EVENT_SPEECH_2, 12000);
                            break;
                        case EVENT_SPEECH_2:
                            Talk(SAY_LINE2);
                            me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
                            events.ScheduleEvent(EVENT_SPEECH_3, 12000);
                            break;
                        case EVENT_SPEECH_3:
                            Talk(SAY_LINE3);
                            me->HandleEmoteCommand(EMOTE_ONESHOT_TALK);
                            events.ScheduleEvent(EVENT_SPEECH_4, 16000);
                            break;
                        case EVENT_SPEECH_4:
                            me->setFaction(103);
                            if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID))
                                AttackStart(player);
                            break;
                    }
                }
                return;
            }

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

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_CLEAVE:
                        events.ScheduleEvent(EVENT_CLEAVE, 15000);
                        DoCastVictim(SPELL_CLEAVE);
                        break;
                    case EVENT_FLAMEBREATH:
                        DoCastVictim(SPELL_FLAMEBREATH);
                        events.ScheduleEvent(EVENT_FLAMEBREATH, urand(8000, 14000));
                        break;
                    case EVENT_FIRENOVA:
                        DoCastVictim(SPELL_FIRENOVA);
                        events.ScheduleEvent(EVENT_FIRENOVA, 15000);
                        break;
                    case EVENT_TAILSWIPE:
                        //Only cast if we are behind
                        /*if (!me->HasInArc(M_PI, me->GetVictim()))
                        {
                        DoCast(me->GetVictim(), SPELL_TAILSWIPE);
                        }*/
                        events.ScheduleEvent(EVENT_TAILSWIPE, 15000);
                        break;
                    case EVENT_BURNINGADRENALINE_CASTER:
                        {
                            Unit* target = NULL;

                            uint8 i = 0;
                            while (i < 3)   // max 3 tries to get a random target with power_mana
                            {
                                ++i;
                                target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true); // not aggro leader
                                if (target && target->getPowerType() == POWER_MANA)
                                    i = 3;
                            }
                            if (target)                                     // cast on self (see below)
                                target->CastSpell(target, SPELL_BURNINGADRENALINE, true);
                        }
                        events.ScheduleEvent(EVENT_BURNINGADRENALINE_CASTER, 15000);
                        break;
                    case EVENT_BURNINGADRENALINE_TANK:
                        // have the victim cast the spell on himself otherwise the third effect aura will be applied to Vael instead of the player
                        me->EnsureVictim()->CastSpell(me->GetVictim(), SPELL_BURNINGADRENALINE, true);
                        events.ScheduleEvent(EVENT_BURNINGADRENALINE_TANK, 45000);
                        break;
                }
            }

            // Yell if hp lower than 15%
            if (HealthBelowPct(15) && !HasYelled)
            {
                Talk(SAY_HALFLIFE);
                HasYelled = true;
            }

            DoMeleeAttackIfReady();
        }
开发者ID:maximusfun,项目名称:funcorecata,代码行数:98,代码来源:boss_vaelastrasz.cpp


示例2: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            // Always decrease our global cooldown first
            if (GlobalCooldown > diff)
                GlobalCooldown -= diff;
            else
                GlobalCooldown = 0;

            // Buff timer (only buff when we are alive and not in combat
            if (!me->isInCombat() && me->isAlive())
            {
                if (BuffTimer <= diff)
                {
                    // Find a spell that targets friendly and applies an aura (these are generally buffs)
                    SpellInfo const* info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);

                    if (info && !GlobalCooldown)
                    {
                        // Cast the buff spell
                        DoCastSpell(me, info);

                        // Set our global cooldown
                        GlobalCooldown = GENERIC_CREATURE_COOLDOWN;

                        // Set our timer to 10 minutes before rebuff
                        BuffTimer = 600000;
                    } // Try again in 30 seconds
                    else BuffTimer = 30000;
                }
                else BuffTimer -= diff;
            }

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

            // If we are within range melee the target
            if (me->IsWithinMeleeRange(me->getVictim()))
            {
                // Make sure our attack is ready and we aren't currently casting
                if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
                {
                    bool Healing = false;
                    SpellInfo const* info = NULL;

                    // Select a healing spell if less than 30% hp
                    if (HealthBelowPct(30))
                        info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);

                    // No healing spell available, select a hostile spell
                    if (info) Healing = true;
                    else
                        info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE);

                    // 50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell
                    if (info && (rand() % (me->GetCreatureTemplate()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown)
                    {
                        // Cast the spell
                        if (Healing)DoCastSpell(me, info);
                        else
                            DoCastSpell(me->getVictim(), info);

                        // Set our global cooldown
                        GlobalCooldown = GENERIC_CREATURE_COOLDOWN;
                    }
                    else me->AttackerStateUpdate(me->getVictim());

                    me->resetAttackTimer();
                }
            }
            else
            {
                // Only run this code if we aren't already casting
                if (!me->IsNonMeleeSpellCasted(false))
                {
                    bool Healing = false;
                    SpellInfo const* info = NULL;

                    // Select a healing spell if less than 30% hp ONLY 33% of the time
                    if (HealthBelowPct(30) && rand() % 3 == 0)
                        info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);

                    // No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
                    if (info) Healing = true;
                    else
                        info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE);

                    // Found a spell, check if we are not on a cooldown
                    if (info && !GlobalCooldown)
                    {
                        // If we are currently moving stop us and set the movement generator
                        if (!IsSelfRooted)
                            IsSelfRooted = true;

                        // Cast spell
                        if (Healing) DoCastSpell(me, info);
                        else
                            DoCastSpell(me->getVictim(), info);

                        // Set our global cooldown
//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:Darkcore-Rebase,代码行数:101,代码来源:mob_generic_creature.cpp


示例3: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            //Only if not incombat check if the event is started
            if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_MAULGAREVENT))
            {
                Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_MAULGAREVENT_TANK));

                if (pTarget)
                {
                    AttackStart(pTarget);
                    GetCouncil();
                }
            }

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

            //someone evaded!
            if (pInstance && !pInstance->GetData(DATA_MAULGAREVENT))
            {
                EnterEvadeMode();
                return;
            }

            //ArcingSmash_Timer
            if (ArcingSmash_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCING_SMASH);
                ArcingSmash_Timer = 10000;
            } else ArcingSmash_Timer -= diff;

            //Whirlwind_Timer
                   if (Whirlwind_Timer <= diff)
                   {
                        DoCast(me->getVictim(), SPELL_WHIRLWIND);
                        Whirlwind_Timer = 55000;
                   } else Whirlwind_Timer -= diff;

            //MightyBlow_Timer
            if (MightyBlow_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_MIGHTY_BLOW);
                MightyBlow_Timer = 30000+rand()%10000;
            } else MightyBlow_Timer -= diff;

            //Entering Phase 2
            if (!Phase2 && HealthBelowPct(50))
            {
                Phase2 = true;
                DoScriptText(SAY_ENRAGE, me);

                DoCast(me, SPELL_DUAL_WIELD, true);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0);
                me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0);
            }

            if (Phase2)
            {
                //Charging_Timer
                if (Charging_Timer <= diff)
                {
                    Unit *pTarget = NULL;
                    pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                    if (pTarget)
                    {
                        AttackStart(pTarget);
                        DoCast(pTarget, SPELL_BERSERKER_C);
                    }
                    Charging_Timer = 20000;
                } else Charging_Timer -= diff;

                //Intimidating Roar
                if (Roar_Timer <= diff)
                {
                    DoCast(me, SPELL_ROAR);
                    Roar_Timer = 40000+(rand()%10000);
                } else Roar_Timer -= diff;
            }

            DoMeleeAttackIfReady();
        }
开发者ID:tauri,项目名称:ArkCORE,代码行数:82,代码来源:boss_high_king_maulgar.cpp


示例4: UpdateAI

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

            //Common to PHASE_START && PHASE_END
            if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END)
            {
                //Specific to PHASE_START || PHASE_END
                if (m_uiPhase == PHASE_START)
                {
                    if (HealthBelowPct(60))
                    {
                        SetCombatMovement(false);
                        m_uiPhase = PHASE_BREATH;
                        me->GetMotionMaster()->MovePoint(10, Phase2Location);
                        return;
                    }
                }
                else
                {
                    if (m_uiBellowingRoarTimer <= uiDiff)
                    {
                        DoCastVictim(SPELL_BELLOWING_ROAR);
                        // Eruption
                        GameObject* pFloor = NULL;
                        Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15);
                        Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check);
                        me->VisitNearbyGridObject(30, searcher);
                        if (m_pInstance && pFloor)
                            m_pInstance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID());
                        m_uiBellowingRoarTimer = 30000;
                    }
                    else
                        m_uiBellowingRoarTimer -= uiDiff;
                }

                if (m_uiFlameBreathTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_FLAME_BREATH);
                    m_uiFlameBreathTimer = urand(10000, 20000);
                }
                else
                    m_uiFlameBreathTimer -= uiDiff;

                if (m_uiTailSweepTimer <= uiDiff)
                {
                    DoCastAOE(SPELL_TAIL_SWEEP);
                    m_uiTailSweepTimer = urand(15000, 20000);
                }
                else
                    m_uiTailSweepTimer -= uiDiff;

                if (m_uiCleaveTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_CLEAVE);
                    m_uiCleaveTimer = urand(2000, 5000);
                }
                else
                    m_uiCleaveTimer -= uiDiff;

                if (m_uiWingBuffetTimer <= uiDiff)
                {
                    DoCastVictim(SPELL_WING_BUFFET);
                    m_uiWingBuffetTimer = urand(15000, 30000);
                }
                else
                    m_uiWingBuffetTimer -= uiDiff;

                DoMeleeAttackIfReady();
            }
            else
            {
                if (HealthBelowPct(40))
                {
                    m_uiPhase = PHASE_END;
                    if (m_pInstance)
                        m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase);
                    DoScriptText(SAY_PHASE_3_TRANS, me);

                    SetCombatMovement(true);
                    me->SetFlying(false);
                    m_bIsMoving = false;
                    me->GetMotionMaster()->MovePoint(9,me->GetHomePosition());
                    return;
                }

                if (m_uiDeepBreathTimer <= uiDiff)
                {
                    if (!m_bIsMoving)
                    {
                        if (me->IsNonMeleeSpellCasted(false))
                            me->InterruptNonMeleeSpells(false);

                        DoScriptText(EMOTE_BREATH, me);
                        DoCast(me, m_pPointData->uiSpellId);
                        m_uiDeepBreathTimer = 70000;
                    }
                }
                else
//.........这里部分代码省略.........
开发者ID:1024wow,项目名称:TrinityCore,代码行数:101,代码来源:boss_onyxia.cpp


示例5: UpdateAI

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

            if(!bIsFrenzy && HealthBelowPct(25) && !bIsExploded)
            {
                DoScriptText(SAY_ENRAGE, me);
                DoCast(me, SPELL_FRENZY, true);
                bIsFrenzy = true;
            }

            if(!bIsFrenzy)
            {
                if(uiBubbleCheckerTimer <= diff)
                {
                    if(!bIsExploded)
                    {
                        if(!me->HasAura(SPELL_PROTECTIVE_BUBBLE, 0))
                        {
                            DoScriptText(SAY_SHATTER, me);
                            DoCast(me, SPELL_WATER_BLAST);
                            DoCast(me, SPELL_DRAINED);
                            bIsExploded = true;
                            me->AttackStop();
                            me->SetVisible(false);
                            for(uint8 i = 0; i < 10; i++)
                            {
                                int tmp = urand(0, MAX_SPAWN_LOC-1);
                                me->SummonCreature(NPC_ICHOR_GLOBULE, SpawnLoc[tmp], TEMPSUMMON_CORPSE_DESPAWN);
                            }
                        }
                    }
                    else
                    {
                        bool bIsWaterElementsAlive = false;
                        if(!m_waterElements.empty())
                        {
                            for(std::list<uint64>::const_iterator itr = m_waterElements.begin(); itr != m_waterElements.end(); ++itr)
                                if(Creature* pTemp = Unit::GetCreature(*me, *itr))
                                    if(pTemp->isAlive())
                                    {
                                        bIsWaterElementsAlive = true;
                                        break;
                                    }
                        }

                        if(!bIsWaterElementsAlive)
                            DoExplodeCompleted();
                    }
                    uiBubbleCheckerTimer = 1000;
                }
                else uiBubbleCheckerTimer -= diff;
            }

            if(!bIsExploded)
            {
                if(uiWaterBoltVolleyTimer <= diff)
                {
                    DoCast(me, SPELL_WATER_BOLT_VOLLEY);
                    uiWaterBoltVolleyTimer = urand(10000, 15000);
                }
                else uiWaterBoltVolleyTimer -= diff;

                DoMeleeAttackIfReady();
            }
        }
开发者ID:Naios,项目名称:MythCore,代码行数:67,代码来源:boss_ichoron.cpp


示例6: UpdateAI

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

            if (instance && !instance->GetData(TYPE_MOROES))
            {
                EnterEvadeMode();
                return;
            }

            if (!Enrage && HealthBelowPct(30))
            {
                DoCast(me, SPELL_FRENZY);
                Enrage = true;
            }

            if (CheckAdds_Timer <= diff)
            {
                for (uint8 i = 0; i < 4; ++i)
                {
                    if (AddGUID[i])
                    {
                        Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
                        if (temp && temp->IsAlive())
                            if (!temp->GetVictim())
                                temp->AI()->AttackStart(me->GetVictim());
                    }
                }
                CheckAdds_Timer = 5000;
            } else CheckAdds_Timer -= diff;

            if (!Enrage)
            {
                //Cast Vanish, then Garrote random victim
                if (Vanish_Timer <= diff)
                {
                    DoCast(me, SPELL_VANISH);
                    InVanish = true;
                    Vanish_Timer = 30000;
                    Wait_Timer = 5000;
                } else Vanish_Timer -= diff;

                if (Gouge_Timer <= diff)
                {
                    DoCastVictim(SPELL_GOUGE);
                    Gouge_Timer = 40000;
                } else Gouge_Timer -= diff;

                if (Blind_Timer <= diff)
                {
                    std::list<Unit*> targets;
                    SelectTargetList(targets, 5, SELECT_TARGET_RANDOM, me->GetMeleeReach()*5, true);
                    for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
                        if (!me->IsWithinMeleeRange(*i))
                        {
                            DoCast(*i, SPELL_BLIND);
                            break;
                        }
                    Blind_Timer = 40000;
                } else Blind_Timer -= diff;
            }

            if (InVanish)
            {
                if (Wait_Timer <= diff)
                {
                    Talk(SAY_SPECIAL);

                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                        target->CastSpell(target, SPELL_GARROTE, true);

                    InVanish = false;
                } else Wait_Timer -= diff;
            }

            if (!InVanish)
                DoMeleeAttackIfReady();
        }
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:79,代码来源:boss_moroes.cpp


示例7: UpdateAI

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

                events.Update(diff);

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

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_MORTALCLEAVE:
                            DoCastVictim(SPELL_MORTALCLEAVE, true);
                            events.ScheduleEvent(EVENT_MORTALCLEAVE, urand(15000, 20000), 0, PHASE_ONE);
                            break;
                        case EVENT_SILENCE:
                            DoCastVictim(SPELL_SILENCE, true);
                            events.ScheduleEvent(EVENT_SILENCE, urand(20000, 25000), 0, PHASE_ONE);
                            break;
                        case EVENT_RESURRECT_TIMER:
                            //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds.
                            if (WasDead)
                            {
                                DoCast(me, SPELL_TIGER_FORM); // SPELL_AURA_TRANSFORM
                                me->SetObjectScale(2.00f);
                                me->SetStandState(UNIT_STAND_STATE_STAND);
                                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                /*
                                CreatureTemplate const* cinfo = me->GetCreatureTemplate();
                                me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40)));
                                me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40)));
                                me->UpdateDamagePhysical(BASE_ATTACK);
                                */
                                me->ApplyStatPctModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, DamageIncrease); // hack
                                ResetThreatList();
                                events.ScheduleEvent(EVENT_FRENZY, 30000, 0, PHASE_TWO);          // Phase 2
                                events.ScheduleEvent(EVENT_FORCEPUNCH, 4000, 0, PHASE_TWO);       // Phase 2
                                events.ScheduleEvent(EVENT_SPELL_CHARGE, 12000, 0, PHASE_TWO);    // Phase 2
                                events.ScheduleEvent(EVENT_ENRAGE, 32000, 0, PHASE_TWO);          // Phase 2
                                events.ScheduleEvent(EVENT_SUMMONTIGERS, 25000, 0, PHASE_TWO);    // Phase 2
                                events.SetPhase(PHASE_TWO);
                            }
                            events.ScheduleEvent(EVENT_RESURRECT_TIMER, 10000, 0, PHASE_ONE);
                            break;
                        case EVENT_CHECK_TIMER:
                            //Check_Timer for the death of LorKhan and Zath.
                            if (!WasDead)
                            {
                                if (instance->GetBossState(DATA_LORKHAN) == SPECIAL)
                                {
                                    //Resurrect LorKhan
                                    if (Unit* pLorKhan = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_LORKHAN)))
                                    {
                                        pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                        pLorKhan->SetFaction(FACTION_MONSTER);
                                        pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                        pLorKhan->SetFullHealth();
                                        instance->SetData(DATA_LORKHAN, DONE);
                                    }
                                }

                                if (instance->GetBossState(DATA_ZATH) == SPECIAL)
                                {
                                    //Resurrect Zath
                                    if (Unit* pZath = ObjectAccessor::GetUnit(*me, instance->GetGuidData(DATA_ZATH)))
                                    {
                                        pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                        pZath->SetFaction(FACTION_MONSTER);
                                        pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                        pZath->SetFullHealth();
                                        instance->SetBossState(DATA_ZATH, DONE);
                                    }
                                }
                            }
                            events.ScheduleEvent(EVENT_CHECK_TIMER, 5000, 0, PHASE_ONE);
                            break;
                        case EVENT_FRENZY:
                            DoCast(me, SPELL_FRENZY);
                            events.ScheduleEvent(EVENT_FRENZY, 30000, 0, PHASE_TWO);
                            break;
                        case EVENT_FORCEPUNCH:
                            DoCastVictim(SPELL_FORCEPUNCH, true);
                            events.ScheduleEvent(EVENT_FORCEPUNCH, urand(16000, 21000), 0, PHASE_TWO);
                            break;
                        case EVENT_CHARGE:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                            {
                                DoCast(target, SPELL_CHARGE);
                                ResetThreatList();
                                AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_CHARGE, urand(15000, 22000), 0, PHASE_TWO);
                            break;
                        case EVENT_ENRAGE:
                            if (HealthBelowPct(11) && !Enraged)
                            {
                                DoCast(me, SPELL_ENRAGE);
//.........这里部分代码省略.........
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:101,代码来源:boss_thekal.cpp


示例8: UpdateAI

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

            if(uiChainLightningTimer <= diff)
            {
                if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(pTarget, SPELL_CHAIN_LIGHTING);
                uiChainLightningTimer = urand(12000, 15000);
            } else uiChainLightningTimer -= diff;

            if(uiStaticChargeTimer <= diff)
            {
                if(Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
                    DoCast(pTarget, SPELL_STATIC_CHARGE);
                 uiStaticChargeTimer = 25000;
            } else uiStaticChargeTimer -= diff;

            if(uiLightningRingTimer <= diff)
            {
                DoCast(me, SPELL_LIGHTING_RING);
                uiLightningRingTimer = urand(30000, 35000);
            } else uiLightningRingTimer -= diff;

            if(uiLightningShieldTimer <= diff)
            {
                CheckLightningShield();
                uiLightningShieldTimer = urand(45000, 55000);
            } else uiLightningShieldTimer -= diff;

            if(uiCheckPhaseTimer <= diff)
            {
                if(HealthBelowPct(75) && uiSummonPhase == 1)
                {
                    uiSummonEntry = CREATURE_FORGED_IRON_TROGG;
                    uiSummonTimer = 1000;
                    uiSummonPhase = 2;
                }
                else if(HealthBelowPct(50) && uiSummonPhase == 2)
                {
                    uiSummonEntry = CREATURE_MALFORMED_OOZE;
                    uiSummonTimer = 1000;
                    uiSummonPhase = 3;
                }
                else if(HealthBelowPct(25) && uiSummonPhase == 3)
                {
                    uiSummonEntry = CREATURE_EARTHEN_DWARF;
                    uiSummonTimer = 1000;
                    uiSummonPhase = 4;
                }

                uiCheckPhaseTimer = 1000;

            } else uiCheckPhaseTimer -= diff;

            if(uiSummonTimer <= diff)
            {
                uint32 rnd = urand(0, 1);

                if(uiSummonEntry)
                    me->SummonCreature(uiSummonEntry, PipeLocations[rnd].x, PipeLocations[rnd].y, PipeLocations[rnd].z, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000);

                switch(uiSummonPhase)
                {
                        case 1: uiSummonTimer = 20000; break;
                    case 2: uiSummonTimer = 7500; break;
                        case 3: uiSummonTimer = 2500; break;
                    case 4: uiSummonTimer = 5000; break;
                }

            } else uiSummonTimer -= diff;

            if(!bIsFrenzy)
                if(HealthBelowPct(25))
                    if(!me->IsNonMeleeSpellCasted(false))
                    {
                        DoCast(me, SPELL_FRENZY);
                        bIsFrenzy = true;
                    }

            DoMeleeAttackIfReady();
        }
开发者ID:Desch,项目名称:MythCore,代码行数:83,代码来源:boss_sjonnir.cpp


示例9: UpdateAI


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

            if (SecondarySpellTimer <= diff)
            {
                DoCast(me, SPELL_AOE_CS);
                SecondarySpellTimer = urand(10000, 40000);
            }
            else SecondarySpellTimer -= diff;

            if (SuperCastTimer <= diff)
            {
                uint8 Available[2];

                switch (LastSuperSpell)
                {
                    case SUPER_AE:
                        Available[0] = SUPER_FLAME;
                        Available[1] = SUPER_BLIZZARD;
                        break;
                    case SUPER_FLAME:
                        Available[0] = SUPER_AE;
                        Available[1] = SUPER_BLIZZARD;
                        break;
                    case SUPER_BLIZZARD:
                        Available[0] = SUPER_FLAME;
                        Available[1] = SUPER_AE;
                        break;
                    default:
                        Available[0] = 0;
                        Available[1] = 0;
                        break;
                }

                LastSuperSpell = Available[urand(0, 1)];

                switch (LastSuperSpell)
                {
                    case SUPER_AE:
                        DoScriptText(RAND(SAY_EXPLOSION1, SAY_EXPLOSION2), me);

                        DoCast(me, SPELL_TELEPORT_MIDDLE, true);
                        DoCast(me, SPELL_MAGNETIC_PULL, true);
                        DoCast(me, SPELL_MASSSLOW, true);
                        DoCast(me, SPELL_AEXPLOSION, false);
                        DrinkingDelay = 15000;
                        break;

                    case SUPER_FLAME:
                        DoScriptText(RAND(SAY_FLAMEWREATH1, SAY_FLAMEWREATH2), me);
                        DrinkingDelay = 25000;
                        break;

                    case SUPER_BLIZZARD:
                        DoScriptText(RAND(SAY_BLIZZARD1, SAY_BLIZZARD2), me);
                        DrinkingDelay = 30000;
                        break;
                }

                SuperCastTimer = urand(35000, 40000);
            }
            else SuperCastTimer -= diff;

            if (!ElementalsSpawned && HealthBelowPct(40))
            {
                ElementalsSpawned = true;

                DoCast(me, SPELL_TELEPORT_MIDDLE, true);
                DoCast(me, SPELL_MAGNETIC_PULL, true);
                DoCast(me, SPELL_ELEMENTAL1, true);
                DoCast(me, SPELL_ELEMENTAL2, true);
                DoCast(me, SPELL_ELEMENTAL3, true);
                DoCast(me, SPELL_ELEMENTAL4, true);

                DoScriptText(SAY_ELEMENTALS, me);
            }
        }
        
        if (BerserkTimer <= diff)
        {
            for (uint32 i = 0; i < 8; ++i)
            {
                if (Creature* unit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, shadowOfAranSpawnPoints[i][0], shadowOfAranSpawnPoints[i][1], me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
                {
                    unit->Attack(me->getVictim(), true);
                    unit->setFaction(me->getFaction());
                }
            }

            DoScriptText(SAY_TIMEOVER, me);

            BerserkTimer = 60000;
        }
        else BerserkTimer -= diff;

        if (ArcaneCooldown && FireCooldown && FrostCooldown)
            DoMeleeAttackIfReady();
    }
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:101,代码来源:boss_shade_of_aran.cpp


示例10: UpdateAI

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

            // Splitted
            if (!me->IsVisible())
            {
                if (uiSplitTimer <= uiDiff)
                {
                    uiSplitTimer = 2500;

                    // Return sparks to where Ionar splitted
                    if (bIsSplitPhase)
                    {
                        CallBackSparks();
                        bIsSplitPhase = false;
                    }
                    // Lightning effect and restore Ionar
                    else if (lSparkList.empty())
                    {
                        me->SetVisible(true);
                        me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_DISABLE_MOVE);

                        DoCast(me, SPELL_SPARK_DESPAWN, false);

                        uiSplitTimer = 25*IN_MILLISECONDS;
                        bIsSplitPhase = true;

                        if (me->getVictim())
                            me->GetMotionMaster()->MoveChase(me->getVictim());
                    }
                }
                else
                    uiSplitTimer -= uiDiff;

                return;
            }

            if (uiStaticOverloadTimer <= uiDiff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                    DoCast(target, SPELL_STATIC_OVERLOAD);

                uiStaticOverloadTimer = urand(5*IN_MILLISECONDS, 6*IN_MILLISECONDS);
            }
            else
                uiStaticOverloadTimer -= uiDiff;

            if (uiBallLightningTimer <= uiDiff)
            {
                DoCast(me->getVictim(), SPELL_BALL_LIGHTNING);
                uiBallLightningTimer = urand(10*IN_MILLISECONDS, 11*IN_MILLISECONDS);
            }
            else
                uiBallLightningTimer -= uiDiff;

            // Health check
            if (!bHasDispersed && HealthBelowPct(uiDisperseHealth))
            {
                bHasDispersed = true;

                DoScriptText(RAND(SAY_SPLIT_1, SAY_SPLIT_2), me);

                if (me->IsNonMeleeSpellCasted(false))
                    me->InterruptNonMeleeSpells(false);

                DoCast(me, SPELL_DISPERSE, false);
            }

            DoMeleeAttackIfReady();
        }
开发者ID:A-Shox,项目名称:TrinityCore,代码行数:73,代码来源:boss_ionar.cpp


示例11: UpdateAI


//.........这里部分代码省略.........
                            events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE);
                            break;
                        }
                        case EVENT_SUBMERGE:
                            if (!_reachedPhase3 && !me->HasAura(SPELL_BERSERK))
                            {
                                DoCast(me, SPELL_SUBMERGE_ANUBARAK);
                                DoCast(me, SPELL_CLEAR_ALL_DEBUFFS);
                                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                                Talk(EMOTE_BURROWER);
                                events.SetPhase(PHASE_SUBMERGED);
                                events.ScheduleEvent(EVENT_PURSUING_SPIKE, 2*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
                                events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
                                events.ScheduleEvent(EVENT_EMERGE, 1*MINUTE*IN_MILLISECONDS, 0, PHASE_SUBMERGED);
                            }
                            break;
                        case EVENT_PURSUING_SPIKE:
                            DoCast(SPELL_SPIKE_CALL);
                            break;
                        case EVENT_SUMMON_SCARAB:
                        {
                            /* WORKAROUND
                            * - The correct implementation is more likely the comment below but it needs spell knowledge
                            */
                            GuidList::iterator i = _burrowGUID.begin();
                            uint32 at = urand(0, _burrowGUID.size()-1);
                            for (uint32 k = 0; k < at; k++)
                                ++i;
                            if (Creature* pBurrow = ObjectAccessor::GetCreature(*me, *i))
                                pBurrow->CastSpell(pBurrow, 66340, false);

                            events.ScheduleEvent(EVENT_SUMMON_SCARAB, 4*IN_MILLISECONDS, 0, PHASE_SUBMERGED);

                            /*It seems that this spell have something more that needs to be taken into account
                            //Need more sniff info
                            DoCast(SPELL_SUMMON_BEATLES);
                            // Just to make sure it won't happen again in this phase
                            m_uiSummonScarabTimer = 90*IN_MILLISECONDS;*/
                            break;
                        }
                        case EVENT_EMERGE:
                            events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE);
                            DoCast(SPELL_SPIKE_TELE);
                            summons.DespawnEntry(NPC_SPIKE);
                            me->RemoveAurasDueToSpell(SPELL_SUBMERGE_ANUBARAK);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                            DoCast(me, SPELL_EMERGE_ANUBARAK);
                            Talk(EMOTE_EMERGE);
                            events.SetPhase(PHASE_MELEE);
                            events.ScheduleEvent(EVENT_FREEZE_SLASH, 15*IN_MILLISECONDS, 0, PHASE_MELEE);
                            events.ScheduleEvent(EVENT_PENETRATING_COLD, 20*IN_MILLISECONDS, PHASE_MELEE);
                            events.ScheduleEvent(EVENT_SUMMON_NERUBIAN, 10*IN_MILLISECONDS, 0, PHASE_MELEE);
                            events.ScheduleEvent(EVENT_SUBMERGE, 80*IN_MILLISECONDS, 0, PHASE_MELEE);
                            if (IsHeroic())
                                events.ScheduleEvent(EVENT_NERUBIAN_SHADOW_STRIKE, 30*IN_MILLISECONDS, 0, PHASE_MELEE);
                            return;
                        case EVENT_SUMMON_FROST_SPHERE:
                        {
                            uint8 startAt = urand(0, 5);
                            uint8 i = startAt;
                            do
                            {
                                if (Unit* pSphere = ObjectAccessor::GetCreature(*me, _sphereGUID[i]))
                                {
                                    if (!pSphere->HasAura(SPELL_FROST_SPHERE))
                                    {
                                        if (Creature* summon = me->SummonCreature(NPC_FROST_SPHERE, SphereSpawn[i]))
                                            _sphereGUID[i] = summon->GetGUID();
                                        break;
                                    }
                                }
                                i = (i + 1) % 6;
                            }
                            while
                                (i != startAt);
                            events.ScheduleEvent(EVENT_SUMMON_FROST_SPHERE, urand(20*IN_MILLISECONDS, 30*IN_MILLISECONDS));
                            break;
                        }
                        case EVENT_BERSERK:
                            DoCast(me, SPELL_BERSERK);
                            break;
                        default:
                            break;
                    }

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

                if (HealthBelowPct(30) && events.IsInPhase(PHASE_MELEE) && !_reachedPhase3)
                {
                    _reachedPhase3 = true;
                    DoCastAOE(SPELL_LEECHING_SWARM);
                    Talk(EMOTE_LEECHING_SWARM);
                    Talk(SAY_LEECHING_SWARM);
                }

                if (events.IsInPhase(PHASE_MELEE))
                    DoMeleeAttackIfReady();
            }
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:101,代码来源:boss_anubarak_trial.cpp


示例12: UpdateAI

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

            if (bIsWaitingToAppear)
            {
                me->StopMoving();
                me->AttackStop();
                if (uiIsWaitingToAppearTimer <= diff)
                {
                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                    bIsWaitingToAppear = false;
                } else uiIsWaitingToAppearTimer -= diff;
                return;
            }

            if ((Phase == 1) ||(Phase == 3))
            {
                if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
                {
                    for (uint8 n = 0; n < 3; ++n)
                        time[n] = 0;
                    me->GetMotionMaster()->Clear();
                    me->SetPosition(CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
                    DoCast(me, SPELL_TELESTRA_BACK);
                    me->SetVisible(true);
                    if (Phase == 1)
                        Phase = 2;
                    if (Phase == 3)
                        Phase = 4;
                    uiFireMagusGUID = 0;
                    uiFrostMagusGUID = 0;
                    uiArcaneMagusGUID = 0;
                    bIsWaitingToAppear = true;
                    uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS;
                    Talk(SAY_MERGE);
                }
                else
                    return;
            }

            if ((Phase == 0) && HealthBelowPct(50))
            {
                Phase = 1;
                me->CastStop();
                me->RemoveAllAuras();
                me->SetVisible(false);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
                uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
                uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
                bFireMagusDead = false;
                bFrostMagusDead = false;
                bArcaneMagusDead = false;
                Talk(SAY_SPLIT);
                return;
            }

            if (IsHeroic() && (Phase == 2) && HealthBelowPct(10))
            {
                Phase = 3;
                me->CastStop();
                me->RemoveAllAuras();
                me->SetVisible(false);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                uiFireMagusGUID = SplitPersonality(MOB_FIRE_MAGUS);
                uiFrostMagusGUID = SplitPersonality(MOB_FROST_MAGUS);
                uiArcaneMagusGUID = SplitPersonality(MOB_ARCANE_MAGUS);
                bFireMagusDead = false;
                bFrostMagusDead = false;
                bArcaneMagusDead = false;
                Talk(SAY_SPLIT);
                return;
            }

            if (uiCooldown)
            {
                if (uiCooldown <= diff)
                    uiCooldown = 0;
                else
                {
                    uiCooldown -= diff;
                    return;
                }
            }

            if (uiIceNovaTimer <= diff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                {
                    DoCast(target, SPELL_ICE_NOVA, false);
                    uiCooldown = 1500;
                }
                uiIceNovaTimer = 15*IN_MILLISECONDS;
            } else uiIceNovaTimer -= diff;

            if (uiGravityWellTimer <= diff)
            {
//.........这里部分代码省略.........
开发者ID:Arkania,项目名称:ArkCORE4,代码行数:101,代码来源:boss_magus_telestra.cpp


示例13: UpdateAI

            void UpdateAI(uint32 diff) override
            {
                if (events.IsInPhase(IDLE))
                    return;

                if (events.IsInPhase(NORMAL) && !UpdateVictim())
                    return;

                events.Update(diff);

                if (!_sacrificed && HealthBelowPct(50))
                {
                    _sacrificed = true 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HeapAlloc函数代码示例发布时间:2022-05-30
下一篇:
C++ HealthAbovePct函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap