Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// $hasKey.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Character.prototype;
  /**
   * Checks to see if player has any keys to unlock the specified asset.
   * @memberOf adventurejs.Character
   * @method adventurejs.Character#$hasKey
   * @param {Object|String} direct_object An asset or asset ID to unlock.
   * @returns {Array} An array of Key assets, if player has any.
   */
  p.$hasKey = function Character_hasKey(direct_object) {
    return this.findNestedIndirectObjects("unlock", direct_object).length
      ? true
      : false;
  };
})();