Guest User

Untitled

a guest
Jan 15th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.84 KB | None | 0 0
  1. enum Spells
  2. {
  3.     SPELL_CALL_THE_WIND = 88772,
  4. SPELL_STOP_CALL_THE_WIND = 88244,
  5.     SPELL_UPWIND_OF_ALTAIRUS = 88282,
  6.     SPELL_DOWNWIND_OF_ALTAIRUS = 88286,
  7.     SPELL_CHILLING_BREATH = 88308,
  8.     SPELL_LIGHTING_BLAST = 88357,
  9.     SPELL_TWISTING_WINDS = 88314
  10. };
  11.  
  12. class boss_altairus : public CreatureScript
  13. {
  14.     public:
  15.         boss_altairus() : CreatureScript("boss_altairus") {}
  16.  
  17.         CreatureAI* GetAI(Creature* pCreature) const
  18.         {
  19.            return new boss_altairusAI(pCreature);
  20.         }
  21.         struct boss_altairusAI : public ScriptedAI
  22. {
  23. boss_altairusAI(Creature* pCreature) : ScriptedAI(pCreature), Summons(me)
  24. {
  25. pInstance = pCreature->GetInstanceScript();
  26. }
  27.  
  28. InstanceScript *pInstance;
  29.             EventMap events;
  30.             SummonList Summons;
  31.             bool check_in;
  32.  
  33.             uint32 m_uiSayTimer; // Timer for random chat
  34.             uint32 m_uiRebuffTimer; // Timer for rebuffing
  35.             uint32 m_uiSpellTimerCTW; // Timer for spell 1 when in combat
  36.             uint32 m_uiSpellTimerCTW_stop; // Timer for spell 1 when in combat
  37.  
  38.             uint32 m_uiSpellTimerLB; // Timer for spell 1 when in combat
  39.             uint32 m_uiSpellTimerCB; // Timer until we go into Beserk (enraged) mode
  40.  
  41. uint32 m_uiSpellTimerSummTwister;
  42.  
  43.             uint32 m_uiPhase; // The current battle phase we are in
  44.             uint32 m_uiPhaseTimer; // Timer until phase transition
  45. bool isCTW;
  46. float windOrientation;
  47.  
  48.             void Reset ()
  49. {
  50.                 events.Reset();
  51.  
  52. m_uiPhase = 1; // Start in phase 1
  53.                 m_uiPhaseTimer = 60000; // 60 seconds
  54.  
  55.                 m_uiSpellTimerCTW = urand(10000,15000); // between 10 and 15 seconds
  56. m_uiSpellTimerCTW_stop = urand(2000,5000); // between 2 and 5 seconds
  57.  
  58.                 m_uiSpellTimerLB = urand(10000,20000); // between 10 and 20 seconds
  59.                 m_uiSpellTimerCB = urand(10000,20000); // between 10 and 20 seconds
  60.  
  61.                 m_uiSpellTimerSummTwister = 5000; // 2 minutes
  62.                                
  63.                 if (pInstance && (pInstance->GetData(DATA_ALTAIRUS_EVENT) != DONE && !check_in))
  64.                     pInstance->SetData(DATA_ALTAIRUS_EVENT, NOT_STARTED);
  65.                
  66.                 check_in = false;
  67. isCTW = false;
  68. }
  69.  
  70.             void JustDied(Unit* /*Kill*/)
  71.             {
  72.  
  73.                 if (pInstance)
  74.                     pInstance->SetData(DATA_ALTAIRUS_EVENT, DONE);
  75.             }
  76.  
  77.             void EnterCombat(Unit* /*Ent*/)
  78.             {
  79. if (pInstance)
  80.                     pInstance->SetData(DATA_ALTAIRUS_EVENT, IN_PROGRESS);
  81.  
  82.                 DoZoneInCombat();
  83. }
  84.  
  85. void UpdateAI(const uint32 uiDiff)
  86.             {
  87.                 if (!UpdateVictim()) /* No target to kill */
  88.                     return;
  89.  
  90. events.Update(uiDiff);
  91.  
  92. //Spell STOP CTW timer
  93. if (m_uiSpellTimerCTW <= uiDiff && isCTW)
  94. {
  95. if (me->HasAura(SPELL_CALL_THE_WIND))
  96. me-> RemoveAurasDueToSpell(SPELL_CALL_THE_WIND);
  97. DoCast(me, SPELL_STOP_CALL_THE_WIND);
  98. m_uiSpellTimerCTW_stop = urand(2000,5000);
  99. isCTW = false;
  100. }
  101. else if ( isCTW )
  102. m_uiSpellTimerCTW -= uiDiff;
  103.  
  104. //Spell CTW timer
  105. if (m_uiSpellTimerCTW_stop <= uiDiff && !isCTW)
  106. {
  107. DoCast(me, SPELL_CALL_THE_WIND);
  108. windOrientation = me->GetOrientation();
  109. m_uiSpellTimerCTW = urand(10000,20000);
  110. isCTW = true;
  111. }
  112. else if ( !isCTW )
  113. m_uiSpellTimerCTW_stop -= uiDiff;
  114.  
  115.                 //if (me->HasUnitState(UNIT_STAT_CASTING))
  116.                 // return;
  117.  
  118. //Spell CB timer
  119. if (m_uiSpellTimerCB <= uiDiff)
  120. {
  121. //Cast spell two on our current target.
  122. DoCast(me->getVictim(), SPELL_CHILLING_BREATH);
  123. m_uiSpellTimerCB = urand(10000,20000);
  124. }
  125. else
  126. m_uiSpellTimerCB -= uiDiff;
  127.  
  128. //Spell LB timer
  129. if (m_uiSpellTimerLB <= uiDiff)
  130. {
  131. //Cast spell one on our current target.
  132. DoCast(me->getVictim(), SPELL_LIGHTING_BLAST);
  133.  
  134. m_uiSpellTimerLB = urand(10000,20000);
  135. }
  136. else
  137. m_uiSpellTimerLB -= uiDiff;
  138.  
  139. //Spell m_uiSpellTimerSummTwister timer
  140. if (m_uiSpellTimerSummTwister <= uiDiff)
  141. {
  142. //Cast spell one on our current target.
  143. me->SummonCreature(47342, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
  144.                     DoCast(me->getVictim(), SPELL_TWISTING_WINDS);
  145.  
  146. m_uiSpellTimerSummTwister = 3000;
  147. }
  148. else
  149. m_uiSpellTimerSummTwister -= uiDiff;
  150.  
  151. Map* pMap = me->GetMap();
  152.                 Map::PlayerList const &PlayerList = pMap->GetPlayers();
  153.                 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
  154.                     if (Player* i_pl = i->getSource())
  155.                         if (i_pl->isAlive())
  156. if ( i_pl->isInFrontInMap(NULL , 4 , windOrientation ) )
  157. DoCast(i_pl, SPELL_UPWIND_OF_ALTAIRUS);
  158. else
  159. DoCast(i_pl, SPELL_DOWNWIND_OF_ALTAIRUS);
  160.  
  161.                
  162.             DoMeleeAttackIfReady();
  163.         }
  164.     };
  165.            
  166. };
  167.  
  168. void AddSC_boss_altairus()
  169. {
  170.     new boss_altairus();
  171. }
Add Comment
Please, Sign In to add comment