Guest User

Untitled

a guest
Nov 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. // Script Generated: 9/12/2011 9:24:00 PM
  2. // Run this query on your world database
  3. // UPDATE `creature_template` SET ScriptName='npc_Temple_Guardian_Anhuur' WHERE `entry`=39425;
  4. #include "ScriptPCH.h"
  5.  
  6.  
  7. class npc_Temple_Guardian_Anhuur : public CreatureScript
  8. {
  9. public:
  10. npc_Temple_Guardian_Anhuur() : CreatureScript("npc_Temple_Guardian_Anhuur") { }
  11.  
  12. CreatureAI* GetAI(Creature* creature) const
  13. {
  14. return new AnhuurAI (creature);
  15. }
  16.  
  17. struct AnhuurAI : public ScriptedAI
  18. {
  19. AnhuurAI(Creature *c) : ScriptedAI(c)
  20. {
  21.  
  22. uint32 spell1_phase1_Timer;
  23. uint32 spell2_phase1_Timer;
  24. uint32 spell1_phase2_Timer;
  25. uint32 spell2_phase2_Timer;
  26. uint32 spell1_phase3_Timer;
  27. uint32 spell2_phase3_Timer;
  28. uint32 phase1_Percent;
  29. uint32 phase2_Percent;
  30. uint32 phase3_Percent;
  31. uint32 phase4_Percent;
  32. uint32 phase;
  33. }
  34. void EnterCombat(Unit *who)
  35. {
  36. }
  37.  
  38. void KilledUnit(Unit* victim)
  39. {
  40. }
  41.  
  42. void JustDied(Unit* Killer)
  43. {
  44. }
  45.  
  46. void Reset()
  47. {
  48. spell1_phase1_Timer = 0;
  49. spell2_phase1_Timer = 1000+rand()%4000;
  50. spell1_phase2_Timer = 0;
  51. spell2_phase2_Timer = 1000+rand()%4000;
  52. spell1_phase3_Timer = 0;
  53. spell2_phase3_Timer = 1000+rand()%4000;
  54. phase1_Percent = 100;
  55. phase2_Percent = 66;
  56. phase3_Percent = 33;
  57. phase4_Percent = 0;
  58. phase = 0;
  59. m_creature->ApplySpellImmune(118, IMMUNITY_DAMAGE, 0, true);
  60. m_creature->ApplySpellImmune(605, IMMUNITY_DAMAGE, 0, true);
  61. m_creature->ApplySpellImmune(6770, IMMUNITY_DAMAGE, 0, true);
  62. m_creature->ApplySpellImmune(339, IMMUNITY_DAMAGE, 0, true);
  63. }
  64.  
  65. void UpdateAI(const uint32 diff)
  66. {
  67. if (!UpdateVictim())
  68. return;
  69.  
  70. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 100) && phase == 0)
  71. {
  72. phase = 1;
  73. m_creature->MonsterYell("Temple Guardian Anhuur yells: Turn back, intruders! These halls must not be disturbed!", LANG_UNIVERSAL, NULL);
  74. }
  75.  
  76. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 66) && phase == 1)
  77. {
  78. phase = 2;
  79. m_creature->MonsterYell("Beacons of light, bestow upon me your aegis!", LANG_UNIVERSAL, NULL);
  80. }
  81.  
  82. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 33) && phase == 2)
  83. {
  84. phase = 3;
  85. m_creature->MonsterYell("Beacons of light, bestow upon me your aegis!", LANG_UNIVERSAL, NULL);
  86. }
  87.  
  88. if ((m_creature->GetHealth() * 100 / m_creature->GetMaxHealth() <= 0) && phase == 3)
  89. {
  90. phase = 4;
  91. m_creature->MonsterYell("What... have you... done?", LANG_UNIVERSAL, NULL);
  92. }
  93.  
  94. if (phase == 1)
  95. {
  96.  
  97. if (spell1_phase1_Timer <= diff)
  98. {
  99. DoCast(m_creature, 75117);
  100. spell1_phase1_Timer = 0;
  101. } else spell1_phase1_Timer -= diff;
  102.  
  103. if (spell2_phase1_Timer <= diff)
  104. {
  105. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 75592);
  106. spell2_phase1_Timer = 1000+rand()%4000;
  107. } else spell2_phase1_Timer -= diff;
  108. }
  109.  
  110. if (phase == 2)
  111. {
  112.  
  113. if (spell1_phase2_Timer <= diff)
  114. {
  115. DoCast(m_creature, 74938);
  116. spell1_phase2_Timer = 0;
  117. } else spell1_phase2_Timer -= diff;
  118.  
  119. if (spell2_phase2_Timer <= diff)
  120. {
  121. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 75322);
  122. spell2_phase2_Timer = 1000+rand()%4000;
  123. } else spell2_phase2_Timer -= diff;
  124. }
  125.  
  126. if (phase == 3)
  127. {
  128.  
  129. if (spell1_phase3_Timer <= diff)
  130. {
  131. DoCast(m_creature, 74938);
  132. spell1_phase3_Timer = 0;
  133. } else spell1_phase3_Timer -= diff;
  134.  
  135. if (spell2_phase3_Timer <= diff)
  136. {
  137. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true), 75322);
  138. spell2_phase3_Timer = 1000+rand()%4000;
  139. } else spell2_phase3_Timer -= diff;
  140. }
  141.  
  142. if (phase == 4)
  143. {
  144. }
  145.  
  146. DoMeleeAttackIfReady();
  147. }
  148. };
  149.  
  150. void AddSC_npc_Temple_Guardian_Anhuur()
  151. {
  152. new npc_Temple_Guardian_Anhuur();
  153. }
Add Comment
Please, Sign In to add comment