Skip to content

Commit

Permalink
always check if an aa or ability is ready before we try to use it.
Browse files Browse the repository at this point in the history
  • Loading branch information
nandor committed Jan 10, 2024
1 parent ec1d0a7 commit 6f184ad
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion extras/version.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return { commitId = '5f561b8 2024-01-10' }
return { commitId = 'ec1d0a7 2024-01-10' }
22 changes: 18 additions & 4 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ function Utils.AAReady(aaName)
return Utils.CanUseAA(aaName) and mq.TLO.Me.AltAbilityReady(aaName)()
end

---@param aaName string
---@return boolean
function Utils.AbilityReady(aaName)
return mq.TLO.Me.AbilityReady(aaName)()
end

---@param aaName string
---@return number
function Utils.AARank(aaName)
Expand Down Expand Up @@ -740,13 +746,21 @@ function Utils.ExecEntry(caller, entry, targetId, resolvedActionMap, bAllowMem)
end

if entry.type:lower() == "aa" then
Utils.UseAA(entry.name, targetId)
ret = true
if Utils.AAReady(entry.name) then
Utils.UseAA(entry.name, targetId)
ret = true
else
ret = false
end
end

if entry.type:lower() == "ability" then
Utils.UseAbility(entry.name)
ret = true
if Utils.AbilityReady(entry.name) then
Utils.UseAbility(entry.name)
ret = true
else
ret = false
end
end

if entry.type:lower() == "customfunc" then
Expand Down

0 comments on commit 6f184ad

Please sign in to comment.