// $has.js
(function () {
/* global adventurejs A */
var p = adventurejs.Tangible.prototype;
/**
* <strong>has</strong> is an alias to asset.isWithin()
* that reverses the direct and indirect objects, to test
* whether that asset is in this asset.
* <pre class="display"><code class="language-javascript">if( MyGame.$('crown').$has('jewel') ){ // do stuff }
* </code></pre>
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#has
* @param {Object} asset
* @returns {Boolean}
*/
p.has = p.$has = function Tangible_$has(asset) {
if ("string" === typeof asset) asset = this.game.getAsset(asset);
if (!asset || !asset.id || asset.id === "null") return false;
return asset.isWithin(this);
};
})();