class SayHeSheIt 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 (WorldState.isPlayer(next)) { this.node.nodeValue = "you"; } else if (gender.genderValueCorrected > 65) { this.node.nodeValue = "she "; } else if (gender.genderValueCorrected < 35) { this.node.nodeValue = "he "; } else { // This person is androgynous... if (gender.hasPenisBulge || gender.hasPenis) { this.node.nodeValue = "he "; } else if (gender.hasVagina || gender.hasTits) { this.node.nodeValue = "she "; } else { this.node.nodeValue = "they "; } } } else { // TODO: If we ever have gendered non-humanoids, they must be added here. this.node.nodeValue = "it "; } 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]; } }