From 7b3b714d391ddb48db6d175b5191508edfa49ca0 Mon Sep 17 00:00:00 2001 From: 4n0n <4n0n@tinkr.site> Date: Wed, 2 Aug 2023 12:40:12 -0500 Subject: [PATCH] Add findanyof --- src/AuraTable/AuraTable.lua | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/AuraTable/AuraTable.lua b/src/AuraTable/AuraTable.lua index 5329d88..981b564 100644 --- a/src/AuraTable/AuraTable.lua +++ b/src/AuraTable/AuraTable.lua @@ -384,6 +384,43 @@ function AuraTable:FindAny(spell) return self:FindMy(spell) end +-- FindAnyOf +---@param spells List +---@return Aura +function AuraTable:FindAnyOf(spells) + return spells:find(function(spell) + return self:FindAny(spell):IsValid() + end) or Bastion.Aura:New() +end + +-- FindAnyOfMy +---@param spells List +---@return Aura +function AuraTable:FindAnyOfMy(spells) + return spells:find(function(spell) + return self:FindMy(spell):IsValid() + end) or Bastion.Aura:New() +end + +-- FindAnyOfTheirs +---@param spells List +---@return Aura +function AuraTable:FindAnyOfTheirs(spells) + return spells:find(function(spell) + return self:FindTheirs(spell):IsValid() + end) or Bastion.Aura:New() +end + +-- FindAnyFrom +---@param spells List +---@param source Unit +---@return Aura +function AuraTable:FindAnyFrom(spells, source) + return spells:find(function(spell) + return self:FindFrom(spell, source):IsValid() + end) or Bastion.Aura:New() +end + -- Has any stealable aura ---@return boolean function AuraTable:HasAnyStealableAura()