local ____lualib = require("lualib_bundle")
local __TS__Class = ____lualib.__TS__Class
local __TS__ClassExtends = ____lualib.__TS__ClassExtends
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local SackSubType = ____isaac_2Dtypescript_2Ddefinitions.SackSubType
local ____decorators = require("decorators")
local Exported = ____decorators.Exported
local ____ISCFeature = require("enums.ISCFeature")
local ISCFeature = ____ISCFeature.ISCFeature
local ____entities = require("functions.entities")
local removeEntities = ____entities.removeEntities
local ____pickupsSpecific = require("functions.pickupsSpecific")
local getCoins = ____pickupsSpecific.getCoins
local spawnSackWithSeed = ____pickupsSpecific.spawnSackWithSeed
local ____Feature = require("classes.private.Feature")
local Feature = ____Feature.Feature
--- Hard-coding this makes it easier to clean up the pickups afterwards.
local SACK_SEED_THAT_SPAWNS_TWO_COINS = 6
____exports.StartAmbush = __TS__Class()
local StartAmbush = ____exports.StartAmbush
StartAmbush.name = "StartAmbush"
__TS__ClassExtends(StartAmbush, Feature)
function StartAmbush.prototype.____constructor(self, runInNFrames)
    Feature.prototype.____constructor(self)
    self.featuresUsed = {ISCFeature.RUN_IN_N_FRAMES}
    self.runInNFrames = runInNFrames
end
function StartAmbush.prototype.startAmbush(self)
    local player = Isaac.GetPlayer()
    local sack = spawnSackWithSeed(nil, SackSubType.NULL, player.Position, SACK_SEED_THAT_SPAWNS_TWO_COINS)
    local sprite = sack:GetSprite()
    sprite:Stop()
    local sackPtr = EntityPtr(sack)
    self.runInNFrames:runNextGameFrame(function()
        local futureSack = sackPtr.Ref
        if futureSack == nil then
            return
        end
        futureSack:Remove()
        local sackPtrHash = GetPtrHash(futureSack)
        local coins = getCoins(nil)
        local coinsFromSack = __TS__ArrayFilter(
            coins,
            function(____, pickup) return pickup.SpawnerEntity ~= nil and GetPtrHash(pickup.SpawnerEntity) == sackPtrHash end
        )
        removeEntities(nil, coinsFromSack)
    end)
end
__TS__DecorateLegacy({Exported}, StartAmbush.prototype, "startAmbush", true)
return ____exports
