diff --git a/src/art/artJS.tw b/src/art/artJS.tw index f0a1dcfaa6d70606bead7217caca33d6aad05835..1f9a72ed4e1e607ffff03bb6d97d037315b4be72 100644 --- a/src/art/artJS.tw +++ b/src/art/artJS.tw @@ -1614,4 +1614,4 @@ window.skinColorCatcher = function (artSlave) { } } return colorSlave; -}; \ No newline at end of file +}; diff --git a/src/art/vector/Generate_Stylesheet.tw b/src/art/vector/Generate_Stylesheet.tw index e5835205f51d76c0f559da5ff2e20c32fe81401f..cea29755be1e4aa44c8072fde2381b59e60286c4 100644 --- a/src/art/vector/Generate_Stylesheet.tw +++ b/src/art/vector/Generate_Stylesheet.tw @@ -37,5 +37,5 @@ ."+_art_display_class+" .outfit_base { fill:"+_outfitBaseColour+"; } ."+_art_display_class+" .gag { fill:#BF2126; } ."+_art_display_class+" .shadow { fill:#010101; } -."+_art_display_class+" .glasses { fill:"+_glassesColour+"; } +."+_art_display_class+" .glasses { fill:"+_glassesColor+"; } </style>" >> diff --git a/src/art/vector/Set_Colour_Outfit.tw b/src/art/vector/Set_Colour_Outfit.tw index 83c2590bf88c42d37ac14d74efc549f4fc32a55c..9cefa571d15bbb6c5292b3e15bdcb54d97f55356 100644 --- a/src/art/vector/Set_Colour_Outfit.tw +++ b/src/art/vector/Set_Colour_Outfit.tw @@ -2,8 +2,8 @@ /* BEWARE: _outfitBaseColour is used by Art_Vector_Set_Colour_Skin_ */ /* BEWARE: _outfitBaseColour is read by Wardrobe Use */ -/* BEWARE: _glassesColour is read by Wardrobe Use */ +/* BEWARE: _glassesColor is read by Wardrobe Use */ <<set _s = Art_Vector_Set_Colour_Outfit(_artSlave) >> <<set _outfitBaseColour = _s.outfitBaseColour>> -<<set _glassesColour = _s.glassesColor>> +<<set _glassesColor = _s.glassesColor>> diff --git a/src/art/vector/Set_Colour_Outfit_JS.tw b/src/art/vector/Set_Colour_Outfit_JS.tw index 02d864d598e457cc7430fdcefb9d3a31c41f2235..d45dc41b5a87c8655ffb45a1a2b68ef66973ee7f 100644 --- a/src/art/vector/Set_Colour_Outfit_JS.tw +++ b/src/art/vector/Set_Colour_Outfit_JS.tw @@ -4,7 +4,7 @@ window.Art_Vector_Set_Colour_Outfit = function(artSlave) { var s = { outfitBaseColour : undefined, - glassesColour : undefined + glassesColor : undefined } if (artSlave.fuckdoll != 0 || artSlave.clothes == "restrictive latex" || artSlave.clothes == "a latex catsuit" || artSlave.clothes == "a cybersuit") { @@ -27,24 +27,24 @@ switch (artSlave.eyewear) { case "corrective glasses": case "glasses": case "blurring glasses": - s.glassesColour = "#010101"; + s.glassesColor = "#010101"; break; default: /* use colour for "glasses" by default */ - s.glassesColour = "#010101"; + s.glassesColor = "#010101"; } switch (artSlave.collar) { case "porcelain mask": - s.glassesColour = "#FFFFFF"; + s.glassesColor = "#FFFFFF"; break; default: /* use colour for "mask" by default */ - s.glassesColour = "#010101"; + s.glassesColor = "#010101"; } if (artSlave.glassesColor) { - s.glassesColour = artSlave.glassesColor; /* glasses colour selected by user */ + s.glassesColor = artSlave.glassesColor; /* glasses colour selected by user */ } return s; diff --git a/src/endWeek/saChoosesOwnClothes.tw b/src/endWeek/saChoosesOwnClothes.tw index 8ec52680b1787441e0d5742ede6038fb8c7a385d..e24433ddb3dedcab3462185f3ca68763f1acf3e3 100644 --- a/src/endWeek/saChoosesOwnClothes.tw +++ b/src/endWeek/saChoosesOwnClothes.tw @@ -549,7 +549,7 @@ window.saChoosesOwnClothes = (function() { } } } - + /*Chooses clothes according to fetishes, quirks, etc.*/ if(slave.attrXY > 70) { if(slave.attrKnown == 1) { @@ -591,7 +591,7 @@ window.saChoosesOwnClothes = (function() { wardrobeTastes.push({text: `and wears a nice suit, the reasons not entirely clear to you.`, clothes: "nice business attire"}); } } - + /* need */ if(slave.need > 90) { wardrobeTastes.push({text: `but goes naked. ${He} needs sex now and clothing will only get in the way.`, clothes: "no clothing"}); @@ -600,20 +600,20 @@ window.saChoosesOwnClothes = (function() { wardrobeTastes.push({text: `and dresses up as a slutty maid. Maybe if ${he} does ${his} job poorly enough, someone will bend ${him} over and fuck some sense into ${him}.`, clothes: "a slutty maid outfit"}); wardrobeTastes.push({text: `and dresses up as a succubus in the hopes it screams that ${he} needs sex now.`, clothes: "a succubus outfit"}); } - + /* quirks n flaws */ if(slave.behavioralFlaw == "arrogant") { wardrobeTastes.push({text: `and chooses a formal dress that makes ${him} feel like royalty.`, clothes: "a ball gown"}); } else if(slave.behavioralQuirk == "devout") { wardrobeTastes.push({text: `and wears something more appropriate for a monastery than a whorehouse.`, clothes: "a penitent nuns habit"}); } - + if(slave.behavioralQuirk == "sinful") { wardrobeTastes.push({text: `and dresses up like a succubus because it makes ${him} feel naughty.`, clothes: "a succubus outfit"}); } else if(slave.behavioralQuirk == "fitness") { wardrobeTastes.push({text: `and wears spats and a tank top to give ${himself} a sporty look.`, clothes: "spats and a tank top"}); } - + if(slave.sexualFlaw == "shamefast") { wardrobeTastes.push({text: `and chooses an outfit that covers ${him} up as much as possible.`, clothes: "a burqa"}); } else if(slave.sexualFlaw == "breeder") { @@ -623,14 +623,14 @@ window.saChoosesOwnClothes = (function() { } else if(slave.sexualFlaw == "malicious") { wardrobeTastes.push({text: `and chooses an outfit that is commonly associated with wanton cruelty.`, clothes: "a schutzstaffel uniform"}); wardrobeTastes.push({text: `and chooses a skimpy outfit that is commonly associated with wanton cruelty.`, clothes: "a slutty schutzstaffel uniform"}); - } - + } + if(slave.sexualQuirk == "romantic") { wardrobeTastes.push({text: `and dresses up like ${he}'s about to go on a date.`, clothes: "a halter top dress"}); } else if(slave.sexualQuirk == "tease") { wardrobeTastes.push({text: `and wears a set of provocatively designed lingerie.`, clothes: "kitty lingerie"}); } - + /* age stuff */ if(slave.actualAge < 10) { wardrobeTastes.push({text: `and puts on a pretty dress so ${he} can be a princess.`, clothes: "a ball gown"}); @@ -641,7 +641,7 @@ window.saChoosesOwnClothes = (function() { } else if(slave.actualAge < 18) { wardrobeTastes.push({text: `and chooses an outfit that somewhat resembles one of ${his} school uniforms.`, clothes: "a schoolgirl outfit"}); } - + /* fetishes */ if(slave.fetishKnown == 1) { if(slave.fetish == "submissive") { @@ -707,7 +707,7 @@ window.saChoosesOwnClothes = (function() { wardrobeTastes.push({text: `and strangely decides to wear a monokini, which leaves ${his} breasts totally bare.`, clothes: "a monokini"}); wardrobeTastes.push({text: `and oddly chooses a lingerie set with a cleavage cutout in the bra.`, clothes: "kitty lingerie"}); } - } + } /* energy */ if(slave.energy > 95) { @@ -730,7 +730,7 @@ window.saChoosesOwnClothes = (function() { } else { wardrobeTastes.push({text: `and wears string lingerie to show off ${his} body.`, clothes: "a string bikini"}); } - + if(slave.nationality == "Canadian") { wardrobeTastes.push({text: `and chooses an outfit that makes ${him} feel oddly nostalgic.`, clothes: "a mounty outfit"}); } else if(slave.nationality == "Japanese") { @@ -806,11 +806,11 @@ window.saChoosesOwnClothes = (function() { function todaysCollar(slave) { let neck = []; - + if(slave.fetish == 'mindbroken') { - + } else if(slave.devotion <= 20) { - + } else { if(V.arcologies[0].FSEgyptianRevivalist > 0) { neck.push({text: `dons a wesekh to support your ancient Egyptian pretensions,`, collar: "ancient Egyptian"}); @@ -835,7 +835,7 @@ window.saChoosesOwnClothes = (function() { function todaysCorset(slave) { let belly = []; const empathyBellies = ["a small empathy belly", "a medium empathy belly", "a large empathy belly", "a huge empathy belly"]; - + if(slave.fetish == 'mindbroken') { if(V.arcologies[0].FSRepopulationFocus > 0 && slave.belly < 1500) { if(slave.weight > 130) { @@ -847,7 +847,7 @@ window.saChoosesOwnClothes = (function() { belly.push({text: "", bellyAccessory: slave.bellyAccessory}); /*compatibility for no output, will likely get deprecated in the future as content is added*/ } } else if(slave.devotion <= 20) { - + } else { if(V.arcologies[0].FSRepopulationFocus > 0 && slave.belly < 1500 && slave.sexualFlaw != "breeder") { if(slave.weight > 130) { diff --git a/src/endWeek/saPornJS.tw b/src/endWeek/saPornJS.tw index b9d3b0bd8a8c812063521bcc06ec719d18b8837e..23ac9d5ad52eee752ca2cb3c5e62b267bc0817c4 100644 --- a/src/endWeek/saPornJS.tw +++ b/src/endWeek/saPornJS.tw @@ -5,7 +5,7 @@ window.getHighestPorn = function(slave) { var max = {value: 0, type: "none"}; - + if(slave.pornTypeGeneral > max.value){ max = {value: slave.pornTypeGeneral, type: "generic"}; } @@ -111,6 +111,6 @@ window.getHighestPorn = function(slave) { if(slave.pornTypePregnancy > max.value){ max = {value: slave.pornTypePregnancy, type: "pregnancy fetish"}; } - + return max; } \ No newline at end of file diff --git a/src/endWeek/saServant.tw b/src/endWeek/saServant.tw index d17dab75d255f7a6517aab6c546b573bff3262ea..c353ebf6f3eb69f789eb79832b07a8df4e4624f4 100644 --- a/src/endWeek/saServant.tw +++ b/src/endWeek/saServant.tw @@ -6,7 +6,7 @@ window.saServant = function saServant(slave) { var he = pronouns.pronoun, him = pronouns.object, his = pronouns.possessive, hers = pronouns.possessivePronoun, himself = pronouns.objectReflexive, boy = pronouns.noun; var He = capFirstChar(he), His = capFirstChar(his); var V = State.variables; - + var t = `works as a servant. ${He} performs the lowest jobs in your penthouse, cleaning up after your other slaves, bathing them, helping them dress, and giving them sexual relief.`; if (V.servantsQuarters > 0) { diff --git a/src/endWeek/saStayConfined.tw b/src/endWeek/saStayConfined.tw index eb2b36589f9f210b45805b20493a0d6b62bb1aa0..fa9c8adf56367e042f0dd68e43cfbae6f6a2658a 100644 --- a/src/endWeek/saStayConfined.tw +++ b/src/endWeek/saStayConfined.tw @@ -56,6 +56,6 @@ window.saStayConfined = function saStayConfined(slave) { } removeJob(slave, slave.assignment) } - + return t } diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw index 0aa93283dfed74963c4f8e2f380f1810574b3904..07ff17b8655aaf964fe9fce8b2c01195fd84de47 100644 --- a/src/init/storyInit.tw +++ b/src/init/storyInit.tw @@ -1196,7 +1196,7 @@ DairyRestraintsSetting($dairyRestraintsSetting) <<set $weatherToday = $niceWeather.random()>> <<set $customSlaveOrdered = 0>> -<<set $customSlave = {age: 19, health: 0, muscles: 0, lips: 15, voice: -1, heightMod: "normal", weight: 0, face: 0, race: "white", skin: "left natural", boobs: 500, butt: 3, sex: 1, virgin: 0, dick: 2, balls: 2, clit: 0, labia: 0, vaginaLube: 1, analVirgin: 0, skills: 15, whoreSkills: 15, combatSkills: 0, intelligence: 0, intelligenceImplant: 1, nationality: "Stateless", amp: 0, eyes: 1}>> +<<set $customSlave = {age: 19, health: 0, muscles: 0, lips: 15, heightMod: "normal", weight: 0, face: 0, race: "white", skin: "left natural", boobs: 500, butt: 3, sex: 1, virgin: 0, dick: 2, balls: 2, clit: 0, labia: 0, vaginaLube: 1, analVirgin: 0, skills: 15, whoreSkills: 15, combatSkills: 0, intelligence: 0, intelligenceImplant: 1, nationality: "Stateless", amp: 0, eyes: 1, hears: 0}>> <<set $huskSlaveOrdered = 0>> <<set $huskSlave = {age: 18, nationality: "Stateless", race: "white", sex: 1, virgin: 0}>> @@ -1345,6 +1345,7 @@ advGracePLimb: 0, advCombatPLimb: 0, cyberneticPLimb: 0, ocularImplant: 0, +cochlearImplant: 0, erectileImplant: 0 } >> @@ -1384,6 +1385,7 @@ advGracePLimb: 0, advCombatPLimb: 0, cyberneticPLimb: 0, ocularImplant: 0, +cochlearImplant: 0, erectileImplant: 0 } >> diff --git a/src/interaction/cyberConfig.tw b/src/interaction/cyberConfig.tw index 36a8aac20c6465bda74b506905cb6fc06c77a94d..8ac0b73002e9749a8270ee950b6d81756a1f0933 100644 --- a/src/interaction/cyberConfig.tw +++ b/src/interaction/cyberConfig.tw @@ -50,6 +50,20 @@ | [[Heart-shaped|cyberConfig][$activeSlave.eyeColor = "heart-shaped",$temp = 2,$cash -= $modCost]] <</if>> + <<if $activeSlave.earImplant == 1>><br><br> + $He has a cochlear implant installed. + <<if $activeSlave.hears == 0>> + They are operating normally. + <<elseif $activeSlave.hears == -1>> + They are set to muffle $his hearing. + <<else>> + They are turned off. + <</if>> + <br><br> + <<if $activeSlave.hears != 0>>[[Restore hearing|cyberConfig][$activeSlave.hears = 0,$temp = 3]] | <</if>> + <<if $activeSlave.hears != -1>>[[Muffle|cyberConfig][$activeSlave.hears = -1,$temp = 3]] | <</if>> + <<if $activeSlave.hears != -2>>[[Disable|cyberConfig][$activeSlave.hears = -2,$temp = 3]]<</if>> + <<if $activeSlave.PLimb > 0>><br><br> $He has PLimb interface installed. You can assign and adjust $his prosthetics here. <<if $activeSlave.amp <= -1>><br> diff --git a/src/interaction/researchLab.tw b/src/interaction/researchLab.tw index 4da68401160653c263f94ac1d6c2a972023b6504..9dee8f212916eb205c1c5edc9aabb7e8d629ef90 100644 --- a/src/interaction/researchLab.tw +++ b/src/interaction/researchLab.tw @@ -146,6 +146,9 @@ <<if $researchLab.ocularImplant == 0 && $stockpile.ocularImplant > 0>><br> [[Reverse engineer ocular implants|Research Lab][$stockpile.ocularImplant -= 1,$researchLab.productionTime = 100,$researchLab.research = "Ocular implants"]] <</if>> + <<if $researchLab.cochlearImplant == 0 && $stockpile.cochlearImplant > 0>><br> + [[Reverse engineer cochlear implants|Research Lab][$stockpile.cochlearImplant -= 1,$researchLab.productionTime = 100,$researchLab.research = "Cochlear implants"]] + <</if>> <<if $researchLab.erectileImplant == 0 && $stockpile.erectileImplant > 0>><br> [[Reverse engineer erectile implant|Research Lab][$stockpile.erectileImplant -= 1,$researchLab.productionTime = 100,$researchLab.research = "Erectile implant"]] <</if>> @@ -185,6 +188,9 @@ <<if $researchLab.ocularImplant == 1>><br> [[Build ocular implants|Research Lab][$researchLab.productionTime = 80,$researchLab.manufacture = "Ocular implants"]] // Currently have: $stockpile.ocularImplant// <</if>> + <<if $researchLab.cochlearImplant == 1>><br> + [[Build cochlear implants|Research Lab][$researchLab.productionTime = 80,$researchLab.manufacture = "Cochlear implants"]] // Currently have: $stockpile.cochlearImplant// + <</if>> <<if $researchLab.erectileImplant == 1>><br> [[Build Erectile implant|Research Lab][$researchLab.productionTime = 50,$researchLab.manufacture = "Erectile implant"]] // Costs <<print cashFormat(25000)>>. Currently have: $stockpile.erectileImplant// <</if>> @@ -204,6 +210,7 @@ [[Advanced beauty limbs|Research Lab][$temp = 1, $cash -= 30000, $stockpile.advGracePLimb += 1]] //Costs <<print cashFormat(30000)>>. Currently have: $stockpile.advGracePLimb//<br> [[Advanced combat limbs|Research Lab][$temp = 1, $cash -= 30000, $stockpile.advCombatPLimb += 1]] //Costs <<print cashFormat(30000)>>. Currently have: $stockpile.advCombatPLimb//<br> [[Ocular implants|Research Lab][$temp = 1, $cash -= 35000, $stockpile.ocularImplant += 1]] //Costs <<print cashFormat(35000)>>. Currently have: $stockpile.ocularImplant//<br> + [[Cochlear implants|Research Lab][$temp = 1, $cash -= 35000, $stockpile.cochlearImplant += 1]] //Costs <<print cashFormat(35000)>>. Currently have: $stockpile.cochlearImplant//<br> /*[[Erectile implant|Research Lab][$temp = 1, $cash -= 25000, $stockpile.erectileImplant += 1]] //Costs <<print cashFormat(25000)>>. Currently have: $stockpile.erectileImplant//*/ <br><br>__Schematics__<br> @@ -228,6 +235,9 @@ <<if $researchLab.ocularImplant != 1 && $researchLab.research != "Ocular implants">> [[Ocular implants|Research Lab][$temp = 1, $cash -= 160000, $researchLab.ocularImplant = 1]] //Costs <<print cashFormat(160000)>>.//<br> <</if>> + <<if $researchLab.cochlearImplant != 1 && $researchLab.research != "Cochlear implants">> + [[Cochlear implants|Research Lab][$temp = 1, $cash -= 160000, $researchLab.cochlearImplant = 1]] //Costs <<print cashFormat(160000)>>.//<br> + <</if>> /*<<if $researchLab.erectileImplant != 1 && $researchLab.research != "Erectile implant">> [[Erectile implant|Research Lab][$temp = 1, $cash -= 95000, $researchLab.erectileImplant = 1]] //Costs <<print cashFormat(95000)>>.// <</if>>*/ diff --git a/src/js/PenthouseNaming.tw b/src/js/PenthouseNaming.tw index 23472d35b30e82e3737f75856abeede02e2a6b64..ea3553530d06fe235156fc9297dcc42a45b001e3 100644 --- a/src/js/PenthouseNaming.tw +++ b/src/js/PenthouseNaming.tw @@ -1,41 +1,41 @@ :: PenthouseNaming [script] window.MS = function() { - const V = State.variables; - var name = ""; - if (V.masterSuiteNameCaps === "The Master Suite") + const V = State.variables; + var name = ""; + if (V.masterSuiteNameCaps === "The Master Suite") name = "Master Suite" else name = V.masterSuiteNameCaps; return `<<link "${name}""Master Suite">><</link>> `} window.HS = function() { - const V = State.variables; - var name = ""; - if (V.HGSuiteNameCaps === "The Head Girl Suite") + const V = State.variables; + var name = ""; + if (V.HGSuiteNameCaps === "The Head Girl Suite") name = "Head Girl Suite" else name = V.HGSuiteNameCaps; return `<<link "${name}""Head Girl Suite">><</link>> `} window.SQ = function() { - const V = State.variables; - var name = ""; - if (V.servantsQuartersNameCaps === "The Servants' Quarters") + const V = State.variables; + var name = ""; + if (V.servantsQuartersNameCaps === "The Servants' Quarters") name = "Servants' Quarters" else name = V.servantsQuartersNameCaps; return `<<link "${name}""Servants' Quarters">><</link>> `} window.S = function() { - const V = State.variables; - var name = ""; - if (V.spaNameCaps === "The Spa") + const V = State.variables; + var name = ""; + if (V.spaNameCaps === "The Spa") name = "Spa" else name = V.spaNameCaps; return `<<link "${name}""Spa">><</link>> `} window.CI = function() { - const V = State.variables; - var name = ""; - if (V.clinicNameCaps === "The Clinic") + const V = State.variables; + var name = ""; + if (V.clinicNameCaps === "The Clinic") name = "Clinic" else name = V.clinicNameCaps; diff --git a/src/js/SetBellySize.tw b/src/js/SetBellySize.tw index ce50faf43da2c3d31860d0e852d1721eb6b01f61..8b0e8b7ef2300215f7ca0336288672d50d705f2e 100644 --- a/src/js/SetBellySize.tw +++ b/src/js/SetBellySize.tw @@ -8,7 +8,7 @@ window.SetBellySize = function SetBellySize(slave) { _implantSize = slave.bellyImplant else _implantSize = 0 - + if (slave.inflation == 3) slave.bellyFluid = 10000 else if (slave.inflation == 2) @@ -17,6 +17,6 @@ window.SetBellySize = function SetBellySize(slave) { slave.bellyFluid = 2000 else slave.bellyFluid = 0 - + slave.belly = slave.bellyPreg+slave.bellyFluid+_implantSize } diff --git a/src/js/accordianJS.tw b/src/js/accordianJS.tw index dae0b80ba5c7adc52c0b038a1698d0ded300b533..836311ecda63ed257613a4904e955466fcc2a5b0 100644 --- a/src/js/accordianJS.tw +++ b/src/js/accordianJS.tw @@ -1,42 +1,42 @@ :: accordionJS.tw [script] + /* Accordion 000-250-006 */ /* * We're making changes to the DOM, so we need to make them *after* everything has been generated * Sticking this all in postdisplay calls reduces the chance of there being a timing conflict - * with other scripts, since anything poking the DOM here will be done last + * with other scripts, since anything poking the DOM here will be done last * * Dev Note: The accordion mod should be able to turn *anything* into an accordion. This iteration - * is configured tightly for the end of week report runs, but it shouldn't be that hard to adapt for - * other uses, like character bios. For now, I'll see what other extra-long passages of cosmetic text - * might benefit. + * is configured tightly for the end of week report runs, but it shouldn't be that hard to adapt for + * other uses, like character bios. For now, I'll see what other extra-long passages of cosmetic text + * might benefit. * * 000-250-006 03092017 */ postdisplay["doAccordionSet"] = function (content) { - if (variables().useAccordion == 1) { - Array.prototype.slice.call(document.querySelectorAll('.macro-include')) - .forEach(function(element) { - element.classList.add('accHidden'); - }); - } + if (variables().useAccordion == 1) { + Array.prototype.slice.call(document.querySelectorAll('.macro-include')) + .forEach(function(element) { + element.classList.add('accHidden'); + }); + } } postdisplay["doAccordion"] = function (content) { - var acc = document.getElementsByClassName("accordion"); - var i; + var acc = document.getElementsByClassName("accordion"); + var i; - for (i = 0; i < acc.length; i += 1) { - acc[i].onclick = function () { - this.classList.toggle("active"); - var panel = this.nextElementSibling; - if (panel.style.maxHeight) { - panel.style.maxHeight = null; - } else { - panel.style.maxHeight = 2*panel.scrollHeight + "px"; - } - }; - } + for (i = 0; i < acc.length; i += 1) { + acc[i].onclick = function () { + this.classList.toggle("active"); + var panel = this.nextElementSibling; + if (panel.style.maxHeight) { + panel.style.maxHeight = null; + } else { + panel.style.maxHeight = 2*panel.scrollHeight + "px"; + } + }; + } }; - diff --git a/src/js/assayJS.tw b/src/js/assayJS.tw index 3724e4892793b6edec90c72b3435a2f9622e9b29..f3d27c81fa6b8f0516307ef732c84f8f3cbea05a 100644 --- a/src/js/assayJS.tw +++ b/src/js/assayJS.tw @@ -3,7 +3,7 @@ window.isSlim = function(slave) { var slim = false; var ArcologyZero = State.variables.arcologies[0]; - + if ((slave.boobs < 500) && (slave.butt < 3)) { if ((slave.muscles <= 30) && (ArcologyZero.FSPhysicalIdealist === "unset") && (slave.weight <= 10) && (ArcologyZero.FSHedonisticDecadence === "unset")) { slim = true; @@ -19,7 +19,7 @@ window.isSlim = function(slave) { } } } - + return slim; }; @@ -31,14 +31,14 @@ window.isModded = function(slave) { var tatScore = TatScore(slave); var piercingScore = PiercingScore(slave); var modScore = piercingScore+tatScore; - + return ((modScore > 15) || (piercingScore > 8) && (tatScore > 5)); }; window.isUnmodded = function(slave) { var tatScore = TatScore(slave); var piercingScore = PiercingScore(slave); - + return !isModded(slave) && (slave.corsetPiercing === 0) && (piercingScore < 3) && (tatScore < 2); }; @@ -71,7 +71,7 @@ window.modScore = function modScore(slave) { window.PiercingScore = function(slave) { var piercingScore = 0; - + if (slave.earPiercing > 0) { piercingScore += slave.earPiercing*0.75-0.5; } @@ -169,14 +169,14 @@ window.TatScore = function(slave) { } else if (slave.anusTat !== 0) { tatScore += 1.25; } - + return tatScore; }; window.slimPass = function(slave) { var slimPass = 0; var ArcologyZero = State.variables.arcologies[0]; - + if (ArcologyZero.FSSlimnessEnthusiastLaw === 1) { if ((slave.boobs < 300) && (slave.butt <= 1) && (slave.waist <= 10)) { State.variables.slimPass = 1; @@ -194,7 +194,7 @@ window.slimPass = function(slave) { } } } - + return slimPass; }; @@ -337,7 +337,7 @@ window.newSlave = function newSlave(slave) { SetBellySize(slave); addSlave(slave); - + if (slave.origin !== "She was your slave, but you freed her, which she repaid by participating in a coup attempt against you. It failed, and she is again your chattel." && slave.ID !== V.boomerangSlave.ID) { V.genePool.push(slave); } else { @@ -527,7 +527,7 @@ window.Enunciate = function Enunciate(slave) { window.fetishChangeChance = function fetishChangeChance(slave) { const V = State.variables; var chance = 0, sex = 0; - + if (slave.clitSetting !== slave.fetish) { if (slave.balls) { sex = V.potencyAge - slave.actualAge; @@ -537,7 +537,7 @@ window.fetishChangeChance = function fetishChangeChance(slave) { } chance = Math.trunc(Math.clamp((slave.devotion/4)-(slave.fetishStrength/4)-(Math.max(sex,0)*10), 0, 100)); } - + return chance; }; @@ -561,7 +561,7 @@ window.PlayerName = function PlayerName() { "Taiwanese", "Vietnamese"]; let names = [V.PC.name, V.PC.surname || ""]; - + if ((V.surnameOrder !== 1) && (surnamesFirstCountries.includes(V.PC.nationality))) names.reverse(); return names.join(" ").trim(); @@ -621,7 +621,6 @@ window.PCTitle = function PCTitle() { titles.push("the Creator"); } - if (V.plot === 1) { if (V.invasionVictory === 3) { if (V.PC.title === 1) { @@ -661,7 +660,6 @@ window.PCTitle = function PCTitle() { titles.push("Commander of the Mercenaries"); } - if (V.dispensary === 1) { if (V.PC.title === 1) { titles.push("Pharmacologos"); @@ -686,7 +684,6 @@ window.PCTitle = function PCTitle() { 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) { @@ -775,7 +772,6 @@ window.PCTitle = function PCTitle() { 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) { @@ -788,7 +784,6 @@ window.PCTitle = function PCTitle() { titles.push("advancer of Gains"); } - if (V.arcologies[0].FSHedonisticDecadence >= V.FSLockinLevel * 0.9) { if (V.PC.title === 1) { titles.push("Master of Softness"); @@ -801,7 +796,6 @@ window.PCTitle = function PCTitle() { 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) { @@ -822,7 +816,6 @@ window.PCTitle = function PCTitle() { titles.push("the Virginbreaker"); } - if (V.arcologies[0].FSChattelReligionistLaw === 1) { titles.push("the Prophet"); } else if (V.arcologies[0].FSChattelReligionist >= V.FSLockinLevel * 0.9) { @@ -833,7 +826,6 @@ window.PCTitle = function PCTitle() { 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) { @@ -842,7 +834,6 @@ window.PCTitle = function PCTitle() { titles.push("Quaestor"); } - if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.9) { titles.push("Tlatcani"); } else if (V.arcologies[0].FSAztecRevivalist >= V.FSLockinLevel * 0.6) { @@ -879,7 +870,6 @@ window.PCTitle = function PCTitle() { titles.push("Daimyo"); } - if (V.arcologies[0].FSArabianRevivalist >= V.FSLockinLevel * 0.9) { if (V.PC.title === 1) { titles.push("Caliph"); @@ -916,7 +906,6 @@ window.PCTitle = function PCTitle() { } } - if (V.brothelSlaves >= 15) { if (V.PC.title === 1) { titles.push("Procurator of the Brothel"); @@ -1097,7 +1086,7 @@ window.PCTitle = function PCTitle() { window.PoliteRudeTitle = function PoliteRudeTitle(slave) { const V = State.variables, PC = V.PC, s = V.sEnunciate, ss = V.ssEnunciate; - + var r = ""; if (slave.nationality === "Japanese") { if (slave.trust > 0) { @@ -1486,7 +1475,7 @@ window.DegradingName = function DegradingName(slave) { "recruit girls"]; let names = []; let suffixes = []; - + if (slave.fuckdoll > 0) { slave.slaveName = "Fuckdoll No. " + slave.ID; slave.slaveSurname = 0; @@ -1509,7 +1498,7 @@ window.DegradingName = function DegradingName(slave) { names.push("Black", "Dark"); break; case "pacific islander": - names.push("Islander", "Sea"); + names.push("Islander", "Pacific", "Sea"); break; case "malay": names.push("Cinnamon", "Pinoy", "Spice"); @@ -1521,7 +1510,7 @@ window.DegradingName = function DegradingName(slave) { names.push("Indian", "Reservation"); break; case "semitic": - names.push("Semitic"); + names.push("Semite", "Semitic"); break; case "middle eastern": names.push("Arab", "Sand"); @@ -1530,7 +1519,7 @@ window.DegradingName = function DegradingName(slave) { names.push("Brown", "Indian"); break; case "mixed race": - names.push("Mulatto", "Mutt"); + names.push("Mixed", "Mulatto", "Mutt"); break; } } @@ -1538,6 +1527,9 @@ window.DegradingName = function DegradingName(slave) { if (slave.eyes === -2) { names.push("Blind", "Eyeless", "Sightless"); } + if (slave.hears === -2) { + names.push("Deaf", "Earless", "Unhearing"); + } if (slave.boobs >= 2000) { suffixes.push("Boob", "Boobs", "Titty"); } @@ -1705,8 +1697,7 @@ window.DegradingName = function DegradingName(slave) { } else if (slave.trust < 20) { names.push("Begging"); } - - + if (slave.dick === 0) { if (slave.vagina === -1) { suffixes.push("Null"); @@ -1800,7 +1791,7 @@ window.DegradingName = function DegradingName(slave) { if (slave.vagina === 0) { suffixes.push("Virgin"); } - + slave.slaveName = jsEither(names); } if (leadershipPosition.includes(slave.assignment)) { diff --git a/src/js/assignJS.tw b/src/js/assignJS.tw index eaececf52f45e9e248610b51aa6be055bfe94ab1..7106cd7449b3dd237b6d062dfb5753da333b12b2 100644 --- a/src/js/assignJS.tw +++ b/src/js/assignJS.tw @@ -7,7 +7,7 @@ window.assignJob = function assignJob(slave, job) { if (job === "Pit" || job === "Coursing Association") return r; - + removeJob(slave, slave.assignment); const idx = V.slaveIndices[slave.ID]; @@ -76,7 +76,7 @@ window.assignJob = function assignJob(slave, job) { case "Hedonistic": slave.livingRules = "luxurious"; break; - + case "Roman Revivalist": case "Aztec Revivalist": case "Egyptian Revivalist": @@ -86,7 +86,7 @@ window.assignJob = function assignJob(slave, job) { case "Edo Revivalist": slave.livingRules = "normal"; break; - + default: slave.livingRules = "spare"; break; @@ -214,13 +214,13 @@ window.assignJob = function assignJob(slave, job) { case "be the stewardess": case "be the wardeness": slave.assignment = job; - slave.assignmentVisible = 0; /* non-visible leadership roles */ + slave.assignmentVisible = 0; /* non-visible leadership roles */ slave.livingRules = "luxurious"; break; case "be your concubine": slave.assignment = job; - slave.assignmentVisible = 0; /* non-visible leadership roles */ + slave.assignmentVisible = 0; /* non-visible leadership roles */ if(V.masterSuiteUpgradeLuxury > 0) slave.livingRules = "luxurious"; else @@ -255,7 +255,7 @@ window.assignJob = function assignJob(slave, job) { case "choose her own job": slave.assignment = job; - slave.choosesOwnAssignment = 1; /* removeJob already set assignmentVisible = 1 */ + slave.choosesOwnAssignment = 1; /* removeJob already set assignmentVisible = 1 */ break; default: @@ -423,18 +423,18 @@ window.removeJob = function removeJob(slave, assignment) { V.personalAttention = "upkeep"; else V.personalAttention = "business"; - + r += `You no longer have a slave assigned to be your Head Girl, so you turn your personal attention to focus on ${V.personalAttention}.`; } break; - + case "be your agent": case "live with your agent": slave.assignment = "rest"; const _leaderIndex = V.leaders.findIndex(function(x) { return x.ID === slave.ID; }); if (_leaderIndex !== -1) V.leaders.deleteAt(_leaderIndex); - + if (slave.relationshipTarget > 0) { /* following code assumes there can be at most one companion */ const _lover = V.slaves.findIndex(function(s) { return haveRelationshipP(s, slave) && s.assignment === "live with your agent"; }); if (_lover !== -1) { @@ -443,16 +443,15 @@ window.removeJob = function removeJob(slave, assignment) { } } break; - + default: slave.assignment = "rest"; break; } - if (slave.livingRules === "luxurious" && slave.assignmentVisible !== 1) slave.livingRules = "normal"; - + slave.assignmentVisible = 1; slave.choosesOwnAssignment = 0; slave.sentence = 0; diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw index 9eaf39bc6af8e34e0e70bebcfd94b88f049308ae..d8cad2d9b39b84f062dd9ede6654f4de7b12934f 100644 --- a/src/js/economyJS.tw +++ b/src/js/economyJS.tw @@ -39,7 +39,7 @@ window.getCost = function(array) { + (0.2 * State.variables.dairyFeedersUpgrade * dairy * facilityCost) + (0.1 * State.variables.dairyPregUpgrade * dairy * facilityCost) + (0.2 * State.variables.dairyStimulatorsUpgrade * facilityCost) - + (0.2 * State.variables.servantsQuartersUpgradeMonitoring * servantsQuarters * facilityCost) + + (0.2 * State.variables.servantsQuartersUpgradeMonitoring * servantsQuarters * facilityCost) + (0.2 * State.variables.incubatorUpgradeWeight * incubator * facilityCost) + (0.2 * State.variables.incubatorUpgradeMuscles * incubator * facilityCost) + (0.2 * State.variables.incubatorUpgradeReproduction * incubator * facilityCost) @@ -104,7 +104,7 @@ window.getCost = function(array) { if (State.variables.slaveUnits != null) { for (var i = 0; i < State.variables.slaveUnits.length; i++) { if( !( State.variables.slaveUnits[i] === null) ){ - secExpCost += State.variables.slaveUnits[i].troops * State.variables.soldierUpkeep * 0.5 * soldierMod; + secExpCost += State.variables.slaveUnits[i].troops * State.variables.soldierUpkeep * 0.5 * soldierMod; } } } @@ -474,11 +474,18 @@ window.getSlaveCost = function(s) { } if(!canSee(s) && (s.assignment != Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment != Job.ARCADE)) { cost += 50; - } else if(s.eyes <= -1 && s.eyewear !== 'corrective glasses' && s.eyewear !== 'corrective contacts') { + } else if(s.eyes <= -1 && s.eyewear !== 'corrective glasses' && s.eyewear !== 'corrective contacts') { cost += 25; } else if(s.eyewear === 'blurring glasses' || s.eyewear === 'blurring contacts') { cost += 25; } + if(!canHear(s) && (s.assignment != Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment != Job.ARCADE)) { + cost += 20; + } else if(s.hears <= -1 && s.earwear !== 'hearing aids') { + cost += 5; + } else if(s.earwear === 'muffling ear plugs') { + cost += 5; + } if((s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) { if(s.amp !== 0) { if(s.amp === 1) { diff --git a/src/js/eventSelectionJS.tw b/src/js/eventSelectionJS.tw index d083a7c04116b9f2552668bbe233575893bc8c20..f1313d8b587544fe700675c8f239b0a093559f6e 100644 --- a/src/js/eventSelectionJS.tw +++ b/src/js/eventSelectionJS.tw @@ -120,7 +120,7 @@ if(eventSlave.fetish != "mindbroken") { if(eventSlave.devotion <= 50) { if(eventSlave.anus != 0 && canDoAnal(eventSlave)) { if(State.variables.HGSeverity >= 0) { - State.variables.events.push("RE anal punishment"); + State.variables.events.push("RE anal punishment"); } State.variables.events.push("RE shower punishment"); } @@ -425,7 +425,7 @@ if(eventSlave.fetish != "mindbroken") { if(eventSlave.fetish == "sadist" || eventSlave.fetish == "dom" || eventSlave.energy > 95) { if(State.variables.REShowerForceSubIDs.length > 0) { if(eventSlave.trust <= 75) { - State.variables.RETSevent.push("shower force"); + State.variables.RETSevent.push("shower force"); } } if(eventSlave.anus > 0) { @@ -1927,7 +1927,7 @@ if(eventSlave.fetish != "mindbroken") { if(eventSlave.devotion <= 50) { if(eventSlave.anus != 0 && canDoAnal(eventSlave)) { if(State.variables.HGSeverity >= 0) { - State.variables.events.push("RE anal punishment"); + State.variables.events.push("RE anal punishment"); } State.variables.events.push("RE shower punishment"); } @@ -2016,7 +2016,7 @@ if(eventSlave.fetish != "mindbroken") { if(eventSlave.fetish == "sadist" || eventSlave.fetish == "dom" || eventSlave.energy > 95) { if(State.variables.REShowerForceSubIDs.length > 0) { if(eventSlave.trust <= 75) { - State.variables.RETSevent.push("shower force"); + State.variables.RETSevent.push("shower force"); } } if(eventSlave.anus > 0) { diff --git a/src/js/extendedFamilyModeJS.tw b/src/js/extendedFamilyModeJS.tw index 564c288c7aa0d79da68c92442187581cf2e555d3..fc1579a6d1a61a4e7ea1331f2e60968480ae8c1d 100644 --- a/src/js/extendedFamilyModeJS.tw +++ b/src/js/extendedFamilyModeJS.tw @@ -68,7 +68,7 @@ window.areTwins = function(slave1, slave2) { window.areSisters = function(slave1, slave2) { if (slave1.ID == slave2.ID) { return 0; //you are not your own sister - } else if (((slave1.father == 0) || (slave1.father == -2)) && ((slave1.mother == 0) || (slave1.mother == -2))) { + } else if (((slave1.father == 0) || (slave1.father == -2)) && ((slave1.mother == 0) || (slave1.mother == -2))) { return 0; //not related } else { if (!sameDad(slave1, slave2) && sameMom(slave1, slave2)) { @@ -102,7 +102,7 @@ window.areSisters = function(c1, c2) { sib -= 1; } if(sameDad(c1, c2)) { - sib -=1; + sib -=1; } if (sib == 2 && c1.actualAge == c2.actualAge && c1.birthWeek == c2.birthWeek) { sib -= 1; @@ -169,26 +169,26 @@ if (typeof DairyRestraintsSetting == "undefined") { /* OLD window.randomRelatedSlave = function(slave, filterFunction) { - if(!slave || !SugarCube) { return undefined; } - if(typeof filterFunction !== 'function') { filterFunction = function(s, index, array) { return true; }; } - return State.variables.slaves.filter(filterFunction).shuffle().find(function(s, index, array) {return areSisters(slave, s) || s.mother == slave.ID || s.father == slave.ID || slave.ID == s.mother || slave.ID == s.father; }) + if(!slave || !SugarCube) { return undefined; } + if(typeof filterFunction !== 'function') { filterFunction = function(s, index, array) { return true; }; } + return State.variables.slaves.filter(filterFunction).shuffle().find(function(s, index, array) {return areSisters(slave, s) || s.mother == slave.ID || s.father == slave.ID || slave.ID == s.mother || slave.ID == s.father; }) } */ window.randomRelatedSlave = function(slave, filterFunction) { - if(!slave || !SugarCube) { return undefined; } - if(typeof filterFunction !== 'function') { - filterFunction = function(s, index, array) { return true; }; - } - var arr = State.variables.slaves.filter(filterFunction) - arr.shuffle() - return arr.find(function(s, index, array) { - return areSisters(slave, s) - || slave.ID === s.mother - || slave.ID === s.father - || s.ID === slave.mother - || s.ID === slave.father; - }) + if(!slave || !SugarCube) { return undefined; } + if(typeof filterFunction !== 'function') { + filterFunction = function(s, index, array) { return true; }; + } + var arr = State.variables.slaves.filter(filterFunction) + arr.shuffle() + return arr.find(function(s, index, array) { + return areSisters(slave, s) + || slave.ID === s.mother + || slave.ID === s.father + || s.ID === slave.mother + || s.ID === slave.father; + }) } window.randomRelatedAvailableSlave = function(slave) { diff --git a/src/js/familyTree.tw b/src/js/familyTree.tw index c057bc7639e1574a8d2832e8a9287676af29ff33..4a8fbfec0a204396730e049092baa8a0d1ec8906 100644 --- a/src/js/familyTree.tw +++ b/src/js/familyTree.tw @@ -4,7 +4,7 @@ var lastActiveSlave, lastSlaves, lastPC; /* - To use, add something like: + To use, add something like: <div id="familyTree"></div> <span id="familyTreeLink"> @@ -116,7 +116,7 @@ window.renderFamilyTree = function(slaves, filterID) { .on('end', dragended)); node.append('circle') - .attr('r', function(d){ return d.r }) + .attr('r', function(d){ return d.r }) .attr('stroke', function(d) { if(d.ID == filterID) { return '#ffff20'; @@ -240,7 +240,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { unborn[State.variables.tanks[i].ID] = true; } - for(var i = 0; i < charList.length; i++) { + for(var i = 0; i < charList.length; i++) { var mom = charList[i].mother; var dad = charList[i].father; @@ -258,7 +258,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { } } - for(var i = 0; i < charList.length; i++) { + for(var i = 0; i < charList.length; i++) { var character = charList[i]; if(character.mother == 0 && character.father == 0 && !kids[character.ID]) { continue; @@ -360,7 +360,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { for(var k in relIDs.tree) { related[k] = true; } - for(var i = 0; i < charList.length; i++) { + for(var i = 0; i < charList.length; i++) { if(charHash[charList[i].ID]) { var pRelIDs = relatedTo(charHash[charList[i].ID], filterID); if(pRelIDs.related) { @@ -379,7 +379,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { } } - for(var i = 0; i < charList.length; i++) { + for(var i = 0; i < charList.length; i++) { var character = charList[i]; var char_id = character.ID; if(character.mother == 0 && character.father == 0 && !kids[char_id]) { @@ -450,7 +450,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { /*Old version. To use, do something like: <div id="editFamily"> - <div id="graph"></div> + <div id="graph"></div> </div> <<run updateFamilyTree($activeSlave, $slaves, $PC)>> @@ -463,149 +463,149 @@ If there's no active slave, you can do: */ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastSlaves, PC = lastPC) { - lastActiveSlave = activeSlave; - lastSlaves = slaves; - lastPC = PC; - var treeDepth = 0; - var numTreeNodes = 0; - - var graphElement = document.getElementById("graph"); - if(!graphElement) - return; - graphElement.innerHTML = ""; - - /* The way this code works is that we start with the activeSlave then we call - slaveInfo() recursively to work our way up the tree finding their parents. - - */ - - function getSlave(id, expectedGenes) { - if(id == -1) { - return {"slaveName":"YOU", "ID":id, "physicalAge":PC.physicalAge, "genes":PC.genes, father:PC.father, mother:PC.mother}; - } - if(id == 0) { - return {"slaveName":"-", "ID":id, "genes":expectedGenes}; - } - if(id == activeSlave.ID) { - return activeSlave; - } - for(var i = 0; i < slaves.length; ++i) { - if(slaves[i].ID == id) - return slaves[i]; - } - return {"slaveName":"-", "ID":id, "genes":expectedGenes}; - } - - function slaveInfo(slave, activeSlaveId, recursionProtectSlaveId = {}) { - numTreeNodes = 0; - treeDepth = 0; - if(recursionProtectSlaveId[slave.ID]) { - console.log("Recursion protection"); - return slaveInfo_(slave, activeSlaveId); - } - recursionProtectSlaveId[slave.ID] = true; - - if(typeof slave.father == "undefined" || typeof slave.mother == "undefined") - return slaveInfo_(slave, activeSlaveId); - - if(slave.father == -1 || slave.mother == -1) { - return slaveInfo(getSlave(-1), activeSlaveId, recursionProtectSlaveId); - } - if(slave.father != 0) { - return slaveInfo(getSlave(slave.father, "unknownXY"), activeSlaveId, recursionProtectSlaveId); - } - - if(slave.mother != 0) { - return slaveInfo(getSlave(slave.mother, "unknownXX"), activeSlaveId, recursionProtectSlaveId); - } - return slaveInfo_(slave, activeSlaveId); - } - function slaveInfo_(slave, activeSlaveId, slavesAdded={}, depth = 1) { - numTreeNodes += 1; - treeDepth = Math.max(treeDepth, depth); - var shouldAddChildren = false; - if(!slavesAdded[slave.ID]) { - shouldAddChildren = true; - slavesAdded[slave.ID] = true; - } - var data = { - "name": slave.slaveName + (slave.physicalAge?(" (" + slave.physicalAge + ")"):""), - "class" : slave.genes, - "textClass": (activeSlaveId == slave.ID)?"emphasis":"", - "marriages": [], - }; - - var spouseToChild = {}; - - function maybeAddSpouseToChild(child) { - if(child.ID == slave.ID) - return; - if (child.father == slave.ID) { - if(!spouseToChild[child.mother]) { - spouseToChild[child.mother] = [] - } - spouseToChild[child.mother].push(child); - } else if (child.mother == slave.ID) { - if(!spouseToChild[child.father]) { - spouseToChild[child.father] = [] - } - spouseToChild[child.father].push(child); - } - } - - if(activeSlave.ID != PC.ID) - maybeAddSpouseToChild(activeSlave); - maybeAddSpouseToChild(getSlave(-1)); - - for(var i = 0; i < slaves.length; ++i) { - var child = slaves[i]; - if(child.ID != activeSlave.ID) - maybeAddSpouseToChild(child); - } - - for(var key in spouseToChild) { - if(spouseToChild.hasOwnProperty(key)) { - var children = shouldAddChildren?spouseToChild[key]:[]; - var spouse = getSlave(key, (slaves.genes=="XX")?"unknownXY":(slaves.genes=="XY")?"unknownXX":"unknown"); - var spouseName; - if (spouse.ID != slave.ID){ - spouseName = spouse.slaveName + (spouse.physicalAge?(" (" + spouse.physicalAge + ")"):"") - } else { - spouseName = (spouse.ID==-1)?"(yourself)":"(themselves)"; - } - var marriage = { - "spouse": {"name": spouseName, "class": spouse.genes}, - "children": children.map(function(x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth+1)} ), - }; - data.marriages.push(marriage); - } - } - return data; - } - - if(activeSlave == PC || activeSlave == null) - activeSlave = getSlave(-1) - const treeData = [slaveInfo(activeSlave, activeSlave.ID)]; - console.log("Family tree is", treeData, 'and has:', numTreeNodes); - - var parentWidth = document.getElementById('editFamily').offsetWidth; - - console.log(parentWidth, document.getElementById('passages').offsetWidth); - if(!parentWidth) - parentWidth = document.body.offsetWidth - 483; - - console.log(parentWidth, Math.min(200 + 40*numTreeNodes,parentWidth-200) + 200); - - dTree.init(treeData, { - target: "#graph", - debug: true, - height: 50 + 50*treeDepth, /* very rough heuristics */ - width: Math.min(200 + 40*numTreeNodes, - parentWidth-200) + 200, - callbacks: { - nodeClick: function(name, extra) { + lastActiveSlave = activeSlave; + lastSlaves = slaves; + lastPC = PC; + var treeDepth = 0; + var numTreeNodes = 0; + + var graphElement = document.getElementById("graph"); + if(!graphElement) + return; + graphElement.innerHTML = ""; + + /* The way this code works is that we start with the activeSlave then we call + slaveInfo() recursively to work our way up the tree finding their parents. + + */ + + function getSlave(id, expectedGenes) { + if(id == -1) { + return {"slaveName":"YOU", "ID":id, "physicalAge":PC.physicalAge, "genes":PC.genes, father:PC.father, mother:PC.mother}; + } + if(id == 0) { + return {"slaveName":"-", "ID":id, "genes":expectedGenes}; + } + if(id == activeSlave.ID) { + return activeSlave; + } + for(var i = 0; i < slaves.length; ++i) { + if(slaves[i].ID == id) + return slaves[i]; + } + return {"slaveName":"-", "ID":id, "genes":expectedGenes}; } + + function slaveInfo(slave, activeSlaveId, recursionProtectSlaveId = {}) { + numTreeNodes = 0; + treeDepth = 0; + if(recursionProtectSlaveId[slave.ID]) { + console.log("Recursion protection"); + return slaveInfo_(slave, activeSlaveId); + } + recursionProtectSlaveId[slave.ID] = true; + + if(typeof slave.father == "undefined" || typeof slave.mother == "undefined") + return slaveInfo_(slave, activeSlaveId); + + if(slave.father == -1 || slave.mother == -1) { + return slaveInfo(getSlave(-1), activeSlaveId, recursionProtectSlaveId); + } + if(slave.father != 0) { + return slaveInfo(getSlave(slave.father, "unknownXY"), activeSlaveId, recursionProtectSlaveId); } + + if(slave.mother != 0) { + return slaveInfo(getSlave(slave.mother, "unknownXX"), activeSlaveId, recursionProtectSlaveId); + } + return slaveInfo_(slave, activeSlaveId); + } + function slaveInfo_(slave, activeSlaveId, slavesAdded={}, depth = 1) { + numTreeNodes += 1; + treeDepth = Math.max(treeDepth, depth); + var shouldAddChildren = false; + if(!slavesAdded[slave.ID]) { + shouldAddChildren = true; + slavesAdded[slave.ID] = true; + } + var data = { + "name": slave.slaveName + (slave.physicalAge?(" (" + slave.physicalAge + ")"):""), + "class" : slave.genes, + "textClass": (activeSlaveId == slave.ID)?"emphasis":"", + "marriages": [], + }; + + var spouseToChild = {}; + + function maybeAddSpouseToChild(child) { + if(child.ID == slave.ID) + return; + if (child.father == slave.ID) { + if(!spouseToChild[child.mother]) { + spouseToChild[child.mother] = [] + } + spouseToChild[child.mother].push(child); + } else if (child.mother == slave.ID) { + if(!spouseToChild[child.father]) { + spouseToChild[child.father] = [] + } + spouseToChild[child.father].push(child); + } + } + + if(activeSlave.ID != PC.ID) + maybeAddSpouseToChild(activeSlave); + maybeAddSpouseToChild(getSlave(-1)); + + for(var i = 0; i < slaves.length; ++i) { + var child = slaves[i]; + if(child.ID != activeSlave.ID) + maybeAddSpouseToChild(child); + } + + for(var key in spouseToChild) { + if(spouseToChild.hasOwnProperty(key)) { + var children = shouldAddChildren?spouseToChild[key]:[]; + var spouse = getSlave(key, (slaves.genes=="XX")?"unknownXY":(slaves.genes=="XY")?"unknownXX":"unknown"); + var spouseName; + if (spouse.ID != slave.ID){ + spouseName = spouse.slaveName + (spouse.physicalAge?(" (" + spouse.physicalAge + ")"):"") + } else { + spouseName = (spouse.ID==-1)?"(yourself)":"(themselves)"; + } + var marriage = { + "spouse": {"name": spouseName, "class": spouse.genes}, + "children": children.map(function(x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth+1)} ), + }; + data.marriages.push(marriage); + } + } + return data; + } + + if(activeSlave == PC || activeSlave == null) + activeSlave = getSlave(-1) + const treeData = [slaveInfo(activeSlave, activeSlave.ID)]; + console.log("Family tree is", treeData, 'and has:', numTreeNodes); + + var parentWidth = document.getElementById('editFamily').offsetWidth; + + console.log(parentWidth, document.getElementById('passages').offsetWidth); + if(!parentWidth) + parentWidth = document.body.offsetWidth - 483; + + console.log(parentWidth, Math.min(200 + 40*numTreeNodes,parentWidth-200) + 200); + + dTree.init(treeData, { + target: "#graph", + debug: true, + height: 50 + 50*treeDepth, /* very rough heuristics */ + width: Math.min(200 + 40*numTreeNodes, + parentWidth-200) + 200, + callbacks: { + nodeClick: function(name, extra) { + } + } }); }; diff --git a/src/js/foreachMacroJS.tw b/src/js/foreachMacroJS.tw index ce497a4907768e3974b8cc3eb748ff8c182c60ef..7453ee70cff5b43bd8b42b6424c6106c6da096b4 100644 --- a/src/js/foreachMacroJS.tw +++ b/src/js/foreachMacroJS.tw @@ -2,15 +2,15 @@ Macro.add('foreach', { skipArgs : true, - tags : null, - + tags : null, + handler() { - const payload = this.payload[0].contents.replace(/\n$/, ''); - let statement = this.args.raw.trim(); + const payload = this.payload[0].contents.replace(/\n$/, ''); + let statement = this.args.raw.trim(); let variable; let array; let result; - + if (statement.length !== 0) { const parts = statement.match(/^(\S+?)\s+of\s+(\S.*?)\s*$/i); if(parts !== null) { @@ -21,24 +21,24 @@ Macro.add('foreach', { if(!variable || !array) { return this.error('invalid syntax, format: <<foreach variable of array-expression>>... <</foreach>>'); } - + try { result = Scripting.evalTwineScript(array); } catch (ex) { return this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`); } - + let resultLength = result['length']; - + // We don't check for "instanceof Array" to also be able to pass arguments or other strange objects if(typeof resultLength !== 'number' || (resultLength % 1) !== 0) { return this.error("bad evaluation: '" + result + "' is not an array or array-like object"); } - + if(resultLength > Config.macros.maxLoopIterations) { return this.error('Array too large for maxLoopIterations (' + resultLength + ' > ' + Config.macros.maxLoopIterations + ')'); } - + if(!new RegExp(`^(${Patterns.variable})$`).test(variable)) { return this.error('not a variable identifier: ' + variable); } @@ -49,7 +49,7 @@ Macro.add('foreach', { } Config.debug && this.debugView.modes({block: true}); - + payload.replace(/^\n/, ''); for(let i = 0; i < resultLength; ++ i) { Wikifier.setValue(variable, result[i]); diff --git a/src/js/fresult.tw b/src/js/fresult.tw index c0f73efc8e2453706c84302c1932bcbcb055a63d..2721c0956a05a85a71bcf0b6c690b780ab488aaf 100644 --- a/src/js/fresult.tw +++ b/src/js/fresult.tw @@ -13,13 +13,13 @@ window.FResult = (function() { function FResult(slave) { V = State.variables; incest_bonus = V.arcologies[0].FSEgyptianRevivalist > 20 || V.arcologies[0].FSEgyptianRevivalistIncestPolicy === 1; - + calcUseWeights(slave); if (!slave.fuckdoll) calcNotFuckdoll(slave); else V.FResult += slave.fuckdoll/10; - + V.FResult += Math.max(0, slave.aphrodisiacs) * 2; if (slave.inflationType === "aphrodisiac") @@ -30,7 +30,7 @@ window.FResult = (function() { if (slave.nipples === "fuckable") calcFuckableTits(slave); - + if (V.seeAge === 1) calcAge(slave); if (slave.fetish === "mindbroken") @@ -113,7 +113,7 @@ window.FResult = (function() { }); if (fre !== -1) V.FResult += 1; } - + function calcWorksWithRival(slave) { const en = V.slaves.findIndex(s => { return isRivalP(slave, s) && sameAssignmentP(slave, s); @@ -158,7 +158,7 @@ window.FResult = (function() { if (slave.clitPiercing > 2) V.FResult += 1; if (slave.fetishKnown === 1 && slave.fetishStrength > 60 && slave.fetish != "none") V.FResult += slave.fetishStrength/5; - + if (slave.attrKnown === 1) { V.FResult += Math.trunc(slave.attrXX/20); V.FResult += Math.trunc(slave.attrXY/20); @@ -192,6 +192,15 @@ window.FResult = (function() { V.FResult -= 1; } + function calcHearing(slave) { + if (!canHear(slave)) V.FResult -= 2; + else if (slave.hears <= -1) { + if (slave.earwear !== "hearing aids") + V.FResult -= 1; + } else if (slave.earwear === "muffling ear plugs") + V.FResult -= 1; + } + function calcEgyptianBonus(slave) { if (V.racialVarieties === undefined) V.racialVarieties = []; if (!V.racialVarieties.includes(slave.race)) @@ -225,6 +234,7 @@ window.FResult = (function() { calcSexAttributes(slave); calcCareer(slave); calcSight(slave); + calcHearing(slave); if (V.arcologies[0].FSEgyptianRevivalist !== "unset") calcEgyptianBonus(slave); if (V.arcologies[0].FSYouthPreferentialist !== "unset") @@ -232,7 +242,7 @@ window.FResult = (function() { else if (V.arcologies[0].FSMaturityPreferentialist !== "unset") calcMatureBonus(slave); } - + function calcAge(slave) { if ((V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset") && slave.physicalAge === V.minimumSlaveAge && slave.physicalAge === V.fertilityAge && canGetPregnant(slave)) { V.FResult += 1; @@ -250,7 +260,7 @@ window.FResult = (function() { V.FResult += 0.1*V.FResult; } } - + function calcAmputation(slave) { switch(slave.amp) { case 0: @@ -266,7 +276,7 @@ window.FResult = (function() { V.FResult -= 1; } } - + function calcHedonismWeight(slave) { if (slave.weight < 10) V.FResult -= 2; diff --git a/src/js/hTagMacroJS.tw b/src/js/hTagMacroJS.tw index 4678c57730faaefc00683060b51fe5d9b94d9907..d33e0f20e8ee26ed9d4e72a8df50050af3fccc8b 100644 --- a/src/js/hTagMacroJS.tw +++ b/src/js/hTagMacroJS.tw @@ -3,16 +3,16 @@ /* * <<htag>> macro * A simple macro which allows to create wrapping html elements with dynamic IDs. - * idea blatantly robbed from the spanMacroJS.tw but expanded to a more generic - * case, allowing <div>, <button> or whatever you want. elements, default is for - * the div though. In addition, you can pass an object in as the first argument - * instead of an id, and each of the object's attributes will become attributes - * of the generate tag. + * idea blatantly robbed from the spanMacroJS.tw but expanded to a more generic + * case, allowing <div>, <button> or whatever you want. elements, default is for + * the div though. In addition, you can pass an object in as the first argument + * instead of an id, and each of the object's attributes will become attributes + * of the generate tag. * - * Usage: <<htag id>>...<</htag>> - * Usage: <<htag id tag>>...<</htag>> - * Usage: <<htag attributes>>...<</htag>> - * Usage: <<htag attributes tag>>...<</htag>> + * Usage: <<htag id>>...<</htag>> + * Usage: <<htag id tag>>...<</htag>> + * Usage: <<htag attributes>>...<</htag>> + * Usage: <<htag attributes tag>>...<</htag>> */ Macro.add('htag', { tags: null, @@ -20,13 +20,13 @@ Macro.add('htag', { const payload = this.payload[0].contents.replace(/(^\n+|\n+$)/, ''); let htag = 'div'; let attributes; - function munge (val, key) { - return key + '="' + val + '"'; + function munge (val, key) { + return key + '="' + val + '"'; } - - if (1 > this.args.length) + + if (1 > this.args.length) return this.error('invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>'); - if (1 < this.args.length) + if (1 < this.args.length) htag = String(this.args[1]).trim(); if ("object" === typeof this.args[0]) attributes = $.map(this.args[0], munge).join(" "); @@ -34,7 +34,7 @@ Macro.add('htag', { attributes = 'id="' + String(this.args[0]).trim() + '"'; if (Config.debug) this.debugView.modes({block: true}); - + jQuery('<' + htag + ' ' + attributes + ' />') .wiki(payload) .appendTo(this.output); diff --git a/src/js/heroCreator.tw b/src/js/heroCreator.tw index 302ff213c4b89603725d18ab7f7a2d349d6d229b..8d2d7c9c8b9696cae77c41d4d2304862333cacd9 100644 --- a/src/js/heroCreator.tw +++ b/src/js/heroCreator.tw @@ -1,9 +1,9 @@ :: heroCreator.tw [script] window.getHeroSlave = function(heroSlave, baseHeroSlave) { - var newSlave = clone(baseHeroSlave); - for (var attrname in heroSlave) { - newSlave[attrname] = heroSlave[attrname]; - }; - return newSlave; + var newSlave = clone(baseHeroSlave); + for (var attrname in heroSlave) { + newSlave[attrname] = heroSlave[attrname]; + }; + return newSlave; } diff --git a/src/js/pregJS.tw b/src/js/pregJS.tw index 9a1b78df150478564bca570a1b39ab0ae32d3f15..8bf49e44f06986d7d1068a364d5d5634adb2afd6 100644 --- a/src/js/pregJS.tw +++ b/src/js/pregJS.tw @@ -1,11 +1,11 @@ :: pregJS [script] -/*Major props to the anons who worked together to forge the Super Pregnancy Project. Let your legacy go unforgotten.*/ +/* Major props to the anons who worked together to forge the Super Pregnancy Project. Let your legacy go unforgotten.*/ window.getPregBellySize = function(s) { var gestastionWeek = s.preg; var fetuses = s.pregType; var phi = 1.618; - + if(gestastionWeek <= 32) { var targetLen = ((0.00006396 * Math.pow(gestastionWeek, 4)) - (0.005501 * Math.pow(gestastionWeek, 3)) + (0.161 * Math.pow(gestastionWeek, 2)) - (0.76 * gestastionWeek) + 0.208); } else if(gestastionWeek <= 106) { @@ -13,7 +13,7 @@ window.getPregBellySize = function(s) { } else { var targetLen = ((-0.00003266 * Math.pow(gestastionWeek,2)) + (0.076 * gestastionWeek) + 43.843); } - + var bellySize = ((4 / 3) * (Math.PI) * (phi / 2) * (Math.pow((targetLen / 2), 3)) * fetuses); return bellySize; }; @@ -64,13 +64,13 @@ window.bellyAdjective = function(slave) { /* calculates and returns expected ovum count during conception*/ window.setPregType = function(actor) { /* IMHO rework is posssible. Can be more interesting to play, if this code will take in account more body conditions - age, fat, food, hormone levels, etc. */ - + var ovum = 1; var fertilityStack = 0; // adds an increasing bonus roll for stacked fertility drugs if(actor.broodmother < 1) { // Broodmothers should be not processed here. Necessary now. if(typeof actor.readyOva == "number" && actor.readyOva != 0) { - ovum = actor.readyOva; //just single override; for delayed impregnation cases + ovum = actor.readyOva; //just single override; for delayed impregnation cases } else if(actor.ID == -1) { if(actor.birthMaster > 0) { // Predisposed to twins if(actor.fertDrugs == 1) { @@ -155,17 +155,17 @@ window.knockMeUp = function(target, chance, hole, fatherID, displayOverride) { if (V.seePreg !== 0) { if (jsRandom(0,99) < (chance + (V.reproductionFormula*((target.pregSource <= 0) ? ((target.ID == -1) ? 0 : 10) : 20)))) { if (target.mpreg === hole) { - + target.preg = 1; target.pregSource = (!fatherID ? 0 : fatherID); - + if (target.ID !== -1) { target.pregWeek = 1; } - + target.pregType = setPregType(target); WombImpregnate(target, target.pregType, target.pregSource, 1); - + if (V.menstruation === 1) {} else if (!displayOverride) { target.pregKnown = 1; @@ -179,19 +179,19 @@ window.knockMeUp = function(target, chance, hole, fatherID, displayOverride) { } else { target.pregKnown = 1; } - + } else if (hole === 2) { - + target.preg = 1; target.pregSource = (!fatherID ? 0 : fatherID); - + if (target.ID !== -1) { target.pregWeek = 1; } - + target.pregType = setPregType(target); WombImpregnate(target, target.pregType, target.pregSource, 1); - + if (V.menstruation === 1) {} else if (!displayOverride) { target.pregKnown = 1; diff --git a/src/js/quickListJS.tw b/src/js/quickListJS.tw index a712681b18ba7ff44f59ff237990e402c7b3f23d..45e4a00b315679b774c8e3c705d9010a4beb48aa 100644 --- a/src/js/quickListJS.tw +++ b/src/js/quickListJS.tw @@ -6,7 +6,7 @@ window.sortDomObjects = function (objects, attrName, reverse = 0) { var aVal = a.getAttribute(attrName); var bVal = b.getAttribute(attrName); var aInt = parseInt(aVal); - if (!isNaN(aInt)) + if (!isNaN(aInt)) return ((parseInt(bVal) - aInt) * reverse); else if (bVal > aVal) return -1 * reverse; @@ -34,8 +34,8 @@ window.quickListBuildLinks = function () { var $this = $(this), $toElement = $this.attr('data-scroll-to'); // note the * 1 enforces $offset to be an integer, without // it we scroll to True, which goes nowhere fast. - var $offset = $this.attr('data-scroll-offset') * 1 || 0; - var $speed = $this.attr('data-scroll-speed') * 1 || 500; + var $offset = $this.attr('data-scroll-offset') * 1 || 0; + var $speed = $this.attr('data-scroll-speed') * 1 || 500; // Use javascript scrollTop animation for in page navigation. $('html, body').animate({ scrollTop: $($toElement).offset().top + $offset @@ -71,9 +71,9 @@ window.sortIncubatorPossiblesByPreviousSort = function () { var sort = State.variables.sortIncubatorList; console.log(State.variables); console.log('sort', sort); - if ('unsorted' !== sort) { + if ('unsorted' !== sort) { console.log("sort isn't unsorted", sort); - if ('Name' === sort) { + if ('Name' === sort) { console.log("sort is name", sort); sortIncubatorPossiblesByName(); } else if ('Reserved Incubator Spots' === sort) { diff --git a/src/js/rbuttonJS.tw b/src/js/rbuttonJS.tw index e0ef1586c17d5dbc846ccc901e6e274d03f546cf..1668d21900a7e3de24d8535b00b1881b8c654ed3 100644 --- a/src/js/rbuttonJS.tw +++ b/src/js/rbuttonJS.tw @@ -11,65 +11,63 @@ Group of radiobutton will be created based on variable name. Checked state will Macro.add('rbutton', { handler() { - if (this.args.length < 2) { + if (this.args.length < 2) { const errors = []; if (this.args.length < 1) { errors.push('variable name'); } if (this.args.length < 2) { errors.push('checked value'); } return this.error(`no ${errors.join(' or ')} specified`); - } + } - // Ensure that the variable name argument is a string. - if (typeof this.args[0] !== 'string') { + // Ensure that the variable name argument is a string. + if (typeof this.args[0] !== 'string') { return this.error('variable name argument is not a string'); - } + } - const varName = this.args[0].trim(); + const varName = this.args[0].trim(); - // Try to ensure that we receive the variable's name (incl. sigil), not its value. - if (varName[0] !== '$' && varName[0] !== '_') { + // Try to ensure that we receive the variable's name (incl. sigil), not its value. + if (varName[0] !== '$' && varName[0] !== '_') { return this.error(`variable name "${this.args[0]}" is missing its sigil ($ or _)`); - } + } - const initValue = Wikifier.getValue(this.args[0]); - const varId = Util.slugify(varName); - const checkValue = this.args[1]; - const el = document.createElement('input'); + const initValue = Wikifier.getValue(this.args[0]); + const varId = Util.slugify(varName); + const checkValue = this.args[1]; + const el = document.createElement('input'); - var replaceID = ""; - var replaceText = ""; - if (typeof this.args[2] === 'string') { + var replaceID = ""; + var replaceText = ""; + if (typeof this.args[2] === 'string') { replaceID = this.args[2]; - } - if (typeof this.args[3] === 'string') { + } + if (typeof this.args[3] === 'string') { replaceText = this.args[3]; - } + } - - - /* + /* Setup and initialize the group counter. - */ - if (!TempState.hasOwnProperty(this.name)) { + */ + if (!TempState.hasOwnProperty(this.name)) { TempState[this.name] = {}; - } + } - if (!TempState[this.name].hasOwnProperty(varId)) { + if (!TempState[this.name].hasOwnProperty(varId)) { TempState[this.name][varId] = 0; - } + } - /* + /* Setup and append the input element to the output buffer. - */ - jQuery(el) + */ + jQuery(el) .attr({ - id : `${this.name}-${varId}-${TempState[this.name][varId]++}`, - name : `${this.name}-${varId}`, - type : 'radio', - tabindex : 0 // for accessiblity + id : `${this.name}-${varId}-${TempState[this.name][varId]++}`, + name : `${this.name}-${varId}`, + type : 'radio', + tabindex : 0 // for accessiblity }) .addClass(`macro-${this.name}`) .on('change', function () { - if (this.checked) { + if (this.checked) { Wikifier.setValue(varName, checkValue); if (replaceID.length > 0 && replaceText.length > 0){ @@ -81,7 +79,7 @@ Macro.add('rbutton', { } } - } + } }) .ready (function () { //alert ("DOM finished"); @@ -97,12 +95,12 @@ Macro.add('rbutton', { }) .appendTo(this.output); - /* + /* Set the story variable to the checked value and the input element to checked, if requested. - */ - if (initValue == checkValue) { + */ + if (initValue == checkValue) { el.checked = true; Wikifier.setValue(varName, checkValue); - } + } } - }); + }); diff --git a/src/js/removeActiveSlave.tw b/src/js/removeActiveSlave.tw index a5189210c9f1e1a64467b05b13c7bf8f4378d0a4..6b8c3db5675fdfab8d607309771e9d16b04cdef2 100644 --- a/src/js/removeActiveSlave.tw +++ b/src/js/removeActiveSlave.tw @@ -95,9 +95,9 @@ window.removeActiveSlave = function removeActiveSlave() { slave.rivalryTarget = 0; } /* moved to saDevotion as a discovery event - if (slave.origBodyOwnerID === AS_ID) { - slave.origBodyOwnerID = 0; - } + if (slave.origBodyOwnerID === AS_ID) { + slave.origBodyOwnerID = 0; + } */ }); @@ -160,7 +160,7 @@ window.removeActiveSlave = function removeActiveSlave() { V.traitor.origBodyOwnerID = 0; } } - + let _o = V.organs.findIndex(function(s) { return s.ID === V.activeSlave.ID; }); if (_o !== -1) { V.organs.deleteAt(_o); @@ -169,7 +169,7 @@ window.removeActiveSlave = function removeActiveSlave() { if (_o !== -1) { V.limbs.deleteAt(_o); } - + const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === V.activeSlave.ID; }); if (_geneIndex !== -1) { let keep = false; @@ -193,11 +193,11 @@ window.removeActiveSlave = function removeActiveSlave() { V.genePool.deleteAt(_geneIndex); } } - + removeSlave(INDEX); LENGTH--; V.activeSlave = 0; - + if (missing) { V.missingParentID--; } diff --git a/src/js/rulesAssistant.tw b/src/js/rulesAssistant.tw index d7c116286504c7916fc744a742aa7ca0979633cd..2eed0d516a78edff756a14740f450080c2b695ff 100644 --- a/src/js/rulesAssistant.tw +++ b/src/js/rulesAssistant.tw @@ -31,9 +31,9 @@ window.mergeRules = function mergeRules(rules) { const combinedRule = {}; rules.forEach(rule => { // A rule overrides any preceding ones if, - // * there are no preceding ones, - // * or it sets autoBrand, - // * or it does not set autoBrand and is not "no default setting" + // * there are no preceding ones, + // * or it sets autoBrand, + // * or it does not set autoBrand and is not "no default setting" Object.keys(rule).forEach(key => { const applies = (combinedRule[key] === undefined || (key === "autoBrand" && rule[key]) || @@ -261,10 +261,12 @@ window.emptyDefaultRule = function emptyDefaultRule() { pornFameSpending: "no default setting", dietGrowthSupport: 0, eyewear: "no default setting", + earwear: "no default setting", setAssignment: "no default setting", facilityRemove: false, removalAssignment: "rest", surgery_eyes: "no default setting", + surgery_hears: "no default setting", surgery_lactation: "no default setting", surgery_prostate: "no default setting", surgery_cosmetic: "no default setting", @@ -297,7 +299,6 @@ window.emptyDefaultRule = function emptyDefaultRule() { return rule; }; - // Saves the slave, silently fires the RA, saves the slave's after-RA state, and then reverts the slave. // Call and then check potential change against $slaveAfterRA to see if the RA would revert it. window.RulesDeconfliction = function RulesDeconfliction(slave) { diff --git a/src/js/rulesAutosurgery.tw b/src/js/rulesAutosurgery.tw index 1fca30407d82fd396b98964fcb84574cd40572f9..be9ad3f584ec00873ad80354e16773e8df513598 100644 --- a/src/js/rulesAutosurgery.tw +++ b/src/js/rulesAutosurgery.tw @@ -17,7 +17,7 @@ window.rulesAutosurgery = (function() { PrintResult(slave, thisSurgery, surgeries); return r; } - + function autoSurgerySelector(slave, ruleset) { const surgery = {}; ruleset.forEach(rule => { @@ -132,42 +132,56 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.eyes == 1) && (thisSurgery.surgery_eyes == -1)) { surgeries.push("surgery to blur her vision"); slave.eyes = -1; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + + } else if ((slave.hears == -1) && (thisSurgery.surgery_hears == 1)) { + surgeries.push("surgery to correct her hearing"); + slave.hears = 0; + V.cash -= V.surgeryCost; + if (V.PC.medicine >= 100) slave.health -= 5; + else slave.health -= 10; + + } else if ((slave.hears == 0) && (thisSurgery.surgery_hears == -1)) { + surgeries.push("surgery to muffle her hearing"); + slave.hears = -1; + V.cash -= V.surgeryCost; + if (V.PC.medicine >= 100) slave.health -= 5; + else slave.health -= 10; + } else if ((slave.lactation == 2) && (thisSurgery.surgery_lactation == 0)) { surgeries.push("surgery to remove her lactation implants"); slave.lactation = 0; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if (slave.lactation != 2 && (thisSurgery.surgery_lactation == 1)) { surgeries.push("lactation inducing implanted drugs"); slave.lactation = 2; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.prostate == 2) && (thisSurgery.surgery_prostate == 0)) { surgeries.push("surgery to remove her prostate implant"); slave.prostate = 0; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if (slave.prostate == 1 && (thisSurgery.surgery_prostate == 1)) { surgeries.push("a precum production enhancing drug implant"); slave.prostate = 2; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.anus > 3) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("a restored anus"); slave.anus = 3; @@ -176,7 +190,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.vagina > 3) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("a restored pussy"); slave.vagina = 3; @@ -185,7 +199,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.faceImplant <= 15) && (slave.face <= 95) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("a nicer face"); if (slave.faceShape == "masculine") slave.faceShape = "androgynous"; @@ -194,7 +208,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.faceImplant <= 15) && (slave.ageImplant != 1) && (slave.visualAge >= 25) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("an age lift"); slave.ageImplant = 1; @@ -207,26 +221,26 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if (((slave.underArmHStyle != "bald" && slave.underArmHStyle != "hairless") || (slave.pubicHStyle != "bald" && slave.pubicHStyle != "hairless")) && (thisSurgery.surgery_bodyhair == 2)) { surgeries.push("body hair removal"); if (slave.underArmHStyle != "hairless") slave.underArmHStyle = "bald"; if (slave.pubicHStyle != "hairless") slave.pubicHStyle = "bald"; V.cash -= V.surgeryCost; - + } else if ((slave.bald == 0 || slave.hStyle != "bald") && (thisSurgery.surgery_hair == 2)) { surgeries.push("hair removal"); slave.hStyle = "bald"; slave.bald = 1; V.cash -= V.surgeryCost; - + } else if ((slave.weight >= 10) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("liposuction"); slave.weight -= 50; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.voice == 1) && (slave.voiceImplant == 0) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("a feminine voice"); slave.voice += 1; @@ -234,14 +248,14 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.waist >= -10) && (thisSurgery.surgery_cosmetic > 0)) { surgeries.push("a narrower waist"); slave.waist -= 20; V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if (((slave.boobShape == "saggy") || (slave.boobShape == "downward-facing")) && (thisSurgery.surgery_cosmetic > 0) && (slave.breastMesh != 1)) { surgeries.push("a breast lift"); slave.boobShape = "normal"; @@ -258,7 +272,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((thisSurgery.surgery_lips == 0) && (slave.lipsImplant > 0)) { surgeries.push("surgery to remove her lip implants"); slave.lips -= slave.lipsImplant; @@ -268,7 +282,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.lips <= 95) && (slave.lips < thisSurgery.surgery_lips)) { if (thisSurgery.surgery_lips !== "no default setting") { surgeries.push("bigger lips"); @@ -280,7 +294,7 @@ window.rulesAutosurgery = (function() { if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; } - + } else if ((slave.faceImplant <= 45) && (slave.face <= 95) && (thisSurgery.surgery_cosmetic == 2)) { surgeries.push("a nicer face"); if (slave.faceShape == "masculine") slave.faceShape = "androgynous"; @@ -289,7 +303,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.hips < 1) && (slave.hips < thisSurgery.surgery_hips) && (V.surgeryUpgrade == 1)) { surgeries.push("wider hips"); slave.hips++; @@ -297,7 +311,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.faceImplant <= 45) && (slave.ageImplant != 1) && (slave.visualAge >= 25) && (thisSurgery.surgery_cosmetic == 2)) { surgeries.push("an age lift"); slave.ageImplant = 1; @@ -316,14 +330,14 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.waist >= -95) && (thisSurgery.surgery_cosmetic == 2) && (V.seeExtreme == 1)) { surgeries.push("a narrower waist"); slave.waist = Math.clamp(slave.waist-20,-100,100); V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.voice < 3) && (slave.voiceImplant == 0) && (thisSurgery.surgery_cosmetic == 2)) { surgeries.push("a bimbo's voice"); slave.voice += 1; @@ -331,7 +345,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((thisSurgery.surgery_butt == 0) && (slave.buttImplant > 0)) { surgeries.push("surgery to remove her butt implants"); slave.butt -= slave.buttImplant; @@ -340,7 +354,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((thisSurgery.surgery_boobs == 0) && (slave.boobsImplant > 0)) { surgeries.push("surgery to remove her boob implants"); slave.boobs -= slave.boobsImplant; @@ -376,7 +390,7 @@ window.rulesAutosurgery = (function() { if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; } - + } else if ((slave.butt <= 5) && (slave.butt < thisSurgery.surgery_butt)) { if (thisSurgery.surgery_butt !== "no default setting") { surgeries.push("a bigger butt"); @@ -386,7 +400,7 @@ window.rulesAutosurgery = (function() { if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; } - + } else if ((slave.boobs <= 2000) && (slave.lactation < 2) && (slave.boobs+400 < thisSurgery.surgery_boobs)) { if (thisSurgery.surgery_boobs !== "no default setting") { surgeries.push("bigger boobs"); @@ -396,7 +410,7 @@ window.rulesAutosurgery = (function() { if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; } - + } else if ((slave.anus > 0) && (V.surgeryUpgrade == 1) && (thisSurgery.surgery_holes == 2)) { surgeries.push("a virgin anus"); slave.anus = 0; @@ -406,7 +420,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.vagina > 0) && (V.surgeryUpgrade == 1) && (thisSurgery.surgery_holes == 2)) { surgeries.push("a virgin pussy"); slave.vagina = 0; @@ -415,7 +429,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.hips < 2) && (slave.hips < thisSurgery.surgery_hips) && (V.surgeryUpgrade == 1)) { surgeries.push("wider hips"); slave.hips++; @@ -423,7 +437,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.anus > 1) && (thisSurgery.surgery_holes == 1)) { surgeries.push("a tighter anus"); slave.anus = 1; @@ -433,7 +447,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.vagina > 1) && (thisSurgery.surgery_holes == 1)) { surgeries.push("a tighter pussy"); slave.vagina = 1; @@ -443,7 +457,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if ((slave.butt <= 8) && (slave.butt < thisSurgery.surgery_butt)) { if (thisSurgery.surgery_butt !== "no default setting") { surgeries.push("a bigger butt"); @@ -453,7 +467,7 @@ window.rulesAutosurgery = (function() { if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; } - + } else if ((slave.boobs <= 9000) && (slave.lactation < 2) && (slave.boobs < thisSurgery.surgery_boobs)) { if (thisSurgery.surgery_boobs !== "no default setting") { surgeries.push("bigger boobs"); @@ -463,7 +477,7 @@ window.rulesAutosurgery = (function() { if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; } - + } else if ((slave.hips < 3) && (slave.hips < thisSurgery.surgery_hips) && (V.surgeryUpgrade == 1)) { surgeries.push("wider hips"); slave.hips++; @@ -471,7 +485,7 @@ window.rulesAutosurgery = (function() { V.cash -= V.surgeryCost; if (V.PC.medicine >= 100) slave.health -= 5; else slave.health -= 10; - + } else if (slave.bellyImplant < 0 && V.bellyImplants > 0 && thisSurgery.surgery_bellyImplant == "install" && slave.womb.length == 0 && slave.broodmother == 0) { slave.bellyImplant = 100; slave.preg = -2; @@ -488,7 +502,7 @@ window.rulesAutosurgery = (function() { else slave.health -= 50; } bellyIn(slave); - + } else if (slave.bellyImplant >= 0 && thisSurgery.surgery_bellyImplant == "remove") { surgeries.push("belly implant removal"); V.surgeryType = "bellyOut"; diff --git a/src/js/slaveGenerationJS.tw b/src/js/slaveGenerationJS.tw index 0f51b03f2f988cc597cff0a422e74df4deabd3b3..dda6d8d217e51e0f0522a793a909ad58cb7b5741 100644 --- a/src/js/slaveGenerationJS.tw +++ b/src/js/slaveGenerationJS.tw @@ -192,19 +192,19 @@ window.nationalityToAccent = function nationalityToAccent(slave) { slave.accent = (V.language === "English") ? jsEither([0, 1, 1, 1, 2]) : naturalAccent; break; case "Beninese": - slave.accent = (V.language === "French") ? 1 : naturalAccent; + slave.accent = (V.language === "French") ? jsEither([0, 1, 1, 1, 2]) : naturalAccent; break; case "Bermudian": - slave.accent = (V.language === "English") ? 1 : naturalAccent; + slave.accent = (V.language === "English") ? jsEither([0, 1, 1, 1, 2]) : naturalAccent; break; case "Bhutanese": slave.accent = (V.language === "Dzongkha") ? jsEither([0, 0, 0, 1]) : naturalAccent; break; case "Bissau-Guinean": - slave.accent = (V.language === "Portuguese") ? 1 : naturalAccent; + slave.accent = (V.language === "Portuguese") ? jsEither([0, 1, 1, 1, 2]) : naturalAccent; break; case "Bolivian": - slave.accent = (V.language === "Spanish") ? 1 : naturalAccent; + slave.accent = (V.language === "Spanish") ? jsEither([0, 1, 1, 1, 2]) : naturalAccent; break; case "Bosnian": slave.accent = naturalAccent; diff --git a/src/js/spanMacroJS.tw b/src/js/spanMacroJS.tw index fde8e0cfed0309ee8f2698335065f076d1cb30a4..47dd2b5c19b63077c28f83d0e7bb5896079e57c6 100644 --- a/src/js/spanMacroJS.tw +++ b/src/js/spanMacroJS.tw @@ -8,25 +8,25 @@ */ Macro.add('span', { skipArgs : true, - tags : null, - + tags : null, + handler() { - const payload = this.payload[0].contents.replace(/(^\n+|\n+$)/, ''); - let statement = this.args.raw.trim(); + const payload = this.payload[0].contents.replace(/(^\n+|\n+$)/, ''); + let statement = this.args.raw.trim(); let result; - + if(statement.length === 0) { return this.error('invalid syntax, format: <<span id>>'); } - + try { result = Scripting.evalTwineScript(statement); } catch (ex) { return this.error(`bad evaluation: ${typeof ex === 'object' ? ex.message : ex}`); } - + Config.debug && this.debugView.modes({block: true}); - + jQuery("<span id='" + String(result) + "' />") .wiki(payload) .appendTo(this.output); diff --git a/src/js/storyJS.tw b/src/js/storyJS.tw index da4ea778ba76b1703332fe98c7ac18b527a14e94..e432e24958201e1cf4ca7cd9585fefcae0f85be2 100644 --- a/src/js/storyJS.tw +++ b/src/js/storyJS.tw @@ -279,7 +279,7 @@ window.canImpreg = function(slave1, slave2) { } else if (slave2.vasectomy == 1) { return false; } else if (!canBreed(slave1, slave2)) { - return false; /* pregmod end */ + return false; /* pregmod end */ } else if (!canGetPregnant(slave1)) { /* includes chastity checks */ return false; } else { @@ -310,7 +310,7 @@ window.isFertile = function(slave) { } else if (slave.bellyImplant != -1) { return false; } else if (slave.mpreg == 1) { - return true; /* pregmod end */ + return true; /* pregmod end */ } else if (slave.ovaries == 1) { return true; } else { @@ -367,10 +367,20 @@ window.canSee = function(slave) { } }; +window.canHear = function(slave) { + if (!slave) { + return null; + } else if ((slave.hears > -2) || (slave.earwear == "deafening ear plugs")) { + return true; + } else { + return false; + } +}; + window.canWalk = function(slave) { if (!slave) { return null; - } else if (slave.amp == 1) { + } else if (slave.amp == 1) { return false; } else if (tooFatSlave(slave)) { return false; @@ -400,7 +410,7 @@ window.canWalk = function(slave) { window.canTalk = function(slave) { if (!slave) { return null; - } else if (slave.accent > 2) { + } else if (slave.accent > 2) { return false; } else if (slave.voice == 0) { return false; @@ -706,7 +716,6 @@ window.isItemAccessible = function(string) { } }; - window.expandFacilityAssignments = function(facilityAssignments) { var assignmentPairs = { "serve in the club": "be the DJ", @@ -927,23 +936,23 @@ window.bodyguardSuccessorEligible = function(slave) { }; window.ngUpdateGenePool = function(genePool) { - var transferredSlaveIds = (State.variables.slaves || []) - .filter(function(s) { return s.ID >= 1200000; }) - .map(function(s) { return s.ID - 1200000; }); - return (genePool || []) - .filter(function(s) { return transferredSlaveIds.indexOf(s.ID) >= 0; }) - .map(function(s) { - var result = jQuery.extend(true, {}, s); - result.ID += 1200000; - return result; - }); + var transferredSlaveIds = (State.variables.slaves || []) + .filter(function(s) { return s.ID >= 1200000; }) + .map(function(s) { return s.ID - 1200000; }); + return (genePool || []) + .filter(function(s) { return transferredSlaveIds.indexOf(s.ID) >= 0; }) + .map(function(s) { + var result = jQuery.extend(true, {}, s); + result.ID += 1200000; + return result; + }); } window.toJson = function(obj) { - var jsontext = JSON.stringify(obj); - jsontext = jsontext.replace(/^{/,""); - jsontext = jsontext.replace(/}$/,""); - return jsontext; + var jsontext = JSON.stringify(obj); + jsontext = jsontext.replace(/^{/,""); + jsontext = jsontext.replace(/}$/,""); + return jsontext; }; window.nippleColor = function(slave) { @@ -991,13 +1000,13 @@ window.overpowerCheck = function(slave, PC) { } strength += (185-slave.height); strength -= (PC.belly/1000); - + return strength; } window.impregnatedBy = function(slave) { /* returns array of IDs of all characters who impregnated slave */ var IDArray = []; - if (!Array.isArray(slave.womb)) { + if (!Array.isArray(slave.womb)) { WombInit(slave); } for (var i = 0; i < slave.womb.length; i++) { @@ -1056,31 +1065,31 @@ window.SoftenBehavioralFlaw = function SoftenBehavioralFlaw(slave) { window.SoftenSexualFlaw = function SoftenSexualFlaw(slave) { switch (slave.sexualFlaw) { case "hates oral": - slave.sexualQuirk = "gagfuck queen"; + slave.sexualQuirk = "gagfuck queen"; break; case "hates anal": - slave.sexualQuirk = "painal queen"; + slave.sexualQuirk = "painal queen"; break; case "hates penetration": - slave.sexualQuirk = "strugglefuck queen"; + slave.sexualQuirk = "strugglefuck queen"; break; case "shamefast": - slave.sexualQuirk = "tease"; + slave.sexualQuirk = "tease"; break; case "idealistic": - slave.sexualQuirk = "romantic"; + slave.sexualQuirk = "romantic"; break; case "repressed": - slave.sexualQuirk = "perverted"; + slave.sexualQuirk = "perverted"; break; case "apathetic": - slave.sexualQuirk = "caring"; + slave.sexualQuirk = "caring"; break; case "crude": - slave.sexualQuirk = "unflinching"; + slave.sexualQuirk = "unflinching"; break; case "judgemental": - slave.sexualQuirk = "size queen"; + slave.sexualQuirk = "size queen"; break; } slave.sexualFlaw = "none"; diff --git a/src/js/textInput.tw b/src/js/textInput.tw index e148eef1526d40f393de0ad91bfc7bbf6c13d725..5480eece77e64ca450bcb99d9dc8f298581ad10c 100644 --- a/src/js/textInput.tw +++ b/src/js/textInput.tw @@ -1,53 +1,53 @@ :: textinput [script] Macro.add("textinput", { - // Signifies that the macro is a container macro. - tags: null, - - handler: function() { - if (this.args.length < 2) { - var errors = []; - if (this.args.length < 1) { errors.push("variable name"); } - if (this.args.length < 2) { errors.push("default value"); } - return this.error("no " + errors.join(" or ") + " specified"); - } - - // Ensure that the variable name argument is a string. - if (typeof this.args[0] !== "string") { - return this.error("variable name argument is not a string"); - } - - var varName = this.args[0].trim(); - - // Try to ensure that we receive the variable's name (incl. sigil), not its value. - if (varName[0] !== "$" && varName[0] !== "_") { - return this.error("variable name '" + varName + "' is missing its sigil ($ or _)"); - } - - var that = this; - var defaultValue = this.args[1]; - var el = document.createElement("textarea"); - - // Setup and append the textarea element to the output buffer. - jQuery(el) - .attr({ - rows: 4, - // cols: 68, // instead of setting "cols" we set the `min-width` in CSS - tabindex: 0 // for accessiblity - }) - .addClass("macro-textarea") // "hijack" the .macro-textarea class - .on("input", function() { - Wikifier.setValue(varName, this.value); - if (that.payload[0].contents !== "") - Wikifier.wikifyEval(that.payload[0].contents.trim()); - }) - .appendTo(this.output); - - // Set the story variable and textarea element to the default value. - Wikifier.setValue(varName, defaultValue); - - // Ideally, we should be setting `.defaultValue` here, but IE doesn't support it, - // so we have to use `.textContent`, which is equivalent. - el.textContent = defaultValue; - } + // Signifies that the macro is a container macro. + tags: null, + + handler: function() { + if (this.args.length < 2) { + var errors = []; + if (this.args.length < 1) { errors.push("variable name"); } + if (this.args.length < 2) { errors.push("default value"); } + return this.error("no " + errors.join(" or ") + " specified"); + } + + // Ensure that the variable name argument is a string. + if (typeof this.args[0] !== "string") { + return this.error("variable name argument is not a string"); + } + + var varName = this.args[0].trim(); + + // Try to ensure that we receive the variable's name (incl. sigil), not its value. + if (varName[0] !== "$" && varName[0] !== "_") { + return this.error("variable name '" + varName + "' is missing its sigil ($ or _)"); + } + + var that = this; + var defaultValue = this.args[1]; + var el = document.createElement("textarea"); + + // Setup and append the textarea element to the output buffer. + jQuery(el) + .attr({ + rows: 4, + // cols: 68, // instead of setting "cols" we set the `min-width` in CSS + tabindex: 0 // for accessiblity + }) + .addClass("macro-textarea") // "hijack" the .macro-textarea class + .on("input", function() { + Wikifier.setValue(varName, this.value); + if (that.payload[0].contents !== "") + Wikifier.wikifyEval(that.payload[0].contents.trim()); + }) + .appendTo(this.output); + + // Set the story variable and textarea element to the default value. + Wikifier.setValue(varName, defaultValue); + + // Ideally, we should be setting `.defaultValue` here, but IE doesn't support it, + // so we have to use `.textContent`, which is equivalent. + el.textContent = defaultValue; + } }); diff --git a/src/js/textboxJS.tw b/src/js/textboxJS.tw index 569d9f3f7986659b07255ff7a1441558756feeb7..225dcfe50c078a603d3310aece0c4015e52f51aa 100644 --- a/src/js/textboxJS.tw +++ b/src/js/textboxJS.tw @@ -7,8 +7,8 @@ window.setReplaceTextboxMaxLength = function (storyVarName, maxLength) { .attr('maxlength', maxLength) .css({ 'min-width' : 'initial', - width : maxLength + 'em', - padding : '3px 2px' + width : maxLength + 'em', + padding : '3px 2px' }); }; @@ -21,8 +21,8 @@ window.setTextboxMaxLength = function (storyVarName, maxLength) { .attr('maxlength', maxLength) .css({ 'min-width' : 'initial', - width : maxLength + 'em', - padding : '3px 2px' + width : maxLength + 'em', + padding : '3px 2px' }); }; }; diff --git a/src/js/utilJS.tw b/src/js/utilJS.tw index f00ec3c0d075009f9f8e041091a7e12bacb9223f..7a13bfbb6fe279f88e5b50f89c35ae01a6e1c563 100644 --- a/src/js/utilJS.tw +++ b/src/js/utilJS.tw @@ -6,56 +6,56 @@ * Height.mean(slave) - returns the mean (expected) height for the given slave * * Height.random(nationality, race, genes, age) - returns a random height using the skew-normal distribution - * around the mean height for the given arguments + * around the mean height for the given arguments * Height.random(nationality, race, genes) - returns a random height for the given combination of an adult, as above * Height.random(slave[, options]) - returns a random height for the given slave, as above. - * The additional options object can modify how the values are generated - * in the same way setting them as global configuration would, but only for this - * specific generation. + * The additional options object can modify how the values are generated + * in the same way setting them as global configuration would, but only for this + * specific generation. * - * Example: Only generate above-average heights based on $activeSlave: - * Height.random($activeSlave, {limitMult: [0, 5]}) + * Example: Only generate above-average heights based on $activeSlave: + * Height.random($activeSlave, {limitMult: [0, 5]}) * * Height.forAge(height, age, genes) - returns the height adapted to the age and genes * Height.forAge(height, slave) - returns the height adapted to the slave's age and genes * * Height.config(configuration) - configures the random height generator globally and returns the current configuration - * The options and their default values are: - * limitMult: [-3, 3] - Limit to the values the underlying (normal) random generator returns. - * In normal use, the values are almost never reached; only 0.27% of values are - * outside this range and need to be regenerated. With higher skew (see below), - * this might change. - * spread: 0.05 - The random values generated are multiplied by this and added to 1 to generate - * the final height multiplier. The default value together with the default limitMult - * means that the generated height will always fall within (1 - 0.05 * 3) = 85% and - * (1 + 0.05 * 3) = 115% of the mean height. - * Minimum value: 0.001; maximum value: 0.5 - * skew: 0 - How much the height distribution skews to the right (positive) or left (negative) side - * of the height. - * Minimum value: -1000, maximum value: 1000 - * limitHeight: [0, 999] - Limit the resulting height range. Warning: A small height limit range - * paired with a high spread value results in the generator having to - * do lots of work generating and re-generating random heights until - * one "fits". + * The options and their default values are: + * limitMult: [-3, 3] - Limit to the values the underlying (normal) random generator returns. + * In normal use, the values are almost never reached; only 0.27% of values are + * outside this range and need to be regenerated. With higher skew (see below), + * this might change. + * spread: 0.05 - The random values generated are multiplied by this and added to 1 to generate + * the final height multiplier. The default value together with the default limitMult + * means that the generated height will always fall within (1 - 0.05 * 3) = 85% and + * (1 + 0.05 * 3) = 115% of the mean height. + * Minimum value: 0.001; maximum value: 0.5 + * skew: 0 - How much the height distribution skews to the right (positive) or left (negative) side + * of the height. + * Minimum value: -1000, maximum value: 1000 + * limitHeight: [0, 999] - Limit the resulting height range. Warning: A small height limit range + * paired with a high spread value results in the generator having to + * do lots of work generating and re-generating random heights until + * one "fits". * * Anon's explination: - *limitMult: [0, -30] + * limitMult: [0, -30] * - *This specifies a range going up from 0 to -30. It needs to go [-30, 0] instead. Same thing with [0, -5] two lines down. note: technically, this isn't true, because for some bizarre reason Height.random reverses the numbers for you if you get them wrong. But it's important to establish good habits, so. + * This specifies a range going up from 0 to -30. It needs to go [-30, 0] instead. Same thing with [0, -5] two lines down. note: technically, this isn't true, because for some bizarre reason Height.random reverses the numbers for you if you get them wrong. But it's important to establish good habits, so. * - *Skew, spread, limitMult: These are statistics things. BTW, a gaussian distribution is a normal distribution. Just a naming thing. + * Skew, spread, limitMult: These are statistics things. BTW, a gaussian distribution is a normal distribution. Just a naming thing. * - *Skew: The shape parameter of a skew-normal distribution. See http://azzalini.stat.unipd.it/SN/Intro/intro.html for more details. Basically a measure of how asymmetrical the curve is. It doesn't move the main mass of the distribution. Rather, it's more like it moves mass from one of the tails into the main mass of the distribution. + * Skew: The shape parameter of a skew-normal distribution. See http://azzalini.stat.unipd.it/SN/Intro/intro.html for more details. Basically a measure of how asymmetrical the curve is. It doesn't move the main mass of the distribution. Rather, it's more like it moves mass from one of the tails into the main mass of the distribution. * - *Spread: Changes the average distance from the mean, making the graph wider and shorter. Moves "mass" from the center to the tail. It's basically standard deviation, but named funny because FC codebase. Changing this can have dramatic effects. It's advised to keep this at or below 0.1 for usual height generation. + * Spread: Changes the average distance from the mean, making the graph wider and shorter. Moves "mass" from the center to the tail. It's basically standard deviation, but named funny because FC codebase. Changing this can have dramatic effects. It's advised to keep this at or below 0.1 for usual height generation. * - *limitMult: A clamp, expressed in z-score. (z=1 is one standard dev above mean, for ex.) If it excludes too much of the distribution the other parameters describe, you're going to spend lots of CPU making and throwing away heights. Don't worry about this unless you run into it. + * limitMult: A clamp, expressed in z-score. (z=1 is one standard dev above mean, for ex.) If it excludes too much of the distribution the other parameters describe, you're going to spend lots of CPU making and throwing away heights. Don't worry about this unless you run into it. * - *There's also limitHeight which you're not using. It's basically limitMult in different units. + * There's also limitHeight which you're not using. It's basically limitMult in different units. */ window.Height = (function(){ 'use strict'; - + // Global configuration (for different game modes/options/types) var minMult = -3.0; var maxMult = 3.0; @@ -63,7 +63,7 @@ window.Height = (function(){ var spread = 0.05; var minHeight = 0; var maxHeight = 999; - + // Configuration method for the above values const _config = function(conf) { if(_.isUndefined(conf)) { @@ -72,18 +72,18 @@ window.Height = (function(){ if(_.isFinite(conf.skew)) { skew = Math.clamp(conf.skew, -1000, 1000); } if(_.isFinite(conf.spread)) { spread = Math.clamp(conf.spread, 0.001, 0.5); } if(_.isArray(conf.limitMult) && conf.limitMult.length === 2 && conf.limitMult[0] !== conf.limitMult[1] && - _.isFinite(conf.limitMult[0]) && _.isFinite(conf.limitMult[1])) { + _.isFinite(conf.limitMult[0]) && _.isFinite(conf.limitMult[1])) { minMult = Math.min(conf.limitMult[0], conf.limitMult[1]); maxMult = Math.max(conf.limitMult[0], conf.limitMult[1]); } if(_.isArray(conf.limitHeight) && conf.limitHeight.length === 2 && conf.limitHeight[0] !== conf.limitHeight[1] && - _.isFinite(conf.limitHeight[0]) && _.isFinite(conf.limitHeight[1])) { + _.isFinite(conf.limitHeight[0]) && _.isFinite(conf.limitHeight[1])) { minHeight = Math.min(conf.limitHeight[0], conf.limitHeight[1]); maxHeight = Math.max(conf.limitHeight[0], conf.limitHeight[1]); } return {limitMult: [minMult, maxMult], limitHeight: [minHeight, maxHeight], skew: skew, spread: spread}; }; - + /* if you can find an average for an undefined, add it in! */ const xxMeanHeight = { "Afghan": 163.8, "Albanian": 161.8, "Algerian": 162, "American.asian": 158.4, "American.black": 163.6, "American.latina": 158.9, "American.white": 165, "American": 161.8, @@ -138,19 +138,19 @@ window.Height = (function(){ "Venezuelan": 169, "Vietnamese": 165.7, "Vincentian": 165.4, "Yemeni": 159.9, "Zairian": 158.9, "Zambian": undefined, "Zimbabwean": undefined, "": 172.5 // defaults }; - + // Helper method - table lookup for nationality/race combinations const nationalityMeanHeight = function(table, nationality, race, def) { return table[nationality + "." + race] || table[nationality] || table["." + race] || table[""] || def; }; - + // Helper method - generate two independent Gaussian numbers using Box-Muller transform const gaussianPair = function() { let r = Math.sqrt(-2.0 * Math.log(1 - Math.random())); let sigma = 2.0 * Math.PI * (1 - Math.random()); return [r * Math.cos(sigma), r * Math.sin(sigma)]; }; - + // Helper method: Generate a skewed normal random variable with the skew s // Reference: http://azzalini.stat.unipd.it/SN/faq-r.html const skewedGaussian = function(s) { @@ -163,7 +163,7 @@ window.Height = (function(){ let result = delta * randoms[0] + Math.sqrt(1 - delta * delta) * randoms[1]; return randoms[0] >= 0 ? result : -result; }; - + // Height multiplier generator; skewed gaussian according to global parameters const multGenerator = function() { let result = skewedGaussian(skew); @@ -172,7 +172,7 @@ window.Height = (function(){ } return result; }; - + // Helper method: Generate a height based on the mean one and limited according to config. const heightGenerator = function(mean) { let result = mean * (1 + multGenerator() * spread); @@ -221,7 +221,7 @@ window.Height = (function(){ return interpolate(2, minHeight, midAge, midHeight, age); } }; - + const _meanHeight = function(nationality, race, genes, age) { if(_.isObject(nationality)) { // We got called with a single slave as the argument @@ -258,7 +258,7 @@ window.Height = (function(){ } return applyAge(result, age, genes); }; - + const _randomHeight = function(nationality, race, genes, age) { const mean = _meanHeight(nationality, race, genes, age); // If we got called with a slave object and options, temporarily modify @@ -272,7 +272,7 @@ window.Height = (function(){ } return heightGenerator(mean); }; - + const _forAge = function(height, age, genes) { if(_.isObject(age)) { // We got called with a slave as a second argument @@ -281,7 +281,7 @@ window.Height = (function(){ return applyAge(height, age, genes); } }; - + return { mean: _meanHeight, random: _randomHeight, @@ -380,19 +380,19 @@ window.cashFormat = function(s) { }; window.isFloat = function(n){ - return n === +n && n !== (n|0); + return n === +n && n !== (n|0); }; window.isInt = function(n) { - return n === +n && n === (n|0); + return n === +n && n === (n|0); }; window.numberWithCommas = function(x) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }; window.jsRandom = function(min,max) { - return Math.floor(Math.random()*(max-min+1)+min); + return Math.floor(Math.random()*(max-min+1)+min); }; window.jsRandomMany = function (arr, count) { @@ -413,13 +413,13 @@ window.jsEither = function(choices) { //This function is alternative to clone - usage needed if nested objects present. Slower but result is separate object tree, not with reference to source object. window.deepCopy = function (o) { - var output, v, key; - output = Array.isArray(o) ? [] : {}; - for (key in o) { - v = o[key]; - output[key] = (typeof v === "object") ? deepCopy(v) : v; - } - return output; + var output, v, key; + output = Array.isArray(o) ? [] : {}; + for (key in o) { + v = o[key]; + output[key] = (typeof v === "object") ? deepCopy(v) : v; + } + return output; }; /* @@ -531,7 +531,7 @@ window.getSlaveDisplayName = function (slave) { "Mongolian", "Taiwanese", "Vietnamese"]; - var names = [slave.slaveName, slave.slaveSurname || ""]; + var names = [slave.slaveName, slave.slaveSurname || ""]; if ((1 !== State.variables.surnameOrder) && (surnamesFirstCountries.includes(slave.nationality))) names.reverse(); return names.join(" ").trim(); @@ -540,7 +540,7 @@ window.getSlaveDisplayName = function (slave) { window.getSlaveDevotionClass = function (slave) { if ((!slave) || (!State)) return undefined; - if ('mindbroken' == slave.fetish) + if ('mindbroken' == slave.fetish) return 'mindbroken'; if (slave.devotion < -95) return 'very-hateful'; @@ -574,7 +574,7 @@ window.getSlaveTrustClass = function (slave) { else if (slave.trust <= 20) return 'fearful'; else if (slave.trust <= 50) { - if (slave.devotion < -20) return 'hate-careful'; + if (slave.devotion < -20) return 'hate-careful'; else return 'careful'; } else if (slave.trust <= 95) { if (slave.devotion < -20) return 'bold'; diff --git a/src/js/vignettes.tw b/src/js/vignettes.tw index e38bafe1a37740eae8b6fea445ee4ab3f988a4a8..023c1fb278ac19c7b4b4cf2ea6eae4a5fcbafa01 100644 --- a/src/js/vignettes.tw +++ b/src/js/vignettes.tw @@ -12,7 +12,6 @@ window.GetVignette = function GetVignette(slave) { const himself = pronouns.objectReflexive; const boy = pronouns.noun; - if (slave.assignment === "whore" || slave.assignment === "work in the brothel" || slave.assignment === "be the Madam") { let seed = jsRandom(1, 10); switch (seed) { diff --git a/src/js/wombJS.tw b/src/js/wombJS.tw index 412282dc17cef3048cb9c6f86d8265db17338531..ea9fc9d33e425c48fd48caf7b007c67327d35828 100644 --- a/src/js/wombJS.tw +++ b/src/js/wombJS.tw @@ -28,24 +28,24 @@ $slave.bellyPreg = WombGetWolume($slave) - return double, with current womb volu //Init womb system. window.WombInit = function(actor) { - if (!Array.isArray(actor.womb)) { + if (!Array.isArray(actor.womb)) { //alert("creating new womb"); //debugging actor.womb = []; } - // console.log("broodmother:" + typeof actor.broodmother); - + //console.log("broodmother:" + typeof actor.broodmother); + if ( typeof actor.broodmother != "number" ) { actor.broodmother = 0; actor.broodmotherFetuses = 0; } - + if ( typeof actor.readyOva != "number" ) { actor.readyOva = 0; } //backward compatibility setup. Fully accurate for normal pregnancy only. - if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother == 0) { + if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother == 0) { WombImpregnate(actor, actor.pregType, actor.pregSource, actor.preg); } else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother > 0 && actor.broodmotherOnHold < 1) { //sorry but for already present broodmothers it's impossible to calculate fully, aproximation used. @@ -107,12 +107,12 @@ window.WombProgress = function(actor, ageToAdd) { window.WombBirth = function(actor, readyAge) { try { WombSort(actor); //For normal processing fetuses that more old should be first. Now - they are. - } catch(err){ + } catch(err){ WombInit(actor); - alert("WombBirth warning - " + actor.slaveName+" "+err); - } + alert("WombBirth warning - " + actor.slaveName+" "+err); + } - var birthed = []; + var birthed = []; var ready = WombBirthReady(actor, readyAge); var i; @@ -134,7 +134,7 @@ window.WombBirthReady = function(actor, readyAge) { readyCnt += actor.womb.filter(ft => ft.age >= readyAge).length; } catch(err){ WombInit(actor); - alert("WombBirthReady warning - " + actor.slaveName+" "+err); + alert("WombBirthReady warning - " + actor.slaveName+" "+err); return 0; } @@ -149,7 +149,7 @@ window.WombGetVolume = function(actor) { //most code from pregJS.tw with minor a try { actor.womb.forEach(ft => { gestastionWeek = ft.age; - if (gestastionWeek <= 32) { + if (gestastionWeek <= 32) { targetLen = (0.00006396 * Math.pow(gestastionWeek, 4)) - (0.005501 * Math.pow(gestastionWeek, 3)) + (0.161 * Math.pow(gestastionWeek, 2)) - @@ -171,7 +171,7 @@ window.WombGetVolume = function(actor) { //most code from pregJS.tw with minor a }); } catch(err){ WombInit(actor); - alert("WombGetVolume warning - " + actor.slaveName + " " + err); + alert("WombGetVolume warning - " + actor.slaveName + " " + err); } if (wombSize < 0) //catch for strange cases, to avoid messing with outside code. wombSize = 0; @@ -209,7 +209,7 @@ window.WombNormalizePreg = function(actor) { // console.log("New actor: " + actor.slaveName + " ===============" + actor.name); WombInit(actor); - + // this is broodmother on hold. if (actor.womb.length == 0 && actor.broodmother >= 1) { actor.pregType = 0; @@ -220,43 +220,43 @@ window.WombNormalizePreg = function(actor) // So we set this for special case. if (actor.preg >= 0) actor.preg = 0.1; - + if (actor.pregSource > 0) actor.pregSource = 0; if (actor.pregWeek > 0) actor.pregWeek = 0; - + actor.broodmotherCountDown = 0; } - + if (actor.womb.length > 0) { var max = WombMaxPreg(actor); - // console.log("max: " + max); - // console.log(".preg: "+ actor.preg); + // console.log("max: " + max); + // console.log(".preg: "+ actor.preg); if (actor.pregWeek < 1 ) actor.pregWeek = 1; if (max < actor.preg) { WombProgress(actor, actor.preg - max); - // console.log("progressin womb"); + // console.log("progressin womb"); } else if ( max > actor.preg) { actor.preg = max; - // console.log("advancing .preg"); + // console.log("advancing .preg"); } actor.pregType = actor.womb.length; actor.pregSource = actor.womb[0].fatherID; } else if (actor.womb.length == 0 && actor.broodmother < 1) { //not broodmother - // console.log("preg fixing"); + // console.log("preg fixing"); actor.pregType = 0; actor.pregKnown = 0; - + if (actor.preg > 0) actor.preg = 0; - + if (actor.pregSource > 0) actor.pregSource = 0; diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index b941c593ba3e8c27373acb646b8a57bb6b7a6813..815a0988be8512294a228fac9b5eb037a403e9ad 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -2456,6 +2456,18 @@ Setting missing slave variables: <<set _Slave.eyewear = "none">> <</if>> +<<if ndef _Slave.hears>> + <<set _Slave.hears = 0>> +<</if>> + +<<if ndef _Slave.earwear>> + <<set _Slave.earwear = "none">> +<</if>> + +<<if ndef _Slave.earImplant>> + <<set _Slave.earImplant = 0>> +<</if>> + <<if ndef _Slave.indenture>> <<set _Slave.indenture = -1>> <</if>>