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