diff --git a/src/js/utilsPC.js b/src/js/utilsPC.js index 4d1e516a74ca22e7874425dcb7377854d5b33f5d..7c843d0768302cf81d48165e4b35e2c546e921fb 100644 --- a/src/js/utilsPC.js +++ b/src/js/utilsPC.js @@ -1,3 +1,642 @@ +/** + * @returns {App.Entity.PlayerState} + */ +globalThis.basePlayer = function() { + return new App.Entity.PlayerState(); +}; + +/** + * Helper function returning PC's title + * @returns {string} + */ +globalThis.properTitle = function() { + const PC = V.PC; + if (PC.customTitle) { + return PC.customTitle; + } else if (PC.title !== 0) { + return "Sir"; + } else { + return "Ma'am"; + } +}; + +/** + * Helper function returning slave's title for PC in situations where getWrittenTitle() is inappropriate + * @returns {string} + */ +globalThis.properMaster = function() { + const PC = V.PC; + if (PC.customTitle) { + return PC.customTitle; + } else if (PC.title !== 0) { + return "Master"; + } else { + return "Mistress"; + } +}; + +/** + * @returns {string} + */ +globalThis.PlayerName = function() { + const names = V.PC.slaveSurname ? [V.PC.slaveName, V.PC.slaveSurname] : [V.PC.slaveName]; + if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(V.PC.nationality)) || (V.surnameOrder === 2)) { + names.reverse(); + } + return names.join(" "); +}; + +/** + * @returns {string} + */ +globalThis.PCTitle = function() { + const titles = []; + + let title = PlayerName(); + if (V.cheater === 1) { + titles.push(`${title} the Cheater`); + } else if (V.arcologies[0].FSRestart > 10) { + titles.push(`${title} of the Societal Elite`); + } else if (V.rep > 18000) { + titles.push(`${title} the Great`); + } else if (V.rep > 17000) { + titles.push(`the exalted ${title}`); + } else if (V.rep > 16000) { + titles.push(`the illustrious ${title}`); + } else if (V.rep > 15000) { + titles.push(`the prestigious ${title}`); + } else if (V.rep > 14000) { + titles.push(`the renowned ${title}`); + } else if (V.rep > 13000) { + titles.push(`the famed ${title}`); + } else if (V.rep > 12000) { + titles.push(`the celebrated ${title}`); + } else if (V.rep > 11000) { + titles.push(`the honored ${title}`); + } else if (V.rep > 10000) { + titles.push(`the acclaimed ${title}`); + } else if (V.rep > 9000) { + titles.push(`the eminent ${title}`); + } else if (V.rep > 8250) { + titles.push(`the prominent ${title}`); + } else if (V.rep > 7500) { + titles.push(`the distinguished ${title}`); + } else if (V.rep > 6750) { + titles.push(`the admired ${title}`); + } else if (V.rep > 6000) { + titles.push(`the esteemed ${title}`); + } else if (V.rep > 5250) { + titles.push(`the respected ${title}`); + } else if (V.rep > 4500) { + titles.push(`the known ${title}`); + } else if (V.rep > 3750) { + titles.push(`the recognized ${title}`); + } else if (V.rep > 3000) { + titles.push(`the rumored ${title}`); + } else { + titles.push(title); + } + + if (V.PC.slaveName === "FC Dev") { + titles.push("the Creator"); + } + + if (V.plot === 1) { + if (V.invasionVictory === 3) { + if (V.PC.title === 1) { + titles.push("Hero of the City"); + } else { + titles.push("Heroine of the City"); + } + } else if (V.invasionVictory === 2) { + titles.push("Defender of the City"); + } + if (V.daughtersVictory === 3) { + titles.push("Destroyer of the Daughters"); + } else if (V.daughtersVictory === 2) { + if (V.PC.title === 1) { + titles.push("Victor over the Daughters"); + } else { + titles.push("Victrix over the Daughters"); + } + } + } + + if (V.SF.Toggle && V.SF.FS.Tension > 100) { + switch (V.SF.FS.BadOutcome) { + case 'MIGRATION': + titles.push("The Abandoned"); + break; + case 'Revolt': + titles.push("The Betrayed"); + break; + case 'ANNIHILATION': + titles.push("The Runner"); + break; + case 'OCCUPATION': + titles.push("The Occupied"); + break; + case 'ASSIMILATION': + titles.push("The Deceived"); + break; + case 'ISOLATION': + titles.push("The Ignored"); + break; + } + } + + if (V.mercenaries >= 5) { + if (V.mercenariesTitle === "Evocati") { + titles.push(`Princeps of the ${V.mercenariesTitle}`); + } else if (V.mercenariesTitle === "Knights") { + if (V.PC.title === 1) { + titles.push(`Lord Commander of the ${V.mercenariesTitle}`); + } else { + titles.push(`Lady Commander of the ${V.mercenariesTitle}`); + } + } else if (V.mercenariesTitle === "Immortals") { + titles.push(`Tyrant of the ${V.mercenariesTitle}`); + } else if (V.mercenariesTitle === "Black Eagles") { + titles.push(`Imperial Overlord of the ${V.mercenariesTitle}`); + } else { + titles.push(`Commander of the ${V.mercenariesTitle}`); + } + } else if (V.mercenaries >= 1) { + titles.push("Commander of the Mercenaries"); + } + + if (V.dispensary === 1) { + if (V.PC.title === 1) { + titles.push("Pharmacologos"); + } else { + titles.push("Pharmacologes"); + } + } + + if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.9) { + titles.push("Grand Champion of the Blood"); + } else if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.6) { + titles.push("Champion of the Blood"); + } else if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.3) { + titles.push("Defender of the Blood"); + } + + if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.9) { + titles.push("Grand Overseer of the Inferior Race"); + } else if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.6) { + titles.push("Overseer of the Inferior Race"); + } else if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.3) { + titles.push("Subduer of the Inferior Race"); + } + + if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.9) { + titles.push("Buttfucker of All Slaves"); + } else if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.6) { + titles.push("Sodomizer of the Traps"); + } else if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.3) { + if (V.PC.title === 1) { + titles.push("Penetrator of the Sissies"); + } else { + titles.push("Penetratrix of the Sissies"); + } + } + + if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Father to the City"); + } else { + titles.push("Mother to the City"); + } + } else if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.6) { + titles.push("Defender of Women"); + } else if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.3) { + titles.push("Restorer of Morals"); + } + + if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Protector to All Slaves"); + } else { + titles.push("Protectrix to All Slaves"); + } + } else if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.6) { + if (V.PC.title === 1) { + titles.push("Benefactor of Slaves"); + } else { + titles.push("Benefactrix of Slaves"); + } + } else if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.3) { + titles.push("Pursuer of Justice"); + } + + if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.9) { + titles.push("the Savior of the Future"); + } else if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.6) { + titles.push("the Holder of the Future"); + } else if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.3) { + titles.push("the Repopulist"); + } + + if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.9) { + titles.push("Holder of the Rod and the Lash"); + } else if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.6) { + titles.push("Subduer of Slaves"); + } else if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.3) { + titles.push("Pursuer of Justice"); + } + + if (V.arcologies[0].FSIntellectualDependency >= V.FSLockinLevel * 0.9) { + titles.push("Sovereign of Bimbos"); + } else if (V.arcologies[0].FSIntellectualDependency >= V.FSLockinLevel * 0.6) { + titles.push("Shepherd of the Slow"); + } else if (V.arcologies[0].FSIntellectualDependency >= V.FSLockinLevel * 0.3) { + titles.push("Lover of Bimbos"); + } + + if (V.arcologies[0].FSSlaveProfessionalism >= V.FSLockinLevel * 0.9) { + titles.push("the Mastermind"); + } else if (V.arcologies[0].FSSlaveProfessionalism >= V.FSLockinLevel * 0.6) { + titles.push("the Genius"); + } else if (V.arcologies[0].FSSlaveProfessionalism >= V.FSLockinLevel * 0.3) { + titles.push("the Smart"); + } + + if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.9) { + titles.push("the Purifier of the Breasts"); + } else if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.6) { + titles.push("the Discerning"); + } else if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.3) { + titles.push("the Tasteful"); + } + + if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.9) { + titles.push("the Expander of the Breasts"); + } else if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.6) { + titles.push("the Expander"); + } else if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.3) { + if (V.PC.title === 1) { + titles.push("the Implanter"); + } else { + titles.push("the Implantrix"); + } + } + + if (V.arcologies[0].FSStatuesqueGlorification >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("He Who Stands Above All"); + } else { + titles.push("She Who Stands Above All"); + } + } else if (V.arcologies[0].FSStatuesqueGlorification >= V.FSLockinLevel * 0.6) { + titles.push("Agent of Growth"); + } else if (V.arcologies[0].FSStatuesqueGlorification >= V.FSLockinLevel * 0.3) { + titles.push("height fetishist"); + } + + if (V.arcologies[0].FSPetiteAdmiration >= V.FSLockinLevel * 0.9) { + titles.push("Supporter of the Small"); + } else if (V.arcologies[0].FSPetiteAdmiration >= V.FSLockinLevel * 0.6) { + titles.push("the Size Enthusiast"); + } else if (V.arcologies[0].FSPetiteAdmiration >= V.FSLockinLevel * 0.3) { + titles.push("height fetishist"); + } + + if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("the Master of Stock"); + } else { + titles.push("the Mistress of Stock"); + } + } else if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.6) { + titles.push("the Rancher"); + } else if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.3) { + titles.push("the Farmer"); + } + + if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.9) { + titles.push("beloved of Brodin"); + } else if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.6) { + if (V.PC.title === 1) { + titles.push("he of the godlike Body"); + } else { + titles.push("she of the godlike Body"); + } + } else if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.3) { + titles.push("advancer of Gains"); + } + + if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Master of Softness"); + } else { + titles.push("Lady of Softness"); + } + } else if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.6) { + titles.push("Thickness Enthusiast"); + } else if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.3) { + titles.push("the Feeder"); + } + + if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.9) { + titles.push("Grand Preserver of MILFS"); + } else if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.6) { + titles.push("Fucker of MILFS"); + } else if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.3) { + if (V.PC.title === 1) { + titles.push("he of the notorious MILF preference"); + } else { + titles.push("she of the notorious MILF preference"); + } + } + + if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.9) { + titles.push("Keeper of the Magnificent Young Harem"); + } else if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.6) { + titles.push("Keeper of Virgins"); + } else if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.3) { + titles.push("the Virginbreaker"); + } + + if (V.arcologies[0].FSChattelReligionistLaw === 1) { + titles.push("the Prophet"); + } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.9) { + titles.push("Keeper of the Blade and Chalice"); + } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.6) { + titles.push("Champion of the Faith"); + } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.3) { + titles.push("the Holy"); + } + + if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.9) { + titles.push("First Consul"); + } else if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.6) { + titles.push("Aedile"); + } else if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.3) { + titles.push("Quaestor"); + } + + if (V.arcologies[0].FSNeoImperialist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Immortal Emperor"); + } else { + titles.push("Immortal Empress"); + } + } else if (V.arcologies[0].FSNeoImperialist >= V.FSLockinLevel * 0.6) { + if (V.PC.title === 1) { + titles.push("His Highness"); + } else { + titles.push("Her Highness"); + } + } else if (V.arcologies[0].FSNeoImperialist >= V.FSLockinLevel * 0.3) { + if (V.PC.title === 1) { + titles.push("Lord and Master"); + } else { + titles.push("Lord and Mistress"); + } + } + + if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.9) { + titles.push("Tlatcani"); + } else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.6) { + titles.push("Cihuacoatl"); + } else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.3) { + titles.push("Tlatoani"); + } + + if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("the Living God"); + } else { + titles.push("the Living Goddess"); + } + } else if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.6) { + titles.push("Pharaoh"); + } else if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.3) { + if (V.PC.title === 1) { + titles.push("Prince of the Nile"); + } else { + titles.push("Princess of the Nile"); + } + } + + if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Emperor and Descendant of Amaterasu"); + } else { + titles.push("Amaterasu Reborn"); + } + } else if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.6) { + titles.push("Shogun"); + } else if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.3) { + titles.push("Daimyo"); + } + + if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Caliph"); + } else { + titles.push("Handmaiden of Allah"); + } + } else if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.6) { + if (V.PC.title === 1) { + titles.push("Sultan"); + } else { + titles.push("Sultana"); + } + } else if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.3) { + titles.push("Beloved of Allah"); + } + + if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.9) { + if (V.PC.title === 1) { + titles.push("Emperor and Holder of the Mandate of Heaven"); + } else { + titles.push("Empress and Holder of the Mandate of Heaven"); + } + } else if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.6) { + if (V.PC.title === 1) { + titles.push("Emperor"); + } else { + titles.push("Empress"); + } + } else if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.3) { + if (V.PC.title === 1) { + titles.push("Governor of the Province"); + } else { + titles.push("Governess of the Province"); + } + } + + const facilities = App.Entity.facilities; + if (facilities.brothel.employeesIDs().size >= 15) { + if (V.PC.title === 1) { + titles.push("Procurator of the Brothel"); + } else { + titles.push("Procuratrix of the Brothel"); + } + } + + if (facilities.club.employeesIDs().size >= 15) { + titles.push("First on the Club"); + } + if (facilities.dairy.employeesIDs().size >= 15) { + titles.push("Keeper of the Cattle"); + } + if (V.cumSlaves >= 15) { + if (V.PC.title === 1) { + titles.push("Extractor of the Ejaculate"); + } else { + titles.push("Extractrix of the Ejaculate"); + } + } + if (facilities.servantsQuarters.employeesIDs().size >= 15) { + if (V.PC.title === 1) { + titles.push("Director of the Servants"); + } else { + titles.push("Directrix of the Servants"); + } + } + if (facilities.schoolroom.employeesIDs().size >= 10) { + if (V.PC.title === 1) { + titles.push("Educator of the Slaves"); + } else { + titles.push("Educatrix of the Slaves"); + } + } + if (facilities.spa.employeesIDs().size >= 10) { + titles.push("Order of the Bath"); + } + if (facilities.arcade.employeesIDs().size >= 15) { + titles.push("Comptroller of the Arcade"); + } + if (V.nurseryChildren >= 10) { + titles.push("Caretaker of the Youth"); + } + + const schoolsPresent = []; + const schoolsPerfected = []; + for (const [school, obj] of App.Data.misc.schools) { + if (V[school].schoolProsperity >= 10) { + schoolsPerfected.push(obj.title); + } else if (V[school].schoolPresent === 1) { + schoolsPresent.push(obj.title); + } + } + + if (schoolsPerfected.length > 0) { + titles.push(`${V.PC.title === 1 ? 'Benefactor' : 'Benefactrix'} of ${schoolsPerfected.toStringExt()}`); + } + if (schoolsPresent.length > 0) { + titles.push(`Supporter of ${schoolsPresent.toStringExt()}`); + } + + if (V.TFS.schoolProsperity >= 10) { + titles.push("Honorary Sibling of the Futanari Sisters"); + } else if (V.TFS.schoolPresent === 1) { + if (V.PC.title === 1) { + titles.push("Protector of the Futanari Sisters"); + } else { + titles.push("Protectrix of the Futanari Sisters"); + } + } + + if (V.slaves.length > 50) { + if (V.PC.title === 1) { + titles.push("Master of Slaves"); + } else { + titles.push("Mistress of Slaves"); + } + } else if (V.slaves.length > 40) { + titles.push("Holder of Slaves"); + } else if (V.slaves.length > 30) { + titles.push("Keeper of Slaves"); + } else if (V.slaves.length > 20) { + titles.push("Manager of Slaves"); + } else if (V.slaves.length > 10) { + titles.push("owner of slaves"); + } + const corpValue = App.Corporate.value; + if (corpValue > 500000) { + titles.push("Corporate Titan"); + } else if (corpValue > 250000) { + titles.push("corporate innovator"); + } else if (corpValue > 100000) { + titles.push("corporate founder"); + } else if (corpValue > 0) { + if (V.PC.title === 1) { + titles.push("noted corporate businessman"); + } else { + titles.push("noted corporate businesswoman"); + } + } + + if (V.rep > 18000) { + if (V.PC.title === 1) { + titles.push("unquestioned Master of the Arcology"); + } else { + titles.push("unquestioned Mistress of the Arcology"); + } + } else if (V.rep > 15000) { + if (V.PC.title === 1) { + titles.push("Lord of the Arcology"); + } else { + titles.push("Lady of the Arcology"); + } + } else if (V.rep > 12000) { + titles.push("Ruler of the Arcology"); + } else if (V.rep > 9000) { + titles.push("chief officer of the arcology"); + } else { + titles.push("owner of the arcology"); + } + + return title + titles.toStringExt(); +}; + +/** + * @param {string|Array<string>} input + * @param {number} [increase=1] + * @returns {string} + */ +globalThis.IncreasePCSkills = function(input, increase = 1) { + if (Array.isArray(input)) { + return input.reduce((r, inputArray) => r + IncreasePCSkills(inputArray, increase), ''); + } + const player = V.PC; + const oldSkill = player.skill[input]; + player.skill[input] += increase; + let t = ``; + + if (oldSkill < 10 && player.skill[input] >= 10) { + t += `<span class="green"> \nYou have gained basic knowledge in ${input}.</span>`; + } else if (oldSkill < 30 && player.skill[input] >= 30) { + t += `<span class="green"> \nYou have gained some knowledge in ${input}.</span>`; + } else if (oldSkill < 60 && player.skill[input] >= 60) { + t += `<span class="green"> \nYou have become an expert in ${input}.</span>`; + } else if (oldSkill < 100 && player.skill[input] >= 100) { + t += `<span class="green"> \nYou have mastered ${input}.</span>`; + } + return t; +}; + +/** Returns if the player is on mandatory bedrest. + * @param {App.Entity.SlaveState} actor + * @returns {boolean} + */ +globalThis.onBedRest = function(actor) { + // consider player health and injury in the future! + if (!actor) { + return null; + } else if (!canMove(actor)) { + return true; + } else if (actor.preg > actor.pregData.normalBirth / 1.33 && actor.womb.find((ft) => ft.genetics.geneticQuirks.polyhydramnios === 2 && ft.age >= 20)) { + return true; + } else if (actor.bellyPreg >= actor.pregAdaptation * 2200) { + return true; + } + return false; +}; + globalThis.resetPersonalAttention = function() { if (V.PC.career === "escort" || V.PC.career === "prostitute" || V.PC.career === "child prostitute") { V.personalAttention = "whoring"; diff --git a/src/player/js/playerJS.js b/src/player/js/playerJS.js deleted file mode 100644 index a9a5df36f88e508c405884ac3bc9097c44605e4f..0000000000000000000000000000000000000000 --- a/src/player/js/playerJS.js +++ /dev/null @@ -1,656 +0,0 @@ -globalThis.basePlayer = function() { - return new App.Entity.PlayerState(); -}; - -/** - * Helper function returning PC's title - * @returns {string} - */ -globalThis.properTitle = function() { - const PC = V.PC; - if (PC.customTitle) { - return PC.customTitle; - } else if (PC.title !== 0) { - return "Sir"; - } else { - return "Ma'am"; - } -}; - -/** - * Helper function returning slave's title for PC in situations where getWrittenTitle() is inappropriate - * @returns {string} - */ -globalThis.properMaster = function() { - const PC = V.PC; - if (PC.customTitle) { - return PC.customTitle; - } else if (PC.title !== 0) { - return "Master"; - } else { - return "Mistress"; - } -}; - -globalThis.PlayerName = function() { - const names = V.PC.slaveSurname ? [V.PC.slaveName, V.PC.slaveSurname] : [V.PC.slaveName]; - if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(V.PC.nationality)) || (V.surnameOrder === 2)) { - names.reverse(); - } - return names.join(" "); -}; - -globalThis.PCTitle = function() { - const titles = []; - - let title = PlayerName(); - - if (V.cheater === 1) { - title = (`${title} the Cheater`); - } else if (V.arcologies[0].FSRestart > 10) { - title = (`${title} of the Societal Elite`); - } else if (V.rep > 18000) { - title = (`${title} the Great`); - } else if (V.rep > 17000) { - title = (`the exalted ${title}`); - } else if (V.rep > 16000) { - title = (`the illustrious ${title}`); - } else if (V.rep > 15000) { - title = (`the prestigious ${title}`); - } else if (V.rep > 14000) { - title = (`the renowned ${title}`); - } else if (V.rep > 13000) { - title = (`the famed ${title}`); - } else if (V.rep > 12000) { - title = (`the celebrated ${title}`); - } else if (V.rep > 11000) { - title = (`the honored ${title}`); - } else if (V.rep > 10000) { - title = (`the acclaimed ${title}`); - } else if (V.rep > 9000) { - title = (`the eminent ${title}`); - } else if (V.rep > 8250) { - title = (`the prominent ${title}`); - } else if (V.rep > 7500) { - title = (`the distinguished ${title}`); - } else if (V.rep > 6750) { - title = (`the admired ${title}`); - } else if (V.rep > 6000) { - title = (`the esteemed ${title}`); - } else if (V.rep > 5250) { - title = (`the respected ${title}`); - } else if (V.rep > 4500) { - title = (`the known ${title}`); - } else if (V.rep > 3750) { - title = (`the recognized ${title}`); - } else if (V.rep > 3000) { - title = (`the rumored ${title}`); - } - - title = (`${title}, `); - - if (V.PC.slaveName === "FC Dev") { - titles.push("the Creator"); - } - - if (V.plot === 1) { - if (V.invasionVictory === 3) { - if (V.PC.title === 1) { - titles.push("Hero of the City"); - } else { - titles.push("Heroine of the City"); - } - } else if (V.invasionVictory === 2) { - titles.push("Defender of the City"); - } - if (V.daughtersVictory === 3) { - titles.push("Destroyer of the Daughters"); - } else if (V.daughtersVictory === 2) { - if (V.PC.title === 1) { - titles.push("Victor over the Daughters"); - } else { - titles.push("Victrix over the Daughters"); - } - } - } - - if (V.SF.Toggle && V.SF.FS.Tension > 100) { - switch (V.SF.FS.BadOutcome) { - case 'MIGRATION': - titles.push("The Abandoned"); - break; - case 'Revolt': - titles.push("The Betrayed"); - break; - case 'ANNIHILATION': - titles.push("The Runner"); - break; - case 'OCCUPATION': - titles.push("The Occupied"); - break; - case 'ASSIMILATION': - titles.push("The Deceived"); - break; - case 'ISOLATION': - titles.push("The Ignored"); - break; - } - } - - if (V.mercenaries >= 5) { - if (V.mercenariesTitle === "Evocati") { - titles.push(`Princeps of the ${V.mercenariesTitle}`); - } else if (V.mercenariesTitle === "Knights") { - if (V.PC.title === 1) { - titles.push(`Lord Commander of the ${V.mercenariesTitle}`); - } else { - titles.push(`Lady Commander of the ${V.mercenariesTitle}`); - } - } else if (V.mercenariesTitle === "Immortals") { - titles.push(`Tyrant of the ${V.mercenariesTitle}`); - } else if (V.mercenariesTitle === "Black Eagles") { - titles.push(`Imperial Overlord of the ${V.mercenariesTitle}`); - } else { - titles.push(`Commander of the ${V.mercenariesTitle}`); - } - } else if (V.mercenaries >= 1) { - titles.push("Commander of the Mercenaries"); - } - - if (V.dispensary === 1) { - if (V.PC.title === 1) { - titles.push("Pharmacologos"); - } else { - titles.push("Pharmacologes"); - } - } - - if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.9) { - titles.push("Grand Champion of the Blood"); - } else if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.6) { - titles.push("Champion of the Blood"); - } else if (V.arcologies[0].FSSupremacist >= V.FSLockinLevel * 0.3) { - titles.push("Defender of the Blood"); - } - - if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.9) { - titles.push("Grand Overseer of the Inferior Race"); - } else if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.6) { - titles.push("Overseer of the Inferior Race"); - } else if (V.arcologies[0].FSSubjugationist >= V.FSLockinLevel * 0.3) { - titles.push("Subduer of the Inferior Race"); - } - - if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.9) { - titles.push("Buttfucker of All Slaves"); - } else if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.6) { - titles.push("Sodomizer of the Traps"); - } else if (V.arcologies[0].FSGenderRadicalist >= V.FSLockinLevel * 0.3) { - if (V.PC.title === 1) { - titles.push("Penetrator of the Sissies"); - } else { - titles.push("Penetratrix of the Sissies"); - } - } - - if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Father to the City"); - } else { - titles.push("Mother to the City"); - } - } else if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.6) { - titles.push("Defender of Women"); - } else if (V.arcologies[0].FSGenderFundamentalist >= V.FSLockinLevel * 0.3) { - titles.push("Restorer of Morals"); - } - - if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Protector to All Slaves"); - } else { - titles.push("Protectrix to All Slaves"); - } - } else if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.6) { - if (V.PC.title === 1) { - titles.push("Benefactor of Slaves"); - } else { - titles.push("Benefactrix of Slaves"); - } - } else if (V.arcologies[0].FSPaternalist >= V.FSLockinLevel * 0.3) { - titles.push("Pursuer of Justice"); - } - - if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.9) { - titles.push("the Savior of the Future"); - } else if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.6) { - titles.push("the Holder of the Future"); - } else if (V.arcologies[0].FSRepopulationFocus >= V.FSLockinLevel * 0.3) { - titles.push("the Repopulist"); - } - - if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.9) { - titles.push("Holder of the Rod and the Lash"); - } else if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.6) { - titles.push("Subduer of Slaves"); - } else if (V.arcologies[0].FSDegradationist >= V.FSLockinLevel * 0.3) { - titles.push("Pursuer of Justice"); - } - - if (V.arcologies[0].FSIntellectualDependency >= V.FSLockinLevel * 0.9) { - titles.push("Sovereign of Bimbos"); - } else if (V.arcologies[0].FSIntellectualDependency >= V.FSLockinLevel * 0.6) { - titles.push("Shepherd of the Slow"); - } else if (V.arcologies[0].FSIntellectualDependency >= V.FSLockinLevel * 0.3) { - titles.push("Lover of Bimbos"); - } - - if (V.arcologies[0].FSSlaveProfessionalism >= V.FSLockinLevel * 0.9) { - titles.push("the Mastermind"); - } else if (V.arcologies[0].FSSlaveProfessionalism >= V.FSLockinLevel * 0.6) { - titles.push("the Genius"); - } else if (V.arcologies[0].FSSlaveProfessionalism >= V.FSLockinLevel * 0.3) { - titles.push("the Smart"); - } - - if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.9) { - titles.push("the Purifier of the Breasts"); - } else if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.6) { - titles.push("the Discerning"); - } else if (V.arcologies[0].FSBodyPurist >= V.FSLockinLevel * 0.3) { - titles.push("the Tasteful"); - } - - if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.9) { - titles.push("the Expander of the Breasts"); - } else if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.6) { - titles.push("the Expander"); - } else if (V.arcologies[0].FSAssetExpansionist >= V.FSLockinLevel * 0.3) { - if (V.PC.title === 1) { - titles.push("the Implanter"); - } else { - titles.push("the Implantrix"); - } - } - - if (V.arcologies[0].FSStatuesqueGlorification >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("He Who Stands Above All"); - } else { - titles.push("She Who Stands Above All"); - } - } else if (V.arcologies[0].FSStatuesqueGlorification >= V.FSLockinLevel * 0.6) { - titles.push("Agent of Growth"); - } else if (V.arcologies[0].FSStatuesqueGlorification >= V.FSLockinLevel * 0.3) { - titles.push("height fetishist"); - } - - if (V.arcologies[0].FSPetiteAdmiration >= V.FSLockinLevel * 0.9) { - titles.push("Supporter of the Small"); - } else if (V.arcologies[0].FSPetiteAdmiration >= V.FSLockinLevel * 0.6) { - titles.push("the Size Enthusiast"); - } else if (V.arcologies[0].FSPetiteAdmiration >= V.FSLockinLevel * 0.3) { - titles.push("height fetishist"); - } - - if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("the Master of Stock"); - } else { - titles.push("the Mistress of Stock"); - } - } else if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.6) { - titles.push("the Rancher"); - } else if (V.arcologies[0].FSPastoralist >= V.FSLockinLevel * 0.3) { - titles.push("the Farmer"); - } - - if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.9) { - titles.push("beloved of Brodin"); - } else if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.6) { - if (V.PC.title === 1) { - titles.push("he of the godlike Body"); - } else { - titles.push("she of the godlike Body"); - } - } else if (V.arcologies[0].FSPhysicalIdealist >= V.FSLockinLevel * 0.3) { - titles.push("advancer of Gains"); - } - - if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Master of Softness"); - } else { - titles.push("Lady of Softness"); - } - } else if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.6) { - titles.push("Thickness Enthusiast"); - } else if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.3) { - titles.push("the Feeder"); - } - - if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.9) { - titles.push("Grand Preserver of MILFS"); - } else if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.6) { - titles.push("Fucker of MILFS"); - } else if (V.arcologies[0].FSMaturityPreferentialist >= V.FSLockinLevel * 0.3) { - if (V.PC.title === 1) { - titles.push("he of the notorious MILF preference"); - } else { - titles.push("she of the notorious MILF preference"); - } - } - - if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.9) { - titles.push("Keeper of the Magnificent Young Harem"); - } else if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.6) { - titles.push("Keeper of Virgins"); - } else if (V.arcologies[0].FSYouthPreferentialist >= V.FSLockinLevel * 0.3) { - titles.push("the Virginbreaker"); - } - - if (V.arcologies[0].FSChattelReligionistLaw === 1) { - titles.push("the Prophet"); - } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.9) { - titles.push("Keeper of the Blade and Chalice"); - } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.6) { - titles.push("Champion of the Faith"); - } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.3) { - titles.push("the Holy"); - } - - if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.9) { - titles.push("First Consul"); - } else if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.6) { - titles.push("Aedile"); - } else if (V.arcologies[0].FSRomanRevivalist >= V.FSLockinLevel * 0.3) { - titles.push("Quaestor"); - } - - if (V.arcologies[0].FSNeoImperialist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Immortal Emperor"); - } else { - titles.push("Immortal Empress"); - } - } else if (V.arcologies[0].FSNeoImperialist >= V.FSLockinLevel * 0.6) { - if (V.PC.title === 1) { - titles.push("His Highness"); - } else { - titles.push("Her Highness"); - } - } else if (V.arcologies[0].FSNeoImperialist >= V.FSLockinLevel * 0.3) { - if (V.PC.title === 1) { - titles.push("Lord and Master"); - } else { - titles.push("Lord and Mistress"); - } - } - - if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.9) { - titles.push("Tlatcani"); - } else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.6) { - titles.push("Cihuacoatl"); - } else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.3) { - titles.push("Tlatoani"); - } - - if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("the Living God"); - } else { - titles.push("the Living Goddess"); - } - } else if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.6) { - titles.push("Pharaoh"); - } else if (V.arcologies[0].FSEgyptianRevivalist >= V.FSLockinLevel * 0.3) { - if (V.PC.title === 1) { - titles.push("Prince of the Nile"); - } else { - titles.push("Princess of the Nile"); - } - } - - if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Emperor and Descendant of Amaterasu"); - } else { - titles.push("Amaterasu Reborn"); - } - } else if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.6) { - titles.push("Shogun"); - } else if (V.arcologies[0].FSEdoRevivalist >= V.FSLockinLevel * 0.3) { - titles.push("Daimyo"); - } - - if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Caliph"); - } else { - titles.push("Handmaiden of Allah"); - } - } else if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.6) { - if (V.PC.title === 1) { - titles.push("Sultan"); - } else { - titles.push("Sultana"); - } - } else if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.3) { - titles.push("Beloved of Allah"); - } - - if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.9) { - if (V.PC.title === 1) { - titles.push("Emperor and Holder of the Mandate of Heaven"); - } else { - titles.push("Empress and Holder of the Mandate of Heaven"); - } - } else if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.6) { - if (V.PC.title === 1) { - titles.push("Emperor"); - } else { - titles.push("Empress"); - } - } else if (V.arcologies[0].FSChineseRevivalist >= V.FSLockinLevel * 0.3) { - if (V.PC.title === 1) { - titles.push("Governor of the Province"); - } else { - titles.push("Governess of the Province"); - } - } - - const facilities = App.Entity.facilities; - if (facilities.brothel.employeesIDs().size >= 15) { - if (V.PC.title === 1) { - titles.push("Procurator of the Brothel"); - } else { - titles.push("Procuratrix of the Brothel"); - } - } - - if (facilities.club.employeesIDs().size >= 15) { - titles.push("First on the Club"); - } - if (facilities.dairy.employeesIDs().size >= 15) { - titles.push("Keeper of the Cattle"); - } - if (V.cumSlaves >= 15) { - if (V.PC.title === 1) { - titles.push("Extractor of the Ejaculate"); - } else { - titles.push("Extractrix of the Ejaculate"); - } - } - if (facilities.servantsQuarters.employeesIDs().size >= 15) { - if (V.PC.title === 1) { - titles.push("Director of the Servants"); - } else { - titles.push("Directrix of the Servants"); - } - } - if (facilities.schoolroom.employeesIDs().size >= 10) { - if (V.PC.title === 1) { - titles.push("Educator of the Slaves"); - } else { - titles.push("Educatrix of the Slaves"); - } - } - if (facilities.spa.employeesIDs().size >= 10) { - titles.push("Order of the Bath"); - } - if (facilities.arcade.employeesIDs().size >= 15) { - titles.push("Comptroller of the Arcade"); - } - if (V.nurseryChildren >= 10) { - titles.push("Caretaker of the Youth"); - } - - const schoolsPresent = []; - const schoolsPerfected = []; - let schoolTitle; - for (const [school, obj] of App.Data.misc.schools) { - if (V[school].schoolProsperity >= 10) { - schoolsPerfected.push(obj.title); - } else if (V[school].schoolPresent === 1) { - schoolsPresent.push(obj.title); - } - } - - if (schoolsPerfected.length > 0) { - schoolTitle = `${V.PC.title === 1 ? 'Benefactor' : 'Benefactrix'} of `; - if (schoolsPerfected.length === 1) { - schoolTitle += schoolsPerfected[0]; - } else if (schoolsPerfected.length === 2) { - schoolTitle += `${schoolsPerfected[0]} and ${schoolsPerfected[1]}`; - } else { - schoolsPerfected[schoolsPerfected.length - 1] = `and ${schoolsPerfected[schoolsPerfected.length - 1]}`; - schoolTitle += schoolsPerfected.join(", "); - } - titles.push(schoolTitle); - } - if (schoolsPresent.length > 0) { - schoolTitle = "Supporter of "; - if (schoolsPresent.length === 1) { - schoolTitle += schoolsPresent[0]; - } else if (schoolsPresent.length === 2) { - schoolTitle += `${schoolsPresent[0]} and ${schoolsPresent[1]}`; - } else { - schoolsPresent[schoolsPresent.length - 1] = `and ${schoolsPresent[schoolsPresent.length - 1]}`; - schoolTitle += schoolsPresent.join(", "); - } - titles.push(schoolTitle); - } - - if (V.TFS.schoolProsperity >= 10) { - titles.push("Honorary Sibling of the Futanari Sisters"); - } else if (V.TFS.schoolPresent === 1) { - if (V.PC.title === 1) { - titles.push("Protector of the Futanari Sisters"); - } else { - titles.push("Protectrix of the Futanari Sisters"); - } - } - - if (V.slaves.length > 50) { - if (V.PC.title === 1) { - titles.push("Master of Slaves"); - } else { - titles.push("Mistress of Slaves"); - } - } else if (V.slaves.length > 40) { - titles.push("Holder of Slaves"); - } else if (V.slaves.length > 30) { - titles.push("Keeper of Slaves"); - } else if (V.slaves.length > 20) { - titles.push("Manager of Slaves"); - } else if (V.slaves.length > 10) { - titles.push("owner of slaves"); - } - const corpValue = App.Corporate.value; - if (corpValue > 500000) { - titles.push("Corporate Titan"); - } else if (corpValue > 250000) { - titles.push("corporate innovator"); - } else if (corpValue > 100000) { - titles.push("corporate founder"); - } else if (corpValue > 0) { - if (V.PC.title === 1) { - titles.push("noted corporate businessman"); - } else { - titles.push("noted corporate businesswoman"); - } - } - - if (V.rep > 18000) { - if (V.PC.title === 1) { - titles.push("unquestioned Master of the Arcology"); - } else { - titles.push("unquestioned Mistress of the Arcology"); - } - } else if (V.rep > 15000) { - if (V.PC.title === 1) { - titles.push("Lord of the Arcology"); - } else { - titles.push("Lady of the Arcology"); - } - } else if (V.rep > 12000) { - titles.push("Ruler of the Arcology"); - } else if (V.rep > 9000) { - titles.push("chief officer of the arcology"); - } else { - titles.push("owner of the arcology"); - } - - if (titles.length === 1) { - title += titles[0]; - } else if (titles.length === 2) { - title += `${titles[0]} and ${titles[1]}`; - } else { - titles[titles.length - 1] = `and ${titles[titles.length - 1]}`; - title += titles.join(", "); - } - return title; -}; - -/** - * @param {string} input - * @param {number} [increase=1] - * @returns {string} - */ -globalThis.IncreasePCSkills = function(input, increase = 1) { - if (Array.isArray(input)) { - return input.reduce((r, inputArray) => r + IncreasePCSkills(inputArray, increase), ''); - } - const player = V.PC; - const oldSkill = player.skill[input]; - player.skill[input] += increase; - let t = ``; - - if (oldSkill < 10 && player.skill[input] >= 10) { - t += `<span class="green"> \nYou have gained basic knowledge in ${input}.</span>`; - } else if (oldSkill < 30 && player.skill[input] >= 30) { - t += `<span class="green"> \nYou have gained some knowledge in ${input}.</span>`; - } else if (oldSkill < 60 && player.skill[input] >= 60) { - t += `<span class="green"> \nYou have become an expert in ${input}.</span>`; - } else if (oldSkill < 100 && player.skill[input] >= 100) { - t += `<span class="green"> \nYou have mastered ${input}.</span>`; - } - return t; -}; - -/** Returns if the player is on mandatory bedrest. - * @returns {boolean} - */ -globalThis.onBedRest = function(actor) { - // consider player health and injury in the future! - if (!actor) { - return null; - } else if (!canMove(actor)) { - return true; - } else if (actor.preg > actor.pregData.normalBirth / 1.33 && actor.womb.find((ft) => ft.genetics.geneticQuirks.polyhydramnios === 2 && ft.age >= 20)) { - return true; - } else if (actor.bellyPreg >= actor.pregAdaptation * 2200) { - return true; - } - return false; -};