local ____exports = {}
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
local ____cachedClasses = require("core.cachedClasses")
local game = ____cachedClasses.game
local ____backdropTypeToRockAltType = require("objects.backdropTypeToRockAltType")
local BACKDROP_TYPE_TO_ROCK_ALT_TYPE = ____backdropTypeToRockAltType.BACKDROP_TYPE_TO_ROCK_ALT_TYPE
local ____entitiesSpecific = require("functions.entitiesSpecific")
local getNPCs = ____entitiesSpecific.getNPCs
local ____gridEntities = require("functions.gridEntities")
local removeEntitiesSpawnedFromGridEntity = ____gridEntities.removeEntitiesSpawnedFromGridEntity
local ____pickupsSpecific = require("functions.pickupsSpecific")
local getCoins = ____pickupsSpecific.getCoins
local getCollectibles = ____pickupsSpecific.getCollectibles
local getTrinkets = ____pickupsSpecific.getTrinkets
--- Helper function to get the alternate rock type (i.e. urn, mushroom, etc.) that the current room
-- will have.
-- 
-- The rock type is based on the backdrop of the room.
-- 
-- For example, if you change the backdrop of the starting room of the run to `BackdropType.CAVES`,
-- and then spawn `GridEntityType.ROCK_ALT`, it will be a mushroom instead of an urn. Additionally,
-- if it is destroyed, it will generate mushroom-appropriate rewards.
-- 
-- On the other hand, if an urn is spawned first before the backdrop is changed to
-- `BackdropType.CAVES`, the graphic of the urn will not switch to a mushroom. However, when
-- destroyed, the urn will still generate mushroom-appropriate rewards.
function ____exports.getRockAltType(self)
    local room = game:GetRoom()
    local backdropType = room:GetBackdropType()
    return BACKDROP_TYPE_TO_ROCK_ALT_TYPE[backdropType]
end
--- Helper function to remove all coins, trinkets, and so on that spawned from breaking an urn.
-- 
-- The rewards are based on the ones from the wiki:
-- https://bindingofisaacrebirth.fandom.com/wiki/Rocks#Urns
function ____exports.removeUrnRewards(self, gridEntity)
    local coins = getCoins(nil)
    removeEntitiesSpawnedFromGridEntity(nil, coins, gridEntity)
    local quarters = getCollectibles(nil, CollectibleType.QUARTER)
    removeEntitiesSpawnedFromGridEntity(nil, quarters, gridEntity)
    local swallowedPennies = getTrinkets(nil, TrinketType.SWALLOWED_PENNY)
    removeEntitiesSpawnedFromGridEntity(nil, swallowedPennies, gridEntity)
    local spiders = getNPCs(nil, EntityType.SPIDER)
    removeEntitiesSpawnedFromGridEntity(nil, spiders, gridEntity)
end
return ____exports
