!\---------------------------------------------------------------------------

	COLOSSAL HUGO

	Based on Graham Nelson's Inform port of Advent, in turn
	taken from David M. Baggett's 1993 reconstruction of the
	1977 original Adventure by Willie Crowther and Don Woods.

	Hugo adaptation by Kent Tessman 1995

---------------------------------------------------------------------------\!

#set DEBUG                              ! include HugoFix library and grammar

#set VERBSTUBS                          ! include verb stub routines

!#set PRECOMPILED_LIBRARY                ! #link HUGOLIB.HLB

#set NO_SCRIPTS                         ! These flags are set to exclude
#set NO_AUX_MATH                        ! unnecessary library routines
#set NO_STRING_ARRAYS                   !

#switches -ls

!----------------------------------------------------------------------------
! NEW GRAMMAR:

verb "on"
	*                                       DoOn

verb "off"
	*                                       DoOff

verb "catch", "capture"
	*                                       DoVague
	* living                                DoCatch
	* living "with" held                    DoCatch

verb "release", "free"
	*                                       DoVague
	* living                                DoRelease

verb "let"
	* living "go"                           DoRelease
	* "go" living                           DoRelease

verb "pour", "douse"
	*                                       DoVague
	* object                                DoEmpty

verb "water", "irrigate"
	*                                       DoVague
	* object                                DoWater

verb "oil", "grease", "lubricate"
	*                                       DoVague
	* object                                DoOil

verb "plugh"
	*                                       Plugh

verb "xyzzy"
	*                                       Xyzzy

verb "plover"   
	*                                       Plover

verb "say", "chant", "incant", "speak"
	*                                       DoVague
	* "plugh"                               Plugh
	* "xyzzy"                               Xyzzy
	* "plover"                              Plover

verb "sesame", "shazam", "hocus-pocus", "abracadabra", \
	"foobar", "open-sesame", "frotz", "presto"
	*                                       DoOldMagic

verb "fee"      
	*                                       DoFee

verb "fie"      
	*                                       DoFie

verb "foe"      
	*                                       DoFoe

verb "foo"      
	*                                       DoFoo

verb "help"     
	*                                       DoHelp
	* "me"                                  DoHelp

verb "kick"     
	*                                       DoVague
	* object                                DoKick

verb "use"      
	*                                       DoUse

verb "blast"    
	*                                       DoBlast
	* object "with" held                    DoBlastWith

verb "fill"
	*                                       DoVague
	* object                                DoFill

verb "rub", "polish"
	*                                       DoVague
	* object                                DoRub

verb "pry"
	*                                       DoVague
	* (giant_bivalve)                       DoUnlock
	* "open" (giant_bivalve)                DoUnlock
	* (giant_bivalve) "with" held           DoUnlock
	* "open" (giant_bivalve) "with" held    DoUnlock
	

#ifset TEST_VERSION
xverb "xdeterm"  
	*                                       Xdeterm

xverb "xcheat"
	*                                       Xcheat
#endif


#include "verblib.g"                    ! library grammar

#ifset PRECOMPILED_LIBRARY
#link "hugolib.hlb"
#endif
#ifclear PRECOMPILED_LIBRARY
#include "hugolib.h"
#endif

!----------------------------------------------------------------------------
! NEW SPECIAL WORDS:

removal "many"


!----------------------------------------------------------------------------
! NEW GLOBALS, ETC.

global caves_closed
global canyon_from
global treasures_found
global deaths

attribute scored
attribute valuable
attribute dwarf_free
attribute treasure_found

property depositpoints

constant MAX_TREASURES 15

!----------------------------------------------------------------------------
! NEW TREASURE CLASS:

class treasure
{
	depositpoints 10
	after
	{
		object DoGet
		{
			if location = inside_building
				score = score - self.depositpoints
			score = score + 5
			if object is not treasure_found
			{
				object is treasure_found
				treasures_found = treasures_found + 1
				score = score + 2
			}
			"Taken!"
		}
		object DoDrop
		{
			score = score - 5
			if location = inside_building
			{
				score = score + self.depositpoints
				"Safely deposited."
			}
			else
				return false
		}
	}
	is valuable
}


!----------------------------------------------------------------------------
! GAME LOOP ROUTINES
!----------------------------------------------------------------------------

routine init
{
	MAX_SCORE = 350
	counter = -1

	STATUSTYPE = 1                  ! score/turns
	TEXTCOLOR = DEF_FOREGROUND
	BGCOLOR = DEF_BACKGROUND
	SL_TEXTCOLOR = DEF_SL_FOREGROUND
	SL_BGCOLOR = DEF_SL_BACKGROUND

	prompt = ">"

	cls

	FORMAT = NOINDENT_F

	DEFAULT_FONT = PROP_ON

	Font(BOLD_ON | DEFAULT_FONT)
	"COLOSSAL HUGO"
	Font(BOLD_OFF)
	"An Adaptation of Adventure by Willie Crowther and
	Don Woods (1977)\n\nHugo adaptation by Kent Tessman 1995" 
	"Based on Graham Nelson's Inform port of
	David M. Baggett's reconstruction"
	print BANNER

	Font(BOLD_ON)
	"(New players should type \"help\".)"
	Font(BOLD_OFF)

	player = you
	location = At_End_Of_Road
	old_location = location
	
	move player to location
	FindLight(location)
	DescribePlace(location)
	location is visited
	CalculateHolding(player)

	score = 36
	Activate(dwarf_daemon)
	Activate(pirate_daemon)
	Activate(cave_closer)
}

