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

292 lines
16 KiB
Lua

-- Nefarian (Octo BigWigs Raids/BWL/Nefarian.lua r30141), native server events.
-- boss_victor_nefarius.cpp: Shadow Command 22667 (MC). boss_nefarian.cpp: Shadow Flame 22539, Bellowing Roar 22686,
-- Veil of Shadow 22687, Tail Lash 23364, class calls (Warrior 23397, Druid 23398, Priest 23401, Mage 23410,
-- Rogue 23414, Paladin 23418, Shaman 23425, Warlock 23427, Hunter 23436), Wild Polymorph 23603.
-- Corrupted Healing 23402 (23401 is the Priest call itself), Fear Ward 6346/19337. Drakonid deaths are counted from server deaths, no syncs.
local DRAKONIDS_MAX = 44 -- Nefarian lands at 40 dead; adds stop at 44.
local NEFARIAN, VICTOR = 11583, 10162
local drakonidColor = {[14264] = "red", [14261] = "blue", [14262] = "green", [14265] = "black", [14263] = "bronze", [14302] = "chromatic"}
local L = {
bar_mobsSpawn = "Drakonids Spawn", bar_mc = " MC", msg_mc = " mind controlled!",
msg_red = "Red Drakonids - Does: Cone Fire Stacking Dot - Resist: Fire",
msg_blue = "Blue Drakonids - Does: Mana Drain & Slow Atk Speed - Resist: Frost & Arcane",
msg_green = "Green Drakonids - Does: Stuns - Resist: Nature Resistant",
msg_black = "Black Drakonids - Does: Fire Attack - Resist: Shadow & Fire",
msg_bronze = "Bronze Drakonids - Does: Slow Atk & Cast Speed - Resist: Arcane",
msg_drakonids = "%d/" .. DRAKONIDS_MAX .. " Drakonids dead",
msg_landingParty = "Nefarian Lands very soon, Landing Party, get in position!",
trigger_landingStart = "Well done, my minions. The mortals' courage begins to wane!",
bar_landingStart = "Nefarian Lands", msg_landingStart = "Nefarian is landing!",
trigger_landingNow = "BURN! You wretches! BURN!",
bar_shadowFlameCast = "Casting Shadow Flame", msg_shadowFlameCast = "Casting Shadow Flame!", bar_shadowFlameCd = "Shadow Flame CD",
bar_fearCd = "Fear CD", bar_fearSoon = "Fear Soon...", bar_fearCast = "Casting Fear!", msg_fearCast = "Casting Fear!",
msg_fearWard = "You have Fear Ward!", msg_fearWardFade = "Fear Ward faded",
bar_curseCd = "Veil of Shadow CD", bar_curseDur = " Veil of Shadow", msg_curse = " Veil of Shadow - Decurse!",
bar_classCallSingle = "%s Class Call", bar_classCallPair = "%s & %s Class Call", bar_classCallFirst = "First Class Call",
bar_classCallSoon = "Class Call Soon", msg_classCall_soon3 = "Class Call in 3 seconds", warn_classCall = "CLASS CALL",
msg_classCall_DRUID = "Druid Call - Stuck in Cat Form!", msg_classCall_HUNTER = "Hunter Call - All Weapons Broken!",
msg_classCall_MAGE = "Mage Call - Random Polymorph in LoS!", msg_classCall_PALADIN = "Paladin Call - Harmful Blessings!",
msg_classCall_PRIEST = "Priest Call - Direct Heals Hurt - Use Renew / Shield only!",
msg_classCall_ROGUE = "Rogue Call - Rogues Teleported and Rooted!", msg_classCall_SHAMAN = "Shaman Call - Kill Totems!",
msg_classCall_WARLOCK = "Warlock Call - Kill the Infernals!", msg_classCall_WARRIOR = "Warrior Call - Stuck in Berserker Stance!",
DRUID = "Druid", HUNTER = "Hunter", MAGE = "Mage", PALADIN = "Paladin", PRIEST = "Priest", ROGUE = "Rogue",
SHAMAN = "Shaman", WARLOCK = "Warlock", WARRIOR = "Warrior",
bar_wildPolymorph = " Sheeped", msg_wildPolymorph = " Sheeped - Dispel!",
msg_corruptedHealing = "A Priest's direct heal caused Corrupted Healing!",
msg_lowHp = "Nefarian under 25% - Bone Constructs Soon (@ 20%)!",
trigger_boneConstructs = "Impossible! Rise my minions! Serve your master once more!",
msg_boneConstructs = "Bone Constructs incoming - AOE!",
msg_tailLash = "Tail Lash hits behind the boss for 30 yards.",
msg_parryYou = "Nefarian Parried your attack - Stop killing the tank you idiot!",
}
local classCallYells = {
{"Druids and your silly shapeshifting", "DRUID"}, {"Hunters, why rely on your weapons", "HUNTER"}, {"Mages too", "MAGE"},
{"Paladins, are you certain", "PALADIN"}, {"Priests! If you're going to keep", "PRIEST"}, {"Rogues? Stop hiding", "ROGUE"},
{"Shamans, show me", "SHAMAN"}, {"Warlocks, you shouldn't be playing", "WARLOCK"}, {"Warriors, I know you can hit harder", "WARRIOR"},
}
local classCallSpells = {[23397] = "WARRIOR", [23398] = "DRUID", [23401] = "PRIEST", [23410] = "MAGE", [23414] = "ROGUE",
[23418] = "PALADIN", [23425] = "SHAMAN", [23427] = "WARLOCK", [23436] = "HUNTER"}
local timer = {mobSpawn = 10, mcDur = 15, landing = 13, shadowFlameFirstCd = 19.7, shadowFlameCd = {16.5, 25}, shadowFlameCast = 2,
fearFirstCd = 18.5, fearCd = {25, 30}, fearSoon = 3.5, fearCast = 1.5, curseFirstCd = 5.0, curseCd = {10, 16}, curseDur = 6,
classCallFirstCd = 26.5, classCallCd = {25, 35}, classCallDur = 30, wildPolymorph = 20, tailLash = 2}
local icon = {phase = "inv_misc_head_dragon_01", mc = "Spell_Shadow_Charm", shadowFlame = "Spell_Fire_Incinerate",
fear = "Spell_Shadow_Possession", fearWard = "spell_holy_excorcism", berserker = "spell_nature_ancestralguardian",
curse = "Spell_Shadow_GatherShadows", classCall = "Spell_Shadow_Charm", DRUID = "ability_druid_catformattack",
HUNTER = "inv_ammo_arrow_01", MAGE = "spell_nature_polymorph", PALADIN = "spell_holy_sealofprotection", PRIEST = "spell_holy_renew",
ROGUE = "spell_shadow_teleport", SHAMAN = "spell_totem_wardofdraining", WARLOCK = "spell_shadow_summoninfernal",
WARRIOR = "ability_warrior_offensivestance", wildPolymorph = "spell_nature_polymorph", boneConstructs = "inv_misc_bone_02",
tailLash = "inv_misc_monsterscales_05", parry = "ability_parry"}
local color = {phase = "White", mc = "Black", shadowFlameCd = "Orange", shadowFlameCast = "Red", fearCd = "Yellow", fearSoon = "Green",
fearCast = "Magenta", curseCd = "Cyan", curseDur = "Blue", classCallCd = "White", classCallDur = "Black", wildPolymorph = "Black"}
local colorMsg = {red = {"msg_red", "Red"}, blue = {"msg_blue", "Blue"}, green = {"msg_green", "Green"},
black = {"msg_black", "Magenta"}, bronze = {"msg_bronze", "Yellow"}}
local m = OctoBossMods:NewModule("Nefarian", {npcs = {NEFARIAN, VICTOR}, killNpcs = {NEFARIAN}, displayName = "Nefarian",
zone = "Blackwing Lair", engageYells = {"Let the games begin!"}})
local function playerClass() local _, class = UnitClass("player") return class end
function m:OnEngage()
self.phase, self.seenColors, self.fearWard, self.lowHp = 1, {}, nil, nil
self.drakonids, self.landingWarned = 0, nil
self.classA, self.classB, self.classTime = nil, nil, 0
self:Bar(L.bar_mobsSpawn, timer.mobSpawn, icon.phase, true, color.phase)
self:ScheduleRepeatingEvent("health", function() self:HealthCheck() end, 1)
end
-- Phase 1: Victor Nefarius' Shadow Command and the drakonid waves.
function m:Mc(_, _, _, dstName)
if not dstName then return end
self:Bar(dstName .. L.bar_mc, timer.mcDur, icon.mc, true, color.mc)
self:Message(dstName .. L.msg_mc, "Urgent")
local class = playerClass()
if class == "MAGE" or class == "WARLOCK" then
self:WarningSign(icon.mc, 1)
self:Sound("Info")
end
self:SetRaidTargetForPlayer(dstName, 4)
end
function m:McFade(_, _, _, dstName)
if not dstName then return end
self:RemoveBar(dstName .. L.bar_mc)
self:RemoveWarningSign(icon.mc)
self:RestorePreviousRaidTargetForPlayer(dstName)
end
function m:OnCombatLog(sub, srcGUID, _, dstGUID)
-- Every drakonid death counts (the engine's own unit-death record keeps one per NPC entry).
local id = OctoBossMods.NpcId(sub == "UNIT_DIED" and dstGUID or srcGUID)
local kind = id and drakonidColor[id]
if not kind or self.phase ~= 1 then return end
local c = colorMsg[kind]
if c and not self.seenColors[kind] then
self.seenColors[kind] = true
self:Message(L[c[1]], c[2])
end
if sub == "UNIT_DIED" then
self.drakonids = self.drakonids + 1
if self.drakonids % 4 == 0 or self.drakonids >= DRAKONIDS_MAX - 8 then
self:Message(format(L.msg_drakonids, math.min(self.drakonids, DRAKONIDS_MAX)), "Attention")
end
if self.drakonids >= DRAKONIDS_MAX - 8 and not self.landingWarned then
self.landingWarned = true
self:Message(L.msg_landingParty, "Important", false, "Beware")
self:WarningSign(icon.phase, 1)
end
end
end
-- Phase 2: landing.
function m:LandingStart()
self.phase = 2
self:Bar(L.bar_landingStart, timer.landing, icon.phase, true, color.phase)
self:Message(L.msg_landingStart, "Important", false, "Beware")
self:WarningSign(icon.phase, 1)
end
local function fearSoonFor(self, delay)
self:DelayedBar(math.max(0, delay - timer.fearSoon), L.bar_fearSoon, timer.fearSoon, icon.fear, true, color.fearSoon)
if playerClass() == "WARRIOR" and not self.fearWard then
self:ScheduleEvent("berserker", function()
if not self.fearWard then self:WarningSign(icon.berserker, 1) self:Sound("BikeHorn") end
end, math.max(0, delay - 3.5))
end
end
function m:LandingNow()
self.phase = 2
self:RemoveBar(L.bar_landingStart)
self:Bar(L.bar_shadowFlameCd, timer.shadowFlameFirstCd, icon.shadowFlame, true, color.shadowFlameCd)
self:Bar(L.bar_fearCd, timer.fearFirstCd, icon.fear, true, color.fearCd)
fearSoonFor(self, timer.fearFirstCd)
self:Bar(L.bar_curseCd, timer.curseFirstCd, icon.curse, true, color.curseCd)
self:Bar(L.bar_classCallFirst, timer.classCallFirstCd, icon.classCall, true, color.classCallCd)
self:DelayedMessage(timer.classCallFirstCd - 3, L.msg_classCall_soon3, "Personal")
end
function m:ShadowFlame(srcGUID)
if OctoBossMods.NpcId(srcGUID) ~= NEFARIAN or not self:Throttle("sf", 3) then return end
self:RemoveBar(L.bar_shadowFlameCd)
self:Bar(L.bar_shadowFlameCast, timer.shadowFlameCast, icon.shadowFlame, true, color.shadowFlameCast)
self:Message(L.msg_shadowFlameCast, "Important", false, "Alarm")
self:ScheduleEvent("sfCd", function()
self:IntervalBar(L.bar_shadowFlameCd, timer.shadowFlameCd[1], timer.shadowFlameCd[2], icon.shadowFlame, true, color.shadowFlameCd)
end, timer.shadowFlameCast)
end
function m:Fear()
if not self:Throttle("fear", 3) then return end
self:RemoveBar(L.bar_fearCd)
self:CancelDelayedBar(L.bar_fearSoon)
self:RemoveBar(L.bar_fearSoon)
self:CancelScheduledEvent("berserker")
self:Bar(L.bar_fearCast, timer.fearCast, icon.fear, true, color.fearCast)
self:Message(L.msg_fearCast, "Urgent", false, "Alarm")
self:WarningSign(icon.fear, 0.7)
self:ScheduleEvent("fearCd", function()
self:IntervalBar(L.bar_fearCd, timer.fearCd[1], timer.fearCd[2], icon.fear, true, color.fearCd)
end, timer.fearCast)
fearSoonFor(self, timer.fearCast + timer.fearCd[2])
end
function m:FearWard(_, _, dstGUID)
if dstGUID ~= UnitGUID("player") or self.phase ~= 2 then return end
self.fearWard = true
self:CancelScheduledEvent("berserker")
self:Message(L.msg_fearWard, "Positive")
self:WarningSign(icon.fearWard, 1)
end
function m:FearWardFade(_, _, dstGUID)
if dstGUID ~= UnitGUID("player") or not self.fearWard then return end
self.fearWard = nil
self:Message(L.msg_fearWardFade, "Attention")
end
function m:Curse(_, _, _, dstName)
if not dstName then return end
if self:Throttle("curseCd", 3) then
self:RemoveBar(L.bar_curseCd)
self:ScheduleEvent("curseCd", function()
self:IntervalBar(L.bar_curseCd, timer.curseCd[1] - 5, timer.curseCd[2] - 5, icon.curse, true, color.curseCd)
end, 5)
end
self:Bar(dstName .. L.bar_curseDur, timer.curseDur, icon.curse, true, color.curseDur)
local class = playerClass()
if (class == "MAGE" or class == "DRUID") and self:Throttle("curseMsg", 1) then
self:Message(dstName .. L.msg_curse, "Urgent", false, "Info")
self:WarningSign(icon.curse, timer.curseDur)
end
end
function m:CurseFade(_, _, _, dstName)
if dstName then self:RemoveBar(dstName .. L.bar_curseDur) end
end
-- Class calls: the spell is authoritative; the yell is kept for wording the server may vary.
function m:ClassCall(class)
local now = GetTime()
local single = function(c) return format(L.bar_classCallSingle, L[c]) end
if self.classA and now - self.classTime < 4 then
if class == self.classA or class == self.classB then return end
self.classB = class
self:Message(L["msg_classCall_" .. class], "Positive")
if playerClass() == class then self:Sound("Beware") self:WarningSign(icon[class] or icon.classCall, 2, true, L.warn_classCall) end
self:RemoveBar(single(self.classA))
self:Bar(format(L.bar_classCallPair, L[self.classA], L[class]), math.max(1, timer.classCallDur - (now - self.classTime)),
icon.classCall, true, color.classCallDur)
return
end
if self.classA then
self:RemoveBar(single(self.classA))
if self.classB then self:RemoveBar(format(L.bar_classCallPair, L[self.classA], L[self.classB])) end
end
self.classA, self.classB, self.classTime = class, nil, now
self:RemoveBar(L.bar_classCallFirst)
self:CancelDelayedBar(L.bar_classCallSoon)
self:RemoveBar(L.bar_classCallSoon)
self:CancelDelayedMessage(L.msg_classCall_soon3)
self:Message(L["msg_classCall_" .. class], "Positive")
if playerClass() == class then self:Sound("Beware") self:WarningSign(icon[class] or icon.classCall, 2, true, L.warn_classCall) end
self:Bar(single(class), timer.classCallDur, icon.classCall, true, color.classCallDur)
self:DelayedBar(timer.classCallDur, L.bar_classCallSoon, timer.classCallCd[2] - timer.classCallDur, icon.classCall, true, color.classCallCd)
self:DelayedMessage(timer.classCallDur - 8, L.msg_classCall_soon3, "Personal")
end
function m:ClassCallSpell(srcGUID, _, _, _, spellId)
if OctoBossMods.NpcId(srcGUID) == NEFARIAN and classCallSpells[spellId] then self:ClassCall(classCallSpells[spellId]) end
end
function m:WildPolymorph(_, _, _, dstName)
if not dstName then return end
self:Bar(dstName .. L.bar_wildPolymorph, timer.wildPolymorph, icon.wildPolymorph, true, color.wildPolymorph)
local class = playerClass()
if class == "PRIEST" or class == "PALADIN" then
self:Message(dstName .. L.msg_wildPolymorph, "Urgent", false, "Info")
self:WarningSign(icon.wildPolymorph, 0.7)
end
end
function m:WildPolymorphFade(_, _, _, dstName) if dstName then self:RemoveBar(dstName .. L.bar_wildPolymorph) end end
function m:CorruptedHealing()
if self:Throttle("corrupted", 5) then self:Message(L.msg_corruptedHealing, "Attention") end
end
function m:HealthCheck()
if self.lowHp or self.phase ~= 2 then return end
for _, unit in ipairs({"target", "focus", "mouseover"}) do
if OctoBossMods.NpcId(UnitGUID(unit)) == NEFARIAN 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, "Attention", false, "Alert")
end
return
end
end
end
function m:BoneConstructs()
self:Message(L.msg_boneConstructs, "Attention", false, "Beware")
self:WarningSign(icon.boneConstructs, 1)
end
function m:TailLash(_, _, dstGUID)
if dstGUID ~= UnitGUID("player") or not self:Throttle("tail", 2) then return end
self:Message(L.msg_tailLash, "Personal")
self:WarningSign(icon.tailLash, timer.tailLash)
end
-- Own swings parried by Nefarian (the server's own melee result).
local baseCombatLog = m.OnCombatLog
function m:OnCombatLog(sub, srcGUID, srcName, dstGUID, dstName, missType, ...)
baseCombatLog(self, sub, srcGUID, srcName, dstGUID, dstName, missType, ...)
if sub == "SWING_MISSED" and missType == "PARRY" and srcGUID == UnitGUID("player") and OctoBossMods.NpcId(dstGUID) == NEFARIAN
and self:Throttle("parry", 2) then
self:WarningSign(icon.parry, 0.7)
self:Message(L.msg_parryYou, "Personal", false, "Info")
end
end
m.yells = {{L.trigger_landingStart, "LandingStart"}, {L.trigger_landingNow, "LandingNow"}, {L.trigger_boneConstructs, "BoneConstructs"}}
for _, entry in ipairs(classCallYells) do
local class = entry[2]
m.yells[#m.yells + 1] = {entry[1], function(self) self:ClassCall(class) end}
end
local classSuccess = {}
for id in pairs(classCallSpells) do classSuccess[id] = "ClassCallSpell" end
m.events = {
SPELL_AURA_APPLIED = {[22667] = "Mc", [22687] = "Curse", [23603] = "WildPolymorph", [23402] = "CorruptedHealing", [6346] = "FearWard", [19337] = "FearWard"},
SPELL_AURA_REMOVED = {[22667] = "McFade", [22687] = "CurseFade", [23603] = "WildPolymorphFade", [6346] = "FearWardFade",
[19337] = "FearWardFade"},
SPELL_CAST_START = {[22539] = "ShadowFlame", [22686] = "Fear"},
SPELL_CAST_SUCCESS = classSuccess,
SPELL_DAMAGE = {[23364] = "TailLash"},
}