// getVerbConnectionCount.js
(function () {
/*global adventurejs A*/
var p = adventurejs.Asset.prototype;
/**
* Return the number of assets connected to this asset
* via the specified verb.
* @memberOf adventurejs.Asset
* @method adventurejs.Asset#getVerbConnectionCount
* @param {String} verb The name of a verb.
* @param {String} to_ov Connection to direct or indirect objects of verb.
* @return {Int}
*/
p.getVerbConnectionCount = function Asset_getConnectionCount(verb, to_ov) {
if (
!verb ||
!this.game.dictionary.verbs[verb] ||
!this.is.connected_by ||
!this.is.connected_by[verb]
) {
return 0;
}
if (to_ov !== "to_dov" && to_ov !== "to_iov") {
if (this.isDOV(verb)) to_ov = "to_iov";
else if (this.isIOV(verb)) to_ov = "to_dov";
}
return this.is.connected_by[verb][to_ov]?.length || 0;
};
})();