Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 1
// getVerbMaxConnections.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Asset.prototype;
  /**
   * Get the maximum number of connections allowed by the specified verb,
   * inclusive of direct and indirect subscriptions.
   * @memberOf adventurejs.Asset
   * @method adventurejs.Asset#getVerbMaxConnections
   * @param {String} verb The name of a verb.
   * @param {String} ov Direct or indirect object of verb.
   * @return {Boolean}
   */
  p.getVerbMaxConnections = function Asset_getMaxVerbConnections(verb, ov) {
    // no verb or not ov, not max
    if (!verb || !this.game.dictionary.verbs[verb]?.with_params.max_connections)
      return 0;
    if (ov !== "dov" && ov !== "iov") ov = "dov";
    if (!this[ov][verb]) return 0;
    return this[ov][verb].with_params.max_connections || 0;
  };
})();