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

  /**
   * @ajstangiblecontainer in
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Luggage.Coinpurse
   * @augments adventurejs.Luggage
   * @class adventurejs.Coinpurse
   * @ajsconstruct MyGame.createAsset({ "class":"Coinpurse", "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 A place for your arcade tokens.
   * @tutorial Tangibles_Aspects
   * @classdesc
   * <p>
   * <strong>Coinpurse</strong> is a subclass of
   * {@link adventurejs.Luggage|Luggage}. Its only real
   * characteristic of note is that you can put small things in it.
   * See the example below to limit a Coinpurse to hold only coins
   * or specified objects.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Coinpurse",
   *   name: "coinpurse",
   *   descriptions: { look: "It's a small coinpurse. ", },
   *   aspects: { in: {
   *     with_classes: ["Coin"],
   *   }, },
   * });
   * </code></pre>
   * <p>
   * The above example uses <code class="property">with_classes</code>
   * and <code class="property">with_assets</code> to limit what a
   * player can put in without having to write custom
   * failure code for every object. To learn more, see
   * <a href="/doc/Tangibles_Aspects.html">How to Use Aspects</a>.
   * </p>
   **/
  class Coinpurse extends adventurejs.Luggage {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Coinpurse";

      this.singlePluralPairs = [["coinpurse", "coinpurses"]];
      this.aspects.in.set({
        maxheight: 0.1,
        maxwidth: 0.05,
        maxdepth: 0.025,
        maxcount: 3,
        maxsize: 0.2,
        maxweight: 1,
      });
    }
  }

  adventurejs.Coinpurse = Coinpurse;
})();