forked from Bastion/Bastion
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.
25 lines
582 B
25 lines
582 B
2 years ago
|
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
|