diff --git a/Conditionals.lua b/Conditionals.lua index 624cabd..0a2344e 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -102,10 +102,9 @@ end -- Helper to choose And() or Or() based on operator metadata -- For negated conditionals (nomybuff, nozone, etc.): --- - OR separator (/) uses And() logic -> ALL negations must match (e.g., missing ALL buffs) --- - AND separator (&) uses Or() logic -> ANY negation can match (e.g., missing ANY buff) --- This is inverted from positive conditionals due to De Morgan's law: --- NOT(A OR B OR C) = (NOT A) AND (NOT B) AND (NOT C) +-- - AND separator (&) or comma-separated: ALL must pass (e.g., nomybuff:X&Y = missing X AND missing Y) +-- - OR separator (/): ANY can pass (e.g., nomybuff:X/Y = missing X OR missing Y) +-- The func already returns the negated check (e.g., "not has buff"), so we apply operators directly. local function NegatedMulti(t, func, conditionals, condition) if type(func) ~= "function" then return false end if type(t) ~= "table" then @@ -119,11 +118,11 @@ local function NegatedMulti(t, func, conditionals, condition) end if operatorType == "AND" then - -- AND separator (&): ANY negation can match - return Or(t, func) - else - -- OR separator (/) [default]: ALL negations must match + -- AND separator (&) or comma-separated: ALL negations must pass return And(t, func) + else + -- OR separator (/) [default]: ANY negation can pass + return Or(t, func) end end diff --git a/README.md b/README.md index de947cc..5a396e2 100644 --- a/README.md +++ b/README.md @@ -130,21 +130,29 @@ Both formats work identically: ### Multi-Value Conditionals -#### Conditionals are split by / for OR, & for AND... +#### Separators: `/` for OR, `&` for AND ```lua -[zone:Stormwind_City/Ironforge] -- In at least one of the zones -[zone:Stormwind_City&Ironforge] -- In both zones (impossible, but simple to understand) +[zone:Stormwind_City/Ironforge] -- In Stormwind OR Ironforge (either) +[zone:Stormwind_City&Ironforge] -- In Stormwind AND Ironforge (both - impossible, but illustrative) ``` -#### Negated Conditionals are reversed... + +#### Negated conditionals work the same way ```lua -[nozone:Stormwind_City/Ironforge] -- NOT in Stormwind AND NOT in Ironforge (neither) -[nozone:Stormwind_City&Ironforge] -- NOT in Stormwind OR NOT in Ironforge (either) +[nozone:Stormwind_City/Ironforge] -- NOT in Stormwind OR NOT in Ironforge (not in at least one) +[nozone:Stormwind_City&Ironforge] -- NOT in Stormwind AND NOT in Ironforge (not in either) ``` + +#### Comma-separated same conditionals = AND +```lua +[nomybuff:X, nomybuff:Y] -- Same as [nomybuff:X&Y] - missing both X AND Y +[mybuff:X, mybuff:Y] -- Same as [mybuff:X&Y] - has both X AND Y +``` + #### More Examples ```lua -[nomypower:>10/<20] -- Power NOT >10 AND NOT <20 -[nomybuff:Mark_of_the_Wild/Thorns] -- Missing both buffs -[nomybuff:"Seal of Wisdom"&"Seal of Light"] -- Missing at least one of the buffs +[nomybuff:Mark_of_the_Wild/Thorns] -- Missing at least one buff (OR) +[nomybuff:"Seal of Wisdom"&"Seal of Light"] -- Missing both buffs (AND) +[nomybuff:"Mind Quickening", nomybuff:"Arcane Power"] -- Missing both (comma = AND) ```