Skip to content

Commit

Permalink
System - bloodLust buff and more settings fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed May 22, 2024
1 parent c7d5da5 commit 88c29e7
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 59 deletions.
47 changes: 46 additions & 1 deletion System/API/Buff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@
local _, br = ...
if br.api == nil then br.api = {} end

br.api.buffs = function(buff, v)
br.api.buffs = function(buff, k, v)
local buff = buff[k]
--- Cancel a buff.
-- @function buff.spell.cancel
-- @string[opt="player"] thisUnit The unit to check.
-- @string[opt="player"] sourceUnit The source of the buff.
buff.cancel = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return end
end
if br.UnitBuffID(thisUnit, v, sourceUnit) ~= nil then
br._G.RunMacroText("/cancelaura " .. br._G.GetSpellInfo(v))
end
Expand All @@ -23,6 +28,10 @@ br.api.buffs = function(buff, v)
-- @function buff.spell.count
-- @treturn number
buff.count = function()
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return 0 end
end
return tonumber(br.getBuffCount(v))
end

Expand All @@ -34,6 +43,10 @@ br.api.buffs = function(buff, v)
buff.duration = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return 0 end
end
return br.getBuffDuration(thisUnit, v, sourceUnit)
end

Expand All @@ -45,6 +58,10 @@ br.api.buffs = function(buff, v)
buff.exists = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return false end
end
return br.UnitBuffID(thisUnit, v, sourceUnit) ~= nil
end

Expand All @@ -54,6 +71,10 @@ br.api.buffs = function(buff, v)
-- @string[opt="player"] sourceUnit The source of the buff.
-- @treturn boolean
buff.down = function(thisUnit, sourceUnit)
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return true end
end
return not buff.exists(thisUnit, sourceUnit)
end

Expand All @@ -65,6 +86,10 @@ br.api.buffs = function(buff, v)
buff.react = function(thisUnit, sourceUnit)
thisUnit = thisUnit or "player"
sourceUnit = sourceUnit or "player"
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return false end
end
return br.getBuffReact(thisUnit, v, sourceUnit)
end

Expand All @@ -76,6 +101,10 @@ br.api.buffs = function(buff, v)
buff.remain = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return 0 end
end
return math.abs(br.getBuffRemain(thisUnit, v, sourceUnit))
end

Expand All @@ -87,6 +116,10 @@ br.api.buffs = function(buff, v)
buff.remains = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return 0 end
end
return math.abs(br.getBuffRemain(thisUnit, v, sourceUnit))
end

Expand All @@ -96,6 +129,10 @@ br.api.buffs = function(buff, v)
-- @string[opt="player"] sourceUnit The source of the buff.
-- @treturn boolean
buff.refresh = function(thisUnit, sourceUnit)
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return false end
end
return buff.remain(thisUnit, sourceUnit) <= buff.duration(thisUnit, sourceUnit) * 0.3
end

Expand All @@ -107,6 +144,10 @@ br.api.buffs = function(buff, v)
buff.stack = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return 0 end
end
return br.getBuffStacks(thisUnit, v, sourceUnit)
end

Expand All @@ -118,6 +159,10 @@ br.api.buffs = function(buff, v)
buff.stackMax = function(thisUnit, sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
if k == "bloodLust" then
v = br.getLustID()
if v == 0 then return 0 end
end
return br.auraMaxStacks[v] and (br.auraMaxStacks[v][thisUnit] or 0) or 0
end
end
2 changes: 0 additions & 2 deletions System/API/Module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ br.api.module = function(self)
end
end



--- Basic Healing Module - Uses healthstones, potions, and racial healing abilities.
-- @function module.BasicHealing
-- @bool[opt] section If set will generate the options for this module in the Profile Options. Otherwise, will run the module.
Expand Down
20 changes: 20 additions & 0 deletions System/API/UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ br.api.ui = function(self)
-- @number[opt=8] range - The range of the AOE damage in yards.
-- @number[opt=3] minCount - The minimum number of units to be in range before true
-- @string[opt="player"] useTarget - the reference unit to check range and units against.
-- #return boolean
ui.useST = function(range, minCount, useTarget)
if range == nil then range = 8 end
if minCount == nil then minCount = 3 end
Expand All @@ -238,6 +239,25 @@ br.api.ui = function(self)
end
end

if ui.useTrinkets == nil then
--- Checks if the option to use trinkets are valid per each Trinket slot.
-- @function ui.useTrinkets
-- @number trinket -The item id of the trinket to check for.
-- #return boolean
ui.useTrinkets = function(trinket)
for slotID = 13, 14 do
-- local useTrinket = (opValue == 1 or (opValue == 2 and (ui.useCDs() or ui.useAOE())) or (opValue == 3 and ui.useCDs()))
if self.use.able.slot(slotID)
and ui.alwaysCdAoENever("Trinket " .. slotID - 12)
and self.equiped.item(trinket, slotID)
then
return true
end
end
return false
end
end

if ui.value == nil then
--- Returns the value of the specified option.
-- @function ui.value
Expand Down
Loading

0 comments on commit 88c29e7

Please sign in to comment.