void UpdateAI(uint32 diff) override { _events.Update(diff); if (Unit* owner = me->GetCharmerOrOwner()) if (!me->IsWithinDist(owner, 25.f)) me->InterruptSpell(CURRENT_CHANNELED_SPELL); while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_BBB_PET_SIT: me->CastSpell(me, SPELL_BBB_PET_SIT, false); _events.ScheduleEvent(EVENT_BBB_PET_SIT_INTER, urandms(15, 30)); break; case EVENT_BBB_PET_SIT_INTER: me->InterruptSpell(CURRENT_CHANNELED_SPELL); _events.ScheduleEvent(EVENT_BBB_PET_SIT, urandms(10, 30)); break; default: break; } } }
void EnterCombat(Unit* /*who*/) override { _EnterCombat(); events.ScheduleEvent(EVENT_WRAP, 20 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_SPRAY, 40 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_SHOCK, urandms(5, 10)); events.ScheduleEvent(EVENT_POISON, urandms(10, 15)); events.ScheduleEvent(EVENT_SUMMON, 30 * IN_MILLISECONDS); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_ATTACK: SetCombatMovement(true); if (Unit* victim = me->GetVictim()) me->GetMotionMaster()->MoveChase(victim); break; case EVENT_STRIKE: DoCastVictim(SPELL_UNBALANCING_STRIKE); events.ScheduleEvent(EVENT_STRIKE, 6 * IN_MILLISECONDS); return; case EVENT_SHOUT: DoCastAOE(SPELL_DISRUPTING_SHOUT); events.ScheduleEvent(EVENT_SHOUT, 16 * IN_MILLISECONDS); return; case EVENT_KNIFE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f)) DoCast(target, SPELL_JAGGED_KNIFE); events.ScheduleEvent(EVENT_KNIFE, urandms(10,15)); return; } } DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (_visibilityTimer) { if (diff > _visibilityTimer) _visibilityTimer -= diff; else { me->SetVisible(true); Talk(EMOTE_GUARDIAN_APPEAR); _visibilityTimer = 0; } } if (!UpdateVictim()) return; if (_bloodTapTimer <= diff) { DoCastVictim(SPELL_BLOOD_TAP); _bloodTapTimer = urandms(18, 26); } else _bloodTapTimer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { _events.Update(diff); if (Unit* owner = me->GetCharmerOrOwner()) { if (!me->IsWithinDist(owner, 40.f)) { me->RemoveAura(SPELL_EGBERT); me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); } } if (me->HasAura(SPELL_EGBERT)) _events.ScheduleEvent(EVENT_RETURN, urandms(5, 20)); while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_RETURN: me->RemoveAura(SPELL_EGBERT); break; default: break; } } }
void _UpdateAI(uint32 diff) { if (diff < _whirlwindTimer) _whirlwindTimer -= diff; else { DoCastAOE(SPELL_SHADOW_MARK); _whirlwindTimer = urandms(15, 20); } DoMeleeAttackIfReady(); }
void _UpdateAI(uint32 diff) { if (diff < _whirlwindTimer) _whirlwindTimer -= diff; else { DoCastAOE(SPELL_WHIRLWIND); _whirlwindTimer = urandms(20, 25); } DoMeleeAttackIfReady(); }
void _UpdateAI(uint32 diff) { if (diff < _stompTimer) _stompTimer -= diff; else { DoCastAOE(SPELL_STOMP); _stompTimer = urandms(14, 18); } DoMeleeAttackIfReady(); }
void _UpdateAI(uint32 diff) { if (diff < _deathPlagueTimer) _deathPlagueTimer -= diff; else { DoCastAOE(SPELL_DEATH_PLAGUE); _deathPlagueTimer = urandms(5, 20); } DoMeleeAttackIfReady(); }
void _UpdateAI(uint32 diff) { if (diff < _boltVolleyTimer) _boltVolleyTimer -= diff; else { DoCastAOE(SPELL_SHADOW_BOLT_VOLLEY); _boltVolleyTimer = urandms(10, 15); } if (!me->HasUnitState(UNIT_STATE_CASTING)) DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (diff >= _boltTimer) { DoCastVictim(SPELL_POISON_BOLT); _boltTimer = urandms(2, 3); } else _boltTimer -= diff; DoMeleeAttackIfReady(); }
void _UpdateAI(uint32 diff) { if (diff < _frenzyTimer) _frenzyTimer -= diff; else if (me->HasUnitState(UNIT_STATE_CASTING)) _frenzyTimer = 0; else { // target priority: knight > other rider > horse > gothik std::list<Creature*> potentialTargets = DoFindFriendlyMissingBuff(30.0, SPELLHELPER_UNHOLY_FRENZY); Creature *knightTarget = nullptr, *riderTarget = nullptr, *horseTarget = nullptr, *gothikTarget = nullptr; for (Creature* pTarget : potentialTargets) { switch (pTarget->GetEntry()) { case NPC_DEAD_KNIGHT: knightTarget = pTarget; break; case NPC_DEAD_RIDER: riderTarget = pTarget; break; case NPC_DEAD_HORSE: horseTarget = pTarget; break; case NPC_GOTHIK: gothikTarget = pTarget; break; } if (knightTarget) break; } Creature* target = knightTarget ? knightTarget : riderTarget ? riderTarget : horseTarget ? horseTarget : gothikTarget ? gothikTarget : nullptr; if (target) DoCast(target, SPELL_UNHOLY_FRENZY); _frenzyTimer = 20 * IN_MILLISECONDS; } if (diff < _drainTimer) _drainTimer -= diff; else { DoCastVictim(SPELL_DRAIN_LIFE); _drainTimer = urandms(10,15); } if (!me->HasUnitState(UNIT_STATE_CASTING)) DoMeleeAttackIfReady(); }
void UpdateAI(uint32 diff) override { UpdateRandomMovement(diff); if (!UpdateVictim()) return; if (_woundTimer <= diff) { _woundTimer = urandms(14, 18); DoCastVictim(SPELL_MORTAL_WOUND); } else _woundTimer -= diff; DoMeleeAttackIfReady(); }
npc_gothik_minion_livingriderAI(Creature* creature) : npc_gothik_minion_baseAI(creature, SPELL_ANCHOR_1_RIDER), _boltVolleyTimer(urandms(5,10)) { }
npc_pet_gen_baby_blizzard_bearAI(Creature* creature) : NullCreatureAI(creature) { if (Unit* owner = me->GetCharmerOrOwner()) me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); _events.ScheduleEvent(EVENT_BBB_PET_SIT, urandms(10, 30)); }
void MovementInform(uint32 /*type*/, uint32 id) override { if (id == MOVEMENT_MINION_RANDOM) _movementTimer = urandms(2, 10) + urandms(2, 10); }
void UpdateAI(uint32 diff) override { if (!UpdateVictim()) return; if (HealthBelowPct(30) && !me->HasAura(SPELL_FRENZY_HELPER)) { DoCast(SPELL_FRENZY); } events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_WRAP: { std::list<Unit*> targets; SelectTargetList(targets, WebTargetSelector(me), RAID_MODE(1, 2), SELECT_TARGET_RANDOM); if (!targets.empty()) { Talk(EMOTE_WEB_WRAP); int8 wrapPos = -1; for (Unit* target : targets) { if (wrapPos == -1) // allow all positions on the first target wrapPos = urand(0, MAX_WRAP_POSITION - 1); else // on subsequent iterations, only allow positions that are not equal to the previous one (this is sufficient since we should only have two targets at most, ever) wrapPos = (wrapPos + urand(1, MAX_WRAP_POSITION - 1)) % MAX_WRAP_POSITION; target->RemoveAura(sSpellMgr->GetSpellIdForDifficulty(SPELL_WEB_SPRAY, me)); if (Creature* wrap = DoSummon(NPC_WEB_WRAP, WrapPositions[wrapPos], 70 * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN)) { wrap->AI()->SetGUID(target->GetGUID()); // handles application of debuff target->GetMotionMaster()->MoveJump(WrapPositions[wrapPos], WEB_WRAP_MOVE_SPEED, WEB_WRAP_MOVE_SPEED); // move after stun to avoid stun cancelling move } } } events.ScheduleEvent(EVENT_WRAP, 40000); break; } case EVENT_SPRAY: Talk(EMOTE_WEB_SPRAY); DoCastAOE(SPELL_WEB_SPRAY); events.ScheduleEvent(EVENT_SPRAY, 40000); break; case EVENT_SHOCK: DoCastAOE(SPELL_POISON_SHOCK); events.ScheduleEvent(EVENT_SHOCK, urandms(10, 20)); break; case EVENT_POISON: DoCastVictim(SPELL_NECROTIC_POISON); events.ScheduleEvent(EVENT_POISON, urandms(10, 20)); break; case EVENT_SUMMON: Talk(EMOTE_SPIDERS); uint8 amount = urand(8, 10); for (uint8 i = 0; i < amount; ++i) DoSummon(NPC_SPIDERLING, me, 4.0f, 5 * IN_MILLISECONDS, TEMPSUMMON_CORPSE_TIMED_DESPAWN); events.ScheduleEvent(EVENT_SUMMON, 40000); break; } } DoMeleeAttackIfReady(); }
npc_kelthuzad_abominationAI(Creature* creature) : npc_kelthuzad_minionAI(creature), _woundTimer(urandms(10, 20)) { }
npc_gothik_minion_spectralhorseAI(Creature* creature) : npc_gothik_minion_baseAI(creature), _stompTimer(urandms(10,15)) { }
void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) if (Creature* blizzard = GetCaster()->SummonCreature(NPC_BLIZZARD, *target, TEMPSUMMON_TIMED_DESPAWN, urandms(25, 30))) { blizzard->CastSpell(nullptr, blizzard->m_spells[0], TRIGGERED_NONE); if (Creature* creatureCaster = GetCaster()->ToCreature()) { if (Unit* newTarget = creatureCaster->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) { blizzard->GetMotionMaster()->MoveFollow(newTarget, 0.1f, 0.0f); return; } } blizzard->GetMotionMaster()->MoveFollow(target, 0.1f, 0.0f); } }
npc_gothik_minion_spectralriderAI(Creature* creature) : npc_gothik_minion_baseAI(creature), _frenzyTimer(urandms(2,5)), _drainTimer(urandms(8,12)) { }
npc_gothik_minion_spectralknightAI(Creature* creature) : npc_gothik_minion_baseAI(creature), _whirlwindTimer(urandms(15,25)) { }
void HandleApply(AuraEffect const* /*eff*/, AuraEffectHandleModes /*mode*/) { if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0)) effect->SetPeriodicTimer(urandms(2, 17)); }
npc_kelthuzad_minionAI(Creature* creature) : ScriptedAI(creature), instance(creature->GetInstanceScript()), pocketId(0), _movementTimer(urandms(4,12)), _home(me->GetPosition()) { }
npc_gothik_minion_livingtraineeAI(Creature* creature) : npc_gothik_minion_baseAI(creature, SPELL_ANCHOR_1_TRAINEE), _deathPlagueTimer(urandms(5,20)) { }
npc_gothik_minion_livingknightAI(Creature* creature) : npc_gothik_minion_baseAI(creature, SPELL_ANCHOR_1_DK), _whirlwindTimer(urandms(5,10)) { }