// conjugate.js
(function () {
/* global AdventureJS A */
var p = AdventureJS.Dictionary.prototype;
/**
* Conjugates the provided verb, taking into consideration
* third-person singular present tense for subjects
* using nonhuman / male / female pronouns (he/she/it)
* or proper name.
* @memberOf AdventureJS.Dictionary
* @method AdventureJS.Dictionary#conjugate
* @param {String} verb_name
* @param {Object} target An optional target.
*/
p.conjugate = function Dictionary_conjugate(verb_name, pronouns) {
if (verb_name.name) verb_name = verb_name.name;
if ("string" !== typeof verb_name) return "";
const player = this.game.getPlayer();
const subject = this.game.getInput().getSubject();
const target = subject || player;
const proper_name = target && target.id !== player.id && target.proper_name;
let inflection;
if (pronouns) {
inflection = this.game.dictionary.inflections[pronouns];
} else {
inflection = this.game.dictionary.inflections[target.pronouns];
}
const third_person_singular =
inflection.singular && inflection.person === "third";
if (third_person_singular || (!pronouns && proper_name)) {
return this.getThirdPersonSingular(verb_name);
} else {
return verb_name;
}
};
})();