Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Advent.inf

27. Dwarves! (lines 3045-3148)

3045  Object  dwarf "threatening little dwarf"
3046    with  name 'dwarf' 'threatening' 'nasty' 'little' 'mean',
3047          description
3048              "It's probably not a good idea to get too close.
3049               Suffice it to say the little guy's pretty aggressive.",
3050          initial "A threatening little dwarf hides in the shadows.",
3051          number 5,
3052          daemon [;
3053              if (location == thedark) return;
3054              if (self.number == 0) {
3055                  StopDaemon(self);
3056                  return;
3057              }
3058              if (parent(self) == nothing) {
3059                  if (location has nodwarf || location has light) return;
3060                  if (random(100) <= self.number) {
3061                      if (Bear in location || Troll in location) return;
3062                      new_line;
3063                      if (Dragon in location) {
3064                          self.number--;
3065                          "A dwarf appears, but with one casual blast the dragon vapourises him!";
3066                      }
3067                      move self to location;
3068                      "A threatening little dwarf comes out of the shadows!";
3069                  }
3070                  return;
3071              }
3072              if (parent(self) ~= location) {
3073                  if (location == thedark) return;
3074                  if (location has nodwarf || location has light) return;
3075                  if (random(100) <= 96 && parent(self) ~= In_Mirror_Canyon) {
3076                      move self to location;
3077                      print "^The dwarf stalks after you...^";
3078                  }
3079                  else {
3080                      remove self;
3081                      return;
3082                  }
3083              }
3084              if (random(100) <= 75) {
3085                  new_line;
3086                  if (self.has_thrown_axe == false) {
3087                      move axe to location;
3088                      self.has_thrown_axe = true;
3089                      remove self;
3090                      "The dwarf throws a nasty little axe at you, misses,
3091                       curses, and runs away.";
3092                  }
3093                  if (location == In_Mirror_Canyon)
3094                      "The dwarf admires himself in the mirror.";
3095                  print "The dwarf throws a nasty little knife at you, ";
3096                  if (random(1000) <= 95) {
3097                      deadflag = 1;
3098                      "and hits!";
3099                  }
3100                  "but misses!";
3101              }
3102              if (random(3) == 1) {
3103                  remove self;
3104                  "^Tiring of this, the dwarf slips away.";
3105              }
3106          ],
3107          before [;
3108            Kick:
3109              "You boot the dwarf across the room. He curses, then gets up and brushes himself off.
3110               Now he's madder than ever!";
3111          ],
3112          life [;
3113            ThrowAt:
3114              if (noun == axe) {
3115                  if (random(3) ~= 1) {
3116                      remove self;
3117                      move axe to location;
3118                      self.number--;
3119                      "You killed a little dwarf! The body vanishes in a cloud of greasy black smoke.";
3120                  }
3121                  move axe to location;
3122                  "Missed! The little dwarf dodges out of the way of the axe.";
3123              }
3124              <<Give noun second>>;
3125            Give:
3126              if (noun == tasty_food)
3127                  "You fool, dwarves eat only coal! Now you've made him *really* mad!";
3128              "The dwarf is not at all interested in your offer. (The reason being,
3129               perhaps, that if he kills you he gets everything you have anyway.)";
3130            Attack:
3131              "Not with your bare hands. No way.";
3132          ],
3133          has_thrown_axe false,
3134    has   animate;
3135   
3136  Object  axe "dwarvish axe"
3137    with  name 'axe' 'little' 'dwarvish' 'dwarven',
3138          description "It's just a little axe.",
3139          initial "There is a little axe here.",
3140          before [;
3141              if (~~self.is_near_bear) rfalse;
3142            Examine:
3143              "It's lying beside the bear.";
3144            Take:
3145              "No chance. It's lying beside the ferocious bear, quite within harm's way.";
3146          ],
3147          is_near_bear false;
3148   


Last updated 23 June 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.