local ____lualib = require("lualib_bundle")
local __TS__ArraySome = ____lualib.__TS__ArraySome
local ____exports = {}
local ____cachedClasses = require("core.cachedClasses")
local game = ____cachedClasses.game
local ____flag = require("functions.flag")
local hasFlag = ____flag.hasFlag
--- Helper function to get the actual bit flag for modded curses.
-- 
-- Will throw a run-time error if the provided curse does not exist.
-- 
-- Use this over the `Isaac.GetCurseIdByName` method because that will return an integer instead of
-- a bit flag.
function ____exports.getCurseIDByName(self, name)
    local curseID = Isaac.GetCurseIdByName(name)
    if curseID == -1 then
        error(("Failed to get the curse ID corresponding to the curse name of \"" .. tostring(curseID)) .. "\". Does this name match what you put in the \"content/curses.xml\" file?")
    end
    return 1 << curseID - 1
end
--- Helper function to check if the current floor has a particular curse.
-- 
-- This function is variadic, meaning that you can specify as many curses as you want. The function
-- will return true if the level has one or more of the curses.
-- 
-- Under the hood, this function uses the `Level.GetCurses` method.
function ____exports.hasCurse(self, ...)
    local curses = {...}
    local level = game:GetLevel()
    local levelCurses = level:GetCurses()
    return __TS__ArraySome(
        curses,
        function(____, curse) return hasFlag(nil, levelCurses, curse) end
    )
end
return ____exports
