Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// triedVerbCount.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Asset.prototype;
  /**
   * <strong>triedVerbCount</strong> is a method to get
   * a count of times it was tried to use this asset
   * as a direct object by the specified verb.
   * <br><br>
   * <strong>$triedCount</strong> is an alias for authors.
   * @memberOf adventurejs.Asset
   * @method adventurejs.Asset#triedVerbCount
   * @param {String} verb The name of a verb.
   * @param {String} ov Direct or indirect object of verb.
   * @returns {Boolean}
   */
  p.triedVerbCount = p.$triedCount = function Asset_triedVerbCount(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.tried[verb] || !this.tried[verb][ov]) return 0;
    return this.tried[verb][ov];
  };
})();