class SayHisHersIts extends Say { private node = document.createTextNode("a "); private target : Thing; private uppercase = true; public constructor (target : Thing, autoUppercase? : boolean) { super(); this.target = target; if (autoUppercase != undefined) { this.uppercase = autoUppercase; } } public async getPureElements (say : Say) : Promise> { let next = this.target; if (next == undefined) { this.node.nodeValue = ""; } else { if (next instanceof Humanoid) { let gender = next.getGenderValue(); if (gender.genderValueCorrected > 65) { this.node.nodeValue = "hers "; } else if (gender.genderValueCorrected < 35) { this.node.nodeValue = "his "; } else { // This person is androgynous... if (gender.hasPenisBulge || gender.hasPenis) { this.node.nodeValue = "his "; } else if (gender.hasVagina || gender.hasTits) { this.node.nodeValue = "hers "; } else { this.node.nodeValue = "their "; } } } else { // TODO: If we ever have gendered non-humanoids, they must be added here. this.node.nodeValue = "its "; } if (this.uppercase && say.currentParagraph.length == 0) { this.node.nodeValue = this.node.nodeValue.charAt(0).toUpperCase() + this.node.nodeValue.substr(1, this.node.nodeValue.length - 1); } } return [this.node]; } }