/** Get all the enunciations used by a particular slave as a destructurable object. * @param {App.Entity.SlaveState} slave * @returns {FC.Enunciation} */ globalThis.getEnunciation = function(slave) { let ret = {}; if (SlaveStatsChecker.checkForLisp(slave)) { if (V.PC.customTitleLisp !== undefined) { ret.title = V.PC.customTitleLisp; } else if (V.PC.title !== 0) { ret.title = "Mathter"; } else { ret.title = "Mithtreth"; } if (V.allowFamilyTitles === 1) { const soleParentPrefersMom = slave.father === -1 && slave.mother === -1 && V.PC.title === 0; if (slave.father === -1 && !soleParentPrefersMom) { if (slave.actualAge < 4 && slave.physicalAge < 4) { ret.title = "Dadda"; } else if (slave.actualAge < 9) { ret.title = "Daddy"; } else { ret.title = "Dad"; } } else if (slave.mother === -1) { if (slave.actualAge < 4 && slave.physicalAge < 4) { ret.title = "Mama"; } else if (slave.actualAge < 9) { ret.title = "Mommy"; } else { ret.title = "Mom"; } } else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) { if (V.PC.title === 1) { ret.title = "Thon"; } else if (V.PC.title === 0) { ret.title = "Daughter"; } } else if (areSisters(slave, V.PC) > 0) { if (V.PC.title === 1) { if (slave.actualAge < 18) { ret.title = "Bro"; } else { ret.title = "Brother"; } } else if (V.PC.title === 0) { if (slave.actualAge < 18) { ret.title = "Thith"; } else { ret.title = "Thithter"; } } } } if (slave.custom.titleLisp !== undefined && slave.custom.titleLisp !== "") { if (slave.rudeTitle === 1) { if (slave.trust > 20) { ret.title = slave.custom.titleLisp; } } else { ret.title = slave.custom.titleLisp; } } ret.say = "lisp"; ret.s = "th"; ret.S = "Th"; ret.ss = "th"; ret.c = "th"; ret.C = "Th"; ret.cc = "kth"; ret.z = "th"; ret.Z = "Th"; ret.zz = "th"; ret.ch = "th"; ret.Ch = "Th"; ret.ps = "th"; ret.Ps = "Th"; ret.sh = "th"; ret.Sh = "Th"; ret.sc = "th"; ret.Sc = "Th"; ret.sch = "th"; ret.Sch = "Th"; ret.x = "kth"; ret.X = "Th"; } else { if (V.PC.customTitle !== undefined) { ret.title = V.PC.customTitle; } else if (V.PC.title !== 0) { ret.title = "Master"; } else { ret.title = "Mistress"; } if (V.allowFamilyTitles === 1) { const soleParentPrefersMom = slave.father === -1 && slave.mother === -1 && V.PC.title === 0; if (slave.father === -1 && !soleParentPrefersMom) { if (slave.actualAge < 4 && slave.physicalAge < 4) { ret.title = "Dadda"; } else if (slave.actualAge < 9) { ret.title = "Daddy"; } else { ret.title = "Dad"; } } else if (slave.mother === -1) { if (slave.actualAge < 4 && slave.physicalAge < 4) { ret.title = "Mama"; } else if (slave.actualAge < 9) { ret.title = "Mommy"; } else { ret.title = "Mom"; } } else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) { if (V.PC.title === 1) { ret.title = "Son"; } else if (V.PC.title === 0) { ret.title = "Daughter"; } } else if (areSisters(slave, V.PC) > 0) { if (V.PC.title === 1) { if (slave.actualAge < 18) { ret.title = "Bro"; } else { ret.title = "Brother"; } } else if (V.PC.title === 0) { if (slave.actualAge < 18) { ret.title = "Sis"; } else { ret.title = "Sister"; } } } } if (slave.custom.title !== undefined && slave.custom.title !== "") { if (slave.rudeTitle === 1) { if (slave.trust > 20) { ret.title = slave.custom.title; } } else { ret.title = slave.custom.title; } } ret.say = "say"; ret.s = "s"; ret.S = "S"; ret.ss = "ss"; ret.c = "c"; ret.C = "C"; ret.cc = "cc"; ret.z = "z"; ret.Z = "Z"; ret.zz = "zz"; ret.ch = "ch"; ret.Ch = "Ch"; ret.ps = "ps"; ret.Ps = "Ps"; ret.sh = "sh"; ret.Sh = "Sh"; ret.sc = "sc"; ret.Sc = "Sc"; ret.sch = "sch"; ret.Sch = "Sch"; ret.x = "x"; ret.X = "X"; } return ret; }; /** Write all of the enunciations used by a slave into global state data for use by SugarCube macros. * @param {App.Entity.SlaveState} slave */ globalThis.Enunciate = function(slave) { V.enunciate = getEnunciation(slave); }; /** * Returns speech with lisp if slave lisps * @param {App.Entity.SlaveState} slave * @param {string} speech * @returns {string} */ globalThis.Spoken = function(slave, speech) { if (SlaveStatsChecker.checkForLisp(slave)) { return lispReplace(speech); } else { return speech; } };