function damage_received(damage, message, entity_thats_responsible, is_fatal, projectile_thats_responsible)
	if IsPlayer(entity_thats_responsible) == true and EntityGetWithName("hooded_portal") == 0 then
		local player_x, player_y = EntityGetTransform(entity_thats_responsible)
		EntityLoad("mods/lewd_noita/files/enemies/hooded_portal.xml", player_x, player_y)
		SetTimeOut(1, "mods/lewd_noita/files/enemies/hooded.lua", "hooded_portal")
	end
end

function hooded_portal()

	local portal_x, portal_y = EntityGetTransform(EntityGetWithName("hooded_portal"))

	SetRandomSeed(portal_x, portal_y)

	local rand = Random(1, 22)

	if rand == 1 then
		EntityLoad("mods/lewd_noita/files/enemies/chainer.xml", portal_x, portal_y)
	elseif rand == 2 then
		EntityLoad("mods/lewd_noita/files/enemies/flyswarm.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/flyswarm.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/flyswarm.xml", portal_x, portal_y)
	elseif rand == 3 then
		EntityLoad("mods/lewd_noita/files/enemies/giantsnail.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/giantsnail.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/giantsnail.xml", portal_x, portal_y)
	elseif rand == 4 then
		EntityLoad("mods/lewd_noita/files/enemies/hellhound.xml", portal_x, portal_y)
	elseif rand == 5 then
		EntityLoad("mods/lewd_noita/files/enemies/hornygasflower.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/hornygasflower.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/hornygasflower.xml", portal_x, portal_y)
	elseif rand == 6 then
		EntityLoad("mods/lewd_noita/files/enemies/kobold.xml", portal_x, portal_y)
	elseif rand == 7 then
		for i = 1, 20 do
			local rnd = Random(1, 4)
			if rnd == 1 then
				EntityLoad("mods/lewd_noita/files/enemies/maggot_firebug_gold.xml", portal_x, portal_y)
			elseif rnd == 2 then
				EntityLoad("mods/lewd_noita/files/enemies/maggot_firebug.xml", portal_x, portal_y)
			elseif rnd == 3 then
				EntityLoad("mods/lewd_noita/files/enemies/maggot_spider.xml", portal_x, portal_y)
			elseif rnd == 4 then
				EntityLoad("mods/lewd_noita/files/enemies/maggot_white.xml", portal_x, portal_y)
			end
		end
	elseif rand == 8 then
		EntityLoad("mods/lewd_noita/files/enemies/tank_corrupt.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/tank_corrupt.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/tank_corrupt.xml", portal_x, portal_y)
	elseif rand == 9 then
		EntityLoad("mods/lewd_noita/files/enemies/webspider.xml", portal_x, portal_y)
	elseif rand == 10 then
		EntityLoad("mods/lewd_noita/files/enemies/wizard_futa.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/wizard_futa.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/wizard_futa.xml", portal_x, portal_y)
	elseif rand == 11 then
		EntityLoad("mods/lewd_noita/files/enemies/wolf_cyber.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/wolf_cyber.xml", portal_x, portal_y)
		EntityLoad("mods/lewd_noita/files/enemies/wolf_cyber.xml", portal_x, portal_y)
	elseif rand == 12 then
		EntityLoad("data/entities/animals/fungus_giga.xml", portal_x, portal_y)
	elseif rand == 13 then
		EntityLoad("data/entities/animals/fungus_big.xml", portal_x, portal_y)
	elseif rand == 14 then
		EntityLoad("data/entities/animals/statue.xml", portal_x, portal_y)
	elseif rand == 15 then
		EntityLoad("data/entities/animals/necromancer.xml", portal_x, portal_y)
	elseif rand == 16 then
		EntityLoad("data/entities/animals/shaman.xml", portal_x, portal_y)
	elseif rand == 17 then
		EntityLoad("data/entities/animals/spitmonster.xml", portal_x, portal_y)
	elseif rand == 18 then
		EntityLoad("data/entities/animals/skullfly.xml", portal_x, portal_y)
	elseif rand == 19 then
		EntityLoad("data/entities/animals/playerghost.xml", portal_x, portal_y)
	elseif rand == 20 then
		EntityLoad("data/entities/animals/spearbot.xml", portal_x, portal_y)
	elseif rand == 21 then
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
		EntityLoad("data/entities/animals/longleg.xml", portal_x, portal_y)
	elseif rand == 22 then
		EntityLoad("data/entities/animals/miner_chef.xml", portal_x, portal_y)
	end

end

function death(damage_type_bit_field, damage_message, entity_thats_responsible, drop_items)
	local hooded_x, hooded_y = EntityGetTransform(GetUpdatedEntityID())

	local loot = {
		"bloodmoney_10000",
		"broken_wand",
		"chest_leggy",
		"chest_random_super",
		"gourd",
		"heart_evil",
		"jar_of_urine",
		"poopstone",
		"potion_beer",
		"potion_milk",
		"potion_mimic",
		"potion_porridge",
		"potion_secret",
		"random_card",
		"safe_haven",
		"stonestone",
		"utility_box",
		"wandstone",
		"waterstone",
	}

	EntityLoad("data/entities/items/pickup/" .. loot[Random(1, #loot)] .. ".xml", hooded_x, hooded_y)

end