local ____lualib = require("lualib_bundle")
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
local ____ModCallbackCustom = require("enums.ModCallbackCustom")
local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
local ____playerIndex = require("functions.playerIndex")
local isChildPlayer = ____playerIndex.isChildPlayer
local ____players = require("functions.players")
local getPlayerNumHitsRemaining = ____players.getPlayerNumHitsRemaining
local ____revive = require("functions.revive")
local willPlayerRevive = ____revive.willPlayerRevive
local ____shouldFire = require("shouldFire")
local shouldFirePlayer = ____shouldFire.shouldFirePlayer
local ____CustomCallback = require("classes.private.CustomCallback")
local CustomCallback = ____CustomCallback.CustomCallback
____exports.PreBerserkDeath = __TS__Class()
local PreBerserkDeath = ____exports.PreBerserkDeath
PreBerserkDeath.name = "PreBerserkDeath"
__TS__ClassExtends(PreBerserkDeath, CustomCallback)
function PreBerserkDeath.prototype.____constructor(self)
    CustomCallback.prototype.____constructor(self)
    self.shouldFire = shouldFirePlayer
    self.postPEffectUpdateReordered = function(____, player)
        if isChildPlayer(nil, player) then
            return
        end
        local effects = player:GetEffects()
        local berserkEffect = effects:GetCollectibleEffect(CollectibleType.BERSERK)
        local numHitsRemaining = getPlayerNumHitsRemaining(nil, player)
        if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and numHitsRemaining == 0 and not willPlayerRevive(nil, player) then
            self:fire(player)
        end
    end
    self.customCallbacksUsed = {{ModCallbackCustom.POST_PEFFECT_UPDATE_REORDERED, self.postPEffectUpdateReordered}}
end
return ____exports
