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

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

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

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

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

示例1: UpdateAI

        void UpdateAI(const uint32 diff)        {            if(!UpdateVictim())                return;            if(CloseDoorTimer)            {                if(CloseDoorTimer <= diff)                {                    if(pInstance)                    {                        pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_LIBRARY_DOOR), false);                        CloseDoorTimer = 0;                    }                } else CloseDoorTimer -= diff;            }            //Cooldowns for casts            if(ArcaneCooldown)            {                if(ArcaneCooldown >= diff)                    ArcaneCooldown -= diff;            else ArcaneCooldown = 0;            }            if(FireCooldown)            {                if(FireCooldown >= diff)                    FireCooldown -= diff;            else FireCooldown = 0;            }            if(FrostCooldown)            {                if(FrostCooldown >= diff)                    FrostCooldown -= diff;            else FrostCooldown = 0;            }            if(!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20)            {                Drinking = true;                me->InterruptNonMeleeSpells(false);                DoScriptText(SAY_DRINK, me);                if(!DrinkInturrupted)                {                    DoCast(me, SPELL_MASS_POLY, true);                    DoCast(me, SPELL_CONJURE, false);                    DoCast(me, SPELL_DRINK, false);                    me->SetStandState(UNIT_STAND_STATE_SIT);                    DrinkInterruptTimer = 10000;                }            }            //Drink Interrupt            if(Drinking && DrinkInturrupted)            {                Drinking = false;                me->RemoveAurasDueToSpell(SPELL_DRINK);                me->SetStandState(UNIT_STAND_STATE_STAND);                me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000);                DoCast(me, SPELL_POTION, false);            }            //Drink Interrupt Timer            if(Drinking && !DrinkInturrupted)            {                if(DrinkInterruptTimer >= diff)                    DrinkInterruptTimer -= diff;                else                {                    me->SetStandState(UNIT_STAND_STATE_STAND);                    DoCast(me, SPELL_POTION, true);                    DoCast(me, SPELL_AOE_PYROBLAST, false);                    DrinkInturrupted = true;                    Drinking = false;                }            }            //Don't execute any more code if we are drinking            if(Drinking)                return;            //Normal casts            if(NormalCastTimer <= diff)            {                if(!me->IsNonMeleeSpellCasted(false))                {                    Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);                    if(!target)                        return;                    uint32 Spells[3];                    uint8 AvailableSpells = 0;                    //Check for what spells are not on cooldown                    if(!ArcaneCooldown)                    {//.........这里部分代码省略.........
开发者ID:Darkelmo,项目名称:MythCore,代码行数:101,


