Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// Purse.js
(function () {
  /*global adventurejs A*/
  "use strict";

  /**
   * @ajstangiblecontainer in
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Luggage.Purse
   * @augments adventurejs.Luggage
   * @class adventurejs.Purse
   * @ajsconstruct MyGame.createAsset({ "class":"Purse", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading LuggageClasses
   * @param {String} game_name The name of the top level game object.
   * @param {String} name A name for the object, to be serialized and used as ID.
   * @summary For carrying anything and everything.
   * @tutorial Tangibles_Aspects
   * @classdesc
   * <p>
   * <strong>Purse</strong> is a subclass of
   * {@link adventurejs.Luggage|Luggage} that can be
   * worn and removed. It's possible to limit what can
   * be put in it by size, weight, and quantity.
   * It's also possible to restrict its contents to
   * certain classes or specific items.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <p>
   * This example shows a Luggage instance that with
   * restrictions on the size, number, and weight of
   * things that can be put in it.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Purse",
   *   name: "leather purse",
   *   place: { in: "Closet" },
   *   descriptions: { look: "It's a satchel, dammit! ", },
   *   in:
   *   {
   *     maxheight: .25,
   *     maxwidth: .1,
   *     maxdepth: .25,
   *     maxcount: 4, // can't hold more than 4 things
   *     maxweight: 2, // can't carry more than 2 units
   *   }
   * });
   * </code></pre>
   * <p>
   * This example shows a Knapsack instance that only
   * allows player to put certain items or classes in it.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Purse",
   *   name: "cheap vinyl purse",
   *   place: { in: "Closet" },
   *   descriptions: { look: "It's my low rent makeup bag. ", },
   *   aspects: { in:
   *   {
   *     with_classes: ["Makeup"], // any instance
   *     with_assets: ["lipstick", "compact", "eye liner"], // specific items
   *   }, },
   * });
   * </code></pre>
   **/
  class Purse extends adventurejs.Luggage {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Purse";

      this.singlePluralPairs = [["purse", "purses"]];

      this.aspects.in.maxheight = 0.5;
      this.aspects.in.maxwidth = 0.25;
      this.aspects.in.maxdepth = 0.1;
      this.aspects.in.maxcount = 10;
      this.aspects.in.maxsize = 1;
      this.aspects.in.maxweight = 5;

      this.setDOVs(["wear", "remove"]);
    }
  }

  adventurejs.Purse = Purse;
})();