# dangeon
$dundincif = {
	cls
	gs 'stat'
	'8809 = 6'
	'7111 = 0'
	'2172 = 0'
	'6666 = 4'
	'1111 = 0'
	'3213 = 0'
	'7662 = 2'
	'9312 = 1'
	'0000 = 4'
	'2222 = 0'
	'3333 = 0'
	'5555 = 0'
	'8193 = 3'
	'8096 = 5'
	'7777 = 0'
	'9999 = 4'
	'7756 = 1'
	'6855 = 3'
	'9881 = 5'
	'5531 = 0'
	'Have a smart sense in such tomfoolery, because often clever fool walks.'

	act 'Move away from labels':gt $curloc
}

$dundinboch = {
	cls

	if openstateDM2 = 0:openstateDM2 = 1

	gs 'stat'
	'Chimes hear soon reconcile those who quarrel.'

	act 'Move away from the barrel':gt $curloc
}

$dundinsvitok = {
	cls
	svitokRTS = 1
	heart += 1
	gs 'stat'
	'You picked up the scroll and he crumbled. As if you breathed in the wind. You listen to the feelings and understand that you have something changed. You feel like somewhere, as if in another dimension another beating heart belongs to you, which will die for you in battle.'

	act 'Move away':gt $curloc
}

gs 'stat'

if dungeonMark = 0:
	'<center><img src="images/picPRE/dunPRE.jpg"></center>'
	'The man-made cave in depth which shows the door.'

	act 'Get out of the dungeon':minut += 5 & gt 'obekt2'
	act 'Enter the door':minut += 5 & dungeonMark = 1 & gt $curloc
elseif dungeonMark = 1:
	'<center><img src="images/picPRE/dunPRE1.jpg"></center>'
	'Quite large and deserted room in which there is nothing but a bunch of bones in the corner.'

	act 'Leave':minut += 5 & dungeonMark = 0 & gt $curloc
	act 'Go deep into':minut += 5 & dungeonMark = 2 & gt $curloc
elseif dungeonMark = 2:
	if svitokRTS = 1:exit

	'<center><img src="images/picPRE/dunPRE2.jpg"></center>'
	'Dilapidated gallery in the recesses of which are visible doors to other rooms.'

	act 'Exit from the gallery':minut += 5 & dungeonMark = 1 & gt $curloc
	act 'Sign in 1yu room':minut += 5 & dungeonMark = 3 & gt $curloc

	act 'Sign in 2w room':
		cls

		if openstateDM = 1:
			minut += 5
			dungeonMark = 4
			gt $curloc
		end

		if openstateDM = 0:
			:markanotherrand
			DMN[1] = rand(0, 9)
			DMN[2] = rand(0, 9)
			DMN[3] = rand(0, 9)
			DMN[4] = rand(0, 9)

			if DMN[1] = DMN[2] and DMN[1] = DMN[3] and DMN[1] = DMN[4]:jump 'markanotherrand'
			if DMN[1] = 8 and DMN[2] = 8 and DMN[3] = 0 and DMN[4] = 9:jump 'markanotherrand'
			if DMN[1] = 7 and DMN[2] = 1 and DMN[3] = 1 and DMN[4] = 1:jump 'markanotherrand'
			if DMN[1] = 2 and DMN[2] = 1 and DMN[3] = 7 and DMN[4] = 2:jump 'markanotherrand'
			if DMN[1] = 3 and DMN[2] = 2 and DMN[3] = 1 and DMN[4] = 3:jump 'markanotherrand'
			if DMN[1] = 7 and DMN[2] = 6 and DMN[3] = 6 and DMN[4] = 2:jump 'markanotherrand'
			if DMN[1] = 9 and DMN[2] = 3 and DMN[3] = 1 and DMN[4] = 2:jump 'markanotherrand'
			if DMN[1] = 8 and DMN[2] = 1 and DMN[3] = 9 and DMN[4] = 3:jump 'markanotherrand'
			if DMN[1] = 8 and DMN[2] = 0 and DMN[3] = 9 and DMN[4] = 6:jump 'markanotherrand'
			if DMN[1] = 7 and DMN[2] = 7 and DMN[3] = 5 and DMN[4] = 6:jump 'markanotherrand'
			if DMN[1] = 6 and DMN[2] = 8 and DMN[3] = 5 and DMN[4] = 5:jump 'markanotherrand'
			if DMN[1] = 9 and DMN[2] = 8 and DMN[3] = 8 and DMN[4] = 1:jump 'markanotherrand'
			if DMN[1] = 5 and DMN[2] = 5 and DMN[3] = 3 and DMN[4] = 1:jump 'markanotherrand'

			i = 0
			numdmr = 0
			:markdnm
			i += 1

			if DMN[i] = 0 or DMN[i] = 6 or DMN[i] = 9:
				numdmr += 1
			elseif DMN[i] = 8:
				numdmr += 2
			end

			if i < 4:jump 'markdnm'

			numberOSDM = input("<<DMN[1]>><<DMN[2]>><<DMN[3]>><<DMN[4]>> >= ?")

			if numberOSDM < 0 or numberOSDM > 8 or numdmr ! numberOSDM:
				msg("Silence, nothing has changed")
				gt $curloc
			else
				openstateDM = 1
				msg("In the door that just clicked")
				gt $curloc
			end
		end
	end

	if openstateDM2 = 2:act 'Sign in third room':minut += 5 & dungeonMark = 5 & gt $curloc
elseif dungeonMark = 3:
	'<center><img src="images/picPRE/dunPRE3.jpg"></center>'
	'The room in which the middle stands a stone dais on which are various dusty bottles.'
	'Scrawled on the wall of what is <a href="exec:dynamic $dundincif">signs</a>.'

	act 'Leave the room':minut += 5 & dungeonMark = 2 & gt $curloc
elseif dungeonMark = 4:
	'<center><img src="images/picPRE/dunPRE4.jpg"></center>'
	'Small room in which there are what that <a href="exec:dynamic $dundinboch">Drums</a>.'

	act 'Leave the room':minut += 5 & dungeonMark = 2 & gt $curloc

	if openstateDM2 = 1:
		'In another barrel you see a device where you can enter numbers.'

		act 'Enter the numbers':
			cls
			numberOSDM2 = input("12, 1, 1, 1, 2, 1, 3, ?, ?, ?, ?")

			if numberOSDM2 = rikudootvet:
				openstateDM2 = 2
				msg("Outside that it rattled.")
			else
				msg("Silence, nothing has changed")
			end

			gt $curloc
		end
	end
elseif dungeonMark = 5:
	'<center><img src="images/picPRE/dunPRE5.jpg"></center>'
	'The room in which the middle, sitting on a stone throne cobwebbed skeleton.'

	if svitokRTS = 0:'In the hands of a skeleton lying <a href="exec:dynamic $dundinsvitok">scroll</a>.'

	act 'Leave the room':minut += 5 & dungeonMark = 2 & gt $curloc
end

--- dangeon ---------------------------------

