Advertisement
Guest User

RG

a guest
Aug 14th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. #include "ScriptMgr.h"
  2. #include "InstanceScript.h"
  3. #include "naxxramas.h"
  4. #include "ScriptedCreature.h"
  5.  
  6. enum Spells
  7. {
  8. SPELL_HATEFUL_STRIKE = 28308,
  9. SPELL_FRENZY = 28131,
  10. SPELL_BERSERK = 26662,
  11. SPELL_SLIME_BOLT = 32309,
  12.  
  13. //Vincent
  14. SPELL_ICE_BARRIER = 69787,
  15. SPELL_DEATHANDDECAY = 37788
  16. };
  17.  
  18. enum Yells
  19. {
  20. SAY_AGGRO = 0,
  21. SAY_SLAY = 1,
  22. SAY_DEATH = 2,
  23. EMOTE_BERSERK = 3,
  24. EMOTE_FRENZY = 4
  25. };
  26.  
  27. enum Events
  28. {
  29. EVENT_NONE,
  30. EVENT_BERSERK,
  31. EVENT_HATEFUL,
  32. EVENT_SLIME,
  33. /////
  34. EVENT_VINCENT
  35. };
  36.  
  37. enum Misc
  38. {
  39. ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286
  40. };
  41.  
  42. enum HatefulThreatAmounts
  43. {
  44. HATEFUL_THREAT_AMT = 1000,
  45. };
  46.  
  47. class boss_patchwerk : public CreatureScript
  48. {
  49. public:
  50. boss_patchwerk() : CreatureScript("boss_patchwerk") { }
  51.  
  52. CreatureAI* GetAI(Creature* creature) const override
  53. {
  54. return GetNaxxramasAI<boss_patchwerkAI>(creature);
  55. }
  56.  
  57. struct boss_patchwerkAI : public BossAI
  58. {
  59. boss_patchwerkAI(Creature* creature) : BossAI(creature, BOSS_PATCHWERK)
  60. {
  61. Enraged = false;
  62. }
  63.  
  64. bool Enraged;
  65.  
  66. void Reset() override
  67. {
  68. _Reset();
  69.  
  70. instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
  71. }
  72.  
  73. void KilledUnit(Unit* /*Victim*/) override
  74. {
  75. if (!(rand32() % 5))
  76. Talk(SAY_SLAY);
  77. }
  78.  
  79. void JustDied(Unit* /*killer*/) override
  80. {
  81. _JustDied();
  82. Talk(SAY_DEATH);
  83. }
  84.  
  85. void JustEngagedWith(Unit* /*who*/) override
  86. {
  87. _JustEngagedWith();
  88. Enraged = false;
  89. Talk(SAY_AGGRO);
  90. ////
  91. //DoCast(me, SPELL_ICE_BARRIER, true);
  92. //DoCastAOE(SPELL_DEATHANDDECAY);
  93. //DoCast(me, SPELL_DEATHANDDECAY, true);
  94. events.ScheduleEvent(EVENT_VINCENT, Seconds(1));
  95. //////
  96. //events.ScheduleEvent(EVENT_HATEFUL, Seconds(1));
  97. events.ScheduleEvent(EVENT_BERSERK, Minutes(6));
  98.  
  99. instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT);
  100. }
  101.  
  102. void UpdateAI(uint32 diff) override
  103. {
  104. if (!UpdateVictim())
  105. return;
  106.  
  107. events.Update(diff);
  108.  
  109. while (uint32 eventId = events.ExecuteEvent())
  110. {
  111. switch (eventId)
  112. {
  113. case EVENT_HATEFUL:
  114. {
  115. // Hateful Strike targets the highest non-MT threat in melee range on 10man
  116. // and the higher HP target out of the two highest non-MT threats in melee range on 25man
  117. ThreatReference* secondThreat = nullptr;
  118. ThreatReference* thirdThreat = nullptr;
  119.  
  120. ThreatManager const& mgr = me->GetThreatManager();
  121. Unit* currentVictim = mgr.GetCurrentVictim();
  122. auto list = mgr.GetModifiableThreatList();
  123. auto it = list.begin(), end = list.end();
  124. if (it == end)
  125. {
  126. EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
  127. return;
  128. }
  129.  
  130. if ((*it)->GetVictim() != currentVictim)
  131. secondThreat = *it;
  132. if ((!secondThreat || Is25ManRaid()) && (++it != end && (*it)->IsAvailable()))
  133. {
  134. if ((*it)->GetVictim() != currentVictim)
  135. (secondThreat ? thirdThreat : secondThreat) = *it;
  136. if (!thirdThreat && Is25ManRaid() && (++it != end && (*it)->IsAvailable()))
  137. thirdThreat = *it;
  138. }
  139.  
  140. Unit* pHatefulTarget = nullptr;
  141. if (!secondThreat)
  142. pHatefulTarget = currentVictim;
  143. else if (!thirdThreat)
  144. pHatefulTarget = secondThreat->GetVictim();
  145. else
  146. pHatefulTarget = (secondThreat->GetVictim()->GetHealth() < thirdThreat->GetVictim()->GetHealth()) ? thirdThreat->GetVictim() : secondThreat->GetVictim();
  147.  
  148. // add threat to highest threat targets
  149. AddThreat(currentVictim, HATEFUL_THREAT_AMT);
  150. if (secondThreat)
  151. secondThreat->AddThreat(HATEFUL_THREAT_AMT);
  152. if (thirdThreat)
  153. thirdThreat->AddThreat(HATEFUL_THREAT_AMT);
  154.  
  155. DoCast(pHatefulTarget, SPELL_HATEFUL_STRIKE, true);
  156.  
  157. events.Repeat(Seconds(1));
  158. break;
  159. }
  160. case EVENT_BERSERK:
  161. DoCast(me, SPELL_BERSERK, true);
  162. Talk(EMOTE_BERSERK);
  163. events.ScheduleEvent(EVENT_SLIME, Seconds(2));
  164. break;
  165. case EVENT_SLIME:
  166. DoCastAOE(SPELL_SLIME_BOLT, true);
  167. events.Repeat(Seconds(2));
  168. break;
  169. //////
  170. case EVENT_VINCENT:
  171. ThreatManager const& mgr = me->GetThreatManager();
  172. Unit* currentVictim = mgr.GetCurrentVictim();
  173. DoCast(currentVictim, SPELL_DEATHANDDECAY, true);
  174. ////////
  175. }
  176. }
  177.  
  178. if (!Enraged && HealthBelowPct(5))
  179. {
  180. DoCast(me, SPELL_FRENZY, true);
  181. Talk(EMOTE_FRENZY);
  182. Enraged = true;
  183. }
  184.  
  185. DoMeleeAttackIfReady();
  186. }
  187. };
  188.  
  189. };
  190.  
  191. void AddSC_boss_patchwerk()
  192. {
  193. new boss_patchwerk();
  194. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement