Bastion aims to serve as a highly performant, simplisitic, and expandable World of Warcraft data visualization framework.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bastion/scripts/shared/get-ranged-target-count.lua

25 lines
582 B

local
Tinkr,
---@type Bastion
Bastion = ...
local Player = Bastion.UnitManager:Get('player')
---@alias GetRangedTargetCount fun(range: number): number
---@type GetRangedTargetCount
local function GetRangedTargetCount(range)
local count = 0
Bastion.UnitManager:EnumEnemies(function(unit)
if not unit:IsDead() and unit:IsAffectingCombat() and Player:CanSee(unit) and Player:GetDistance(unit) <= range and Player:IsFacing(unit) then
count = count + 1
return false
end
return false
end)
return count
end
return GetRangedTargetCount