示例2: UpdateAI

        void UpdateAI(const uint32 diff)        {            //Check if we have a target            if (!UpdateVictim())                return;            //No instance            if (!instance)                return;            uint32 currentPhase = instance->GetData(DATA_CTHUN_PHASE);            if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM)            {                // EyeTentacleTimer                if (EyeTentacleTimer <= diff)                {                    //Spawn the 8 Eye Tentacles in the corret spots                    SpawnEyeTentacle(0, 20);                //south                    SpawnEyeTentacle(10, 10);               //south west                    SpawnEyeTentacle(20, 0);                //west                    SpawnEyeTentacle(10, -10);              //north west                    SpawnEyeTentacle(0, -20);               //north                    SpawnEyeTentacle(-10, -10);             //north east                    SpawnEyeTentacle(-20, 0);               // east                    SpawnEyeTentacle(-10, 10);              // south east                    EyeTentacleTimer = 45000;                } else EyeTentacleTimer -= diff;            }            switch (currentPhase)            {                case PHASE_EYE_GREEN_BEAM:                    //BeamTimer                    if (BeamTimer <= diff)                    {                        //SPELL_GREEN_BEAM                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                        {                            me->InterruptNonMeleeSpells(false);                            DoCast(target, SPELL_GREEN_BEAM);                            //Correctly update our target                            me->SetTarget(target->GetGUID());                        }                        //Beam every 3 seconds                        BeamTimer = 3000;                    } else BeamTimer -= diff;                    //ClawTentacleTimer                    if (ClawTentacleTimer <= diff)                    {                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                        {                            Creature* Spawned = NULL;                            //Spawn claw tentacle on the random target                            Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *target, TEMPSUMMON_CORPSE_DESPAWN, 500);                            if (Spawned && Spawned->AI())                                Spawned->AI()->AttackStart(target);                        }                        //One claw tentacle every 12.5 seconds                        ClawTentacleTimer = 12500;                    } else ClawTentacleTimer -= diff;                    //PhaseTimer                    if (PhaseTimer <= diff)                    {                        //Switch to Dark Beam                        instance->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM);                        me->InterruptNonMeleeSpells(false);                        me->SetReactState(REACT_PASSIVE);                        //Remove any target                        me->SetTarget(0);                        //Select random target for dark beam to start on                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                        {                            //Face our target                            DarkGlareAngle = me->GetAngle(target);                            DarkGlareTickTimer = 1000;                            DarkGlareTick = 0;                            ClockWise = RAND(true, false);                        }                        //Add red coloration to C'thun                        DoCast(me, SPELL_RED_COLORATION, true);                        //Freeze animation                        DoCast(me, SPELL_FREEZE_ANIM);                        me->SetOrientation(DarkGlareAngle);                        me->StopMoving();                        me->GetMotionMaster()->MoveRotate(35000, ClockWise ? ROTATE_DIRECTION_LEFT : ROTATE_DIRECTION_RIGHT);//.........这里部分代码省略.........
开发者ID:AtVirus,项目名称:Tenerby,代码行数:101,


示例3: UpdateAI

        void UpdateAI(uint32 uiDiff) override        {            if (!UpdateVictim())                return;            //START NOT TRANSFORMED            if (!m_bTransformed)            {                //MindBlast                if (m_uiMindBlast_Timer <= uiDiff)                {                    DoCastVictim(SPELL_MINDBLAST);                    m_uiMindBlast_Timer = urand(15000, 20000);                } else m_uiMindBlast_Timer -= uiDiff;                //CrusadersHammer                if (m_uiCrusadersHammer_Timer <= uiDiff)                {                    DoCastVictim(SPELL_CRUSADERSHAMMER);                    m_uiCrusadersHammer_Timer = 12000;                } else m_uiCrusadersHammer_Timer -= uiDiff;                //CrusaderStrike                if (m_uiCrusaderStrike_Timer <= uiDiff)                {                    DoCastVictim(SPELL_CRUSADERSTRIKE);                    m_uiCrusaderStrike_Timer = 15000;                } else m_uiCrusaderStrike_Timer -= uiDiff;                //HolyStrike                if (m_uiHolyStrike_Timer <= uiDiff)                {                    DoCastVictim(SPELL_HOLYSTRIKE);                    m_uiHolyStrike_Timer = 15000;                } else m_uiHolyStrike_Timer -= uiDiff;                //BalnazzarTransform                if (HealthBelowPct(40))                {                    if (me->IsNonMeleeSpellCast(false))                        me->InterruptNonMeleeSpells(false);                    //restore hp, mana and stun                    DoCast(me, SPELL_BALNAZZARTRANSFORM);                    me->UpdateEntry(NPC_BALNAZZAR);                    m_bTransformed = true;                }            }            else            {                //MindBlast                if (m_uiMindBlast_Timer <= uiDiff)                {                    DoCastVictim(SPELL_MINDBLAST);                    m_uiMindBlast_Timer = urand(15000, 20000);                } else m_uiMindBlast_Timer -= uiDiff;                //ShadowShock                if (m_uiShadowShock_Timer <= uiDiff)                {                    DoCastVictim(SPELL_SHADOWSHOCK);                    m_uiShadowShock_Timer = 11000;                } else m_uiShadowShock_Timer -= uiDiff;                //PsychicScream                if (m_uiPsychicScream_Timer <= uiDiff)                {                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                        DoCast(target, SPELL_PSYCHICSCREAM);                    m_uiPsychicScream_Timer = 20000;                } else m_uiPsychicScream_Timer -= uiDiff;                //DeepSleep                if (m_uiDeepSleep_Timer <= uiDiff)                {                    if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                        DoCast(target, SPELL_SLEEP);                    m_uiDeepSleep_Timer = 15000;                } else m_uiDeepSleep_Timer -= uiDiff;                //MindControl                if (m_uiMindControl_Timer <= uiDiff)                {                    DoCastVictim(SPELL_MINDCONTROL);                    m_uiMindControl_Timer = 15000;                } else m_uiMindControl_Timer -= uiDiff;            }            DoMeleeAttackIfReady();        }
开发者ID:Arkania,项目名称:ArkCORE-NG,代码行数:92,


示例4: UpdateAI

        void UpdateAI(uint32 const diff)        {            if(!UpdateVictim() || !CheckInRoom())                return;            events.Update(diff);            if(me->HasUnitState(UNIT_STAT_CASTING))                return;            while(uint32 eventId = events.ExecuteEvent())            {                switch(eventId)                {                case EVENT_INHALE_BLIGHT:                {                    RemoveBlight();                    if(_inhaleCounter == 3)                    {                        Talk(EMOTE_WARN_PUNGENT_BLIGHT);                        Talk(SAY_PUNGENT_BLIGHT);                        DoCast(me, SPELL_PUNGENT_BLIGHT);                        _inhaleCounter = 0;                        if(Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_PROFESSOR_PUTRICIDE)))                            professor->AI()->DoAction(ACTION_FESTERGUT_GAS);                        events.RescheduleEvent(EVENT_GAS_SPORE, urand(20000, 25000));                    }                    else                    {                        DoCast(me, SPELL_INHALE_BLIGHT);                        // just cast and dont bother with target, conditions will handle it                        ++_inhaleCounter;                        if(_inhaleCounter < 3)                            me->CastSpell(me, gaseousBlight[_inhaleCounter], true, NULL, NULL, me->GetGUID());                    }                    events.ScheduleEvent(EVENT_INHALE_BLIGHT, urand(33500, 35000));                    break;                }                case EVENT_VILE_GAS:                {                    std::list<Unit*> targets;                    uint32 minTargets = RAID_MODE<uint32>(3, 8, 3, 8);                    SelectTargetList(targets, minTargets, SELECT_TARGET_RANDOM, -10.0f, true);                    float minDist = 0.0f;                    if(targets.size() >= minTargets)                        minDist = -15.0f;                    if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, minDist, true))                        DoCast(target, SPELL_VILE_GAS);                    events.ScheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));                    break;                }                case EVENT_GAS_SPORE:                    Talk(EMOTE_WARN_GAS_SPORE);                    Talk(EMOTE_GAS_SPORE);                    me->CastCustomSpell(SPELL_GAS_SPORE, SPELLVALUE_MAX_TARGETS, RAID_MODE<int32>(2, 3, 2, 3), me);                    events.ScheduleEvent(EVENT_GAS_SPORE, urand(40000, 45000));                    events.RescheduleEvent(EVENT_VILE_GAS, urand(28000, 35000));                    break;                case EVENT_GASTRIC_BLOAT:                    DoCastVictim(SPELL_GASTRIC_BLOAT);                    events.ScheduleEvent(EVENT_GASTRIC_BLOAT, urand(15000, 17500));                    break;                case EVENT_BERSERK:                    DoCast(me, SPELL_BERSERK2);                    Talk(SAY_BERSERK);                    break;                default:                    break;                }            }            DoMeleeAttackIfReady();        }
开发者ID:FreedomEmu,项目名称:FreedomEmu,代码行数:75,


示例5: UpdateAI

            void UpdateAI(const uint32 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 = SelectUnit(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 = SelectUnit(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 CreatureInfo *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 = SelectUnit(SELECT_TARGET_RANDOM, 0))                                DoCast(pTarget, SPELL_VENOMSPIT);                            VenomSpit_Timer = 15000 + rand()%5000;                        } else VenomSpit_Timer -= diff;                        if (PhaseTwo && HealthBelowPct(11))                        {                            if (!InBerserk)                            {                                me->InterruptNonMeleeSpells(false);                                DoCast(me, SPELL_BERSERK);                                InBerserk = true;                            }                        }                    }                    DoMeleeAttackIfReady();            }
开发者ID:FrenchCORE,项目名称:OLD_FrenchCORE,代码行数:96,


示例6: UpdateAI

        void UpdateAI(const uint32 diff)        {            if (!CanAttack && Intro)            {                if (AggroTimer <= diff)                {                    CanAttack = true;                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);                    AggroTimer=19000;                }else                {                    AggroTimer-=diff;                    return;                }            }            //to prevent abuses during phase 2            if (Phase == 2 && !me->getVictim() && me->isInCombat())            {                EnterEvadeMode();                return;            }            //Return since we have no target            if (!UpdateVictim())                return;            if (Phase == 1 || Phase == 3)            {                //ShockBlast_Timer                if (ShockBlast_Timer <= diff)                {                    //Shock Burst                    //Randomly used in Phases 1 and 3 on Vashj's target, it's a Shock spell doing 8325-9675 nature damage and stunning the target for 5 seconds, during which she will not attack her target but switch to the next person on the aggro list.                    DoCast(me->getVictim(), SPELL_SHOCK_BLAST);                    me->TauntApply(me->getVictim());                    ShockBlast_Timer = 1000+rand()%14000;       //random cooldown                } else ShockBlast_Timer -= diff;                //StaticCharge_Timer                if (StaticCharge_Timer <= diff)                {                    //Static Charge                    //Used on random people (only 1 person at any given time) in Phases 1 and 3, it's a debuff doing 2775 to 3225 Nature damage to the target and everybody in about 5 yards around it, every 1 seconds for 30 seconds. It can be removed by Cloak of Shadows, Iceblock, Divine Shield, etc, but not by Cleanse or Dispel Magic.                    Unit *pTarget = NULL;                    pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true);                    if (pTarget && !pTarget->HasAura(SPELL_STATIC_CHARGE_TRIGGER))                                                                //cast Static Charge every 2 seconds for 20 seconds                            DoCast(pTarget, SPELL_STATIC_CHARGE_TRIGGER);                    StaticCharge_Timer = 10000+rand()%20000;    //blizzlike                } else StaticCharge_Timer -= diff;                //Entangle_Timer                if (Entangle_Timer <= diff)                {                    if (!Entangle)                    {                        //Entangle                        //Used in Phases 1 and 3, it casts Entangling Roots on everybody in a 15 yard radius of Vashj, immobilzing them for 10 seconds and dealing 500 damage every 2 seconds. It's not a magic effect so it cannot be dispelled, but is removed by various buffs such as Cloak of Shadows or Blessing of Freedom.                        DoCast(me->getVictim(), SPELL_ENTANGLE);                        Entangle = true;                        Entangle_Timer = 10000;                    }                    else                    {                        CastShootOrMultishot();                        Entangle = false;                        Entangle_Timer = 20000+rand()%5000;                    }                } else Entangle_Timer -= diff;                //Phase 1                if (Phase == 1)                {                    //Start phase 2                    if (HealthBelowPct(70))                    {                        //Phase 2 begins when Vashj hits 70%. She will run to the middle of her platform and surround herself in a shield making her invulerable.                        Phase = 2;                        me->GetMotionMaster()->Clear();                        DoTeleportTo(MIDDLE_X, MIDDLE_Y, MIDDLE_Z);                        Creature *pCreature;                        for (uint8 i = 0; i < 4; ++i)                        {                            pCreature = me->SummonCreature(SHIED_GENERATOR_CHANNEL, ShieldGeneratorChannelPos[i][0],  ShieldGeneratorChannelPos[i][1],  ShieldGeneratorChannelPos[i][2],  ShieldGeneratorChannelPos[i][3], TEMPSUMMON_CORPSE_DESPAWN, 0);                            if (pCreature)                                ShieldGeneratorChannel[i] = pCreature->GetGUID();                        }                        DoScriptText(SAY_PHASE2, me);                    }                }                //Phase 3                else                {                    //SummonSporebat_Timer                    if (SummonSporebat_Timer <= diff)                    {//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:StrawberryCore,代码行数:101,


示例7: UpdateAI

    void UpdateAI(const uint32 diff)    {        if (IsNihil)        {            if (NihilSpeech_Phase)            {                if (NihilSpeech_Timer <= diff)                {                    switch(NihilSpeech_Phase)                    {                        case 1:                            DoScriptText(SAY_NIHIL_1, me);                            ++NihilSpeech_Phase;                            break;                        case 2:                            DoScriptText(SAY_NIHIL_2, me);                            ++NihilSpeech_Phase;                            break;                        case 3:                            DoScriptText(SAY_NIHIL_3, me);                            ++NihilSpeech_Phase;                            break;                        case 4:                            DoScriptText(SAY_NIHIL_4, me);                            ++NihilSpeech_Phase;                            break;                        case 5:                            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                                                            // + MOVEFLAG_LEVITATING                            me->AddUnitMovementFlag(MOVEFLAG_ONTRANSPORT);                            //then take off to random location. creature is initially summoned, so don't bother do anything else.                            me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+100, me->GetPositionY(), me->GetPositionZ()+100);                            NihilSpeech_Phase = 0;                            break;                    }                    NihilSpeech_Timer = 5000;                } else NihilSpeech_Timer -=diff;            }            return;                                         //anything below here is not interesting for Nihil, so skip it        }        if (!UpdateVictim())            return;        if (IntangiblePresence_Timer <= diff)        {            DoCast(me->getVictim(),SPELL_INTANGIBLE_PRESENCE);            IntangiblePresence_Timer = 15000+rand()%15000;        } else IntangiblePresence_Timer -= diff;        if (ManaBurn_Timer <= diff)        {            Unit* pTarget = me->getVictim();            if (pTarget && pTarget->getPowerType() == POWER_MANA)                DoCast(pTarget,SPELL_MANA_BURN);            ManaBurn_Timer = 8000+rand()%8000;        } else ManaBurn_Timer -= diff;        if (ArcaneBlast_Timer <= diff)        {            DoCast(me->getVictim(),SPELL_ARCANE_BLAST);            ArcaneBlast_Timer = 2500+rand()%5000;        } else ArcaneBlast_Timer -= diff;        DoMeleeAttackIfReady();    }
开发者ID:FirstCore,项目名称:Battle_2.4.3,代码行数:66,


示例8: EnterEvadeMode

 // Override Evade Mode event, recast buff that was removed by standard handler void EnterEvadeMode() override {     npc_escortAI::EnterEvadeMode();     DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true); }
开发者ID:beyourself,项目名称:LordPsyanBots,代码行数:6,


示例9: UpdateAI

        void UpdateAI(uint32 diff) override        {            events.Update(diff);            while (uint32 eventId = events.ExecuteEvent())            {                switch (eventId)                {                    case EVENT_BARADAS_TALK:                        switch (step)                        {                            case 0:                                me->SetFacingTo(1.513286f);                                me->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 3000);                                step++;                                break;                            case 1:                                DoCast(SPELL_BARADAS_COMMAND);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);                                step++;                                break;                            case 2:                                Talk(SAY_BARADA_3);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 7000);                                step++;                                break;                            case 3:                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->Talk(SAY_JULES_2);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 18000);                                step++;                                break;                            case 4:                                DoCast(SPELL_BARADA_FALTERS);                                me->HandleEmoteCommand(EMOTE_STAND_STATE_NONE);                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->DoAction(ACTION_JULES_HOVER);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 11000);                                step++;                                break;                            case 5:                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->Talk(SAY_JULES_3);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 13000);                                step++;                                break;                            case 6:                                Talk(SAY_BARADA_4);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);                                step++;                                break;                            case 7:                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->Talk(SAY_JULES_3);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 13000);                                step++;                                break;                            case 8:                                Talk(SAY_BARADA_4);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 12000);                                step++;                                break;                            case 9:                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->Talk(SAY_JULES_4);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 12000);                                step++;                                break;                            case 10:                                Talk(SAY_BARADA_4);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 5000);                                step++;                                break;                            case 11:                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->DoAction(ACTION_JULES_FLIGHT);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);                                step++;                                break;                            case 12:                                if (Creature* jules = ObjectAccessor::GetCreature(*me, julesGUID))                                    jules->AI()->Talk(SAY_JULES_4);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 8000);                                step++;                                break;                            case 13:                                Talk(SAY_BARADA_5);                                events.ScheduleEvent(EVENT_BARADAS_TALK, 10000);                                step++;                                break;//.........这里部分代码省略.........
