Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- enum BOSS_SPELLS
- {
- SPELL_CAST_TIME_INCREASE = 32264,
- SPELL_STUN = 45922,
- };
- enum MINION_SPELLS
- {
- SPELL_SLOW_SPEED = 35329
- };
- enum Phases
- {
- PHASE_1 = 1,
- PHASE_2 = 2,
- PHASE_3 = 3,
- PHASE_4 = 4
- };
- const float UNDEAD_FORM = 348;
- const float REGULAR_FORM = 1830;
- const float UNDEAD_PORTAL = 185871;
- class npc_jailor_borhuin : public CreatureScript
- {
- public:
- npc_jailor_borhuin() : CreatureScript("npc_jailor_borhuin") { }
- struct npc_jailor_borhuinAI : public ScriptedAI
- {
- npc_jailor_borhuinAI(Creature* creature) : ScriptedAI(creature), Summons(me) { }
- SummonList Summons;
- uint8 phase;
- uint32 summon_minion_timer;
- uint32 pool_timer;
- uint32 increaseCastSpeed_timer;
- void Reset()
- {
- phase = PHASE_1;
- summon_minion_timer = 10000;
- pool_timer = 8000;
- me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- me->SetVisible(true);
- Summons.DespawnAll();
- }
- void EnterCombat(Unit* who)
- {
- DoZoneInCombat();
- me->SummonGameObject(UNDEAD_PORTAL, 169.745270f, 4.757922, -25.606224, 0, 0, 0, 0, 0, 0);
- }
- void SummonMinion(uint32 entry, float x, float y, float z)
- {
- Creature* summoned = me->SummonCreature(entry, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
- if (summoned)
- {
- if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
- {
- summoned->AI()->AttackStart(target);
- summoned->AI()->DoCast(SPELL_SLOW_SPEED);
- Summons.Summon(summoned);
- }
- }
- }
- void UpdateAI(uint32 diff)
- {
- if (!UpdateVictim())
- return;
- if (me->HealthBelowPct(40) && phase == PHASE_1)
- {
- phase = PHASE_2;
- me->AttackStop();
- me->StopMoving();
- me->SetUInt32Value(UNIT_FIELD_DISPLAYID, UNDEAD_FORM);
- me->SetHealth(me->GetMaxHealth());
- }
- if (me->HealthBelowPct(30) && phase == PHASE_2)
- {
- phase = PHASE_3;
- me->AttackStop();
- me->StopMoving();
- me->SetUInt32Value(UNIT_FIELD_DISPLAYID, REGULAR_FORM);
- DoCastAOE(SPELL_STUN);
- }
- switch (phase)
- {
- case PHASE_1:
- if (summon_minion_timer <= diff)
- {
- //summon minions
- }
- else
- summon_minion_timer -= diff;
- if (pool_timer <= diff)
- {
- // pools
- }
- else
- pool_timer -= diff;
- break;
- case PHASE_2:
- if (pool_timer <= diff)
- {
- // pools
- }
- else
- pool_timer -= diff;
- if (increaseCastSpeed_timer <= diff)
- {
- std::list<Unit*> targetList;
- const std::list<HostileReference*>&threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
- {
- if (((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA))
- targetList.push_back((*itr)->getTarget());
- }
- Trinity::Containers::RandomResizeList(targetList, 5);
- for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
- {
- DoCast(*itr, SPELL_CAST_TIME_INCREASE);
- increaseCastSpeed_timer = 5000;
- }
- }
- else
- increaseCastSpeed_timer -= diff;
- break;
- case PHASE_3:
- break;
- case PHASE_4:
- break;
- }
- DoMeleeAttackIfReady();
- }
- };
- };
- class jailor_ghoul : public CreatureScript
- {
- public:
- jailor_ghoul() : CreatureScript("jailor_ghoul") { }
- struct jailor_ghoulAI : public ScriptedAI
- {
- jailor_ghoulAI(Creature* creature) : ScriptedAI(creature) { }
- void UpdateAI(uint32 diff)
- {
- if (!UpdateVictim())
- return;
- DoMeleeAttackIfReady();
- }
- };
- CreatureAI* GetAI(Creature* creature) const
- {
- return new jailor_ghoulAI(creature);
- }
- };
- void AddSC_npc_jailor_borhuin()
- {
- new npc_jailor_borhuin();
- new jailor_ghoul();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement