Files
2026-11-23 03:28:32 +02:00

150 lines
7.5 KiB
Lua

-- Chromaggus (Octo BigWigs Raids/BWL/Chromaggus.lua r30141), native server events.
-- boss_chromaggus.cpp: breaths Incinerate 23308, Time Lapse 23310, Corrosive Acid 23313, Ignite Flesh 23315,
-- Frost Burn 23187 (second IDs 23309/23311/23314/23316/23189 kept for safety); Frenzy 23128, Enrage 28747;
-- vulnerability auras Fire 22277, Frost 22278, Shadow 22279, Nature 22280, Arcane 22281; Bronze affliction 23170.
-- The vulnerability is read from Chromaggus's own aura instead of Octo's damage-size guessing.
local L = {
bar_frenzyCd = "Frenzy CD", bar_frenzyDur = "Frenzy!", msg_frenzy = "Frenzy - Tranq now!",
msg_lowHp = "Chromaggus under 25% - Enrages soon (at 20%)!", msg_enrage = "Chromaggus is Enraged!",
bar_breathCast = "Casting ", bar_breathCd = " CD", msg_breathSoon5 = " in 5 seconds", msg_breathCast = "Casting ",
trigger_vulnerabilityChanged = "flinches as its skin shimmers.",
msg_vulnerability = "Current Vulnerability - ", bar_vulnerability = " Vulnerability", unknown = "???",
msg_bronzeYou = "Brood Affliction: Bronze - Consider using Hourglass Sand",
}
local timer = {frenzyCd = {14.8, 17}, frenzyDur = 8, breathFirstCd = 30, breathCd = 28, breathCast = 2, vulnerability = 20}
local breaths = {
[23308] = {"Incinerate", "spell_fire_flameshock", "Red"}, [23309] = {"Incinerate", "spell_fire_flameshock", "Red"},
[23310] = {"Time Lapse", "spell_arcane_portalorgrimmar", "Yellow"}, [23311] = {"Time Lapse", "spell_arcane_portalorgrimmar", "Yellow"},
[23313] = {"Corrosive Acid", "spell_nature_acid_01", "Green"}, [23314] = {"Corrosive Acid", "spell_nature_acid_01", "Green"},
[23315] = {"Ignite Flesh", "spell_fire_fire", "Orange"}, [23316] = {"Ignite Flesh", "spell_fire_fire", "Orange"},
[23187] = {"Frost Burn", "spell_frost_chillingblast", "Blue"}, [23189] = {"Frost Burn", "spell_frost_chillingblast", "Blue"},
}
local vulnerabilities = {
[22277] = {"Fire", "spell_fire_flamebolt", "Red", {MAGE = true, WARLOCK = true}},
[22278] = {"Frost", "spell_frost_frostbolt02", "Blue", {MAGE = true}},
[22279] = {"Shadow", "spell_shadow_shadowbolt", "Black", {WARLOCK = true, PRIEST = true}},
[22280] = {"Nature", "spell_nature_protectionformnature", "Green", {SHAMAN = true, DRUID = true}},
[22281] = {"Arcane", "spell_nature_starfall", "Magenta", {MAGE = true, DRUID = true}},
}
local icon = {frenzy = "Ability_Druid_ChallangingRoar", tranquil = "Spell_Nature_Drowsy", enrage = "Spell_Shadow_UnholyFrenzy",
unknown = "INV_Misc_QuestionMark", bronze = "inv_misc_head_dragon_bronze"}
local CHROMAGGUS = 14020
local m = OctoBossMods:NewModule("Chromaggus", {npcs = {CHROMAGGUS}, displayName = "Chromaggus", zone = "Blackwing Lair"})
local function classIs(set) local _, class = UnitClass("player") return set[class] end
-- The two breaths are learned as they are cast; each shows as "???" until then.
local function breathInfo(self, slot)
local b = self.breath[slot]
if b then return b[1], b[2], b[3] end
return L.unknown, icon.unknown, "White"
end
local function countdown(self, delay, slot)
local name = breathInfo(self, slot)
self:DelayedMessage(delay - 5, name .. L.msg_breathSoon5, "Attention")
self:ScheduleEvent("three", function() self:Sound("Three") end, delay - 3)
self:ScheduleEvent("two", function() self:Sound("Two") end, delay - 2)
self:ScheduleEvent("one", function() self:Sound("One") end, delay - 1)
end
function m:OnEngage()
self.breath, self.nextSlot, self.vulnerability, self.lowHp = {}, 1, nil, nil
self.frenzyStart = 0
self:IntervalBar(L.bar_frenzyCd, timer.frenzyCd[1], timer.frenzyCd[2], icon.frenzy, true, "Black")
local name, ic, col = breathInfo(self, 1)
self:Bar(name .. L.bar_breathCd, timer.breathFirstCd, ic, true, col)
countdown(self, timer.breathFirstCd, 1)
self:ScheduleRepeatingEvent("health", function() self:HealthCheck() end, 1)
end
function m:HealthCheck()
if self.lowHp then return end
for _, unit in ipairs({"target", "focus", "mouseover"}) do
if OctoBossMods.NpcId(UnitGUID(unit)) == CHROMAGGUS then
local ok, low = pcall(function() return UnitHealth(unit) * 100 / UnitHealthMax(unit) <= 25 end)
if ok and low then
self.lowHp = true
self:Message(L.msg_lowHp, "Important")
end
return
end
end
end
function m:Breath(_, _, _, _, spellId)
local b = breaths[spellId]
if not b or not self:Throttle("breath", 5) then return end
-- The breaths alternate: fill the slot of the one being cast, then count down the other.
local slot = self.nextSlot
for i = 1, 2 do if self.breath[i] and self.breath[i][1] == b[1] then slot = i end end
if not self.breath[slot] then self.breath[slot] = b end
local other = slot == 1 and 2 or 1
self.nextSlot = other
for i = 1, 2 do
local name = breathInfo(self, i)
self:RemoveBar(name .. L.bar_breathCd)
self:CancelDelayedMessage(name .. L.msg_breathSoon5)
end
self:Message(L.msg_breathCast .. b[1], "Attention")
self:Bar(L.bar_breathCast .. b[1], timer.breathCast, b[2], true, b[3])
local name, ic, col = breathInfo(self, other)
self:DelayedBar(timer.breathCast, name .. L.bar_breathCd, timer.breathCd, ic, true, col)
countdown(self, timer.breathCast + timer.breathCd, other)
end
function m:Frenzy(_, _, dstGUID)
if OctoBossMods.NpcId(dstGUID) ~= CHROMAGGUS then return end
self:RemoveBar(L.bar_frenzyCd)
if classIs({HUNTER = true}) then
self:Message(L.msg_frenzy, "Urgent", false, "Info")
self:WarningSign(icon.tranquil, 1)
end
self:Bar(L.bar_frenzyDur, timer.frenzyDur, icon.frenzy, true, "Magenta")
self.frenzyStart = GetTime()
end
function m:FrenzyFade(_, _, dstGUID)
if OctoBossMods.NpcId(dstGUID) ~= CHROMAGGUS then return end
self:RemoveBar(L.bar_frenzyDur)
self:RemoveWarningSign(icon.tranquil)
local spent = GetTime() - (self.frenzyStart or GetTime())
self:IntervalBar(L.bar_frenzyCd, math.max(0.1, timer.frenzyCd[1] - spent), math.max(0.2, timer.frenzyCd[2] - spent), icon.frenzy, true, "Black")
end
function m:Enrage(_, _, dstGUID)
if OctoBossMods.NpcId(dstGUID) ~= CHROMAGGUS then return end
self:Message(L.msg_enrage, "Important", false, "Beware")
self:WarningSign(icon.enrage, 0.7)
end
function m:Vulnerability(_, _, dstGUID, _, spellId)
local v = vulnerabilities[spellId]
if not v or OctoBossMods.NpcId(dstGUID) ~= CHROMAGGUS then return end
if self.vulnerability then self:RemoveBar(self.vulnerability .. L.bar_vulnerability) end
self.vulnerability = v[1]
self:Bar(v[1] .. L.bar_vulnerability, timer.vulnerability, v[2], true, v[3])
self:Message(L.msg_vulnerability .. v[1], "Positive")
if classIs(v[4]) then self:WarningSign(v[2], 1) end
end
function m:Shimmer()
-- The emote precedes the new vulnerability aura; drop the old bar now.
if self.vulnerability then self:RemoveBar(self.vulnerability .. L.bar_vulnerability) end
self.vulnerability = nil
end
function m:BronzeYou(_, _, dstGUID)
if dstGUID ~= UnitGUID("player") then return end
self:WarningSign(icon.bronze, 1.5)
self:Message(L.msg_bronzeYou, "Personal", false, "Info")
end
local castStart = {}
for id in pairs(breaths) do castStart[id] = "Breath" end
local applied = {[23128] = "Frenzy", [28747] = "Enrage", [23170] = "BronzeYou"}
for id in pairs(vulnerabilities) do applied[id] = "Vulnerability" end
m.emotes = {{L.trigger_vulnerabilityChanged, "Shimmer"}}
m.events = {
SPELL_CAST_START = castStart,
SPELL_AURA_APPLIED = applied,
SPELL_AURA_REMOVED = {[23128] = "FrenzyFade"},
}