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

C++ HealthAbovePct函数代码示例

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

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



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

示例1: UpdateAI

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

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                    case EVENT_HARD_ENRAGE:
                        if (!_isHardEnraged)
                        {
                            DoCast(me, SPELL_PYROBUFFET, true);
                            _isHardEnraged = true;
                        }
                        break;
                    case EVENT_FLAME_TSUNAMI:
                        Talk(WHISPER_LAVA_CHURN);
                        switch (urand(0, 1))
                        {
                            case 0:
                            {
                                if (Creature* right1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight1Spawn, TEMPSUMMON_TIMED_DESPAWN, 12000))
                                    right1->GetMotionMaster()->MovePoint(0, FlameRight1Direction);
                                if (Creature* right2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight2Spawn, TEMPSUMMON_TIMED_DESPAWN, 12000))
                                    right2->GetMotionMaster()->MovePoint(0, FlameRight2Direction);
                                if (Creature* right3 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameRight3Spawn, TEMPSUMMON_TIMED_DESPAWN, 12000))
                                    right3->GetMotionMaster()->MovePoint(0, FlameRight3Direction);
                                break;
                            }
                            case 1:
                            {
                                if (Creature* left1 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft1Spawn, TEMPSUMMON_TIMED_DESPAWN, 12000))
                                    left1->GetMotionMaster()->MovePoint(0, FlameLeft1Direction);
                                if (Creature* left2 = me->SummonCreature(NPC_FLAME_TSUNAMI, FlameLeft2Spawn, TEMPSUMMON_TIMED_DESPAWN, 12000))
                                    left2->GetMotionMaster()->MovePoint(0, FlameLeft2Direction);
                                break;
                            }
                        }
                        events.ScheduleEvent(EVENT_FLAME_TSUNAMI, 30000);
                        break;
                    case EVENT_FLAME_BREATH:
                        Talk(SAY_SARTHARION_BREATH);
                        DoCastVictim(RAID_MODE(SPELL_FLAME_BREATH, SPELL_FLAME_BREATH_H));
                        events.ScheduleEvent(EVENT_FLAME_BREATH, urand(25000, 35000));
                        break;
                    case EVENT_TAIL_SWEEP:
                        DoCastVictim(RAID_MODE(SPELL_TAIL_LASH, SPELL_TAIL_LASH_H));
                        events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(15000, 20000));
                        break;
                    case EVENT_CLEAVE_ATTACK:
                        DoCastVictim(SPELL_CLEAVE);
                        events.ScheduleEvent(EVENT_CLEAVE_ATTACK, urand(7000, 10000));
                        break;
                    case EVENT_LAVA_STRIKE:
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            CastLavaStrikeOnTarget(target);
                            if (urand(0, 5) == 0)
                                Talk(SAY_SARTHARION_SPECIAL);
                        }
                        events.ScheduleEvent(EVENT_LAVA_STRIKE, (_isSoftEnraged ? urand(1400, 2000) : urand(5000, 20000)));
                        break;
                    case EVENT_CALL_TENEBRON:
                        CallDragon(DATA_TENEBRON);
                        break;
                    case EVENT_CALL_SHADRON:
                        CallDragon(DATA_SHADRON);
                        break;
                    case EVENT_CALL_VESPERON:
                        CallDragon(DATA_VESPERON);
                        break;
                    default:
                        break;
                }
            }

            //  At 35% spell will target dragons, if they are still alive.
            if (!_isBerserk && !HealthAbovePct(35))
            {
                if (instance->GetBossState(DATA_TENEBRON) != DONE || instance->GetBossState(DATA_SHADRON) != DONE || instance->GetBossState(DATA_VESPERON) != DONE)
                {
                    Talk(SAY_SARTHARION_BERSERK);
                    DoCast(me, SPELL_BERSERK);
                    _isBerserk = true;
                }
            }

            // Soft Enrage used while determining Lava Strike cooldown.
            if (!_isSoftEnraged && HealthBelowPct(10))
            {
                _isSoftEnraged = true;
            }

            DoMeleeAttackIfReady();

            EnterEvadeIfOutOfCombatArea(diff);
        }
开发者ID:125125,项目名称:TrinityCore,代码行数:100,代码来源:boss_sartharion.cpp


