Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptMgr.h"
- #include "ScriptedCreature.h"
- #include "SpellAuraEffects.h"
- #include "SpellScript.h"
- enum Phases
- {
- PHASE_ONE = 1,
- PHASE_TWO = 2,
- };
- enum Texts
- {
- SAY_INTRO = 0,
- SAY_AGGRO = 1,
- SAY_KILL = 2,
- SAY_DEATH = 3,
- SAY_PHASE_TRANSITION = 4,
- SAY_BERSERK = 5,
- SAY_FEAR = 6,
- SAY_RANDOM = 7,
- SAY_CHAOS = 8,
- };
- enum Spells
- {
- SPELL_HOWL_OF_FEAR = 39048,
- SPELL_CLEAVE = 31779,
- SPELL_SHADOW_VOLLEY = 17228,
- SPELL_BERSERK = 68378,
- SPELL_CHAOS = 71904,
- };
- enum Events
- {
- EVENT_FEAR = 1,
- EVENT_CLEAVE = 2,
- EVENT_SHADOW_VOLLEY = 3,
- EVENT_BERSERK = 4,
- EVENT_RANDOM = 5,
- EVENT_CHAOS = 6,
- EVENT_FEL_FIRE = 7,
- };
- class boss_netbus : public CreatureScript
- {
- public:
- boss_netbus() : CreatureScript("boss_netbus") { }
- struct boss_netbusAI : public ScriptedAI
- {
- boss_netbusAI(Creature* creature) : ScriptedAI(creature), summons(me)
- {
- }
- void Reset() override
- {
- _events.Reset();
- _events.ScheduleEvent(EVENT_CLEAVE, 15000, 0, 0);
- _events.ScheduleEvent(EVENT_BERSERK, 360000, 0, 0);
- _events.ScheduleEvent(EVENT_RANDOM, 60000, 0, 0);
- _events.ScheduleEvent(EVENT_CHAOS, 50000, 0, PHASE_ONE);
- _events.ScheduleEvent(EVENT_FEL_FIRE, 5000, 0, PHASE_ONE);
- summons.DespawnAll();
- }
- void JustRespawned() override
- {
- Talk(SAY_INTRO);
- }
- void EnterCombat(Unit* /*who*/) override
- {
- Talk(SAY_AGGRO);
- _events.SetPhase(PHASE_ONE);
- }
- void KilledUnit(Unit* victim) override
- {
- if (victim->GetTypeId() != TYPEID_PLAYER)
- return;
- Talk(SAY_KILL);
- }
- void JustDied(Unit* victim) override
- {
- Talk(SAY_DEATH);
- summons.DespawnAll();
- ScriptedAI::JustDied(victim);
- }
- void JustSummoned(Creature* summoned)
- {
- summons.Summon(summoned);
- if (Unit* bossTarget = me->SelectNearestPlayer())
- {
- if (bossTarget && bossTarget->IsInWorld())
- {
- summoned->AddThreat(bossTarget, 100.0f);
- summoned->GetMotionMaster()->MoveChase(bossTarget, 300.0f);
- }
- }
- }
- void UpdateAI(uint32 diff) override
- {
- // Return since we have no target
- if (!UpdateVictim())
- return;
- _events.Update(diff);
- if (me->HasUnitState(UNIT_STATE_CASTING))
- return;
- if (_events.IsInPhase(PHASE_ONE) && HealthBelowPct(50))
- {
- _events.SetPhase(PHASE_TWO);
- Talk(SAY_PHASE_TRANSITION);
- _events.ScheduleEvent(EVENT_FEAR, urand(20000, 25000), 0, PHASE_TWO);
- _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(5000, 9000), 0, PHASE_TWO);
- }
- while (uint32 eventId = _events.ExecuteEvent())
- {
- switch (eventId)
- {
- case EVENT_FEAR:
- DoCastVictim(SPELL_HOWL_OF_FEAR);
- Talk(SAY_FEAR);
- _events.ScheduleEvent(EVENT_FEAR, urand(20000, 25000));
- break;
- case EVENT_SHADOW_VOLLEY:
- DoCastVictim(SPELL_SHADOW_VOLLEY);
- _events.ScheduleEvent(EVENT_SHADOW_VOLLEY, urand(8000, 13000));
- break;
- case EVENT_CLEAVE:
- DoCastVictim(SPELL_CLEAVE);
- _events.ScheduleEvent(EVENT_CLEAVE, urand(9000, 14000));
- break;
- case EVENT_BERSERK:
- DoCast(me, SPELL_BERSERK);
- Talk(SAY_BERSERK);
- break;
- case EVENT_RANDOM:
- Talk(SAY_RANDOM);
- _events.ScheduleEvent(EVENT_RANDOM, 40000);
- break;
- case EVENT_CHAOS:
- Talk(SAY_CHAOS);
- DoCastVictim(SPELL_CHAOS);
- me->SummonCreature(100049, me->GetPositionX()+5.0f, me->GetPositionY(), me->GetPositionZ() + 3.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
- me->SummonCreature(100049, me->GetPositionX()-5.0f, me->GetPositionY(), me->GetPositionZ() + 3.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
- me->SummonCreature(100049, me->GetPositionX(), me->GetPositionY()+5.0f, me->GetPositionZ() + 3.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
- me->SummonCreature(100049, me->GetPositionX(), me->GetPositionY()-5.0f, me->GetPositionZ() + 3.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
- _events.ScheduleEvent(EVENT_CHAOS, 75000);
- break;
- case EVENT_FEL_FIRE:
- for (uint64 i = 0; i < 5; i = i+1)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
- me->SummonGameObject(100050, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0);
- }
- me->SummonGameObject(100050, me->SelectNearestTarget()->GetPositionX(), me->SelectNearestTarget()->GetPositionY(), me->SelectNearestTarget()->GetPositionZ(), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 100);
- _events.ScheduleEvent(EVENT_FEL_FIRE, 20000);
- break;
- default:
- break;
- }
- }
- DoMeleeAttackIfReady();
- }
- private:
- EventMap _events;
- SummonList summons;
- };
- CreatureAI* GetAI(Creature* creature) const override
- {
- return new boss_netbusAI(creature);
- }
- };
- void AddSC_boss_netbus()
- {
- new boss_netbus();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement