Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// getWornAssets.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Character.prototype;
  /**
   * Get all worn contents.
   * @memberOf adventurejs.Character
   * @method adventurejs.Character#getWornAssets
   * @return {Array}
   */
  p.getWornAssets = function Character_getWornAssets() {
    var contents = this.getAllContents();
    var worn = [];
    for (var i = 0; i < contents.length; i++) {
      var asset = this.game.getAsset(contents[i]);
      if (asset.is.worn) {
        worn.push(contents[i]);
      }
    }
    return worn;
  };
})();