Guest User

Wizards & Warriors in Inform 7 (v2)

a guest
May 12th, 2015
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. Section 1 - Definitions
  2.  
  3. A wizard is a kind of person.
  4. A warrior is a kind of person.
  5.  
  6. A weapon is a kind of thing.
  7. A dagger is a kind of weapon.
  8. A sword is a kind of weapon.
  9. A staff is a kind of weapon.
  10.  
  11. Wielding is a thing based rulebook. The wielding rules have outcomes allow it (success), it is too heavy (failure), it is too magical (failure).
  12. The wielder is a person that varies.
  13.  
  14. To consult the rulebook for (C - a person) wielding (W - a weapon):
  15. now the wielder is C;
  16. follow the wielding rules for W.
  17.  
  18. Wielding a sword: if the wielder is not a warrior, it is too heavy.
  19. Wielding a staff: if the wielder is not a wizard, it is too magical.
  20. Wielding a dagger: allow it.
  21.  
  22. To decide whether the rules allow (C - a person) to wield (W - weapon):
  23. consult the rulebook for C wielding W;
  24. if the rule failed, decide no;
  25. decide yes.
  26.  
  27. Wielding-ability relates a person (called C) to a weapon (called W) when the rules allow C to wield W. The verb to be able to wield (he can wield, they can wield, it can be wielded) implies the wielding-ability relation.
  28.  
  29. Section 2 - Example
  30.  
  31. Dungeon is a room.
  32. Gandalf is a wizard in Dungeon.
  33. Conan is a warrior in Dungeon.
  34.  
  35. The rusty dagger is a dagger in Dungeon.
  36. The elvish sword is a sword in Dungeon.
  37. The oaken staff is a staff in Dungeon.
  38.  
  39. Instead of giving a weapon (called W) to someone (called C):
  40. consult the rulebook for C wielding W;
  41. if the rule failed:
  42. let the outcome text be "[outcome of the rulebook]" in sentence case;
  43. say "[C] declines. '[outcome text].'";
  44. otherwise:
  45. now C carries W;
  46. say "[C] gladly accepts [the W]."
  47.  
  48. Instead of examining a person (called C) who is not the player:
  49. say "[C] can wield [the list of weapons that can be wielded by C]."
  50.  
  51. The can't take people's possessions rule is not listed in any rulebook.
  52.  
  53. Test me with "x gandalf / x conan / give sword to gandalf / give sword to conan / give staff to conan / give staff to gandalf / give dagger to gandalf / get dagger / give dagger to conan".
Advertisement
Add Comment
Please, Sign In to add comment