Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- -- Usage:
- local targets = GetRandomEnemies(unit, 3)
- for k, target in ipairs(targets) do
- unit:CastSpellv(target, 11)
- end
- ]]
- local function pick(n, t)
- if #t <= math.max(n, 0) then return t end
- local picked, remove, random = {}, table.remove, math.random
- for i = 1, n do
- picked[i] = remove(t, random(#t))
- end
- return picked
- end
- function GetRandomEnemies(unit, n)
- return pick(n, unit:GetInRangeEnemies())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement