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

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