Thanks for the help people, checking to see if this makes sense. to be fair, i took much of it from the stuff that was there, and tried to edit it for my purposes. If you could take a look at this, and let me know what you think...
Code:
local max = math.max
local GetSpellInfo = GetSpellInfo
local GetNumGroupMembers = GetNumGroupMembers
local IsInRaid = IsInRaid
local UnitCanAssist = UnitCanAssist
local UnitDebuff = UnitDebuff
local UnitExists = UnitExists
local UnitGetIncomingHeals = UnitGetIncomingHeals
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs
local UnitGroupRolesAssigned = UnitGroupRolesAssigned
local UnitHealth = UnitHealth
local UnitHealthMax = UnitHealthMax
local UnitInParty = UnitInParty
local UnitInRange = UnitInRange
local UnitIsConnected = UnitIsConnected
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
local UnitIsFriend = UnitIsFriend
local UnitUsingVehicle = UnitUsingVehicle
-- riptide logic
local function missingRiptide(unit)
if UnitExists(unit)
and UnitCanAssist('player', unit)
and UnitIsFriend('player', unit)
and UnitIsConnected(unit)
and not UnitIsDeadOrGhost(unit)
and not UnitUsingVehicle(unit) then
if UnitInParty(unit) and not UnitInRange(unit) then
return false
end
if unitBuff("unit", GetSpellInfo(61295)") then
return false
end
return true
end
return false
end
needRiptide = function ()
local lowestUnit = 'player'
if missingRiptide('focus') then lowestUnit = 'focus' end
local lowest = 100
for _, unit in pairs(ProbablyEngine.raid.roster) do
if missingRiptide(unit.unit) and unit.health and unit.health < lowest then
lowest = unit.health
lowestUnit = unit.unit
end
end
return lowestUnit
end
if target == "shouldRiptide" then
target = needRiptide()
if target == false then return end
elseif target == "tank" then
if UnitExists("focus") then
target = "focus"
else
target = ProbablyEngine.raid.tank()
end
end
-- chain heal
local function hasRiptide(unit)
if UnitExists(unit)
and UnitCanAssist('player', unit)
and UnitIsFriend('player', unit)
and UnitIsConnected(unit)
and not UnitIsDeadOrGhost(unit)
and not UnitUsingVehicle(unit) then
if UnitInParty(unit) and not UnitInRange(unit) then
return false
end
if not unitBuff("unit", GetSpellInfo(61295)") then
return false
end
return true
end
return false
end
lowestRiptide = function ()
local lowestUnit = 'player'
if hasRiptide('focus') then lowestUnit = 'focus' end
local lowest = 100
for _, unit in pairs(ProbablyEngine.raid.roster) do
if hasRiptide(unit.unit) and unit.health and unit.health < lowest then
lowest = unit.health
lowestUnit = unit.unit
end
end
return lowestUnit
end
if target == "shouldChain" then
target = lowestRiptide()
if target == false then return end
elseif target == "tank" then
if UnitExists("focus") then
target = "focus"
else
target = ProbablyEngine.raid.tank()
end
end
ProbablyEngine.library.register('Boxo_Healing', Boxo_Healing)
Would be the library for creating the logics, and then something like:
{ "Riptide", "focus.buff(Riptide).duration > 6", "@Boxo_Healing.shouldRiptide" },
Does this look even close to right?