Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1. //
  2. #include "ScriptedPch.h"
  3.  
  4.  
  5. struct Memory of HoggerAI : public ScriptedAI
  6. {
  7. Memory of HoggerAI(Creature *c) : ScriptedAI(c)
  8. {
  9. }
  10.  
  11. uint32 spell1_phase1_Timer;
  12. uint32 spell1_phase2_Timer;
  13. uint32 spell2_phase2_Timer;
  14. uint32 spell3_phase2_Timer;
  15. uint32 spell1_phase3_Timer;
  16. uint32 spell1_phase4_Timer;
  17. uint32 spell1_phase5_Timer;
  18. uint32 phase1_Percent;
  19. uint32 phase2_Percent;
  20. uint32 phase3_Percent;
  21. uint32 phase4_Percent;
  22. uint32 phase5_Percent;
  23. uint32 phase;
  24.  
  25. bool enraged;
  26.  
  27. void EnterCombat(Unit *who)
  28. {
  29. }
  30.  
  31. void KilledUnit(Unit* victim)
  32. {
  33. }
  34.  
  35. void JustDied(Unit* Killer)
  36. {
  37. m_creature->MonsterYell("I...will....be back!", LANG_UNIVERSAL, NULL);
  38. DoCast(m_creature, 67729);
  39. }
  40.  
  41. void Reset()
  42. {
  43. spell1_phase1_Timer = 15000+rand()%5000;
  44. spell1_phase2_Timer = 15000+rand()%5000;
  45. spell2_phase2_Timer = 10000+rand()%5000;
  46. spell3_phase2_Timer = 10000+rand()%10000;
  47. spell1_phase3_Timer = 10000+rand()%5000;
  48. spell1_phase4_Timer = 3000+rand()%1000;
  49. spell1_phase5_Timer = 1000+rand()%1000;
  50. phase1_Percent = 100;
  51. phase2_Percent = 75;
  52. phase3_Percent = 50;
  53. phase4_Percent = 25;
  54. phase5_Percent = 0;
  55. phase = 0;
  56. enraged = false;
  57. }
  58.  
  59. void UpdateAI(const uint32 diff)
  60. {
  61. if (!UpdateVictim())
  62. return;
  63.  
  64. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 30) && !enraged)
  65. {
  66. enraged = true;
  67. DoCast(m_creature, 78722);
  68. m_creature->MonsterYell("Raaaaaaaaaaaaaaaaaaaa", LANG_UNIVERSAL, NULL);
  69. }
  70.  
  71. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 100) && phase == 0)
  72. {
  73. phase = 1;
  74. m_creature->MonsterYell("Die!", LANG_UNIVERSAL, NULL);
  75. }
  76.  
  77. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 75) && phase == 1)
  78. {
  79. phase = 2;
  80. m_creature->MonsterYell("Worthless Maggots!", LANG_UNIVERSAL, NULL);
  81. }
  82.  
  83. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 50) && phase == 2)
  84. {
  85. phase = 3;
  86. m_creature->MonsterYell("You...will....die!", LANG_UNIVERSAL, NULL);
  87. }
  88.  
  89. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 25) && phase == 3)
  90. {
  91. phase = 4;
  92. m_creature->MonsterYell("Scrubs!!", LANG_UNIVERSAL, NULL);
  93. }
  94.  
  95. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 0) && phase == 4)
  96. {
  97. phase = 5;
  98. m_creature->MonsterYell("Impossible!....", LANG_UNIVERSAL, NULL);
  99. }
  100.  
  101. if (phase == 1)
  102. {
  103.  
  104. if (spell1_phase1_Timer <= diff)
  105. {
  106. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 71504);
  107. spell1_phase1_Timer = 15000+rand()%5000;
  108. } else spell1_phase1_Timer -= diff;
  109. }
  110.  
  111. if (phase == 2)
  112. {
  113.  
  114. if (spell1_phase2_Timer <= diff)
  115. {
  116. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 67994);
  117. spell1_phase2_Timer = 15000+rand()%5000;
  118. } else spell1_phase2_Timer -= diff;
  119.  
  120. if (spell2_phase2_Timer <= diff)
  121. {
  122. DoCast(m_creature->getVictim(), 71130);
  123. spell2_phase2_Timer = 10000+rand()%5000;
  124. } else spell2_phase2_Timer -= diff;
  125.  
  126. if (spell3_phase2_Timer <= diff)
  127. {
  128. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 71504);
  129. spell3_phase2_Timer = 10000+rand()%10000;
  130. } else spell3_phase2_Timer -= diff;
  131. }
  132.  
  133. if (phase == 3)
  134. {
  135.  
  136. if (spell1_phase3_Timer <= diff)
  137. {
  138. DoCast(m_creature->getVictim(), 71130);
  139. spell1_phase3_Timer = 10000+rand()%5000;
  140. } else spell1_phase3_Timer -= diff;
  141. }
  142.  
  143. if (phase == 4)
  144. {
  145.  
  146. if (spell1_phase4_Timer <= diff)
  147. {
  148. DoCast(m_creature, 75382);
  149. spell1_phase4_Timer = 3000+rand()%1000;
  150. } else spell1_phase4_Timer -= diff;
  151. }
  152.  
  153. if (phase == 5)
  154. {
  155.  
  156. if (spell1_phase5_Timer <= diff)
  157. {
  158. DoCast(m_creature, 75382);
  159. spell1_phase5_Timer = 1000+rand()%1000;
  160. } else spell1_phase5_Timer -= diff;
  161. }
  162.  
  163. DoMeleeAttackIfReady();
  164. }
  165. };
  166.  
  167. CreatureAI* GetAIMemory of Hogger(Creature* pCreature)
  168. {
  169. return new Memory of HoggerAI (pCreature);
  170. }
  171.  
  172. void AddSC_Memory of Hogger()
  173. {
  174. Script *newscript;
  175. newscript = new Script;
  176. newscript->Name = "npc_Memory of Hogger";
  177. newscript->GetAI = &GetAIMemory of Hogger;
  178. newscript->RegisterSelf();
  179. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement