Test coverage - Almost all of score.c
[open-adventure.git] / adventure.yaml
index 48353c272b8eb91da06fb9c55898913fd50a9d3c..81cc864d26e9f1a9af6bc2e3e806a50d609640e0 100644 (file)
@@ -1,5 +1,55 @@
+# This YAML file gets processed into a collection of data structure and
+# variable initializers describing Colossal Cave.  It replaces an ad-hoc
+# text database shipped with Adventure versions up to 2.5.  The format
+# change enabled a lot of use of symbolic names where there were previously
+# inscrutable numeric literals.
+#
+# We define a bunch of YAML structures:
+#
+# locations: Each item contains a long and short description.  Some
+#    short descriptions are empty.  Order of these locations is significant;
+#    see the macros OUTSID and INDEEP.
+#
+# arbitrary_messages: These are arguments to RSPEAK(). Some spans of
+#    these messages need to be kept adjacent and ordered.  To see which,
+#    grep for RSPEAK calls containing expressions with arithmetic.
+#
+# classes: Each item contains a point threshold and a message
+#    describing a classification of player.  point thresholds must be
+#    in ascending order. The scoring code selects the appropriate
+#    message, where each message is considered to apply to players
+#    whose scores are higher than the previous N but not higher than
+#    this N.  Note that these scores probably change with every
+#    modification (and particularly expansion) of the program.
+#
+# turn_thresholds:  Each item contains a number and a message
+#    berating the player for taking so many turns.  The messages must
+#    be in the proper (ascending) order.  The message gets printed if
+#    the player exceeds N % 100000 turns, at which time N/100000
+#    points get deducted from his score.
+#
+# objects: Each item contains a description for use in the inventory command
+#    and one or more messages describing the object in different states.
+#    If the inventory desription begins with "*" the object is dungeon
+#    furniture that cannot be taken or carried.
+#
+# obituaries: Death messages and reincarnation queries.  Order is
+#    significant, they're used in succession as the player racks up
+#    deaths.
+#
+# hints: Each item contains a hint number (add 10 to get cond bit),
+#    the number of turns he must be at the right loc(s) before
+#    triggering the hint, the points deducted for taking the hint, the
+#    message number (section 6) of the question, and the message
+#    number of the hint.  These values are stashed in the "hints"
+#    array.
+#
+# These correspond to sections 1, 2, 5, 6, 10, 11, and 14 in the old
+# adventure.text format.  Sections 3, 4, 7, 8, and 9 haven't moved yet.
+# Section 12 was obsolete.
+
 locations: !!omap
-- LOC_0:
+- LOC_NOWHERE:
     description:
       long: !!null
       short: !!null
@@ -449,7 +499,7 @@ locations: !!omap
       short: 'You''re at top of stalactite.'
 - LOC_DIFFERENT2:
     description:
-      long: '1You are in a little maze of twisting passages, all different.'
+      long: 'You are in a little maze of twisting passages, all different.'
       short: !!null
 - LOC_RESERVOIR:
     description:
@@ -575,7 +625,7 @@ locations: !!omap
     description:
       long: 'You are in a large chamber with passages to the west and north.'
       short: !!null
-- LOC_SOTOREROOM:
+- LOC_STOREROOM:
     description:
       long: 'You are in the ogre''s storeroom.  The only exit is to the south.'
       short: !!null
@@ -804,7 +854,7 @@ arbitrary_messages:  !!omap
 - FUTILE_CRAWL: 'You have crawled around in some little holes and wound up back in the\nmain passage.'
 - FOLLOW_STREAM: 'I don''t know where the cave is, but hereabouts no stream can run on\nthe surface for long.  I would try the stream.'
 - NEED_DETAIL: 'I need more detailed instructions to do that.'
-- NEreplace: 'I can only tell you what you see as you move about and manipulate\nthings.  I cannot tell you where remote things are.'
+- NEARBY: 'I can only tell you what you see as you move about and manipulate\nthings.  I cannot tell you where remote things are.'
 - OGRE_SNARL: 'The ogre snarls and shoves you back.'
 - HUH_MAN: 'Huh?'
 - ENTRY_QUERY: 'Are you trying to get into the cave?'
