diff --git a/Defensives.lua b/Defensives.lua index 2d4037f..d3c3808 100644 --- a/Defensives.lua +++ b/Defensives.lua @@ -6,7 +6,7 @@ CastAheadDefensives = { [266237] = { TANK = true, ep = { TANK = 29 }, lead = 2.3, aura = false, name = "Debilitating Backhand", mob = "Aka'ali the Conqueror", boss = "The Council of Tribes", dungeon = 1762, bar = true, school = 1, aoe = false }, [266923] = { DAMAGER = true, HEALER = true, TANK = true, ep = { DAMAGER = 164, HEALER = 171, TANK = 43 }, lead = 2.2, aura = true, name = "Galvanized", mob = "Lightning Spire", boss = "Galvazzt", dungeon = 1877, bar = false, school = 8, aoe = false }, [267618] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 161, HEALER = 183 }, lead = 2.1, aura = false, name = "Drain Fluids", mob = "Mchimba the Embalmer", boss = "Mchimba the Embalmer", dungeon = 1762, bar = true, school = 8, aoe = true }, - [267763] = { DAMAGER = true, ep = { DAMAGER = 225 }, lead = 4.2, aura = false, name = "Wretched Discharge", mob = "Half-Finished Mummy", boss = "", dungeon = 1762, bar = false, school = 8, aoe = true }, + [267763] = { DAMAGER = true, ep = { DAMAGER = 225 }, lead = 4.2, aura = false, name = "Wretched Discharge", mob = "Half-Finished Mummy", boss = "", dungeon = 1762, bar = false, school = 8, aoe = true, dispel = "Disease" }, [268590] = { TANK = true, ep = { TANK = 18 }, lead = 4.4, aura = false, name = "Blade Combo", mob = "King Dazar", boss = "King Dazar", dungeon = 1762, bar = true, school = 1, aoe = false }, [268591] = { TANK = true, ep = { TANK = 22 }, lead = 3.9, aura = false, name = "Blade Combo", mob = "King Dazar", boss = "King Dazar", dungeon = 1762, bar = false, school = 1, aoe = false }, [270293] = { TANK = true, ep = { TANK = 60 }, lead = 3.3, aura = false, name = "Purification Strike", mob = "Purification Construct", boss = "", dungeon = 1762, bar = false, school = 4, aoe = true }, @@ -17,17 +17,17 @@ CastAheadDefensives = { [372860] = { TANK = true, ep = { TANK = 87 }, lead = 3.2, aura = true, name = "Searing Wounds", mob = "Kokia Blazehoof", boss = "Kokia Blazehoof", dungeon = 2521, bar = false, school = 4, aoe = false }, [373688] = { DAMAGER = true, HEALER = true, TANK = true, ep = { DAMAGER = 217, HEALER = 197, TANK = 83 }, lead = 4.4, aura = false, name = "Frost Overload", mob = "Melidrussa Chillworn", boss = "Melidrussa Chillworn", dungeon = 2521, bar = true, school = 16, aoe = true }, [373692] = { TANK = true, ep = { TANK = 41 }, lead = 4.4, aura = false, name = "Inferno", mob = "Blazebound Destroyer", boss = "", dungeon = 2521, bar = false, school = 4, aoe = true }, - [373693] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 119, HEALER = 136 }, lead = 2.5, aura = true, name = "Living Bomb", mob = "Primalist Cinderweaver", boss = "", dungeon = 2521, bar = false, school = 4, aoe = false }, + [373693] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 119, HEALER = 136 }, lead = 2.5, aura = true, name = "Living Bomb", mob = "Primalist Cinderweaver", boss = "", dungeon = 2521, bar = false, school = 4, aoe = false, dispel = "Magic" }, [381513] = { TANK = true, ep = { TANK = 27 }, lead = 4.0, aura = false, name = "Stormslam", mob = "Erkhart Stormvein", boss = "Kyrakka and Erkhart Stormvein", dungeon = 2521, bar = true, school = 8, aoe = false }, [381862] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 112, HEALER = 108 }, lead = 2.1, aura = false, name = "Inferno Spit", mob = "Kyrakka", boss = "Kyrakka and Erkhart Stormvein", dungeon = 2521, bar = true, school = 4, aoe = false }, [384823] = { HEALER = true, TANK = true, ep = { HEALER = 156, TANK = 56 }, lead = 1.9, aura = false, name = "Inferno", mob = "Blazebound Firestorm", boss = "Kokia Blazehoof", dungeon = 2521, bar = false, school = 4, aoe = true }, [385567] = { TANK = true, ep = { TANK = 21 }, lead = 4.1, aura = false, name = "Flaming Barrage", mob = "Ashseer Flamelasher", boss = "", dungeon = 2521, bar = true, school = 4, aoe = false }, [395292] = { TANK = true, ep = { TANK = 78 }, lead = 4.1, aura = false, name = "Fire Maw", mob = "Flamegullet", boss = "", dungeon = 2521, bar = false, school = 4, aoe = false }, [474483] = { DAMAGER = true, HEALER = true, TANK = true, ep = { DAMAGER = 119, HEALER = 105, TANK = 44 }, lead = 3.3, aura = false, name = "Killing Spree", mob = "Zaen Bladesorrow", boss = "Zaen Bladesorrow", dungeon = 2813, bar = true, school = 1, aoe = true }, - [474515] = { TANK = true, ep = { TANK = 18 }, lead = 5.0, aura = true, name = "Heartstop Poison", mob = "Zaen Bladesorrow", boss = "Zaen Bladesorrow", dungeon = 2813, bar = false, school = 8, aoe = false }, + [474515] = { TANK = true, ep = { TANK = 18 }, lead = 5.0, aura = true, name = "Heartstop Poison", mob = "Zaen Bladesorrow", boss = "Zaen Bladesorrow", dungeon = 2813, bar = false, school = 8, aoe = false, dispel = "Poison" }, [474740] = { TANK = true, ep = { TANK = 152 }, lead = 2.3, aura = false, name = "Murder in a Row", mob = "Zaen Bladesorrow", boss = "Zaen Bladesorrow", dungeon = 2813, bar = true, school = 1, aoe = false }, [1214959] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 364, HEALER = 311 }, lead = 4.0, aura = false, name = "Chaotic Burst", mob = "Kystia Manaheart", boss = "Kystia Manaheart", dungeon = 2813, bar = false, school = 124, aoe = true }, - [1216590] = { TANK = true, ep = { TANK = 12 }, lead = 5.0, aura = false, name = "Heartstop Poison", mob = "Street Sneak", boss = "", dungeon = 2813, bar = false, school = 8, aoe = false }, + [1216590] = { TANK = true, ep = { TANK = 12 }, lead = 5.0, aura = false, name = "Heartstop Poison", mob = "Street Sneak", boss = "", dungeon = 2813, bar = false, school = 8, aoe = false, dispel = "Poison" }, [1216945] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 1608, HEALER = 1612 }, lead = 3.7, aura = false, name = "Searing Fel Flame", mob = "Lithiel Cinderfury", boss = "Lithiel Cinderfury", dungeon = 2813, bar = false, school = 4, aoe = true }, [1222103] = { DAMAGER = true, HEALER = true, TANK = true, ep = { DAMAGER = 259, HEALER = 271, TANK = 123 }, lead = 2.7, aura = false, name = "Nether Dash", mob = "Ethereal Shade", boss = "Taz'Rah", dungeon = 2923, bar = true, school = 32, aoe = false }, [1222642] = { TANK = true, ep = { TANK = 123 }, lead = 2.3, aura = false, name = "Hulking Claw", mob = "Atroxus", boss = "Atroxus", dungeon = 2923, bar = true, school = 8, aoe = false }, @@ -41,7 +41,7 @@ CastAheadDefensives = { [1236731] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 134, HEALER = 119 }, lead = 2.0, aura = false, name = "Thorncaller Roar", mob = "Ikuzz the Light Hunter", boss = "Ikuzz the Light Hunter", dungeon = 2859, bar = true, school = 8, aoe = true }, [1237093] = { TANK = true, ep = { TANK = 13 }, lead = 5.6, aura = false, name = "Crushing Footfalls", mob = "Ikuzz the Light Hunter", boss = "Ikuzz the Light Hunter", dungeon = 2859, bar = false, school = 8, aoe = true }, [1237330] = { TANK = true, ep = { TANK = 52 }, lead = 3.8, aura = false, name = "Bloodthorn Roots", mob = "Ikuzz the Light Hunter", boss = "Ikuzz the Light Hunter", dungeon = 2859, bar = false, school = 8, aoe = false }, - [1238084] = { TANK = true, ep = { TANK = 40 }, lead = 5.0, aura = true, name = "Spore Spines", mob = "Lasher", boss = "", dungeon = 2859, bar = false, school = 8, aoe = false }, + [1238084] = { TANK = true, ep = { TANK = 40 }, lead = 5.0, aura = true, name = "Spore Spines", mob = "Lasher", boss = "", dungeon = 2859, bar = false, school = 8, aoe = false, dispel = "Magic" }, [1238439] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 181, HEALER = 176 }, lead = 2.9, aura = true, name = "Razor Dive", mob = "Keen-Eyed Striker", boss = "", dungeon = 2825, bar = false, school = 1, aoe = false }, [1238463] = { DAMAGER = true, ep = { DAMAGER = 133 }, lead = 2.6, aura = false, name = "Lightmaw Beams", mob = "Overgrown Hydra", boss = "", dungeon = 2859, bar = false, school = 2, aoe = true }, [1239825] = { DAMAGER = true, HEALER = true, TANK = true, ep = { DAMAGER = 141, HEALER = 145, TANK = 71 }, lead = 2.1, aura = false, name = "Lightfire", mob = "Lightwarden Ruia", boss = "Lightwarden Ruia", dungeon = 2859, bar = true, school = 6, aoe = false }, @@ -53,7 +53,7 @@ CastAheadDefensives = { [1247052] = { DAMAGER = true, ep = { DAMAGER = 106 }, lead = 5.2, aura = true, name = "Lightbloom's Might", mob = "Environment", boss = "Ziekett", dungeon = 2859, bar = false, school = 2, aoe = false }, [1247746] = { TANK = true, ep = { TANK = 55 }, lead = 5.1, aura = false, name = "Thornspike", mob = "Ziekket", boss = "Ziekett", dungeon = 2859, bar = true, school = 1, aoe = false }, [1250695] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 154, HEALER = 147 }, lead = 2.7, aura = false, name = "Insidious Aura", mob = "Chitigoth", boss = "", dungeon = 2923, bar = false, school = 8, aoe = true }, - [1250937] = { DAMAGER = true, ep = { DAMAGER = 138 }, lead = 2.9, aura = false, name = "Toxic Spew", mob = "Potatoad Matriarch", boss = "", dungeon = 2859, bar = false, school = 8, aoe = true }, + [1250937] = { DAMAGER = true, ep = { DAMAGER = 138 }, lead = 2.9, aura = false, name = "Toxic Spew", mob = "Potatoad Matriarch", boss = "", dungeon = 2859, bar = false, school = 8, aoe = true, dispel = "Poison" }, [1252406] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 162, HEALER = 162 }, lead = 4.1, aura = false, name = "Dreadbellow", mob = "Devouring Brutalizer", boss = "", dungeon = 2923, bar = false, school = 32, aoe = true }, [1263420] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 539, HEALER = 568 }, lead = 3.0, aura = false, name = "Lightcrazed Frenzy", mob = "Ikuzz the Light Hunter", boss = "Ikuzz the Light Hunter", dungeon = 2859, bar = false, school = 2, aoe = true }, [1263628] = { DAMAGER = true, HEALER = true, ep = { DAMAGER = 139, HEALER = 129 }, lead = 1.7, aura = false, name = "Spouting Floret", mob = "Sporeblight Belcher", boss = "", dungeon = 2859, bar = false, school = 2, aoe = true }, diff --git a/Match.lua b/Match.lua index 6117db5..36cc307 100644 --- a/Match.lua +++ b/Match.lua @@ -163,6 +163,18 @@ function M.SaveAdvice(row) return key and M.HasButton() and M.ADVICE[key] or nil end +-- A debuff landing on the player. A healer who can remove it is told to, and +-- does the defensive only when the dispel is not there; everyone else, and +-- the second of two bombs, still needs the defensive. +function M.AuraAdvice(row, prio) + local category = row.dispel and M.DISPEL_CATEGORY[row.dispel] + if category and category ~= "BLEED" and row.HEALER and M.SpecRole() == "HEALER" + and M.PlayerCanHandle and M.PlayerCanHandle(category) then + return M.ADVICE[category] + end + return M.SaveAdvice({ save = row, prio = prio }) +end + function M.IsSave(advice) return advice == M.ADVICE.DEFENSIVE end diff --git a/Saves.lua b/Saves.lua index ec1bd6d..0a63311 100644 --- a/Saves.lua +++ b/Saves.lua @@ -437,7 +437,7 @@ local function RegisterAuraSounds() if not (CastAheadConfig.SaveCalls() and CastAheadConfig.Enabled("sound")) then return end local voice = CastAheadConfig.Enabled("voice") for spellID, row in pairs(CastAheadDefensives and CastAheadDefensives.spells or {}) do - local advice = row.aura and M.SaveAdvice({ save = row, prio = CastAheadPriority and CastAheadPriority[spellID] }) + local advice = row.aura and M.AuraAdvice(row, CastAheadPriority and CastAheadPriority[spellID]) local file = advice and (PickedFile(advice) or voice and SOUND_ROOT .. advice.file .. ".ogg") if file then local ok, id = pcall(C_UnitAuras.AddAuraSound, Enum.UnitAuraSoundTrigger.Added, { diff --git a/test_core.lua b/test_core.lua index b80b289..93808b4 100644 --- a/test_core.lua +++ b/test_core.lua @@ -3139,6 +3139,27 @@ do CastAheadDB.saveButtons = nil C_UnitAuras.AddAuraSound = function() error("restricted") end check(pcall(CastAheadSaves.Refresh) and CastAheadSaves.AuraSoundCount() == 0, "a failing AddAuraSound is skipped") + C_UnitAuras.AddAuraSound = function(trigger, info) files[#files + 1] = info.soundFileName return #files end + CastAheadDefensives = { spells = { [373693] = { DAMAGER = true, HEALER = true, aura = true, dispel = "Magic" }, + [1238084] = { TANK = true, aura = true, dispel = "Magic" } }, alias = {} } + local magic = { [527] = true, [4987] = true, [77130] = true, [88423] = true, [115450] = true, [360823] = true, + [32375] = true } + local savedIsPlayerSpell, knowsDispel = IsPlayerSpell, true + IsPlayerSpell = function(id) + if magic[id] then return knowsDispel and id == 527 end + return savedIsPlayerSpell == nil or savedIsPlayerSpell(id) + end + role = "HEALER" + fire("SPELLS_CHANGED") + check(files[#files]:match("Sounds\\en\\MAGIC%.ogg$") and CastAheadSaves.AuraSoundCount() == 1, + "a healer who can remove the magic hears the dispel, and nothing on a tank's debuff") + knowsDispel = false + fire("SPELLS_CHANGED") + check(files[#files]:match("Sounds\\en\\DEFENSIVE%.ogg$"), "a healer without a magic dispel hears the defensive") + knowsDispel, role = true, "DAMAGER" + fire("PLAYER_SPECIALIZATION_CHANGED", "player") + check(files[#files]:match("Sounds\\en\\DEFENSIVE%.ogg$"), "a damage dealer with a magic dispel still hears the defensive") + IsPlayerSpell = savedIsPlayerSpell C_UnitAuras.AddAuraSound, C_UnitAuras.RemoveAuraSound = nil, nil C_ChatInfo, InCombatLockdown, Enum.UnitAuraSoundTrigger = nil, nil, nil CastAheadDefensives = { spells = {}, alias = {} }