From 167ab96d34bbbc6b5f30914606b7890f7b540959 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Wed, 24 Dec 2025 11:13:40 -0500 Subject: [PATCH] consolidate some cc types --- Conditionals.lua | 48 +++++++++++++++++++++++++++++++++++------------- README.md | 10 ++++------ 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/Conditionals.lua b/Conditionals.lua index 7548115..083484f 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -2505,6 +2505,7 @@ end -- ============================================================================ -- Maps CC type names to mechanic constants (matches DBC mechanic IDs) +-- Note: Some types map to multiple mechanics via CCMechanicGroups below CleveRoids.CCMechanics = { -- Movement/control impairment charm = 1, -- Mind Control, Seduction @@ -2512,7 +2513,6 @@ CleveRoids.CCMechanics = { disorient = 2, -- Alias for disoriented disarm = 3, -- Disarm, Riposte disarm distract = 4, -- Distract (Rogue ability) - incapacitate = 4, -- Alias - some incaps use distract mechanic fear = 5, -- Fear, Psychic Scream, Howl of Terror grip = 6, -- Grip effects root = 7, -- Entangling Roots, Frost Nova, Improved Hamstring @@ -2521,34 +2521,37 @@ CleveRoids.CCMechanics = { sleep = 10, -- Hibernate, Wyvern Sting sleep snare = 11, -- Hamstring, Wing Clip, Crippling Poison slow = 11, -- Alias for snare - stun = 12, -- Cheap Shot, Kidney Shot, Hammer of Justice, Bash + stun = 12, -- Consolidated: Stun(12) + Knockout(14) + Sap(30) freeze = 13, -- Freeze effects (Frost Nova freeze) - knockout = 14, -- Gouge, Sap (incapacitate mechanic) - incap = 14, -- Alias for knockout (Gouge, Sap type) bleed = 15, -- Rend, Garrote, Deep Wounds polymorph = 17, -- Polymorph (all variants) banish = 18, -- Banish (Warlock) shackle = 20, -- Shackle Undead horror = 24, -- Death Coil (Warlock), Intimidating Shout (horror) daze = 27, -- Dazed effects - sap = 30, -- Sap (has its own mechanic in Turtle WoW) - sapped = 30, -- Alias for sap +} + +-- Mechanic groups: CC types that check multiple DBC mechanics +-- Used when a single conditional should match several related effects +CleveRoids.CCMechanicGroups = { + stun = {12, 14, 30}, -- Stun(12), Knockout/Gouge(14), Sap(30) } -- CC types that count as "crowd controlled" (loss of control) +-- Note: Mechanics 12, 14, 30 are all consolidated under "stun" for conditionals CleveRoids.CCTypesLossOfControl = { [1] = true, -- charm [2] = true, -- disoriented [5] = true, -- fear [10] = true, -- sleep - [12] = true, -- stun + [12] = true, -- stun (Cheap Shot, Kidney Shot, etc.) [13] = true, -- freeze - [14] = true, -- knockout/incapacitate + [14] = true, -- knockout/gouge (now part of stun group) [17] = true, -- polymorph [18] = true, -- banish [20] = true, -- shackle [24] = true, -- horror - [30] = true, -- sapped + [30] = true, -- sap (now part of stun group) } -- Complete spell ID to mechanic mapping from DBC data @@ -2736,15 +2739,34 @@ end function CleveRoids.ValidateUnitCC(unit, ccType) if not unit or not UnitExists(unit) then return false end - -- Get mechanic number from CC type name - local mechanic = CleveRoids.CCMechanics[string.lower(ccType or "")] - if not mechanic then return false end + local ccTypeLower = string.lower(ccType or "") -- Special case: "cc" means any loss-of-control effect - if ccType == "cc" or ccType == "any" then + if ccTypeLower == "cc" or ccTypeLower == "any" then return CleveRoids.ValidateUnitAnyCrowdControl(unit) end + -- Check if this CC type maps to a group of mechanics + local mechanicGroup = CleveRoids.CCMechanicGroups[ccTypeLower] + if mechanicGroup then + -- Check all mechanics in the group (e.g., stun checks 12, 14, 30) + for _, mechanic in ipairs(mechanicGroup) do + if CleveRoids.ValidateUnitCCSingleMechanic(unit, mechanic) then + return true + end + end + return false + end + + -- Single mechanic lookup + local mechanic = CleveRoids.CCMechanics[ccTypeLower] + if not mechanic then return false end + + return CleveRoids.ValidateUnitCCSingleMechanic(unit, mechanic) +end + +-- Validate a single CC mechanic on a unit (helper function) +function CleveRoids.ValidateUnitCCSingleMechanic(unit, mechanic) -- Use BuffLib if available (most accurate - tracks overflow debuffs and hidden auras) if CleveRoids.HasBuffLib() then local _, guid = UnitExists(unit) diff --git a/README.md b/README.md index 738ccb4..7de2bf4 100644 --- a/README.md +++ b/README.md @@ -653,7 +653,7 @@ Crowd control detection using DBC spell mechanic data (785 spells). | charm | | Mind Control, Seduction | | disorient | disoriented | Scatter Shot, Blind | | disarm | | Disarm | -| distract | incapacitate | Distract (Rogue) | +| distract | | Distract (Rogue) | | fear | | Fear, Psychic Scream, Howl of Terror, Intimidating Shout | | grip | | Grip effects | | root | | Entangling Roots, Frost Nova, Improved Hamstring | @@ -661,20 +661,18 @@ Crowd control detection using DBC spell mechanic data (785 spells). | silence | | Silence, Counterspell, Kick, Spell Lock | | sleep | | Hibernate, Wyvern Sting | | snare | slow | Hamstring, Wing Clip, Crippling Poison, Frostbolt | -| stun | | Cheap Shot, Kidney Shot, Hammer of Justice, Bash, War Stomp | +| stun | | Cheap Shot, Kidney Shot, Hammer of Justice, Bash, War Stomp, Gouge, Sap | | freeze | | Frost Nova freeze | -| knockout | incap | Gouge, Sap | | bleed | | Rend, Garrote, Deep Wounds | | polymorph | | Polymorph (all variants) | | banish | | Banish | | shackle | | Shackle Undead | | horror | | Death Coil | | daze | | Daze effects | -| sap | sapped | Sap | **Usage:** ```lua -/cast [cc:stun] Blessing of Freedom -- Target is stunned +/cast [cc:stun] Blessing of Freedom -- Target is stunned (includes Gouge, Sap) /cast [mycc:fear] Will of the Forsaken -- Player is feared /cast [@focus,nocc:polymorph] Fireball -- Focus not polymorphed /cast [cc:stun/fear/root] Dispel -- Any of these CCs @@ -682,7 +680,7 @@ Crowd control detection using DBC spell mechanic data (785 spells). ``` `[cc]` or `[nocc]` without a type checks for any **loss-of-control** effect: -stun, fear, sleep, charm, polymorph, banish, horror, freeze, knockout, disorient, shackle, sapped +stun, fear, sleep, charm, polymorph, banish, horror, freeze, disorient, shackle ---