Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// Phrase.js
(function() {
	/*global adventurejs A*/ 
  "use strict";

  /**
	 * @class adventurejs.Phrase
   * @ajsinternal
   * @ajsnavheading FrameworkReference
   * @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.Input|Input} 
   * to refer to and set rules for noun / preposition pairs.
   * </p>
   */
	function Phrase() {
    
   /**
    * Currently unused.
	  * @var {String} adventurejs.Verb#accepts_string
    * 
    */
    this.accepts_string = false;
    
   /**
    * Currently unused.
	  * @var {String} adventurejs.Verb#accepts_direction
    * 
    */
   this.accepts_direction = false;
    
   /**
    * Currently unused.
	  * @var {String} adventurejs.Verb#requires_string
    * 
    */
   this.requires_string = false;
    
   /**
    * Currently unused.
	  * @var {String} adventurejs.Verb#accepts_number
    * 
    */
   this.accepts_number = false;
    
   /**
    * Currently unused.
	  * @var {String} adventurejs.Verb#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.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.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.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.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.Phrase#requires_preposition
    * @default false
    */
    this.requires_preposition = false;

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

   /**
    * 
    * @var {Boolean} adventurejs.Phrase#
    * @default false
    */
    this.preposition_cant_be = [];

   /**
    * When the player enters a verb and one or more nouns,
    * the parser will perform disambiguation to determine what 
    * game object(s) match the player's input. You can use  
    * these qualifiers to narrow down potential matches.
    * For example, if your verb only acts on tangible objects,
    * like "take" for instance, then set "tangible: true". 
    * If your verb only applies to characters, like "talk to",
    * then uncomment "character: true". For more information, see
    * {@link adventurejs.NounMustBe|NounMustBe}. For more 
    * information about creating Verbs or modifying Verbs, see  
    * <a href="/doc/Scripting_VerbSubscriptions.html">Verb Subscriptions</a>, 
    * <a href="/doc/Scripting_VerbPhases.html">Verb Phases</a>, 
    * <a href="/doc/Scripting_VerbActions.html">Verb Actions</a>, 
    * <a href="/doc/Verbs_VerbAnatomy.html">Verb Anatomy</a>, 
    * <a href="/doc/Verbs_VerbAnatomy.html">Verb Process</a>, or 
    * <a href="/doc/Verbs_ModifyVerbs.html">Modify Verbs</a>.
    * @var {adventurejs.NounMustBe} adventurejs.Phrase#noun_must_be
    * @default false
    */
    this.noun_must_be = new adventurejs.NounMustBe();

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

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

  }
	var p = Phrase.prototype;

  //p.enabled;
  p.accepts_string;
  p.accepts_direction;
  p.requires_string;
  p.accepts_number;
  p.requires_number;
  p.accepts_noun;
  p.requires_noun;
  p.accepts_preposition;
  p.accepts_preposition_without_noun;
  p.requires_preposition;
  p.preposition_must_be = [];
  p.preposition_cant_be = [];
  p.noun_can_be_plural;
  p.noun_must_be = {};

  p.no_preposition_with_direction;

	adventurejs.Phrase = Phrase;
}());