@@ -826,16 +876,16 @@ arbitrary_messages:  !!omap
 - CANT_POUR: 'You can''t pour that.'
 - WATCH_IT: 'Watch it!'
 - WHICH_WAY: 'Which way?'
-- REINCARNATE_QUERY: 'Oh dear, you seem to have gotten yourself killed.  I might be able to\nhelp you out, but I''ve never really done this before.  Do you want me\nto try to reincarnate you?'
-- DONT_BLAME: 'All right.  But don''t blame me if something goes wr......\n                    --- POOF!! ---\nYou are engulfed in a cloud of orange smoke.  Coughing and gasping,\nyou emerge from the smoke and find....'
-- CLUMSY_OAF: 'You clumsy oaf, you''ve done it again!  I don''t know how long I can\nkeep this up.  Do you want me to try reincarnating you again?'
-- ORANGE_SMOKE: 'Okay, now where did I put my orange smoke?....  >POOF!<\nEverything disappears in a dense cloud of orange smoke.'
-- SMOKE_OUT: 'Now you''ve really done it!  I''m out of orange smoke!  You don''t expect\nme to do a decent reincarnation without any orange smoke, do you?'
-- DOIT_YOURSELF: 'Okay, if you''re so smart, do it yourself!  I''m leaving!'
-- GETS_YOU7: !!null
-- GETS_YOU8: !!null
-- GETS_YOU9: !!null
-- MISSES_YOU0: '>>> messages 81 thru 90 are reserved for "obituaries". <<<'
+- ARB_81: !!null
+- ARB_82: !!null
+- ARB_83: !!null
+- ARB_84: !!null
+- ARB_85: !!null
+- ARB_86: !!null
+- ARB_87: !!null
+- ARB_88: !!null
+- ARB_89: !!null
+- ARB_90: !!null
 - FORGOT_PATH: 'Sorry, but I no longer seem to remember how it was you got here.'
 - CARRY_LIMIT: 'You can''t carry anything more.  You''ll have to drop something first.'
 - GRATE_NOWAY: 'You can''t go through a locked steel grate!'
@@ -883,7 +933,7 @@ arbitrary_messages:  !!omap
 - SPLATTER_MESSAGE: 'There is a loud explosion, and you are suddenly splashed across the\nwalls of the room.'
 - DWARVES_AWAKEN: 'The resulting ruckus has awakened the dwarves.  There are now several\nthreatening little dwarves in the room with you!  Most of them throw\nknives at you!  All of them get you!'
 - UNHAPPY_BIRD: 'Oh, leave the poor unhappy bird alone.'
-- NEEDED_NEreplace: 'I daresay whatever you want is around here somewhere.'
+- NEEDED_NEARBY: 'I daresay whatever you want is around here somewhere.'
 - STOP_UNKNOWN: 'I don''t know the word "stop".  Use "quit" if you want to give up.'
 - NOT_CONNECTED: 'You can''t get there from here.'
 - TAME_BEAR: 'You are being followed by a very large, tame bear.'
@@ -1024,25 +1074,43 @@ arbitrary_messages:  !!omap
 - GO_UNNEEDED: 'You don''t have to say "go" every time; just specify a direction or, if\nit''s nearby, name the place to which you wish to move.'
 - CANNOT_CARRY7: !!null
   
