Advertisement
Emulation

Untitled

May 15th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.89 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. enum BOSS_SPELLS
  4. {
  5.     SPELL_CAST_TIME_INCREASE = 32264,
  6.     SPELL_STUN = 45922,
  7. };
  8.  
  9. enum MINION_SPELLS
  10. {
  11.     SPELL_SLOW_SPEED = 35329
  12. };
  13.  
  14. enum Phases
  15. {
  16.     PHASE_1 = 1,
  17.     PHASE_2 = 2,
  18.     PHASE_3 = 3,
  19.     PHASE_4 = 4
  20. };
  21.  
  22. const float UNDEAD_FORM = 348;
  23. const float REGULAR_FORM = 1830;
  24.  
  25. const float UNDEAD_PORTAL = 185871;
  26.  
  27.  
  28. class npc_jailor_borhuin : public CreatureScript
  29. {
  30. public:
  31.     npc_jailor_borhuin() : CreatureScript("npc_jailor_borhuin") { }
  32.  
  33.     struct npc_jailor_borhuinAI : public ScriptedAI
  34.     {
  35.         npc_jailor_borhuinAI(Creature* creature) : ScriptedAI(creature), Summons(me) { }
  36.         SummonList Summons;
  37.  
  38.         uint8 phase;
  39.         uint32 summon_minion_timer;
  40.         uint32 pool_timer;
  41.         uint32 increaseCastSpeed_timer;
  42.  
  43.         void Reset()
  44.         {
  45.             phase = PHASE_1;
  46.             summon_minion_timer = 10000;
  47.             pool_timer = 8000;
  48.  
  49.             me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  50.             me->SetVisible(true);
  51.  
  52.             Summons.DespawnAll();
  53.         }
  54.  
  55.         void EnterCombat(Unit* who)
  56.         {
  57.             DoZoneInCombat();
  58.             me->SummonGameObject(UNDEAD_PORTAL, 169.745270f, 4.757922, -25.606224, 0, 0, 0, 0, 0, 0);
  59.         }
  60.  
  61.         void SummonMinion(uint32 entry, float x, float y, float z)
  62.         {
  63.             Creature* summoned = me->SummonCreature(entry, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
  64.             if (summoned)
  65.             {
  66.                 if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
  67.                 {
  68.                     summoned->AI()->AttackStart(target);
  69.                     summoned->AI()->DoCast(SPELL_SLOW_SPEED);
  70.                     Summons.Summon(summoned);
  71.                 }
  72.             }
  73.         }
  74.        
  75.         void UpdateAI(uint32 diff)
  76.         {
  77.             if (!UpdateVictim())
  78.                 return;
  79.  
  80.             if (me->HealthBelowPct(40) && phase == PHASE_1)
  81.             {
  82.                 phase = PHASE_2;
  83.                 me->AttackStop();
  84.                 me->StopMoving();
  85.                
  86.                 me->SetUInt32Value(UNIT_FIELD_DISPLAYID, UNDEAD_FORM);
  87.                 me->SetHealth(me->GetMaxHealth());
  88.             }
  89.  
  90.             if (me->HealthBelowPct(30) && phase == PHASE_2)
  91.             {
  92.                 phase = PHASE_3;
  93.                 me->AttackStop();
  94.                 me->StopMoving();
  95.  
  96.                 me->SetUInt32Value(UNIT_FIELD_DISPLAYID, REGULAR_FORM);
  97.                 DoCastAOE(SPELL_STUN);
  98.             }
  99.  
  100.             switch (phase)
  101.             {
  102.                 case PHASE_1:
  103.                     if (summon_minion_timer <= diff)
  104.                     {
  105.                         //summon minions
  106.                     }
  107.                     else
  108.                         summon_minion_timer -= diff;
  109.  
  110.                     if (pool_timer <= diff)
  111.                     {
  112.                         // pools
  113.                     }
  114.                     else
  115.                         pool_timer -= diff;
  116.  
  117.                     break;
  118.                 case PHASE_2:
  119.                     if (pool_timer <= diff)
  120.                     {
  121.                         // pools
  122.                     }
  123.                     else
  124.                         pool_timer -= diff;
  125.                     if (increaseCastSpeed_timer <= diff)
  126.                     {
  127.                         std::list<Unit*> targetList;
  128.  
  129.                         const std::list<HostileReference*>&threatList = me->getThreatManager().getThreatList();
  130.                         for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
  131.                         {
  132.                             if (((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA))
  133.                                 targetList.push_back((*itr)->getTarget());
  134.                         }
  135.  
  136.                         Trinity::Containers::RandomResizeList(targetList, 5);
  137.  
  138.                         for (std::list<Unit*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
  139.                         {
  140.                             DoCast(*itr, SPELL_CAST_TIME_INCREASE);
  141.                             increaseCastSpeed_timer = 5000;
  142.                         }
  143.                     }
  144.                     else
  145.                         increaseCastSpeed_timer -= diff;
  146.                     break;
  147.                 case PHASE_3:
  148.  
  149.                     break;
  150.                 case PHASE_4:
  151.  
  152.                     break;
  153.             }
  154.  
  155.             DoMeleeAttackIfReady();
  156.         }
  157.  
  158.     };
  159. };
  160.  
  161. class jailor_ghoul : public CreatureScript
  162. {
  163. public:
  164.     jailor_ghoul() : CreatureScript("jailor_ghoul") { }
  165.  
  166.     struct jailor_ghoulAI : public ScriptedAI
  167.     {
  168.         jailor_ghoulAI(Creature* creature) : ScriptedAI(creature) { }
  169.  
  170.         void UpdateAI(uint32 diff)
  171.         {
  172.             if (!UpdateVictim())
  173.                 return;
  174.  
  175.             DoMeleeAttackIfReady();
  176.         }
  177.     };
  178.  
  179.     CreatureAI* GetAI(Creature* creature) const
  180.     {
  181.         return new jailor_ghoulAI(creature);
  182.     }
  183. };
  184.  
  185. void AddSC_npc_jailor_borhuin()
  186. {
  187.     new npc_jailor_borhuin();
  188.     new jailor_ghoul();
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement