aggixx

Mannoroth.lua

Aug 13th, 2015
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.97 KB | None | 0 0
  1.  
  2. --------------------------------------------------------------------------------
  3. -- Module Declaration
  4. --
  5.  
  6. local mod, CL = BigWigs:NewBoss("Mannoroth", 1026, 1395)
  7. if not mod then return end
  8. mod:RegisterEnableMob(91305, 91241, 91349) -- Fel Iron Summoner, Doom Lord, Mannoroth
  9. mod.engageId = 1795
  10. mod.respawnTime = 30
  11.  
  12. --------------------------------------------------------------------------------
  13. -- Locals
  14. --
  15.  
  16. local portalsClosed = 0
  17. local phase = 1
  18. local curseCount = 1
  19.  
  20. --------------------------------------------------------------------------------
  21. -- Localization
  22. --
  23.  
  24. local L = mod:NewLocale("enUS", true)
  25. if L then
  26. L.doomLord = "Doom Lord portal closed!"
  27. L.imp = "Imp portal closed!"
  28. L.infernal = "Infernal portal closed!"
  29.  
  30. L.gaze = "Gaze (%d)"
  31. L.felseeker_message = "%s (%d) %dy" -- same as Margok's branded_say
  32.  
  33. L.custom_off_gaze_marker = "Mannoroth's Gaze marker"
  34. L.custom_off_gaze_marker_desc = "Mark the targets of Mannoroth's Gaze with {rt1}{rt2}{rt3}, requires promoted or leader."
  35. L.custom_off_gaze_marker_icon = 1
  36.  
  37. L.custom_off_doom_marker = "Mark of Doom marker"
  38. L.custom_off_doom_marker_desc = "Mark the targets of Mark of Doom with {rt4}{rt5}{rt6}, requires promoted or leader."
  39. L.custom_off_doom_marker_icon = 4
  40. end
  41. L = mod:GetLocale()
  42.  
  43. --------------------------------------------------------------------------------
  44. -- Initialization
  45. --
  46.  
  47. function mod:GetOptions()
  48. return {
  49. --[[ Mannoroth ]]--
  50. 181799, -- Shadowforce
  51. {181354, "TANK"}, -- Glaive Combo
  52. {181359, "TANK"}, -- Massive Blast
  53. 181557, -- Fel Hellstorm
  54. {181597, "SAY"}, -- Mannoroth's Gaze
  55. "custom_off_gaze_marker",
  56. 181735, -- Felseeker
  57. {186362, "SAY", "FLASH"}, -- Wrath of Gul'dan
  58. --[[ Adds ]]--
  59. {181275, "SAY", "ICON", "FLASH"}, -- Curse of the Legion
  60. {181119, "TANK"}, -- Doom Spike
  61. {181099, "PROXIMITY", "FLASH", "SAY"}, -- Mark of Doom
  62. "custom_off_doom_marker",
  63. 181126, -- Shadow Bolt Volley
  64. 181255, -- Fel Imp-losion
  65. 181180, -- Inferno
  66. --[[ General ]]--
  67. "stages",
  68. }, {
  69. [181799] = mod.displayName,
  70. [181275] = "adds",
  71. ["stages"] = "general",
  72. }
  73. end
  74.  
  75. function mod:OnBossEnable()
  76. self:Log("SPELL_CAST_START", "MannorothsGazeCast", 181597, 182006)
  77. self:Log("SPELL_AURA_APPLIED", "MannorothsGaze", 181597, 182006)
  78. self:Log("SPELL_AURA_REMOVED", "MannorothsGazeRemoved", 181597, 182006)
  79. self:Log("SPELL_CAST_START", "Shadowforce", 181799, 182084)
  80. self:Log("SPELL_CAST_START", "Felseeker", 181793, 181792, 181738) -- 10, 20, 30 yds
  81. self:Log("SPELL_CAST_START", "EmpoweredFelseeker", 182077, 182076, 182040)
  82. self:Log("SPELL_CAST_START", "GlaiveThrust", 183377, 185831)
  83. self:Log("SPELL_AURA_APPLIED", "MassiveBlast", 181359, 185821)
  84. self:Log("SPELL_CAST_SUCCESS", "FelHellstorm", 181557)
  85. -- Adds
  86. self:Log("SPELL_CAST_SUCCESS", "CurseOfTheLegionSuccess", 181275) -- APPLIED can miss
  87. self:Log("SPELL_AURA_APPLIED", "CurseOfTheLegion", 181275)
  88. self:Log("SPELL_AURA_REMOVED", "CurseOfTheLegionRemoved", 181275)
  89. self:Log("SPELL_CAST_START", "MarkOfDoomCast", 181099)
  90. self:Log("SPELL_AURA_APPLIED", "MarkOfDoom", 181099)
  91. self:Log("SPELL_AURA_REMOVED", "MarkOfDoomRemoved", 181099)
  92. self:Log("SPELL_AURA_APPLIED_DOSE", "DoomSpike", 181119)
  93. self:Log("SPELL_CAST_START", "ShadowBoltVolley", 181126)
  94. self:Log("SPELL_SUMMON", "FelImplosion", 181255)
  95. self:Log("SPELL_SUMMON", "Inferno", 181180)
  96. -- General
  97. self:Log("SPELL_AURA_APPLIED", "WrathOfGuldan", 186362)
  98. self:Log("SPELL_AURA_REMOVED", "WrathOfGuldanRemoved", 186362)
  99. self:Log("SPELL_AURA_REMOVED", "P1PortalClosed", 185147, 185175, 182212) -- Doom Lords, Imps, Infernals
  100. self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", nil, "boss1")
  101. end
  102.  
  103. function mod:OnEngage()
  104. portalsClosed = 0
  105. phase = 1
  106. curseCount = 1
  107. if self:Mythic() then -- non-mythic starts after the portals close
  108. self:Bar("stages", 15.5, 108508) -- Mannoroth's Fury
  109. self:CDBar(181275, 24) -- Curse of the Legion
  110. self:CDBar(181557, 30) -- Fel Hellstorm
  111. self:CDBar(181354, 43) -- Glaive Combo
  112. self:Bar(181255, 46.5) -- Fel Imp-losion
  113. self:CDBar(181735, 57) -- Felseeker
  114. self:Bar(181180, 70) -- Infernals
  115. end
  116. end
  117.  
  118. --------------------------------------------------------------------------------
  119. -- Event Handlers
  120. --
  121.  
  122. -- Adds
  123.  
  124. function mod:CurseOfTheLegionSuccess(args)
  125. curseCount = curseCount + 1
  126. if self:Mythic() then
  127. self:Bar(args.spellId, 65, CL.count:format(args.spellName, curseCount))
  128. end
  129. end
  130.  
  131. function mod:CurseOfTheLegion(args)
  132. self:TargetMessage(args.spellId, args.destName, "Attention", "Alarm", CL.count:format(args.spellName, curseCount-1))
  133. self:TargetBar(args.spellId, 20, args.destName)
  134. self:PrimaryIcon(args.spellId, args.destName)
  135. if self:Me(args.destGUID) then
  136. self:Say(args.spellId)
  137. self:Flash(args.spellId)
  138. end
  139. end
  140.  
  141. function mod:CurseOfTheLegionRemoved(args)
  142. self:StopBar(args.spellName, args.destName)
  143. self:PrimaryIcon(args.spellId)
  144. self:Message(args.spellId, "Important", "Warning", CL.spawned:format(self:SpellName(-11813))) -- Doom Lord
  145. self:Bar(181099, 12) -- Mark of Doom
  146. end
  147.  
  148. do
  149. local list = mod:NewTargetList()
  150. function mod:MarkOfDoomCast(args)
  151. wipe(list)
  152. self:Message(args.spellId, "Attention", "Info", CL.casting:format(args.spellName))
  153. end
  154.  
  155. function mod:MarkOfDoom(args)
  156. list[#list+1] = args.destName
  157. if #list == 1 then
  158. self:ScheduleTimer("TargetMessage", 2, args.spellId, list, "Attention", "Alarm")
  159. end
  160. if self:Me(args.destGUID) then
  161. self:Say(args.spellId, CL.count:format(args.spellName, #list))
  162. self:TargetBar(args.spellId, 15, args.destName)
  163. self:OpenProximity(args.spellId, 20)
  164. self:Flash(args.spellId)
  165. end
  166. print("Mark #"..#list.." out.");
  167. --[[if #list == 3 and self:GetOption("custom_off_doom_marker") then
  168. table.sort(list, function(a, b)
  169. if UnitGroupRolesAssigned(a) == "DAMAGER" then
  170. local c = select(3, UnitClass(a));
  171. if c == 1 then return true end
  172. if c == 2 or c == 4 or c == 6 or c == 10 then return true end
  173. end
  174. return false;````
  175. end);
  176. DevTools_Dump(list);
  177. for i=1,#list do
  178. local idx;
  179. if i == 1 then
  180. idx = 5;
  181. elseif i == 2 then
  182. idx = 4;
  183. else
  184. idx = 6;
  185. end
  186. SetRaidTarget(list[i], idx);
  187. end
  188. end]]
  189. if self:GetOption("custom_off_doom_marker") then
  190. SetRaidTarget(args.destName, 3+#list);
  191. end
  192. end
  193. end
  194.  
  195. function mod:MarkOfDoomRemoved(args)
  196. if self:Me(args.destGUID) then
  197. self:StopBar(args.spellName, args.destName)
  198. self:CloseProximity(args.spellId)
  199. end
  200. if self:GetOption("custom_off_doom_marker") then
  201. SetRaidTarget(args.destName, 0);
  202. end
  203. end
  204.  
  205. function mod:DoomSpike(args)
  206. if args.amount % 3 == 0 then
  207. self:StackMessage(args.spellId, args.destName, args.amount, "Urgent")
  208. end
  209. end
  210.  
  211. function mod:ShadowBoltVolley(args)
  212. self:Message(args.spellId, "Positive", nil, CL.casting:format(args.spellName))
  213. end
  214.  
  215. function mod:FelImplosion(args)
  216. if phase > 1 then
  217. self:CDBar(args.spellId, self:Mythic() and 49 or 30)
  218. end
  219. end
  220.  
  221. function mod:Inferno(args)
  222. if phase > 1 then
  223. self:CDBar(args.spellId, self:Mythic() and 55 or 35)
  224. end
  225. end
  226.  
  227. -- Mannoroth
  228.  
  229. do
  230. local list = mod:NewTargetList();
  231. local lastWrath = 0;
  232. local marks;
  233. local wrathsOut = {};
  234.  
  235. local function reset()
  236. wipe(list);
  237. marks = {
  238. ["MELEE"] = { 2, 7 }, -- circle x
  239. ["RANGED"] = { 3, 8 }, -- skull diamond
  240. };
  241. wrathsOut = {
  242. ["total"] = 0,
  243. ["MELEE"] = 0,
  244. ["RANGED"] = 0,
  245. };
  246. end
  247.  
  248. reset();
  249.  
  250. local function getDPSRole(unit)
  251. local c = select(2, UnitClass(unit));
  252. if c == "DEATHKNIGHT" or c == "WARRIOR" or c == "PALADIN" or c == "MONK" or c == "ROGUE" then
  253. return "MELEE";
  254. elseif c == "HUNTER" or c == "MAGE" or c == "WARLOCK" or c == "PRIEST" then
  255. return "RANGED";
  256. else
  257. if UnitPowerMax(unit, 0) > 100000 then
  258. return "RANGED";
  259. else
  260. return "MELEE";
  261. end
  262. end
  263. end
  264.  
  265. -- normalize case of words in 'str' to Title Case
  266. local function titlecase(str)
  267. local buf = {}
  268. for word in string.gmatch(str, "%S+") do
  269. local first, rest = string.sub(word, 1, 1), string.sub(word, 2)
  270. table.insert(buf, string.upper(first) .. string.lower(rest))
  271. end
  272. return table.concat(buf, " ")
  273. end
  274.  
  275. function mod:WrathOfGuldan(args)
  276. if GetTime() - lastWrath > 5 then
  277. reset();
  278. end
  279. lastWrath = GetTime();
  280.  
  281. list[#list + 1] = args.destName;
  282.  
  283. if self:Me(args.destGUID) then
  284. self:Say(args.spellId, CL.count:format(args.spellName, #list))
  285. self:Flash(args.spellId)
  286. end
  287.  
  288. wrathsOut.total = wrathsOut.total + 1;
  289.  
  290. if UnitGroupRolesAssigned(args.destName) == "DAMAGER" then
  291. local r = getDPSRole(args.destName);
  292. wrathsOut[r] = wrathsOut[r] + 1;
  293. if #marks[r] > 0 then
  294. print("Marking "..args.destName.." with {rt"..marks[r][#marks[r]].."}.");
  295. SetRaidTarget(args.destName, table.remove(marks[r]));
  296. else
  297. print("No mark available for "..r.." "..args.destName..".");
  298. end
  299. end
  300. end
  301.  
  302. function mod:WrathOfGuldanRemoved(args)
  303. SetRaidTarget(args.destName, 0);
  304.  
  305. if UnitGroupRolesAssigned(args.destName) == "DAMAGER" then
  306. local r = getDPSRole(args.destName);
  307. wrathsOut[r] = wrathsOut[r] - 1;
  308. if wrathsOut[r] == 0 then
  309. SendChatMessage(titlecase(r).." wraths clear.", "RAID_WARNING");
  310. end
  311. end
  312.  
  313. wrathsOut.total = wrathsOut.total - 1;
  314. if wrathsOut.total == 0 then
  315. SendChatMessage("*** ALL WRATHS CLEARED ***", "RAID_WARNING");
  316. end
  317. end
  318. end
  319.  
  320. function mod:GlaiveThrust(args)
  321. self:Message(181354, "Urgent", "Warning", args.spellName)
  322. end
  323.  
  324. function mod:MassiveBlast(args)
  325. self:TargetMessage(181359, args.destName, "Urgent", nil, args.spellName)
  326. end
  327.  
  328. do
  329. local list, isOnMe, timer = {}, nil, nil
  330. function mod:MannorothsGazeCast(args)
  331. timer, isOnMe = nil, nil
  332. wipe(list)
  333. self:Message(181597, "Attention", "Info", CL.casting:format(args.spellName))
  334. self:Bar(181597, 47, args.spellName)
  335. end
  336.  
  337. local function gazeSay(self, spellName)
  338. timer = nil
  339. sort(list)
  340. for i = 1, #list do
  341. local target = list[i]
  342. if target == isOnMe then
  343. local gaze = L.gaze:format(i)
  344. self:Say(181597, gaze)
  345. self:Message(181597, "Personal", "Alarm", CL.you:format(gaze))
  346. end
  347. if self:GetOption("custom_off_gaze_marker") then
  348. SetRaidTarget(target, i)
  349. end
  350. list[i] = self:ColorName(target)
  351. end
  352. if not isOnMe then
  353. self:TargetMessage(181597, list, "Attention")
  354. end
  355. end
  356.  
  357. function mod:MannorothsGaze(args)
  358. if self:Me(args.destGUID) then
  359. isOnMe = args.destName
  360. end
  361.  
  362. list[#list+1] = args.destName
  363. if #list == 1 then
  364. timer = self:ScheduleTimer(gazeSay, 0.5, self, args.spellName)
  365. elseif timer and #list == 3 then
  366. self:CancelTimer(timer)
  367. gazeSay(self, args.spellName)
  368. end
  369. end
  370.  
  371. function mod:MannorothsGazeRemoved(args)
  372. if self:GetOption("custom_off_gaze_marker") then
  373. SetRaidTarget(args.destName, 0)
  374. end
  375. end
  376. end
  377.  
  378. function mod:Shadowforce(args)
  379. self:Message(181799, "Important", "Long", CL.casting:format(args.spellName))
  380. self:Bar(181799, 8, CL.cast:format(args.spellName))
  381. self:CDBar(181799, 52, args.spellName)
  382. end
  383.  
  384. function mod:Felseeker(args)
  385. if args.spellId == 181793 then
  386. self:Message(181735, "Positive", "Alert", L.felseeker_message:format(args.spellName, 1, 10))
  387. elseif args.spellId == 181792 then
  388. self:Message(181735, "Positive", "Alert", L.felseeker_message:format(args.spellName, 2, 20))
  389. elseif args.spellId == 181738 then
  390. self:Message(181735, "Positive", "Alert", L.felseeker_message:format(args.spellName, 3, 30))
  391. end
  392. end
  393.  
  394. function mod:EmpoweredFelseeker(args)
  395. if args.spellId == 182077 then
  396. self:Message(181735, "Positive", "Alert", L.felseeker_message:format(args.spellName, 1, 10))
  397. elseif args.spellId == 182076 then
  398. self:Message(181735, "Positive", "Alert", L.felseeker_message:format(args.spellName, 2, 20))
  399. elseif args.spellId == 182040 then
  400. self:Message(181735, "Positive", "Alert", L.felseeker_message:format(args.spellName, 3, 30))
  401. end
  402. end
  403.  
  404. function mod:FelHellstorm(args)
  405. self:Message(args.spellId, "Attention")
  406. self:CDBar(args.spellId, 36)
  407. end
  408.  
  409. -- Phases
  410.  
  411. do
  412. local tbl = {
  413. [185147] = L.doomLord,
  414. [185175] = L.imp,
  415. [182212] = L.infernal,
  416. }
  417. function mod:P1PortalClosed(args)
  418. portalsClosed = portalsClosed + 1
  419. self:Message("stages", "Neutral", nil, tbl[args.spellId], false)
  420. if portalsClosed == 3 then
  421. self:ScheduleTimer("Message", 1, "stages", "Neutral", "Info", CL.stage:format(2), false)
  422. phase = 2
  423. if not self:Mythic() then -- already starting mythic timers on :OnEnage()
  424. self:CDBar(181557, 33) -- Fel Hellstorm
  425. self:CDBar(181597, 40) -- Mannoroth's Gaze
  426. self:CDBar(181354, 45) -- Glaive Combo
  427. self:CDBar(181735, 60) -- Felseeker
  428. end
  429. end
  430. end
  431. end
  432.  
  433. function mod:UNIT_SPELLCAST_SUCCEEDED(unit, spellName, _, _, spellId)
  434. --181156 = Summon Adds: Mythic, when Mannoroth spawns at ~17sec, not sure what it actually does (Doomguards?)
  435.  
  436. if spellId == 181301 then -- Summon Adds: P2 & Mythic P3
  437. self:Bar(181255, 25) -- Fel Imp-losion
  438. if self:Mythic() then
  439. self:StopBar(CL.count:format(self:SpellName(181275), curseCount))
  440. curseCount = 1
  441. self:Bar(181275, 45, CL.count:format(self:SpellName(181275), curseCount)) -- Curse of the Legion
  442. else
  443. self:Bar(181180, 48) -- Inferno
  444. end
  445.  
  446. elseif spellId == 182262 then -- Summon Adds: P3
  447. self:StopBar(181255) -- Fel Imp-losion
  448. self:Bar(181180, 28) -- Inferno
  449.  
  450. elseif spellId == 182263 then -- P3 Transform
  451. -- ~7s before: CHAT_MSG_MONSTER_YELL#Fear not, Mannoroth. The fel gift empowers you... Make them suffer!#Gul'dan
  452. self:Message("stages", "Neutral", "Info", CL.stage:format(3), false)
  453. phase = 3
  454. self:CDBar(181557, 24) -- Fel Hellstorm
  455. self:CDBar(181799, 26.5) -- Shadowforce, 26.5-31
  456. self:CDBar(181354, 36) -- Glaive Combo
  457. self:CDBar(181597, 40) -- Mannoroth's Gaze
  458. self:CDBar(181735, 60) -- Felseeker
  459. if self:Mythic() then
  460. self:Bar(186362, 5) -- Wrath of Gul'dan
  461. end
  462.  
  463. elseif spellId == 185690 then -- P4 Transform
  464. -- ~8s before: CHAT_MSG_MONSTER_YELL#These mortals cannot be this strong. Gul'dan, do something!#Mannoroth
  465. self:Message("stages", "Neutral", "Info", CL.stage:format(4), false)
  466. phase = 4
  467. self:StopBar(181557) -- Fel Hellstorm
  468. self:StopBar(181597) -- Mannoroth's Gaze
  469. self:StopBar(181799) -- Shadowforce
  470. self:StopBar(181735) -- Felseeker
  471. self:StopBar(181354) -- Glaive Combo
  472. self:CDBar(181557, 14, 181948) -- Empowered Fel Hellstorm
  473. self:CDBar(181354, 23, 187347) -- Empowered Glaive Combo
  474. self:CDBar(181799, 45, 182084) -- Empowered Shadowforce
  475. self:CDBar(181597, 30, 182006) -- Empowered Mannoroth's Gaze
  476. self:CDBar(181735, 60, 182077) -- Empowered Felseeker
  477. if self:Mythic() then
  478. self:Bar(186362, 5) -- Wrath of Gul'dan
  479. self:Bar(181255, 19) -- Fel Imp-losion
  480. end
  481.  
  482. elseif spellId == 181735 then -- Felseeker
  483. self:CDBar(181735, 50, phase == 4 and 182077) -- [Empowered] Felseeker
  484.  
  485. elseif spellId == 181354 then -- Glaive Combo
  486. self:CDBar(181354, 30.5, phase == 4 and 187347) -- [Empowered] Glaive Combo
  487.  
  488. end
  489. end
Advertisement
Add Comment
Please, Sign In to add comment