new conditional powertype

This commit is contained in:
Jrc13245
2025-11-25 15:10:02 -05:00
parent a33f3f21db
commit 139c95ba22
2 changed files with 47 additions and 0 deletions
+46
View File
@@ -2361,5 +2361,51 @@ CleveRoids.Keywords = {
if type(args) ~= "table" then return false end
return not CleveRoids.ValidateSwingTimer(args.operator, args.amount)
end, conditionals, "nostimer")
end,
-- Checks if the target uses a specific power type (mana, rage, energy)
powertype = function(conditionals)
local unit = conditionals.target or "target"
if not UnitExists(unit) then return false end
return Or(conditionals.powertype, function(powerTypeName)
local powerType = UnitPowerType(unit)
local powerTypeLower = string.lower(powerTypeName or "")
if powerTypeLower == "mana" then
return powerType == 0
elseif powerTypeLower == "rage" then
return powerType == 1
elseif powerTypeLower == "focus" then
return powerType == 2
elseif powerTypeLower == "energy" then
return powerType == 3
end
return false
end)
end,
-- Checks if the target does NOT use a specific power type
nopowertype = function(conditionals)
local unit = conditionals.target or "target"
if not UnitExists(unit) then return true end
return NegatedMulti(conditionals.nopowertype, function(powerTypeName)
local powerType = UnitPowerType(unit)
local powerTypeLower = string.lower(powerTypeName or "")
if powerTypeLower == "mana" then
return powerType ~= 0
elseif powerTypeLower == "rage" then
return powerType ~= 1
elseif powerTypeLower == "focus" then
return powerType ~= 2
elseif powerTypeLower == "energy" then
return powerType ~= 3
end
return true
end, conditionals, "nopowertype")
end
}
+1
View File
@@ -658,6 +658,7 @@ See the **[Macro Syntax Guide](#macro-syntax-guide)** above for detailed syntax
| party | [party] | | * | If the @unitid is in your party. |
| power | [power:>=X]<br/>[power:>=X/<=Y] | * | | The @unitid power (mana/rage/energy) **PERCENT** compared to X. |
| powerlost | [powerlost:>=X]<br/>[powerlost:>=X/<=Y] | * | | The @unitid power (mana/rage/energy) lost compared to X. |
| powertype | [powertype:mana]<br/>[powertype:rage]<br/>[powertype:energy]<br/>[powertype:mana/rage] | * | * | If the @unitid uses the specified power type(s). Valid types: mana, rage, energy, focus. Useful for checking if NPCs use mana or for player class detection. |
| raid | [raid] | | * | If the @unitid is in your raid. |
| rawhp | [rawhp:>=X]<br/>[rawhp:>=X/<=Y] | * | | The @unitid health compared to X. |
| rawpower | [rawpower:>=X]<br/>[rawpower:>=X/<=Y] | * | | The @unitid power (mana/rage/energy) compared to X. |