Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// didVerb.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Asset.prototype;
  /**
   * <strong>didVerb</strong> is a method to check whether
   * this asset was already used as an object by the
   * specified verb.
   * <br><br>
   * <strong>$did</strong> is an alias for authors.
   * @memberOf adventurejs.Asset
   * @method adventurejs.Asset#didVerb
   * @param {String} verb The name of a verb.
   * @param {String} ov Direct or indirect object of verb.
   * @returns {Boolean}
   */
  p.didVerb = p.$did = function Asset_didVerb(verb, ov) {
    if (!ov || (ov !== "dov" && ov !== "iov")) ov = "dov";
    if (!verb || !this.game.dictionary.verbs[verb]) {
      return false;
    }
    // return this[ov][verb].did_do;

    ov = ov === "dov" ? "directly" : "indirectly";
    // if (!this.did[verb] || !this.did[verb][ov]) return false;

    return this.did[verb] && this.did[verb][ov];
  };
})();