-class_messages: !!omap
-- CLS_0: !!null
-- CLS_1: 'You are obviously a rank amateur.  Better luck next time.'
-- CLS_2: 'Your score qualifies you as a novice class adventurer.'
-- CLS_3: 'You have achieved the rating: "Experienced Adventurer".'
-- CLS_4: 'You may now consider yourself a "Seasoned Adventurer".'
-- CLS_5: 'You have reached "Junior Master" status.'
-- CLS_6: 'Your score puts you in Master Adventurer Class C.'
-- CLS_7: 'Your score puts you in Master Adventurer Class B.'
-- CLS_8: 'Your score puts you in Master Adventurer Class A.'
-- CLS_9: 'All of Adventuredom gives tribute to you, Adventurer Grandmaster!'
-- CLS_10: 'Adventuredom stands in awe -- you have now joined the ranks of the\n       W O R L D   C H A M P I O N   A D V E N T U R E R S !\nIt may interest you to know that the Dungeon-Master himself has, to\nmy knowledge, never achieved this threshhold in fewer than 330 turns.'
+classes: 
+- threshold: 0
+  message: !!null
+- threshold: 45
+  message: 'You are obviously a rank amateur.  Better luck next time.'
+- threshold: 120
+  message: 'Your score qualifies you as a novice class adventurer.'
+- threshold: 170
+  message: 'You have achieved the rating: "Experienced Adventurer".'
+- threshold: 250
+  message: 'You may now consider yourself a "Seasoned Adventurer".'
+- threshold: 320
+  message: 'You have reached "Junior Master" status.'
+- threshold: 375
+  message: 'Your score puts you in Master Adventurer Class C.'
+- threshold: 410
+  message: 'Your score puts you in Master Adventurer Class B.'
+- threshold: 426
+  message: 'Your score puts you in Master Adventurer Class A.'
+- threshold: 429
+  message: 'All of Adventuredom gives tribute to you, Adventurer Grandmaster!'
+- threshold: 9999
+  message: 'Adventuredom stands in awe -- you have now joined the ranks of the\n       W O R L D   C H A M P I O N   A D V E N T U R E R S !\nIt may interest you to know that the Dungeon-Master himself has, to\nmy knowledge, never achieved this threshhold in fewer than 330 turns.'
 
-turn_threshold_messages: !!omap
-- TURN_0: !!null
-- TURN_1: 'Tsk!  A wizard wouldn''t have to take 350 turns.  This is going to cost\nyou a couple of points.'
-- TURN_2: 500 turns?  That's another few points you've lost.
-- TURN_3: 'Are you still at it?  Five points off for exceeding 1000 turns!'
-- TURN_4: 'Good grief, don''t you *EVER* give up?  Do you realize you''ve spent\nover 2500 turns at this?  That''s another ten points off, a total of\ntwenty points lost for taking so long.'
+turn_thresholds:
+- threshold: 350
+  point_loss: 2
+  message: 'Tsk!  A wizard wouldn''t have to take 350 turns.  This is going to cost\nyou a couple of points.' 
+- threshold: 500
+  point_loss: 3
+  message: '500 turns?  That''s another few points you''ve lost.'  
+- threshold: 1000
+  point_loss: 5
+  message: 'Are you still at it?  Five points off for exceeding 1000 turns!'  
+- threshold: 2500
+  point_loss: 10
+  message: 'Good grief, don''t you *EVER* give up?  Do you realize you''ve spent\nover 2500 turns at this?  That''s another ten points off, a total of\ntwenty points lost for taking so long.'
   
 object_descriptions: !!omap
 - OBJ_0:
@@ -1152,14 +1220,13 @@ object_descriptions: !!omap
     - 'There is a bottle of oil here.'
 - OBJ_21:
     inventory: 'Water in the bottle'
-    longs: []
+    longs: !!null
 - OBJ_22:
     inventory: 'Oil in the bottle'
-    longs: []
+    longs: !!null
 - OBJ_23:
     inventory: '*mirror'
-    longs:
-    - ''
+    longs: !!null
 - OBJ_24:
     inventory: '*plant'
     longs:
@@ -1193,12 +1260,10 @@ object_descriptions: !!omap
     - 'There is a little axe lying beside the bear.'
 - OBJ_29:
     inventory: '*cave drawings'
-    longs:
-    - ''
+    longs: !!null
 - OBJ_30:
     inventory: '*pirate/genie'
-    longs:
-    - '' # never present
+    longs: !!null # never present
 - OBJ_31:
     inventory: '*dragon'
     longs:
