87 lines
4.7 KiB
Lua
87 lines
4.7 KiB
Lua
-- Sorcerer-Thane Thaurissan (Octo BigWigs Raids/MC/Thaurissan.lua), Turtle MC boss, native server events.
|
|
-- boss_thane.cpp: Rune of Power 52724/52729 (the floor zone; aura on players standing in it), Rune of Detonation 52725
|
|
-- (leave the zone), Rune of Combustion 52726 (stay in it). The runes alternate every 18-22 s; the zone moves at 75/50/25%.
|
|
local THANE = {[57642] = true, [57645] = true}
|
|
local L = {
|
|
msg_detonation = "Get/Stay out of the Zone - Rune of Detonation", msg_combustion = "Get/Stay in the Zone - Rune of Combustion",
|
|
msg_combustion_out_of_zone = "Get back into the Zone!!!", msg_detonation_in_zone = "Get back out of the Zone!!!",
|
|
bar_runeDetonation = "Detonation (move out)", bar_runeCombustion = "Combustion (get in)",
|
|
bar_detonationNext = "Next Detonation Rune", bar_combustionNext = "Next Combustion Rune",
|
|
warn_detonation = "MOVE_OUT", warn_combustion = "GET_IN", msg_floorwarn = "Floor Zone moving soon! %s%%",
|
|
}
|
|
local timer = {runeCooldown = {18, 22}, runeDuration = 6}
|
|
local icon = {runeDetonation = "Spell_Shadow_Teleport", runeCombustion = "Spell_Fire_SealOfFire"}
|
|
local color = {runeDetonation = "Blue", runeCombustion = "Orange", runeUpcoming = "Gray"}
|
|
local POWER = {[52724] = true, [52729] = true}
|
|
|
|
local m = OctoBossMods:NewModule("Sorcerer-Thane Thaurissan", {npcs = {57642, 57645}, displayName = "Sorcerer-Thane Thaurissan",
|
|
zone = "Molten Core"})
|
|
|
|
function m:OnEngage()
|
|
self.detonation, self.combustion, self.inZone, self.nextFloor = false, false, false, 75
|
|
self:IntervalBar(L.bar_detonationNext, timer.runeCooldown[1], timer.runeCooldown[2], icon.runeDetonation, true, color.runeUpcoming)
|
|
self:ScheduleRepeatingEvent("floor", function() self:CheckHealth() end, 0.25)
|
|
end
|
|
function m:CheckHealth()
|
|
if self.nextFloor <= 0 then return self:CancelScheduledEvent("floor") end
|
|
for _, unit in ipairs({"target", "focus", "mouseover", "targettarget"}) do
|
|
if THANE[OctoBossMods.NpcId(UnitGUID(unit)) or 0] then
|
|
local ok, pct = pcall(function() return UnitHealth(unit) * 100 / UnitHealthMax(unit) end)
|
|
if ok and pct <= self.nextFloor + 3 then
|
|
self:Message(format(L.msg_floorwarn, self.nextFloor), "Attention")
|
|
self.nextFloor = self.nextFloor - 25
|
|
end
|
|
return
|
|
end
|
|
end
|
|
end
|
|
-- Cast once per rune: the bar and the next-rune countdown.
|
|
local function runeCast(self, key, bar, ic, col, nextBar, nextIcon)
|
|
if not self:Throttle(key, 5) then return end
|
|
self:RemoveBar(L.bar_detonationNext)
|
|
self:RemoveBar(L.bar_combustionNext)
|
|
self:Bar(bar, timer.runeDuration, ic, true, col)
|
|
self:ScheduleEvent("nextRune", function()
|
|
self:IntervalBar(nextBar, timer.runeCooldown[1] - timer.runeDuration, timer.runeCooldown[2] - timer.runeDuration, nextIcon, true, color.runeUpcoming)
|
|
end, timer.runeDuration)
|
|
end
|
|
function m:Detonation(_, _, dstGUID)
|
|
runeCast(self, "det", L.bar_runeDetonation, icon.runeDetonation, color.runeDetonation, L.bar_combustionNext, icon.runeCombustion)
|
|
if dstGUID ~= UnitGUID("player") then return end
|
|
self.detonation = true
|
|
self:Message(L.msg_detonation, "Personal", false, "RunAway")
|
|
self:WarningSign(icon.runeDetonation, timer.runeDuration, false, L.warn_detonation)
|
|
end
|
|
function m:DetonationFade(_, _, dstGUID)
|
|
if dstGUID ~= UnitGUID("player") then return end
|
|
self.detonation = false
|
|
self:RemoveBar(L.bar_runeDetonation)
|
|
self:RemoveWarningSign(icon.runeDetonation)
|
|
end
|
|
function m:Combustion(_, _, dstGUID)
|
|
runeCast(self, "comb", L.bar_runeCombustion, icon.runeCombustion, color.runeCombustion, L.bar_detonationNext, icon.runeDetonation)
|
|
if dstGUID ~= UnitGUID("player") then return end
|
|
self.combustion = true
|
|
self:Message(L.msg_combustion, "Personal", false, "Beware")
|
|
self:WarningSign(icon.runeCombustion, timer.runeDuration, false, L.warn_combustion)
|
|
end
|
|
function m:CombustionFade(_, _, dstGUID)
|
|
if dstGUID ~= UnitGUID("player") then return end
|
|
self.combustion = false
|
|
self:RemoveWarningSign(icon.runeCombustion)
|
|
end
|
|
function m:PowerIn(_, _, dstGUID, _, spellId)
|
|
if dstGUID ~= UnitGUID("player") or not POWER[spellId] then return end
|
|
self.inZone = true
|
|
if self.detonation then self:Message(L.msg_detonation_in_zone, "Personal", false, "RunAway") end
|
|
end
|
|
function m:PowerOut(_, _, dstGUID, _, spellId)
|
|
if dstGUID ~= UnitGUID("player") or not POWER[spellId] then return end
|
|
self.inZone = false
|
|
if self.combustion then self:Message(L.msg_combustion_out_of_zone, "Personal", false, "Beware") end
|
|
end
|
|
m.events = {
|
|
SPELL_AURA_APPLIED = {[52725] = "Detonation", [52726] = "Combustion", [52724] = "PowerIn", [52729] = "PowerIn"},
|
|
SPELL_AURA_REMOVED = {[52725] = "DetonationFade", [52726] = "CombustionFade", [52724] = "PowerOut", [52729] = "PowerOut"},
|
|
}
|