Guest User

Wizards & Warriors in Inform 7

a guest
Apr 30th, 2015
1,111
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. Section 2 - Example
  23.  
  24. Dungeon is a room.
  25. Gandalf is a wizard in Dungeon.
  26. Conan is a warrior in Dungeon.
  27.  
  28. The rusty dagger is a dagger in Dungeon.
  29. The elvish sword is a sword in Dungeon.
  30. The oaken staff is a staff in Dungeon.
  31.  
  32. Instead of giving a weapon (called W) to someone (called C):
  33. consult the rulebook for C wielding W;
  34. if the rule failed:
  35. let the outcome text be "[outcome of the rulebook]" in sentence case;
  36. say "[C] declines. '[outcome text].'";
  37. otherwise:
  38. now C carries W;
  39. say "[C] gladly accepts [the W]."
  40.  
  41. The can't take people's possessions rule is not listed in any rulebook.
  42.  
  43. Test me with "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".
RAW Paste Data