这篇教程C++ HealthAbovePct函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中HealthAbovePct函数的典型用法代码示例。如果您正苦于以下问题:C++ HealthAbovePct函数的具体用法?C++ HealthAbovePct怎么用?C++ HealthAbovePct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了HealthAbovePct函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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(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:Akenyshka,项目名称:MythCore,代码行数:97,
示例13: UpdateAI void UpdateAI(const uint32 diff) { //Return since we have no target if (!UpdateVictim()) return; //MortalWound_Timer if (MortalWound_Timer <= diff) { DoCast(me->getVictim(), SPELL_MORTAL_WOUND); MortalWound_Timer = 10000 + rand()%10000; } else MortalWound_Timer -= diff; //Summon 1-3 Spawns of Fankriss at random time. if (SpawnSpawns_Timer <= diff) { switch (urand(0, 2)) { case 0: SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); break; case 1: SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); break; case 2: SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM, 0)); break; } SpawnSpawns_Timer = 30000 + rand()%30000; } else SpawnSpawns_Timer -= diff; // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. if (HealthAbovePct(3)) { if (SpawnHatchlings_Timer <= diff) { Unit *pTarget = NULL; pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) { DoCast(pTarget, SPELL_ROOT); if (DoGetThreat(pTarget)) DoModifyThreatPercent(pTarget, -100); switch(urand(0, 2)) { case 0: DoTeleportPlayer(pTarget, -8106.0142f, 1289.2900f, -74.419533f, 5.112f); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); break; case 1: DoTeleportPlayer(pTarget, -7990.135354f, 1155.1907f, -78.849319f, 2.608f); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); break; case 2: DoTeleportPlayer(pTarget, -8159.7753f, 1127.9064f, -76.868660f, 0.675f); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); if (Hatchling) Hatchling->AI()->AttackStart(pTarget); break; } } SpawnHatchlings_Timer = 45000 + rand()%15000; } else SpawnHatchlings_Timer -= diff;//.........这里部分代码省略.........
开发者ID:SkyFireArchives,项目名称:SkyFireEMU_420,代码行数:101,
示例14: UpdateAI void UpdateAI(uint32 diff) { if (!Intro) { if (!instance) return; if (Intro_Timer <= diff) { switch (Intro_Phase) { case 1: Talk(SAY_INTRO); instance->HandleGameObject(instance->GetData64(DATA_SPHERE_SHIELD), true); ++Intro_Phase; Intro_Timer = 25000; break; case 2: Talk(SAY_AGGRO); if (Unit* mellic = Unit::GetUnit(*me, instance->GetData64(DATA_MELLICHAR))) { //should have a better way to do this. possibly spell exist. mellic->setDeathState(JUST_DIED); mellic->SetHealth(0); instance->SetData(TYPE_SHIELD_OPEN, IN_PROGRESS); } ++Intro_Phase; Intro_Timer = 3000; break; case 3: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); Intro = true; break; } } else Intro_Timer -=diff; } if (!UpdateVictim()) return; if (!IsImage66 && !HealthAbovePct(66)) { DoSplit(66); IsImage66 = true; } if (!IsImage33 && !HealthAbovePct(33)) { DoSplit(33); IsImage33 = true; } if (MindRend_Timer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_MIND_REND); else DoCast(me->getVictim(), SPELL_MIND_REND); MindRend_Timer = 8000; } else MindRend_Timer -=diff; if (Fear_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) return; Talk(SAY_FEAR); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_FEAR); else DoCast(me->getVictim(), SPELL_FEAR); Fear_Timer = 25000; } else Fear_Timer -=diff; if (Domination_Timer <= diff) { if (me->IsNonMeleeSpellCasted(false)) return; Talk(SAY_MIND); if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) DoCast(target, SPELL_DOMINATION); else DoCast(me->getVictim(), SPELL_DOMINATION); Domination_Timer = 16000+rand()%16000; } else Domination_Timer -=diff; if (IsHeroic()) {//.........这里部分代码省略.........
开发者ID:Asandru,项目名称:Script-Land,代码行数:101,
示例15: UpdateAI void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; //always decrease BerserkTimer if (BerserkTimer <= diff) { //if evocate, then break evocate if (Evocating) { if (me->HasAura(SPELL_EVOCATION)) me->RemoveAurasDueToSpell(SPELL_EVOCATION); Evocating = false; } //may not be correct SAY (generic hard enrage) DoScriptText(SAY_ENRAGE, me); me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_BERSERK); //don't know if he's supposed to do summon/evocate after hard enrage (probably not) Enraged = true; } else BerserkTimer -= diff; if (Evocating) { //not supposed to do anything while evocate if (me->HasAura(SPELL_EVOCATION)) return; else Evocating = false; } if (!Enraged) { if (AddTimer <= diff) { //Summon Astral Flare Creature* AstralFlare = DoSpawnCreature(17096, float(rand()%37), float(rand()%37), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); Unit* target = NULL; target = SelectTarget(SELECT_TARGET_RANDOM, 0); if (AstralFlare && target) { AstralFlare->CastSpell(AstralFlare, SPELL_ASTRAL_FLARE_PASSIVE, false); AstralFlare->AI()->AttackStart(target); } //Reduce Mana by 10% of max health if (int32 mana = me->GetMaxPower(POWER_MANA)) { mana /= 10; me->ModifyPower(POWER_MANA, -mana); //if this get's us below 10%, then we evocate (the 10th should be summoned now) if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10) { DoScriptText(SAY_EVOCATE, me); me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_EVOCATION); Evocating = true; //no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected return; } else { if (urand(0, 1) == 0) { DoScriptText(RAND(SAY_SUMMON1, SAY_SUMMON2), me); } } } AddTimer = 10000; } else AddTimer -= diff; if (!HealthAbovePct(15)) { Enraged = true; DoCast(me, SPELL_ENRAGE); DoScriptText(SAY_ENRAGE, me); } } if (HatefulBoltTimer <= diff) { if (Enraged) HatefulBoltTimer = 7000; else HatefulBoltTimer = 15000; if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 1)) DoCast(target, SPELL_HATEFUL_BOLT); } else HatefulBoltTimer -= diff; DoMeleeAttackIfReady(); }
开发者ID:Bootz,项目名称:SkyFireEMU_430,代码行数:100,
示例16: UpdateAI void UpdateAI(uint32 diff) { if (!_phase) return; events.Update(diff); if ((_phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom()) return; if (_canTheHundredClub) { if (_checkFrostResistTimer <= diff) { CheckPlayersFrostResist(); _checkFrostResistTimer = 5 * IN_MILLISECONDS; } else _checkFrostResistTimer -= diff; } if (_phase == PHASE_GROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_BERSERK: Talk(EMOTE_ENRAGE); DoCast(me, SPELL_BERSERK); return; case EVENT_CLEAVE: DoCastVictim(SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND); return; case EVENT_TAIL: DoCastAOE(SPELL_TAIL_SWEEP); events.ScheduleEvent(EVENT_TAIL, urand(5, 15) * IN_MILLISECONDS, 0, PHASE_GROUND); return; case EVENT_DRAIN: DoCastAOE(SPELL_LIFE_DRAIN); events.ScheduleEvent(EVENT_DRAIN, 24 * IN_MILLISECONDS, 0, PHASE_GROUND); return; case EVENT_BLIZZARD: { //DoCastAOE(SPELL_SUMMON_BLIZZARD); if (Creature* summon = DoSummon(NPC_BLIZZARD, me, 0.0f, urand(25, 30) * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN)) summon->GetMotionMaster()->MoveRandom(40); events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20, 7) * IN_MILLISECONDS, 0, PHASE_GROUND); break; } case EVENT_FLIGHT: if (HealthAbovePct(10)) { _phase = PHASE_FLIGHT; events.SetPhase(PHASE_FLIGHT); me->SetReactState(REACT_PASSIVE); me->AttackStop(); float x, y, z, o; me->GetHomePosition(x, y, z, o); me->GetMotionMaster()->MovePoint(1, x, y, z); return; } break; } } DoMeleeAttackIfReady(); } else { if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_LIFTOFF: Talk(EMOTE_AIR_PHASE); me->SetDisableGravity(true); me->SendMovementFlagUpdate(); events.ScheduleEvent(EVENT_ICEBOLT, 1500); _iceboltCount = RAID_MODE(2, 3); return; case EVENT_ICEBOLT: { std::vector<Unit*> targets; std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) targets.push_back((*i)->getTarget()); if (targets.empty()) _iceboltCount = 0; else { std::vector<Unit*>::const_iterator itr = targets.begin(); advance(itr, rand()%targets.size()); _iceblocks.insert(std::make_pair((*itr)->GetGUID(), 0)); DoCast(*itr, SPELL_ICEBOLT); --_iceboltCount; }//.........这里部分代码省略.........
开发者ID:Onirox,项目名称:ReanDev,代码行数:101,
示例17: UpdateAI void UpdateAI(const uint32 diff) { //Only if not incombat check if the event is started if (!me->isInCombat() && pInstance && pInstance->GetData(DATA_KARATHRESSEVENT)) { Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESSEVENT_STARTER)); if (pTarget) { AttackStart(pTarget); GetAdvisors(); } } //Return since we have no target if (!UpdateVictim()) return; //someone evaded! if (pInstance && !pInstance->GetData(DATA_KARATHRESSEVENT)) { EnterEvadeMode(); return; } //CataclysmicBolt_Timer if (CataclysmicBolt_Timer <= diff) { //select a random unit other than the main tank Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1); //if there aren't other units, cast on the tank if (!pTarget) pTarget = me->getVictim(); if (pTarget) DoCast(pTarget, SPELL_CATACLYSMIC_BOLT); CataclysmicBolt_Timer = 10000; } else CataclysmicBolt_Timer -= diff; //SearNova_Timer if (SearNova_Timer <= diff) { DoCast(me->getVictim(), SPELL_SEAR_NOVA); SearNova_Timer = 20000+rand()%40000; } else SearNova_Timer -= diff; //Enrage_Timer if (Enrage_Timer <= diff) { DoCast(me, SPELL_ENRAGE); Enrage_Timer = 90000; } else Enrage_Timer -= diff; //Blessing of Tides Trigger if (!HealthAbovePct(75) && !BlessingOfTides) { BlessingOfTides = true; bool continueTriggering = false; Creature* Advisor; for (uint8 i = 0; i < MAX_ADVISORS; ++i) if (Advisors[i]) { Advisor = (Unit::GetCreature(*me, Advisors[i])); if (Advisor && Advisor->isAlive()) { continueTriggering = true; break; } } if (continueTriggering) { DoCast(me, SPELL_BLESSING_OF_THE_TIDES); me->MonsterYell(SAY_GAIN_BLESSING_OF_TIDES, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(me, SOUND_GAIN_BLESSING_OF_TIDES); } } DoMeleeAttackIfReady(); }
开发者ID:ice74,项目名称:blizzwow,代码行数:80,
示例18: UpdateAI void UpdateAI(const uint32 diff) { if (!me->isInCombat()) { if (pInstance) { // Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished. if ((pInstance->GetData(DATA_AZGALOREVENT) < DONE) && ((me->GetVisibility() != VISIBILITY_OFF) || (me->getFaction() != 35))) { me->SetVisibility(VISIBILITY_OFF); me->setFaction(35); } else if ((pInstance->GetData(DATA_AZGALOREVENT) >= DONE) && ((me->GetVisibility() != VISIBILITY_ON) || (me->getFaction() == 35))) { me->setFaction(1720); me->SetVisibility(VISIBILITY_ON); } } if (DrainNordrassilTimer <= diff) { if (!IsChanneling) { Creature *temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); if (temp) WorldTreeGUID = temp->GetGUID(); if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) { Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Nordrassil->SetDisplayId(11686); DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE); IsChanneling = true; } } if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) { Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); DrainNordrassilTimer = 1000; } } else DrainNordrassilTimer -= diff; } if (!UpdateVictim()) return; if (me->HealthBelowPct(10) && !BelowTenPercent && !Enraged) BelowTenPercent = true; if (!Enraged) { if (EnrageTimer <= diff) { if (HealthAbovePct(10)) { me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); Enraged = true; DoScriptText(SAY_ENRAGE, me); } } else EnrageTimer -= diff; if (CheckDistanceTimer <= diff) { // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); if (Check) { Check->SetVisibility(VISIBILITY_OFF); if (me->IsWithinDistInMap(Check, 75)) { me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); Enraged = true; DoScriptText(SAY_ENRAGE, me); } } CheckDistanceTimer = 5000; } else CheckDistanceTimer -= diff; } if (BelowTenPercent) { if (!HasProtected) { me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); //all members of raid must get this buff DoCast(me->getVictim(), SPELL_PROTECTION_OF_ELUNE); HasProtected = true; Enraged = true; } if (SummonWispTimer <= diff) { DoSpawnCreature(CREATURE_ANCIENT_WISP, float(rand()%40), float(rand()%40), 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);//.........这里部分代码省略.........
开发者ID:AdrElecTro,项目名称:CactusEMU,代码行数:101,
示例19: UpdateAI void UpdateAI(const uint32 diff) { if (IsIntroEvent) { if (!pInstance) return; if (pInstance->GetData(TYPE_NETHEKURSE) == IN_PROGRESS) { if (IntroEvent_Timer <= diff) DoTauntPeons(); else IntroEvent_Timer -= diff; } } if (!UpdateVictim()) return; if (!IsMainEvent) return; if (Phase) { if (!SpinOnce) { DoCast(me->getVictim(), SPELL_DARK_SPIN); SpinOnce = true; } if (Cleave_Timer <= diff) { DoCast(me->getVictim(), SPELL_SHADOW_CLEAVE); Cleave_Timer = 6000+rand()%2500; } else Cleave_Timer -= diff; } else { if (ShadowFissure_Timer <= diff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_SHADOW_FISSURE); ShadowFissure_Timer = urand(7500, 15000); } else ShadowFissure_Timer -= diff; if (DeathCoil_Timer <= diff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_DEATH_COIL); DeathCoil_Timer = urand(15000, 20000); } else DeathCoil_Timer -= diff; if (!HealthAbovePct(20)) Phase = true; DoMeleeAttackIfReady(); } }
开发者ID:FrenchCORE,项目名称:Server,代码行数:64,
示例20: DamageTaken void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) { if (!_hardMode && _phase == 1 && !HealthAbovePct(100 - 25 * (_heartExposed+1))) ExposeHeart(); }
开发者ID:Bootz,项目名称:OpenStage-Project,代码行数:5,
示例21: UpdateAI void UpdateAI(const uint32 uiDiff) { if (m_bShades && m_uiShades_Timer <= uiDiff) { //Become unbanished again me->setFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_bShades = false; } else if (m_bShades) { m_uiShades_Timer -= uiDiff; //Do nothing while banished return; } //Return since we have no target if (!UpdateVictim()) return; //Sleep_Timer if (m_uiSleep_Timer <= uiDiff) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_SLEEP); m_uiSleep_Timer = 8000 + rand()%7000; } else m_uiSleep_Timer -= uiDiff; //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer <= uiDiff) { DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); m_uiNoxiousBreath_Timer = 14000 + rand()%6000; } else m_uiNoxiousBreath_Timer -= uiDiff; //Tailsweep every 2 seconds if (m_uiTailSweep_Timer <= uiDiff) { DoCast(me, SPELL_TAILSWEEP); m_uiTailSweep_Timer = 2000; } else m_uiTailSweep_Timer -= uiDiff; //ArcaneBlast_Timer if (m_uiArcaneBlast_Timer <= uiDiff) { DoCast(me->getVictim(), SPELL_ARCANEBLAST); m_uiArcaneBlast_Timer = 7000 + rand()%5000; } else m_uiArcaneBlast_Timer -= uiDiff; //BellowingRoar_Timer if (m_uiBellowingRoar_Timer <= uiDiff) { DoCast(me->getVictim(), SPELL_BELLOWINGROAR); m_uiBellowingRoar_Timer = 20000 + rand()%10000; } else m_uiBellowingRoar_Timer -= uiDiff; //Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again) if (!m_bShades && !HealthAbovePct(100 - 25 * m_uiShadesSummoned)) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { //Interrupt any spell casting me->InterruptNonMeleeSpells(false); //horrible workaround, need to fix me->setFaction(35); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); DoScriptText(SAY_SUMMONSHADE, me); int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); for (int i = 0; i < iSize; ++i) DoCast(pTarget, m_auiSpellSummonShade[i], true); ++m_uiShadesSummoned; // prevent casting twice at same health m_bShades = true; } m_uiShades_Timer = 60000; } DoMeleeAttackIfReady(); }
开发者ID:1024wow,项目名称:TrinityCore,代码行数:94,
示例22: UpdateAI void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (!Enraged) { //used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25% if (!HealthAbovePct(100 - INTERVAL_MODIFIER * IntervalHealthAmount)) { //increase amount, unless we're at 10%, then we switch and return if (IntervalHealthAmount == INTERVAL_SWITCH) { Enraged = true; return; } else ++IntervalHealthAmount; DoScriptText(SAY_ENERGY, me); DoScriptText(EMOTE_DISCHARGE_ENERGY, me); if (IsHeroic()) { DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false); DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false); } else DoCast(me, SPELL_SUMMON_PURE_ENERGY, false); //below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); if (IsHeroic()) me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0); } if (ChainLightningTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_CHAIN_LIGHTNING); ChainLightningTimer = 8000; } else ChainLightningTimer -= diff; if (ArcaneShockTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) if (target) DoCast(target, SPELL_ARCANE_SHOCK); ArcaneShockTimer = 8000; } else ArcaneShockTimer -= diff; } else { if (OverloadTimer <= diff) { DoCast(me->getVictim(), SPELL_OVERLOAD); OverloadTimer = 2000; } else OverloadTimer -= diff; } DoMeleeAttackIfReady(); }
开发者ID:rexy,项目名称:ArkCORE,代码行数:66,
示例23: UpdateAI void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (!Bat && !HealthAbovePct(100)) { if(wing_flap<= diff) { DoCast(me->getVictim(), spell_wing_flap); wing_flap = 10000; }else wing_flap -= diff; if(pierce_armor<= diff) { DoCast(me->getVictim(), spell_pierce_armor); pierce_armor = 15000; }else pierce_armor -= diff; if(swoop<= diff) { DoCast(me->getVictim(), spell_swoop); swoop = 8000; }else swoop -= diff; if(disarm<= diff) { DoCast(me->getVictim(), spell_disarm); disarm = 18000; }else disarm -= diff; Bat = true; Vampire = false; } if (!Vampire && !HealthAbovePct(50)) { if (!Vampire && kirthonos_transform <= diff) { DoCast(me, spell_kirthonos_transform); kirthonos_transform = 3600000; }else kirthonos_transform -= diff; if(curse_of_thongue<= diff) { DoCast(spell_curse_of_tongues); curse_of_thongue = 20000; }else curse_of_thongue -= diff; if(dominate_mind<= diff) { if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) DoCast(pTarget, spell_dominate_mind); dominate_mind = 25000; } else dominate_mind -= diff; if(shadow_bolt_volley<= diff) { DoCast(spell_shadow_bolt_volley); shadow_bolt_volley = 10000; }else shadow_bolt_volley -= diff; Vampire = true; Bat = false; } DoMeleeAttackIfReady(); }
开发者ID:xerkoss,项目名称:Project-WoW,代码行数:70,
注:本文中的HealthAbovePct函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ HealthBelowPct函数代码示例 C++ Header_Fill_Size函数代码示例 |