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

  /**
   * @class adventurejs.NounMustBe
   * @ajsinternal
   * @ajsnavheading FrameworkReference
   * @summary Framework class, used as a property of a verb instance, that sets conditions a noun must meet for the verb to act on it.
   * @classdesc
   * <p>
   * <strong>NounMustBe</strong> is a special class
   * used while parsing {@link adventurejs.Input|Input}
   * to specify general conditions that
   * a noun must meet for a {@link adventurejs.Verb|Verb}
   * to act on it. This is a broad set
   * of exclusions used to narrow items by class or by certain
   * properties, or availability to the player character.
   * Exclusion is handled by
   * {@link adventurejs.Parser#qualifyParsedNoun|Parser.qualifyParsedNoun}.
   * Each verb has more specific logic to handle more specific
   * conditions.  This is an internal class
   * that authors should not need to construct, though there are
   * methods to allow authors to customize these settings
   * per Verb. See
   * <a href="/doc/Verbs_ModifyVerbs.html">Modify Verbs</a>
   * for more info.
   * </p>
   */
  class NounMustBe {
    constructor() {
      /**
       * Extant means the asset is available in the game world.
       * If extant is false the asset can be referred to
       * but not used.
       * @var {Boolean} adventurejs.NounMustBe#extant
       * @default true
       */
      this.extant = true; // maybe our only true by default?

      /**
       * If true, Verb will only act on directions, such as "go north".
       * @var {Boolean} adventurejs.NounMustBe#direction
       * @default false
       */
      this.direction = false;

      /**
       * If true, Verb will not act on directions.
       * @var {Boolean} adventurejs.NounMustBe#not_direction
       * @default false
       */
      this.not_direction = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Matter|Matter},
       * which includes Tangibles and Substances.
       * @var {Boolean} adventurejs.NounMustBe#matter
       * @default false
       */
      this.matter = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}.
       * @var {Boolean} adventurejs.NounMustBe#tangible
       * @default false
       */
      this.tangible = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Intangible|Intangibles}.
       * @var {Boolean} adventurejs.NounMustBe#intangible
       * @default false
       */
      this.intangible = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Character|Characters}.
       * @var {Boolean} adventurejs.NounMustBe#character
       * @default false
       */
      this.character = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}
       * that are in the current {@link adventurejs.Room|Room}
       * @var {Boolean} adventurejs.NounMustBe#present
       * @default false
       */
      this.present = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}
       * that are in the current {@link adventurejs.Room|Room}
       * @var {Boolean} adventurejs.NounMustBe#present_if_tangible
       * @default false
       */
      this.present_if_tangible = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}
       * that are in reachable to player.
       * @var {Boolean} adventurejs.NounMustBe#reachable_if_tangible
       * @default false
       */
      this.reachable_if_tangible = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}
       * that are visible to player character. Visibility may be
       * determined by a number of factors.
       * @var {Boolean} adventurejs.NounMustBe#visible
       * @default false
       */
      this.visible = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}
       * that are reachable to player character. Reachability may be
       * determined by a number of factors.
       * @var {Boolean} adventurejs.NounMustBe#reachable
       * @default false
       */
      this.reachable = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Tangible|Tangibles}
       * that can be taken by player character.
       * @var {Boolean} adventurejs.NounMustBe#takeable
       * @default false
       */
      this.takeable = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Asset|Assets}
       * that are known by player character.
       * @var {Boolean} adventurejs.NounMustBe#known
       * @default false
       */
      this.known = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Asset|Assets}
       * in player's inventory.
       * @var {Boolean} adventurejs.NounMustBe#in_inventory
       * @default false
       */
      this.in_inventory = false;

      /**
       * If true, if {@link adventurejs.Asset|Asset} is takeable,
       * it must be in player character's inventory for
       * verb to act on it.
       * @var {Boolean} adventurejs.NounMustBe#in_inventory_if_takeable
       * @default false
       */
      this.in_inventory_if_takeable = false;

      /**
       * If true, Verb will not act on {@link adventurejs.Asset|Assets}
       * in player's inventory.
       * @var {Boolean} adventurejs.NounMustBe#not_in_inventory
       * @default false
       */
      this.not_in_inventory = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Asset|Assets}
       * worn by player.
       * @var {Boolean} adventurejs.NounMustBe#worn
       * @default false
       */
      this.worn = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Asset|Assets}
       * not worn by player.
       * @var {Boolean} adventurejs.NounMustBe#not_worn
       * @default false
       */
      this.not_worn = false;

      /**
       * If true, Verb will only act on {@link adventurejs.Asset|Assets}
       * in the player character's hands, such as held objects
       * like ropes.
       * @var {Boolean} adventurejs.NounMustBe#in_hands
       * @default false
       */
      this.in_hands = false;

      /**
       * If true, Verb will not act on {@link adventurejs.Asset|Assets}
       * in the player character's hands, such as held objects
       * like ropes.
       * @var {Boolean} adventurejs.NounMustBe#not_in_hands
       * @default false
       */
      this.not_in_hands = false;

      /**
       * If true, Verb will not act on items that are not singular, such as collections.
       * For example, author might make a collection to represent three drawers in a desk.
       * Though the collection itself is a single asset, it represents multiple other assets.
       * @var {Boolean} adventurejs.NounMustBe#singular
       * @default false
       */
      this.singular = false;

      /**
       * If true, Verb will not act on a group of items. This is distinct from singular.
       * For example, if player has three keys and tries to "unlock door with all keys",
       * "all keys" being plural will be rejected.
       * @var {Boolean} adventurejs.NounMustBe#singular
       * @default true
       */
      //this.single = true;

      /**
       * If true, Verb will only act on the parent object of the
       * player character.
       * @var {Boolean} adventurejs.NounMustBe#player_parent
       * @default false
       */
      this.player_parent = false;

      /**
       * If true, Verb will not act on the parent object of the player character.
       * @var {Boolean} adventurejs.NounMustBe#not_player_parent
       * @default false
       */
      this.not_player_parent = false;

      /**
       * If true, Verb will only act on noun1 if it is a child of noun2.
       * For verbs such as 'take a from b', where b must be in a
       * for verb to be relevant.
       * @var {Boolean} adventurejs.NounMustBe#child_of_noun2
       * @default false
       */
      this.child_of_noun2 = false;

      /**
       * If true, qualified object of noun2 will be excluded
       * from noun1. Chiefly intended for cases like 'put all in thing'
       * where 'thing' should not be included in 'all'.
       * @var {Boolean} adventurejs.NounMustBe#not_in_prior_plural
       * @default false
       */
      this.not_in_prior_plural = false;

      /**
       * If true, Verb will only act on strings, for example:
       * say "foo" to npc
       * @var {Boolean} adventurejs.NounMustBe#string
       * @default false
       */
      this.string = false;

      /**
       * If true, Verb will only act on
       * {@link adventurejs.Asset#is!global|global}
       * {@link adventurejs.Asset|Assets}
       * @var {Boolean} adventurejs.NounMustBe#global
       * @default false
       */
      this.global = false;

      /**
       * If true, Verb will not act on
       * {@link adventurejs.Asset#is!global|global}
       * {@link adventurejs.Asset|Assets}
       * @var {Boolean} adventurejs.NounMustBe#not_global
       * @default false
       */
      this.not_global = false;

      /**
       * If true, Verb will only act on
       * {@link adventurejs.Asset#Scenery|Scenery}
       * @var {Boolean} adventurejs.NounMustBe#scenery
       * @default false
       */
      this.scenery = false;

      /**
       * If true, Verb will not act on
       * {@link adventurejs.Asset#Scenery|Scenery}
       * @var {Boolean} adventurejs.NounMustBe#not_scenery
       * @default false
       */
      this.not_scenery = false;

      /**
       * If true, Verb will only act on
       * {@link adventurejs.Asset#Exit|Exits}
       * @var {Boolean} adventurejs.NounMustBe#exit
       * @default false
       */
      this.exit = false;

      /**
       * If true, Verb will not act on
       * {@link adventurejs.Asset#Exit|Exits}
       * @var {Boolean} adventurejs.NounMustBe#not_exit
       * @default false
       */
      this.not_exit = false;

      /**
       * If true, Verb will not act on
       * {@link adventurejs.Asset#Substance|Substances}
       * @var {Boolean} adventurejs.NounMustBe#not_substance
       * @default true
       */
      this.not_substance = false;

      /**
       * If true, Verb will only act on
       * {@link adventurejs.Asset#Substance|Substances}.
       * Looks for Substances in a present Vessel.
       * @var {Boolean} adventurejs.NounMustBe#
       * @default false
       */
      this.substance = false;

      /**
       * If true, Verb will only act on global_substance.
       * This is method for referring to a substance in the abstract
       * rather than to a specific portion of substance.
       *
       * @var {Boolean} adventurejs.NounMustBe#global_substance
       * @default false
       */
      this.global_substance = false;
    }
  }

  adventurejs.NounMustBe = NounMustBe;
})();