From a84930cef2a604777caab16b7d3fa8b86e92b6b3 Mon Sep 17 00:00:00 2001 From: LyLo Date: Tue, 22 Aug 2023 22:30:49 -0400 Subject: [PATCH] Change Spell:Cast add possibility to use functions as argument for condition --- src/Spell/Spell.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Spell/Spell.lua b/src/Spell/Spell.lua index 1cdc0a8..f4a5e19 100644 --- a/src/Spell/Spell.lua +++ b/src/Spell/Spell.lua @@ -161,11 +161,15 @@ end -- Cast the spell ---@param unit Unit ----@param condition string +---@param condition string|function ---@return boolean function Spell:Cast(unit, condition) - if condition and not self:EvaluateCondition(condition) then - return false + if condition then + if type(condition) == "string" and not self:EvaluateCondition(condition) then + return false + elseif type(condition) == "function" and not condition(self) then + return false + end end if not self:Castable() then