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

  /**
   * @ajspath AdventureJS.Atom.Asset.Tangible
   * @augments AdventureJS.Assets.Asset
   * @class AdventureJS.Assets.Tangible
   * @ajsconstruct MyGame.createAsset({ "class": "Tangible", "name": "foo", [...] })
   * @ajsconstructedby AdventureJS.Game#createAsset
   * @ajsnavheading BaseClasses
   * @param {String} game_name Name of top level game instance that is scoped to window.
   * @param {String} name Instance name.
   * @summary Let's get physical! Physical!
   * @classdesc
   * <p>
   * <strong>Tangible</strong> is a low-level subclass of
   * {@link AdventureJS.Assets.Asset|Asset}, and the base class for
   * all tangible assets in the
   * {@link AdventureJS.Game|Game} world,
   * including
   * {@link AdventureJS.Assets.Substance|Substances} and
   * {@link AdventureJS.Assets.Entity|Entities}. It exists chiefly
   * to provide a common base class for these two classes
   * for verb qualification with NounMustBe.tangible.
   * </p>
   * <p>
   * Rather than subclassing Tangible directly, authors should
   * use subclasses of Substance and Entity.
   * </p>
   **/
  class Tangible extends AdventureJS.Assets.Asset {
    constructor(name, game_name, context_id = "", id = "") {
      super(name, game_name, context_id, id);
      this.class = "Tangible";

      // set up verbs that operate on all tangibles
      this.setDOVs([
        "examine",
        "look",
        // "listen",
        "taste",
        "smell",
        "touch",
        "lick",
      ]);
      this.setDOV({ hit: { with_anything: true, with_nothing: true } });
      this.setDOV({ tap: { with_anything: true, with_nothing: true } });
      this.setDOV({ flick: { with_nothing: true } });
      this.setIOVs(["wave"]);
    }

    validate(game) {
      super.validate(game);
      return true;
    }

    initialize(game) {
      super.initialize(game);
      return true;
    } // p.initialize

    destroy() {
      super.destroy();
      return true;
    } // p.destroy
  } // function Tangible(id)

  AdventureJS.Assets.Tangible = Tangible;
})();