From e35d19af3aa3994501139a25aac185f98ec164b3 Mon Sep 17 00:00:00 2001 From: jeffi Date: Mon, 26 Feb 2024 23:16:31 -0600 Subject: [PATCH] Fix `Item:Usable` and `Spell:Castable` --- src/Item/Item.lua | 4 ++-- src/Spell/Spell.lua | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Item/Item.lua b/src/Item/Item.lua index af7571a..8132913 100644 --- a/src/Item/Item.lua +++ b/src/Item/Item.lua @@ -366,8 +366,8 @@ function Item:Usable() if not self:EvaluateTraits() then return false end - if self:GetUsableFunction() then - return self:GetUsableFunction()(self) + if self:GetUsableFunction() and not self:GetUsableFunction()(self) then + return false end return self:IsEquippedAndUsable() diff --git a/src/Spell/Spell.lua b/src/Spell/Spell.lua index 510154b..e9c9d6e 100644 --- a/src/Spell/Spell.lua +++ b/src/Spell/Spell.lua @@ -421,9 +421,8 @@ function Spell:Castable() if not self:EvaluateTraits() then return false end - if self:GetCastableFunction() then - return self:GetCastableFunction()(self) and - self:IsKnownAndUsable(type(self.traits.cast.override) ~= nil and self.traits.cast.override or nil) + if self:GetCastableFunction() and not self:GetCastableFunction()(self) then + return false end return self:IsKnownAndUsable(type(self.traits.cast.override) ~= nil and self.traits.cast.override or nil)