Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// Information.js
(function () {
  /* global adventurejs A */

  /**
   * @ajspath adventurejs.Atom.Asset.Intangible.Information
   * @augments adventurejs.Intangible
   * @class adventurejs.Information
   * @ajsconstruct MyGame.createAsset({ "class":"Information", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading IntangibleClasses
   * @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 class for storing transmissible information such as passwords.
   * @classdesc
   * <p>
   * <strong>Information</strong> is a special class of
   * {@link adventurejs.Intangible|Intangible}
   * meant for things like names and passwords, as in
   * "type name" or "enter password".
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *    class: "Information",
   *    name: "password",
   *    value: "1234"
   * });
   * </code></pre>
   **/
  class Information extends adventurejs.Intangible {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Information";
      this.value = "";
      this.is.information = true;
      this.is.global = true;
      this.is.abstract = true;

      // write "foo" on page
      // write "foo" on page with pen
      this.setDOV("write");

      // say "hello" to man
      this.setDOV("say");

      //type "hello" on keyboard
      this.setDOV("type");

      // enter "hello" on
      this.setDOV("enter");
    }

    validate(game) {
      super.validate(game);
      return true;
    }
  }
  adventurejs.Information = Information;
})();