local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_NONE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GIFT_WRAPS)

local maxsummons = 2

local spell = Spell("instant")

function spell.onCastSpell(creature, var)
	local summoncount = creature:getSummons()
	if #summoncount < 2 then
		local mid = Game.createMonster("Monk", creature:getPosition())
		if not mid then
			return
		end
		mid:setMaster(creature)
	end
	return combat:execute(creature, var)
end

spell:name("man in the cave summon")
spell:words("###187")
spell:blockWalls(true)
spell:needLearn(true)
spell:register()
