Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// allowVerbWithPreposition.js
(function () {
  /* global adventurejs A */
  var p = adventurejs.Asset.prototype;
  /**
   * Return whether the specified preposition is explicitly
   * allowed for this verb and object.
   * @memberOf adventurejs.Asset
   * @method adventurejs.Asset#allowVerbWithPreposition
   * @param {String} verb A verb name.
   * @param {String} prep A preposition.
   * @param {String} ov Direct or indirect object of verb.
   * @return {Boolean}
   */
  p.allowVerbWithPreposition = function Asset_allowVerbWithPreposition(
    verb,
    prep,
    ov
  ) {
    if (!ov || (ov !== "dov" && ov !== "iov")) ov = "dov";
    if (!verb || !this.game.dictionary.verbs[verb] || !this[ov][verb]) {
      return false;
    }
    if (this[ov][verb].without_prepositions.includes(prep)) {
      return false;
    }
    return this[ov][verb].with_prepositions.includes(prep);
  };
})();