开发者ID:beyourself,项目名称:LordPsyanBots,代码行数:101,


示例10: UpdateAI

        void UpdateAI(const uint32 diff)        {            if (ghost)            {                if (instance && instance->GetData(DATA_SKARVALD_DALRONN_EVENT) != IN_PROGRESS)                    me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);            }            if (!UpdateVictim())                return;            if (AggroYell_Timer)            {                if (AggroYell_Timer <= diff)                {                    DoScriptText(YELL_DALRONN_AGGRO, me);                    AggroYell_Timer = 0;                } else AggroYell_Timer -= diff;            }            if (!ghost)            {                if (Check_Timer)                {                    if (Check_Timer <= diff)                    {                        Check_Timer = 5000;                        Unit* skarvald = Unit::GetUnit(*me, instance ? instance->GetData64(DATA_SKARVALD) : 0);                        if (skarvald && skarvald->isDead())                        {                            Skarvald_isDead = true;                            Response_Timer = 2000;                            Check_Timer = 0;                        }                    } else Check_Timer -= diff;                }                if (Response_Timer && Skarvald_isDead)                {                    if (Response_Timer <= diff)                    {                        DoScriptText(YELL_DALRONN_SKA_DIEDFIRST, me);                        Response_Timer = 0;                    } else Response_Timer -= diff;                }            }            if (ShadowBolt_Timer <= diff)            {                if (!me->IsNonMeleeSpellCasted(false))                {                    DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_SHADOW_BOLT);                    ShadowBolt_Timer = 2100;//give a 100ms pause to try cast other spells                }            } else ShadowBolt_Timer -= diff;            if (Debilitate_Timer <= diff)            {                if (!me->IsNonMeleeSpellCasted(false))                {                    DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0), SPELL_DEBILITATE);                    Debilitate_Timer = 5000+rand()%5000;                }            } else Debilitate_Timer -= diff;            if (IsHeroic())            {                if (Summon_Timer <= diff)                {                    if (!me->IsNonMeleeSpellCasted(false))                    {                        DoCast(me, H_SPELL_SUMMON_SKELETONS);                        Summon_Timer = (rand()%10000) + 20000;                    }                } else Summon_Timer -= diff;            }            DoMeleeAttackIfReady();        }
开发者ID:AwkwardDev,项目名称:Darkcore-Rebase,代码行数:80,


示例11: UpdateAI

        void UpdateAI(const uint32 uiDiff)        {            //Return since we have no target            if (!UpdateVictim())                return;            if (bEventInProgress)            {                if (uiResurrectTimer <= uiDiff)                {                    me->SetFullHealth();                    DoCast(me, SPELL_BLACK_KNIGHT_RES, true);                    uiPhase++;                    uiResurrectTimer = 4000;                    bEventInProgress = false;                    me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);                } else uiResurrectTimer -= uiDiff;            }            switch (uiPhase)            {            case PHASE_UNDEAD:            case PHASE_SKELETON:            {                if (uiIcyTouchTimer <= uiDiff)                {                    DoCastVictim(SPELL_ICY_TOUCH);                    uiIcyTouchTimer = urand(5000, 7000);                } else uiIcyTouchTimer -= uiDiff;                if (uiPlagueStrikeTimer <= uiDiff)                {                    DoCastVictim(SPELL_ICY_TOUCH);                    uiPlagueStrikeTimer = urand(12000, 15000);                } else uiPlagueStrikeTimer -= uiDiff;                if (uiObliterateTimer <= uiDiff)                {                    DoCastVictim(SPELL_OBLITERATE);                    uiObliterateTimer = urand(17000, 19000);                } else uiObliterateTimer -= uiDiff;                switch (uiPhase)                {                case PHASE_UNDEAD:                {                    if (uiDeathRespiteTimer <= uiDiff)                    {                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))                        {                            if (target && target->isAlive())                                DoCast(target, SPELL_DEATH_RESPITE);                        }                        uiDeathRespiteTimer = urand(15000, 16000);                    } else uiDeathRespiteTimer -= uiDiff;                    break;                }                case PHASE_SKELETON:                {                    if (!bSummonArmy)                    {                        bSummonArmy = true;                        me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);                        DoCast(me, SPELL_ARMY_DEAD);                    }                    if (!bDeathArmyDone)                    {                        if (uiDeathArmyCheckTimer <= uiDiff)                        {                            me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED);                            uiDeathArmyCheckTimer = 0;                            bDeathArmyDone = true;                        } else uiDeathArmyCheckTimer -= uiDiff;                    }                    if (uiDesecration <= uiDiff)                    {                        if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))                        {                            if (target && target->isAlive())                                DoCast(target, SPELL_DESECRATION);                        }                        uiDesecration = urand(15000, 16000);                    } else uiDesecration -= uiDiff;                    if (uiGhoulExplodeTimer <= uiDiff)                    {                        DoCast(me, SPELL_GHOUL_EXPLODE);                        uiGhoulExplodeTimer = 8000;                    } else uiGhoulExplodeTimer -= uiDiff;                    break;                }                break;                }                break;            }            case PHASE_GHOST:            {                if (uiDeathBiteTimer <= uiDiff)                {                    DoCastAOE(SPELL_DEATH_BITE);                    uiDeathBiteTimer = urand (2000, 4000);                } else uiDeathBiteTimer -= uiDiff;                if (uiMarkedDeathTimer <= uiDiff)                {//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:InfinityCore,代码行数:101,


示例12: UpdateAI

    void UpdateAI(const uint32 diff)    {        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())            return;        if (AppearDelay)        {            m_creature->StopMoving();            m_creature->AttackStop();            if (AppearDelay_Timer < diff)            {                AppearDelay = false;                if (Phase == 2)                {                    m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                    m_creature->SetVisibility(VISIBILITY_OFF);                }                AppearDelay_Timer = 2000;            }else AppearDelay_Timer -= diff;        }        if (Phase == 1)        {            //ArcaneMissiles_Timer            if (ArcaneMissiles_Timer < diff)            {                //Solarian casts Arcane Missiles on on random targets in the raid.                Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);                if (target && !m_creature->HasInArc(2.5f, target))                    target = m_creature->getVictim();                if (target)                    DoCast(target, SPELL_ARCANE_MISSILES);                ArcaneMissiles_Timer = 3000;            }else ArcaneMissiles_Timer -= diff;            //Wrath of the Astromancer targets a random player which will explode after 6 secondes            if (m_uiWrathOfTheAstromancer_Timer < diff)            {                m_creature->InterruptNonMeleeSpells(false);                //Target the tank ?                if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))                {                    if (pTarget->GetTypeId() == TYPEID_PLAYER)                    {                        DoCast(pTarget, SPELL_WRATH_OF_THE_ASTROMANCER);                        m_uiWrathOfTheAstromancer_Timer = 25000;                    }                    else                        m_uiWrathOfTheAstromancer_Timer = 1000;                }            }else m_uiWrathOfTheAstromancer_Timer -= diff;            //BlindingLight_Timer            if (BlindingLight_Timer < diff)            {                //She casts this spell every 45 seconds. It is a kind of Moonfire spell, which she strikes down on the whole raid simultaneously. It hits everyone in the raid for 2280 to 2520 arcane damage.                DoCast(m_creature->getVictim(), SPELL_BLINDING_LIGHT);                BlindingLight_Timer = 45000;            }else BlindingLight_Timer -= diff;            //Phase1_Timer            if (Phase1_Timer < diff)            {                Phase = 2;                Phase1_Timer = 50000;                //After these 50 seconds she portals to the middle of the room and disappears, leaving 3 light portals behind.                m_creature->GetMotionMaster()->Clear();                m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, CENTER_Z, CENTER_O);                for(int i = 0; i <= 2; ++i)                {                    if (!i)                    {                        Portals[i][0] = Portal_X(SMALL_PORTAL_RADIUS);                        Portals[i][1] = Portal_Y(Portals[i][0], SMALL_PORTAL_RADIUS);                        Portals[i][2] = CENTER_Z;                    }                    else                    {                        Portals[i][0] = Portal_X(LARGE_PORTAL_RADIUS);                        Portals[i][1] = Portal_Y(Portals[i][0], LARGE_PORTAL_RADIUS);                        Portals[i][2] = PORTAL_Z;                    }                }                if ((abs(int(Portals[2][0]) - int(Portals[1][0])) < 7) && (abs(int(Portals[2][1]) - int(Portals[1][1])) < 7))                {                    int i = 1;                    if (abs(int(CENTER_X) + int(26.0f) - int(Portals[2][0])) < 7)                        i = -1;                    Portals[2][0] = Portals[2][0]+7*i;                    Portals[2][1] = Portal_Y(Portals[2][0], LARGE_PORTAL_RADIUS);                }//.........这里部分代码省略.........
开发者ID:RareSoul,项目名称:andeeria,代码行数:101,


示例13: UpdateAI

        void UpdateAI(const uint32 diff)        {            //Only if not incombat check if the event is started            if (!me->isInCombat() && instance && instance->GetData(DATA_MAULGAREVENT))            {                Unit* target = Unit::GetUnit(*me, instance->GetData64(DATA_MAULGAREVENT_TANK));                if (target)                {                    AttackStart(target);                }            }            //Return since we have no target            if (!UpdateVictim())                return;            //someone evaded!            if (instance && !instance->GetData(DATA_MAULGAREVENT))            {                EnterEvadeMode();                return;            }            //GreaterFireball_Timer            if (GreaterFireball_Timer < diff || me->IsWithinDist(me->GetVictim(), 30))            {                DoCastVictim(SPELL_GREATER_FIREBALL);                GreaterFireball_Timer = 2000;            } else GreaterFireball_Timer -= diff;            //SpellShield_Timer            if (SpellShield_Timer <= diff)            {                me->InterruptNonMeleeSpells(false);                DoCastVictim(SPELL_SPELLSHIELD);                SpellShield_Timer = 30000;            } else SpellShield_Timer -= diff;            //BlastWave_Timer            if (BlastWave_Timer <= diff)            {                Unit* target = NULL;                std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();                std::vector<Unit*> target_list;                for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)                {                    target = Unit::GetUnit(*me, (*itr)->getUnitGuid());                                                                //15 yard radius minimum                    if (target && target->IsWithinDist(me, 15, false))                        target_list.push_back(target);                    target = NULL;                }                if (!target_list.empty())                    target = *(target_list.begin()+rand()%target_list.size());                me->InterruptNonMeleeSpells(false);                DoCast(target, SPELL_BLAST_WAVE);                BlastWave_Timer = 60000;            } else BlastWave_Timer -= diff;        }
开发者ID:P-Kito,项目名称:InfinityCore,代码行数:61,


示例14: UpdateAI

    void UpdateAI(const uint32 diff)    {        if (IsEvent)        {            //Must update npc_escortAI            npc_escortAI::UpdateAI(diff);            if(!go)            {                go = true;                if(pInstance)                {                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(0, 5492.91,    -2404.61,    1462.63);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(1, 5531.76,    -2460.87,    1469.55);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(2, 5554.58,    -2514.66,    1476.12);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(3, 5554.16,    -2567.23,    1479.90);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(4, 5540.67,    -2625.99,    1480.89);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(5, 5508.16,    -2659.2,    1480.15);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(6, 5489.62,    -2704.05,    1482.18);                    ((npc_escortAI*)(m_creature->AI()))->AddWaypoint(7, 5457.04,    -2726.26,    1485.10);                    ((npc_escortAI*)(m_creature->AI()))->Start(false, true, true);                    ((npc_escortAI*)(m_creature->AI()))->SetDespawnAtEnd(false);                }            }        }        //Return since we have no target        if (!UpdateVictim() )            return;        if(RainTimer < diff)        {            DoCast(SelectUnit(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE);            RainTimer = 20000+rand()%15000;        }else RainTimer -= diff;        if(DoomTimer < diff)        {            DoCast(SelectUnit(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank            DoomTimer = 45000+rand()%5000;        }else DoomTimer -= diff;        if(HowlTimer < diff)        {            DoCast(m_creature, SPELL_HOWL_OF_AZGALOR);            HowlTimer = 30000;        }else HowlTimer -= diff;        if(CleaveTimer < diff)        {            DoCast(m_creature->getVictim(), SPELL_CLEAVE);            CleaveTimer = 10000+rand()%5000;        }else CleaveTimer -= diff;        if(EnrageTimer < diff && !enraged)        {            m_creature->InterruptNonMeleeSpells(false);            DoCast(m_creature, SPELL_BERSERK, true);            enraged = true;            EnrageTimer = 600000;        }else EnrageTimer -= diff;        DoMeleeAttackIfReady();    }
开发者ID:adan830,项目名称:QuaDCore,代码行数:63,


示例15: Reset

 void Reset() {     BossAI::Reset();     DoCast(me, SPELL_MAGMASPLASH, true); }
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:5,


示例16: UpdateAI

        void UpdateAI(const uint32 uiDiff)        {            //Return since we have no target            if (!UpdateVictim())                return;            if (bEventInProgress)            {                if (uiResurrectTimer <= uiDiff)                {                        me->SetHealth(me->GetMaxHealth());                        me->AttackStop();                        switch(uiPhase)                        {                            case PHASE_UNDEAD:                                DoScriptText(SAY_DEATH_1, me);                                break;                            case PHASE_SKELETON:                                DoScriptText(SAY_DEATH, me);                                break;                        }                    DoCast(me,SPELL_BLACK_KNIGHT_RES,true);                        me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);                    uiPhase++;                    uiResurrectTimer = 4000;                    bEventInProgress = false;                    me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);                } else uiResurrectTimer -= uiDiff;            }            switch(uiPhase)            {                case PHASE_UNDEAD:                case PHASE_SKELETON:                {                    if (uiIcyTouchTimer <= uiDiff)                    {                        if (IsHeroic())                            DoCastVictim(SPELL_ICY_TOUCH_H);                        else                            DoCastVictim(SPELL_ICY_TOUCH);                        uiIcyTouchTimer = urand(5000,7000);                    } else uiIcyTouchTimer -= uiDiff;                    if (uiPlagueStrikeTimer <= uiDiff)                    {                        if (IsHeroic())                            DoCastVictim(SPELL_PLAGUE_STRIKE);                        else                            DoCastVictim(SPELL_PLAGUE_STRIKE_H);                        uiPlagueStrikeTimer = urand(12000,15000);                    } else uiPlagueStrikeTimer -= uiDiff;                    if (uiObliterateTimer <= uiDiff)                    {                        if (IsHeroic())                            DoCastVictim(SPELL_OBLITERATE_H);                        else                            DoCastVictim(SPELL_OBLITERATE);                        uiObliterateTimer = urand(17000,19000);                    } else uiObliterateTimer -= uiDiff;                    switch(uiPhase)                    {                        case PHASE_UNDEAD:                        {                            if (uiDeathRespiteTimer <= uiDiff)                            {                                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))                                {                                    if (target && target->isAlive())                                    {                                        if (IsHeroic())                                            DoCast(target,SPELL_DEATH_RESPITE_H);                                        else                                            DoCast(target,SPELL_DEATH_RESPITE);                                    }                                }                                uiDeathRespiteTimer = urand(15000,16000);                            } else uiDeathRespiteTimer -= uiDiff;                        break;                    }                        case PHASE_SKELETON:                    {                        if (!bSummonArmy)                        {                            bSummonArmy = true;                            me->AddUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);                            me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);                            if (IsHeroic())                                DoCast(me, SPELL_ARMY_DEAD_H);                            else                            DoCast(me, SPELL_ARMY_DEAD);                        }                        if (!bDeathArmyDone)                            {                            if (uiDeathArmyCheckTimer <= uiDiff)                            {                                me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED);                                me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE);                                uiDeathArmyCheckTimer = 0;//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:101,


示例17: EnterCombat

 void EnterCombat(Unit* /*target*/) {     DoCast(me, SPELL_PLAGUE_STENCH); }
开发者ID:FreedomEmu,项目名称:FreedomEmu,代码行数:4,


示例18: JustDied

 void JustDied(Unit* /*who*/) {     DoCast(SPELL_HALLUCINATION_2); }
开发者ID:A-Shox,项目名称:TrinityCore,代码行数:4,


示例19: Reset

 void Reset() {     DoCast(me, SPELL_SPIRIT_SPAWNIN);     me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); }
开发者ID:Adrya,项目名称:CrystalShard,代码行数:5,


示例20: UpdateAI

        void UpdateAI(const uint32 diff)        {            if (!UpdateVictim())                return;            if (HealthBelowPct(10) && !Enraged)            {                Enraged = true;                DoCast(me, SPELL_ENRAGE, true);                DoScriptText(SAY_ENRAGE, me);            }            //Randomly cast one beam.            if (BeamTimer <= diff)            {                Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0);                if (!pTarget || !pTarget->isAlive())                    return;                BeamTimer = 9000;                switch(CurrentBeam)                {                    case 0:                        DoCast(pTarget, SPELL_BEAM_SINISTER);                        break;                    case 1:                        DoCast(pTarget, SPELL_BEAM_VILE);                        break;                    case 2:                        DoCast(pTarget, SPELL_BEAM_WICKED);                        break;                    case 3:                        DoCast(pTarget, SPELL_BEAM_SINFUL);                        break;                }                ++BeamCount;                uint32 Beam = CurrentBeam;                if (BeamCount > 3)                    while (CurrentBeam == Beam)                        CurrentBeam = rand()%3;            } else BeamTimer -= diff;            // Random Prismatic Shield every 15 seconds.            if (PrismaticShieldTimer <= diff)            {                uint32 random = rand()%6;                if (PrismaticAuras[random])                    DoCast(me, PrismaticAuras[random]);                PrismaticShieldTimer = 15000;            } else PrismaticShieldTimer -= diff;            // Select 3 random targets (can select same target more than once), teleport to a random location then make them cast explosions until they get away from each other.            if (FatalAttractionTimer <= diff)            {                ExplosionCount = 0;                TeleportPlayers();                DoScriptText(RAND(SAY_SPELL2,SAY_SPELL3), me);                FatalAttractionExplodeTimer = 2000;                FatalAttractionTimer = 40000 + rand()%31 * 1000;            } else FatalAttractionTimer -= diff;            if (FatalAttractionExplodeTimer <= diff)            {                // Just make them explode three times... they're supposed to keep exploding while they are in range, but it'll take too much code. I'll try to think of an efficient way for it later.                if (ExplosionCount < 3)                {                    for (uint8 i = 0; i < 3; ++i)                    {                        Unit* pUnit = NULL;                        if (TargetGUID[i])                        {                            pUnit = Unit::GetUnit((*me), TargetGUID[i]);                            if (pUnit)                                pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true);                            TargetGUID[i] = 0;                        }                    }                    ++ExplosionCount;                    FatalAttractionExplodeTimer = 1000;                }                else                {                    FatalAttractionExplodeTimer = FatalAttractionTimer + 2000;                    ExplosionCount = 0;                }            } else FatalAttractionExplodeTimer -= diff;            if (ShriekTimer <= diff)            {                DoCast(me->getVictim(), SPELL_SILENCING_SHRIEK);                ShriekTimer = 25000+rand()%10 * 1000;            } else ShriekTimer -= diff;            if (SaberTimer <= diff)            {//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:StrawberryCore,代码行数:101,


示例21: UpdateAI

    void UpdateAI(const uint32 uiDiff)    {        if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())            return;        if (!isInVanish && !isInVampyrMode)            // Summon Flame Orb            if(summonFlameOrbTimer <= uiDiff)            {                for(int i = 0; i < 3; ++i)                {                    m_creature->SummonCreature(NPC_FLAME_ORB, m_creature->GetPositionX(), m_creature->GetPositionY(), FLAME_ORB_Z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0);                    if(m_bIsRegularMode)                        break;                }                DoCast(m_creature, SPELL_CONJURE_FLAME_ORB);                vanishTimer += 10000;                summonFlameOrbTimer = 16000 + rand()%10000;            }else summonFlameOrbTimer -= uiDiff;        if (!isInVampyrMode)            if(vanishTimer < uiDiff)            {                m_creature->CastSpell(m_creature,SPELL_VANISH,true);                isInVanish = true;                embraceOfTheVampyrTimer = 2400;                vanishTimer = 200000;            }else vanishTimer -= uiDiff;                if (isInVanish)        {            if (embraceOfTheVampyrTimer < uiDiff)            {                Player* pPlayer;                // get player enemy                do                {                    pPlayer = (Player*) m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0);                }                while (!pPlayer);                m_creature->NearTeleportTo(pPlayer->GetPositionX() + 3.0f, pPlayer->GetPositionY() + 3.0f, pPlayer->GetPositionZ(), pPlayer->GetOrientation());                m_creature->RemoveAurasDueToSpell(SPELL_VANISH);                DoCastSpellIfCan(pPlayer, m_bIsRegularMode ? SPELL_EMBRACE_OF_THE_VAMPYR : SPELL_EMBRACE_OF_THE_VAMPYR_H);                isInVampyrMode = true;                summonFlameOrbTimer += 20000;                isInVanish = false;                vanishTimer = 25000;            }else embraceOfTheVampyrTimer -= uiDiff;        }        // set VampyrMode false when Spell not stopped by damage        if(isInVampyrMode)            if(embraceOfTheVampyrFinishedTimer < uiDiff)            {                isInVampyrMode = false;                embraceOfTheVampyrFinishedTimer = 20000;            } else embraceOfTheVampyrFinishedTimer -= uiDiff;                    if(!isInVampyrMode && !isInVanish)            if (bloodthirstTimer < uiDiff)            {                DoCastSpellIfCan(m_creature->getVictim(), SPELL_BLOODTHIRST);                 bloodthirstTimer = m_bIsRegularMode ? 15000 : 8000;            }else bloodthirstTimer -= uiDiff;        DoMeleeAttackIfReady();    }
开发者ID:Ankso,项目名称:scriptdev2,代码行数:70,


示例22: UpdateAI

        void UpdateAI(const uint32 diff)        {            //Return since we have no target            if(!UpdateVictim())                return;            //ArcaneExplosion_Timer            if(ArcaneExplosion_Timer <= diff)            {                DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);                ArcaneExplosion_Timer = 8000 + rand()%10000;            } else ArcaneExplosion_Timer -= diff;            //If we are within range melee the target            if(me->IsWithinMeleeRange(me->getVictim()))            {                //Make sure our attack is ready and we arn't currently casting                if(me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))                {                    me->AttackerStateUpdate(me->getVictim());                    me->resetAttackTimer();                }            } else            {                //EarthShock_Timer                if(EarthShock_Timer <= diff)                {                    DoCast(me->getVictim(), SPELL_EARTH_SHOCK);                    EarthShock_Timer = 1000;                } else EarthShock_Timer -= diff;            }            //Blink_Timer            if(Blink_Timer <= diff)            {                //DoCast(me, SPELL_BLINK);                switch(urand(0, 2))                {                    case 0:                        me->GetMap()->CreatureRelocation(me, -8340.782227f, 2083.814453f, 125.648788f, 0.0f);                        DoResetThreat();                        break;                    case 1:                        me->GetMap()->CreatureRelocation(me, -8341.546875f, 2118.504639f, 133.058151f, 0.0f);                        DoResetThreat();                        break;                    case 2:                        me->GetMap()->CreatureRelocation(me, -8318.822266f, 2058.231201f, 133.058151f, 0.0f);                        DoResetThreat();                        break;                }                DoStopAttack();                Blink_Timer= 20000 + rand()%20000;            } else Blink_Timer -= diff;            int procent = (int) (me->GetHealthPct() + 0.5f);            //Summoning 2 Images and teleporting to a random position on 75% health            if((!Images75 && !IsImage) && (procent <= 75 && procent > 70))                DoSplit(75);            //Summoning 2 Images and teleporting to a random position on 50% health            if((!Images50 && !IsImage) && (procent <= 50 && procent > 45))                DoSplit(50);            //Summoning 2 Images and teleporting to a random position on 25% health            if((!Images25 && !IsImage) && (procent <= 25 && procent > 20))                DoSplit(25);            //Invisible_Timer            if(Invisible)            {                if(Invisible_Timer <= diff)                {                    //Making Skeram visible after telporting                    me->SetVisible(true);                    me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);                    Invisible_Timer = 2500;                    Invisible = false;                } else Invisible_Timer -= diff;            }            DoMeleeAttackIfReady();        }
开发者ID:Darkelmo,项目名称:MythCore,代码行数:86,


示例23: UpdateAI

            void UpdateAI(const uint32 diff)            {                if (!UpdateVictim())                    return;                //BloodSiphon_Timer                if (BloodSiphon_Timer <= diff)                {                    DoCast(me->getVictim(), SPELL_BLOODSIPHON);                    BloodSiphon_Timer = 90000;                } else BloodSiphon_Timer -= diff;                //CorruptedBlood_Timer                if (CorruptedBlood_Timer <= diff)                {                    DoCast(me->getVictim(), SPELL_CORRUPTEDBLOOD);                    CorruptedBlood_Timer = 30000 + rand()%15000;                } else CorruptedBlood_Timer -= diff;                //CauseInsanity_Timer                /*if (CauseInsanity_Timer <= diff)                {                if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))                DoCast(pTarget, SPELL_CAUSEINSANITY);                CauseInsanity_Timer = 35000 + rand()%8000;                } else CauseInsanity_Timer -= diff;*/                //WillOfHakkar_Timer                if (WillOfHakkar_Timer <= diff)                {                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))                        DoCast(pTarget, SPELL_WILLOFHAKKAR);                    WillOfHakkar_Timer = 25000 + rand()%10000;                } else WillOfHakkar_Timer -= diff;                if (!Enraged && Enrage_Timer <= diff)                {                    DoCast(me, SPELL_ENRAGE);                    Enraged = true;                } else Enrage_Timer -= diff;                //Checking if Jeklik is dead. If not we cast her Aspect                if (CheckJeklik_Timer <= diff)                {                    if (m_pInstance)                    {                        if (m_pInstance->GetData(TYPE_JEKLIK) != DONE)                        {                            if (AspectOfJeklik_Timer <= diff)                            {                                DoCast(me->getVictim(), SPELL_ASPECT_OF_JEKLIK);                                AspectOfJeklik_Timer = 10000 + rand()%4000;                            } else AspectOfJeklik_Timer -= diff;                        }                    }                    CheckJeklik_Timer = 1000;                } else CheckJeklik_Timer -= diff;                //Checking if Venoxis is dead. If not we cast his Aspect                if (CheckVenoxis_Timer <= diff)                {                    if (m_pInstance)                    {                        if (m_pInstance->GetData(TYPE_VENOXIS) != DONE)                        {                            if (AspectOfVenoxis_Timer <= diff)                            {                                DoCast(me->getVictim(), SPELL_ASPECT_OF_VENOXIS);                                AspectOfVenoxis_Timer = 8000;                            } else AspectOfVenoxis_Timer -= diff;                        }                    }                    CheckVenoxis_Timer = 1000;                } else CheckVenoxis_Timer -= diff;                //Checking if Marli is dead. If not we cast her Aspect                if (CheckMarli_Timer <= diff)                {                    if (m_pInstance)                    {                        if (m_pInstance->GetData(TYPE_MARLI) != DONE)                        {                            if (AspectOfMarli_Timer <= diff)                            {                                DoCast(me->getVictim(), SPELL_ASPECT_OF_MARLI);                                AspectOfMarli_Timer = 10000;                            } else AspectOfMarli_Timer -= diff;                        }                    }                    CheckMarli_Timer = 1000;                } else CheckMarli_Timer -= diff;                //Checking if Thekal is dead. If not we cast his Aspect                if (CheckThekal_Timer <= diff)                {                    if (m_pInstance)                    {//.........这里部分代码省略.........
开发者ID:Bootz,项目名称:SkyFireEMU_420,代码行数:101,


示例24: UpdateAI

    void UpdateAI(const uint32 diff)    {        //Return since we have no target        if (!UpdateVictim())            return;        if (Teleport_Timer <= diff)        {            DoScriptText(SAY_TELEPORT, me);            std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();            std::list<HostileReference*>::iterator i = m_threatlist.begin();            for (i = m_threatlist.begin(); i != m_threatlist.end();++i)            {                Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());                if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))                {                    DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation());                }            }            DoResetThreat();            Teleport_Timer = 30000;        } else Teleport_Timer -= diff;        //        //MarkOfFrost_Timer        //        if (MarkOfFrost_Timer <= diff)        //        {        //            DoCast(me->getVictim(),SPELL_MARKOFFROST);        //            MarkOfFrost_Timer = 25000;        //        } else MarkOfFrost_Timer -= diff;        //Chill_Timer        if (Chill_Timer <= diff)        {            DoCast(me->getVictim(),SPELL_CHILL);            Chill_Timer = 13000 + rand()%12000;        } else Chill_Timer -= diff;        //Breath_Timer        if (Breath_Timer <= diff)        {            DoCast(me->getVictim(),SPELL_FROSTBREATH);            Breath_Timer = 10000 + rand()%5000;        } else Breath_Timer -= diff;        //ManaStorm_Timer        if (ManaStorm_Timer <= diff)        {            if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))                DoCast(pTarget,SPELL_MANASTORM);            ManaStorm_Timer = 7500 + rand()%5000;        } else ManaStorm_Timer -= diff;        //Reflect_Timer        if (Reflect_Timer <= diff)        {            DoCast(me,SPELL_REFLECT);            Reflect_Timer = 20000 + rand()%15000;        } else Reflect_Timer -= diff;        //Cleave_Timer        if (Cleave_Timer <= diff)        {            DoCast(me->getVictim(),SPELL_CLEAVE);            Cleave_Timer = 7000;        } else Cleave_Timer -= diff;        //Enrage_Timer        if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged)        {            DoCast(me, SPELL_ENRAGE);            Enraged = true;        }        DoMeleeAttackIfReady();    }
开发者ID:Agustin1010,项目名称:Oregon-Core,代码行数:76,



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


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