Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Balances.inf

11. Inside the Cave, the powerful urbzig spell and its consequences (lines 1057-1234)

1057  Place In_Cave "Inside Cave"
1058    with description
1059            "A wide but shallow cave not far inside the hill.  There is no
1060             obvious exit, except for the way you came in.",
1061         out_to
1062         [;  if (CoinsIn(left_pan)+CoinsIn(right_pan) < 6)
1063                 "Something bars your way, and you hear
1064                  the scales jangling militantly.  You were trying to
1065                  steal its coins!";
1066             if (scales.number~=0) "Something bars your way, and you hear
1067                 the scales jangle slightly with energy.";
1068             return Iron_Door;
1069         ],
1070         e_to
1071         [;  return self.out_to();
1072         ],
1073         cant_go "The only way is back ~out~ through the iron door.",
1074         after
1075         [;  Take: if (parent(noun)==left_pan or right_pan)
1076                       print_ret "Taken from ", (the) parent(noun), ".";
1077         ],
1078    has  ~light;
1079   
1080  FeaturelessCube -> cave_cube "cube"
1081    with initial "Balanced on a rock formation is a featureless white cube.";
1082   
1083  Object -> scales "pair of scales"
1084    with name "pair" "of" "scales" "pans", number 0,
1085         describe
1086         [;  print "^A fair-sized pair of scales hangs from a bracket in the
1087                    cave wall.  ";
1088             if (self.number==0)  "The scales are balanced.";
1089             if (self.number==1)  "The left-hand side is higher.";
1090             "The right-hand side is higher.";
1091         ],
1092         before
1093         [;  "There are left and right hand pans, which you should refer to
1094              individually.";
1095         ],
1096    has  static supporter;
1097   
1098  Class  ScalePan
1099    with name "pan" "side" "tray",
1100         before
1101         [;  Receive:
1102             if (noun ofclass Scroll or Coin) rfalse;
1103             if (noun==feather) rfalse;
1104             "The pans gleam with what almost seems greed, and somehow they
1105              contrive to nudge your hand past them with your worthless and
1106              boring item.";
1107         ],
1108         after
1109         [ i j d w1 w2;  Receive, LetGo: i=scales.number;
1110             objectloop (j in left_pan) w1=w1 + WeightOf(j);
1111             objectloop (j in right_pan) w2=w2 + WeightOf(j);
1112             if (w1==w2) scales.number=0;
1113             if (w1 > w2) scales.number=-1;
1114             if (w1 < w2) scales.number=1;
1115             j=scales.number; d=(w2-w1)*(scales.number);
1116             if (j==i) rfalse;
1117             if (j==0) "The scales come into balance.";
1118             if (j==1) print "The left pan "; else print "The right pan ";
1119             if (d==1) "very slowly rises up.";
1120             "rises up.";
1121         ],
1122    has  supporter scenery;
1123   
1124  [ WeightOf obj;
1125    if (obj==bronze_coin) return 2;
1126    if (obj ofclass Scroll || obj==feather) return 1;
1127    return 3;
1128  ];
1129   
1130  [ CoinsIn obj i c;
1131    objectloop (i in obj) if (i ofclass Coin) c++;
1132    return c;
1133  ];
1134   
1135  ScalePan -> right_pan "right pan" with name "right";
1136  GoldCoin -> ->;
1137  GoldCoin -> ->;
1138  GoldCoin -> ->;
1139   
1140  ScalePan -> left_pan "left pan" with name "left";
1141  BronzeCoin -> -> bronze_coin;
1142  GoldCoin -> ->;
1143  GoldCoin -> ->;
1144   
1145  Scroll -> -> crumpled_scroll "crumpled scroll"
1146    with name "crumpled";
1147  Spell  -> -> -> urbzig_spell
1148    with name "urbzig",
1149         purpose "turn a dangerous object into a harmless one",
1150         magic
1151         [;  if (second==0) "The spell fizzles away.";
1152             if (second==player) "It's a matter of opinion, isn't it?";
1153             if (second==helistars_book or mace || second ofclass FeaturelessCube)
1154             {   CDefArt(second); remove second;
1155                 if (second==mace && cyclops in location)
1156                 {   remove cyclops; move eye_cube to location;
1157                     " turns into a featureless white cube just as the cyclops
1158                      was about to hit you with it.  Mightily embarrassed
1159                      by this, he drops the cube and runs off!";
1160                 }
1161                 print " turns into a moth and flutters away.^";
1162                 rtrue;
1163             }
1164             print_ret "Nothing obvious happens.  Perhaps ", (the) second,
1165                       " isn't so very dangerous after all.";
1166         ],
1167         unmagic
1168         [;  if (second==0) "The spell fizzles away.";
1169             if (second==player) "It's a matter of opinion, isn't it?";
1170             if (second has static || second has scenery)
1171             {   print_ret "Your spell is too weak for something quite as
1172                            monumentally harmless as ", (the) second, ".";
1173             }
1174             if (second==helistars_book or snake or cyclops or mace
1175                 || second ofclass FeaturelessCube)
1176                 "Nothing obvious happens.";
1177             if (second in player)
1178             {   remove second; deadflag = true;
1179                 "Suddenly, a tarantula races up your arm to your throat! 
1180                  Perhaps it was unwise to gizbru something you were
1181                  actually holding.";
1182             }
1183             if (cyclops has general)
1184                 "Nothing happens.  Perhaps that's just as well,
1185                  after the last time.";
1186             move cyclops to location;
1187             remove second; give cyclops general; StartTimer(cyclops, 5);
1188             print_ret (The) second, " is replaced by a buck-toothed cyclops
1189                  wielding a mace!";
1190         ];
1191   
1192  Object cyclops "buck-toothed cyclops"
1193    with name "buck" "toothed" "buck-toothed" "cyclops",
1194         initial "A huge buck-toothed cyclops menaces you, armed with a
1195                  heavy mace!",
1196         before
1197         [;  Cast: if (the_spell_was == bozbar_spell)
1198                       "Does the term ~death wish~ mean anything to you?";
1199                   if (the_spell_was == urbzig_spell)
1200                       "The cyclops bellows with glee as your spell has
1201                        no effect.  (After all, he wouldn't be ~dangerous~ if
1202                        an urbzig spell worked on him, would he?)";
1203         ],
1204         life [; "He roars incoherently, swinging the mace!"; ],
1205         time_left 0,
1206         time_out
1207         [;  if (self notin location)
1208             {   remove self; rtrue;
1209             }
1210             deadflag = true; remove mace; remove cyclops;
1211             "Feeling that he's given you quite long enough to explain why
1212              you made such a mess of his life, he swings the great mace
1213              maniacally down on you!";
1214         ],
1215         each_turn
1216         [ i; i=random(4); if (i==1) "^The cyclops leaps and bellows!";
1217              if (i==2)
1218                "^Whirling the mace, the cyclops jabbers at you incoherently.";
1219              if (i==3)
1220                "^The cyclops is losing patience (the appropriate cyclops
1221                  word is untranslatable into English, but approximately means
1222                  ~forbearance in not smashing all nearby skulls~).";
1223              "^The cyclops jabs you with the mace, almost breaking your rib.";
1224         ],
1225    has  animate transparent;
1226   
1227  Object -> mace "mace"
1228    with name "heavy" "mace" "axe",
1229         description "It looks much too heavy for you to even lift.";
1230   
1231  FeaturelessCube -> eye_cube "cube"
1232    with initial
1233           "A featureless white cube lies where the cyclops dropped it.";
1234   


Last updated 23 June 2004. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.