示例2: UpdateAI

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

            //ArcaneMissiles_Timer
            if (ArcaneMissiles_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_ARCANEMISSILES);
                ArcaneMissiles_Timer = 8000;
            } else ArcaneMissiles_Timer -= diff;

            //ShadowShield_Timer
            if (ShadowShield_Timer <= diff)
            {
                DoCast(me, SPELL_SHADOWSHIELD);
                ShadowShield_Timer = 14000 + rand()%14000;
            } else ShadowShield_Timer -= diff;

            //Curse_Timer
            if (Curse_Timer <= diff)
            {
                DoCast(me->getVictim(), SPELL_CURSE);
                Curse_Timer = 15000 + rand()%12000;
            } else Curse_Timer -= diff;

            //Teleporting Random Target to one of the six pre boss rooms and spawn 3-4 skeletons near the gamer.
            //We will only telport if gandling has more than 3% of hp so teleported gamers can always loot.
            if (HealthAbovePct(3))
            {
                if (Teleport_Timer <= diff)
                {
                    Unit *pTarget = NULL;
                    pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
                    if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
                    {
                        if (DoGetThreat(pTarget))
                            DoModifyThreatPercent(pTarget, -100);

                        Creature *Summoned = NULL;
                        switch(rand()%6)
                        {
                            case 0:
                                DoTeleportPlayer(pTarget, 250.0696f, 0.3921f, 84.8408f, 3.149f);
                                Summoned = me->SummonCreature(16119, 254.2325f, 0.3417f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 257.7133f, 4.0226f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 258.6702f, -2.60656f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 1:
                                DoTeleportPlayer(pTarget, 181.4220f, -91.9481f, 84.8410f, 1.608f);
                                Summoned = me->SummonCreature(16119, 184.0519f, -73.5649f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 179.5951f, -73.7045f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 180.6452f, -78.2143f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 283.2274f, -78.1518f, 84.8407f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 2:
                                DoTeleportPlayer(pTarget, 95.1547f, -1.8173f, 85.2289f, 0.043f);
                                Summoned = me->SummonCreature(16119, 100.9404f, -1.8016f, 85.2289f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 101.3729f, 0.4882f, 85.2289f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 101.4596f, -4.4740f, 85.2289f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 3:
                                DoTeleportPlayer(pTarget, 250.0696f, 0.3921f, 72.6722f, 3.149f);
                                Summoned = me->SummonCreature(16119, 240.34481f, 0.7368f, 72.6722f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 240.3633f, -2.9520f, 72.6722f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 240.6702f, 3.34949f, 72.6722f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                break;
                            case 4:
                                DoTeleportPlayer(pTarget, 181.4220f, -91.9481f, 70.7734f, 1.608f);
                                Summoned = me->SummonCreature(16119, 184.0519f, -73.5649f, 70.7734f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
                                    Summoned->AI()->AttackStart(pTarget);
                                Summoned = me->SummonCreature(16119, 179.5951f, -73.7045f, 70.7734f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
                                if (Summoned)
//.........这里部分代码省略.........
开发者ID:H4D3S,项目名称:DarkmoonCore-Cataclysm,代码行数:101,代码来源:boss_darkmaster_gandling.cpp


示例3: UpdateAI

            void UpdateAI(const uint32 uiDiff)
            {
                if (!instance)
                    return;
                // we're still doing awaken animation
                if (bWakingUp && iAwakenTimer >= 0)
                {
                    iAwakenTimer -= uiDiff;
                    return;        // dont do anything until we are done
                } else if (bWakingUp && iAwakenTimer <= 0)
                {
                    bWakingUp = false;
                    AttackStart(Unit::GetUnit(*me, instance->GetData64(0)));
                    return;     // dont want to continue until we finish the AttackStart method
                }

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

                // wake a wall minion
                if (uiWallMinionTimer <= uiDiff)
                {
                    instance->SetData(DATA_MINIONS, IN_PROGRESS);

                    uiWallMinionTimer = 10000;
                } else uiWallMinionTimer -= uiDiff;

                //If we are <66 summon the guardians
                if (!bGuardiansAwake && !HealthAbovePct(66))
                {
                    ActivateMinion(instance->GetData64(5), true);   // EarthenGuardian1
                    ActivateMinion(instance->GetData64(6), true);   // EarthenGuardian2
                    ActivateMinion(instance->GetData64(7), true);   // EarthenGuardian3
                    ActivateMinion(instance->GetData64(8), true);   // EarthenGuardian4
                    ActivateMinion(instance->GetData64(9), true);   // EarthenGuardian5
                    ActivateMinion(instance->GetData64(10), false); // EarthenGuardian6
                    me->MonsterYell(SAY_SUMMON, LANG_UNIVERSAL, 0);
                    DoPlaySoundToSet(me, SOUND_SUMMON);
                    bGuardiansAwake = true;
                }

                //If we are <33 summon the vault walkers
                if (!bVaultWalkersAwake && !HealthAbovePct(33))
                {
                    ActivateMinion(instance->GetData64(1), true);    // VaultWalker1
                    ActivateMinion(instance->GetData64(2), true);    // VaultWalker2
                    ActivateMinion(instance->GetData64(3), true);    // VaultWalker3
                    ActivateMinion(instance->GetData64(4), false);    // VaultWalker4
                    me->MonsterYell(SAY_SUMMON2, LANG_UNIVERSAL, 0);
                    DoPlaySoundToSet(me, SOUND_SUMMON2);
                    bVaultWalkersAwake = true;
                }

                if (uiTremorTimer <= uiDiff)
                {
                    //Cast
                    DoCast(me->getVictim(), SPELL_GROUND_TREMOR);

                    //45 seconds until we should cast this agian
                    uiTremorTimer  = 45000;
                } else uiTremorTimer  -= uiDiff;

                DoMeleeAttackIfReady();
            }
开发者ID:heros,项目名称:LasCore,代码行数:65,代码来源:boss_archaedas.cpp


示例4: UpdateAI

            void UpdateAI(uint32 uiDiff) override
            {
                // we're still doing awaken animation
                if (bWakingUp && iAwakenTimer >= 0)
                {
                    iAwakenTimer -= uiDiff;
                    return;        // dont do anything until we are done
                } else if (bWakingUp && iAwakenTimer <= 0)
                {
                    bWakingUp = false;
                    AttackStart(ObjectAccessor::GetUnit(*me, instance->GetGuidData(0)));
                    return;     // dont want to continue until we finish the AttackStart method
                }

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

                // wake a wall minion
                if (uiWallMinionTimer <= uiDiff)
                {
                    instance->SetData(DATA_MINIONS, IN_PROGRESS);

                    uiWallMinionTimer = 10000;
                } else uiWallMinionTimer -= uiDiff;

                //If we are <66 summon the guardians
                if (!bGuardiansAwake && !HealthAbovePct(66))
                {
                    ActivateMinion(instance->GetGuidData(5), true);   // EarthenGuardian1
                    ActivateMinion(instance->GetGuidData(6), true);   // EarthenGuardian2
                    ActivateMinion(instance->GetGuidData(7), true);   // EarthenGuardian3
                    ActivateMinion(instance->GetGuidData(8), true);   // EarthenGuardian4
                    ActivateMinion(instance->GetGuidData(9), true);   // EarthenGuardian5
                    ActivateMinion(instance->GetGuidData(10), false); // EarthenGuardian6
                    Talk(SAY_SUMMON_GUARDIANS);
                    bGuardiansAwake = true;
                }

                //If we are <33 summon the vault walkers
                if (!bVaultWalkersAwake && !HealthAbovePct(33))
                {
                    ActivateMinion(instance->GetGuidData(1), true);    // VaultWalker1
                    ActivateMinion(instance->GetGuidData(2), true);    // VaultWalker2
                    ActivateMinion(instance->GetGuidData(3), true);    // VaultWalker3
                    ActivateMinion(instance->GetGuidData(4), false);    // VaultWalker4
                    Talk(SAY_SUMMON_VAULT_WALKERS);
                    bVaultWalkersAwake = true;
                }

                if (uiTremorTimer <= uiDiff)
                {
                    //Cast
                    DoCastVictim(SPELL_GROUND_TREMOR);

                    //45 seconds until we should cast this agian
                    uiTremorTimer  = 45000;
                } else uiTremorTimer  -= uiDiff;

                DoMeleeAttackIfReady();
            }
开发者ID:mysql1,项目名称:TournamentCore,代码行数:61,代码来源:boss_archaedas.cpp


示例5: UpdateAI

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

                    //Check_Timer for the death of LorKhan and Zath.
                    if (!WasDead && Check_Timer <= diff)
                    {
                        if (m_pInstance)
                        {
                            if (m_pInstance->GetData(TYPE_LORKHAN) == SPECIAL)
                            {
                                //Resurrect LorKhan
                                if (Unit *pLorKhan = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_LORKHAN)))
                                {
                                    pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                    pLorKhan->setFaction(14);
                                    pLorKhan->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                    pLorKhan->SetFullHealth();

                                    m_pInstance->SetData(TYPE_LORKHAN, DONE);
                                }
                            }

                            if (m_pInstance->GetData(TYPE_ZATH) == SPECIAL)
                            {
                                //Resurrect Zath
                                Unit *pZath = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ZATH));
                                if (pZath)
                                {
                                    pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                    pZath->setFaction(14);
                                    pZath->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                    pZath->SetFullHealth();

                                    m_pInstance->SetData(TYPE_ZATH, DONE);
                                }
                            }
                        }

                        Check_Timer = 5000;
                    } else Check_Timer -= diff;

                    if (!PhaseTwo && MortalCleave_Timer <= diff)
                    {
                        DoCast(me->getVictim(), SPELL_MORTALCLEAVE);
                        MortalCleave_Timer = 15000 + rand()%5000;
                    } else MortalCleave_Timer -= diff;

                    if (!PhaseTwo && Silence_Timer <= diff)
                    {
                        DoCast(me->getVictim(), SPELL_SILENCE);
                        Silence_Timer = 20000 + rand()%5000;
                    } else Silence_Timer -= diff;

                    if (!PhaseTwo && !WasDead && !HealthAbovePct(5))
                    {
                        me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
                        me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        me->SetStandState(UNIT_STAND_STATE_SLEEP);
                        me->AttackStop();

                        if (m_pInstance)
                            m_pInstance->SetData(TYPE_THEKAL, SPECIAL);

                        WasDead=true;
                    }

                    //Thekal will transform to Tiger if he died and was not resurrected after 10 seconds.
                    if (!PhaseTwo && WasDead)
                    {
                        if (Resurrect_Timer <= diff)
                        {
                            DoCast(me, SPELL_TIGER_FORM);
                            me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
                            me->SetStandState(UNIT_STAND_STATE_STAND);
                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                            me->SetFullHealth();
                            const CreatureInfo *cinfo = me->GetCreatureInfo();
                            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);
                            DoResetThreat();
                            PhaseTwo = true;
                        } else Resurrect_Timer -= diff;
                    }

                    if (me->IsFullHealth() && WasDead)
                    {
                        WasDead = false;
                    }

                    if (PhaseTwo)
                    {
                        if (Charge_Timer <= diff)
                        {
                            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                            {
                                DoCast(pTarget, SPELL_CHARGE);
//.........这里部分代码省略.........
开发者ID:BoThay,项目名称:ArkCORE,代码行数:101,代码来源:boss_thekal.cpp


示例6: UpdateAI

        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
                return;

            if(phase == PHASE_CASTER_PHASE && !HealthAbovePct(30))
            {
                phase = PHASE_DRAGON_PHASE;
                me->SetSpeed(MOVE_RUN, 1.5f);
                me->SetReactState(REACT_PASSIVE);

                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                me->RemoveAllAuras(); // He should not die when he is jumping down...

                DoCast(me, SPELL_TWILIGHT_PROTECTION, true);

                events.Reset(); // He Should not cast while he is flying
                me->GetMotionMaster()->MovePoint(POINT_DRAHGA_GO_TO_THE_LAVA, position[0]);

                pValiona = me->SummonCreature(NPC_VALIONA,-375.33f,-667.291f,270.0f,3.29545f, TEMPSUMMON_CORPSE_DESPAWN);
            }

            if(phase == PHASE_DRAGON_PHASE && !HealthAbovePct(10))
            {
                phase = PHASE_FINAL_PHASE;

                me->SetReactState(REACT_AGGRESSIVE);
                me->GetMotionMaster()->Clear();
                me->GetMotionMaster()->MoveChase(me->getVictim());

                pValiona->GetAI()->DoAction(ACTION_VALIONA_SHOULD_FLY_AWAY);

                pValiona = NULL;

            }

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_BURNING_SHADOWBOLT:

                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                        DoCast(pTarget, RAID_MODE(SPELL_BURNING_SHADOWBOLT,SPELL_BURNING_SHADOWBOLT_H));

                    events.ScheduleEvent(EVENT_BURNING_SHADOWBOLT,4000);
                    break;
                case EVENT_SUMMON_INVOKED_FLAME_SPIRIT:

                    me->MonsterYell(SAY_SUMMON, LANG_UNIVERSAL, NULL);

                    DoCast(SPELL_INVOCATION_OF_FLAME);

                    events.ScheduleEvent(EVENT_SUMMON_INVOKED_FLAME_SPIRIT,20000);
                    break;

                case EVENT_DRAGAH_ENTER_VEHICLE:
                    me->GetMotionMaster()->Clear();

                    // me->EnterVehicle(pValiona, 1);
                    break;

                default:
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
开发者ID:Jackbogoss,项目名称:CataclysmScripts,代码行数:71,代码来源:boss_drahga_shadowburner.cpp


示例7: UpdateAI

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

                if (BerserkTimer <= diff)
                {
                    me->MonsterYell(YELL_BERSERK, LANG_UNIVERSAL, 0);
                    DoPlaySoundToSet(me, SOUND_BERSERK);
                    DoCast(me, SPELL_BERSERK, true);
                    BerserkTimer = 60000;
                } else BerserkTimer -= diff;

                if (Phase == PHASE_LYNX || Phase == PHASE_ENRAGE)
                {
                    if (SaberlashTimer <= diff)
                    {
                        // A tank with more than 490 defense skills should receive no critical hit
                        //DoCast(me, 41296, true);
                        DoCast(me->getVictim(), SPELL_SABER_LASH, true);
                        //me->RemoveAurasDueToSpell(41296);
                        SaberlashTimer = 30000;
                    } else SaberlashTimer -= diff;

                    if (FrenzyTimer <= diff)
                    {
                        DoCast(me, SPELL_FRENZY);
                        FrenzyTimer = urand(10000, 15000);
                    } else FrenzyTimer -= diff;

                    if (Phase == PHASE_LYNX)
                    {
                        if (CheckTimer <= diff)
                        {
                            if (HealthBelowPct(25 * (3 - TransformCount)))
                                EnterPhase(PHASE_SPLIT);
                            CheckTimer = 1000;
                        } else CheckTimer -= diff;
                    }
                }

                if (Phase == PHASE_HUMAN || Phase == PHASE_ENRAGE)
                {
                    if (TotemTimer <= diff)
                    {
                        DoCast(me, SPELL_SUMMON_TOTEM);
                        TotemTimer = 20000;
                    } else TotemTimer -= diff;

                    if (ShockTimer <= diff)
                    {
                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                        {
                            if (target->IsNonMeleeSpellCasted(false))
                                DoCast(target, SPELL_EARTHSHOCK);
                            else
                                DoCast(target, SPELL_FLAMESHOCK);
                            ShockTimer = urand(10000, 15000);
                        }
                    } else ShockTimer -= diff;

                    if (Phase == PHASE_HUMAN)
                    {
                        if (CheckTimer <= diff)
                        {
                            if (!HealthAbovePct(20) /*HealthBelowPct(10)*/)
                                EnterPhase(PHASE_MERGE);
                            else
                            {
                                Unit* Lynx = Unit::GetUnit(*me, LynxGUID);
                                if (Lynx && !Lynx->HealthAbovePct(20) /*Lynx->HealthBelowPct(10)*/)
                                    EnterPhase(PHASE_MERGE);
                            }
                            CheckTimer = 1000;
                        } else CheckTimer -= diff;
                    }
                }

                if (Phase == PHASE_MERGE)
                {
                    if (CheckTimer <= diff)
                    {
                        Unit* Lynx = Unit::GetUnit(*me, LynxGUID);
                        if (Lynx)
                        {
                            Lynx->GetMotionMaster()->MoveFollow(me, 0, 0);
                            me->GetMotionMaster()->MoveFollow(Lynx, 0, 0);
                            if (me->IsWithinDistInMap(Lynx, 6.0f))
                            {
                                if (TransformCount < 3)
                                    EnterPhase(PHASE_LYNX);
                                else
                                    EnterPhase(PHASE_ENRAGE);
                            }
                        }
                        CheckTimer = 1000;
                    } else CheckTimer -= diff;
                }

                DoMeleeAttackIfReady();
//.........这里部分代码省略.........
开发者ID:Carbinfibre,项目名称:Script-Land,代码行数:101,代码来源:boss_halazzi.cpp


示例8: UpdateAI


//.........这里部分代码省略.........
                                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                /*
                                const CreatureTemplate* 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->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, 40.0f, true); // hack
                                DoResetThreat();
                                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->GetData64(DATA_LORKHAN)))
                                    {
                                        pLorKhan->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                        pLorKhan->setFaction(14);
                                        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->GetData64(DATA_ZATH)))
                                    {
                                        pZath->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
                                        pZath->setFaction(14);
                                        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);
                                DoResetThreat();
                                AttackStart(target);
                            }
                            events.ScheduleEvent(EVENT_CHARGE, urand(15000, 22000), 0, PHASE_TWO);
                            break;
                        case EVENT_ENRAGE:
                            if (HealthBelowPct(11) && !Enraged)
                            {
                                DoCast(me, SPELL_ENRAGE);
                                Enraged = true;
                            }
                            events.ScheduleEvent(EVENT_ENRAGE, 30000);
                            break;
                        case EVENT_SUMMONTIGERS:
                            DoCastVictim(SPELL_SUMMONTIGERS, true);
                            events.ScheduleEvent(EVENT_SUMMONTIGERS, urand(10000, 14000), 0, PHASE_TWO);
                            break;
                        default:
                            break;
                    }

                    if (me->IsFullHealth() && WasDead)
                        WasDead = false;

                    if ((events.IsInPhase(PHASE_ONE)) && !WasDead && !HealthAbovePct(5))
                    {
                        me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
                        me->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
                        me->RemoveAurasByType(SPELL_AURA_PERIODIC_LEECH);
                        me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                        me->SetStandState(UNIT_STAND_STATE_SLEEP);
                        me->AttackStop();
                        instance->SetBossState(DATA_THEKAL, SPECIAL);
                        WasDead=true;
                    }
                }
                DoMeleeAttackIfReady();
            }
开发者ID:Allysia1,项目名称:TrinityCore,代码行数:101,代码来源:boss_thekal.cpp


示例9: UpdateAI

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

            if (WhirlWind)
            {
                if (WhirlWindRandom_Timer <= diff)
                {
                    //Attack random Gamers
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
                    {
                        AddThreat(target, 1.0f);
                        AttackStart(target);
                    }
                    WhirlWindRandom_Timer = urand(3000, 7000);
                } else WhirlWindRandom_Timer -= diff;

                if (WhirlWindEnd_Timer <= diff)
                {
                    WhirlWind = false;
                    WhirlWind_Timer = urand(25000, 40000);
                } else WhirlWindEnd_Timer -= diff;
            }

            if (!WhirlWind)
            {
                if (WhirlWind_Timer <= diff)
                {
                    DoCast(me, SPELL_WHIRLWIND);
                    WhirlWind = true;
                    WhirlWindEnd_Timer = 15000;
                } else WhirlWind_Timer -= diff;

                if (AggroReset_Timer <= diff)
                {
                    //Attack random Gamers
                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 100.0f, true))
                    {
                        AddThreat(target, 1.0f);
                        AttackStart(target);
                    }
                    AggroReset = true;
                    AggroReset_Timer = urand(2000, 5000);
                } else AggroReset_Timer -= diff;

                if (AggroReset)
                {
                    if (AggroResetEnd_Timer <= diff)
                    {
                        AggroReset = false;
                        AggroResetEnd_Timer = 5000;
                        AggroReset_Timer = urand(35000, 45000);
                    } else AggroResetEnd_Timer -= diff;
                }

                //If she is 20% enrage
                if (!Enraged)
                {
                    if (!HealthAbovePct(20) && !me->IsNonMeleeSpellCast(false))
                    {
                        DoCast(me, SPELL_ENRAGE);
                        Enraged = true;
                    }
                }

                //After 10 minutes hard enrage
                if (!EnragedHard)
                {
                    if (EnrageHard_Timer <= diff)
                    {
                        DoCast(me, SPELL_ENRAGEHARD);
                        EnragedHard = true;
                    } else EnrageHard_Timer -= diff;
                }

                DoMeleeAttackIfReady();
            }
        }
开发者ID:lasyan3,项目名称:TrinityCore,代码行数:80,代码来源:boss_sartura.cpp


示例10: UpdateAI

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

        /*START ACID-AI*/
            if (uiTrashTimer <= uiDiff)
            {
                if (bCheckChances())
                    DoCast(me, SPELL_TRASH);
                uiTrashTimer = urand(6000, 15500);
            } else uiTrashTimer -= uiDiff;

            if (uiSlamTimer <= uiDiff)
            {
                if (bCheckChances())
                    DoCast(me->getVictim(), SPELL_SMITE_SLAM);
                uiSlamTimer = 11000;
            } else uiSlamTimer -= uiDiff;

            if (uiNimbleReflexesTimer <= uiDiff)
            {
                if (bCheckChances())
                    DoCast(me, SPELL_NIMBLE_REFLEXES);
                uiNimbleReflexesTimer = urand(27300, 60100);
            } else uiNimbleReflexesTimer -= uiDiff;
        /*END ACID-AI*/

            if ((uiHealth == 0 && !HealthAbovePct(66)) || (uiHealth == 1 && !HealthAbovePct(33)))
            {
                ++uiHealth;
                DoCastAOE(SPELL_SMITE_STOMP, false);
                SetCombatMovement(false);
                if (pInstance)
                    if (GameObject* pGo = GameObject::GetGameObject((*me), pInstance->GetData64(DATA_SMITE_CHEST)))
                    {
                        me->GetMotionMaster()->Clear();
                        me->GetMotionMaster()->MovePoint(1, pGo->GetPositionX() - 3.0f, pGo->GetPositionY(), pGo->GetPositionZ());
                    }
            }

            if (uiPhase)
            {
                if (uiTimer <= uiDiff)
                {
                    switch(uiPhase)
                    {
                        case 1:
                            me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work?
                            uiTimer = 1000;
                            uiPhase = 2;
                            break;
                        case 2:
                            if (uiHealth == 1)
                                SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE);
                            else
                                SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
                            uiTimer = 500;
                            uiPhase = 3;
                            break;
                        case 3:
                            SetCombatMovement(true);
                            me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance);
                            uiPhase = 0;
                            break;

                    }
                } else uiTimer -= uiDiff;
            }

            DoMeleeAttackIfReady();
        }
开发者ID:Bootz,项目名称:Singularity,代码行数:72,代码来源:boss_mr_smite.cpp


示例11: UpdateAI

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

            if (m_bCanResurrect)
            {
                //When casting resuruction make sure to delay so on rez when reinstate battle deepsleep runs out
                if (m_instance && m_uiWait_Timer <= uiDiff)
                {
                    if (Unit* Mograine = Unit::GetUnit((*me), m_instance->GetData64(DATA_MOGRAINE)))
                    {
                        DoCast(Mograine, SPELL_SCARLETRESURRECTION);
                        DoScriptText(SAY_WH_RESSURECT, me);
                        m_bCanResurrect = false;
                    }
                }
                else m_uiWait_Timer -= uiDiff;
            }

            //Cast Deep sleep when health is less than 50%
            if (!m_bCanResurrectCheck && !HealthAbovePct(50))
            {
                if (me->IsNonMeleeSpellCasted(false))
                    me->InterruptNonMeleeSpells(false);

                DoCast(me->getVictim(), SPELL_DEEPSLEEP);
                m_bCanResurrectCheck = true;
                m_bCanResurrect = true;
                return;
            }

            //while in "resurrect-mode", don't do anything
            if (m_bCanResurrect)
                return;

            //If we are <75% hp cast healing spells at self or Mograine
            if (m_uiHeal_Timer <= uiDiff)
            {
                Creature* target = NULL;

                if (!HealthAbovePct(75))
                    target = me;

                if (m_instance)
                {
                    if (Creature* pMograine = Unit::GetCreature((*me), m_instance->GetData64(DATA_MOGRAINE)))
                    {
                        // checking m_bCanResurrectCheck prevents her healing Mograine while he is "faking death"
                        if (m_bCanResurrectCheck && pMograine->isAlive() && !pMograine->HealthAbovePct(75))
                            target = pMograine;
                    }
                }

                if (target)
                    DoCast(target, SPELL_HEAL);

                m_uiHeal_Timer = 13000;
            } else m_uiHeal_Timer -= uiDiff;

            //m_uiPowerWordShield_Timer
            if (m_uiPowerWordShield_Timer <= uiDiff)
            {
                DoCast(me, SPELL_POWERWORDSHIELD);
                m_uiPowerWordShield_Timer = 15000;
            } else m_uiPowerWordShield_Timer -= uiDiff;

            //m_uiHolySmite_Timer
            if (m_uiHolySmite_Timer <= uiDiff)
            {
                DoCast(me->getVictim(), SPELL_HOLYSMITE);
                m_uiHolySmite_Timer = 6000;
            } else m_uiHolySmite_Timer -= uiDiff;

            DoMeleeAttackIfReady();
        }
开发者ID:ALive-WoW,项目名称:RC2,代码行数:76,代码来源:boss_mograine_and_whitemane.cpp


示例12: UpdateAI

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

                    if (HealthAbovePct(50))
                    {
                        if (Dispell_Timer <= diff)
                        {
                            DoCast(me, SPELL_DISPELL);
                            Dispell_Timer = 15000 + rand()%15000;
                        } else Dispell_Timer -= diff;

                        if (Renew_Timer <= diff)
                        {
                            DoCast(me, SPELL_RENEW);
                            Renew_Timer = 20000 + rand()%10000;
                        } else Renew_Timer -= diff;

                        if (HolyWrath_Timer <= diff)
                        {
                            DoCast(me->getVictim(), SPELL_HOLY_WRATH);
                            HolyWrath_Timer = 15000 + rand()%10000;
                        } else HolyWrath_Timer -= diff;

                        if (HolyNova_Timer <= diff)
                        {
                            TargetInRange = 0;
                            for (uint8 i = 0; i < 10; ++i)
                            {
                                if (Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, i))
                                    if (me->IsWithinMeleeRange(pTarget))
                                        ++TargetInRange;
                            }

                            if (TargetInRange > 1)
                            {
                                DoCast(me->getVictim(), SPELL_HOLY_NOVA);
                                HolyNova_Timer = 1000;
                            }
                            else
                            {
                                HolyNova_Timer = 2000;
                            }

                        } else HolyNova_Timer -= diff;

                        if (HolyFire_Timer < diff && TargetInRange < 3)
                        {
                            if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
                                DoCast(pTarget, SPELL_HOLY_FIRE);

                            HolyFire_Timer = 8000;
                        } else HolyFire_Timer -= diff;
                    }
                    else
                    {
                        if (!PhaseTwo)
                        {
                            DoScriptText(SAY_TRANSFORM, me);
                            me->InterruptNonMeleeSpells(false);
                            DoCast(me, SPELL_SNAKE_FORM);
                            me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.00f);
                            const CreatureTemplate *cinfo = me->GetCreatureInfo();
                            me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 25)));
                            me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 25)));
                            me->UpdateDamagePhysical(BASE_ATTACK);
                            DoResetThreat();
                            PhaseTwo = true;
                        }

                        if (PhaseTwo && PoisonCloud_Timer <= diff)
                        {
                            DoCast(me->getVictim(), SPELL_POISON_CLOUD);
                            PoisonCloud_Timer = 15000;
                        }PoisonCloud_Timer -=diff;

                        if (PhaseTwo && VenomSpit_Timer <= diff)
                        {
                            if (Unit *pTarget = SelectTarget( 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ HealthBelowPct函数代码示例发布时间:2022-05-30
下一篇:
C++ Header_Fill_Size函数代码示例发布时间: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