Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// Phrase.js
(function () {
  /* global AdventureJS A */

  /**
   * @class AdventureJS.Dictionary.Phrase
   * @ajsinternal
   * @ajsnavheading DictionaryClasses
   * @summary Special class used to identify nouns that a verb can act on.
   * @classdesc
   * <p>
   * <strong>Phrase</strong> is a special class
   * used while parsing {@link AdventureJS.Parser.Input|Input}
   * to refer to and set rules for noun / preposition pairs.
   * </p>
   */
  class Phrase {
    constructor() {
      /**
       * Currently unused.
       * @var {String} AdventureJS.Dictionary.Phrase#accepts_string
       *
       */
      this.accepts_string = false;

      /**
       * Currently unused.
       * @var {String} AdventureJS.Dictionary.Phrase#accepts_direction
       *
       */
      this.accepts_direction = false;

      /**
       * Currently unused.
       * @var {String} AdventureJS.Dictionary.Phrase#requires_string
       *
       */
      this.requires_string = false;

      /**
       * Currently unused.
       * @var {String} AdventureJS.Dictionary.Phrase#accepts_number
       *
       */
      this.accepts_number = false;

      /**
       * Currently unused.
       * @var {String} AdventureJS.Dictionary.Phrase#requires_number
       *
       */
      this.requires_number = false;

      /**
       * If accepts_noun is true, the verb will accept a noun
       * for this phrase. If requires_noun is false, verb
       * will work with one noun or no nouns.<br>
       * Examples: "look" or "look north"
       * @var {Boolean} AdventureJS.Dictionary.Phrase#accepts_noun
       * @default false
       */
      this.accepts_noun = false;

      /**
       * If requires_noun is true, the verb must receive
       * a noun for this phrase.<br>
       * Examples: "go north" or "take thing"
       * @var {Boolean} AdventureJS.Dictionary.Phrase#
       * @default false
       */
      this.requires_noun = false;

      /**
       * If accepts_preposition is true, it is possible, but not required,
       * to accept a preposition with noun3.<br>
       * @var {Boolean} AdventureJS.Dictionary.Phrase#accepts_preposition
       * @default false
       */
      this.accepts_preposition = false;

      /**
       * If accepts_preposition_without_noun is true, parser will accept
       * a preposition that has no corresponding noun.<br>
       * Examples:<br>
       *  "fly over"<br>
       * @var {Boolean} AdventureJS.Dictionary.Phrase#accepts_preposition_without_noun
       * @default false
       */
      this.accepts_preposition_without_noun = false;
      //this.preposition_requires_noun = true;

      /**
       * If requires_preposition is true, a preposition must be provided with noun3.<br>
       * @var {Boolean} AdventureJS.Dictionary.Phrase#requires_preposition
       * @default false
       */
      this.requires_preposition = false;

      /**
       * Only these prepositions are allowed with this phrase.
       * @var {Boolean} AdventureJS.Dictionary.Phrase#
       * @default false
       */
      this.preposition_must_be = [];

      /**
       *
       * @var {Boolean} AdventureJS.Dictionary.Phrase#
       * @default false
       */
      this.preposition_must_not_be = [];

      /**
       * When the player enters a verb and one or more nouns,
       * the parser will search all assets to determine which
       * match the player's input.
       * NounMustBe qualifiers are used to narrow down potential matches.
       * For example, if your verb only acts on tangible objects,
       * then set "tangible: true".
       * If your verb only applies to characters,
       * then set "character: true". For more information, see
       * {@link AdventureJS.Dictionary.NounMustBe|NounMustBe}. For more
       * information about creating Verbs or modifying Verbs, see
       * <a href="/doc/BasicVerbs_Subscriptions.html">Verb Subscriptions</a>,
       * <a href="/doc/BasicVerbs_PhaseHooks.html">Verb Phases</a>,
       * <a href="/doc/BasicVerbs_ActionHooks.html">Verb Actions</a>,
       * <a href="/doc/Reference_HowAVerbIsBuilt.html">Verb Anatomy</a>,
       * <a href="/doc/Reference_HowAVerbIsBuilt.html">Verb Process</a>, or
       * <a href="/doc/AdvancedVerbs_ModifyVerbs.html">Modify Verbs</a>.
       * @var {AdventureJS.Dictionary.NounMustBe} AdventureJS.Dictionary.Phrase#noun_must_be
       */
      this.noun_must_be = new AdventureJS.Dictionary.NounMustBe();

      /**
       * When the player enters a verb and one or more nouns,
       * the parser will search all assets to determine which
       * match the player's input. In some cases, multiple assets
       * will be returned. NounPrefers qualifiers can be used
       * to disambiguate among multiple assets.
       * For example, if a verb can handle assets in the room or outside
       * the room but has a preference for assets in the room, we can set
       * noun_prefers: { present: true }. For more information, see
       * {@link AdventureJS.Dictionary.NounPrefers|NounPrefers}. For more
       * information about creating Verbs or modifying Verbs, see
       * <a href="/doc/BasicVerbs_Subscriptions.html">Verb Subscriptions</a>,
       * <a href="/doc/BasicVerbs_PhaseHooks.html">Verb Phases</a>,
       * <a href="/doc/BasicVerbs_ActionHooks.html">Verb Actions</a>,
       * <a href="/doc/Reference_HowAVerbIsBuilt.html">Verb Anatomy</a>,
       * <a href="/doc/Reference_HowAVerbIsBuilt.html">Verb Process</a>, or
       * <a href="/doc/AdvancedVerbs_ModifyVerbs.html">Modify Verbs</a>.
       * @var {AdventureJS.Dictionary.NounPrefers} AdventureJS.Dictionary.Phrase#noun_prefers
       */
      this.noun_prefers = new AdventureJS.Dictionary.NounPrefers();

      /**
       * accepts_plural_noun means verb can act on multiple objects.<br>
       * Examples: <br>
       *  "take shield and sword"<br>
       *  "take all keys"<br>
       *  "take all"
       * @var {Boolean} AdventureJS.Dictionary.Phrase#accepts_plural_noun
       * @default false
       */
      this.accepts_plural_noun = false;

      /**
       * Determines whether verb can act specifically on "all".<br>
       * Examples: <br>
       *  "take all"
       * @var {Boolean} AdventureJS.Dictionary.Phrase#accepts_all
       * @default false
       */
      this.accepts_all = false;

      //this.soft_prompt_for_noun = false;
      //this.soft_prompt_for_preposition = false;
    }
  }

  AdventureJS.Dictionary.Phrase = Phrase;
})();