the-infocom-files/zork1

Jumping while up a tree is coded oddly

Opened this issue · 0 comments

When you jump down from Up a Tree, this happens:

>JUMP
In a feat of unaccustomed daring, you manage to land on your feet without
killing yourself.

Forest Path
This is a path winding through a dimly lit forest. The path heads north-south
here. One particularly large tree with some low branches stands at the edge of
the path.

Which is all well and good, but it's coded oddly. It's handled by V-LEAP:

		      %<COND (<==? ,ZORK-NUMBER 1>
			      '(<EQUAL? ,HERE ,UP-A-TREE>
		                <TELL
"In a feat of unaccustomed daring, you manage to land on your feet without
killing yourself." CR CR>
		                <DO-WALK ,P?DOWN>
		                <RTRUE>))
			     (T '(<NULL-F> T))>

In addition, TREE-ROOM also handles it:

		      (<VERB? DROP>
		       <COND (<NOT <IDROP>> <RTRUE>)
			     (<AND <EQUAL? ,PRSO ,NEST> <IN? ,EGG ,NEST>>
			      <TELL
"The nest falls to the ground, and the egg spills out of it, seriously
damaged." CR>
			      <REMOVE-CAREFULLY ,EGG>
			      <MOVE ,BROKEN-EGG ,PATH>)
			     (<EQUAL? ,PRSO ,EGG>
			      <TELL
"The egg falls to the ground and springs open, seriously damaged.">
			      <MOVE ,EGG ,PATH>
			      <BAD-EGG>
			      <CRLF>)
			     (<NOT <EQUAL? ,PRSO ,WINNER ,TREE>>
			      <MOVE ,PRSO ,PATH>
			      <TELL
"The " D ,PRSO " falls to the ground." CR>)
			     (<VERB? LEAP>
			      <JIGS-UP
			        "That was just a bit too far down.">)>)>)

But it only handles the "LEAP" verb if it's already established that it's handling the "DROP" verb, i.e. never.

I assume that surviving the fall is the correct behavior (even though the room would have handled the "LEAP" verb first, if it had been correctly written). So my suggestion would be to change TREE-ROOM like so:

		      (<VERB? DROP>
		       <COND (<NOT <IDROP>> <RTRUE>)
			     (<AND <EQUAL? ,PRSO ,NEST> <IN? ,EGG ,NEST>>
			      <TELL
"The nest falls to the ground, and the egg spills out of it, seriously
damaged." CR>
			      <REMOVE-CAREFULLY ,EGG>
			      <MOVE ,BROKEN-EGG ,PATH>)
			     (<EQUAL? ,PRSO ,EGG>
			      <TELL
"The egg falls to the ground and springs open, seriously damaged.">
			      <MOVE ,EGG ,PATH>
			      <BAD-EGG>
			      <CRLF>)
			     (<NOT <EQUAL? ,PRSO ,WINNER ,TREE>>
			      <MOVE ,PRSO ,PATH>
			      <TELL
"The " D ,PRSO " falls to the ground." CR>)>)
		      (<VERB? LEAP>
		       <TELL
"In a feat of unaccustomed daring, you manage to land on your feet without
killing yourself." CR CR>
		       <DO-WALK ,P?DOWN>
		       <RTRUE>)>)

And remove that special case from V-LEAP, because the zork-substrate project should contain as little game-specific logic as possible:

<ROUTINE V-LEAP ("AUX" TX S)
	 <COND (,PRSO
		<COND (<IN? ,PRSO ,HERE>
		       <COND (<FSET? ,PRSO ,ACTORBIT>
			      <TELL
"The " D ,PRSO " is too big to jump over." CR>)
			     (T
			      <V-SKIP>)>)
		      (T
		       <TELL "That would be a good trick." CR>)>)
	       (<SET TX <GETPT ,HERE ,P?DOWN>>
		<SET S <PTSIZE .TX>>
		<COND (<OR <EQUAL? .S 2> ;NEXIT
       			   <AND <EQUAL? .S 4> ;CEXIT
				<NOT <VALUE <GETB .TX 1>>>>>
		       <TELL
"This was not a very safe place to try jumping." CR>
		       <JIGS-UP <PICK-ONE ,JUMPLOSS>>)
		      (T
		       <V-SKIP>)>)
	       (T
		<V-SKIP>)>>

If we absolutely want to preserve both the messages, I would suggest either make it random or have it depend on LUCKY, i.e. on whether or not you've broken the mirror.