#ifset PRECOMPILED_LIBRARY
replace main
{
#endif
#ifclear PRECOMPILED_LIBRARY
routine main
{
#endif
	counter = counter + 1
	PrintStatusLine
	runevents
	RunScripts
	if speaking not in location
		speaking = 0
}

player_character you "you"
{}

!----------------------------------------------------------------------------
! THE OUTSIDE WORLD
!----------------------------------------------------------------------------

room At_End_Of_Road "At End Of Road"
{
	long_desc
		"You are standing at the end of a road before a small
		brick building.  Around you is a forest.  A small
		stream flows out of the building and down a gully."
	w_to At_Hill_In_Road
	u_to At_Hill_In_Road
	e_to Inside_Building
	d_to In_A_Valley
	s_to In_A_Valley
	n_to In_Forest_1,
	in_to Inside_Building,
	nouns "gully", "road", "street", "path"
}

scenery well "well house"
{  
	nouns "house", "building", "wellhouse"
	adjectives "well", "brick", "small"
	article "a"
	before
	{
		object DoGo, DoEnter
			{MovePlayer(Inside_Building)}
	}
	long_desc
		"It's a small brick building. It seems to be a well house."
	found_in At_End_Of_Road, At_Hill_In_Road, Inside_Building
}

scenery stream "stream"
{
	nouns "stream", "water", "brook", "river", "lake", "reservoir"
	adjectives "small", "tumbling", "splashing", "babbling", "rushing"
	article "a"
	found_in At_End_Of_Road, In_A_Valley, At_Slit_In_Streambed, \
		In_Pit, In_Cavern_With_Waterfall, At_Reservoir, \
		Inside_Building
	before
	{
		object DoDrink
		{
			 "You have taken a drink from the stream.  The water
			  tastes strongly of minerals, but is not
			  unpleasant.  It is extremely cold."
		}
		object DoGet
		{
			if bottle not in player
				"You have nothing in which to carry the
				water."
			else
				Perform(&DoFill, bottle)
		}
		object DoPutIn
		{
			if xobject = bottle
				Perform(&DoFill, bottle)
			else
				return false
		}
		xobject DoPutIn
		{
			if object = bottle
				Perform(&DoFill, bottle)
			elseif xobject = ming_vase
			{
				remove ming_vase
				move shards to location
				score = score - 5
				"The sudden change in temperature
				has delicately shattered the vase."
			}
			else
			{
				remove object
				if object is valuable
					score = score - 5
				CThe(object)
				" washes away with the stream."
			}
		}
	}
}

scenery Road "road"
{
	nouns "road", "street", "path", "dirt"
	article "the"
	long_desc 
		"The road is dirt, not yellow brick."
	found_in At_End_Of_Road, At_Hill_In_Road, In_Forest_2
}

scenery forest "forest"
{
	nouns "forest", "tree", "trees", "grove", "saplings", "bushes", \
		"leaves", "berry", "berries", "hardwood"
	adjectives "oak", "maple", "pine", "spruce", "birch", "ash", \
		"saplings"
	article "a"
	long_desc
		{"The trees of the forest are large hardwood oak and
		maple, with an occasional grove of pine or spruce.  ";
		"There is quite a bit of undergrowth, largely birch
		and ash saplings plus nondescript bushes of various sorts.  ";
		"This time of year visibility is quite
		restricted by all the leaves, but travel is quite
		easy if you detour around the spruce and berry
		bushes."}
	found_in At_End_Of_Road, At_Hill_In_Road, In_A_Valley, \
		In_Forest_1, In_Forest_2
}

room At_Hill_In_Road "At Hill In Road"
{
	long_desc
		"You have walked up a hill, still in the forest.  The road
	       slopes back down the other side of the hill.  There is a
	       building in the distance."
	e_to At_End_Of_Road
	n_to At_End_Of_Road
	d_to At_End_Of_Road
	s_to In_Forest_1
	nouns "gully", "road", "street", "path"
}

scenery Hill "hill"
{
	in At_Hill_In_Road
	long_desc
		"It's just a typical hill."
	nouns "hill", "bump", "incline"
	article "a"
}

scenery OtherSideOfHill "other side of hill"
{
	long_desc
		"Why not explore it yourself?"
	adjectives "other", "side", "hill"
	article "the"
}

room Inside_Building "Inside Building"
{
	long_desc
		"You are inside a building, a well house for a
		large spring."
	cant_go 
		"The stream flows out through a pair of 1 foot
		diameter sewer pipes.  The only exit is to the west."
	before
	{
		location Xyzzy
		{
			if In_Debris_Room is visited
				MovePlayer(In_Debris_Room)
			else
				return false
		}
		location Plugh
		{
			if At_Y2 is visited
				MovePlayer(At_Y2)
			else
				return false
		}
	}
	w_to At_End_Of_Road
	out_to At_End_Of_Road
	in_to 
		"The pipes are too small."
}

scenery Spring "spring"
{
	in Inside_Building
	nouns "spring", "large"
	article "a"
	long_desc 
		"The stream flows out through a pair of 1 foot
		diameter sewer pipes."
}

scenery SewerPipes "pair of 1 foot diameter sewer pipes"
{
	nearby
	nouns "pipes", "pipe"
	adjectives "one", "foot", "diameter", "sewer"
	article "a"
	long_desc
		"Too small. The only exit is to the west."
}

object set_of_keys "set of keys"
{
	nearby
	long_desc
		"It's just a normal-looking set of keys."
	initial_desc
		"There are some keys on the ground here."
	nouns "keys", "keyring", "ring"
	adjectives "set", "of", "bunch", "key"
	article "a"
}

object tasty_food "tasty food"
{
	nearby
	long_desc
		"Sure looks yummy!"
	nouns "food", "rations", "ration", "tripe"
	adjectives "yummy", "tasty", "delicious", "scrumptious"
	initial_desc
		"There is tasty food here."
	before
	{
		object DoEat
			{"Delicious!"}
	}
}

object brass_lantern "brass lantern"
{
	nearby
	nouns "lamp", "headlamp", "headlight", "lantern", "light"
	adjectives "shiny", "brass"
	article "a"
	short_desc
	{
		if self is not switchedon
			"There is a shiny brass lamp nearby."
		else
			"Your lamp is here, gleaming brightly."
	}
	misc 330
	before
	{
		object DoLook
		{
			"It is a shiny brass lamp";
			if self is not switchedon
				".  It is not currently lit."
			elseif self.misc < 30
				", glowing dimly."
			else
				", glowing brightly."
		}
		object DoRub
		{
			"Rubbing the electric lamp is not particularly
			rewarding.  Anyway, nothing exciting happens."
		}
		object DoBurn
			{Perform(&DoSwitchOn, self)}
		object DoSwitchOn
		{
			if self.misc <= 0
				"Unfortunately, the batteries seem to be
				dead."
			else
				return false
		}
		xobject DoPutIn
		{
			if object = old_batteries
				"Those batteries are dead; they won't
				do any good at all."
			elseif object = fresh_batteries
				ReplaceBatts
			else
				"The only thing you might successfully put
				in the lamp is a fresh pair of batteries."
		}
	}
	after
	{
		object DoSwitchOn
		{
			self is light
			FindLight(location)
			Activate(lamp_daemon)
			"Switched on."
			if location is not light
				{DescribePlace(location)
				location is visited}
		}
		object DoSwitchOff
			{self is not light
			"Your lamp goes dark.  ";
			if not FindLight(location)
				"(And so does everything else.)"
			print newline
			Deactivate(lamp_daemon)}
	}
	is switchable
}

daemon lamp_daemon
{}

event lamp_daemon
{
	local t

	self = brass_lantern
	
	self.misc = self.misc - 1
	t = self.misc

	if t <= 0
		{self.misc = 0
		t = 0
		self is not switchedon
		self is not light}
	
	if FindObject(self, location)
	{
		if t = 0
		{
			"Your lamp has run out of power.";
			if fresh_batteries not in player \
				and location is not light
			{
				"  You can't explore the cave without a
				lamp.  So let's just call it a day."
				endflag = 3
			}
			else
				ReplaceBatts
			print newline
			event_flag = true
		 }
		 elseif t = 30
		 {
			"Your lamp is getting dim.";
			if fresh_batteries is special
				"  You're also out of spare batteries.  \
				You'd best start wrapping this up."
			elseif fresh_batteries in VendingMachine \
				and Dead_End_14 is visited

				"  You'd best start wrapping this up,
				unless you can find some fresh
				batteries. I seem to recall there's a
				vending machine in the maze.  Bring
				some coins with you."
			elseif fresh_batteries not in VendingMachine
				"  You'd best go back for those batteries."
			print newline
			event_flag = true
		 }
	}
}

routine ReplaceBatts
{
	if fresh_batteries in player or fresh_batteries in location
	{   
		remove fresh_batteries
		fresh_batteries is special
		move old_batteries to location
		brass_lantern.misc = 2500
		"I'm taking the liberty of replacing the batteries."
	}
}

object bottle "small bottle"
{
	nearby brass_lantern
	nouns "bottle", "jar", "flask"
	adjectives "small", "little"
	article "a"
	initial_desc 
		"There is an empty bottle here."
	before
	{
		xobject DoPutIn
		{
			if object = stream or object = Oil
				{xobject = object
				object = self
				run object.before}
			else
				"The bottle is only supposed to hold liquids."
		}
		object DoFill
		{
			if child(bottle) ~= 0
				"The bottle is full already."
			elseif FindObject(stream, location) \
				or FindObject(Spring, location)
				{move water_in_the_bottle to bottle
				"The bottle is now full of water."}
			elseif Oil in location
				{move oil_in_the_bottle to bottle
				"The bottle is now full of oil."}
			else
				"There is nothing here with which to
				fill the bottle."
		}
		object DoEmpty
		{
			if child(bottle) = 0 
				"The bottle is already empty!"
			else
				{remove child(bottle)
				"Your bottle is now empty and the
				ground is now wet."}
		}
	}
	is container, open
}

object water_in_the_bottle "bottled water"
{
	nouns "water"
	adjective "bottled"
	article "some"
	before
	{
		object DoDrink
		{
			remove water_in_the_bottle
			Perform(&DoDrink, Stream)
		}
	}
	long_desc
		"It looks like ordinary water to me."
}

object oil_in_the_bottle "bottled oil"
{
	nouns "oil", "lubricant", "grease"
	adjective "bottled"
	article "some"
	before
	{
		object DoDrink
		{
			object = Oil
			run object.before
		}
	}
	long_desc
		"It looks like ordinary oil to me."
}

room In_Forest_1 "In Forest"
{
	long_desc
		{"You are in open forest, with a deep valley to one side."
		if random(2) = 1
			{move player to In_Forest_2
			location = In_Forest_2}
		}
	e_to In_A_Valley
	d_to In_A_Valley
	n_to In_Forest_1
	w_to In_Forest_1
	s_to In_Forest_1
}

room In_Forest_2 "In Forest"
{
	long_desc
		"You are in open forest near both a valley and a road."
	n_to At_End_Of_Road
	e_to In_A_Valley
	w_to In_A_Valley
	d_to In_A_Valley
	s_to In_Forest_1
}

room In_A_Valley "In A Valley"
{
	long_desc
		"You are in a valley in the forest beside a
		stream tumbling along a rocky bed."
	n_to At_End_Of_Road
	e_to In_Forest_1
	w_to In_Forest_1
	u_to In_Forest_1
	s_to At_Slit_In_Streambed
	d_to At_Slit_In_Streambed
	noun "valley"
}

scenery "streambed"
{
	in In_A_Valley
	noun "bed", "rock", "streambed"
	adjectives "small", "rocky", "bare", "dry"
	article "a"
}

room At_Slit_In_Streambed "At Slit In Streambed"
{
	long_desc
		"At your feet all the water of the stream
		splashes into a 2-inch slit in the rock.  Downstream
		the streambed is bare rock."
	n_to In_A_Valley
	e_to In_Forest_1
	w_to In_Forest_1
	s_to Outside_Grate
	d_to
		"You don't fit through a two-inch slit!"
	in_to
		"You don't fit through a two-inch slit!"
}

scenery Slit "2-inch slit"
{
	in At_Slit_In_Streambed
	long_desc
		"It's just a 2-inch slit in the rock, through which the
		stream is flowing."
	noun "slit"
	adjectives "two", "inch", "two-inch"
	article "a"
	before
	{
		object DoGo, DoEnter
			{"You don't fit through a two-inch slit!"}
	}
	is enterable
}

room Outside_Grate "Outside Grate"
{
	long_desc
		"You are in a 20-foot depression floored with
		bare dirt.  Set into the dirt is a strong steel grate
		mounted in concrete.  A dry streambed leads into the
		depression."
	e_to In_Forest_1
	w_to In_Forest_1
	s_to In_Forest_1
	n_to At_Slit_In_Streambed
	d_to 
		return Grate.door_to
}

scenery Depression "20-foot depression"
{
	in Outside_Grate
	long_desc
		"You're standing in it."
	nouns "depression", "dirt"
	adjectives "twenty", "foot", "bare", "twenty-foot"
	article "a"
}

object Grate "steel grate"
{
	nearby
	nouns "grate", "lock", "gate", "grille", "grating"
	adjectives "metal", "strong", "steel"
	article "a"
	long_desc
		"It just looks like an ordinary grate mounted in concrete."
	key_object set_of_keys
	door_to
	{
		if Grate is not locked and Grate is not open
			{"(First opening the grate)"
			Grate is open}
		elseif Grate is not open
			{"The steel grate is locked."
			return true}

		if location = Below_The_Grate
			return Outside_Grate
		else
			return Below_The_Grate
	}
	short_desc
	{
		if self is open
			"The grate stands open."
		elseif self is not locked 
			"The grate is unlocked but shut."
	}
	found_in Below_The_Grate, Outside_Grate
	type door
	is static, openable, lockable, locked
}

!----------------------------------------------------------------------------
!   Facilis descensus Averno...
!----------------------------------------------------------------------------

room Below_The_Grate "Below the Grate"
{
	long_desc
		"You are in a small chamber beneath a 3x3 steel
		grate to the surface. A low crawl over cobbles leads
		inward to the west."
	w_to In_Cobble_Crawl
	u_to 
		return Grate.door_to
}

scenery Cobbles "cobbles"
{
	long_desc
		"They're just ordinary cobbles."
	nouns "cobblestones", "cobblestone", "stones", "stone"
	adjective "cobble"
	article "some"
	is plural
	found_in In_Cobble_Crawl, In_Debris_Room, Below_The_Grate
}

room In_Cobble_Crawl "In Cobble Crawl"
{
	long_desc
		"You are crawling over cobbles in a low passage.  \
		There is a dim light at the east end of the passage."
	e_to Below_The_Grate
	w_to In_Debris_Room
}

object wicker_cage "wicker cage"
{
	in In_Cobble_Crawl
	long_desc
		"It's a small wicker cage."
	initial_desc
		"There is a small wicker cage discarded nearby."
	noun "cage" 
	adjectives "small", "wicker"
	article "a"
	after
	{
		object DoOpen
		{
			if little_bird not in self
				return false
			"(Releasing the little bird)"
			Perform(&DoRelease, little_bird)
		}
	}
	is container, container, open, openable, transparent
}

room In_Debris_Room "In Debris Room"
{
	is not light
	long_desc
		"You are in a debris room filled with stuff
		washed in from the surface. A low wide passage with
		cobbles becomes plugged with mud and debris here, but
		an awkward canyon leads upward and west.\n\n\
		A note on the wall says, \"Magic word XYZZY.\""
	e_to In_Cobble_Crawl
	u_to In_Awkward_Sloping_E_W_Canyon
	w_to In_Awkward_Sloping_E_W_Canyon
	before
	{
		location Xyzzy
			{MovePlayer(Inside_Building)}
	}
	is dwarf_free
}

scenery Debris "debris"
{
	in In_Debris_Room
	long_desc
		"Yuck."
	nouns "debris", "stuff", "mud"
	article "some"
}

scenery XyzzyNote "note"
{
	nearby
	long_desc
		"The note says \"Magic word XYZZY\"."
	noun "note"
	article "the"
}

object black_rod "black rod with a rusty star on the end"
{
	nearby
	long_desc
		"It's a three foot black rod with a rusty star on an end."
	initial_desc
		"A three foot black rod
		with a rusty star on one end lies nearby."
	nouns "rod", "star"
	adjectives "three", "foot", "black", "iron", "rusty"
	article "a"
	before
	{
		object DoWave
		{
			if location = West_Side_Of_Fissure \
				or location = On_East_Bank_Of_Fissure
			{
				if caves_closed = 1
					"Peculiar.  Nothing happens."
				elseif CrystalBridge_daemon is active
				{
					Deactivate(CrystalBridge_daemon)
					CrystalBridge.found_in = 0, 0
					West_Side_Of_Fissure.e_to = 0
					On_East_Bank_Of_Fissure.w_to = 0
					"The crystal bridge has vanished!"
				}
				else
				{
					Activate(CrystalBridge_daemon)
					CrystalBridge.found_in = \
						West_Side_Of_Fissure, \
						On_East_Bank_Of_Fissure
					West_Side_Of_Fissure.e_to = \
						{return CrystalBridge.door_to}
					On_East_Bank_Of_Fissure.w_to = \
						{return CrystalBridge.door_to}
					"A crystal bridge now spans the
					fissure!"
				}
			}                
			else
				"Nothing happens."
		}
	}
}

room In_Awkward_Sloping_E_W_Canyon "Sloping E/W Canyon"
{
	long_desc
		"You are in an awkward sloping east/west canyon."
	d_to In_Debris_Room
	e_to In_Debris_Room
	u_to In_Bird_Chamber
	w_to In_Bird_Chamber
	is not light, dwarf_free
}

!----------------------------------------------------------------------------
!   The little bird in its natural habitat
!----------------------------------------------------------------------------

room In_Bird_Chamber "Orange River Chamber"
{
	long_desc
		"You are in a splendid chamber thirty feet high.  \
		The walls are frozen rivers of orange stone.  An
		awkward canyon and a good passage exit from east and
		west sides of the chamber."
	e_to In_Awkward_Sloping_E_W_Canyon
	w_to At_Top_Of_Small_Pit
	is not light, dwarf_free
}

character little_bird "little bird"
{
	in In_Bird_Chamber
	noun "bird"
	adjectives "cheerful", "mournful", "little"
	article "a"
	initial_desc
		"A cheerful little bird is sitting here singing."
	ignore_response
		"Cheep!  Chirp!"
	before
	{
		object DoLook
		{
			if little_bird in wicker_cage
				"The little bird looks unhappy in the cage."
			else
				"The cheerful little bird is sitting here
				singing."
		}
		object DoPutIn
		{
			if xobject = wicker_cage
				Perform(&DoCatch, little_bird)
			else
				"Don't put the poor bird in ";
				print The(xobject); "!"
		}
		object DoDrop
		{
			if little_bird in wicker_cage
				{"(The bird is released from the cage)\n"
				Perform(&DoRelease, little_bird)}
			else
				return false
		}
		object DoGet, DoCatch
		{
			if little_bird in wicker_cage
				"You already have the little bird.  If
				you take it out of the cage it will likely
				fly away from you."
			elseif wicker_cage not in player
				"You can catch the bird, but you cannot
				carry it."
			elseif black_rod in player
				"The bird was unafraid when you entered, but
				as you approach it becomes disturbed and you
				cannot catch it."
			else
				{move little_bird to wicker_cage
				little_bird is moved
				wicker_cage is not open
				"You catch the bird in the wicker cage."}
		}
		object DoRelease
		{
			if little_bird not in wicker_cage
				{"The bird is not caged now."
				return true}

			wicker_cage is open
			move little_bird to location

			if Snake in location
			{
				remove Snake
				"The little bird attacks the green snake,
				and in an astounding flurry drives the
				snake away."
			}
			elseif Dragon in location
			{
				remove little_bird
				"The little bird attacks the green dragon,
				and in an astounding flurry gets burnt to a
				cinder.  The ashes blow away."
			}
			else
				"The little bird flies free."
		}
		xobject DoGive
		{
			"It's not hungry. (It's merely pinin' for the
			fjords).  Besides, I suspect it would prefer
			bird seed."
		}
		object DoHit
		{
			if little_bird in wicker_cage
				"Oh, leave the poor unhappy bird alone."
			else
				{remove little_bird
				"The little bird is now dead.  Its
				body disappears."}
		}
	}
	is unfriendly
}

room At_Top_Of_Small_Pit "At Top of Small Pit"
{
	long_desc
		"At your feet is a small pit breathing traces of
		white mist.  A west passage ends here except for a
		small crack leading on.\n\n\
		Rough stone steps lead down the pit."
	e_to In_Bird_Chamber
	w_to 
		"The crack is far too small for you to follow."
	d_to
	{
		if large_gold_nugget in player
		{
			"Thanks to the large gold nugget, you are now at
			the bottom of the pit with a broken neck."
			endflag = 2
		}
		else
			return In_Hall_Of_Mists
	}
	is not light, dwarf_free
}

scenery SmallPit "small pit"
{
	in At_Top_Of_Small_Pit
	long_desc
		"The pit is breathing traces of white mist."
	noun "pit"
	adjective "small"
	article "a"
}

scenery PitCrack "crack"
{
	nearby
	long_desc
		"The crack is very small--far too small for you to follow."
	noun "crack" 
	adjective "small"
	article "a"
	before
	{
		object DoEnter
			{"The crack is far too small for you to follow."}
	}
}

scenery Mist "mist"
{
	long_desc
		"Mist is a white vapor, usually water, seen from time
		to time in caverns.  It can be found anywhere but is
		frequently a sign of a deep pit leading down to
		water."
	nouns "mist", "vapor", "wisps"
	adjective "white"
	article "the"
	found_in  At_Top_Of_Small_Pit, In_Hall_Of_Mists, \
		 On_East_Bank_Of_Fissure, At_Window_On_Pit_1, \
		 At_West_End_Of_Hall_Of_Mists, In_Misty_Cavern, \
		 In_Mirror_Canyon, At_Reservoir, At_Window_On_Pit_2, \
		 On_Sw_Side_Of_Chasm
}

!----------------------------------------------------------------------------
!   The caves open up: The Hall of Mists
!----------------------------------------------------------------------------

room In_Hall_Of_Mists "In Hall of Mists"
{
	long_desc
		{"You are at one end of a vast hall stretching
		forward out of sight to the west.  There are openings
		to either side.  Nearby, a wide stone staircase leads
		downward.  The hall is filled with wisps of white
		mist swaying to and fro almost as if alive.  ";
		"A cold wind blows up the staircase.  There is a passage at
		the top of a dome behind you.\n\n\
		Rough stone steps lead up the dome."}
	initial_desc
		{if self is special
			return
		score = score + 25
		self is special}
	s_to In_Nugget_Of_Gold_Room
	w_to On_East_Bank_Of_Fissure
	d_to In_Hall_Of_Mt_King
	n_to In_Hall_Of_Mt_King
	u_to
	{
		if large_gold_nugget in player
			"The dome is unclimbable."
		else
			return At_Top_Of_Small_Pit
	}
	is not light
}

scenery Staircase "wide stone staircase"
{
	in In_Hall_Of_Mists
	long_desc
		"The staircase leads down."
	nouns "stair", "stairs", "staircase", "steps" 
	adjectives "wide", "stone"
	article "a"
}

scenery DomeSteps "rough stone steps"
{
       nearby 
       long_desc
		"The rough stone steps lead up the dome."
       nouns "stair", "stairs", "staircase" 
       adjectives "rough", "stone"
       article "some"
       is plural
}

scenery Dome "dome"
{
	nearby
	noun "dome"
	before
	{
		object DoLook
		{
			if large_gold_nugget in player
				"I'm not sure you'll be able to get up it
				with what you're carrying."
			else
				"It looks like you might be able to climb
				up it."
		}
		object DoClimb
		{
			if location.u_to > 1    ! returns true if message...
				MovePlayer(At_Top_Of_Small_Pit)
		}
	}
}

room In_Nugget_Of_Gold_Room "Low Room"
{
	is not light
	long_desc
		"This is a low room with a crude note on the
		wall:\n\n\"You won't get it up the steps\"."
	n_to In_Hall_Of_Mists
}

scenery NuggetNote "note"
{
	in In_Nugget_Of_Gold_Room
	long_desc
		"The note says, \"You won't get it up the steps\"."
	noun "note"
	adjective "crude"
	article "a"
}

treasure large_gold_nugget "large gold nugget"
{
	nearby
	long_desc
		"It's a large sparkling nugget of gold!"
	initial_desc
		"There is a large sparkling nugget of gold here!"
	noun "nugget"
	adjectives "large", "heavy", "gold"
	article "a"
}

room FissureRoom
{
	is not light
	before
	{
		location DoJump
		{
			if CrystalBridge_daemon is active
				"I respectfully suggest you go across the
				bridge instead of jumping."
			else
				{"You didn't make it."
				endflag = 2}
		}
	}
	d_to {"The fissure is too terrifying!"}
}

FissureRoom On_East_Bank_Of_Fissure "On East Bank of Fissure"
{
	long_desc
	{
		"You are on the east bank of a fissure slicing
		clear across the hall. The mist is quite thick here,
		and the fissure is too wide to jump."
		if CrystalBridge_daemon is active
			"A crystal bridge now spans the fissure."
	}
	e_to In_Hall_Of_Mists
	w_to 
		"The fissure is too wide."
}

FissureRoom West_Side_Of_Fissure "West Side of Fissure"
{
	long_desc
	{
		"You are on the west side of the fissure in the
		hall of mists."
		if CrystalBridge_daemon is active
			"A crystal bridge now spans the fissure."
	}
	w_to At_West_End_Of_Hall_Of_Mists
	e_to 
		"The fissure is too wide."
	n_to 
		{"You have crawled through a very
		low wide passage parallel to and north
		of the hall of mists.\n"
		return At_West_End_Of_Hall_Of_Mists}
}

object CrystalBridge "crystal bridge"
{
	long_desc
		"It spans the fissure, thereby providing you a way across."
	door_to
	{
		if location = West_Side_Of_Fissure 
			return On_East_Bank_Of_Fissure
		else
			return West_Side_Of_Fissure
	}
	noun "bridge"
	adjective "crystal"
	article "a"
	found_in 0, 0
	type door
	is static, open
}

daemon CrystalBridge_daemon
{}

scenery BridgeFissure "fissure"
{
	noun "fissure"
	adjective "wide"
	article "a"
	long_desc
		 "The fissure looks far too wide to jump."
	found_in On_East_Bank_Of_Fissure, West_Side_Of_Fissure
}

treasure several_diamonds "diamonds" 
{
	in West_Side_Of_Fissure
	article "some"
	is plural
	long_desc
		"They look to be of the highest quality!"
	initial_desc
		"There are diamonds here!"
	nouns "diamond", "diamonds"
}

room At_West_End_Of_Hall_Of_Mists "At West End of Hall of Mists"
{
	is not light
	long_desc
		"You are at the west end of the hall of mists.  \
		A low wide crawl continues west and another goes
		north.  To the south is a little passage 6 feet off
		the floor."
	s_to Alike_Maze_1
	u_to Alike_Maze_1
	e_to West_Side_Of_Fissure
	w_to At_East_End_Of_Long_Hall
	n_to
		{"You have crawled through a very low
		wide passage parallel to and north of
		the hall of mists.\n"
		return West_Side_Of_Fissure}
}

!----------------------------------------------------------------------------
!   Long Hall to the west of the Hall of Mists
!----------------------------------------------------------------------------

room At_East_End_Of_Long_Hall "At East End of Long Hall"
{
	is not light
	long_desc
		"You are at the east end of a very long hall
		apparently without side chambers.  To the east a low
		wide crawl slants up.  To the north a round two foot
		hole slants down."
	e_to At_West_End_Of_Hall_Of_Mists
	u_to At_West_End_Of_Hall_Of_Mists
	w_to At_West_End_Of_Long_Hall
	n_to Crossover
	d_to Crossover
}

room At_West_End_Of_Long_Hall "At West End of Long Hall"
{
	is not light
	long_desc
		"You are at the west end of a very long
		featureless hall.  The hall joins up with a narrow
		north/south passage."
	e_to At_East_End_Of_Long_Hall
	s_to Different_Maze_1
	n_to Crossover
}

room Crossover "N/S and E/W Crossover"
{
	is not light
	long_desc
		"You are at a crossover of a high N/S passage
		and a low E/W one."
	w_to At_East_End_Of_Long_Hall
	n_to Dead_End_7
	e_to In_West_Side_Chamber
	s_to At_West_End_Of_Long_Hall
}

scenery TheCrossover "crossover"
{
	nearby
	long_desc
		"You know as much as I do at this point."
	noun "crossover", "over" 
	adjective "cross"
	article "a"
}

room DeadEndRoom
{
	is not light
	long_desc
		"You have reached a dead end."
	cant_go 
		"You'll have to go back the way you came."
}

DeadEndRoom Dead_End_7 "Dead End"
{
	s_to Crossover
	out_to Crossover
}

!----------------------------------------------------------------------------
!   The Hall of the Mountain King and side chambers
!----------------------------------------------------------------------------

room In_Hall_Of_Mt_King "Hall of the Mountain King"
{
	is not light
	long_desc
		"You are in the hall of the mountain king, with
		passages off in all directions."
	cant_go 
		"Well, perhaps not quite all directions."
	u_to In_Hall_Of_Mists
	e_to In_Hall_Of_Mists
	n_to Low_N_S_Passage
	s_to In_South_Side_Chamber
	w_to In_West_Side_Chamber
	sw_to In_Secret_E_W_Canyon
	before
	{
		location DoGo
		{
			if Snake not in nothing and \
				((object=n_obj or object=s_obj \
				or object=w_obj) \
				or (object=sw_obj and random(100)<=35))
				"You can't get by the snake."
			else
				return false
		}
	}
}

character Snake "snake"
{
	in In_Hall_Of_Mt_King
	long_desc
		"I wouldn't mess with it if I were you."
	initial_desc
		"A huge green fierce snake bars the way!"
	nouns "snake", "cobra", "asp"
	adjectives "huge", "fierce", "green", "ferocious", "large", \
		"big", "killer"
	article "a"
	ignore_response
		"Hiss!"
	is unfriendly
	before
	{
		xobject DoGive
		{
			if object = little_bird
			{
				remove little_bird
				"The snake has now devoured your bird."
			}
			else
				"There's nothing here it wants to eat
				(except perhaps you)."
		}
		object DoHit
		{
			"Attacking the snake both doesn't work
			and is very dangerous."
		}
		object DoGet
		{
			"It takes you instead.  Glrp!"
			endflag = 2
		}
	}
}

room Low_N_S_Passage "Low N/S Passage"
{
	is not light
	long_desc
		"You are in a low N/S passage at a hole in the
		floor.  The hole goes down to an E/W passage."
	s_to In_Hall_Of_Mt_King
	d_to In_Dirty_Passage
	n_to At_Y2
}

treasure bars_of_silver "bars of silver"
{
	in Low_N_S_Passage
	long_desc
		"They're probably worth a fortune!"
	initial_desc
		"There are bars of silver here!"
	article "some"
	is plural
	adjectives "bar", "bars", "silver"
}

room In_South_Side_Chamber "In South Side Chamber"
{
	is not light
	long_desc
		"You are in the south side chamber."
	n_to In_Hall_Of_Mt_King
}

treasure precious_jewelry "precious jewelry"
{
	in In_South_Side_Chamber
	long_desc
		"It's all quite exquisite!"
	initial_desc
		"There is some precious jewelry here!"
	nouns "jewel", "jewels", "jewelry" 
	adjectives "precious", "exquisite"
	article "some"
}

room In_West_Side_Chamber "In West Side Chamber"
{
	long_desc
		"You are in the west side chamber of the hall of
		the mountain king. A passage continues west and up
		here."
	w_to Crossover
	u_to Crossover
	e_to In_Hall_Of_Mt_King
	is not light
}

treasure rare_coins "rare coins"
{
	in In_West_Side_Chamber
	long_desc
		"They're a numismatist's dream!"
	initial_desc 
		"There are many coins here!"
	article "many"
	nouns "coin", "coins"
	adjectives "rare"
	is plural
}
       
!----------------------------------------------------------------------------
!   The Y2 Rock Room and environs, slightly below
!----------------------------------------------------------------------------

room At_Y2 "At \"Y2\""
{
	is not light
	long_desc
	{
		"You are in a large room, with a passage to the
		south, a passage to the west, and a wall of broken
		rock to the east. There is a large \"Y2\" on
		a rock in the room's center."
		if random(100)<=25
			"\nA hollow voice says, \"Plugh.\""
	}
	before
	{
		location Plugh
			{MovePlayer(Inside_Building)}
		location Plover
		{
			if In_Plover_Room is not visited
				return false
			if egg_sized_emerald in player
				move egg_sized_emerald to In_Plover_Room
			MovePlayer(In_Plover_Room)
		}
	}
	s_to Low_N_S_Passage
	e_to Jumble_Of_Rock
	w_to At_Window_On_Pit_1
}

scenery Y2Rock "\"Y2\" rock"
{
	in At_Y2
	long_desc
		"There is a large \"Y2\" painted on the rock."
	noun "rock", "stone"
	adjective "y2"
	article "the"
	is platform
}

room Jumble_Of_Rock "Jumble of Rock"
{
	is not light
	long_desc
		"You are in a jumble of rock, with cracks everywhere."
	d_to At_Y2
	u_to In_Hall_Of_Mists
}

room At_Window_On_Pit_1 "At Window on Pit"
{
	long_desc
		"You're at a low window overlooking a huge pit,
		which extends up out of sight.  A floor is
		indistinctly visible over 50 feet below.  Traces of
		white mist cover the floor of the pit, becoming
		thicker to the right. Marks in the dust around the
		window would seem to indicate that someone has been
		here recently.  Directly across the pit from you and
		25 feet away there is a similar window looking into a
		lighted room.  A shadowy figure can be seen there
		peering back at you."
	before
	{
		location DoWaveHands
		{
			"The shadowy figure waves back at you!"
		}
	}
	cant_go 
		"The only passage is back east to Y2."
	e_to At_Y2
}

scenery TheWindow "window"
{
	in At_Window_On_Pit_1
	long_desc
		"It looks like a regular window."
	noun "window" 
	adjective "low"
	article "a"
	found_in At_Window_On_Pit_1, At_Window_On_Pit_2
	is openable
}

scenery WindowPit "huge pit"
{
	long_desc
		"It's so deep you can barely make out the floor below,
		and the top isn't visible at all."
	noun "pit"
	adjectives "huge", "deep", "large"
	article "a"
	found_in At_Window_On_Pit_1, At_Window_On_Pit_2
}

scenery MarksInTheDust "marks in the dust"
{
	long_desc
		"Evidently you're not alone here."
	noun "dust"
	adjectives "marks", "in"
	article "some"
	is plural
	found_in At_Window_On_Pit_1, At_Window_On_Pit_2
}

scenery ShadowyFigure "shadowy figure"
{
	long_desc
		"The shadowy figure seems to be trying to attract
		your attention."
	found_in At_Window_On_Pit_1, At_Window_On_Pit_2
	nouns "figure", "shadow", "person"
	adjectives "shadowy"
	article "a"
}

room In_Dirty_Passage "Dirty Passage"
{
	is not light
	long_desc
		"You are in a dirty broken passage.  To the east
		is a crawl.  To the west is a large passage.  Above
		you is a hole to another passage."
	e_to On_Brink_Of_Pit
	u_to Low_N_S_Passage
	w_to In_Dusty_Rock_Room
}

room On_Brink_Of_Pit "Brink of Pit"
{
	long_desc
		"You are on the brink of a small clean climbable
		pit.  A crawl leads west."
	w_to In_Dirty_Passage
	d_to In_Pit
	in_to In_Pit
}

scenery CleanPit "small pit" 
{
	in On_Brink_Of_Pit
	long_desc
		"It looks like you might be able to climb down into it."
	noun "pit"
	adjectives "small", "clean", "climbable"
	article "a"
	before
	{
		object DoClimb, DoEnter
		{
			MovePlayer(d_obj)
		}
	}
}

room In_Pit "In Pit"
{
	long_desc
		"You are in the bottom of a small pit with a
		little stream, which enters and exits through tiny
		slits."
	u_to On_Brink_Of_Pit
	d_to 
		"You don't fit through the tiny slits!"
	is not light, dwarf_free
}

scenery PitSlits "tiny slits"
{
	in In_Pit
	long_desc
		"The slits form a complex pattern in the rock."
	nouns "slit", "slits", "pattern", "rock"
	adjective "tiny", "complex"
	article "the"
}

room In_Dusty_Rock_Room "In Dusty Rock Room"
{
	is not light
	long_desc
		"You are in a large room full of dusty rocks.  \
		There is a big hole in the floor.  There are cracks
		everywhere, and a passage leading east."
	e_to In_Dirty_Passage
	d_to At_Complex_Junction
}

scenery DustyRocks "dusty rocks"
{
	in In_Dusty_Rock_Room
	long_desc
		"They're just rocks.  (Dusty ones, that is.)"
	nouns "rocks", "stones", "boulders", "rock", "boulder", "stone"
	adjectives "dusty", "dirty"
	article "some"
	is plural
}

!----------------------------------------------------------------------------
!   A maze of twisty little passages, all alike...
!----------------------------------------------------------------------------

room MazeRoom
{
	is not light
	long_desc
		"You are in a maze of twisty little passages,
		all alike."
	out_to 
		"Easier said than done."
}

MazeRoom Alike_Maze_1 "Maze"
{
	u_to At_West_End_Of_Hall_Of_Mists
	n_to Alike_Maze_1
	e_to Alike_Maze_2
	s_to Alike_Maze_4
	w_to Alike_Maze_11
}

MazeRoom Alike_Maze_2 "Maze"
{
	w_to Alike_Maze_1
	s_to Alike_Maze_3
	e_to Alike_Maze_4
}

MazeRoom Alike_Maze_3 "Maze"
{
	e_to Alike_Maze_2
	d_to Dead_End_3
	s_to Alike_Maze_6
	n_to Dead_End_13
}

MazeRoom Alike_Maze_4 "Maze"
{
	w_to Alike_Maze_1
	n_to Alike_Maze_2
	e_to Dead_End_1
	s_to Dead_End_2
	u_to Alike_Maze_14
	d_to Alike_Maze_14
}

MazeRoom Alike_Maze_5 "Maze"
{
	e_to Alike_Maze_6
	w_to Alike_Maze_7
}

MazeRoom Alike_Maze_6 "Maze"
{
	e_to Alike_Maze_3
	w_to Alike_Maze_5
	d_to Alike_Maze_7
	s_to Alike_Maze_8
}

DeadEndRoom Dead_End_1 "Dead End"
{
	w_to Alike_Maze_4
	out_to Alike_Maze_4
}

DeadEndRoom Dead_End_2 "Dead End"
{
	w_to Alike_Maze_4
	out_to Alike_Maze_4
}

DeadEndRoom Dead_End_3 "Dead End"
{
	u_to Alike_Maze_3
	out_to Alike_Maze_3
}

MazeRoom Alike_Maze_7 "Maze"
{
	w_to Alike_Maze_5
	u_to Alike_Maze_6
	e_to Alike_Maze_8
	s_to Alike_Maze_9
}

MazeRoom Alike_Maze_8 "Maze"
{
	w_to Alike_Maze_6
	e_to Alike_Maze_7
	s_to Alike_Maze_8
	u_to Alike_Maze_9
	n_to Alike_Maze_10
	d_to Dead_End_12
}

MazeRoom Alike_Maze_9 "Maze"
{
	w_to Alike_Maze_7
	n_to Alike_Maze_8
	s_to Dead_End_4
}

DeadEndRoom Dead_End_4 "Dead End"
{
	w_to Alike_Maze_9
	out_to Alike_Maze_9
}

MazeRoom Alike_Maze_10 "Maze"
{
	w_to Alike_Maze_8
	n_to Alike_Maze_10
	d_to Dead_End_5
	e_to At_Brink_Of_Pit
}

DeadEndRoom Dead_End_5 "Dead End"
{
	u_to Alike_Maze_10
	out_to Alike_Maze_10
}

room At_Brink_Of_Pit "At Brink of Pit"
{
	is not light
	long_desc
		"You are on the brink of a thirty foot pit with
		a massive orange column down one wall.  You could
		climb down here but you could not get back up.  The
		maze continues at this level."
	d_to In_Bird_Chamber
	w_to Alike_Maze_10
	s_to Dead_End_6
	n_to Alike_Maze_12
	e_to Alike_Maze_13
}

scenery OrangeColumn "massive orange column"
{
	in At_Brink_Of_Pit
	long_desc
		"It looks like you could climb down it."
	noun "column"
	adjectives "massive", "orange", "big", "huge"
	article "a"
	before
	{
		object DoClimb
			{MovePlayer(d_obj)}
	}
}

scenery ThirtyFootPit "pit"
{
	nearby
	long_desc
		"You'll have to climb down to find out anything more..."
	noun "pit"
	adjectives "thirty", "foot", "thirty-foot"
	article "a"
	before
	{
		object DoClimb
			{MovePlayer(d_obj)}
	}
}

DeadEndRoom Dead_End_6 "Dead End"
{
	e_to At_Brink_Of_Pit
	out_to At_Brink_Of_Pit
}

!----------------------------------------------------------------------------
!   A line of three vital junctions, east to west
!----------------------------------------------------------------------------

room At_Complex_Junction "At Complex Junction"
{
	is not light
	long_desc
		"You are at a complex junction.  A low hands and
		knees passage from the north joins a higher crawl
		from the east to make a walking passage going west.  \
		There is also a large room above.  The air is damp
		here."
	u_to In_Dusty_Rock_Room
	w_to In_Bedquilt
	n_to In_Shell_Room
	e_to In_Anteroom
}

room In_Bedquilt "Bedquilt"
{
	is not light
	long_desc
		"You are in bedquilt, a long east/west passage
		with holes everywhere. To explore at random select
		north, south, up, or down."
	e_to At_Complex_Junction
	w_to In_Swiss_Cheese_Room
	s_to In_Slab_Room
	u_to In_Dusty_Rock_Room
	n_to At_Junction_Of_Three
	d_to In_Anteroom
	before
	{
		location DoGo
		{
			local destiny
			if object = s_obj or object = d_obj \
				and random(100)<=80

				destiny = 1
			elseif object = u_obj and random(100)<=80
				destiny = 1
			elseif object = u_obj and random(100)<=50
				destiny = In_Secret_N_S_Canyon_1
			elseif object = n_obj and random(100)<=60
				destiny = 1
			elseif object = n_obj and random(100)<=75
				destiny = In_Large_Low_Room

			if destiny = 1
				"You have crawled around in some little
				holes and wound up back in the main passage."
			elseif destiny = 0
				return false
			else
				MovePlayer(destiny)
		}
	}
}

room In_Swiss_Cheese_Room "In Swiss Cheese Room"
{
	is not light
	long_desc
		"You are in a room whose walls resemble swiss
		cheese.  Obvious passages go west, east, ne, and nw.  \
		Part of the room is occupied by a large bedrock
		block."
	w_to At_East_End_Of_Twopit_Room
	s_to In_Tall_E_W_Canyon
	ne_to In_Bedquilt
	nw_to In_Oriental_Room
	e_to In_Soft_Room
	before
	{
		location DoGo
		{
			if (object = s_obj and random(100)<=80) or \
				(object = nw_obj and random(100)<=50)
				"You have crawled around in some little
				holes and wound up back in the main passage."
			else: return false
		}
	}
}

scenery BedrockBlock "bedrock block"
{
	in In_Swiss_Cheese_Room
	long_desc
		"It's just a huge block."
	noun "block"
	adjectives "bed", "rock", "bedrock", "large", "huge"
	article "a"
	before
	{
		object DoGet, DoLookUnder
			{"Surely you're joking."}
	}
}

!----------------------------------------------------------------------------
!   The Twopit Room area
!----------------------------------------------------------------------------

room At_West_End_Of_Twopit_Room "At West End of Twopit Room"
{
	is not light
	long_desc
		"You are at the west end of the twopit room.  \
		There is a large hole in the wall above the pit at
		this end of the room."
	e_to At_East_End_Of_Twopit_Room
	w_to In_Slab_Room
	d_to In_West_Pit
	u_to 
		"It is too far up for you to reach."
}

object PlantStickingUp "beanstalk"
{
	
	in At_West_End_Of_Twopit_Room
	nouns "stalk", "beanstalk", "plant"
	adjectives "bean", "giant", "tiny", "little", "murmuring", \
		"tall", "bellowing"
	article "a"
	short_desc
	{
		if Plant.misc = 1
			"The top of a 12-foot-tall beanstalk is
			 poking out of the west pit."
		elseif Plant.misc > 1
			"There is a huge beanstalk growing out of the
			west pit up to the hole."
	}
	before
	{
		object DoLook
			{run self.short_desc}
		object DoClimb
		{
			if Plant.misc = 2
				Perform(&DoClimb, Plant)
		}
	}
	is static
}

scenery HoleAbovePit_1 "hole above pit"
{
	long_desc
		"The hole is in the wall above the pit at
		this end of the room."
	noun "pit"
	adjectives "hole", "above"
	article "a"
	found_in In_West_Pit, At_West_End_Of_Twopit_Room
	before
	{
		object DoEnter, DoGo
			{"It is too far up for you to reach."}
	}
}

room In_West_Pit "In West Pit"
{
	is not light
	long_desc
		"You are at the bottom of the western pit in the
		twopit room.  There is a large hole in the wall about
		25 feet above you."
	before
	{
		location DoClimb
		{
			if object = Plant
				return false
			elseif Plant.misc < 1 or Plant.misc < 2
				"There is nothing here to climb.  Use
				\"up\" or \"out\" to leave the pit."
			else
				return false
		}
	}
	u_to At_West_End_Of_Twopit_Room
	is dwarf_free
}

object Plant "plant"
{
	in In_West_Pit
	misc 0
	nouns "stalk", "beanstalk", "plant"
	adjectives "bean", "giant", "tiny", "little", "murmuring", \
		"tall", "bellowing"
	article "a"
	short_desc
	{
		select self.misc
		case 0
			"There is a tiny little plant in the pit,
			murmuring \"Water, water, ...\""
		case 1
			"There is a 12-foot-tall beanstalk stretching
			up out of the pit, bellowing \"Water!! Water!!\""
		case 2
			"There is a gigantic beanstalk stretching all
			the way up to the hole."
	}
	before
	{
		object DoClimb
		{
			if self.misc = 0
				"It's just a little plant!"
			elseif self.misc = 1
				{"You have climbed up the plant and out
				of the pit.\n"
				MovePlayer(At_West_End_Of_Twopit_Room)}
			elseif self.misc = 2
				{"You clamber up the plant and scurry
				through the hole at the top.\n"
				MovePlayer(In_Narrow_Corridor)}
		}
		object DoGet
			{"The plant has exceptionally deep roots and
			cannot be pulled free."}
		object DoWater
		{
			if bottle not in player
				{"You have nothing to water the plant with."
				return true}
			
			local conts
			conts = child(bottle)
			if conts = 0 
				{"The bottle is empty."
				return true}
			else
				remove conts

			if conts = oil_in_the_bottle
				{"The plant indignantly shakes the oil
				off its leaves and asks, \"Water?\""
				return true}
			else
				self.misc = self.misc + 1

			if self.misc = 1
				"The plant spurts into furious growth for a
				few seconds."
			elseif self.misc = 2
				"The plant grows explosively, almost filling
				the bottom of the pit."
			elseif self.misc = 3
				{"You've over-watered the plant!  It's
				shriveling up!  It's, it's..."
				remove PlantStickingUp
				self.misc = 0}
			run self.short_desc
		}
		object DoOil
			{Perform(&DoWater, object)}
		object DoLook
			{run self.short_desc}
	}
}

room At_East_End_Of_Twopit_Room "At East End of Twopit Room"
{
	is not light
	long_desc
		"You are at the east end of the twopit room.  \
		The floor here is littered with thin rock slabs,
		which make it easy to descend the pits. There is a
		path here bypassing the pits to connect passages from
		east and west.  There are holes all over, but the
		only big one is on the wall directly over the west
		pit where you can't get to it."
	e_to In_Swiss_Cheese_Room
	w_to At_West_End_Of_Twopit_Room
	d_to In_East_Pit
}

scenery Slabs "thin rock slabs"
{
	in At_East_End_Of_Twopit_Room
	long_desc
		"They almost form natural stairs down into the pit."
	nouns "slabs", "rocks", "stairs", "slab"
	adjectives "thin", "rock"
	article "some"
	is plural
	before
	{
		object DoLookUnder, DoGet
			{"Surely you're joking."}
	}
}

room In_East_Pit "In East Pit"
{
	long_desc
		"You are at the bottom of the eastern pit in the
		twopit room.  There is a small pool of oil in one
		corner of the pit."
	u_to At_East_End_Of_Twopit_Room
	is dwarf_free
}

scenery Oil "pool of oil"
{
	in In_East_Pit
	noun "pool", "oil"
	adjective "small"
	article "a"
	long_desc
		"It looks like ordinary oil."
	before
	{
		object DoDrink
			{"Absolutely not."}
		object DoGet
		{   
			if bottle not in player
				"You have nothing in which to carry the oil."
			else
				Perform(&DoFill, bottle)
		}
		object DoPutin
		{
			if xobject = bottle
				Perform(&DoFill, bottle)
			else
				"You have nothing in which to carry the oil."
		}
	}
}

scenery HoleAbovePit_2 "hole above pit"
{
	nearby Oil
	long_desc
		"The hole is in the wall above you."
	nouns "hole"
	article "a"
	found_in In_East_Pit, At_East_End_Of_Twopit_Room
}

room In_Slab_Room "Slab Room"
{
	is not light
	long_desc
		"You are in a large low circular chamber whose
		floor is an immense slab fallen from the ceiling
		(slab room).  East and west there once were large
		passages, but they are now filled with boulders.  Low
		small passages go north and south, and the south one
		quickly bends west around the boulders."
	s_to At_West_End_Of_Twopit_Room
	u_to In_Secret_N_S_Canyon_0
	n_to In_Bedquilt
}

scenery Slab "slab"
{
	in In_Slab_Room
	long_desc
		"It is now the floor here."
	noun "slab" 
	adjective "immense"
	before
	{
		object DoLookUnder, DoGet
			{"Surely you're joking."}
	}
}

scenery SlabBoulders "boulders"
{
	nearby
	long_desc
		"They're just ordinary boulders."
	nouns "boulder" "boulders" "rocks" "stones"
	article "some"
	is plural
}

!----------------------------------------------------------------------------
!   A small network of Canyons, mainly Secret
!----------------------------------------------------------------------------

room In_Secret_N_S_Canyon_0 "Secret N/S Canyon"
{
	long_desc
		"You are in a secret N/S canyon above a large
		room."
	d_to In_Slab_Room
	s_to In_Secret_Canyon
	n_to In_Mirror_Canyon
	before
	{
		location DoGo
		{
			if object=d_obj {canyon_from = self}
			return false
		}
	}
}

room In_Secret_N_S_Canyon_1 "Secret N/S Canyon"
{
	is not light
	long_desc
		"You are in a secret N/S canyon above a sizable
		passage."
	n_to At_Junction_Of_Three
	d_to In_Bedquilt
	s_to Atop_Stalactite
}

room At_Junction_Of_Three "Junction of Three Secret Canyons"
{
	is not light
	long_desc
		"You are in a secret canyon at a junction of
		three canyons, bearing north, south, and se.  The
		north one is as tall as the other two combined."
	se_to In_Bedquilt
	s_to In_Secret_N_S_Canyon_1
	n_to At_Window_On_Pit_2
}

room In_Large_Low_Room "Large Low Room"
{
	is not light
	long_desc
		"You are in a large low room.  Crawls lead
		north, se, and sw."
	sw_to In_Sloping_Corridor
	se_to In_Oriental_Room
	n_to Dead_End_Crawl
}

room Dead_End_Crawl "Dead End Crawl"
{
	is not light
	long_desc
		"This is a dead end crawl."
	s_to In_Large_Low_Room
	out_to In_Large_Low_Room
}

room In_Secret_E_W_Canyon "Secret E/W Canyon Above Tight Canyon"
{
	is not light
	long_desc
		"You are in a secret canyon which here runs E/W.  \
		It crosses over a very tight canyon 15 feet below.  \
		If you go down you may not be able to get back up."
	e_to In_Hall_Of_Mt_King
	w_to 
		{canyon_from = self
		return In_Secret_Canyon}
	d_to In_N_S_Canyon
}

room In_N_S_Canyon "N/S Canyon"
{
	is not light
	long_desc
		"You are at a wide place in a very tight N/S
		canyon."
	s_to Canyon_Dead_End
	n_to In_Tall_E_W_Canyon
}

room Canyon_Dead_End "Canyon Dead End"
{
	is not light
	long_desc
		"The canyon here becomes too tight to go further
		south."
	n_to In_N_S_Canyon
}

room In_Tall_E_W_Canyon "In Tall E/W Canyon"
{
	is not light
	long_desc
		"You are in a tall E/W canyon.  A low tight
		crawl goes 3 feet north and seems to open up."
	e_to In_N_S_Canyon
	w_to Dead_End_8
	n_to In_Swiss_Cheese_Room
}

room Atop_Stalactite "Atop Stalactite"
{
	is not light
	long_desc
		"A large stalactite extends from the roof and
		almost reaches the floor below.  You could climb down
		it, and jump from it to the floor, but having done so
		you would be unable to reach it to climb back up."
	n_to In_Secret_N_S_Canyon_1
	d_to
	{
		if random(100) <= 40
			return Alike_Maze_6
		if random(100) <= 40
			return Alike_Maze_9
		return Alike_Maze_4
	}
	before
	{
		location DoJump, DoClimb
			{MovePlayer(d_obj)}
	}
}

scenery Stalactite "stalactite"
{
	in Atop_Stalactite
	long_desc
		"You could probably climb down it, but you can forget
		coming back up."
	nouns "stalactite"
	adjective "large"
	article "a"
	before
	{
		object DoLookUnder, DoGet
			{"Do get a grip on yourself."}
	}
}

!----------------------------------------------------------------------------
!   Here be dragons
!----------------------------------------------------------------------------

room In_Secret_Canyon "Secret Canyon"
{
	long_desc
		"You are in a secret canyon which exits to the
		north and east."
	e_to 
	{
		if canyon_from = In_Secret_E_W_Canyon 
			return canyon_from
		if Dragon in location
			"The dragon looks rather nasty.  You'd
			best not try to get by."
		else
			return In_Secret_E_W_Canyon
	}
	n_to
	{
		if canyon_from = In_Secret_N_S_Canyon_0
			return canyon_from
		if Dragon in location
			"The dragon looks rather nasty.  You'd
			best not try to get by."
		else
			return In_Secret_N_S_Canyon_0
	}
	out_to
		return canyon_from
	before
	{
		location DoYes
		{
			if Dragon is special
			{
				remove Dragon
				move DragonCorpse to location
				Dragon is not special
				"Congratulations!  You have just vanquished
				a dragon with your bare hands!  \
				(Unbelievable, isn't it?)"
			}
			else
				return false
		}
		location DoNo
		{
			if Dragon is special
				{Dragon is not special
				"I should think not."}
			else
				return false
		}
	}
}

character Dragon "dragon"
{
	in In_Secret_Canyon
	is unfriendly
	long_desc
		"I wouldn't mess with it if I were you."
	nouns "dragon", "monster", "beast", "lizard"
	adjectives "huge", "green", "fierce", "scaly", "giant", "ferocious"
	article "a"
	initial_desc 
		"A huge green fierce dragon bars the way!"
	before
	{
		object DoHit
		{
			Dragon is special
			"With what?  Your bare hands?"
		}
		xobject DoGive
			{"The dragon is implacable."}
		xobject DoThrowAt
		{
			if object ~= axe
			       "You'd probably be better off using your
			       bare hands than that thing!"
			else
			{
				move axe to location
				"The axe bounces harmlessly off the dragon's
				 thick scales."
			}
		}
	}
}

treasure persian_rug "Persian rug"
{
	nearby
	nouns "rug"
	adjectives "persian", "fine", "finest", "dragon's"
	article "a"
	depositpoints 14
	before
	{
		object DoGet
		{
			if Dragon in location
				"You'll need to get the dragon to move first!"
			else
				return false
		}
	}
	long_desc
	{
		if (Dragon in location)
			"The dragon is sprawled out on the Persian rug!"
		else
			"The Persian rug is spread out on the floor here."
	}
}

object DragonCorpse "dragon's body"
{
	initial_desc
		"The body of a huge green dead dragon is lying off to
		one side."
	nouns "corpse", "body"
	adjectives "dragon", "dragon's", "dead"
	article "a"
	before
	{
		object DoHit
			{"You've already done enough damage!"}
	}
}

!----------------------------------------------------------------------------
!   And more of the Alike Maze
!----------------------------------------------------------------------------

DeadEndRoom Dead_End_8 "Dead End"
{
	long_desc
		"The canyon runs into a mass of boulders--dead end."
	s_to In_Tall_E_W_Canyon
	out_to In_Tall_E_W_Canyon
}

MazeRoom Alike_Maze_11 "Maze"
{
	n_to Alike_Maze_1
	w_to Alike_Maze_11
	s_to Alike_Maze_11
	e_to Dead_End_9
}

DeadEndRoom Dead_End_9 "Dead End"
{
	w_to Alike_Maze_11
	out_to Alike_Maze_11
}

DeadEndRoom Dead_End_10 "Dead End"
{
	s_to Alike_Maze_3
	out_to Alike_Maze_3
}

MazeRoom Alike_Maze_12 "Maze"
{
	s_to At_Brink_Of_Pit
	e_to Alike_Maze_13
	w_to Dead_End_11
}

MazeRoom Alike_Maze_13 "Maze"
{
	n_to At_Brink_Of_Pit
	w_to Alike_Maze_12
	nw_to Dead_End_13
}

DeadEndRoom Dead_End_11 "Dead End"
{
	e_to Alike_Maze_12
	out_to Alike_Maze_12
}

DeadEndRoom Dead_End_12 "Dead End"
{
	u_to Alike_Maze_8
	out_to Alike_Maze_8
}

MazeRoom Alike_Maze_14 "Maze"
{
	u_to Alike_Maze_4
	d_to Alike_Maze_4
}

DeadEndRoom Dead_End_13 "Dead End"
{
	se_to Alike_Maze_13
	out_to Alike_Maze_13
	long_desc
		"This is the pirate's dead end."
	initial_desc
	{
		Deactivate(pirate_daemon)
		if treasure_chest in self and treasure_chest is not moved
			"You've found the pirate's treasure chest!"
	}
	is dwarf_free
}

treasure treasure_chest "treasure chest"
{
	in Dead_End_13
	depositpoints 12
	long_desc
		"It's the pirate's treasure chest, filled with
		riches of all kinds!"
	noun "chest", "box", "riches"
	adjective "pirate", "pirate's", "treasure"
	article "a"
}

!----------------------------------------------------------------------------
!   Above the beanstalk: the Giant Room and the Waterfall
!----------------------------------------------------------------------------

room In_Narrow_Corridor "In Narrow Corridor"
{
	is not light
	long_desc
		"You are in a long, narrow corridor stretching
		out of sight to the west.  At the eastern end is a
		hole through which you can see a profusion of
		leaves."
	d_to In_West_Pit
	w_to In_Giant_Room
	e_to In_West_Pit
	before
	{
		location DoJump
			{"You fall and break your neck!"
			endflag = 2}
	}
}

scenery Leaves "leaves"
{
	in In_Narrow_Corridor
	long_desc
		"The leaves appear to be attached to the beanstalk
		you climbed to get here."
	article "some"
	is plural
	nouns "leaves", "leaf", "plant", "tree", "stalk", "beanstalk"
	adjective "profusion"
}

room At_Steep_Incline "Steep Incline Above Large Room"
{
	is not light
	long_desc
		"You are at the top of a steep incline above a
		large room.  You could climb down here, but you would
		not be able to climb up.  There is a passage leading
		back to the north."
	n_to In_Cavern_With_Waterfall
	d_to In_Large_Low_Room
}

room In_Giant_Room "Giant Room"
{
	is not light
	long_desc
		"You are in the giant room.  The ceiling here is
		too high up for your lamp to show it.  Cavernous
		passages lead east, north, and south.  On the west
		wall is scrawled the inscription, \"Fee fie foe foo\"
		[sic]."
	s_to In_Narrow_Corridor
	e_to At_Recent_Cave_In
	n_to In_Immense_N_S_Passage
}

scenery Inscription "scrawled inscription"
{
	in In_Giant_Room
	long_desc
		"It says, \"Fee fie foe foo\" [sic]."
	nouns "inscription", "writing", "scrawl" 
	adjective "scrawled"
	article "a"
}

treasure golden_eggs "nest of golden eggs"
{
	nearby
	depositpoints 14
	long_desc
		"The nest is filled with beautiful golden eggs!"
	initial_desc
		"There is a large nest here, full of golden eggs!"
	noun "eggs"
	adjectives "egg", "nest", "beautiful", "golden"
	article "a"
}

room At_Recent_Cave_In "Recent Cave-in"
{
	is not light
	long_desc
	       "The passage here is blocked by a recent
	       cave-in."
	s_to In_Giant_Room
}

room In_Immense_N_S_Passage "Immense N/S Passage"
{
	is not light
	long_desc
		"You are at one end of an immense north/south passage."
	s_to In_Giant_Room
	n_to
		return RustyDoor.door_to
}

door RustyDoor "rusty door"
{
	in In_Immense_N_S_Passage
	long_desc
		"It's just a big iron door."
	nouns "door", "hinge", "hinges"
	adjectives "massive", "big", "iron", "rusty"
	article "a"
	when_closed 
		"The way north is barred by a massive, rusty, iron door."
	when_open   
		"The way north leads through a massive, rusty, iron door."
	found_in In_Cavern_With_Waterfall, In_Immense_N_S_Passage
	before
	{
		object DoOpen
		{
			if RustyDoor is locked
				"The hinges are quite thoroughly rusted now
				and won't budge."
			else
				return false
		}
		object DoClose
		{
			if RustyDoor is open
				"With all the effort it took to get the door
				open, I wouldn't suggest closing it again."
			else
				"No problem there -- it already is."
		}
		object DoOil
		{
			if bottle in player and oil_in_the_bottle in bottle
			{
				remove oil_in_the_bottle
				RustyDoor is not locked
				"The oil has freed up the hinges so that the
				 door will now move, although it requires
				 some effort."
			}
			else
				"You have nothing to oil it with."
		}
		object DoWater
		{
			if bottle in player and water_in_the_bottle in bottle
			{
				remove water_in_the_bottle
				RustyDoor is locked 
				RustyDoor is not open
				"The hinges are quite thoroughly
				rusted now and won't budge."
			}
			else
			    "You have nothing to water it with."
		}
	}
	after
	{
		object DoOpen
			{"The door heaves open with a shower of rust."}
	}
	is locked
}

room In_Cavern_With_Waterfall "In Cavern With Waterfall"
{
	is not light
	long_desc
		"You are in a magnificent cavern with a rushing
		stream, which cascades over a sparkling waterfall
		into a roaring whirlpool which disappears through a
		hole in the floor.  Passages exit to the south and
		west."
	s_to In_Immense_N_S_Passage
	w_to At_Steep_Incline
}

scenery Waterfall "waterfall"
{
	in In_Cavern_With_Waterfall
	long_desc
		"Wouldn't want to go down in in a barrel!"
	nouns "waterfall" "whirlpool" 
	adjectives "sparkling" "whirling"
}

treasure trident "jeweled trident"
{
	nearby
	long_desc
		"The trident is covered with fabulous jewels!"
	initial_desc 
		"There is a jewel-encrusted trident here!"
	noun "trident"
	adjectives "jewel", "encrusted", "jewel-encrusted", "jeweled", \
		"fabulous"
	article "a"
	depositpoints 14
}

!----------------------------------------------------------------------------
!   The caves around Bedquilt
!----------------------------------------------------------------------------

room In_Soft_Room "In Soft Room"
{
	is not light
	long_desc
		"You are in the soft room.  The walls are
		covered with heavy curtains, the floor with a thick
		pile carpet.  Moss covers the ceiling."
	w_to In_Swiss_Cheese_Room
}

scenery Carpet "carpet"
{
	in In_Soft_Room
	long_desc
		"The carpet is quite plush."
	nouns "carpet"
	adjectives "shag" "pile" "heavy" "thick"
	article "a"
}

scenery Curtains "curtains"
{
	nearby
	long_desc
		"They seem to absorb sound very well."
	nouns "curtain" "curtains" 
	adjectives "heavy" "thick"
	before
	{
		object DoGet
			{"Now don't go ripping up the place!"}
		object DoLookUnder
			{"You don't find anything exciting behind the
			curtains."}
	}
}

scenery Moss "moss"
{
	nearby
	long_desc
		"It just looks like your typical, everyday moss."
	noun "moss" 
	adjectives "typical" "everyday"
	article "some"
	before
	{
		object DoGet
			{"It crumbles to nothing in your hands."}
		object DoEat
			{"Eeeewwwww."}
	}
}

object velvet_pillow "velvet pillow" 
{
	nearby
	long_desc
		"It's just a small velvet pillow."
	initial_desc 
		"A small velvet pillow lies on the floor."
	noun "pillow"
	adjectives "velvet", "small"
	article "a"
}

room In_Oriental_Room "Oriental Room"
{
	is not light
	long_desc
		"This is the oriental room.  Ancient oriental
		cave drawings cover the walls.  A gently sloping
		passage leads upward to the north, another passage
		leads se, and a hands and knees crawl leads west."
	w_to In_Large_Low_Room
	se_to In_Swiss_Cheese_Room
	u_to In_Misty_Cavern
	n_to In_Misty_Cavern
}

scenery CaveDrawings "ancient oriental drawings"
{
	in In_Oriental_Room
	long_desc
		"They seem to depict people and animals."
	nouns "paintings" "drawings" "art" 
	adjectives "cave" "ancient" "oriental"
	article "some"
	is plural
}

treasure ming_vase "ming vase"
{
	nearby
	long_desc
		"It's a delicate, previous, ming vase!"
	initial_desc
		"A ming vase is here!"
	nouns "vase"
	adjectives "ming", "delicate"
	article "a"
	depositpoints 14
	after
	{
		object DoDrop
		{
			if velvet_pillow in location
			{
				"(coming to rest, delicately, on
				the velvet pillow)"
				return false
			}
			remove ming_vase
			move shards to location
			"The ming vase drops with a delicate crash."
		}
	}
}

object shards "some worthless shards of pottery"
{
	initial_desc
		"The floor is littered with worthless shards of pottery."
	long_desc
		"They look to be the remains of what was once a
		beautiful vase.  I guess some oaf must have dropped it."
	nouns "pottery"
	adjectives "shards", "remains", "vase", "worthless"
}

room In_Misty_Cavern "Misty Cavern"
{
	is not light
	long_desc
		"You are following a wide path around the outer
		edge of a large cavern. Far below, through a heavy
		white mist, strange splashing noises can be heard.  \
		The mist rises up through a fissure in the ceiling.  \
		The path exits to the south and west."
	s_to In_Oriental_Room
	w_to In_Alcove
}

scenery CeilingFissure "fissure"
{
	in In_Misty_Cavern
	long_desc
		"You can't really get close enough to examine it."
	noun "fissure"
	article "a"
}

!----------------------------------------------------------------------------
!   Plovers and pyramids
!----------------------------------------------------------------------------

room In_Alcove "Alcove"
{
	long_desc
		"You are in an alcove.  A small northwest path seems
		to widen after a short distance.  An extremely tight
		tunnel leads east.  It looks like a very tight
		squeeze.  An eerie light can be seen at the other
		end."
	nw_to In_Misty_Cavern
	e_to
	{
		local j
		j = children(player)
		if j = 0 or (j = 1 and egg_sized_emerald in player)
			return In_Plover_Room
		"Something you're carrying won't fit through the
		tunnel with you. You'd best take inventory and drop
		something."
	}
}

room In_Plover_Room "Plover Room"
{
	long_desc
		"You're in a small chamber lit by an eerie green
		light.  An extremely narrow tunnel exits to the west. \
		A dark corridor leads northeast."
	out_to In_Alcove
	ne_to In_Dark_Room
	w_to
	{
		local j
		j = children(player)
		if j = 0 or (j = 1 and egg_sized_emerald in player)
			return In_Alcove
		"Something you're carrying won't fit through the
		tunnel with you. You'd best take inventory and drop
		something."
	}
	before
	{
		location Plover
		{
			if egg_sized_emerald in player
				move egg_sized_emerald to In_Plover_Room
			MovePlayer(At_Y2)
		}
	}
}

treasure egg_sized_emerald "emerald the size of a plover's egg"
{
	in In_Plover_Room
	depositpoints 14
	article "an"
	long_desc
		"Plover's eggs, by the way, are quite large."
	initial_desc 
		"There is an emerald here the size of a plover's egg!"
	noun "egg"
	adjective "emerald", "size", "a", "plover's"
}

room In_Dark_Room "The Dark Room"
{
	is not light
	long_desc
		"You're in the dark-room.  A corridor leading
		south is the only exit."
	s_to In_Plover_Room
	is dwarf_free
}

object StoneTablet "stone tablet"
{
	in In_Dark_Room
	initial_desc
		"A massive stone tablet imbedded in the wall reads:  \
		\"Congratulations on bringing light into the
		dark-room!\""
	noun "tablet"
	adjectives "massive" "stone"
	article "a"
	is static, readable
}

treasure platinum_pyramid "platinum pyramid"
{
	nearby
	initial_desc
		"There is a platinum pyramid here, 8 inches on a side!"
	depositpoints 14
	long_desc
		"The platinum pyramid is 8 inches on a side!"
	noun "pyramid"
	adjectives "platinum"
	article "a"
}

!----------------------------------------------------------------------------
!   North of the complex junction: a long up-down corridor
!----------------------------------------------------------------------------

room In_Arched_Hall "Arched Hall"
{
	is not light
	long_desc
		"You are in an arched hall.  A coral passage
		once continued up and east from here, but is now
		blocked by debris.  The air smells of sea water."
	d_to In_Shell_Room
}

room In_Shell_Room "Shell Room"
{
	is not light
	long_desc
		"You're in a large room carved out of
		sedimentary rock.  The floor and walls are littered
		with bits of shells imbedded in the stone.  A shallow
		passage proceeds downward, and a somewhat steeper one
		leads up.  A low hands and knees passage enters from
		the south."
	u_to In_Arched_Hall
	d_to In_Ragged_Corridor
	s_to
	{
		if giant_bivalve in player
		{
			if giant_bivalve is open
				"You can't fit this five-foot oyster
				 through that little passage!"
			else
				"You can't fit this five-foot clam
				through that little passage!"
		}
		else
			return At_Complex_Junction
	}
}

object giant_bivalve "giant clam"
{
	in In_Shell_Room
	nouns "clam", "oyster", "bivalve"
	adjective "giant"
	article "a"
	short_desc
	{
		"There is an enormous ";
		if self is special
			"oyster";
		else
			"clam";
		" here with its shell tightly closed."
	}
	before
	{
		object DoLook
		{
			if location = At_Ne_End or location = At_Sw_End
				"Interesting.  There seems to be
				something written on the underside of
				the oyster:\n\n\
				\"There is something strange about this
				place, such that one of the words I've
				always known now has a new effect.\""
			else
				"A giant bivalve of some kind."
		}
		object DoOpen
		{
			"You aren't strong enough to open the clam
			 with your bare hands."
		}
		object DoUnlock
		{
			if not xobject
				Perform(&DoOpen, self)
			elseif xobject ~= trident
				{CThe(xobject)
				 " isn't strong enough to open the clam."}
			elseif self is special
				"The oyster creaks open, revealing nothing
				but oyster inside.  It promptly snaps shut
				again."
			else
			{
				self is special
				move pearl to In_A_Cul_De_Sac
				"A glistening pearl falls out of the clam
				and rolls away.  Goodness, this must
				really be an oyster.  (I never was very
				good at identifying bivalves.)  Whatever it
				is, it has now snapped shut again."
			}
		}
		object DoHit
			{"The shell is very strong and is impervious to
			attack."}
	}
	is lockable, openable
}

treasure pearl "glistening pearl"
{
	long_desc
		"It's incredibly large!"
	initial_desc
		"Off to one side lies a glistening pearl!"
	noun "pearl"
	adjectives "glistening" "incredible" "incredibly" "large"
	article "a"
	depositpoints 14
}

room In_Ragged_Corridor "Ragged Corridor"
{
	is not light
	long_desc
		"You are in a long sloping corridor with ragged
		sharp walls."
	u_to In_Shell_Room
	d_to In_A_Cul_De_Sac
}        

room In_A_Cul_De_Sac "Cul-de-Sac"
{
	is not light
	long_desc
		"You are in a cul-de-sac about eight feet
		across."
	u_to In_Ragged_Corridor
	out_to In_Ragged_Corridor
}

!----------------------------------------------------------------------------
!   Witt's End: Cave under construction
!----------------------------------------------------------------------------

room In_Anteroom "In Anteroom"
{
	is not light
	long_desc
		"You are in an anteroom leading to a large
		passage to the east.  Small passages go west and up.  \
		The remnants of recent digging are evident."
	u_to At_Complex_Junction
	w_to In_Bedquilt
	e_to At_Witts_End
}

object WittSign "sign"
{
	in In_Anteroom
	initial_desc
		"A sign in midair here says \"Cave under
		 construction beyond this point. Proceed at own risk.  \
		 [Witt Construction Company]\""
	noun "sign"
	adjective "witt" "company" "construction"
	before 
	{
		object DoGet
			{"It's hanging way above your head."}
	}
	is static
}

object spelunker_today "recent issues of \"Spelunker Today\""
{
	nearby
	nouns "magazines", "magazine"
	adjectives "issue", "issues", "recent", "spelunker", "today"
	initial_desc
		"There are a few recent issues of \"Spelunker Today\"
		magazine here."
	long_desc
		"I'm afraid the magazines are written in Dwarvish."
	article "a few"
	is plural
	after
	{
		object DoGet
		{
			if location = At_Witts_End
				score = score - 1
			return false
		}
		object DoDrop
		{
			if location = At_Witts_End
				{score = score + 1
				"You really are at wit's end."}
			else
				return false
		}
	}
}

room At_Witts_End "At Witt's End"
{
	is not light
	long_desc
		"You are at Witt's End.  Passages lead off in
		*all* directions."
	w_to   {"You have crawled around in some little holes and
	       found your way blocked by a recent cave-in.  You are
	       now back in the main passage."}
	before
	{
		location DoGo
		{
			if object ~= w_obj and random(100)<=95
				 "You have crawled around in some little
				 holes and wound up back in the main passage."
			else
				MovePlayer(In_Anteroom)
		}
	}
}

!----------------------------------------------------------------------------
!   North of the secret canyons, on the other side of the pit
!----------------------------------------------------------------------------

room In_Mirror_Canyon "In Mirror Canyon"
{
	is not light
	long_desc
		"You are in a north/south canyon about 25 feet
		across.  The floor is covered by white mist seeping
		in from the north.  The walls extend upward for well
		over 100 feet.  Suspended from some unseen point far
		above you, an enormous two-sided mirror is hanging
		parallel to and midway between the canyon walls.\n\n\
		A small window can be seen in either wall,
		some fifty feet up."
	s_to In_Secret_N_S_Canyon_0
	n_to At_Reservoir
}

object CanyonMirror "suspended mirror"
{
	in In_Mirror_Canyon
	long_desc
		"The mirror is obviously provided for the use of the
		dwarves who, as you know, are extremely vain."
	noun "mirror"
	adjectives "massive", "enormous", "suspended", "hanging", \
		"two-sided", "two", "sided"
	initial_desc
		"The mirror is obviously provided for the use of the
		dwarves, who as you know, are extremely vain."
	before
	{
		object DoGet
			{"You can't reach it from here."}
	}
	is static
}

room At_Window_On_Pit_2 "At Window on Pit"
{
	is not light
	long_desc
		"You're at a low window overlooking a huge pit,
		which extends up out of sight.  A floor is
		indistinctly visible over 50 feet below.  Traces of
		white mist cover the floor of the pit, becoming
		thicker to the left. Marks in the dust around the
		window would seem to indicate that someone has been
		here recently.  Directly across the pit from you and
		25 feet away there is a similar window looking into a
		lighted room.  A shadowy figure can be seen there
		peering back at you."
	cant_go 
		"The only passage is back west to the junction."
	w_to At_Junction_Of_Three
	before
	{
		location DoJump
		{
			"You jump and break your neck!"
			endflag = 2
		}
		location DoWaveHands
			{"The shadowy figure waves back at you!"}
	}
}

room At_Reservoir "At Reservoir"
{
	is not light
	long_desc
		"You are at the edge of a large underground
		reservoir.  An opaque cloud of white mist fills the
		room and rises rapidly upward.  The lake is fed by a
		stream, which tumbles out of a hole in the wall about
		10 feet overhead and splashes noisily into the water
		somewhere within the mist.  The only passage goes
		back toward the south."
	s_to In_Mirror_Canyon
	out_to In_Mirror_Canyon
	before
	{
		location DoSwim
			{"The water is icy cold, and you would soon
			freeze to death."}
	}
}

!----------------------------------------------------------------------------
!   The Chasm and the Troll Bridge
!----------------------------------------------------------------------------

room In_Sloping_Corridor "Sloping Corridor"
{
	is not light
	long_desc
		"You are in a long winding corridor sloping out
		of sight in both directions."
	d_to In_Large_Low_Room
	u_to On_Sw_Side_Of_Chasm
	cant_go 
		"The corridor slopes steeply up and down."
}

room On_Sw_Side_Of_Chasm "On SW Side of Chasm"
{
	is not light
	long_desc
	{
		"You are on one side of a large, deep chasm.  A
		heavy white mist rising up from below obscures all
		view of the far side.  A southwest path leads away
		from the chasm into a winding corridor."
		RicketyBridge_desc
	}
	ne_to 
		return CrossRicketyBridge
	sw_to In_Sloping_Corridor
	d_to In_Sloping_Corridor
	cant_go 
		"The path winds southwest."
	before
	{
		location DoJump
		{
			if RicketyBridge is not special
				"I respectfully suggest you go across the
				 bridge instead of jumping."
			else
				{"You didn't make it."
				endflag = 2}
		}
	}
}

routine CrossRicketyBridge
{
	if RicketyBridge is special
		{"What's left of the bridge is lying at the bottom
		of the chasm!"
		return true}
	
	if Troll is special or Troll in nothing
	{
		if Bear is special
		{
			remove bear
			Wreckage.found_in = \
				On_Sw_Side_Of_Chasm, On_Ne_Side_Of_Chasm
			RicketyBridge is special
			RicketyBridge.found_in = 0, 0
			Deactivate(bear_daemon)
			"Just as you reach the other side, the bridge
			 buckles beneath the weight of the bear, which
			 was still following you around.  You scrabble
			 desperately for support, but as the bridge
			 collapses you stumble back and fall into the
			 chasm."
			endflag = 2
		}
		else
			return RicketyBridge.door_to
	}
	if Troll in location
		"The troll refuses to let you cross."
	else
		{move Troll to location
		"The troll steps out from beneath the bridge
		and blocks your way."}
	return true
}

routine RicketyBridge_desc
{
	if RicketyBridge is not special
	{
		if location = On_Sw_Side_Of_Chasm \
			or location = On_Ne_Side_Of_Chasm
		{
			"A rickety wooden bridge extends across the
			chasm, vanishing into the mist.\n\n
			A sign posted on the bridge reads,
			\"Stop! Pay troll!\""
			if Troll not in location
				"\nThe troll is nowhere to be seen."
		}
	}
	else
		"The wreckage of the troll bridge (and a dead bear)
		can be seen at the bottom of the chasm."
}

object RicketyBridge "rickety bridge"
{
	found_in On_Sw_Side_Of_Chasm, On_Ne_Side_Of_Chasm
	long_desc
		"It just looks like an ordinary, but unstable, bridge."
	noun "bridge"
	adjectives "rickety" "unstable" "wobbly" "rope"
	door_to
	{
		if location = On_Sw_Side_Of_Chasm
			return On_Ne_Side_Of_Chasm
		else
			return On_Sw_Side_Of_Chasm
	}
	is static, open
	type door
}

object Wreckage "wreckage of bridge"
{
	noun "bridge","bear"
	adjectives "wreckage", "wreck", "dead"
	found_in 0, 0
	is static
}

character Troll "burly troll"
{
	in RicketyBridge
	long_desc
		"Trolls are close relatives with rocks and have skin
		 as tough as that of a rhinoceros."
	initial_desc
		"A burly troll stands by the bridge and insists you
		throw him a treasure before you may cross."
	noun "troll", "monster", "creature"
	adjective "burly"
	article "a"
	ignore_response
		"Trolls make poor conversation."
	before
	{
		object DoHit
			{"The troll laughs aloud at your pitiful attempt
			to injure him."}
		xobject DoGive
		{
			if object is valuable
			{
				remove object
				remove Troll
				Troll is special
				score = score - 5
				"The troll catches your treasure and
				scurries away out of sight."
			}
			elseif object = tasty_food
				"Gluttony is not one of the troll's vices.  \
				Avarice, however, is."
			else
			{
				"The troll deftly catches "; 
				The(noun)
				", examines it carefully, and tosses
				it back, declaring, \"Good workmanship,
				but it's not valuable enough.\""
			}
		}
	}
}

room On_Ne_Side_Of_Chasm "On NE Side of Chasm"
{
	is not light
	long_desc
	{
		"You are on the far side of the chasm.  A
		northeast path leads away from the chasm on this
		side."
		RicketyBridge_desc
	}
	sw_to 
		return CrossRicketyBridge
	ne_to In_Corridor

       before
       {
		location DoJump
		{
			if RicketyBridge is not special
				"I respectfully suggest you go across the
				 bridge instead of jumping."
			else
				{"You didn't make it."
				endflag = 2}
		}
	}
	is dwarf_free
}

room In_Corridor "In Corridor"
{
	is not light
	long_desc
		"You're in a long east/west corridor.  A faint
		rumbling noise can be heard in the distance."
	w_to On_Ne_Side_Of_Chasm
	e_to At_Fork_In_Path
	is dwarf_free
}

!----------------------------------------------------------------------------
!   The Volcano
!----------------------------------------------------------------------------

room At_Fork_In_Path "At Fork in Path"
{
	is not light
	long_desc
		"The path forks here.  The left fork leads
		northeast.  A dull rumbling seems to get louder in
		that direction.  The right fork leads southeast down
		a gentle slope.  The main corridor enters from the
		west."
	w_to In_Corridor
	ne_to At_Junction_With_Warm_Walls
	se_to In_Limestone_Passage
	d_to In_Limestone_Passage
	is dwarf_free
}

room At_Junction_With_Warm_Walls "At Junction With Warm Walls"
{
	long_desc
		"The walls are quite warm here.  From the north
		can be heard a steady roar, so loud that the entire
		cave seems to be trembling.  Another passage leads
		south, and a low crawl goes east."
	s_to At_Fork_In_Path
	n_to At_Breath_Taking_View
	e_to In_Chamber_Of_Boulders
	is dwarf_free
}

room At_Breath_Taking_View "At Breath-Taking View"
{
	long_desc
	{
		"You are on the edge of a breath-taking view.  Far
		below you is an active volcano, from which great
		gouts of molten lava come surging out, cascading back
		down into the depths.  The glowing rock fills the
		farthest reaches of the cavern with a blood-red
		glare, giving everything an eerie, macabre
		appearance. The air is filled with flickering sparks
		of ash and a heavy smell of brimstone.  The walls are
		hot to the touch, and the thundering of the volcano
		drowns out all other sounds.  ";
		"Embedded in the jagged
		roof far overhead are myriad twisted formations
		composed of pure white alabaster, which scatter the
		murky light into sinister apparitions upon the walls.  \
		To one side is a deep gorge, filled with a bizarre
		chaos of tortured rock which seems to have been
		crafted by the devil himself.  An immense river of
		fire crashes out from the depths of the volcano,
		burns its way through the gorge, and plummets into a
		bottomless pit far off to your left.  To the right,
		an immense geyser of blistering steam erupts
		continuously from a barren island in the center of a
		sulfurous lake, which bubbles ominously.  ";
		"The far
		right wall is aflame with an incandescence of its
		own, which lends an additional infernal splendor to
		the already hellish scene.  A dark, forboding passage
		exits to the south."
	}
	s_to At_Junction_With_Warm_Walls
	out_to At_Junction_With_Warm_Walls
	d_to 
		"Don't be ridiculous!"
	before
	{
		location DoJump
			{run self.d_to}
	}
}

scenery Volcano "active volcano"
{
	in At_Breath_Taking_View
	long_desc
		"Great gouts of molten lava come surging out of the
		volvano and go cascading back down into the depths.  \
		The glowing rock fills the farthest reaches of the
		cavern with a blood-red glare, giving everything an
		eerie, macabre appearance."
	nouns "volcano", "rock"
	adjectives "active", "glowing", "blood", "red", "blood-red", \
		"eerie", "macabre"
	article "an"
}

scenery Sparks "sparks of ash"
{
	nearby
	long_desc
		"The sparks too far away for you to get a good look at
		them."
	nouns "ash"
	adjectives "spark", "sparks"
	article "some"
	is plural
}

scenery JaggedRoof "jagged roof"
{
	nearby
	long_desc
		"Embedded in the jagged roof far overhead are myriad
		twisted formations composed of pure white alabaster,
		which scatter the murky light into sinister
		apparitions upon the walls."
	nouns "roof", "formations", "apparitions", "light"
	adjectives "jagged", "twisted", "murky", "sinister"
	article "the"
}

scenery DeepGorge "deep gorge"
{
	nearby
	long_desc
		"The gorge is filled with a bizarre chaos of tortured
		rock which seems to have been crafted by the devil
		himself."
	nouns "gorge", "chaos", "rock"
	adjectives "deep", "bizarre", "tortured"
	article "a"
}

scenery RiverOfFire "river of fire"
{
	nearby
	long_desc
		"The river of fire crashes out from the depths of the
		volcano, burns its way through the gorge, and
		plummets into a bottomless pit far off to your
		left."
	nouns "fire", "pit"
	adjectives "river", "fiery", "bottomless"
	article "a"
}

scenery Geyser "immense geyser"
{
	nearby
	long_desc
		"The geyser of blistering steam erupts continuously
		from a barren island in the center of a sulfurous
		lake, which bubbles ominously."
	nouns "geyser", "steam", "island", "lake"
	adjectives "blistering", "barren", "sulfurous"
	article "an"
}

room In_Chamber_Of_Boulders "In Chamber of Boulders"
{
	is not light
	long_desc
		"You are in a small chamber filled with large
		boulders.  The walls are very warm, causing the air
		in the room to be almost stifling from the heat.  The
		only exit is a crawl heading west, through which is
		coming a low rumbling."
	w_to At_Junction_With_Warm_Walls
	out_to At_Junction_With_Warm_Walls
	is dwarf_free
}

scenery ChamberBoulders "boulders"
{
	in In_Chamber_Of_Boulders
	long_desc
		"They're just ordinary boulders.  They're warm."
	nouns "boulder", "boulders", "rocks", "stones"
}

treasure rare_spices "rare spices"
{
	nearby
	nouns  "spices" "spice" 
	adjectives "selection" "rare" "exotic",
	depositpoints 14
	article "a selection of"
	initial_desc
		"There is a selection of rare spices here!"
	before
	{
		object DoSmell, DoLook
			{"They smell wonderfully exotic!"}
	}
}

room In_Limestone_Passage "In Limestone Passage"
{
	is not light
	long_desc
		"You are walking along a gently sloping
		north/south passage lined with oddly shaped limestone
		formations."
	n_to At_Fork_In_Path
	u_to At_Fork_In_Path
	s_to In_Front_Of_Barren_Room
	d_to In_Front_Of_Barren_Room
	is dwarf_free
}

scenery LimestoneFormations "limestone formations"
{
	long_desc
		"Every now and then a particularly strange shape
		catches your eye."
	nouns "formations", "shape", "shapes", "stone", "stones"
	adjectives "limestone", "lime", "stone", "strange"
	article "some"
	is plural
}

!----------------------------------------------------------------------------
!   If you go down to the woods today...
!----------------------------------------------------------------------------

room In_Front_Of_Barren_Room "In Front of Barren Room"
{
	long_desc
		"You are standing at the entrance to a large,
		barren room.  A sign posted above the entrance reads:  \
		\"Caution!  Bear in room!\""
	w_to In_Limestone_Passage
	u_to In_Limestone_Passage
	e_to In_Barren_Room
	in_to In_Barren_Room
	is dwarf_free
}

scenery BarrenSign "caution sign"
{
	in In_Front_Of_Barren_Room
	long_desc
		"The sign reads, \"Caution!  Bear in room!\""
	nouns "sign"
	adjectives "caution"
	article "a"
}

room In_Barren_Room "In Barren Room"
{
	is not light
	long_desc
		"You are inside a barren room.  The center of
		the room is completely empty except for some dust.  \
		Marks in the dust lead away toward the far end of the
		room.  The only exit is the way you came in."
	w_to In_Front_Of_Barren_Room
	out_to In_Front_Of_Barren_Room
	is dwarf_free
}

scenery Dust "dust"
{
	in In_Barren_Room
	long_desc
		"It just looks like ordinary dust."
	noun "dust"
	adjective "marks", "in"
	article "the"
}

character Bear "large cave bear"
{
	nearby
	is unfriendly
	ignore_response
		"This is a bear of very little brain."
	short_desc
	{
		if Bear is special
			"You are being followed by a very
			large, tame bear."
		elseif Bear is not scored
			"There is a ferocious cave bear
			 eyeing you from the far end of the room!"
		elseif location = In_Barren_Room
			"There is a gentle cave bear
			 sitting placidly in one corner."
		else
			"There is a contented-looking
			 bear wandering about nearby."
	}
	noun "bear", "animal"
	adjectives "large", "tame", "ferocious", "cave"
	article "a"
	before
	{
		object DoHit
		{
			if axe in player
				Perform(&DoThrowAt, axe, Bear)
			elseif Bear is scored
				"The bear is confused; he only wants
				to be your friend."
			else
				"With what?  Your bare hands?  Against
				*his* bear hands??"
		}
		object DoThrowAt
		{
			if object ~= axe
				Perform(&DoGive, object, Bear)
			elseif Bear is scored
				"The bear is confused; he only wants
				to be your friend."
			else
			{
				move axe to location
				axe is special
				"The axe misses and lands near the bear
				where you can't get at it."
			}
		}
		xobject DoGive
		{
			if object = tasty_food
			{
				axe is not special
				remove tasty_food
				Bear is scored
				"The bear eagerly wolfs down your food,
				after which he seems to calm down
				considerably and even becomes rather
				friendly."
			}
			elseif Bear is scored
				"The bear doesn't seem very interested
				in your offer."
			else
				"Uh-oh -- your offer only makes the bear
				angrier!"
		}
		object DoLook
		{
			"The bear is extremely large, ";
			if Bear is scored {"but appears to be friendly."}
			else {"and seems quite ferocious!"}
		}
		object DoGet, DoCatch
		{
			if Bear is not scored
				"Surely you're joking!"
			elseif golden_chain is locked
				"The bear is still chained to the wall."
			else
				{Bear is special
				Activate(bear_daemon)
				"Ok, the bear's now following you around."}
		}
		object DoDrop, DoRelease
		{
			if Bear is not scored
				"What exactly do you mean by that?"
			else
			{
				Bear is not special
				Deactivate(bear_daemon)
				if Troll in location
				{
					remove troll
					troll is special
					"The bear lumbers toward the troll,
					who lets out a startled shriek and
					scurries away.  The bear soon gives
					up the pursuit and wanders back."
				}
				else
					"The bear wanders away from you."
			}
		}
	}
}

daemon bear_daemon
{}

event bear_daemon
{
	if not light_source
		return false
	elseif location = parent(bear)
	{
		if location = At_Breath_Taking_View
			{"\nThe bear roars with delight"
			event_flag = true}
	}
	else
	{
		move Bear to location
		"\nThe bear lumbers along behind you."
	}
}

treasure golden_chain "golden chain"
{
	in In_Barren_Room
	depositpoints 14
	short_desc
	{
		if self is locked
			"The bear is held back by a solid gold chain."
		else
			"A solid golden chain lies in coils on the ground!"
	}
	long_desc
		"The chain has thick links of solid gold!"
	nouns "chain", "chains", "links", "shackles" 
	adjectives "gold", "golden", "thick", "solid"
	article "a"
	key_object set_of_keys
	before
	{
		object DoGet
		{
			if self is locked
			{
				if Bear is scored
					"It's locked to the friendly bear."
				else
					"It's locked to the ferocious bear!"
			}
			else
				return false
		}
		object DoUnlock
		{
			if Bear is not scored
				"There is no way to get past the bear to
				 unlock the chain, which is probably just as
				 well."
			else
				return false
		}
		object DoLock
			{"The mechanism won't lock again."}
	}
	after
	{
		object DoUnlock
			{"You unlock the chain, and set the tame bear free."}
	}
	is lockable, locked
}

!----------------------------------------------------------------------------
!   The Different Maze
!----------------------------------------------------------------------------

room DiffMaze
{
	is not light
	long_desc
		"You are in a maze of twisty little passages,
		all different."
}

DiffMaze Different_Maze_1 "Maze"
{
	s_to  Different_Maze_3
	sw_to Different_Maze_4
	ne_to Different_Maze_5
	se_to Different_Maze_6
	u_to  Different_Maze_7
	nw_to Different_Maze_8
	e_to  Different_Maze_9
	w_to  Different_Maze_10
	n_to  Different_Maze_11
	d_to  At_West_End_Of_Long_Hall
}

DiffMaze Different_Maze_2 "Maze"
{
	sw_to Different_Maze_3
	n_to Different_Maze_4
	e_to Different_Maze_5
	nw_to Different_Maze_6
	se_to Different_Maze_7
	ne_to Different_Maze_8
	w_to Different_Maze_9
	d_to Different_Maze_10
	u_to Different_Maze_11
	s_to Dead_End_14
}

DiffMaze Different_Maze_3 "Maze"
{
	w_to Different_Maze_1
	se_to Different_Maze_4
	nw_to Different_Maze_5
	sw_to Different_Maze_6
	ne_to Different_Maze_7
	u_to Different_Maze_8
	d_to Different_Maze_9
	n_to Different_Maze_10
	s_to Different_Maze_11
	e_to Different_Maze_2
}

DiffMaze Different_Maze_4 "Maze"
{
	nw_to Different_Maze_1
	u_to Different_Maze_3
	n_to Different_Maze_5
	s_to Different_Maze_6
	w_to Different_Maze_7
	sw_to Different_Maze_8
	ne_to Different_Maze_9
	e_to Different_Maze_10
	d_to Different_Maze_11
	se_to Different_Maze_2
}

DiffMaze Different_Maze_5 "Maze"
{
	u_to Different_Maze_1
	d_to Different_Maze_3
	w_to Different_Maze_4
	ne_to Different_Maze_6
	sw_to Different_Maze_7
	e_to Different_Maze_8
	n_to Different_Maze_9
	nw_to Different_Maze_10
	se_to Different_Maze_11
	s_to Different_Maze_2
}

DiffMaze Different_Maze_6 "Maze"
{
	ne_to Different_Maze_1
	n_to Different_Maze_3
	nw_to Different_Maze_4
	se_to Different_Maze_5
	e_to Different_Maze_7
	d_to Different_Maze_8
	s_to Different_Maze_9
	u_to Different_Maze_10
	w_to Different_Maze_11
	sw_to Different_Maze_2
}

DiffMaze Different_Maze_7 "Maze"
{
	n_to Different_Maze_1
	se_to Different_Maze_3
	d_to Different_Maze_4
	s_to Different_Maze_5
	e_to Different_Maze_6
	w_to Different_Maze_8
	sw_to Different_Maze_9
	ne_to Different_Maze_10
	nw_to Different_Maze_11
	u_to Different_Maze_2
}

DiffMaze Different_Maze_8 "Maze"
{
	e_to Different_Maze_1
	w_to Different_Maze_3
	u_to Different_Maze_4
	sw_to Different_Maze_5
	d_to Different_Maze_6
	s_to Different_Maze_7
	nw_to Different_Maze_9
	se_to Different_Maze_10
	ne_to Different_Maze_11
	n_to Different_Maze_2
}

DiffMaze Different_Maze_9 "Maze"
{
	se_to Different_Maze_1
	ne_to Different_Maze_3
	s_to Different_Maze_4
	d_to Different_Maze_5
	u_to Different_Maze_6
	nw_to Different_Maze_7
	n_to Different_Maze_8
	sw_to Different_Maze_10
	e_to Different_Maze_11
	w_to Different_Maze_2
}

DiffMaze Different_Maze_10 "Maze"
{
	d_to Different_Maze_1
	e_to Different_Maze_3
	ne_to Different_Maze_4
	u_to Different_Maze_5
	w_to Different_Maze_6
	n_to Different_Maze_7
	s_to Different_Maze_8
	se_to Different_Maze_9
	sw_to Different_Maze_11
	nw_to Different_Maze_2
}

DiffMaze Different_Maze_11 "Maze"
{
	sw_to Different_Maze_1
	nw_to Different_Maze_3
	e_to Different_Maze_4
	w_to Different_Maze_5
	n_to Different_Maze_6
	d_to Different_Maze_7
	se_to Different_Maze_8
	u_to Different_Maze_9
	s_to Different_Maze_10
	ne_to Different_Maze_2
}

DeadEndRoom Dead_End_14 "Dead End, near Vending Machine"
{
	long_desc
		"You have reached a dead end. There is a massive
		vending machine here."
	n_to Different_Maze_2
	out_to Different_Maze_2
	is dwarf_free
}

scenery PirateMessage "message in the dust"
{
	in Dead_End_14
	long_desc
		"The message reads, \"This is not the maze where the
		pirate leaves his treasure chest.\""
	noun "dust"
	adjectives "message", "scrawl", "writing", "script", "scrawled", \
		"flowery", "in"
	initial_desc
		"Hmmm...  There is a message here
		scrawled in the dust in a flowery script."
}

scenery VendingMachine "vending machine"
{
	nearby
	long_desc
		"The instructions on the vending machine read,
		\"Insert coins to receive fresh batteries.\""
	noun "machine"
	adjectives "vending"
	article "a"
	before
	{
		xobject DoPutIn
		{
			if object = rare_coins
			{
				move fresh_batteries to location
				remove rare_coins
				"Soon after you insert the coins in the coin
				 slot, the vending machines makes a grinding
				 sound, and a set of fresh batteries falls
				 at your feet."
			}
			else
				"The machine seems to be designed to take
				coins."
		}
		object DoHit
			{"The machine is quite sturdy and survives your
			attack without getting so much as a scratch."}
		object DoGet
			{"The vending machine is far too heavy to move."}
	}
	is container
}

object fresh_batteries "fresh batteries"
{
	long_desc
		"They look like ordinary batteries.  (A sepulchral
		voice says, \"Still going!\")"
	nouns "batteries", "battery"
	adjective "fresh"
	article "some"
	is plural
}

object old_batteries "worn-out batteries"
{
	long_desc
		"They look like ordinary batteries."
	initial_desc
		"Some worn-out batteries have been discarded nearby."
	nouns "batteries", "battery"
	adjectives "worn", "out", "worn-out"
	article "some"
	is plural
}

!----------------------------------------------------------------------------
!   Dwarves!
!----------------------------------------------------------------------------

character dwarf "threatening little dwarf"
{
	is unfriendly
	noun "dwarf"
	adjectives "threatening", "little"
	article "a"
	long_desc
		"It's probably not a good idea to get too close.  Suffice
		it to say the little guy's pretty aggressive."
	initial_desc 
		"A threatening little dwarf hides in the shadows."
	misc 5
	before
	{
		object DoKick
			{"You boot the dwarf across the room.  He curses,
			then gets up and brushes himself off.  Now he's
			madder than ever!"}
		xobject DoThrowAt
		{
			if object = axe
			{   
				if random(3) ~= 1
				{
					remove self
					move axe to location
					self.misc = self.misc - 1
					"You killed a little dwarf!  The
					body vanishes in a cloud of greasy
					black smoke."
				}
				else
					{move axe to location
					"Missed!  The little dwarf dodges
					out of the way of the axe."}
			}
			else
				Perform(&DoGive, object, xobject)
		}
		xobject DoGive
		{
			if object = tasty_food
				"You fool, dwarves eat only coal!  \
				Now you've made him *really* mad!"
			else
				"The dwarf is not at all interested in your
				 offer.  (The reason being, perhaps, that if
				 he kills you he gets everything you have
				 anyway.)"
		}
		object DoHit
			{"Not with your bare hands.  No way."}
	}
}

daemon dwarf_daemon
{}

event dwarf_daemon
{
	if not light_source {return}

	if dwarf.misc = 0
		Deactivate(dwarf_daemon)
	
	if parent(dwarf) = nothing
	{
		if location is dwarf_free or location is light 
			return
		if random(100) <= self.misc
		{
			if Bear in location or Troll in location
				return
			print newline
			event_flag = true
			if Dragon in location
			{
				self.misc = self.misc - 1
				"A dwarf appears, but with one casual blast
				the dragon vapourises him!"
				 return
			}
			else
			{
				move dwarf to location
				"A threatening little dwarf comes out of
				the shadows!"
				return
			}
		}
		else 
			return
	}
	elseif parent(dwarf)~=location
	{   
		if not light_source
			return
		if location is dwarf_free or location is light
			return
		if random(100)<=96 and parent(dwarf)~=In_Mirror_Canyon
		{
			move dwarf to location
			"\nThe dwarf stalks after you..."
		}
		else
			{remove dwarf
			return}
	}
	
	if (random(100)<=75)
	{   
		print newline
		if dwarf is not special
		{
			move axe to location
			dwarf is special
			remove dwarf
			"The dwarf throws a nasty little axe at you, misses,
			curses, and runs away."
		}
		elseif location = In_Mirror_Canyon
			"The dwarf admires himself in the mirror."
		else
		{
			"The dwarf throws a nasty little knife at you, ";
			if random(1000)<=95 
				{"and hits!"
				endflag = 2}
			else
				"but misses!"
		}
		event_flag = true
		return
	}
	
	if random(3) = 1
		{remove dwarf
		"\nTiring of this, the dwarf slips away."
		event_flag = true}
}

object axe "dwarvish axe"
{
	noun "axe"
	adjectives "little", "dwarvish"
	article "a"
	initial_desc
		"There is a little axe here."
	long_desc
		"It's just a little axe."
	before
	{
		object DoLook
			{if axe is not special
				return false
			"It's lying beside the bear."}
		object DoGet
			{if axe is not special
				return false
			"No chance.  It's lying beside the ferocious
			bear, quite within harm's way."}
	}
}

!----------------------------------------------------------------------------
!   Piracy, twice over
!----------------------------------------------------------------------------

daemon pirate_daemon
{}

event pirate_daemon
{
	local c, i, j
	if pirate_daemon is special and pirate_daemon is scored
		{Deactivate(pirate_daemon)
		return}

	if not light_source or location is light or location is dwarf_free \
		or random(100)>2 or location = In_Secret_Canyon
		
		return
	
	if dwarf in location
		{"\nA bearded pirate appears, catches sight of the dwarf
		and runs away."
		event_flag = true
		return}

	for (i=child(player); i~=0; i=sibling(i))
	{
		if i is valuable
			c = c + 1
	}
	for (i=child(location); i~=0; i=sibling(i))
	{
		if i is valuable
			c = c + 1
	}

	if c = 0
	{
		if pirate_daemon is special
			return
		pirate_daemon is special
		"\nThere are faint rustling noises from the darkness
		behind you.  As you turn toward them, you spot
		a bearded pirate. He is carrying a large chest.\n\n\
		\"Shiver me timbers!\" he cries, \"I've been spotted!  I'd
		best hie meself off to the maze to hide me chest!\"\n\n\
		With that, he vanishes into the gloom."
		event_flag = true
	}
	else
	{
		if pirate_daemon is scored
			return
		pirate_daemon is scored

		while c > 0
		{
			for (i=child(player); i~=0; i=sibling(i))
			{
				if i is valuable
					{j=i
					score = score - 5}
			}
			for (i=child(location); i~=0; i=sibling(i))
			{
				if i is valuable
					j=i
			}
			move j to Dead_End_13
			c = c - 1
		}
		"\nOut from the shadows behind you
		 pounces a bearded pirate!  \"Har,
		 har,\" he chortles.  \"I'll just take
		 all this booty and hide it away with
		 me chest deep in the maze!\"  He
		 snatches your treasure and vanishes
		 into the gloom."
		 event_flag = true
	}
}

!----------------------------------------------------------------------------
!   The cave is closing now...
!----------------------------------------------------------------------------

daemon cave_closer
{}

event cave_closer
{
	if treasures_found < MAX_TREASURES 
		return
	Deactivate(self)
	caves_closed = 1

	score=score + 25

	Deactivate(CrystalBridge_daemon)
	CrystalBridge.found_in = 0, 0
	Grate is locked
	Grate is not open
	remove set_of_keys

	Deactivate(dwarf_daemon)
	Deactivate(pirate_daemon)
	remove Troll
	remove Bear
	remove Dragon

	Activate(endgame_timer, 25)

	"\nA sepulchral voice reverberating through the cave says,
	 \"Cave closing soon.  All adventurers exit immediately
	 through main office.\""
	 
	 event_flag = true
}

fuse endgame_timer
{}

event endgame_timer
{
	if self.tick = 0
	{
		score = score + 10
		
		while child(player) ~= 0
			remove child(player)
		
		move bottle to At_Ne_End
		if child(bottle) ~= 0:  remove child(bottle)
	  
		move giant_bivalve to At_Ne_End
		move brass_lantern to At_Ne_End
		move black_rod to At_Ne_End
		move little_bird to At_Sw_End
		move velvet_pillow to At_Sw_End
		
		"\nThe sepulchral voice intones, \"The cave is now
		closed.\" As the echoes fade, there is a blinding flash of
		light (and a small puff of orange smoke). . .\n\n\
		As your eyes refocus, you look around...\n"
		MovePlayer(At_Ne_End)
		event_flag = true
	}
}

!----------------------------------------------------------------------------
!   The End Game
!----------------------------------------------------------------------------

room At_Ne_End "NE End of Repository"
{
	long_desc
		"You are at the northeast end of an immense
		room, even larger than the giant room.  It appears to
		be a repository for the \"Adventure\" program.  \
		Massive torches far overhead bathe the room with
		smoky yellow light.  Scattered about you can be seen
		a pile of bottles (all of them empty), a nursery of
		young beanstalks murmuring quietly, a bed of oysters,
		a bundle of black rods with rusty stars on their
		ends, and a collection of brass lanterns.  Off to one
		side a great many dwarves are sleeping on the floor,
		snoring loudly.  A sign nearby reads: \"Do not
		disturb the dwarves!\""
	sw_to At_Sw_End
}

object Mirror_2 "enormous mirror"
{
	in At_Ne_End
	long_desc
		"It looks like an ordinary, albeit enormous, mirror."
	noun "mirror"
	adjectives "immense", "ordinary", "hanging"
	article "an"
	initial_desc
		"An immense mirror is hanging against one wall,
		and stretches to the other end of the room, where
		various other sundry objects can be glimpsed dimly in
		the distance."
	found_in At_Ne_End, At_Sw_End
	before
	{
		object DoHit
		{
			"You strike the mirror a resounding blow, whereupon
			it shatters into a myriad tiny fragments.\n\n"
			DwarvesWake()
		}
	}
	is static
}

scenery RepositoryStuff_1 "collection of adventure game materials"
{
	in At_Ne_End
	found_in At_Ne_End
	long_desc
		"You've seen everything in here already, albeit
		in somewhat different contexts."
	nouns "materials", "loot", "objects", "bottles", "beanstalks", \
		"oysters", "rods", "lanterns"
	adjectives "collection", "adventure", "game", "repository", "pile", \
		"nursery", "young", "bed", "bundle", "black", "brass"
	article "a"
	before
	{
		object DoGet
		{
			 "Realizing that by removing the loot here you'd be
			ruining the game for future players, you leave the
			\"Adventure\" materials where they are."
		}
	}
}

character RepositoryDwarves "sleeping dwarves"
{
	type scenery
	is unfriendly
	long_desc
		"I wouldn't bother the dwarves if I were you."
	noun "dwarf", "dwarves"
	adjectives "sleeping", "dozing", "snoozing", "sleeping"
	article "hundreds of angry"
	is plural
	before
	{
		object DoGet
			{"What, all of them?"}
		object DoWakeCharacter
		{
			"You prod the nearest dwarf, who wakes up grumpily,
			takes one look at you, curses, and grabs for his
			axe.\n\n"
			DwarvesWake()
		}
		object DoHit
			{DwarvesWake()}
		object DoAsk, DoTell, DoTalk
			{"You're probably best off not waking the dwarves."}
		xobject DoShow, DoGive
			{"You're probably best off not waking the dwarves."}
	}
}

room At_Sw_End "SW End of Repository"
{
	long_desc
		"You are at the southwest end of the repository.  \
		To one side is a pit full of fierce green snakes.  On
		the other side is a row of small wicker cages, each
		of which contains a little sulking bird.  In one
		corner is a bundle of black rods with rusty marks on
		their ends.  A large number of velvet pillows are
		scattered about on the floor. A vast mirror stretches
		off to the northeast. At your feet is a large steel
		grate, next to which is a sign which reads,
		\"TREASURE VAULT. Keys in main office.\""
	d_to
		return RepositoryGrate.door_to
	ne_to At_Ne_End
}

scenery RepositoryStuff_2 "collection of adventure game materials"
{
	in At_Ne_End
	found_in At_Sw_End
	long_desc
		"You've seen everything in here already, albeit
		in somewhat different contexts."
	nouns "materials", "loot", "objects", "snakes", "cages", "bird", \
		"rods", "pillows"
	adjectives "collection", "adventure", "game", "repository", \
		"wicker", "little", "sulking", "black", "velvet"
	article "a"
	before
	{
		object DoGet
		{
			 "Realizing that by removing the loot here you'd be
			ruining the game for future players, you leave the
			\"Adventure\" materials where they are."
		}
	}
}

object RepositoryGrate "steel grate"
{
	in At_Sw_End
	adjectives "steel", "ordinary"
	nouns "grate", "grating"
	article "a"
	long_desc
		"It just looks like an ordinary steel grate."
	when_open 
		"The grate is open."
	when_closed 
		"The grate is closed."
	door_to
	{
		if self is not open
			run self.when_closed
		else
			return Outside_Grate
	}
	key_object 0
	is static, locked, openable
}

object black_mark_rod "black rod with a rusty mark on the end"
{
	in At_Sw_End
	long_desc
		"It's a three foot black rod with a rusty mark on an end."
	initial_desc
		"A three foot black rod
		with a rusty mark on one end lies nearby."
	noun "mark"
	adjectives "black", "rod", "rusty", "iron"
	article "a"
	before 
	{
		object DoWave
			{"Nothing happens."}
	}
}

routine DwarvesWake
{
	"The resulting ruckus has awakened the dwarves.  There
	 are now dozens of threatening little dwarves in the room with
	 you!  Most of them throw knives at you!  All of them get
	 you!"
	endflag = 2
}

!----------------------------------------------------------------------------
!   Some replacement routines
!----------------------------------------------------------------------------

replace PrintScore(end_of_game)
{
	print "You ";
	if not end_of_game
		print "have ";
	print "scored a total of ";
	print number score; " out of "; number MAX_SCORE;
	print ", giving you the rank of ";
	if score >= 348                        
		"Grandmaster Adventurer!"
	elseif score >= 330
		"Master, first class."
	elseif score >= 300
		"Master, second class."
	elseif score >= 200
		"Junior Master."
	elseif score >= 130
		"Seasoned Adventurer."
	elseif score >= 100
		"Experienced Adventurer."
	elseif score >= 35
		"Adventurer."
	elseif score >=10
		"Novice."
	else
		"Amateur."
}

global dark_warning

replace DarkWarning
{
	if (dark_warning = 0)
	{
		dark_warning = 1
		"It is now pitch dark.  \
		If you proceed you will likely fall into a pit."
	}
	elseif random(4) = 1
	{
		"You fell into a pit and broke every bone in your body!"
		endflag = 2
	}
}

!----------------------------------------------------------------------------
!   Menu-driven help
!----------------------------------------------------------------------------

routine HelpInfo(menu_item)
{
	cls
	select menu_item
	case 1
	{
		"I know of places, actions, and things.  You can guide
		me using commands that are complete sentences. To move, try
		commands like \"enter,\" \"east,\" \"west,\" \"north,\"
		\"south,\" \"up,\" \"down,\" \"enter building,\"
		\"get lamp,\" etc.\n"
		
		"I know about a few special objects, like a black rod
		hidden in the cave.  These objects can be manipulated using
		some of the action words that I know.  Usually you will need
		to give a verb followed by an object (along with descriptive
		adjectives when desired), but sometimes I can infer the
		object from the verb alone.  Some objects also imply verbs;
		in particular, \"inventory\" implies \"take inventory\",
		which causes me to give you a list of what you're carrying.  \
		The objects have side effects; for instance, the rod scares
		the bird.\n"

		"Many commands have abbreviations.  For example, you can
		type \"i\" in place of \"inventory,\" \"x object\" instead
		of \"examine object,\" \"w\" instead of \"west\" or
		\"go west,\" etc.\n"

		"Usually people having trouble moving just need to try a
		few more words.  Usually people trying unsuccessfully to
		manipulate an object are attempting something beyond their
		(or my!) capabilities and should try a completely different
		tack.\n"

		"Note that cave passages turn a lot, and that leaving a room
		to the north does not guarantee
		entering the next from the south.\n"

		"If you want to end your adventure early, type \"quit\".  \
		To suspend your adventure such that you can continue later,
		type \"save,\" and to resume a saved game, type \"restore.\"  \
		To see how well you're doing, type \"score\".  To get full
		credit for a treasure, you must have left it safely in the
		building, though you get partial credit just for locating
		it. You lose points for getting killed, or for quitting,
		though the former costs you more. There are also points
		based on how much (if any) of the cave you've managed to
		explore; in particular, there is a large bonus just for
		getting in (to distinguish the beginners from the rest of
		the pack), and there are other ways to determine whether
		you've been through some of the more harrowing sections.\n"

		"If you think you've found all the treasures, just keep
		exploring for a while.  If nothing interesting happens, you
		haven't found them all yet. If something interesting *does*
		happen, it means you're getting a bonus and have an
		opportunity to garner many more points in the master's
		section.\n"

		"Good luck!"
	}
	case 2
	{
		"This was the first adventure game ever written, based on
		a FORTRAN simulation of the Mammoth and Flint Ridge cave
		system by Willie Crowther.  Crowther was one of its
		explorers: some of the game's locations are real, Bedquilt
		for instance.  (And \"Y2\" is a reference to the cave-map
		notation for \"alternative entrance to caves\".)\n"

		"Adventure (sometimes called \"Colossal Cave\", another
		real place) was an extension largely by Don Woods, a
		colleague of Crowther's at a Massachusetts computing firm.  \
		Inspired by (a variant of) the role-playing game \"Dungeons
		and Dragons\", they added puzzles and magic to the caves.\n"

		"The game was spread from machine to machine, and (among
		others) DECUS, the Digital user group, issued tapes of it.  \
		Ever since, the game has been modified, ported, improved,
		extended and generally corrupted.  The original is hard to
		find.  Most of the extras tacked on are clearly inferior,
		and lose the spirit of the (certainly imperfect, but
		atmospheric and well-designed) original.\n"

		"[NOTE:  The following refers specifically to the Inform
		version by Graham Nelson, upon which this adaptation is
		based.]\n"
		
		"This is a copy at third hand.  It is a slight
		simplification of David M. Baggett's excellent 1993 version
		for Adventions, written in TADS: which in turn derived
		from Donald Ekman's PC port of the original FORTRAN source
		code.\n"

		"And, even by modern standards, it is still a good game!"
	}
	case 3
	{
		"[NOTE:  The following refers to the Inform version by
		Graham Nelson, upon which this adaptation is based.]\n"

		"This port is fairly close to the original.  The puzzles,
		items and places of the 1977 version are exactly those
		here.\n"

		"I have added a few helpful messages, such as \"This is a
		dead end.\", here and there: and restored some \"initial
		position\" messages from objects, such as the (rather
		lame)\n\n\_  There is tasty food here.\n\n\from source
		files which are certainly early but of doubtful provenance.  \
		They seem to sit well with the rest of the text.\n"

		"The scoring system is the original, except that you no
		longer lose 4 points for quitting (since you don't get
		the score if you quit an Inform game, this makes no
		difference) and, controversially, I award 5 points for
		currently carrying a treasure, as some early 1980s
		ports did.  The rank names are tidied up a little.  The only
		significant rule change is that one cannot use
		magic words until their destinations have been visited.\n"
		
		"The dwarves are simpler in their movements, but on the
		other hand I have added a very few messages to make them
		interact better with the rest of the game.  The
		probabilities are as in the original game.\n"

		"In the original one could type the name of a room to visit
		it: for the sake of keeping the code small, I have
		omitted this feature, but with some regrets.\n"

		"The text itself is almost everywhere preserved intact,
		but I've corrected some spelling and grammatical mistakes
		(and altered a couple of utterly misleading and gnomic
		remarks).  The instructions have been slightly altered
		(for obvious reasons) but are basically as written.\n"

		"A good source for details is David Baggett's source code,
		which is circulated on the Internet."
	}
	case 4
	{
		"[NOTE:  The bulk of the help text is taken from Graham
		Nelson's Inform port of Adventure, with the exception of
		the following.]\n"

		"Graham Nelson refers to his port of Adventure (upon which
		this Hugo adaptation is based) as a copy at third hand;
		I guess that makes the Hugo version a copy at fourth.\n"

		"The behaviors of objects in this game are almost identical
		to those in the Inform version.  Any differences are due
		mainly to technical differences between the two languages.  \
		An effort has been made in this game to adhere as closely
		as possible to Inform's complement of verbs and actions in
		order to make the porting to Hugo as direct and as
		faithful as possible.\n"

		"Why does the world need another port of Adventure?  Mainly
		for comparison reasons.  Hugo was designed to make certain
		aspects of interactive fiction design easier and more
		accessible.  Of course, in that realm, there already exist
		two well-designed systems:  Inform by Graham Nelson,
		and TADS by Michael Roberts.  Since Adventure has been
		ported to both of these, it is an ideal means for
		comparison of the advantages and disadvantages of either.  \
		Now the same ruler can be applied to Hugo.\n"

		"Finally, I would like to avoid the blame for any errors
		in the program, since it is based on such a long line of
		predecessors.  Unfortunately for me, however, that's
		probably not possible.  Porting Adventure to Hugo involved
		editing and rewriting some 5000+ lines of code, and it would
		be awfully presumptuous of me to think that my work was
		anywhere near flawless.  That said, assume that any given
		error is the result of a problem in the Hugo source code.  \
		If the interest is there, dig into the code to see what
		might be causing the bug; if no explanation readily presents
		itself, the next step might be to back up one generation to
		the Inform source, then to the TADS source, and finally to
		the (somewhat) original FORTRAN code.\n"

		"Or on the other hand, just enjoy the game."

		"\n\_  --Kent Tessman\
		 \n\_    May 10, 1995"
	}
	case 5
	{
		"Did you know that...\n"

		"The five dwarves have a 96% chance of following you,
		except into light, down pits or when admiring themselves:  \
		and the nasty little knives are 9.5% accurate.\n"

		"Dragons burn up dwarves (perhaps because dwarves eat only
		coal).\n"

		"The bear (who likes the volcano) is too heavy for the
		bridge... and you can go back to the scene after being
		resurrected.\n"

		"You can slip past the snake into the secret E/W canyon,
		35% of the time at any rate.  And walking about in the dark
		is not all that gruesome: it carries only a 25% risk of
		falling down a pit.\n"

		"The vase does not like being immersed.\n"
		
		"Shadowy figures can wave to each other.\n"

		"Watering the hinges of the door rusts them up again.\n"

		"When the cave closes, the grate is locked and the keys are
		thrown away, creatures run off and the crystal bridge
		vanishes...\n"

		"...and a completely useless hint is written on the giant
		oyster's shell in the end game.\n"

		"The last lousy point can be won by... but no.  That would
		be telling."
	}
}

!----------------------------------------------------------------------------
!   New verbs (to add or replace the library stock)
!----------------------------------------------------------------------------

replace DoHelp
{
	local m
	
	menuitem[0] = "COLOSSAL HELP FOR COLOSSAL HUGO"
	menuitem[1] = "Instructions for playing"
	menuitem[2] = "The history of this game"
	menuitem[3] = "How authentic is this edition?"
	menuitem[4] = "About this Hugo adaptation"
	menuitem[5] = "Did you know..."
	
	do
	{
		m = Menu(5)
		if m >= 1 and m <= 5
			{HelpInfo(m)
			pause}
	} while m 
	window 0
	cls
	PrintStatusline
	DescribePlace(location, true)
}

routine DoCatch
{
	print "You can't catch "; The(object); "."
	return true
}

routine DoRelease
{
	print "You can't release "; The(object); "."
	return true
}

routine DoWater
{
	if bottle in player
		return Perform(&DoEmpty, bottle)
	"Water?  What water?"
	return true
}

routine DoOil
{
	if bottle in player 
		return Perform(&DoEmpty, bottle)
	"Oil?  What oil?"
	return true
}

routine DoOn
{
	if brass_lantern in player
		return Perform(&DoSwitchOn, brass_lantern)
	"You have no lamp."
	return true
}

routine DoOff
{
	if brass_lantern in player
		return Perform(&DoSwitchOff, brass_lantern)
	"You have no lamp."
	return true
}

routine Xyzzy
	{"Nothing happens."
	return true}
	
routine Plugh
	{"Nothing happens."
	return true}

routine Plover
	{"Nothing happens."
	return true}

routine DoFee
	{Fthing(0)
	return true}
	
routine DoFie
	{Fthing(1)
	return true}
	
routine DoFoe
	{Fthing(2)
	return true}
	
routine DoFoo
	{Fthing(3)
	return true}

global fcount

routine Fthing(i)
{
	if fcount ~= i
		{fcount = 0
		"Get it right, dummy!"
		return}

	fcount = fcount + 1
	if fcount = 4
	{
		fcount = 0
		if golden_eggs in In_Giant_Room 
			"Nothing happens."
		if (golden_eggs in player) or (golden_eggs in location)
			"The nest of golden eggs has vanished!"
		else 
			"Done!"

		if golden_eggs in player
			score = score - 5
		if golden_eggs in Inside_Building
			score = score - golden_eggs.depositpoints
		move golden_eggs to In_Giant_Room
		if location = In_Giant_Room
			"\n\nA large nest full of golden eggs suddenly
			appears out of nowhere!"
	}
	else
		"Ok."
}

routine DoBlastWith
{
	if xobject ~= black_mark_rod
		"Blasting requires dynamite."
	else
		"Been eating those funny brownies again?"
}

routine DoOldMagic
	{"Good try, but that is an old worn-out magic word."}

routine DoKick
{
	Perform(&DoHit, object) ! for dwarf-kicking
}

routine DoBlast
{
	if location ~= At_Sw_End and location ~= At_Ne_End
		"Frustrating, isn't it?"
	elseif location = At_Sw_End and black_mark_rod in At_Ne_End
	{
		score=score+35
		"There is a loud explosion, and a twenty-foot
		hole appears in the far wall, burying the dwarves in
		the rubble.  You march through the hole and find
		yourself in the main office, where a cheering band of
		friendly elves carry the conquering adventurer off
		into the sunset."
		endflag = 1
	}
	elseif location = At_Ne_End and black_mark_rod in At_Sw_End
	{
		score=score+20
		"There is a loud explosion, and a twenty-foot
		 hold appears in the far wall, burying the snakes in
		 the rubble.  A river of molten lava pours in through
		 the hole, destroying everything in its path,
		 including you!"
		endflag = 2
	}
	else
	{
		"There is a loud explosion, and you are suddenly
		 splashed across the walls of the room."
		endflag = 2
	}
}

routine DoFill
	{"There's nothing to fill "; 
	The(object)
	" with."}

routine DoRub
	{"Once again, you accomplish nothing."}

!----------------------------------------------------------------------------
!   Resurrection
!----------------------------------------------------------------------------

routine AfterLife 
{
	if caves_closed = 1
		{"\nIt looks as though you're dead.  Well, seeing as how
		 it's so close to closing time anyway, I think we'll
		 just call it a day."
		 return false}

	if deaths = 0
		"\nOh dear, you seem to have gotten yourself killed.  I
		might be able to help you out, but I've never really
		done this before.  Do you want me to try to
		reincarnate you?";
	if deaths = 1
		"\nYou clumsy oaf, you've done it again!  I don't know
		how long I can keep this up.  Do you want me to try
		reincarnating you again?";
	if deaths = 2
		"\nNow you've really done it!  I'm out of orange smoke!  \
		You don't expect me to do a decent reincarnation
		without any orange smoke, do you?";

	GetInput

	if YesorNo = 0
	{
		if deaths = 0
			"Very well."
		elseif deaths = 1
			"Probably a wise choice."
		else
			"I thought not!"
		return false
	}

	if deaths = 0
	{
		"All right.  But don't blame me if something
		goes wr......\n\n\n\n\
		--- POOF!! ---\n\n\
		You are engulfed in a cloud of orange smoke.  \
		Coughing and gasping, you emerge from the smoke and
		find that you're...."
	}
	if deaths = 1
	{
		"Okay, now where did I put my orange smoke?....  >POOF!<
		\n\nEverything disappears in a dense cloud of orange smoke."
	}
	if deaths = 2
	{
		"Okay, if you're so smart, do it yourself!  I'm leaving!"
		return false
	}

	deaths = deaths + 1
	score = score - 10
	while child(player)
	{
		if child(player) is valuable
			score = score - 5
		move child(player) to location
	}

	move brass_lantern to At_End_Of_Road
	brass_lantern is not switchedon
	brass_lantern is not light
	remove dwarf

	MovePlayer(Inside_Building)
}

!----------------------------------------------------------------------------
!   How to cheat in the test version: no dwarves or pirates, and magic words 
!   working from the beginning (as well as no troll and an extra-special
!   set of lantern batteries, if desired)
!
!   (A little more cheaty than Mr. Nelson's version.  Hope that isn't
!   saying something about my latent shifty side.  --K.T.)
!----------------------------------------------------------------------------

#ifset TEST_VERSION
routine Xdeterm
{
	Deactivate(dwarf_daemon)
	Deactivate(pirate_daemon)
	In_Debris_Room is visited
	At_Y2 is visited
	In_Plover_Room is visited
}

routine Xcheat
{
	troll is special
	brass_lantern.misc = 2000
}
#endif
