// tryDestroyAfterUsing.js
(function () {
/*global adventurejs A*/
"use strict";
var p = adventurejs.Asset.prototype;
/**
* <strong>tryDestroyAfterUsing</strong> is the underlying
* function for tryDestroyDirectObjectAfterUsing and
* tryDestroyIndirectObjectAfterUsing.
* @memberOf adventurejs.Verb
* @method adventurejs.Verb#tryDestroyAfterUsing
* @param {String} object_of
* @param {Object} asset
* @returns {Object}
*/
p.tryDestroyAfterUsing = function Asset_tryDestroyAfterUsing(
object_of,
verb
) {
var results = { destroy: false, msg: "" };
if (
!object_of ||
!verb ||
!this[object_of][verb] ||
!this[object_of][verb].then_destroy
)
return results;
results.destroy = true;
if ("boolean" !== typeof this[object_of][verb].then_destroy) {
results.msg = A.getSAF.call(
this.game,
this[object_of][verb].then_destroy,
this
);
}
this.destroy();
return results;
};
})();