@@ -1219,14 +1284,14 @@ object_descriptions: !!omap
     longs:
     - 'A burly troll stands by the bridge and insists you throw him a\ntreasure before you may cross.'
     - 'The troll steps out from beneath the bridge and blocks your way.'
-    - '  (chased away)'
+    - '' # chased away
     - 'The troll sounds quite adamant in his demand for a treasure.'
 - OBJ_34:
     inventory: '*phony troll'
     longs:
     - 'The troll is nowhere to be seen.'
 - OBJ_35:
-    inventory: '' # bear uses rtext 141
+    inventory: !!null # bear uses rtext 141
     longs:
     - 'There is a ferocious cave bear eying you from the far end of the room!'
     - 'There is a gentle cave bear sitting placidly in one corner.'
@@ -1239,8 +1304,7 @@ object_descriptions: !!omap
     - '"This is not the maze where the pirate leaves his treasure chest."'
 - OBJ_37:
     inventory: '*volcano and/or geyser'
-    longs:
-    - ''
+    longs: !!null
 - OBJ_38:
     inventory: '*vending machine'
     longs:
@@ -1257,8 +1321,7 @@ object_descriptions: !!omap
     - 'Some worn-out batteries have been discarded nearby.'
 - OBJ_40:
     inventory: '*carpet and/or moss and/or curtains'
-    longs:
-    - ''
+    longs: !!null
 - OBJ_41:
     inventory: '*ogre'
     longs:
@@ -1492,3 +1555,65 @@ object_descriptions: !!omap
     inventory: !!null
     longs: !!null
 
+obituaries:
+  - query: 'Oh dear, you seem to have gotten yourself killed.  I might be able to\nhelp you out, but I''ve never really done this before.  Do you want me\nto try to reincarnate you?'
+    yes_response: 'All right.  But don''t blame me if something goes wr......\n                    --- POOF!! ---\nYou are engulfed in a cloud of orange smoke.  Coughing and gasping,\nyou emerge from the smoke and find....'
+  - query: 'You clumsy oaf, you''ve done it again!  I don''t know how long I can\nkeep this up.  Do you want me to try reincarnating you again?'
+    yes_response: 'Okay, now where did I put my orange smoke?....  >POOF!<\nEverything disappears in a dense cloud of orange smoke.'
+  - query: 'Now you''ve really done it!  I''m out of orange smoke!  You don''t expect\nme to do a decent reincarnation without any orange smoke, do you?'
+    yes_response: 'Okay, if you''re so smart, do it yourself!  I''m leaving!'
+
+# FIXME: Hint texts shouldn't be in arbitrary_messages, but inlined here
+hints:
+- number: 1
+  turns: 4
+  penalty: 2
+  question: ENTRY_QUERY
+  hint: HARD_GRATE
+- number: 2
+  turns: 5
+  penalty: 2
+  question: BIRD_QUERY
+  hint: SKITTISH_BIRD
+- number: 3
+  turns: 8
+  penalty: 2
+  question: SNAKE_QUERY
+  hint: SNAKE_HINT
+- number: 4
+  turns: 75
+  penalty: 4
+  question: MAZE_HELP
+  hint: DROP_THINGS
+- number: 5
+  turns: 25
+  penalty: 5
+  question: PLOVER_QUERY
+  hint: EXPLORE_HINT
+- number: 6
+  turns: 20
+  penalty: 3
+  question: HELP_LEAVING
+  hint: NOGO_WEST
+- number: 7
+  turns: 8
+  penalty: 2
+  question: WONDERING_QUERY
+  hint: ADVANCED_SECTION
+- number: 8
+  turns: 25
+  penalty: 2
+  question: FOREST_QUERY
+  hint: GO_EAST
+- number: 9
+  turns: 10
+  penalty: 4
+  question: OGRE_QUERY
+  hint: OGRE_CLUE
+- number: 10
+  turns: 1
+  penalty: 4
+  question: MISSING_ONE
+  hint: NO_LOCATE
+
+# end