new conditional druidmana

This commit is contained in:
Jrc13245
2025-09-06 20:02:12 -04:00
parent 79e7e3fd9e
commit fe83793c0b
2 changed files with 32 additions and 2 deletions
+31 -2
View File
@@ -382,7 +382,7 @@ function CleveRoids.ValidatePower(unit, operator, amount)
if not unit or not operator or not amount then return false end
local powerPercent = 100 / UnitManaMax(unit) * UnitMana(unit)
if CleveRoids.operators[operator] then
if powerPercent and CleveRoids.operators[operator] then
return CleveRoids.comparators[operator](powerPercent, amount)
end
@@ -398,13 +398,35 @@ function CleveRoids.ValidateRawPower(unit, operator, amount)
if not unit or not operator or not amount then return false end
local power = UnitMana(unit)
if CleveRoids.operators[operator] then
if power and CleveRoids.operators[operator] then
return CleveRoids.comparators[operator](power, amount)
end
return false
end
-- Raw caster-form mana for druids (SuperWoW: 2nd return of UnitMana)
function CleveRoids.ValidateDruidRawMana(unit, operator, amount)
unit = unit or "player"
if not operator or amount == nil then return false end
if (CleveRoids.playerClass ~= "DRUID") then return false end
-- SuperWoW returns: current-form power, caster-form mana
local _, casterMana = UnitMana(unit)
-- Fallback: if for some reason we didn't get a 2nd value and we're in caster form now
if type(casterMana) ~= "number" then
if UnitPowerType and UnitPowerType(unit) == 0 then
casterMana = UnitMana(unit)
else
return false
end
end
local cmp = CleveRoids.comparators and CleveRoids.comparators[operator]
return cmp and cmp(casterMana, amount) or false
end
-- Checks whether or not the given unit has a power deficit vs the amount specified
-- unit: The unit we're checking
-- operator: valid comparitive operator symbol
@@ -1112,6 +1134,13 @@ CleveRoids.Keywords = {
end)
end,
druidmana = function(conditionals)
return And(conditionals.druidmana, function(args)
if type(args) ~= "table" then return false end
return CleveRoids.ValidateDruidRawMana("player", args.operator, args.amount)
end)
end,
powerlost = function(conditionals)
return And(conditionals.powerlost, function(args)
if type(args) ~= "table" then return false end
+1
View File
@@ -293,6 +293,7 @@ Check slash command and all conditional lists for new usages!
| mypowerlost | [mypowerlost:>=X]<br/>[mypowerlost:>=X/<=Y] | * | | The player's lost power (mana/rage/energy) compared to X. |
| myrawhp | [myrawhp:>=X]<br/>[myrawhp:>=X/<=Y] | * | | The player's health compared to X. |
| myrawpower | [myrawpower:>=X]<br/>[myrawpower:>=X/<=Y] | * | | The player's power (mana/rage/energy) compared to X. |
| druidmana | [druidmana:>=X]<br/>[druidmana:>=X/<=Y] | * | | The druid's mana compared to X. **ONLY FOR DRUIDS** **Works in Cat or Bear form.** |
| reactive | [reactive]<br/>[reactive:Overpower] | * | | If the player has the reactive ability (Revenge, Overpower, Riposte, etc.) available to use.<br/><br/>**NOTE: Currently requires the reactive ability to be somewhere on your actionbars in addition to any macros you're using it in. A planned future update will remove this requirement if using [Nampower](https://github.com/pepopo978/nampower).** |
| resting | [resting] | | * | If the player is resting (in an inn/capital city/etc.) |
| stance | [stance:0/1/2/3/4/5] | * | | If the player is in stance #.<br/>Supports Shadowform and Stealth as stance 1.|