diff --git a/.eslintrc.json b/.eslintrc.json index c50f403a8694dd5fb40484aa72555416d00e013e..dec9b166a6873368764ab457c9436ab51af6ba40 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,7 +36,7 @@ "eqeqeq": "warn", "no-fallthrough": "error", "space-before-function-paren": ["warn", { - "anonymous": "always", + "anonymous": "never", "named": "never", "asyncArrow": "always" }], diff --git a/src/002-config/fc-js-init.js b/src/002-config/fc-js-init.js index 172e3b5fe06601e8d937c8a70eb5ff5259aced1a..517904199992fed31214d0232ae6b06012c84736 100644 --- a/src/002-config/fc-js-init.js +++ b/src/002-config/fc-js-init.js @@ -1,3 +1,4 @@ +/* eslint-disable no-var */ /* * SugarCube executes scripts via eval() inside a closure. Thus to make App global, * we declare it as a property of the window object. I don't know why 'App = {}' diff --git a/src/SpecialForce/SpecialForce.js b/src/SpecialForce/SpecialForce.js index 4bd0d2a335e4f8223d5d1def08f3ea1b1bb36431..ad90a8625601701525f4e66854e6a4524666718c 100644 --- a/src/SpecialForce/SpecialForce.js +++ b/src/SpecialForce/SpecialForce.js @@ -2518,7 +2518,7 @@ App.SF.AAR = function(endWeekCall = 1) { income *= 14.15; } } // Remove line if hard mode ever gets fixed. - if (endWeekCall > 0) S.Troops += FNG; + if (endWeekCall > 0) { S.Troops += FNG; } income = Math.ceil(income); if (V.debugMode > 0 && endWeekCall > 0) { r += `<br>income:${num(income)}, troop:${num((0.09+Multiplier.troop/NO).toFixed(2))}, unit:${num((0.09+Multiplier.unit/NO).toFixed(2))}, action:${num((0.09+Multiplier.action/NO).toFixed(2))}, depravity:${num((0.09+Multiplier.depravity/NO).toFixed(2))}, upkeep:${num((upkeep*N1).toFixed(2))}`; diff --git a/src/art/artJS.js b/src/art/artJS.js index cfeaba2ae90a47cbf47b504a5e7f5b7d555bf22a..4f23c9685416bc224a52fd41ecc6df8df8e0be26 100644 --- a/src/art/artJS.js +++ b/src/art/artJS.js @@ -19,16 +19,17 @@ UIDisplay (optional, only used by legacy art): icon UI Display for vector art, 1 */ window.SlaveArt = function(artSlave, artSize, UIDisplay) { const imageChoice = State.variables.imageChoice; - if (artSlave.custom.image !== null && artSlave.custom.image.filename !== "") + if (artSlave.custom.image !== null && artSlave.custom.image.filename !== "") { return CustomArt(artSlave, artSize); - else if (imageChoice === 1) /* VECTOR ART BY NOX/DEEPMURK */ + } else if (imageChoice === 1) { /* VECTOR ART BY NOX/DEEPMURK */ return VectorArt(artSlave, artSize); - else if (imageChoice === 2) /* VECTOR ART BY NOX - Pregmod Legacy Version */ + } else if (imageChoice === 2) { /* VECTOR ART BY NOX - Pregmod Legacy Version */ return LegacyVectorArt(artSlave, UIDisplay); - else if (imageChoice === 3) /* VECTOR ART REVAMP*/ + } else if (imageChoice === 3) { /* VECTOR ART REVAMP*/ return RevampedVectorArt(artSlave); - else /* RENDERED IMAGES BY SHOKUSHU */ + } else { /* RENDERED IMAGES BY SHOKUSHU */ return ArtControlRendered(artSlave, artSize); + } }; window.ArtControlRendered = function ArtControlRendered(slave, sizePlacement) { @@ -112,14 +113,15 @@ window.CustomArt = function(slave, imageSize) { const displayTypeStart = (fileType === "webm" ? "video loop autoplay" : "img"); const displayTypeEnd = (fileType === "webm" ? "</video>" : ""); - if (imageSize === 3) + if (imageSize === 3) { return `<${displayTypeStart} src=${fileName} style='float:right; border:3px hidden'>${displayTypeEnd}`; - else if (imageSize === 2) + } else if (imageSize === 2) { return `<${displayTypeStart} src=${fileName} style='float:right; border:3px hidden' width='300' height='300'>${displayTypeEnd}`; - else if (imageSize === 1) + } else if (imageSize === 1) { return `<${displayTypeStart} src=${fileName} style='float:right; border:3px hidden' width='150' height='150'>${displayTypeEnd}`; - else + } else { return `<${displayTypeStart} src=${fileName} style='float:right; border:3px hidden' width='120' height='120'>${displayTypeEnd}`; + } }; /* @@ -177,7 +179,6 @@ window.extractColor = function(color, eyes) { /* these are HTML color names supported by most browsers */ let HTMLstandardColors = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgrey", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgrey", "lightgreen", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"]; - let FCnames = new Map(FCname2HTMLarray); color = color.toLowerCase(); /* normalization: lowercase color name */ let colorCode = FCnames.get(color); /* look up in FreeCities color names */ @@ -212,10 +213,11 @@ window.extractColor = function(color, eyes) { } if (!colorCode) { console.log("Art Color Tools JS: Unable to determine HTML compliant color code for color string '" + color + "'."); - if (eyes) + if (eyes) { colorCode = "#89b7ff"; - else + } else { colorCode = "fuchsia"; /* use fuchsia as error marker */ + } } return colorCode; }; diff --git a/src/art/vector/VectorArtJS.js b/src/art/vector/VectorArtJS.js index 5295d7e10723260e28f416d0ee354a07e32acc0b..3da76328829c64dffd0f46ba2d17538f9f5c38e3 100644 --- a/src/art/vector/VectorArtJS.js +++ b/src/art/vector/VectorArtJS.js @@ -1,4 +1,4 @@ -window.VectorArt = (function () { +window.VectorArt = (function() { "use strict"; let V, T, slave; let r; @@ -2679,7 +2679,7 @@ window.VectorArt = (function () { return VectorArt; })(); -window.LegacyVectorArt = function (slave, artSize) { +window.LegacyVectorArt = function(slave, artSize) { const filePath = "'resources/vector"; const skinFilePath = `${filePath}/body/white`; const wearingLatex = slave.clothes === "a Fuckdoll suit" || slave.clothes === "restrictive latex" || slave.clothes === "a latex catsuit"; diff --git a/src/art/vector_revamp/vectorRevampedArtControl.js b/src/art/vector_revamp/vectorRevampedArtControl.js index ac04a40c9e17caa7be2b7a3e8dd94e5f15e5f84c..6c4c727da020657212c1315b56f6c3e214d4dd19 100644 --- a/src/art/vector_revamp/vectorRevampedArtControl.js +++ b/src/art/vector_revamp/vectorRevampedArtControl.js @@ -1,12 +1,14 @@ +/* eslint-disable camelcase */ window.RevampedVectorArt = function(slave) { const V = State.variables; const T = State.temporary; let r; - if (T.art_display_id > 0) + if (T.art_display_id > 0) { T.art_display_id++; - else + } else { T.art_display_id = 1; + } T.art_display_class = `ad${T.art_display_id}`; /* Using JS from vectorRevampedArtControl.tw*/ @@ -48,10 +50,9 @@ class ArtStyleEntry { let styleValue = `${styleArray.join(";")};`; - let cssDef = `{ ${styleValue} }`; // not sure if there should be padding here + let cssDef = `{ ${styleValue} }`; // not sure if there should be padding here - if (this.name.length > 0) - cssDef = `.${this.name}${cssDef}`; + if (this.name.length > 0) { cssDef = `.${this.name}${cssDef}`; } return cssDef; } @@ -126,19 +127,21 @@ class ArtStyleControl { applyCalcMuscleTone() { let musclesValue = this.artSlave.muscles + 101; - let musclesVisibility = 0.910239*Math.log(0.02*musclesValue); + let musclesVisibility = 0.910239 * Math.log(0.02 * musclesValue); this.muscleTone["fill-opacity"] = musclesVisibility; } applyEyeLensStyle() { - if (this.artSlave.eyeColor === null || this.artSlave.eyeColor === undefined) + if (this.artSlave.eyeColor === null || this.artSlave.eyeColor === undefined) { return; + } let eyeColorSplit = this.artSlave.eyeColor.split(" "); - if (eyeColorSplit === 1) + if (eyeColorSplit === 1) { return; + } let eyeLens = eyeColorSplit[0]; @@ -154,8 +157,9 @@ class ArtStyleControl { /* currently unused, keeping for color reference - */ parseSkinColorFromName(colorName) { // eslint-disable-next-line eqeqeq - if (colorName == null) + if (colorName == null) { return "#000000"; + } let skinPalette = [ ["light", "#feebe5"], @@ -319,7 +323,7 @@ class ArtStyleControl { get StylesCss() { let mainStyle = new ArtStyleEntry(""); mainStyle.position = "absolute"; - mainStyle.height= "100%"; + mainStyle.height = "100%"; mainStyle["margin-left"] = "auto"; mainStyle["margin-right"] = "auto"; mainStyle.left = "0"; @@ -446,7 +450,7 @@ class ClothingControl { get restrictiveLatex() { let defaultOutfitColor = "#515351"; - let areolaColor = "#383838"; + let areolaColor = "#383838"; // FIXME: unused variable return { bodySettings: { showEyes: false, @@ -635,10 +639,12 @@ class RevampedArtControl { let clothing = this.getClothing(); if (clothing !== null) { - if (clothing.bodySettings !== null) + if (clothing.bodySettings !== null) { this.applyClothingSettings(clothing.bodySettings); - if (clothing.styleSettings !== null) + } + if (clothing.styleSettings !== null) { this.applyClothingStyleSettings(clothing.styleSettings); + } } if (!globalShowHighlights) { @@ -658,8 +664,7 @@ class RevampedArtControl { copyProperties(objTo, objFrom) { for (let attr in objFrom) { - if (objFrom.hasOwnProperty(attr)) - objTo[attr] = objFrom[attr]; + if (objFrom.hasOwnProperty(attr)) { objTo[attr] = objFrom[attr]; } } } @@ -669,14 +674,16 @@ class RevampedArtControl { applyClothingStyleSettings(styleSettings) { for (let attr in styleSettings) { - if (styleSettings.hasOwnProperty(attr)) + if (styleSettings.hasOwnProperty(attr)) { this.copyProperties(this.styleControl[attr], styleSettings[attr]); + } } } getClothing() { - if (this.artSlave.fuckdoll > 0) + if (this.artSlave.fuckdoll > 0) { return this.clothingControl.fuckdoll; + } let clothing = null; switch (this.artSlave.clothes) { case "a nice maid outfit": @@ -706,13 +713,13 @@ class RevampedArtControl { get getHairLength() { let result = "Short"; - - if (this.artSlave.hLength >= 80) + if (this.artSlave.hLength >= 80) { result = "Long"; - else if (this.artSlave.hLength >= 40) + } else if (this.artSlave.hLength >= 40) { result = "Medium"; - else + } else { result = "Short"; + } return result; } @@ -769,26 +776,27 @@ class RevampedArtControl { get getBellyLevel() { let bellyLevel = 0; - if (this.artSlave.belly >= 120000) + if (this.artSlave.belly >= 120000) { bellyLevel = 9; - else if (this.artSlave.belly >= 90000) + } else if (this.artSlave.belly >= 90000) { bellyLevel = 8; - else if (this.artSlave.belly >= 50000) + } else if (this.artSlave.belly >= 50000) { bellyLevel = 7; - else if (this.artSlave.belly >= 30000) + } else if (this.artSlave.belly >= 30000) { bellyLevel = 6; - else if (this.artSlave.belly >= 15000) + } else if (this.artSlave.belly >= 15000) { bellyLevel = 5; - else if (this.artSlave.belly >= 10000) + } else if (this.artSlave.belly >= 10000) { bellyLevel = 4; - else if (this.artSlave.belly >= 5000) + } else if (this.artSlave.belly >= 5000) { bellyLevel = 3; - else if (this.artSlave.belly >= 1500) + } else if (this.artSlave.belly >= 1500) { bellyLevel = 2; - else if (this.artSlave.belly >= 500) + } else if (this.artSlave.belly >= 500) { bellyLevel = 1; - else + } else { bellyLevel = 0; + } return bellyLevel; } @@ -796,11 +804,13 @@ class RevampedArtControl { get hairBackLayer() { let result = []; - if (!this.showHair) + if (!this.showHair) { return result; + } - if (this.artSlave.hLength === 0) + if (this.artSlave.hLength === 0) { return result; + } switch (this.artSlave.hStyle) { case "neat": @@ -850,8 +860,8 @@ class RevampedArtControl { get armLayer() { let result = []; - let leftArmType = ""; - let rightArmType = ""; + let leftArmType = ""; // FIXME: unused variable + let rightArmType = ""; // FIXME: unused variable if (this.artSlave.amp === 1) { result.push("Art_Vector_Revamp_Arm_Stump"); @@ -878,17 +888,19 @@ class RevampedArtControl { get buttLayer() { let result = []; let buttSize = 0; - if (this.artSlave.amp) + if (this.artSlave.amp) { return result; + } - if (this.artSlave.butt > 6) + if (this.artSlave.butt > 6) { buttSize = 3; - else if (this.artSlave.butt > 4) + } else if (this.artSlave.butt > 4) { buttSize = 2; - else if (this.artSlave.butt > 2) + } else if (this.artSlave.butt > 2) { buttSize = 1; - else + } else { buttSize = 0; + } result.push(`Art_Vector_Revamp_Butt_${buttSize}`); @@ -977,8 +989,9 @@ class RevampedArtControl { get pussyLayer() { let result = []; - if (this.showPussy && this.artSlave.vagina >= 0) + if (this.showPussy && this.artSlave.vagina >= 0) { result.push("Art_Vector_Revamp_Pussy"); + } return result; } @@ -986,11 +999,13 @@ class RevampedArtControl { get pubicLayer() { let result = []; - if (!this.showPubic) + if (!this.showPubic) { return result; + } - if (this.artSlave.physicalAge < 12) + if (this.artSlave.physicalAge < 12) { return result; + } if (this.artSlave.vaginaTat === "rude words") { this.pubicTattooText = this.artSlave.dick !== 0 ? "Useless" : "Fucktoy"; @@ -1020,20 +1035,23 @@ class RevampedArtControl { get pussyPiercingsLayer() { let result = []; - if (!this.showPussyPiercings) + if (!this.showPussyPiercings) { return result; + } - if (this.artSlave.vaginaPiercing === 1) + if (this.artSlave.vaginaPiercing === 1) { result.push("Art_Vector_Revamp_Pussy_Piercing"); - else if (this.artSlave.vaginaPiercing === 2) + } else if (this.artSlave.vaginaPiercing === 2) { result.push("Art_Vector_Revamp_Pussy_Piercing_Heavy"); + } - if (this.artSlave.clitPiercing === 1) + if (this.artSlave.clitPiercing === 1) { result.push("Art_Vector_Revamp_Clit_Piercing"); - else if (this.artSlave.clitPiercing === 2) + } else if (this.artSlave.clitPiercing === 2) { result.push("Art_Vector_Revamp_Clit_Piercing_Heavy"); - else if (this.artSlave.clitPiercing === 3) + } else if (this.artSlave.clitPiercing === 3) { result.push("Art_Vector_Revamp_Clit_Piercing_Smart"); + } return result; } @@ -1049,14 +1067,17 @@ class RevampedArtControl { isChastityVaginalWorn = isChastityVaginalWorn && this.showChastityVaginal; - if (isChastityAnalWorn) + if (isChastityAnalWorn) { result.push("Art_Vector_Revamp_Chastity_Anus"); + } - if (isChastityVaginalWorn) + if (isChastityVaginalWorn) { result.push("Art_Vector_Revamp_Chastity_Vagina"); + } - if (isChastityAnalWorn || isChastityVaginalWorn) + if (isChastityAnalWorn || isChastityVaginalWorn) { result.push("Art_Vector_Revamp_Chastity_Base"); + } return result; } @@ -1083,21 +1104,23 @@ class RevampedArtControl { get ballsLayer() { let result = []; - if (!this.showBalls || this.artSlave.scrotum <= 0 || this.artSlave.balls <= 0) + if (!this.showBalls || this.artSlave.scrotum <= 0 || this.artSlave.balls <= 0) { return result; + } let ballsSize = 0; - if (this.artSlave.scrotum >= 6) + if (this.artSlave.scrotum >= 6) { ballsSize = 4; - else if (this.artSlave.scrotum >= 4) + } else if (this.artSlave.scrotum >= 4) { ballsSize = 3; - else if (this.artSlave.scrotum >= 3) + } else if (this.artSlave.scrotum >= 3) { ballsSize = 2; - else if (this.artSlave.scrotum >= 2) + } else if (this.artSlave.scrotum >= 2) { ballsSize = 1; - else + } else { ballsSize = 0; + } result.push(`Art_Vector_Revamp_Balls_${ballsSize}`); @@ -1111,19 +1134,23 @@ class RevampedArtControl { result.push(`Art_Vector_Revamp_Belly_${this.bellyLevel}`); if (this.showBellyPiercings) { - if (this.artSlave.navelPiercing >= 1) + if (this.artSlave.navelPiercing >= 1) { result.push(`Art_Vector_Revamp_Belly_${this.bellyLevel}_Piercing`); + } - if (this.artSlave.navelPiercing === 2) + if (this.artSlave.navelPiercing === 2) { result.push(`Art_Vector_Revamp_Belly_${this.bellyLevel}_Piercing_Heavy`); + } } } else { if (this.showBellyPiercings) { - if (this.artSlave.navelPiercing >= 1) + if (this.artSlave.navelPiercing >= 1) { result.push("Art_Vector_Revamp_Navel_Piercing"); + } - if (this.artSlave.navelPiercing === 2) + if (this.artSlave.navelPiercing === 2) { result.push("Art_Vector_Revamp_Navel_Piercing_Heavy"); + } } } @@ -1133,41 +1160,46 @@ class RevampedArtControl { get penisLayer() { let result = []; - if (this.getBellyLevel >= 8) + if (this.getBellyLevel >= 8) { return result; + } let penisSize = -1; - if (this.artSlave.dick >= 8) + if (this.artSlave.dick >= 8) { penisSize = 6; - else if (this.artSlave.dick >= 7) + } else if (this.artSlave.dick >= 7) { penisSize = 5; - else if (this.artSlave.dick >= 6) + } else if (this.artSlave.dick >= 6) { penisSize = 4; - else if (this.artSlave.dick >= 5) + } else if (this.artSlave.dick >= 5) { penisSize = 3; - else if (this.artSlave.dick >= 4) + } else if (this.artSlave.dick >= 4) { penisSize = 2; - else if (this.artSlave.dick >= 2) + } else if (this.artSlave.dick >= 2) { penisSize = 1; - else if (this.artSlave.dick >= 1) + } else if (this.artSlave.dick >= 1) { penisSize = 0; - else + } else { penisSize = -1; + } - if (!this.showPenis || penisSize < 0) + if (!this.showPenis || penisSize < 0) { return result; + } if (canAchieveErection(this.artSlave) && (this.artSlave.chastityPenis !== 1)) { result.push(`Art_Vector_Revamp_Penis_${penisSize}`); - if (!this.showPenisPiercings) + if (!this.showPenisPiercings) { return result; + } - if (this.artSlave.dickPiercing === 1) + if (this.artSlave.dickPiercing === 1) { result.push(`Art_Vector_Revamp_Penis_${penisSize}_Piercing`); - else if (this.artSlave.dickPiercing === 2) + } else if (this.artSlave.dickPiercing === 2) { result.push(`Art_Vector_Revamp_Penis_${penisSize}_Piercing_Heavy`); + } } else { result.push(`Art_Vector_Revamp_Flaccid_${penisSize}`); @@ -1214,34 +1246,35 @@ class RevampedArtControl { result.push(`Art_Vector_Revamp_Boob_None_Areola_${areolaeShape}`); } } else { - let artScaleFactor = 0.804354*Math.log(0.00577801*this.artSlave.boobs); + let artScaleFactor = 0.804354 * Math.log(0.00577801 * this.artSlave.boobs); - let boobRightArtTranslationX = 270*((-1*artScaleFactor) + 1); - let boobLeftArtTranslationX = 320*((-1*artScaleFactor) + 1); - let artTranslationX = -283.841*artScaleFactor+285.349; - let artTranslationY = 198*((-1*artScaleFactor) + 1); + let boobRightArtTranslationX = 270 * ((-1 * artScaleFactor) + 1); + let boobLeftArtTranslationX = 320 * ((-1 * artScaleFactor) + 1); + let artTranslationX = -283.841 * artScaleFactor + 285.349; + let artTranslationY = 198 * ((-1 * artScaleFactor) + 1); let artBoobTransform = `matrix(${artScaleFactor},0,0,${artScaleFactor},${artTranslationX},${artTranslationY})`; this.artTransform = artBoobTransform; - if (!this.showBoobs) + if (!this.showBoobs) { return result; + } let size = "Small"; if (this.artSlave.boobs < 600) { - artScaleFactor = 0.360674*Math.log(0.0266667*this.artSlave.boobs); + artScaleFactor = 0.360674 * Math.log(0.0266667 * this.artSlave.boobs); - boobRightArtTranslationX = 240*((-1*artScaleFactor) + 1); - boobLeftArtTranslationX = 300*((-1*artScaleFactor) + 1); - artTranslationY = 250*((-1*artScaleFactor) + 1); + boobRightArtTranslationX = 240 * ((-1 * artScaleFactor) + 1); + boobLeftArtTranslationX = 300 * ((-1 * artScaleFactor) + 1); + artTranslationY = 250 * ((-1 * artScaleFactor) + 1); size = "Small"; } else if (this.artSlave.boobs < 15000) { size = "Medium"; } else { size = "Huge"; - boobRightArtTranslationX = 252*((-1*artScaleFactor) + 1); - boobLeftArtTranslationX = 315*((-1*artScaleFactor) + 1); + boobRightArtTranslationX = 252 * ((-1 * artScaleFactor) + 1); + boobLeftArtTranslationX = 315 * ((-1 * artScaleFactor) + 1); } this.boobRightArtTransform = `matrix(${artScaleFactor},0,0,${artScaleFactor},${boobRightArtTranslationX},${artTranslationY})`; @@ -1303,27 +1336,31 @@ class RevampedArtControl { } if (this.artSlave.nipplesPiercing === 1) { - if (this.artSlave.boobs < 300) + if (this.artSlave.boobs < 300) { result.push("Art_Vector_Revamp_Boob_None_Piercing"); - else + } else { result.push(`Art_Vector_Revamp_Boob_${size}_Piercing`); + } } else if (this.artSlave.nipplesPiercing === 2) { - if (this.artSlave.boobs < 300) + if (this.artSlave.boobs < 300) { result.push("Art_Vector_Revamp_Boob_None_Piercing_Heavy"); - else + } else { result.push(`Art_Vector_Revamp_Boob_${size}_Piercing_Heavy`); + } } if (this.artSlave.areolaePiercing === 1) { - if (this.artSlave.boobs < 300) + if (this.artSlave.boobs < 300) { result.push("Art_Vector_Revamp_Boob_None_Areola_Piercing"); - else + } else { result.push(`Art_Vector_Revamp_Boob_${size}_Areola_Piercing`); + } } else if (this.artSlave.areolaePiercing === 2) { - if (this.artSlave.boobs < 300) + if (this.artSlave.boobs < 300) { result.push("Art_Vector_Revamp_Boob_None_Areola_Piercing_Heavy"); - else + } else { result.push(`Art_Vector_Revamp_Boob_${size}_Areola_Piercing_Heavy`); + } } } @@ -1335,26 +1372,26 @@ class RevampedArtControl { case "a nice maid outfit": if (this.artSlave.boobs >= 300) { if (this.artSlave.boobs < 600) { - let artScaleFactor = 0.288539*Math.log(0.106667*this.artSlave.boobs); - let artTranslationX = 270*((-1*artScaleFactor) + 1); - let artTranslationY = 198*((-1*artScaleFactor) + 1);// -198.438*artScaleFactor+203.274; + let artScaleFactor = 0.288539 * Math.log(0.106667 * this.artSlave.boobs); + let artTranslationX = 270 * ((-1 * artScaleFactor) + 1); + let artTranslationY = 198 * ((-1 * artScaleFactor) + 1); // -198.438*artScaleFactor+203.274; let artBoobTransform = `matrix(${artScaleFactor},0,0,${artScaleFactor},${artTranslationX},${artTranslationY})`; this.boobOutfitArtTransform = artBoobTransform; result.push("Art_Vector_Revamp_Boob_Small_Outfit_Maid"); } else if (this.artSlave.boobs < 15000) { - let artScaleFactor = 0.155334*Math.log(1.04167*this.artSlave.boobs); - let artTranslationX = 270*((-1.25*artScaleFactor) + 1.25); - let artTranslationY = 198*((-0.8*artScaleFactor) + 0.8);// -198.438*artScaleFactor+203.274; + let artScaleFactor = 0.155334 * Math.log(1.04167 * this.artSlave.boobs); + let artTranslationX = 270 * ((-1.25 * artScaleFactor) + 1.25); + let artTranslationY = 198 * ((-0.8 * artScaleFactor) + 0.8); // -198.438*artScaleFactor+203.274; let artBoobTransform = `matrix(${artScaleFactor},0,0,${artScaleFactor},${artTranslationX},${artTranslationY})`; this.boobOutfitArtTransform = artBoobTransform; result.push("Art_Vector_Revamp_Boob_Medium_Outfit_Maid"); } else { - let artScaleFactor = 1.56609*Math.log(0.00017373*this.artSlave.boobs); - let artTranslationX = 340*((-1*artScaleFactor) + 1); - let artTranslationY = 153*((-1*artScaleFactor) + 1);// -198.438*artScaleFactor+203.274; + let artScaleFactor = 1.56609 * Math.log(0.00017373 * this.artSlave.boobs); + let artTranslationX = 340 * ((-1 * artScaleFactor) + 1); + let artTranslationY = 153 * ((-1 * artScaleFactor) + 1); // -198.438*artScaleFactor+203.274; let artBoobTransform = `matrix(${artScaleFactor},0,0,${artScaleFactor},${artTranslationX},${artTranslationY})`; this.boobOutfitArtTransform = artBoobTransform; @@ -1422,21 +1459,25 @@ class RevampedArtControl { result.push("Art_Vector_Revamp_Head"); - if (this.showHeadHighlight) + if (this.showHeadHighlight) { result.push("Art_Vector_Revamp_Face_Highlights"); + } - if (!this.showHeadPiercings) + if (!this.showHeadPiercings) { return result; + } - if (this.artSlave.earPiercing === 1) + if (this.artSlave.earPiercing === 1) { result.push("Art_Vector_Revamp_Head_Ear_Piercing"); - else if (this.artSlave.earPiercing === 2) + } else if (this.artSlave.earPiercing === 2) { result.push("Art_Vector_Revamp_Head_Ear_Piercing_Heavy"); + } - if (this.artSlave.nosePiercing === 1) + if (this.artSlave.nosePiercing === 1) { result.push("Art_Vector_Revamp_Head_Nose_Piercing"); - else if (this.artSlave.nosePiercing === 2) + } else if (this.artSlave.nosePiercing === 2) { result.push("Art_Vector_Revamp_Head_Nose_Piercing_Heavy"); + } return result; } @@ -1444,46 +1485,51 @@ class RevampedArtControl { get eyesLayer() { let result = []; - if (!this.showEyes) + if (!this.showEyes) { return result; + } if (this.artSlave.devotion > 50) { result.push("Art_Vector_Revamp_Eyes_Happy"); result.push("Art_Vector_Revamp_Eyes_Happy_Highlights"); if (this.showHeadPiercings) { - if (this.artSlave.eyebrowPiercing === 1) + if (this.artSlave.eyebrowPiercing === 1) { result.push("Art_Vector_Revamp_Head_Eyebrow_Happy_Piercing"); - else if (this.artSlave.eyebrowPiercing === 2) + } else if (this.artSlave.eyebrowPiercing === 2) { result.push("Art_Vector_Revamp_Head_Eyebrow_Happy_Piercing_Heavy"); + } } } else if (this.artSlave.devotion >= 0) { result.push("Art_Vector_Revamp_Eyes_Shy"); result.push("Art_Vector_Revamp_Eyes_Shy_Highlights"); if (this.showHeadPiercings) { - if (this.artSlave.eyebrowPiercing === 1) + if (this.artSlave.eyebrowPiercing === 1) { result.push("Art_Vector_Revamp_Head_Eyebrow_Shy_Piercing"); - else if (this.artSlave.eyebrowPiercing === 2) + } else if (this.artSlave.eyebrowPiercing === 2) { result.push("Art_Vector_Revamp_Head_Eyebrow_Shy_Piercing_Heavy"); + } } } else if (this.artSlave.devotion >= -50) { result.push("Art_Vector_Revamp_Eyes_Closed"); if (this.showHeadPiercings) { - if (this.artSlave.eyebrowPiercing === 1) + if (this.artSlave.eyebrowPiercing === 1) { result.push("Art_Vector_Revamp_Head_Eyebrow_Closed_Piercing"); - else if (this.artSlave.eyebrowPiercing === 2) + } else if (this.artSlave.eyebrowPiercing === 2) { result.push("Art_Vector_Revamp_Head_Eyebrow_Closed_Piercing_Heavy"); + } } } else { result.push("Art_Vector_Revamp_Eyes_Angry"); result.push("Art_Vector_Revamp_Eyes_Angry_Highlights"); if (this.showHeadPiercings) { - if (this.artSlave.eyebrowPiercing === 1) + if (this.artSlave.eyebrowPiercing === 1) { result.push("Art_Vector_Revamp_Head_Eyebrow_Angry_Piercing"); - else if (this.artSlave.eyebrowPiercing === 2) + } else if (this.artSlave.eyebrowPiercing === 2) { result.push("Art_Vector_Revamp_Head_Eyebrow_Angry_Piercing_Heavy"); + } } } @@ -1494,41 +1540,45 @@ class RevampedArtControl { let result = []; let lipsSize = "Normal"; - if (!this.showMouth) + if (!this.showMouth) { return result; + } - if (this.artSlave.lips > 95) + if (this.artSlave.lips > 95) { lipsSize = "Enormous"; - else if (this.artSlave.lips > 70) + } else if (this.artSlave.lips > 70) { lipsSize = "Huge"; - else if (this.artSlave.lips > 50) + } else if (this.artSlave.lips > 50) { lipsSize = "Big"; - else if (this.artSlave.lips > 30) + } else if (this.artSlave.lips > 30) { lipsSize = "Plush"; - else if (this.artSlave.lips > 10) + } else if (this.artSlave.lips > 10) { lipsSize = "Normal"; - else + } else { lipsSize = "Thin"; + } if (this.artSlave.trust > 20) { result.push(`Art_Vector_Revamp_Makeup_Mouth_Happy_${lipsSize}`); result.push(`Art_Vector_Revamp_Mouth_Happy_${lipsSize}`); if (this.showHeadPiercings) { - if (this.artSlave.lipsPiercing === 1) + if (this.artSlave.lipsPiercing === 1) { result.push("Art_Vector_Revamp_Head_Mouth_Happy_Piercing"); - else if (this.artSlave.lipsPiercing === 2) + } else if (this.artSlave.lipsPiercing === 2) { result.push("Art_Vector_Revamp_Head_Mouth_Happy_Piercing_Heavy"); + } } } else { result.push(`Art_Vector_Revamp_Makeup_Mouth_Angry_${lipsSize}`); result.push(`Art_Vector_Revamp_Mouth_Angry_${lipsSize}`); if (this.showHeadPiercings) { - if (this.artSlave.lipsPiercing === 1) + if (this.artSlave.lipsPiercing === 1) { result.push("Art_Vector_Revamp_Head_Mouth_Angry_Piercing"); - else if (this.artSlave.lipsPiercing === 2) + } else if (this.artSlave.lipsPiercing === 2) { result.push("Art_Vector_Revamp_Head_Mouth_Angry_Piercing_Heavy"); + } } } @@ -1567,11 +1617,13 @@ class RevampedArtControl { get hairForeLayer() { let result = []; - if (!this.showHair) + if (!this.showHair) { return result; + } - if (this.artSlave.hLength === 0) + if (this.artSlave.hLength === 0) { return result; + } switch (this.artSlave.hStyle) { case "neat": diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index 80a9153ca67bbc43c82f6024ed878c23aa38fa9a..44b7f3aa8b25a34b582219646e681741c2d979e1 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -1,5 +1,5 @@ /* OPEN MAIN */ -App.UI.View.MainLinks = function () { +App.UI.View.MainLinks = function() { "use strict"; const V = State.variables; const PA = Array.isArray(V.personalAttention) ? V.personalAttention.map(x => getSlave(x.ID)) : []; diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index c94323529c1f644a6d2bd5da1cac1d911c4dd383..90ed3d4ce5e15732d65c95663fee18ee48d31239 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -1,6 +1,6 @@ // this code applies RA rules onto slaves -window.DefaultRules = (function () { +window.DefaultRules = (function() { "use strict"; let V; let r; @@ -1353,7 +1353,7 @@ window.DefaultRules = (function () { } } if (_priorities.length > 1) { - _priorities = _priorities.sort(function (a, b) { + _priorities = _priorities.sort(function(a, b) { if (a.weight > b.weight) { return -1; } diff --git a/src/js/assayJS.js b/src/js/assayJS.js index b0cab4b9a5850aea9c14ced6f1cb51508ccbf32f..6bc856d5fe1e3f8054a2aeb1439cff33c35aca66 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -53,17 +53,25 @@ window.isLeaderP = function isLeaderP(slave) { // helper function returning PC's title window.properTitle = function properTitle() { const PC = State.variables.PC; - if (PC.customTitle) return PC.customTitle; - else if (PC.title !== 0) return "Sir"; - else return "Ma'am"; + if (PC.customTitle) { + return PC.customTitle; + } else if (PC.title !== 0) { + return "Sir"; + } else { + return "Ma'am"; + } }; // helper function returning slave's title for PC in situations where WrittenMaster() is inappropriate window.properMaster = function properMaster() { const PC = State.variables.PC; - if (PC.customTitle) return PC.customTitle; - else if (PC.title !== 0) return "Master"; - else return "Mistress"; + if (PC.customTitle) { + return PC.customTitle; + } else if (PC.title !== 0) { + return "Master"; + } else { + return "Mistress"; + } }; /** @@ -192,7 +200,7 @@ window.newSlave = function newSlave(slave) { V.genePool.push(slave); /* Store non-albino stats in genePool */ if (slave.geneticQuirks.albinism === 2) { - const albInd = V.genePool.findIndex(function(s) {return s.ID === slave.ID;}); + const albInd = V.genePool.findIndex(function(s) { return s.ID === slave.ID; }); V.genePool[albInd].origSkin = slave.albinismOverride.skin; V.genePool[albInd].origEye = slave.albinismOverride.eyeColor; V.genePool[albInd].origHColor = slave.albinismOverride.hColor; @@ -202,9 +210,10 @@ window.newSlave = function newSlave(slave) { slave.albinismOverride = 0; } } else { - if (V.genePool.findIndex(function(s) {return s.ID === slave.ID;}) === -1) {V.genePool.push(slave);} + if (V.genePool.findIndex(function(s) { return s.ID === slave.ID; }) === -1) { + V.genePool.push(slave); + } } - assignJob(slave, slave.assignment); /** do not run the Rules Assistant before adding the new slave to the slaves list! **/ @@ -306,6 +315,7 @@ window.addSlave = function addSlave(slave) { State.variables.slaves.push(slave); State.variables.slaveIndices[slave.ID] = State.variables.slaves.length - 1; }; + window.removeSlave = function removeSlave(index) { const ret = State.variables.slaves.deleteAt(index); State.variables.slaveIndices = slaves2indices(); @@ -389,7 +399,7 @@ App.Utils.Pronouns = class { * @param {App.Entity.SlaveState} slave * @returns {App.Utils.Pronouns} */ -window.getPronouns = function (slave) { +window.getPronouns = function(slave) { return new App.Utils.Pronouns(slave); }; @@ -399,10 +409,11 @@ window.getPronouns = function (slave) { */ window.WrittenMaster = function WrittenMaster(slave) { const V = State.variables; - if (slave !== undefined) + if (slave !== undefined) { Enunciate(slave); - else if (V.titleEnunciate === undefined) + } else if (V.titleEnunciate === undefined) { Enunciate(V.activeSlave); + } return V.writtenTitle; }; @@ -412,48 +423,55 @@ window.WrittenMaster = function WrittenMaster(slave) { window.Enunciate = function Enunciate(slave) { const V = State.variables; if (SlaveStatsChecker.checkForLisp(slave)) { - if (V.PC.customTitleLisp !== undefined) + if (V.PC.customTitleLisp !== undefined) { V.titleEnunciate = V.PC.customTitleLisp; - else if (V.PC.title !== 0) + } else if (V.PC.title !== 0) { V.titleEnunciate = "Mathter"; - else + } else { V.titleEnunciate = "Mithtreth"; + } if (V.allowFamilyTitles === 1) { if (slave.father === -1) { - if (slave.actualAge < 4 && slave.physicalAge < 4) + if (slave.actualAge < 4 && slave.physicalAge < 4) { V.titleEnunciate = "Dadda"; - else if (slave.actualAge < 9) + } else if (slave.actualAge < 9) { V.titleEnunciate = "Daddy"; - else + } else { V.titleEnunciate = "Dad"; + } } else if (slave.mother === -1) { - if (slave.actualAge < 4 && slave.physicalAge < 4) + if (slave.actualAge < 4 && slave.physicalAge < 4) { V.titleEnunciate = "Mama"; - else if (slave.actualAge < 9) + } else if (slave.actualAge < 9) { V.titleEnunciate = "Mommy"; - else + } else { V.titleEnunciate = "Mom"; + } } else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) { - if (V.PC.title === 1) + if (V.PC.title === 1) { V.titleEnunciate = "Thon"; - else if (V.PC.title === 0) + } else if (V.PC.title === 0) { V.titleEnunciate = "Daughter"; + } } else if (areSisters(slave, V.PC) > 0) { if (V.PC.title === 1) { - if (slave.actualAge < 18) + if (slave.actualAge < 18) { V.titleEnunciate = "Bro"; - else + } else { V.titleEnunciate = "Brother"; + } } else if (V.PC.title === 0) { - if (slave.actualAge < 18) + if (slave.actualAge < 18) { V.titleEnunciate = "Thith"; - else + } else { V.titleEnunciate = "Thithter"; + } } } } - if (slave.custom.titleLisp && slave.custom.titleLisp !== "") + if (slave.custom.titleLisp && slave.custom.titleLisp !== "") { V.titleEnunciate = slave.custom.titleLisp; + } V.sayEnunciate = "lisp"; V.sEnunciate = "th"; V.SEnunciate = "Th"; @@ -476,56 +494,65 @@ window.Enunciate = function Enunciate(slave) { V.xEnunciate = "kth"; V.XEnunciate = "Th"; } else { - if (V.PC.customTitle !== undefined) + if (V.PC.customTitle !== undefined) { V.titleEnunciate = V.PC.customTitle; - else if (V.PC.title !== 0) + } else if (V.PC.title !== 0) { V.titleEnunciate = "Master"; - else + } else { V.titleEnunciate = "Mistress"; + } if (V.allowFamilyTitles === 1) { if (slave.father === -1) { - if (slave.actualAge < 4 && slave.physicalAge < 4) + if (slave.actualAge < 4 && slave.physicalAge < 4) { V.titleEnunciate = "Dadda"; - else if (slave.actualAge < 9) + } else if (slave.actualAge < 9) { V.titleEnunciate = "Daddy"; - else + } else { V.titleEnunciate = "Dad"; + } } else if (slave.mother === -1) { - if (slave.actualAge < 4 && slave.physicalAge < 4) + if (slave.actualAge < 4 && slave.physicalAge < 4) { V.titleEnunciate = "Mama"; - else if (slave.actualAge < 9) + } else if (slave.actualAge < 9) { V.titleEnunciate = "Mommy"; - else + } else { V.titleEnunciate = "Mom"; + } } else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) { - if (V.PC.title === 1) + if (V.PC.title === 1) { V.titleEnunciate = "Son"; - else if (V.PC.title === 0) + } else if (V.PC.title === 0) { V.titleEnunciate = "Daughter"; + } } else if (areSisters(slave, V.PC) > 0) { if (V.PC.title === 1) { - if (slave.actualAge < 18) + if (slave.actualAge < 18) { V.titleEnunciate = "Bro"; - else + } else { V.titleEnunciate = "Brother"; + } } else if (V.PC.title === 0) { - if (slave.actualAge < 18) + if (slave.actualAge < 18) { V.titleEnunciate = "Sis"; - else + } else { V.titleEnunciate = "Sister"; + } } } } - if (slave.custom.title !== undefined && slave.custom.title !== "") + if (slave.custom.title !== undefined && slave.custom.title !== "") { V.titleEnunciate = slave.custom.title; - if (V.PC.customTitle !== undefined) + } + if (V.PC.customTitle !== undefined) { V.writtenTitle = V.PC.customTitle; - else if (V.PC.title !== 0) + } else if (V.PC.title !== 0) { V.writtenTitle = "Master"; - else + } else { V.writtenTitle = "Mistress"; - if (slave.custom.title !== undefined && slave.custom.title !== "" && slave.rudeTitle === 0) + } + if (slave.custom.title !== undefined && slave.custom.title !== "" && slave.rudeTitle === 0) { V.writtenTitle = slave.custom.title; + } V.sayEnunciate = "say"; V.sEnunciate = "s"; V.SEnunciate = "S"; @@ -578,8 +605,9 @@ window.fetishChangeChance = function fetishChangeChance(slave) { window.SlaveFullName = function SlaveFullName(slave) { const V = State.variables; const pair = slave.slaveSurname ? [slave.slaveName, slave.slaveSurname] : [slave.slaveName]; - if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(slave.nationality)) || (V.surnameOrder === 2)) + if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(slave.nationality)) || (V.surnameOrder === 2)) { pair.reverse(); + } return pair.join(" "); }; @@ -590,16 +618,18 @@ window.SlaveFullName = function SlaveFullName(slave) { window.SlaveFullBirthName = function SlaveFullBirthName(slave) { const V = State.variables; const pair = slave.birthSurname ? [slave.birthName, slave.birthSurname] : [slave.birthName]; - if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(slave.nationality)) || (V.surnameOrder === 2)) + if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(slave.nationality)) || (V.surnameOrder === 2)) { pair.reverse(); + } return pair.join(" "); }; window.PlayerName = function PlayerName() { const V = State.variables; const names = V.PC.surname ? [V.PC.name, V.PC.surname] : [V.PC.name]; - if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(V.PC.nationality)) || (V.surnameOrder === 2)) + if ((V.surnameOrder !== 1 && ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(V.PC.nationality)) || (V.surnameOrder === 2)) { names.reverse(); + } return names.join(" "); }; @@ -610,48 +640,48 @@ window.PCTitle = function PCTitle() { V.PCTitle = PlayerName(); if (V.cheater === 1) { - V.PCTitle = (`${V.PCTitle } the Cheater`); + V.PCTitle = (`${V.PCTitle} the Cheater`); } else if (V.arcologies[0].FSRestart > 10) { - V.PCTitle = (`${V.PCTitle } of the Societal Elite`); + V.PCTitle = (`${V.PCTitle} of the Societal Elite`); } else if (V.rep > 18000) { - V.PCTitle = (`${V.PCTitle } the Great`); + V.PCTitle = (`${V.PCTitle} the Great`); } else if (V.rep > 17000) { - V.PCTitle = (`the exalted ${ V.PCTitle}`); + V.PCTitle = (`the exalted ${V.PCTitle}`); } else if (V.rep > 16000) { - V.PCTitle = (`the illustrious ${ V.PCTitle}`); + V.PCTitle = (`the illustrious ${V.PCTitle}`); } else if (V.rep > 15000) { - V.PCTitle = (`the prestigious ${ V.PCTitle}`); + V.PCTitle = (`the prestigious ${V.PCTitle}`); } else if (V.rep > 14000) { - V.PCTitle = (`the renowned ${ V.PCTitle}`); + V.PCTitle = (`the renowned ${V.PCTitle}`); } else if (V.rep > 13000) { - V.PCTitle = (`the famed ${ V.PCTitle}`); + V.PCTitle = (`the famed ${V.PCTitle}`); } else if (V.rep > 12000) { - V.PCTitle = (`the celebrated ${ V.PCTitle}`); + V.PCTitle = (`the celebrated ${V.PCTitle}`); } else if (V.rep > 11000) { - V.PCTitle = (`the honored ${ V.PCTitle}`); + V.PCTitle = (`the honored ${V.PCTitle}`); } else if (V.rep > 10000) { - V.PCTitle = (`the acclaimed ${ V.PCTitle}`); + V.PCTitle = (`the acclaimed ${V.PCTitle}`); } else if (V.rep > 9000) { - V.PCTitle = (`the eminent ${ V.PCTitle}`); + V.PCTitle = (`the eminent ${V.PCTitle}`); } else if (V.rep > 8250) { - V.PCTitle = (`the prominent ${ V.PCTitle}`); + V.PCTitle = (`the prominent ${V.PCTitle}`); } else if (V.rep > 7500) { - V.PCTitle = (`the distinguished ${ V.PCTitle}`); + V.PCTitle = (`the distinguished ${V.PCTitle}`); } else if (V.rep > 6750) { - V.PCTitle = (`the admired ${ V.PCTitle}`); + V.PCTitle = (`the admired ${V.PCTitle}`); } else if (V.rep > 6000) { - V.PCTitle = (`the esteemed ${ V.PCTitle}`); + V.PCTitle = (`the esteemed ${V.PCTitle}`); } else if (V.rep > 5250) { - V.PCTitle = (`the respected ${ V.PCTitle}`); + V.PCTitle = (`the respected ${V.PCTitle}`); } else if (V.rep > 4500) { - V.PCTitle = (`the known ${ V.PCTitle}`); + V.PCTitle = (`the known ${V.PCTitle}`); } else if (V.rep > 3750) { - V.PCTitle = (`the recognized ${ V.PCTitle}`); + V.PCTitle = (`the recognized ${V.PCTitle}`); } else if (V.rep > 3000) { - V.PCTitle = (`the rumored ${ V.PCTitle}`); + V.PCTitle = (`the rumored ${V.PCTitle}`); } - V.PCTitle = (`${V.PCTitle }, `); + V.PCTitle = (`${V.PCTitle}, `); if (V.PC.name === "FC Dev") { titles.push("the Creator"); @@ -679,29 +709,41 @@ window.PCTitle = function PCTitle() { } if (V.SF.Toggle && V.SF.FS.Tension > 100) { - switch(V.SF.FS.BadOutcome) { - case 'MIGRATION': titles.push("The Abandoned"); break; - case 'Revolt': titles.push("The Betrayed"); break; - case 'ANNIHILATION': titles.push("The Runner"); break; - case 'OCCUPATION': titles.push("The Occupied"); break; - case 'ASSIMILATION': titles.push("The Deceived"); break; - case 'ISOLATION': titles.push("The Ignored"); break; + switch (V.SF.FS.BadOutcome) { + case 'MIGRATION': + titles.push("The Abandoned"); + break; + case 'Revolt': + titles.push("The Betrayed"); + break; + case 'ANNIHILATION': + titles.push("The Runner"); + break; + case 'OCCUPATION': + titles.push("The Occupied"); + break; + case 'ASSIMILATION': + titles.push("The Deceived"); + break; + case 'ISOLATION': + titles.push("The Ignored"); + break; } } if (V.mercenaries >= 5) { if (V.mercenariesTitle === "Evocati") { - titles.push(`Princeps of the ${ V.mercenariesTitle}`); + titles.push(`Princeps of the ${V.mercenariesTitle}`); } else if (V.mercenariesTitle === "Knights") { if (V.PC.title === 1) { - titles.push(`Lord Commander of the ${ V.mercenariesTitle}`); + titles.push(`Lord Commander of the ${V.mercenariesTitle}`); } else { - titles.push(`Lady Commander of the ${ V.mercenariesTitle}`); + titles.push(`Lady Commander of the ${V.mercenariesTitle}`); } } else if (V.mercenariesTitle === "Immortals") { - titles.push(`Tyrant of the ${ V.mercenariesTitle}`); + titles.push(`Tyrant of the ${V.mercenariesTitle}`); } else { - titles.push(`Commander of the ${ V.mercenariesTitle}`); + titles.push(`Commander of the ${V.mercenariesTitle}`); } } else if (V.mercenaries >= 1) { titles.push("Commander of the Mercenaries"); @@ -1050,9 +1092,9 @@ window.PCTitle = function PCTitle() { if (schoolsPerfected.length === 1) { schoolTitle += schoolsPerfected[0]; } else if (schoolsPerfected.length === 2) { - schoolTitle += `${schoolsPerfected[0] } and ${ schoolsPerfected[1]}`; + schoolTitle += `${schoolsPerfected[0]} and ${schoolsPerfected[1]}`; } else { - schoolsPerfected[schoolsPerfected.length - 1] = `and ${ schoolsPerfected[schoolsPerfected.length - 1]}`; + schoolsPerfected[schoolsPerfected.length - 1] = `and ${schoolsPerfected[schoolsPerfected.length - 1]}`; schoolTitle += schoolsPerfected.join(", "); } titles.push(schoolTitle); @@ -1063,9 +1105,9 @@ window.PCTitle = function PCTitle() { if (schoolsPresent.length === 1) { schoolTitle += schoolsPresent[0]; } else if (schoolsPresent.length === 2) { - schoolTitle += `${schoolsPresent[0] } and ${ schoolsPresent[1]}`; + schoolTitle += `${schoolsPresent[0]} and ${schoolsPresent[1]}`; } else { - schoolsPresent[schoolsPresent.length - 1] = `and ${ schoolsPresent[schoolsPresent.length - 1]}`; + schoolsPresent[schoolsPresent.length - 1] = `and ${schoolsPresent[schoolsPresent.length - 1]}`; schoolTitle += schoolsPresent.join(", "); } titles.push(schoolTitle); @@ -1134,9 +1176,9 @@ window.PCTitle = function PCTitle() { if (titles.length === 1) { V.PCTitle += titles[0]; } else if (titles.length === 2) { - V.PCTitle += `${titles[0] } and ${ titles[1]}`; + V.PCTitle += `${titles[0]} and ${titles[1]}`; } else { - titles[titles.length - 1] = `and ${ titles[titles.length - 1]}`; + titles[titles.length - 1] = `and ${titles[titles.length - 1]}`; V.PCTitle += titles.join(", "); } }; @@ -1240,80 +1282,80 @@ window.SlaveTitle = function SlaveTitle(slave) { if (slave.visualAge < 13) { if (slave.genes === "XY" && slave.vagina === -1) { - r = `shota ${ r}`; + r = `shota ${r}`; } else { - r = `loli ${ r}`; + r = `loli ${r}`; } } if (slave.geneticQuirks.albinism === 2) { - r = `albino ${ r}`; + r = `albino ${r}`; } if (slave.dick > 9 && slave.balls > 9 && slave.boobs > 12000) { - r = `hyper ${ r}`; + r = `hyper ${r}`; } if (slave.boobs > 4000 && slave.lactation > 0) { if (slave.physicalAge < 13) { - r = `${r } calf`; + r = `${r} calf`; } else { - r = `${r } cow`; + r = `${r} cow`; } } else if (slave.lactation > 0) { - r = `milky ${ r}`; + r = `milky ${r}`; } if (slave.boobs > 20000) { - r = `supermassive titted ${ r}`; + r = `supermassive titted ${r}`; } else if (slave.boobs > 10000) { - r = `giant titted ${ r}`; + r = `giant titted ${r}`; } else if (slave.boobs > 4000) { - r = `huge titted ${ r}`; + r = `huge titted ${r}`; } else if (slave.boobs > 1000) { - r = `busty ${ r}`; + r = `busty ${r}`; } if (slave.dick > 5 && slave.balls > 5) { - r = `womb filling ${ r}`; + r = `womb filling ${r}`; } else if (slave.dick > 5) { - r = `well hung ${ r}`; + r = `well hung ${r}`; } if (slave.butt >= 12) { - r = `colossal assed ${ r}`; + r = `colossal assed ${r}`; } else if (slave.butt >= 12) { - r = `massive assed ${ r}`; + r = `massive assed ${r}`; } else if (slave.butt >= 8) { - r = `fat assed ${ r}`; + r = `fat assed ${r}`; } else if (slave.butt >= 6) { - r = `bottom heavy ${ r}`; + r = `bottom heavy ${r}`; } else if (slave.butt >= 4) { - r = `big bottomed ${ r}`; + r = `big bottomed ${r}`; } if (slave.weight > 10 && slave.weight < 100 && slave.boobs > 5000 && slave.butt > 5 && slave.hips >= 2 && slave.bellyPreg >= 30000 && slave.counter.births >= 10) { - r = `${r } fertility goddess`; + r = `${r} fertility goddess`; } else if (slave.counter.births >= 6) { - r = `${r } broodmother`; + r = `${r} broodmother`; } else if (slave.counter.births >= 3) { - r = `${r } breeder`; + r = `${r} breeder`; } if (slave.indenture > -1) { - r = `indentured ${ r}`; + r = `indentured ${r}`; } if (slave.preg > slave.pregData.normalBirth / 4 && slave.pregKnown === 1) { - r = `pregnant ${ r}`; + r = `pregnant ${r}`; } else if (slave.bellyFluid >= 5000) { - r = `bloated ${ r}`; + r = `bloated ${r}`; } else if (slave.belly >= 5000) { - r = `gravid ${ r}`; + r = `gravid ${r}`; } if (slave.fuckdoll > 0) { - r = `${r } fuckdoll`; + r = `${r} fuckdoll`; } } else { r = "slave"; /* I don't tihnk there is an 'else'? */ @@ -1321,24 +1363,24 @@ window.SlaveTitle = function SlaveTitle(slave) { /* NULLS */ r = "null"; if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = `${r } cow`; + r = `${r} cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `${r } bimbo `; + r = `${r} bimbo `; } else if (slave.boobs > 6000) { - r = `${r } boob`; + r = `${r} boob`; } else if (slave.butt > 6) { - r = `${r } ass`; + r = `${r} ass`; } else if ((slave.muscles > 30) && (slave.height < 185)) { - r = `${r } muscle`; + r = `${r} muscle`; } if (slave.visualAge > 55) { - r = `${r }GILF`; + r = `${r}GILF`; } else if (slave.visualAge > 35) { - r = `${r }MILF`; + r = `${r}MILF`; } else if (slave.visualAge >= 25) { - r = `${r }slave`; + r = `${r}slave`; } else { - r = `${r }girl`; + r = `${r}girl`; } } @@ -1354,15 +1396,15 @@ window.SlaveTitle = function SlaveTitle(slave) { r = "slavegirl"; } if ((slave.muscles > 30) && (slave.height < 185)) { - r = `muscle ${ r}`; + r = `muscle ${r}`; } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = `${r } cow`; + r = `${r} cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `${r } bimbo`; + r = `${r} bimbo`; } else if (slave.boobs > 6000) { - r = `boob${ r}`; + r = `boob${r}`; } else if (slave.butt > 6) { - r = `ass${ r}`; + r = `ass${r}`; } } @@ -1375,27 +1417,27 @@ window.SlaveTitle = function SlaveTitle(slave) { r = "futa "; } if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = `${r }cow`; + r = `${r}cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `${r }bimbo `; + r = `${r}bimbo `; } else if (slave.boobs > 6000) { - r = `${r }boob`; + r = `${r}boob`; } else if (slave.butt > 6) { - r = `${r }ass`; + r = `${r}ass`; } else if ((slave.muscles > 30) && (slave.height < 185)) { - r = `${r }muscle`; + r = `${r}muscle`; } if (slave.visualAge > 55) { - r = `${r }GILF`; + r = `${r}GILF`; } else if (slave.visualAge > 35) { - r = `${r }MILF`; + r = `${r}MILF`; } else if (slave.visualAge >= 25) { - r = `${r }slave`; + r = `${r}slave`; } else { - r = `${r }girl`; + r = `${r}girl`; } if (slave.dick > 5 && slave.balls > 5 && slave.boobs > 5000) { - r = `hyper ${ r}`; + r = `hyper ${r}`; } } @@ -1411,15 +1453,15 @@ window.SlaveTitle = function SlaveTitle(slave) { r = "tgirl"; } if ((slave.muscles > 30) && (slave.height < 185)) { - r = `muscle${ r}`; + r = `muscle${r}`; } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = `${r } cow`; + r = `${r} cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `${r } bimbo`; + r = `${r} bimbo`; } else if (slave.boobs > 6000) { - r = `topheavy ${ r}`; + r = `topheavy ${r}`; } else if (slave.butt > 6) { - r = `bottomheavy ${ r}`; + r = `bottomheavy ${r}`; } } @@ -1448,9 +1490,9 @@ window.SlaveTitle = function SlaveTitle(slave) { } } if (slave.lactation > 0) { - r = `${r } cow`; + r = `${r} cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `${r } bimbo`; + r = `${r} bimbo`; } } } @@ -1462,18 +1504,18 @@ window.SlaveTitle = function SlaveTitle(slave) { /* BITCHES: masculine shoulders or muscles */ r = "bitch"; if ((slave.muscles > 30) && (slave.height < 185)) { - r = `muscle${ r}`; + r = `muscle${r}`; } else if (slave.lactation > 0) { - r = `${r }cow`; + r = `${r}cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `bimbo ${ r}`; + r = `bimbo ${r}`; } if (slave.visualAge > 55) { - r = `aged ${ r}`; + r = `aged ${r}`; } else if (slave.visualAge > 35) { - r = `mature ${ r}`; + r = `mature ${r}`; } else if (slave.visualAge < 25) { - r = `young ${ r}`; + r = `young ${r}`; } } } @@ -1482,61 +1524,61 @@ window.SlaveTitle = function SlaveTitle(slave) { if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls === 0)) { r = "dick"; if (slave.visualAge > 55) { - r = `${r }GILF`; + r = `${r}GILF`; } else if (slave.visualAge > 35) { - r = `${r }MILF`; + r = `${r}MILF`; } else if (slave.visualAge >= 25) { - r = `${r }slave`; + r = `${r}slave`; } else { - r = `${r }girl`; + r = `${r}girl`; } if ((slave.muscles > 30) && (slave.height < 185)) { - r = `muscle${ r}`; + r = `muscle${r}`; } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = `${r } cow`; + r = `${r} cow`; } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = `${r } bimbo`; + r = `${r} bimbo`; } else if (slave.boobs > 6000) { - r = `boob ${ r}`; + r = `boob ${r}`; } else if (slave.butt > 6) { - r = `ass ${ r}`; + r = `ass ${r}`; } } if ((slave.muscles > 30) && (slave.height > 185)) { - r = `amazon ${ r}`; + r = `amazon ${r}`; } else if ((slave.muscles < 30) && (slave.height > 185)) { - r = `statuesque ${ r}`; + r = `statuesque ${r}`; } else if ((slave.boobs < 800) && (slave.height < 150)) { - r = `petite ${ r}`; + r = `petite ${r}`; } else if ((slave.boobs > 800) && (slave.height < 150)) { - r = `shortstack ${ r}`; + r = `shortstack ${r}`; } if (slave.counter.births >= 5) { - r = `${r } broodmother`; + r = `${r} broodmother`; } else if (slave.counter.births >= 2) { - r = `${r } breeder`; + r = `${r} breeder`; } if (slave.geneticQuirks.albinism === 2) { - r = `albino ${ r}`; + r = `albino ${r}`; } if (slave.indenture > -1) { - r = `indentured ${ r}`; + r = `indentured ${r}`; } if (slave.preg > slave.pregData.normalBirth / 4 && slave.pregKnown === 1) { - r = `pregnant ${ r}`; + r = `pregnant ${r}`; } else if (slave.bellyFluid >= 5000) { - r = `bloated ${ r}`; + r = `bloated ${r}`; } else if (slave.belly >= 5000) { - r = `gravid ${ r}`; + r = `gravid ${r}`; } if (slave.fuckdoll > 0) { - r = `${r } fuckdoll`; + r = `${r} fuckdoll`; } } return r; @@ -1567,10 +1609,10 @@ window.DegradingName = function DegradingName(slave) { const suffixes = []; if (slave.fuckdoll > 0) { - slave.slaveName = `Fuckdoll No. ${ slave.ID}`; + slave.slaveName = `Fuckdoll No. ${slave.ID}`; slave.slaveSurname = 0; } else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting >= 2) { - slave.slaveName = `Bioreactor No. ${ slave.ID}`; + slave.slaveName = `Bioreactor No. ${slave.ID}`; slave.slaveSurname = 0; } else { if (V.seeRace === 1) { @@ -1946,7 +1988,7 @@ window.DegradingName = function DegradingName(slave) { slave.slaveSurname = surname; }; -window.SlaveSort = function(){ +window.SlaveSort = function() { const comparators = { Aassignment: (a, b) => a.assignment < b.assignment ? -1 : 1, Dassignment: (a, b) => a.assignment > b.assignment ? -1 : 1, @@ -2083,20 +2125,23 @@ window.faceIncrease = function faceIncrease(slave, amount) { const his = pronouns.possessive; const His = capFirstChar(his); let r = ""; - if (slave.face <= -95) + if (slave.face <= -95) { r += `<span class="green">${His} face is no longer horrifying,</span> and is now merely ugly.`; - else if (slave.face <= -40 && slave.face + amount > -40) + } else if (slave.face <= -40 && slave.face + amount > -40) { r += `<span class="green">${His} face is no longer ugly,</span> and is now merely unattractive.`; - else if (slave.face <= -10 && slave.face + amount > -10) + } else if (slave.face <= -10 && slave.face + amount > -10) { r += `<span class="green">${His} face is no longer unattractive,</span> and is now somewhat tolerable.`; - else if (slave.face <= 10 && slave.face + amount > 10) + } else if (slave.face <= 10 && slave.face + amount > 10) { r += `<span class="green">${His} face is now decently attractive,</span> rather than merely tolerable.`; - else if (slave.face <= 40 && slave.face + amount > 40) + } else if (slave.face <= 40 && slave.face + amount > 40) { r += `<span class="green">${His} face is now quite beautiful,</span> rather than merely pretty.`; - else if (slave.face <= 95 && slave.face + amount > 95) + } else if (slave.face <= 95 && slave.face + amount > 95) { r += `<span class="green">${His} face is now perfect.</span> It's difficult to imagine how it could be any more beautiful.`; + } slave.face = Math.clamp(slave.face + amount, -100, 100); - if (slave.face > 95) slave.face = 100; + if (slave.face > 95) { + slave.face = 100; + } return r; }; diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 90124832f8816dc0ae48e623f9b9535240829155..47da3b346cd5d99ca599394477de6e97437b76af 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -4,8 +4,7 @@ window.assignJob = function assignJob(slave, job) { const V = State.variables; let r = ""; - if (job === "Pit" || job === "Coursing Association") - return r; + if (job === "Pit" || job === "Coursing Association") { return r; } removeJob(slave, slave.assignment); const idx = V.slaveIndices[slave.ID]; @@ -170,10 +169,11 @@ window.assignJob = function assignJob(slave, job) { slave.assignmentVisible = 0; V.masterSuiteSlaves++; V.MastSiIDs.push(slave.ID); - if (V.masterSuiteUpgradeLuxury > 0) + if (V.masterSuiteUpgradeLuxury > 0) { slave.livingRules = "luxurious"; - else + } else { slave.livingRules = "spare"; + } break; case "learn in the schoolroom": @@ -258,10 +258,11 @@ window.assignJob = function assignJob(slave, job) { case "be your concubine": slave.assignment = job; slave.assignmentVisible = 0; /* non-visible leadership roles */ - if (V.masterSuiteUpgradeLuxury > 0) + if (V.masterSuiteUpgradeLuxury > 0) { slave.livingRules = "luxurious"; - else + } else { slave.livingRules = "normal"; + } break; case "be your head girl": @@ -276,8 +277,7 @@ window.assignJob = function assignJob(slave, job) { if (V.dojo > 1) { slave.livingRules = "luxurious"; } - if (V.pitBG === 1 && V.fighterIDs.includes(slave.ID)) - V.fighterIDs.delete(slave.ID); + if (V.pitBG === 1 && V.fighterIDs.includes(slave.ID)) { V.fighterIDs.delete(slave.ID); } break; case "be your agent": @@ -303,24 +303,25 @@ window.assignJob = function assignJob(slave, job) { } if (slave.assignmentVisible === 0 && Array.isArray(V.personalAttention)) { - const awi = V.personalAttention.findIndex(function(s) {return s.ID === slave.ID;}); + const awi = V.personalAttention.findIndex(function(s) { return s.ID === slave.ID; }); if (awi !== -1) { V.personalAttention.deleteAt(awi); if (V.personalAttention.length === 0) { - if (V.PC.career === "escort") + if (V.PC.career === "escort") { V.personalAttention = "whoring"; - else if (V.PC.career === "servant") + } else if (V.PC.career === "servant") { V.personalAttention = "upkeep"; - else + } else { V.personalAttention = "business"; + } r += `${slave.slaveName} no longer has your personal attention; you plan to focus on ${V.personalAttention}.`; - } else + } else { r += `${slave.slaveName} no longer has your personal attention.`; + } } } V.JobIDArray = resetJobIDArray(); - if (idx >= 0) - V.slaves[idx] = slave; + if (idx >= 0) { V.slaves[idx] = slave; } return r; }; @@ -332,43 +333,42 @@ window.removeJob = function removeJob(slave, assignment) { const idx = V.slaveIndices[slave.ID]; - if (assignment === "Pit") + if (assignment === "Pit") { V.fighterIDs.delete(slave.ID); - - else if (assignment === "Coursing Association") + } else if (assignment === "Coursing Association") { V.Lurcher = 0; - - else { - if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID) + } else { + if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID) { V.HeadGirl = 0; - else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID) + } else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID) { V.Recruiter = 0; - else if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID) + } else if (V.Bodyguard !== 0 && slave.ID === V.Bodyguard.ID) { V.Bodyguard = 0; - else if (V.Madam !== 0 && slave.ID === V.Madam.ID) + } else if (V.Madam !== 0 && slave.ID === V.Madam.ID) { V.Madam = 0; - else if (V.DJ !== 0 && slave.ID === V.DJ.ID) + } else if (V.DJ !== 0 && slave.ID === V.DJ.ID) { V.DJ = 0; - else if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID) + } else if (V.Milkmaid !== 0 && slave.ID === V.Milkmaid.ID) { V.Milkmaid = 0; - else if (V.Farmer !== 0 && slave.ID === V.Farmer.ID) + } else if (V.Farmer !== 0 && slave.ID === V.Farmer.ID) { V.Farmer = 0; - else if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID) + } else if (V.Schoolteacher !== 0 && slave.ID === V.Schoolteacher.ID) { V.Schoolteacher = 0; - else if (V.Attendant !== 0 && slave.ID === V.Attendant.ID) + } else if (V.Attendant !== 0 && slave.ID === V.Attendant.ID) { V.Attendant = 0; - else if (V.Matron !== 0 && slave.ID === V.Matron.ID) + } else if (V.Matron !== 0 && slave.ID === V.Matron.ID) { V.Matron = 0; - else if (V.Nurse !== 0 && slave.ID === V.Nurse.ID) + } else if (V.Nurse !== 0 && slave.ID === V.Nurse.ID) { V.Nurse = 0; - else if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID) + } else if (V.Stewardess !== 0 && slave.ID === V.Stewardess.ID) { V.Stewardess = 0; - else if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID) + } else if (V.Wardeness !== 0 && slave.ID === V.Wardeness.ID) { V.Wardeness = 0; - else if (V.Concubine !== 0 && slave.ID === V.Concubine.ID) + } else if (V.Concubine !== 0 && slave.ID === V.Concubine.ID) { V.Concubine = 0; - else if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID) + } else if (V.Collectrix !== 0 && slave.ID === V.Collectrix.ID) { V.Collectrix = 0; + } /* use .toLowerCase() to get rid of a few dupe conditions. */ switch (assignment.toLowerCase()) { @@ -475,12 +475,13 @@ window.removeJob = function removeJob(slave, assignment) { case "be your head girl": slave.assignment = "rest"; if (V.HGSuiteEquality === 0 && V.personalAttention === "HG") { - if (V.PC.career === "escort") + if (V.PC.career === "escort") { V.personalAttention = "whoring"; - else if (V.PC.career === "servant") + } else if (V.PC.career === "servant") { V.personalAttention = "upkeep"; - else + } 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}.`; } @@ -492,12 +493,11 @@ window.removeJob = function removeJob(slave, assignment) { const _leaderIndex = V.leaders.findIndex(function(x) { return x.ID === slave.ID; }); - if (_leaderIndex !== -1) - V.leaders.deleteAt(_leaderIndex); + 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";}); + const _lover = V.slaves.findIndex(function(s) { return haveRelationshipP(s, slave) && s.assignment === "live with your agent"; }); if (_lover !== -1) { V.slaves[_lover].assignment = "rest"; V.slaves[_lover].assignmentVisible = 1; @@ -510,16 +510,18 @@ window.removeJob = function removeJob(slave, assignment) { break; } - if (slave.livingRules === "luxurious" && slave.assignmentVisible !== 1) + if (slave.livingRules === "luxurious" && slave.assignmentVisible !== 1) { slave.livingRules = "normal"; + } slave.assignmentVisible = 1; slave.choosesOwnAssignment = 0; slave.sentence = 0; } V.JobIDArray = resetJobIDArray(); - if (idx >= 0) + if (idx >= 0) { V.slaves[idx] = slave; + } return r; }; @@ -541,8 +543,9 @@ window.resetJobIDArray = function resetJobIDArray() { }; slaves.forEach(function(slave) { - if (JobIDArray.hasOwnProperty(slave.assignment)) + if (JobIDArray.hasOwnProperty(slave.assignment)) { JobIDArray[slave.assignment].push(slave.ID); + } }); return JobIDArray; @@ -602,7 +605,7 @@ App.UI.jobLinks = function() { const slave = App.Utils.slaveByIndex(index); for (const f of facilitiesOrder) { - if (!f.established) continue; + if (!f.established) { continue; } const rejects = f.canHostSlave(slave); if (rejects.length === 0) { transfers.push(f.transferLink(index, undefined, passage())); diff --git a/src/js/familyTreeJS.js b/src/js/familyTreeJS.js index e6cc775d6bbd8e31139499d44c3e0e72056e3de5..691dc1cecb3fae92385e0b55775a30f6744d88b5 100644 --- a/src/js/familyTreeJS.js +++ b/src/js/familyTreeJS.js @@ -48,7 +48,10 @@ window.renderFamilyTree = function(slaves, filterID) { } margin = { - top: 0, left: 0, bottom: 0, right: 0 + top: 0, + left: 0, + bottom: 0, + right: 0 }; @@ -195,7 +198,7 @@ window.renderFamilyTree = function(slaves, filterID) { .links(data.links); function dragstarted(d) { - if (!d3.event.active) simulation.alphaTarget(0.3).restart(); + if (!d3.event.active) { simulation.alphaTarget(0.3).restart(); } d.fx = d.x; d.fy = d.y; } @@ -206,7 +209,7 @@ window.renderFamilyTree = function(slaves, filterID) { } function dragended(d) { - if (!d3.event.active) simulation.alphaTarget(0); + if (!d3.event.active) { simulation.alphaTarget(0); } d.fx = null; d.fy = null; } @@ -536,8 +539,9 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS let numTreeNodes = 0; let graphElement = document.getElementById("graph"); - if (!graphElement) + if (!graphElement) { return; + } graphElement.innerHTML = ""; /* The way this code works is that we start with the activeSlave then we call @@ -563,8 +567,9 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS return activeSlave; } for (let i = 0; i < slaves.length; ++i) { - if (slaves[i].ID === id) + if (slaves[i].ID === id) { return slaves[i]; + } } return { "slaveName": "-", @@ -582,8 +587,9 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS } recursionProtectSlaveId[slave.ID] = true; - if (typeof slave.father === "undefined" || typeof slave.mother === "undefined") + 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); @@ -616,8 +622,9 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS let spouseToChild = {}; function maybeAddSpouseToChild(child) { - if (child.ID === slave.ID) + if (child.ID === slave.ID) { return; + } if (child.father === slave.ID) { if (!spouseToChild[child.mother]) { spouseToChild[child.mother] = []; @@ -631,29 +638,31 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS } } - if (activeSlave.ID !== PC.ID) + if (activeSlave.ID !== PC.ID) { maybeAddSpouseToChild(activeSlave); + } maybeAddSpouseToChild(getSlave(-1)); for (let i = 0; i < slaves.length; ++i) { let child = slaves[i]; - if (child.ID !== activeSlave.ID) + if (child.ID !== activeSlave.ID) { maybeAddSpouseToChild(child); + } } for (let key in spouseToChild) { if (spouseToChild.hasOwnProperty(key)) { - let children = shouldAddChildren?spouseToChild[key]:[]; + let children = shouldAddChildren ? spouseToChild[key] : []; let spouse = getSlave(key, (slaves.genes === "XX") ? "unknownXY" : (slaves.genes === "XY") ? "unknownXX" : "unknown"); let spouseName; if (spouse.ID !== slave.ID) { - spouseName = spouse.slaveName + (spouse.physicalAge?(` (${spouse.physicalAge})`):""); + spouseName = spouse.slaveName + (spouse.physicalAge ? (` (${spouse.physicalAge})`) : ""); } else { spouseName = (spouse.ID === -1) ? "(yourself)" : "(themselves)"; } let marriage = { "spouse": {"name": spouseName, "class": spouse.genes}, - "children": children.map(function(x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth + 1); }), + "children": children.map(function(x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth + 1); }) }; data.marriages.push(marriage); } @@ -661,16 +670,18 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS return data; } - if (activeSlave === PC || activeSlave === null) + if (activeSlave === PC || activeSlave === null) { activeSlave = getSlave(-1); + } const treeData = [slaveInfo(activeSlave, activeSlave.ID)]; console.log("Family tree is", treeData, 'and has:', numTreeNodes); let parentWidth = document.getElementById('editFamily').offsetWidth; console.log(parentWidth, document.getElementById('passages').offsetWidth); - if (!parentWidth) + if (!parentWidth) { parentWidth = document.body.offsetWidth - 483; + } console.log(parentWidth, Math.min(200 + 40 * numTreeNodes, parentWidth - 200) + 200); diff --git a/src/js/futureSocietyJS.js b/src/js/futureSocietyJS.js index 03dc2cdece4d59e73b6cfd65b988ab89aa830a1f..2351c02c0bc5d0ec4705e97052e21de49be73100 100644 --- a/src/js/futureSocietyJS.js +++ b/src/js/futureSocietyJS.js @@ -136,7 +136,9 @@ window.FutureSocieties = (function() { activeFS += arcology.FSNull / 17; } else if (V.FSCreditCount === 7) { activeFS += arcology.FSNull / 15; - } else { activeFS += arcology.FSNull / 20; } + } else { + activeFS += arcology.FSNull / 20; + } } V.FSCredits = Math.max(Math.trunc(V.FSGotRepCredits - activeFS), 0); } diff --git a/src/js/generateMarketSlave.js b/src/js/generateMarketSlave.js index 30bf3581877c2c6367f0efb9d9a962e06371e20c..1f153839b5139434d4a69747faefa6fd2ac028b4 100644 --- a/src/js/generateMarketSlave.js +++ b/src/js/generateMarketSlave.js @@ -1,3 +1,4 @@ +/* eslint-disable camelcase */ window.generateMarketSlave = function(market = "kidnappers", numArcology = 1) { const V = State.variables; let r = ``; @@ -77,7 +78,7 @@ window.generateMarketSlave = function(market = "kidnappers", numArcology = 1) { } else if (V.corpSpecRaces.length === 1) { r += `The corporation specializes in ${V.corpSpecRaces[0]} slaves. `; } else { - r += `The corporation selects slaves based on race. `; /*getting into the specifics of which races exactly is a hellhole I'd rather not jump into*/ + r += `The corporation selects slaves based on race. `; /* getting into the specifics of which races exactly is a hellhole I'd rather not jump into*/ } if (V.corpSpecTrust > 0) { V.activeSlave.trust = jsRandom(-105, -85) + V.corpSpecTrust * 20; diff --git a/src/js/hTagMacroJS.js b/src/js/hTagMacroJS.js index eae7530a3a8ec90f9f6aea11ba777f1dcfd482c3..3226d538fa31308ab76a8ef7e5defeeaefbf890a 100644 --- a/src/js/hTagMacroJS.js +++ b/src/js/hTagMacroJS.js @@ -31,8 +31,7 @@ Macro.add('htag', { } else { attributes = `id="${String(this.args[0]).trim()}"`; } - if (Config.debug) - { + if (Config.debug) { this.debugView.modes({ block: true }); diff --git a/src/js/physicalDevelopment.js b/src/js/physicalDevelopment.js index 31207d9dad07337d2bba0e8cf04b8011dcf07502..bda4e15f788572986f865b1a805ed76594218ce3 100644 --- a/src/js/physicalDevelopment.js +++ b/src/js/physicalDevelopment.js @@ -9,8 +9,8 @@ window.physicalDevelopment = (function physicalDevelopment() { return physicalDevelopment; /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function physicalDevelopment(slave) { if (slave.geneMods.NCS !== 1) { /* NCS completely blocks all natural physical growth: no height increases. It also blocks all hormonal secondary sexual * characteristics. So, on the female side: no boobs, no butt, no hips, and no labia. And on the male side: no dick, no clit, no balls, no scrotum, no shoulders. */ @@ -37,7 +37,8 @@ window.physicalDevelopment = (function physicalDevelopment() { increaseHipsXX(slave); increaseButtXX(slave); increasePregAdpatationXX(slave); - } else { /* shota becoming a man */ + } else { + /* shota becoming a man */ if (slave.geneticFlaws.dwarfism === 2 && slave.geneticFlaws.gigantism !== 2) { increaseHeightDwarf(slave); } else if (slave.geneticFlaws.gigantism === 2) { @@ -67,8 +68,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseHeightXX(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge === 3) { @@ -524,8 +525,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseHeightXY(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge === 3) { @@ -991,8 +992,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseHeightDwarf(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge === 3) { @@ -1458,8 +1459,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseHeightGiant(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge < 16) { @@ -1515,8 +1516,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseBoobsXX(slave) { if (slave.geneticQuirks.gigantomastia === 2 && slave.geneticQuirks.macromastia === 2) { gigantomastiaMod = 3; @@ -1725,8 +1726,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseBoobsXY(slave) { if (slave.geneticQuirks.gigantomastia === 2 && slave.geneticQuirks.macromastia === 2) { gigantomastiaMod = 3; @@ -1865,8 +1866,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseHipsXX(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge === 8) { @@ -2092,8 +2093,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseHipsXY(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge === 8) { @@ -2259,8 +2260,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseButtXX(slave) { rearQuirk = slave.geneticQuirks.rearLipedema === 2 ? 2 : 0; rearQuirkDivider = rearQuirk === 0 ? 1 : rearQuirk; @@ -2423,8 +2424,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseButtXY(slave) { rearQuirk = slave.geneticQuirks.rearLipedema === 2 ? 2 : 0; rearQuirkDivider = rearQuirk === 0 ? 1 : rearQuirk; @@ -2518,8 +2519,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseDick(slave) { dickMod = (slave.geneticQuirks.wellHung === 2 ? 2 : 1); @@ -2798,8 +2799,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseBalls(slave) { if (slave.hormoneBalance >= 200) { // @@ -3031,8 +3032,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseClit(slave) { if (slave.hormoneBalance <= -200) { if (slave.physicalAge === 8) { @@ -3177,8 +3178,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseWaistXX(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge >= 12) { @@ -3224,8 +3225,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseWaistXY(slave) { if (slave.hormoneBalance >= 200) { if (slave.physicalAge >= 12) { @@ -3271,8 +3272,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseFaceXX(slave) { if (slave.hormoneBalance >= 200) { if (slave.face > 60) { @@ -3320,8 +3321,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseFaceXY(slave) { if (slave.hormoneBalance >= 200) { if (slave.face > 60) { @@ -3343,8 +3344,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseVoiceXX(slave) { if (slave.hormoneBalance >= 200) { if (slave.voice === 3) { @@ -3380,8 +3381,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increaseVoiceXY(slave) { if (slave.hormoneBalance >= 200) { if (slave.voice < 2) { @@ -3417,8 +3418,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increasePregAdpatationXX(slave) { if (slave.physicalAge === 3) { if (slave.pregAdaptation < 5) { @@ -3488,8 +3489,8 @@ window.physicalDevelopment = (function physicalDevelopment() { } /** - * @param {App.Entity.SlaveState} slave - */ + * @param {App.Entity.SlaveState} slave + */ function increasePregAdpatationXY(slave) { if (slave.physicalAge === 3) { if (slave.pregAdaptation < 5) { diff --git a/src/js/pregJS.js b/src/js/pregJS.js index 853e4d66669c5c5c5cfc03816ebe5b13a1af97d4..177fd0e483b8ab9dea1d73afe0a8c601103b3a55 100644 --- a/src/js/pregJS.js +++ b/src/js/pregJS.js @@ -24,25 +24,25 @@ window.getPregBellySize = function(s) { window.bellyAdjective = function(slave) { if (slave.belly >= 1500) { if (slave.belly >= 1000000) { - if (slave.preg > slave.pregData.normalBirth/4) { + if (slave.preg > slave.pregData.normalBirth / 4) { return 'unfathomably distended, brimming with life'; } else { return `unfathomable`; } } else if (slave.belly >= 750000) { - if (slave.preg > slave.pregData.normalBirth/4) { + if (slave.preg > slave.pregData.normalBirth / 4) { return 'monolithic bulging'; } else { return `monolithic`; } } else if (slave.belly >= 600000) { - if (slave.preg > slave.pregData.normalBirth/4) { + if (slave.preg > slave.pregData.normalBirth / 4) { return 'titanic bulging'; } else { return `titanic`; } } else if (slave.belly >= 450000) { - if (slave.preg > slave.pregData.normalBirth/4) { + if (slave.preg > slave.pregData.normalBirth / 4) { return 'gigantic bulgy'; } else { return `gigantic`; @@ -146,7 +146,7 @@ window.setPregType = function(actor) { if (State.variables.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === "serve in the master suite" || actor.assignment === "be your Concubine"))) { fertilityStack += .5; } - if (State.variables.reproductionFormula === 1 && (State.variables.week-actor.weekAcquired > 0)) { + if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) { fertilityStack += .2; } if (actor.drugs === "super fertility drugs") { @@ -157,7 +157,7 @@ window.setPregType = function(actor) { fertilityStack = Math.floor(fertilityStack); if (State.variables.seeHyperPreg === 1) { if (actor.drugs === "super fertility drugs") { - ovum += jsRandom(0, fertilityStack*2); + ovum += jsRandom(0, fertilityStack * 2); } else { ovum += jsRandom(0, fertilityStack); } @@ -210,7 +210,7 @@ window.setPregType = function(actor) { fertilityStack++; fertilityStack++; } - if (State.variables.reproductionFormula === 1 && (State.variables.week-actor.weekAcquired > 0)) { + if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) { fertilityStack++; } if (actor.drugs === "super fertility drugs") { @@ -226,7 +226,7 @@ window.setPregType = function(actor) { } if (State.variables.seeHyperPreg === 1) { if (actor.drugs === "super fertility drugs") { - ovum += jsRandom(0, fertilityStack*2); + ovum += jsRandom(0, fertilityStack * 2); } else { ovum += jsRandom(0, fertilityStack); } @@ -275,7 +275,7 @@ window.setPregType = function(actor) { ovum += jsRandom(8, 16); fertilityStack += 10; } - if (State.variables.reproductionFormula === 1 && (State.variables.week-actor.weekAcquired > 0)) { + if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) { fertilityStack += 2; } if (actor.drugs === "super fertility drugs") { @@ -287,7 +287,7 @@ window.setPregType = function(actor) { } if (State.variables.seeHyperPreg === 1) { if (actor.drugs === "super fertility drugs") { - ovum += jsRandom(fertilityStack/2, fertilityStack*2); + ovum += jsRandom(fertilityStack / 2, fertilityStack * 2); } else { ovum += jsRandom(fertilityStack / 4, fertilityStack); } @@ -343,7 +343,7 @@ window.setPregType = function(actor) { fertilityStack++; fertilityStack++; } - if (State.variables.reproductionFormula === 1 && (State.variables.week-actor.weekAcquired > 0)) { + if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) { fertilityStack++; } if (actor.drugs === "super fertility drugs") { @@ -359,7 +359,7 @@ window.setPregType = function(actor) { } if (State.variables.seeHyperPreg === 1) { if (actor.drugs === "super fertility drugs") { - ovum += jsRandom(0, fertilityStack*2); + ovum += jsRandom(0, fertilityStack * 2); } else { ovum += jsRandom(0, fertilityStack); } @@ -474,11 +474,11 @@ window.knockMeUp = function(target, chance, hole, fatherID, displayOverride) { return r; }; -window.getIncubatorReserved = function(/* slaves */) { +window.getIncubatorReserved = function( /* slaves */ ) { return FetusGlobalReserveCount("incubator"); }; -window.getNurseryReserved = function(/* slaves */) { +window.getNurseryReserved = function( /* slaves */ ) { return FetusGlobalReserveCount("nursery"); }; @@ -507,8 +507,9 @@ window.findFather = function(fatherID) { window.adjustFatherProperty = function(actor, property, newValue) { let father = findFather(actor.ID); - if (father) + if (father) { father[property] = newValue; + } }; /* OLD diff --git a/src/js/quickListJS.js b/src/js/quickListJS.js index 8ac22f3e4c859dbdd3731ec668ec01de73d915d8..27fe34eed16eabb291a8b9a4fe1a9dfb792d7c9c 100644 --- a/src/js/quickListJS.js +++ b/src/js/quickListJS.js @@ -1,4 +1,4 @@ -window.sortDomObjects = function (objects, attrName, reverse = 0) { +window.sortDomObjects = function(objects, attrName, reverse = 0) { reverse = (reverse) ? -1 : 1; function sortingByAttr(a, b) { @@ -15,22 +15,22 @@ window.sortDomObjects = function (objects, attrName, reverse = 0) { return objects.toArray().sort(sortingByAttr); }; -window.sortButtonsByDevotion = function () { +window.sortButtonsByDevotion = function() { let $sortedButtons = $('#qlWrapper button').remove(); $sortedButtons = sortDomObjects($sortedButtons, 'data-devotion'); $($sortedButtons).appendTo($('#qlWrapper')); quickListBuildLinks(); }; -window.sortButtonsByTrust = function () { +window.sortButtonsByTrust = function() { let $sortedButtons = $('#qlWrapper button').remove(); $sortedButtons = sortDomObjects($sortedButtons, 'data-trust'); $($sortedButtons).appendTo($('#qlWrapper')); quickListBuildLinks(); }; -window.quickListBuildLinks = function () { - $("[data-scroll-to]").click(function () { +window.quickListBuildLinks = function() { + $("[data-scroll-to]").click(function() { let $this = $(this), $toElement = $this.attr('data-scroll-to'); // note the * 1 enforces $offset to be an integer, without @@ -44,31 +44,31 @@ window.quickListBuildLinks = function () { }); }; -window.sortIncubatorPossiblesByName = function () { +window.sortIncubatorPossiblesByName = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-name'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPregnancyWeek = function () { +window.sortIncubatorPossiblesByPregnancyWeek = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-week'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPregnancyCount = function () { +window.sortIncubatorPossiblesByPregnancyCount = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-count'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByReservedSpots = function () { +window.sortIncubatorPossiblesByReservedSpots = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-reserved-spots'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPreviousSort = function () { +window.sortIncubatorPossiblesByPreviousSort = function() { let sort = State.variables.sortIncubatorList; if ('unsorted' !== sort) { if ('Name' === sort) { @@ -83,31 +83,31 @@ window.sortIncubatorPossiblesByPreviousSort = function () { } }; -window.sortNurseryPossiblesByName = function () { +window.sortNurseryPossiblesByName = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-name'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPregnancyWeek = function () { +window.sortNurseryPossiblesByPregnancyWeek = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-preg-week'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPregnancyCount = function () { +window.sortNurseryPossiblesByPregnancyCount = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-preg-count'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByReservedSpots = function () { +window.sortNurseryPossiblesByReservedSpots = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-reserved-spots'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPreviousSort = function () { +window.sortNurseryPossiblesByPreviousSort = function() { let sort = State.variables.sortNurseryList; if ('unsorted' !== sort) { if ('Name' === sort) { diff --git a/src/js/removeActiveSlave.js b/src/js/removeActiveSlave.js index d07be0a9658e3c963785c8049b769baa07f502df..c93d9435f7e2d9602c5dd62ab5319fe1201382ed 100644 --- a/src/js/removeActiveSlave.js +++ b/src/js/removeActiveSlave.js @@ -125,7 +125,7 @@ window.removeActiveSlave = function removeActiveSlave() { } if (Array.isArray(V.personalAttention)) { - const _rasi = V.personalAttention.findIndex(function (s) { return s.ID === AS_ID; }); + const _rasi = V.personalAttention.findIndex(function(s) { return s.ID === AS_ID; }); if (_rasi !== -1) { V.personalAttention.deleteAt(_rasi); if (V.personalAttention.length === 0) { @@ -195,7 +195,7 @@ window.removeActiveSlave = function removeActiveSlave() { } } - const _geneIndex = V.genePool.findIndex(function (s) { return s.ID === AS_ID; }); + const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === AS_ID; }); if (_geneIndex !== -1) { let keep = false; if (V.traitor !== 0) { @@ -335,7 +335,7 @@ window.removeNonNGPSlave = function removeNonNGPSlave(removedSlave) { } }); - const _geneIndex = V.genePool.findIndex(function (s) { return s.ID === ID; }); + const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === ID; }); if (_geneIndex !== -1) { let keep = false; if (isImpregnatedBy(V.PC, removedSlave)) { diff --git a/src/js/rulesAssistant.js b/src/js/rulesAssistant.js index d14ba3ddf032048137490a73bba8a05617b64406..b3afe04950d86170278960e82d319ed0591caf57 100644 --- a/src/js/rulesAssistant.js +++ b/src/js/rulesAssistant.js @@ -72,7 +72,7 @@ window.mergeRules = function mergeRules(rules) { const applies = (combinedRule[key] === undefined || (key === "autoBrand" && rule[key]) || (key !== "autoBrand" && rule[key] !== "no default setting")); - if (!applies) return; + if (!applies) { return; } combinedRule[key] = rule[key]; }); }); @@ -97,7 +97,7 @@ window.ruleApplied = function(slave, rule) { window.RAFacilityRemove = function RAFacilityRemove(slave, rule) { const V = State.variables; let r = ""; - if (!rule.facilityRemove) return r; + if (!rule.facilityRemove) { return r; } switch (rule.setAssignment) { case "be confined in the arcade": if (slave.assignment === rule.setAssignment) { @@ -223,7 +223,7 @@ window.ruleAppliesP = function ruleAppliesP(cond, slave) { } // assignment / facility / special slaves / specific slaves check let assignment = slave.assignment; - if (assignment === "be your Concubine") assignment = "serve in the master suite"; + if (assignment === "be your Concubine") { assignment = "serve in the master suite"; } if (cond.specialSlaves !== -1) { // not "Include", which means "doesn't matter" flag = flag && (cond.specialSlaves == isLeaderP(slave)); // eslint-disable-line eqeqeq diff --git a/src/js/rulesAssistantOptions.js b/src/js/rulesAssistantOptions.js index 9dc37e63372bdcdc044dcb502194806d6f34a7b0..5f2376393182356cb44fc23f20053938dce244d9 100644 --- a/src/js/rulesAssistantOptions.js +++ b/src/js/rulesAssistantOptions.js @@ -18,10 +18,11 @@ window.rulesAssistantOptions = (function() { V.encyclopedia = "Personal Assistant"; if (V.currentRule !== null) { const idx = V.defaultRules.findIndex(rule => rule.ID === V.currentRule); - if (idx === -1) + if (idx === -1) { current_rule = V.defaultRules[0]; - else + } else { current_rule = V.defaultRules[idx]; + } } const root = new Root(element); } @@ -41,28 +42,30 @@ window.rulesAssistantOptions = (function() { if (V.defaultRules.length > 0) { const new_idx = idx < V.defaultRules.length ? idx : V.defaultRules.length - 1; V.currentRule = V.defaultRules[new_idx].ID; - } else V.currentRule = null; + } else { + V.currentRule = null; + } reload(root); } function lowerPriority(root) { - if (V.defaultRules.length === 1) return; // nothing to swap with + if (V.defaultRules.length === 1) { return; } // nothing to swap with const idx = V.defaultRules.findIndex(rule => rule.ID === current_rule.ID); - if (idx === 0) return; // no lower rule + if (idx === 0) { return; } // no lower rule arraySwap(V.defaultRules, idx, idx - 1); reload(root); } function higherPriority(root) { - if (V.defaultRules.length === 1) return; // nothing to swap with + if (V.defaultRules.length === 1) { return; } // nothing to swap with const idx = V.defaultRules.findIndex(rule => rule.ID === current_rule.ID); - if (idx === V.defaultRules.length - 1) return; // no higher rule + if (idx === V.defaultRules.length - 1) { return; } // no higher rule arraySwap(V.defaultRules, idx, idx + 1); reload(root); } function changeName(name, root) { - if (name === current_rule.name) return; + if (name === current_rule.name) { return; } current_rule.name = name; reload(root); } @@ -128,7 +131,7 @@ window.rulesAssistantOptions = (function() { constructor(header, hidden = false) { super(header); this.hidey = this.element.querySelector("div"); - if (hidden) this.toggle_hidey(); + if (hidden) { this.toggle_hidey(); } } render(header) { @@ -186,34 +189,36 @@ window.rulesAssistantOptions = (function() { } inputEdited() { - if (this.selectedItem) this.selectedItem.deselect(); + if (this.selectedItem) { this.selectedItem.deselect(); } this.propagateChange(); } selectItem(item) { - if (this.selectedItem) this.selectedItem.deselect(); + if (this.selectedItem) { this.selectedItem.deselect(); } this.selectedItem = item; this.setValue(item.data); this.propagateChange(); } setValue(what) { - if (this.value.tagName === "INPUT") + if (this.value.tagName === "INPUT") { this.value.value = `${what}`; - else + } else { this.value.innerHTML = `${what}`; + } } getData(what) { - return (this.value.tagName === "INPUT" ? this.parse(this.value.value): this.selectedItem.data); + return (this.value.tagName === "INPUT" ? this.parse(this.value.value) : this.selectedItem.data); } // customizable input field parser / sanity checker parse(what) { return what; } propagateChange() { - if (this.onchange instanceof Function) + if (this.onchange instanceof Function) { this.onchange(this.getData()); + } } } @@ -234,7 +239,7 @@ window.rulesAssistantOptions = (function() { } select() { - if (this.selected) return false; + if (this.selected) { return false; } this.parent.selectItem(this); this.element.classList.add("selected"); this.selected = true; @@ -261,7 +266,7 @@ window.rulesAssistantOptions = (function() { this.inputEdited(); }; res.onkeypress = (e) => { - if (returnP(e)) this.inputEdited(); + if (returnP(e)) { this.inputEdited(); } }; return res; } @@ -283,7 +288,7 @@ window.rulesAssistantOptions = (function() { this.inputEdited(); }; res.onkeypress = (e) => { - if (returnP(e)) this.inputEdited(); + if (returnP(e)) { this.inputEdited(); } }; return res; } @@ -428,10 +433,11 @@ window.rulesAssistantOptions = (function() { const text = this.textarea.value; try { const rule = JSON.parse(text); - if (rule instanceof Array) + if (rule instanceof Array) { rule.forEach(r => V.defaultRules.push(r)); - else + } else { V.defaultRules.push(rule); + } reload(this.root); } catch (e) { alert(`Couldn't import that rule:\n${e.message}`); @@ -518,7 +524,7 @@ window.rulesAssistantOptions = (function() { constructor(root) { super(); this.element.onblur = () => changeName(this.element.value, root); - this.element.onkeypress = (e) => { if (returnP(e)) changeName(this.element.value, root); }; + this.element.onkeypress = (e) => { if (returnP(e)) { changeName(this.element.value, root); } }; } render() { @@ -637,7 +643,7 @@ window.rulesAssistantOptions = (function() { } show_custom_editor(what, ...args) { - if (this.custom_editor !== null) this.hide_custom_editor(); + if (this.custom_editor !== null) { this.hide_custom_editor(); } this.custom_editor = new what(...args); this.appendChild(this.custom_editor); } @@ -681,7 +687,7 @@ window.rulesAssistantOptions = (function() { class CustomEditor extends Element { constructor(data) { - if (data.length === 0) data = "(slave) => slave.slaveName === 'Fancy Name'"; + if (data.length === 0) { data = "(slave) => slave.slaveName === 'Fancy Name'"; } super(data); } @@ -709,7 +715,7 @@ window.rulesAssistantOptions = (function() { const min = document.createElement("input"); min.setAttribute("type", "text"); min.value = `${data.value[0]}`; - min.onkeypress = e => { if (returnP(e)) this.setmin(min.value); }; + min.onkeypress = e => { if (returnP(e)) { this.setmin(min.value); } }; min.onblur = e => this.setmin(min.value); this.min = min; elem.appendChild(min); @@ -723,7 +729,7 @@ window.rulesAssistantOptions = (function() { const max = document.createElement("input"); max.setAttribute("type", "text"); max.value = `${data.value[1]}`; - max.onkeypress = e => { if (returnP(e)) this.setmax(max.value); }; + max.onkeypress = e => { if (returnP(e)) { this.setmax(max.value); } }; max.onblur = e => this.setmax(max.value); this.max = max; elem.appendChild(max); @@ -737,10 +743,11 @@ window.rulesAssistantOptions = (function() { parse(value) { value = value.trim(); - if (value === "null") value = null; - else { + if (value === "null") { + value = null; + } else { value = parseInt(value); - if (isNaN(value)) value = null; + if (isNaN(value)) { value = null; } } return value; } @@ -782,7 +789,7 @@ window.rulesAssistantOptions = (function() { const input = document.createElement("input"); input.setAttribute("type", "text"); input.value = JSON.stringify(data.value); - input.onkeypress = e => { if (returnP(e)) this.setValue(input); }; + input.onkeypress = e => { if (returnP(e)) { this.setValue(input); } }; input.onblur = e => this.setValue(input); this.input = input; elem.appendChild(input); @@ -818,18 +825,42 @@ window.rulesAssistantOptions = (function() { constructor() { super("Apply to assignments and facilities"); const items = ["Classes", "Confined", "Fucktoy", "Gloryhole", "House Servant", "Milked", "Public Servant", "Rest", "Subordinate Slave", "Whore"]; - if (V.HGSuite > 0) items.push("Head Girl Suite"); - if (V.brothel > 0) items.push("Brothel"); - if (V.club > 0) items.push("Club"); - if (V.arcade > 0) items.push("Arcade"); - if (V.dairy > 0) items.push("Dairy"); - if (V.servantsQuarters > 0) items.push("Servant Quarters"); - if (V.masterSuite > 0) items.push("Master Suite"); - if (V.schoolroom > 0) items.push("Schoolroom"); - if (V.spa > 0) items.push("Spa"); - if (V.nursery > 0) items.push("Nursery"); - if (V.clinic > 0) items.push("Clinic"); - if (V.cellblock > 0) items.push("Cellblock"); + if (V.HGSuite > 0) { + items.push("Head Girl Suite"); + } + if (V.brothel > 0) { + items.push("Brothel"); + } + if (V.club > 0) { + items.push("Club"); + } + if (V.arcade > 0) { + items.push("Arcade"); + } + if (V.dairy > 0) { + items.push("Dairy"); + } + if (V.servantsQuarters > 0) { + items.push("Servant Quarters"); + } + if (V.masterSuite > 0) { + items.push("Master Suite"); + } + if (V.schoolroom > 0) { + items.push("Schoolroom"); + } + if (V.spa > 0) { + items.push("Spa"); + } + if (V.nursery > 0) { + items.push("Nursery"); + } + if (V.clinic > 0) { + items.push("Clinic"); + } + if (V.cellblock > 0) { + items.push("Cellblock"); + } items.forEach( i => this.appendChild(new ButtonItem(i, this.getAttribute(i), current_rule.condition.assignment.includes(this.getAttribute(i))))); } @@ -889,13 +920,13 @@ window.rulesAssistantOptions = (function() { } show_slave_selection() { - if (this.subwidget) this.subwidget.remove(); + if (this.subwidget) { this.subwidget.remove(); } this.subwidget = new SlaveSelection(); this.appendChild(this.subwidget); } show_slave_exclusion() { - if (this.subwidget) this.subwidget.remove(); + if (this.subwidget) { this.subwidget.remove(); } this.subwidget = new SlaveExclusion(); this.appendChild(this.subwidget); } @@ -977,15 +1008,17 @@ window.rulesAssistantOptions = (function() { class RegimenSection extends Section { constructor() { super("Physical Regimen Settings"); - if (V.arcologies[0].FSAssetExpansionistResearch === 1) + if (V.arcologies[0].FSAssetExpansionistResearch === 1) { this.appendChild(new HyperGrowthSwitch()); + } this.appendChild(new GrowthList()); this.appendChild(new CurrativesList()); this.appendChild(new AphrodisiacList()); this.appendChild(new ContraceptiveList()); this.appendChild(new AbortionList()); - if (V.pregSpeedControl) + if (V.pregSpeedControl) { this.appendChild(new PregDrugsList()); + } this.appendChild(new FemaleHormonesList()); this.appendChild(new ShemaleHormonesList()); this.appendChild(new GeldingHormonesList()); @@ -1086,8 +1119,9 @@ window.rulesAssistantOptions = (function() { this.appendChild(new UpperBackTattooList()); this.appendChild(new LowerBackTattooList()); this.appendChild(new AbdomenTattooList()); - if (V.seeDicks || V.makeDicks) + if (V.seeDicks || V.makeDicks) { this.appendChild(new DickTattooList()); + } this.appendChild(new ButtockTattooList()); this.appendChild(new AnalTattooList()); this.appendChild(new LegTattooList()); @@ -1115,8 +1149,9 @@ window.rulesAssistantOptions = (function() { this.appendChild(new TummyTuckSurgeryList()); this.appendChild(new BodyHairSurgeryList()); this.appendChild(new HairSurgeryList()); - if (V.bellyImplants > 0) + if (V.bellyImplants > 0) { this.appendChild(new BellyImplantList()); + } } } @@ -1236,8 +1271,8 @@ window.rulesAssistantOptions = (function() { ["Toga (FS)", "a toga"], ["Western clothing (FS)", "Western clothing"], ]; - spclothes.forEach(pair => { if (isItemAccessible(pair[1])) nclothes.push(pair); }); - fsnclothes.forEach(pair => { if (isItemAccessible(pair[1])) nclothes.push(pair); }); + spclothes.forEach(pair => { if (isItemAccessible(pair[1])) { nclothes.push(pair); } }); + fsnclothes.forEach(pair => { if (isItemAccessible(pair[1])) { nclothes.push(pair); } }); const nice = new ListSubSection(this, "Nice", nclothes); this.appendChild(nice); @@ -1251,7 +1286,7 @@ window.rulesAssistantOptions = (function() { const fshclothes = [ ["Chains (FS)", "chains"], ]; - fshclothes.forEach(pair => { if (isItemAccessible(pair[1])) hclothes.push(pair); }); + fshclothes.forEach(pair => { if (isItemAccessible(pair[1])) { hclothes.push(pair); } }); const harsh = new ListSubSection(this, "Harsh", hclothes); this.appendChild(harsh); @@ -1278,22 +1313,26 @@ window.rulesAssistantOptions = (function() { ["Bell", "bell collar"], ["Cowbell", "leather with cowbell"] ]; - if (V.seeAge !== 0) - ncollars.push(["Nice retirement counter", "nice retirement counter"]); + if (V.seeAge !== 0) { ncollars.push(["Nice retirement counter", "nice retirement counter"]); } const fsncollars = [ ["Bowtie collar", "bowtie"], ["Ancient Egyptian", "ancient Egyptian"], ]; - fsncollars.forEach(pair => { if (isItemAccessible(pair[1])) ncollars.push(pair); }); + fsncollars.forEach(pair => { if (isItemAccessible(pair[1])) { ncollars.push(pair); } }); const nice = new ListSubSection(this, "Nice", ncollars); this.appendChild(nice); const hcollars = []; setup.harshCollars.forEach(item => { - if (item.fs === "seeAge" && V.seeAge === 0) return; - else if (item.fs === "seePreg" && V.seePreg === 0) return; - else if (item.rs === "buyGag" && V.toysBoughtGags !== 1) return; - else hcollars.push([item.name, item.value]); + if (item.fs === "seeAge" && V.seeAge === 0) { + return; + } else if (item.fs === "seePreg" && V.seePreg === 0) { + return; + } else if (item.rs === "buyGag" && V.toysBoughtGags !== 1) { + return; + } else { + hcollars.push([item.name, item.value]); + } }); const harsh = new ListSubSection(this, "Harsh", hcollars); this.appendChild(harsh); @@ -1315,12 +1354,13 @@ window.rulesAssistantOptions = (function() { constructor() { const bellies = []; setup.bellyAccessories.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { bellies.push([acc.name, acc.value]); - else if (acc.fs === "repopulation" && V.arcologies[0].FSRepopulationFocus !== "unset") + } else if (acc.fs === "repopulation" && V.arcologies[0].FSRepopulationFocus !== "unset") { bellies.push([`${acc.name} (FS)`, acc.value]); - else if (acc.rs === "boughtBelly" && V.clothesBoughtBelly === 1) + } else if (acc.rs === "boughtBelly" && V.clothesBoughtBelly === 1) { bellies.push([`${acc.name} (Purchased)`, acc.value]); +} }); super("Corsetage", bellies); this.setValue(current_rule.set.bellyAccessory); @@ -1359,10 +1399,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.vaginalAccessories.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyBigDildos" && V.toysBoughtDildos === 1) + } else if (acc.rs === "buyBigDildos" && V.toysBoughtDildos === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); + } }); super("Vaginal accessories for virgins", accs); this.setValue(current_rule.set.virginAccessory); @@ -1374,10 +1415,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.vaginalAccessories.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyBigDildos" && V.toysBoughtDildos === 1) + } else if (acc.rs === "buyBigDildos" && V.toysBoughtDildos === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); + } }); super("Vaginal accessories for anal virgins", accs); this.setValue(current_rule.set.aVirginAccessory); @@ -1389,10 +1431,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.vaginalAccessories.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyBigDildos" && V.toysBoughtDildos === 1) + } else if (acc.rs === "buyBigDildos" && V.toysBoughtDildos === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); + } }); super("Vaginal accessories for other slaves", accs); this.setValue(current_rule.set.vaginalAccessory); @@ -1404,10 +1447,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.vaginalAttachments.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyVaginalAttachments" && V.toysBoughtVaginalAttachments === 1) + } else if (acc.rs === "buyVaginalAttachments" && V.toysBoughtVaginalAttachments === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); + } }); super("Vaginal attachments for slaves with vaginal accessories", accs); this.setValue(current_rule.set.vaginalAttachment); @@ -1461,10 +1505,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.buttplugs.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyBigPlugs" && V.toysBoughtButtPlugs === 1) + } else if (acc.rs === "buyBigPlugs" && V.toysBoughtButtPlugs === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); +} }); super("Buttplugs for anal virgins", accs); this.setValue(current_rule.set.aVirginButtplug); @@ -1476,10 +1521,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.buttplugs.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyBigPlugs" && V.toysBoughtButtPlugs === 1) + } else if (acc.rs === "buyBigPlugs" && V.toysBoughtButtPlugs === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); +} }); super("Buttplugs for other slaves", accs); this.setValue(current_rule.set.buttplug); @@ -1491,10 +1537,11 @@ window.rulesAssistantOptions = (function() { constructor() { const accs = []; setup.buttplugAttachments.forEach(acc => { - if (acc.fs === undefined && acc.rs === undefined) + if (acc.fs === undefined && acc.rs === undefined) { accs.push([acc.name, acc.value]); - else if (acc.rs === "buyTails" && V.toysBoughtButtPlugTails === 1) + } else if (acc.rs === "buyTails" && V.toysBoughtButtPlugTails === 1) { accs.push([`${acc.name} (Purchased)`, acc.value]); +} }); super("Buttplug attachments for slaves with buttplugs", accs); this.setValue(current_rule.set.buttplugAttachment); @@ -1595,8 +1642,8 @@ window.rulesAssistantOptions = (function() { this.breasts.setValue(350); this.butts.setValue(2); this.lips.setValue(25); - if (this.dicks) this.dicks.setValue(0); - if (this.balls) this.balls.setValue(0); + if (this.dicks) { this.dicks.setValue(0); } + if (this.balls) { this.balls.setValue(0); } this.sublists.forEach(i => i.propagateChange()); } @@ -1604,8 +1651,8 @@ window.rulesAssistantOptions = (function() { this.breasts.setValue(1000); this.butts.setValue(5); this.lips.setValue(25); - if (this.dicks) this.dicks.setValue(4); - if (this.balls) this.balls.setValue(4); + if (this.dicks) { this.dicks.setValue(4); } + if (this.balls) { this.balls.setValue(4); } this.sublists.forEach(i => i.propagateChange()); } @@ -1613,8 +1660,8 @@ window.rulesAssistantOptions = (function() { this.breasts.setValue(9000); this.butts.setValue(10); this.lips.setValue(45); - if (this.dicks) this.dicks.setValue(6); - if (this.balls) this.balls.setValue(6); + if (this.dicks) { this.dicks.setValue(6); } + if (this.balls) { this.balls.setValue(6); } this.sublists.forEach(i => i.propagateChange()); } @@ -1622,8 +1669,8 @@ window.rulesAssistantOptions = (function() { this.breasts.setValue(48000); this.butts.setValue(20); this.lips.setValue(100); - if (this.dicks) this.dicks.setValue(30); - if (this.balls) this.balls.setValue(125); + if (this.dicks) { this.dicks.setValue(30); } + if (this.balls) { this.balls.setValue(125); } this.sublists.forEach(i => i.propagateChange()); } @@ -1856,14 +1903,16 @@ window.rulesAssistantOptions = (function() { ["intensive testicle enhancement"], ]; - if (V.growthStim === 1) + if (V.growthStim === 1) { drugs.push(["Growth Stimulants (Research)", "growth stimulants"]); + } if (V.precociousPuberty === 1 && V.pubertyHormones) { drugs.push(["Female hormone injections (Research)", "female hormone injections"]); drugs.push(["Male hormone injections (Research)", "male hormone injections"]); } - if (V.purchasedSagBGone === 1) + if (V.purchasedSagBGone === 1) { drugs.push(["Sag-B-gone (Product)", "sag-B-gone"]); + } if (V.arcologies[0].FSSlimnessEnthusiastResearch === 1) { drugs.push(["Weight loss pills (FS)", "appetite suppressors"]); drugs.push(["breast redistributors"]); @@ -1881,10 +1930,12 @@ window.rulesAssistantOptions = (function() { drugs.push(["hyper penis enhancement"]); drugs.push(["hyper testicle enhancement"]); } - if (V.arcologies[0].FSYouthPreferentialistResearch === 1) + if (V.arcologies[0].FSYouthPreferentialistResearch === 1) { drugs.push(["Anti-aging cream (FS)", "anti-aging cream"]); - if (V.seeHyperPreg === 1 && V.superFertilityDrugs === 1) + } + if (V.seeHyperPreg === 1 && V.superFertilityDrugs === 1) { drugs.push(["Super fertility drugs", "super fertility drugs"]); + } super("Other drugs", drugs); this.setValue(current_rule.set.drug); this.onchange = (value) => current_rule.set.drug = value; @@ -1926,15 +1977,19 @@ window.rulesAssistantOptions = (function() { ["Feminine", "XX"], ["Masculine", "XY"] ); - if (V.dietXXY === 1) + if (V.dietXXY === 1) { diets.push(["Futanari", "XXY"]); + } } - if (V.dietCleanse === 1) + if (V.dietCleanse === 1) { diets.push(["Cleansing", "cleansing"]); - if (V.dietFertility === 1) + } + if (V.dietFertility === 1) { diets.push(["Fertility", "fertility"]); - if (V.cumProDiet === 1) + } + if (V.cumProDiet === 1) { diets.push(["Cum production", "cum production"]); + } super("Slave diets", diets, true); this.setValue(current_rule.set.diet); @@ -2265,16 +2320,21 @@ window.rulesAssistantOptions = (function() { combine() { const lst = []; - if (this.colorlist.value !== "no default setting") + if (this.colorlist.value !== "no default setting") { lst.push(this.colorlist.value); - if (this.shapelist.value !== "no default setting") + } + if (this.shapelist.value !== "no default setting") { lst.push(this.shapelist.value); - if (lst.length === 0) return "no default setting"; - else return lst.join(" "); + } + if (lst.length === 0) { + return "no default setting"; + } else { + return lst.join(" "); + } } setValue(val) { - if (val === undefined) val = this.combine(); + if (val === undefined) { val = this.combine(); } this.label.innerText = `${val} `; current_rule.set.eyeColor = val; } @@ -3031,77 +3091,101 @@ window.rulesAssistantOptions = (function() { ["Devil", "a devil silhouette"] ]; - if (V.arcologies[0].FSSupremacist !== "unset" || V.arcologies[0].FSSubjugationist !== "unset") + if (V.arcologies[0].FSSupremacist !== "unset" || V.arcologies[0].FSSubjugationist !== "unset") { items.push(["(FS) Racial Slur", "a racial slur"]); + } - if (V.arcologies[0].FSSupremacist !== "unset" && V.arcologies[0].FSSupremacistRace === "white") + if (V.arcologies[0].FSSupremacist !== "unset" && V.arcologies[0].FSSupremacistRace === "white") { items.push(["(FS) Swastika", "a swastika"]); + } - if (V.arcologies[0].FSSubjugationist !== "unset" && V.arcologies[0].FSSubjugationistRace === "semitic") + if (V.arcologies[0].FSSubjugationist !== "unset" && V.arcologies[0].FSSubjugationistRace === "semitic") { items.push(["(FS) Star of David", "a Star of David"]); + } - if (V.arcologies[0].FSGenderRadicalist !== "unset" || V.arcologies.FSGenderFundamentalist !== "unset") + if (V.arcologies[0].FSGenderRadicalist !== "unset" || V.arcologies.FSGenderFundamentalist !== "unset") { items.push(["(FS) Gender Symbol", "a gender symbol"]); + } - if (V.arcologies[0].FSPaternalist !== "unset") + if (V.arcologies[0].FSPaternalist !== "unset") { items.push(["(FS) Personal Symbol", "her own personal symbol"]); + } - if (V.arcologies[0].FSDegradationist !== "unset") + if (V.arcologies[0].FSDegradationist !== "unset") { items.push(["(FS) Chain Symbol", "a chain symbol"]); + } - if (V.arcologies[0].FSBodyPurist !== "unset") + if (V.arcologies[0].FSBodyPurist !== "unset") { items.push(["(FS) Vitruvian Man", "a Vitruvian man"]); + } - if (V.arcologies[0].FSTransformationFetishist !== "unset") + if (V.arcologies[0].FSTransformationFetishist !== "unset") { items.push(["(FS) Most Desired Implants", "a shortlist of desired implants"]); + } - if (V.arcologies[0].FSYouthPreferentialist !== "unset") + if (V.arcologies[0].FSYouthPreferentialist !== "unset") { items.push(["(FS) Virginity Status", "her virginity status"]); + } - if (V.arcologies[0].FSMaturityPreferentialist !== "unset") + if (V.arcologies[0].FSMaturityPreferentialist !== "unset") { items.push(["(FS) Sexual Skill Info", "her sexual skills"]); + } - if (V.arcologies[0].FSSlimnessEnthusiast !== "unset") + if (V.arcologies[0].FSSlimnessEnthusiast !== "unset") { items.push(["(FS) Breast Ceiling", "her absolute maximum breast size"]); + } - if (V.arcologies[0].FSAssetExpansionist !== "unset") + if (V.arcologies[0].FSAssetExpansionist !== "unset") { items.push(["(FS) Breast Floor", "her absolute minimum breast size"]); + } - if (V.arcologies[0].FSPastoralist !== "unset") + if (V.arcologies[0].FSPastoralist !== "unset") { items.push(["(FS) Product Quality", "her body product quality"]); + } - if (V.arcologies[0].FSPhysicalIdealist !== "unset") + if (V.arcologies[0].FSPhysicalIdealist !== "unset") { items.push(["(FS) Deadlift Info", "her deadlift record"]); + } - if (V.arcologies[0].FSHedonisticDecadence !== "unset") + if (V.arcologies[0].FSHedonisticDecadence !== "unset") { items.push(["(FS) Weight Record", "her highest weigh-in"]); + } - if (V.arcologies[0].FSHedonisticDecadence && V.PC.refreshmentType === 2) + if (V.arcologies[0].FSHedonisticDecadence && V.PC.refreshmentType === 2) { items.push(["(FS) Favorite Food", `a big helping of ${V.PC.refreshment}`]); + } - if (V.arcologies[0].FSRepopulationFocus !== "unset") + if (V.arcologies[0].FSRepopulationFocus !== "unset") { items.push(["(FS) Birth Count", "the number of children she has birthed"]); + } - if (V.arcologies[0].FSChattelReligionist !== "unset") + if (V.arcologies[0].FSChattelReligionist !== "unset") { items.push(["(FS) Religious Symbol", "a religious symbol"]); + } - if (V.arcologies[0].FSRomanRevivalist !== "unset") + if (V.arcologies[0].FSRomanRevivalist !== "unset") { items.push(["(FS) Republican Crest", "a small crest of your Republic"]); + } - if (V.arcologies[0].FSAztecRevivalist !== "unset") + if (V.arcologies[0].FSAztecRevivalist !== "unset") { items.push(["(FS) Seven Serpents", "a small symbol of the Aztec gods"]); + } - if (V.arcologies[0].FSEgyptianRevivalist !== "unset") + if (V.arcologies[0].FSEgyptianRevivalist !== "unset") { items.push(["(FS) Dynastic Sigil", "a small sigil of your Dynasty"]); + } - if (V.arcologies[0].FSEdoRevivalist !== "unset") + if (V.arcologies[0].FSEdoRevivalist !== "unset") { items.push(["(FS) Mon", "a small image of the Shogunate's mon"]); + } - if (V.arcologies[0].FSArabianRevivalist !== "unset") + if (V.arcologies[0].FSArabianRevivalist !== "unset") { items.push(["(FS) Caliphate Symbol", "a small symbol of the Caliphate"]); + } - if (V.arcologies[0].FSChineseRevivalist !== "unset") + if (V.arcologies[0].FSChineseRevivalist !== "unset") { items.push(["(FS) Imperial Seal", "a small image of your Imperial Seal"]); + } super("Your brand design is", items, true); } @@ -3603,18 +3687,42 @@ window.rulesAssistantOptions = (function() { ["Choose Her Own", "choose her own job"] ]; - if (V.HGSuite > 0) items.push(["Head Girl Suite", "live with your Head Girl"]); - if (V.brothel > 0) items.push(["Brothel", "work in the brothel"]); - if (V.club > 0) items.push(["Club", "serve in the club"]); - if (V.arcade > 0) items.push(["Arcade", "be confined in the arcade"]); - if (V.dairy > 0) items.push(["Dairy", "work in the dairy"]); - if (V.farmyard > 0) items.push(["Farmyard", "work as a farmhand"]); - if (V.servantsQuarters > 0) items.push(["Servant Quarters", "work as a servant"]); - if (V.masterSuite > 0) items.push(["Master Suite", "serve in the master suite"]); - if (V.schoolroom > 0) items.push(["Schoolroom", "learn in the schoolroom"]); - if (V.spa > 0) items.push(["Spa", "rest in the spa"]); - if (V.clinic > 0) items.push(["Clinic", "get treatment in the clinic"]); - if (V.cellblock > 0) items.push(["Cellblock", "be confined in the cellblock"]); + if (V.HGSuite > 0) { + items.push(["Head Girl Suite", "live with your Head Girl"]); + } + if (V.brothel > 0) { + items.push(["Brothel", "work in the brothel"]); + } + if (V.club > 0) { + items.push(["Club", "serve in the club"]); + } + if (V.arcade > 0) { + items.push(["Arcade", "be confined in the arcade"]); + } + if (V.dairy > 0) { + items.push(["Dairy", "work in the dairy"]); + } + if (V.farmyard > 0) { + items.push(["Farmyard", "work as a farmhand"]); + } + if (V.servantsQuarters > 0) { + items.push(["Servant Quarters", "work as a servant"]); + } + if (V.masterSuite > 0) { + items.push(["Master Suite", "serve in the master suite"]); + } + if (V.schoolroom > 0) { + items.push(["Schoolroom", "learn in the schoolroom"]); + } + if (V.spa > 0) { + items.push(["Spa", "rest in the spa"]); + } + if (V.clinic > 0) { + items.push(["Clinic", "get treatment in the clinic"]); + } + if (V.cellblock > 0) { + items.push(["Cellblock", "be confined in the cellblock"]); + } super("Automatically set assignment", items); this.setValue(current_rule.set.setAssignment); diff --git a/src/js/rulesAutosurgery.js b/src/js/rulesAutosurgery.js index 6cc77c4bfc933687327546a1629a77fc70fe2e29..6be658d7a683bc0ad06df62102050af5bc30acf3 100644 --- a/src/js/rulesAutosurgery.js +++ b/src/js/rulesAutosurgery.js @@ -154,50 +154,74 @@ window.rulesAutosurgery = (function() { surgeries.push("surgery to correct her vision"); slave.eyes = 1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.hears === -1 && thisSurgery.surgery_hears === 0) { surgeries.push("surgery to correct her hearing"); slave.hears = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.smells === -1 && thisSurgery.surgery_smells === 0) { surgeries.push("surgery to correct her sense of smell"); slave.smells = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.smells === 0 && thisSurgery.surgery_smells === -1) { surgeries.push("surgery to muffle her sense of smell"); slave.smells = -1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.tastes === -1 && thisSurgery.surgery_tastes === 0) { surgeries.push("surgery to correct her sense of taste"); slave.tastes = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.tastes === 0 && thisSurgery.surgery_tastes === -1) { surgeries.push("surgery to muffle her sense of taste"); slave.tastes = -1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } } if (slave.health > 20 && surgeries.length < 3) { @@ -205,20 +229,29 @@ window.rulesAutosurgery = (function() { surgeries.push("surgery to remove her lactation implants"); slave.lactation = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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"; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if ((slave.boobShape === "normal" || slave.boobShape === "wide-set") && thisSurgery.surgery_cosmetic > 0 && slave.breastMesh !== 1) { if (slave.boobs > 800) { slave.boobShape = "torpedo-shaped"; @@ -227,44 +260,62 @@ window.rulesAutosurgery = (function() { } surgeries.push("more interestingly shaped breasts"); cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; slave.boobsImplant = 0; slave.boobsImplantType = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.boobs <= 600 && slave.lactation < 2 && (slave.boobs + 400 <= thisSurgery.surgery_boobs)) { surgeries.push("bigger boobs"); slave.boobsImplant += 400; slave.boobs += 400; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.boobs <= 600 && slave.lactation < 2 && (slave.boobs + 200 <= thisSurgery.surgery_boobs)) { surgeries.push("modestly bigger boobs"); slave.boobsImplant += 200; slave.boobs += 200; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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)) { surgeries.push("bigger boobs"); slave.boobsImplant += 400; slave.boobs += 400; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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)) { surgeries.push("bigger boobs"); slave.boobsImplant += 200; slave.boobs += 200; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } } if (slave.health > 20 && surgeries.length < 3) { @@ -274,29 +325,41 @@ window.rulesAutosurgery = (function() { slave.buttImplant = 0; slave.buttImplantType = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.butt <= 3 && (slave.butt < thisSurgery.surgery_butt)) { surgeries.push("a bigger butt"); slave.buttImplant = 1; slave.butt += 1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.butt <= 5 && (slave.butt < thisSurgery.surgery_butt)) { surgeries.push("a bigger butt"); slave.buttImplant = 1; slave.butt += 1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.butt <= 8 && (slave.butt < thisSurgery.surgery_butt)) { surgeries.push("a bigger butt"); slave.buttImplant = 1; slave.butt += 1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } } if (slave.health > 20 && surgeries.length < 3) { @@ -307,8 +370,11 @@ window.rulesAutosurgery = (function() { slave.skill.anal -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -316,8 +382,11 @@ window.rulesAutosurgery = (function() { slave.skill.vaginal -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -325,8 +394,11 @@ window.rulesAutosurgery = (function() { slave.skill.anal -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -334,8 +406,11 @@ window.rulesAutosurgery = (function() { slave.skill.vaginal -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -343,8 +418,11 @@ window.rulesAutosurgery = (function() { slave.skill.anal -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -352,8 +430,11 @@ window.rulesAutosurgery = (function() { slave.skill.vaginal -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } } if (slave.health > 20 && surgeries.length < 3) { @@ -361,14 +442,20 @@ window.rulesAutosurgery = (function() { surgeries.push("surgery to remove her prostate implant"); slave.prostate = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.balls > 0 && slave.vasectomy === 0 && thisSurgery.surgery_vasectomy === true) { surgeries.push("vasectomy"); V.surgeryType = "vasectomy"; @@ -394,28 +481,40 @@ window.rulesAutosurgery = (function() { if (slave.health > 20 && surgeries.length < 3) { if (slave.faceImplant <= 15 && slave.face <= 95 && thisSurgery.surgery_cosmetic > 0) { surgeries.push("a nicer face"); - if (slave.faceShape === "masculine") slave.faceShape = "androgynous"; + if (slave.faceShape === "masculine") { slave.faceShape = "androgynous"; } slave.faceImplant += 25 - 5 * Math.trunc(V.PC.medicine / 50) - 5 * V.surgeryUpgrade; slave.face = Math.clamp(slave.face + 20, -100, 100); cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; slave.faceImplant += 25 - 5 * Math.trunc(V.PC.medicine / 50) - 5 * V.surgeryUpgrade; - if (slave.visualAge > 80) slave.visualAge -= 40; - else if (slave.visualAge >= 70) slave.visualAge -= 30; - else if (slave.visualAge > 50) slave.visualAge -= 20; - else if (slave.visualAge > 36) slave.visualAge -= 10; - else slave.visualAge -= 5; - cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (slave.visualAge > 80) { + slave.visualAge -= 40; + } else if (slave.visualAge >= 70) { + slave.visualAge -= 30; + } else if (slave.visualAge > 50) { + slave.visualAge -= 20; + } else if (slave.visualAge > 36) { + slave.visualAge -= 10; + } else { + slave.visualAge -= 5; + } + cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); + 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"; + if (slave.underArmHStyle !== "hairless") { slave.underArmHStyle = "bald"; } + if (slave.pubicHStyle !== "hairless") { slave.pubicHStyle = "bald"; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); } else if ((slave.bald === 0 || slave.hStyle !== "bald" || slave.eyebrowHStyle !== "bald") && thisSurgery.surgery_hair === 2) { surgeries.push("hair removal"); @@ -427,22 +526,31 @@ window.rulesAutosurgery = (function() { surgeries.push("liposuction"); slave.weight -= 50; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; - } else if ((slave.bellySagPreg > 0 || slave.bellySag > 0) && (thisSurgery.surgery_cosmetic > 0 || thisSurgery.surgery_tummy > 0 )) { + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } + } else if ((slave.bellySagPreg > 0 || slave.bellySag > 0) && (thisSurgery.surgery_cosmetic > 0 || thisSurgery.surgery_tummy > 0)) { surgeries.push("a tummy tuck"); slave.bellySag = 0; slave.bellySagPreg = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 10; - else slave.health -= 20; + if (V.PC.medicine >= 100) { + slave.health -= 10; + } else { + slave.health -= 20; + } } else if (slave.voice === 1 && slave.voiceImplant === 0 && thisSurgery.surgery_cosmetic > 0) { surgeries.push("a feminine voice"); slave.voice += 1; slave.voiceImplant += 1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -451,8 +559,11 @@ window.rulesAutosurgery = (function() { slave.skill.oral -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.lips <= 95 && (slave.lips < thisSurgery.surgery_lips)) { surgeries.push("bigger lips"); slave.lipsImplant += 10; @@ -461,22 +572,31 @@ window.rulesAutosurgery = (function() { slave.skill.oral -= 10; } cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.cSec === 1 && thisSurgery.surgery_cosmetic > 0) { surgeries.push("surgery to remove a c-section scar"); slave.cSec = 0; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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"; + if (slave.faceShape === "masculine") { slave.faceShape = "androgynous"; } slave.faceImplant += 25 - 5 * Math.trunc(V.PC.medicine / 50) - 5 * V.surgeryUpgrade; slave.face = Math.clamp(slave.face + 20, -100, 100); cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; @@ -493,15 +613,21 @@ window.rulesAutosurgery = (function() { } slave.faceImplant += 25 - 5 * Math.trunc(V.PC.medicine / 50) - 5 * V.surgeryUpgrade; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + 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; slave.voiceImplant += 1; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } } if (slave.health > 20 && surgeries.length < 3) { @@ -509,35 +635,50 @@ window.rulesAutosurgery = (function() { surgeries.push("a narrower waist"); slave.waist -= 20; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.hips < 1 && V.surgeryUpgrade === 1 && (slave.hips < thisSurgery.surgery_hips)) { surgeries.push("wider hips"); slave.hips++; slave.hipsImplant++; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.waist >= -95 && V.seeExtreme === 1 && thisSurgery.surgery_cosmetic === 2) { surgeries.push("a narrower waist"); slave.waist = Math.clamp(slave.waist - 20, -100, 100); cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.hips < 2 && V.surgeryUpgrade === 1 && (slave.hips < thisSurgery.surgery_hips)) { surgeries.push("wider hips"); slave.hips++; slave.hipsImplant++; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else if (slave.hips < 3 && V.surgeryUpgrade === 1 && (slave.hips < thisSurgery.surgery_hips)) { surgeries.push("wider hips"); slave.hips++; slave.hipsImplant++; cashX(forceNeg(V.surgeryCost), "slaveSurgery", slave); - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } } if (slave.health > 20 && surgeries.length < 3) { @@ -548,13 +689,19 @@ window.rulesAutosurgery = (function() { if (slave.ovaries === 1 || slave.mpreg === 1) { surgeries.push("belly implant"); V.surgeryType = "bellyIn"; - if (V.PC.medicine >= 100) slave.health -= 5; - else slave.health -= 10; + if (V.PC.medicine >= 100) { + slave.health -= 5; + } else { + slave.health -= 10; + } } else { surgeries.push("male belly implant"); V.surgeryType = "bellyInMale"; - if (V.PC.medicine >= 100) slave.health -= 25; - else slave.health -= 50; + if (V.PC.medicine >= 100) { + slave.health -= 25; + } else { + slave.health -= 50; + } } bellyIn(slave); } else if (slave.bellyImplant >= 0 && thisSurgery.surgery_bellyImplant === "remove") { diff --git a/src/js/sexActsJS.js b/src/js/sexActsJS.js index 231f899b9025d0fe1e5744622cef5a1fb8af089d..3ca88e59963f53959936e34b9571c7174f65b2ba 100644 --- a/src/js/sexActsJS.js +++ b/src/js/sexActsJS.js @@ -1,5 +1,6 @@ -window.VCheck = (function () { +window.VCheck = (function() { "use strict"; + /* eslint-disable */ let he; let him; let his; @@ -8,6 +9,7 @@ window.VCheck = (function () { let boy; let He; let His; + /* eslint-enable */ return { Anal: AnalVCheck, @@ -315,7 +317,6 @@ window.VCheck = (function () { } return r; } - })(); /** diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index a4a571ffe939660eeb3162e3d41a1c9410d0545b..811a4a3f0b824e011c9ca8c7e31fa9ce446655e4 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -1488,7 +1488,9 @@ window.FResult = (function() { } const uses = V.oralUseWeight + V.vaginalUseWeight + V.analUseWeight; - if (uses <= 0) return; + if (uses <= 0) { + return; + } result += (6 + slave.tonguePiercing) * (V.oralUseWeight / uses) * (slave.skill.oral / 30); if (slave.sexualFlaw === "cum addict") { @@ -1527,11 +1529,15 @@ window.FResult = (function() { V.slaves.forEach(islave => { if (isParentP(slave, islave) && sameAssignmentP(slave, islave)) { result += 1; - if (incestBonus) result += 1; + if (incestBonus) { + result += 1; + } } if (areSisters(slave, islave) > 0 && sameAssignmentP(slave, islave)) { result += 1; - if (incestBonus) result += 1; + if (incestBonus) { + result += 1; + } } }); } @@ -1543,7 +1549,9 @@ window.FResult = (function() { const fre = getSlave(slave.relationTarget); if (fre !== undefined && sameAssignmentP(slave, fre)) { result += 2; - if (incestBonus) result += 2; + if (incestBonus) { + result += 2; + } } } @@ -1554,7 +1562,9 @@ window.FResult = (function() { const fre = V.slaves.findIndex(s => { return haveRelationshipP(slave, s) && sameAssignmentP(slave, s); }); - if (fre !== -1) result += 1; + if (fre !== -1) { + result += 1; + } } /** @@ -1562,7 +1572,9 @@ window.FResult = (function() { */ function calcWorksWithRival(slave) { const en = getSlave(slave.rivalryTarget); - if (en !== undefined && sameAssignmentP(slave, en)) result -= 1; + if (en !== undefined && sameAssignmentP(slave, en)) { + result -= 1; + } } /** @@ -1588,8 +1600,11 @@ window.FResult = (function() { */ function calcPreg(slave) { if (V.arcologies[0].FSRepopulationFocus > 20) { - if (slave.belly >= 1500) result += 2; - else result -= 2; + if (slave.belly >= 1500) { + result += 2; + } else { + result -= 2; + } } else if (V.arcologies[0].FSRepopulationFocusPregPolicy === 1) { if (slave.bellyPreg >= 1500) { result += 1; @@ -1624,8 +1639,12 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcSexAttributes(slave) { - if (slave.clitPiercing > 2) result += 1; - if (slave.tail === "sex") result += 1; + if (slave.clitPiercing > 2) { + result += 1; + } + if (slave.tail === "sex") { + result += 1; + } if (slave.fetishKnown === 1 && slave.fetishStrength > 60 && slave.fetish !== "none") { result += slave.fetishStrength / 5; } @@ -1633,16 +1652,30 @@ window.FResult = (function() { if (slave.attrKnown === 1) { result += Math.trunc(slave.attrXX / 20); result += Math.trunc(slave.attrXY / 20); - if (slave.energy > 95) result += 3; - else if (slave.energy > 80) result += 2; - else if (slave.energy > 60) result += 1; - else if (slave.energy <= 20) result -= 2; - else if (slave.energy <= 40) result -= 1; + if (slave.energy > 95) { + result += 3; + } else if (slave.energy > 80) { + result += 2; + } else if (slave.energy > 60) { + result += 1; + } else if (slave.energy <= 20) { + result -= 2; + } else if (slave.energy <= 40) { + result -= 1; + } + } + if (slave.sexualFlaw !== "none") { + result -= 2; + } + if (slave.sexualQuirk !== "none") { + result += 2; + } + if (slave.behavioralFlaw !== "none") { + result -= 2; + } + if (slave.behavioralQuirk !== "none") { + result += 2; } - if (slave.sexualFlaw !== "none") result -= 2; - if (slave.sexualQuirk !== "none") result += 2; - if (slave.behavioralFlaw !== "none") result -= 2; - if (slave.behavioralQuirk !== "none") result += 2; } /** @@ -1660,8 +1693,9 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcSight(slave) { - if (!canSee(slave)) result -= 3; - else if (slave.eyes <= -1) { + if (!canSee(slave)) { + result -= 3; + } else if (slave.eyes <= -1) { if (slave.eyewear !== "corrective glasses" && slave.eyewear !== "corrective contacts") { result -= 1; } @@ -1676,8 +1710,9 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcHearing(slave) { - if (!canHear(slave)) result -= 2; - else if (slave.hears <= -1) { + if (!canHear(slave)) { + result -= 2; + } else if (slave.hears <= -1) { if (slave.earwear !== "hearing aids") { result -= 1; } @@ -1690,7 +1725,9 @@ window.FResult = (function() { * @param {App.Entity.SlaveState} slave */ function calcEgyptianBonus(slave) { - if (V.racialVarieties === undefined) V.racialVarieties = []; + if (V.racialVarieties === undefined) { + V.racialVarieties = []; + } if (!V.racialVarieties.includes(slave.race)) { V.racialVarieties.push(slave.race); } @@ -1728,8 +1765,12 @@ window.FResult = (function() { } else if (!V.familyTesting && slave.relation !== 0) { calcWorksWithRelativesVanilla(slave); } - if (slave.relationship > 0) calcWorksWithRelationship(slave); - if (slave.rivalry !== 0) calcWorksWithRival(slave); + if (slave.relationship > 0) { + calcWorksWithRelationship(slave); + } + if (slave.rivalry !== 0) { + calcWorksWithRival(slave); + } calcHInjectionsDiet(slave); calcPreg(slave); calcRace(slave); @@ -1753,12 +1794,18 @@ window.FResult = (function() { function calcAge(slave) { if ((V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset") && slave.physicalAge === V.minimumSlaveAge && slave.physicalAge === V.fertilityAge && canGetPregnant(slave)) { result += 1; - if (slave.birthWeek === 0) result += result; - else if (slave.birthWeek < 4) result += 0.2 * result; + if (slave.birthWeek === 0) { + result += result; + } else if (slave.birthWeek < 4) { + result += 0.2 * result; + } } else if (slave.physicalAge === V.minimumSlaveAge) { result += 1; - if (slave.birthWeek === 0) result += 0.5 * result; - else if (slave.birthWeek < 4) result += 0.1 * result; + if (slave.birthWeek === 0) { + result += 0.5 * result; + } else if (slave.birthWeek < 4) { + result += 0.1 * result; + } } else if (slave.physicalAge === V.fertilityAge && canGetPregnant(slave) && (V.arcologies[0].FSRepopulationFocus !== "unset" || V.arcologies[0].FSGenderFundamentalist !== "unset")) { result += 1; if (slave.birthWeek === 0) { @@ -2217,7 +2264,7 @@ window.slaveCost = (function() { } } - function calcCost(/* slave */) { + function calcCost( /* slave */ ) { cost *= multiplier * 50; cost = Number(cost) || 0; if (cost < V.minimumSlaveCost) { diff --git a/src/js/slaveGenerationJS.js b/src/js/slaveGenerationJS.js index 5bb707929cbc3e32a843a4936587acd03d7cfdb2..653092227d1c7488268fe8a0f3252247d0800815 100644 --- a/src/js/slaveGenerationJS.js +++ b/src/js/slaveGenerationJS.js @@ -1532,7 +1532,7 @@ window.generatePronouns = function generatePronouns(slave) { /** * @param {App.Entity.SlaveState} slave */ -window.generatePuberty = function (slave) { +window.generatePuberty = function(slave) { if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.physicalAge >= slave.pubertyAgeXX) { slave.pubertyXX = 1; } else { @@ -1548,7 +1548,7 @@ window.generatePuberty = function (slave) { /** * @param {App.Entity.SlaveState} slave */ -window.ageImplantAdjustment = function (slave) { +window.ageImplantAdjustment = function(slave) { if (slave.visualAge > 80) { slave.visualAge -= 40; } else if (slave.visualAge >= 70) { diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index a10e724c34c65f8d5fd9d0c684dc0b9d704acad2..b08753a992674d35c0e522909d53e99c2eff410c 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -362,7 +362,7 @@ App.UI.selectSlaveForPersonalAttention = function(id) { * @param {string} passage The passage to link to * @returns {string} */ -App.UI.SlaveList.sortingLinks = function (passage) { +App.UI.SlaveList.sortingLinks = function(passage) { const V = State.variables; let r = ' Sort by: '; r += ["devotion", "name", "assignment", "seniority", "actualAge", "visualAge", "physicalAge"] @@ -385,7 +385,7 @@ App.UI.SlaveList.sortingLinks = function (passage) { * @param {{assign: string, remove: string, transfer: (string| undefined)}} [tabCaptions] * @returns {string} */ -App.UI.SlaveList.listSJFacilitySlaves = function (facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { +App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { const V = State.variables; facilityPassage = facilityPassage || passage(); tabCaptions = tabCaptions || { @@ -463,7 +463,7 @@ App.UI.SlaveList.listSJFacilitySlaves = function (facility, facilityPassage, sho /** * @returns {string} */ -App.UI.SlaveList.listNGPSlaves = function () { +App.UI.SlaveList.listNGPSlaves = function() { const V = State.variables; const thisPassage = 'New Game Plus'; let r = this.sortingLinks(thisPassage) + '<br>'; @@ -509,7 +509,7 @@ App.UI.SlaveList.listNGPSlaves = function () { * @param {string} [selectionPassage] passage name for manager selection. "${Manager} Select" if omitted * @returns {string} */ -App.UI.SlaveList.displayManager = function (facility, selectionPassage) { +App.UI.SlaveList.displayManager = function(facility, selectionPassage) { const managerCapName = capFirstChar(facility.desc.manager.position); selectionPassage = selectionPassage || `${managerCapName} Select`; const manager = facility.manager.currentEmployee; @@ -528,11 +528,11 @@ App.UI.SlaveList.displayManager = function (facility, selectionPassage) { * @param {boolean} [showTransfersPage] * @returns {string} */ -App.UI.SlaveList.stdFacilityPage = function (facility, showTransfersPage) { +App.UI.SlaveList.stdFacilityPage = function(facility, showTransfersPage) { return this.displayManager(facility) + '<br><br>' + this.listSJFacilitySlaves(facility, passage(), showTransfersPage); }; -App.UI.SlaveList.penthousePage = function () { +App.UI.SlaveList.penthousePage = function() { const V = State.variables; const ph = App.Entity.facilities.penthouse; const listElementId = 'summarylist'; // for the untabbed mode only @@ -785,7 +785,7 @@ App.UI.SlaveList.penthousePage = function () { * @returns {boolean} */ -App.UI.SlaveList.slaveSelectionList = function () { +App.UI.SlaveList.slaveSelectionList = function() { const selectionElementId = "slaveSelectionList"; return selection; @@ -917,7 +917,7 @@ App.UI.SlaveList.slaveSelectionList = function () { * @param {string} [passage] one of the *Workaround passages. Will be composed from the position name if omitted * @returns {string} */ -App.UI.SlaveList.facilityManagerSelection = function (facility, passage) { +App.UI.SlaveList.facilityManagerSelection = function(facility, passage) { passage = passage || capFirstChar(facility.manager.desc.position) + " Workaround"; return this.slaveSelectionList(slave => facility.manager.canEmploy(slave), (slave, index) => App.UI.passageLink(SlaveFullName(slave), passage, `$i = ${index}`), diff --git a/src/js/slaveStatsChecker.js b/src/js/slaveStatsChecker.js index 26a682ce96611eec7462f565ab278dd58245d238..fe59b32861071792ec221f89573ce6c39baefffe 100644 --- a/src/js/slaveStatsChecker.js +++ b/src/js/slaveStatsChecker.js @@ -1,4 +1,4 @@ -window.SlaveStatsChecker = (function () { +window.SlaveStatsChecker = (function() { return { checkForLisp: hasLisp, isModded: isModded, @@ -177,7 +177,7 @@ window.SlaveStatsChecker = (function () { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSlim = function (slave) { +window.isSlim = function(slave) { let slim = false; const ArcologyZero = State.variables.arcologies[0]; @@ -209,7 +209,7 @@ window.isSlim = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.slimPass = function (slave) { +window.slimPass = function(slave) { let slimPass = 0; const ArcologyZero = State.variables.arcologies[0]; @@ -238,7 +238,7 @@ window.slimPass = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isStacked = function (slave) { +window.isStacked = function(slave) { return (slave.butt > 4) && (slave.boobs > 800); }; @@ -246,7 +246,7 @@ window.isStacked = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isXY = function (slave) { +window.isXY = function(slave) { return (slave.dick > 0); }; @@ -254,7 +254,7 @@ window.isXY = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isYoung = function (slave) { +window.isYoung = function(slave) { return (slave.visualAge < 30); }; @@ -262,7 +262,7 @@ window.isYoung = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isPreg = function (slave) { +window.isPreg = function(slave) { return ((slave.bellyPreg >= 5000) || (slave.bellyImplant >= 5000)); }; @@ -270,7 +270,7 @@ window.isPreg = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isNotPreg = function (slave) { +window.isNotPreg = function(slave) { return (!isPreg(slave) && (slave.belly < 100) && (slave.weight < 30) && !setup.fakeBellies.includes(slave.bellyAccessory)); }; @@ -278,7 +278,7 @@ window.isNotPreg = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isPure = function (slave) { +window.isPure = function(slave) { return ((slave.boobsImplant === 0) && (slave.buttImplant === 0) && (slave.waist >= -95) && (slave.lipsImplant === 0) && (slave.faceImplant < 30) && (slave.bellyImplant === -1) && (Math.abs(slave.shouldersImplant) < 2) && (Math.abs(slave.hipsImplant) < 2)); }; @@ -286,7 +286,7 @@ window.isPure = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSurgicallyImproved = function (slave) { +window.isSurgicallyImproved = function(slave) { return ((slave.boobsImplant > 0) && (slave.buttImplant > 0) && (slave.waist < -10) && (slave.lipsImplant > 0)); }; @@ -294,7 +294,7 @@ window.isSurgicallyImproved = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isFullyPotent = function (slave) { +window.isFullyPotent = function(slave) { if (!slave) { return null; } else if (slave.dick > 0 && slave.balls > 0 && slave.ballType !== "sterile" && slave.hormoneBalance < 100 && slave.drugs !== "hormone blockers") { @@ -307,7 +307,7 @@ window.isFullyPotent = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canGetPregnant = function (slave) { +window.canGetPregnant = function(slave) { if (!slave) { return null; } else if (slave.preg === -1) { /* contraceptives check */ @@ -327,7 +327,7 @@ window.canGetPregnant = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isFertile = function (slave) { +window.isFertile = function(slave) { if (!slave) { return null; } @@ -375,7 +375,7 @@ window.isFertile = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canAchieveErection = function (slave) { +window.canAchieveErection = function(slave) { if (!slave) { return null; } else if (slave.dick <= 0) { @@ -400,7 +400,7 @@ window.canAchieveErection = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canPenetrate = function (slave) { +window.canPenetrate = function(slave) { if (!slave) { return null; } else if (!canAchieveErection(slave)) { @@ -417,7 +417,7 @@ window.canPenetrate = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canSee = function (slave) { +window.canSee = function(slave) { if (!slave) { return null; } @@ -428,7 +428,7 @@ window.canSee = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canHear = function (slave) { +window.canHear = function(slave) { if (!slave) { return null; } @@ -439,7 +439,7 @@ window.canHear = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canSmell = function (slave) { +window.canSmell = function(slave) { if (!slave) { return null; } @@ -450,7 +450,7 @@ window.canSmell = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canTaste = function (slave) { +window.canTaste = function(slave) { if (!slave) { return null; } @@ -461,7 +461,7 @@ window.canTaste = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canWalk = function (slave) { +window.canWalk = function(slave) { if (!slave) { return null; } else if (slave.amp === 1) { @@ -494,7 +494,7 @@ window.canWalk = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canTalk = function (slave) { +window.canTalk = function(slave) { if (!slave) { return null; } else if (slave.accent > 2) { @@ -519,7 +519,7 @@ window.canTalk = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canDoAnal = function (slave) { +window.canDoAnal = function(slave) { if (!slave) { return null; } else if (slave.chastityAnus === 1) { @@ -532,7 +532,7 @@ window.canDoAnal = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canDoVaginal = function (slave) { +window.canDoVaginal = function(slave) { if (!slave) { return null; } else if (slave.vagina < 0) { @@ -547,7 +547,7 @@ window.canDoVaginal = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooFatSlave = function (slave) { +window.tooFatSlave = function(slave) { if (!slave) { return null; } else if (slave.weight > 190 + (slave.muscles / 5) && slave.physicalAge >= 18) { @@ -566,7 +566,7 @@ window.tooFatSlave = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBreasts = function (slave) { +window.tooBigBreasts = function(slave) { if (!slave) { return null; } else if (slave.boobs > 30000 + (slave.muscles * 100) && slave.physicalAge >= 18) { @@ -585,7 +585,7 @@ window.tooBigBreasts = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBelly = function (slave) { +window.tooBigBelly = function(slave) { if (!slave) { return null; } else if (slave.belly >= 450000 + (slave.muscles * 2000) && slave.physicalAge >= 18) { @@ -604,7 +604,7 @@ window.tooBigBelly = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBalls = function (slave) { +window.tooBigBalls = function(slave) { if (!slave) { return null; } else if (slave.balls >= 30 + (slave.muscles * 0.3) && slave.physicalAge <= 3) { @@ -621,7 +621,7 @@ window.tooBigBalls = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigDick = function (slave) { +window.tooBigDick = function(slave) { if (!slave) { return null; } else if (slave.dick >= 20 + (slave.muscles * 0.1) && slave.physicalAge <= 3 && slave.dick !== 0) { @@ -638,7 +638,7 @@ window.tooBigDick = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigButt = function (slave) { +window.tooBigButt = function(slave) { if (!slave) { return null; } else if (slave.butt > 10 && slave.physicalAge <= 3) { @@ -653,7 +653,7 @@ window.tooBigButt = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isVegetable = function (slave) { +window.isVegetable = function(slave) { if (!slave) { return false; } diff --git a/src/js/storyJS.js b/src/js/storyJS.js index a58bc99bbe522b7a4e5f52977ff827be403c3447..18530af669e3933fc1b3dc666909212040e0a26a 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -8,7 +8,7 @@ * @param {number} maxValue * @returns {number} */ -window.variableAsNumber = function (x, defaultValue = 0, minValue, maxValue) { +window.variableAsNumber = function(x, defaultValue = 0, minValue, maxValue) { x = Number(x); if (isNaN(x)) { return defaultValue; @@ -26,7 +26,7 @@ window.variableAsNumber = function (x, defaultValue = 0, minValue, maxValue) { * @param {App.Entity.SlaveState} slave * @return {boolean} */ -window.isSexuallyPure = function (slave) { +window.isSexuallyPure = function(slave) { if (!slave) { return null; } @@ -34,7 +34,7 @@ window.isSexuallyPure = function (slave) { }; if (typeof interpolate === "undefined") { - const interpolate = function (x0, y0, x1, y1, x) { + const interpolate = function(x0, y0, x1, y1, x) { if (x <= x0) { return y0; } else if (x >= x1) { @@ -51,7 +51,7 @@ if (typeof interpolate === "undefined") { * @param {any} val * @returns {any[]} */ -window.removeFromArray = function (arr, val) { +window.removeFromArray = function(arr, val) { for (let i = 0; i < arr.length; i++) { if (val === arr[i]) { return arr.splice(i, 1); @@ -66,10 +66,10 @@ window.removeFromArray = function (arr, val) { * @param {any} thisArg * @returns {Array} */ -window.filterInPlace = function (arr, callback, thisArg) { +window.filterInPlace = function(arr, callback, thisArg) { let j = 0; - arr.forEach(function (e, i) { + arr.forEach(function(e, i) { if (callback.call(thisArg, e, i, arr)) { arr[j++] = e; } @@ -84,7 +84,7 @@ window.filterInPlace = function (arr, callback, thisArg) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.canBreed = function (slave1, slave2) { +window.canBreed = function(slave1, slave2) { if (!slave1 || !slave2) { return null; } @@ -98,7 +98,7 @@ window.canBreed = function (slave1, slave2) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.canImpreg = function (slave1, slave2) { +window.canImpreg = function(slave1, slave2) { if (!slave1 || !slave2) { return null; } else if (slave2.dick < 1) { @@ -144,7 +144,7 @@ window.canImpreg = function (slave1, slave2) { * @param {object} PC * @returns {boolean} */ -window.isPlayerFertile = function (PC) { +window.isPlayerFertile = function(PC) { if (!PC) { return null; } else if (PC.preg !== 0) { @@ -164,7 +164,7 @@ window.isPlayerFertile = function (PC) { * @param {App.Entity.SlaveState} slave * @returns {string|number} */ -window.relationTargetWord = function (slave) { +window.relationTargetWord = function(slave) { if (!slave) { return null; } else if (slave.relation === "daughter") { @@ -179,7 +179,7 @@ window.relationTargetWord = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.milkAmount = function (slave) { +window.milkAmount = function(slave) { let milk; let calcs; if (!slave) { @@ -229,7 +229,7 @@ window.milkAmount = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.cumAmount = function (slave) { +window.cumAmount = function(slave) { let cum = 0; let calcs = 0; if (!slave) { @@ -279,7 +279,7 @@ window.cumAmount = function (slave) { * @param {string} text * @returns {string} */ -window.lispReplace = function (text) { +window.lispReplace = function(text) { text = text.replace(/Sh/g, "Th"); text = text.replace(/SS/g, "Th"); text = text.replace(/Ss/g, "Th"); @@ -367,7 +367,7 @@ window.lispReplace = function (text) { * @param {Object} arcology * @returns {number} */ -window.repGainSacrifice = function (slave, arcology) { +window.repGainSacrifice = function(slave, arcology) { if (!slave || !arcology || arcology.FSAztecRevivalist === "unset" || arcology.FSAztecRevivalist <= 0) { return 0; } @@ -379,33 +379,33 @@ window.repGainSacrifice = function (slave, arcology) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.bodyguardSuccessorEligible = function (slave) { +window.bodyguardSuccessorEligible = function(slave) { if (!slave) { return false; } return (slave.devotion > 50 && slave.muscles >= 0 && slave.weight < 100 && slave.boobs < 8000 && slave.butt < 10 && slave.belly < 5000 && slave.balls < 10 && slave.dick < 10 && slave.preg < 20 && slave.fuckdoll === 0 && slave.fetish !== "mindbroken" && canWalk(slave)); }; -window.ngUpdateGenePool = function (genePool) { +window.ngUpdateGenePool = function(genePool) { const transferredSlaveIds = (State.variables.slaves || []) - .filter(function (s) { + .filter(function(s) { return s.ID >= 1200000; }) - .map(function (s) { + .map(function(s) { return s.ID - 1200000; }); return (genePool || []) - .filter(function (s) { + .filter(function(s) { return transferredSlaveIds.indexOf(s.ID) >= 0; }) - .map(function (s) { + .map(function(s) { const result = jQuery.extend(true, {}, s); result.ID += 1200000; return result; }); }; -window.ngUpdateMissingTable = function (missingTable) { +window.ngUpdateMissingTable = function(missingTable) { const newTable = {}; (State.variables.slaves || []) @@ -423,7 +423,7 @@ window.ngUpdateMissingTable = function (missingTable) { * @param {any} obj * @returns {string} */ -window.toJson = function (obj) { +window.toJson = function(obj) { let jsontext = JSON.stringify(obj); jsontext = jsontext.replace(/^{/, ""); jsontext = jsontext.replace(/}$/, ""); @@ -434,7 +434,7 @@ window.toJson = function (obj) { * @param {App.Entity.SlaveState} slave * @returns {string} */ -window.nippleColor = function (slave) { +window.nippleColor = function(slave) { if (skinToneLevel(slave.skin) < 8) { if (slave.preg > slave.pregData.normalBirth / 4 || (slave.counter.birthsTotal > 0 && slave.lactation > 0)) { return "brown"; @@ -467,7 +467,7 @@ window.nippleColor = function (slave) { * @param {Object} PC * @returns {number} */ -window.overpowerCheck = function (slave, PC) { +window.overpowerCheck = function(slave, PC) { let strength; if (State.variables.arcologies[0].FSPhysicalIdealist !== "unset") { @@ -494,7 +494,7 @@ window.overpowerCheck = function (slave, PC) { * @param {App.Entity.SlaveState} slave * @returns {number[]} */ -window.impregnatedBy = function (slave) { +window.impregnatedBy = function(slave) { const IDArray = []; if (!Array.isArray(slave.womb)) { WombInit(slave); @@ -511,15 +511,15 @@ window.impregnatedBy = function (slave) { * @param {App.Entity.SlaveState} father * @returns {boolean} */ -window.isImpregnatedBy = function (mother, father) { +window.isImpregnatedBy = function(mother, father) { return impregnatedBy(mother).includes(father.ID); }; -window.jsAlert = function (obj) { +window.jsAlert = function(obj) { alert(obj); }; -window.jsConsoleInfo = function (obj) { +window.jsConsoleInfo = function(obj) { // eslint-disable-next-line no-console console.info(obj); }; @@ -599,7 +599,7 @@ window.SoftenSexualFlaw = function SoftenSexualFlaw(slave) { /** * @param {object} PC */ -window.generatePlayerPronouns = function (PC) { +window.generatePlayerPronouns = function(PC) { if (PC.title === 0) { PC.pronoun = "she"; PC.possessivePronoun = "hers"; @@ -617,7 +617,7 @@ window.generatePlayerPronouns = function (PC) { } }; -window.generateAssistantPronouns = function () { +window.generateAssistantPronouns = function() { const V = State.variables; if (V.assistant === 0) { V.assistantPronouns.pronoun = "it"; diff --git a/src/js/textInput.js b/src/js/textInput.js index 00bffdaac33247f9d888216acb26b32665d70f75..25c358be815f7e6991a0e09fd63c0a87eb040248 100644 --- a/src/js/textInput.js +++ b/src/js/textInput.js @@ -2,7 +2,7 @@ Macro.add("textinput", { // Signifies that the macro is a container macro. tags: null, - handler: function () { + handler: function() { if (this.args.length < 2) { const errors = []; if (this.args.length < 1) { @@ -38,7 +38,7 @@ Macro.add("textinput", { tabindex: 0 // for accessibility }) .addClass("macro-textarea") // "hijack" the .macro-textarea class - .on("input", function () { + .on("input", function() { Wikifier.setValue(varName, this.value); if (that.payload[0].contents !== "") { Wikifier.wikifyEval(that.payload[0].contents.trim()); diff --git a/src/js/utilJS.js b/src/js/utilJS.js index d9f92887d1afea8965062108d77036eb6cf84fbf..ffce2d69b0d2f06289879a348514b17e90958bbb 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -1,57 +1,57 @@ /* eslint-disable no-unused-vars */ /* -* Height.mean(nationality, race, genes, age) - returns the mean height for the given combination and age in years (>=2) -* Height.mean(nationality, race, genes) - returns the mean adult height for the given combination -* 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 -* 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. -* -* 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". -* -* Anon's explanation: -* 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. -* -* 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. -* -* 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. -* -* There's also limitHeight which you're not using. It's basically limitMult in different units. -*/ + * Height.mean(nationality, race, genes, age) - returns the mean height for the given combination and age in years (>=2) + * Height.mean(nationality, race, genes) - returns the mean adult height for the given combination + * 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 + * 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. + * + * 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". + * + * Anon's explanation: + * 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. + * + * 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. + * + * 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. + * + * There's also limitHeight which you're not using. It's basically limitMult in different units. + */ window.Height = (function() { "use strict"; @@ -66,7 +66,7 @@ window.Height = (function() { /** * Configuration method for the above values * @param {any} [conf] - * @returns {{ limitMult: number[]; limitHeight: number[]; skew: number; spread: number; }} + * @returns {object} */ const _config = function(conf) { if (_.isUndefined(conf)) { @@ -542,6 +542,7 @@ window.Height = (function() { }; /** + * FIXME: JSdoc syntax error * Helper method - table lookup for nationality/race combinations * @param {{ [table: string]: number; }} table * @param {string|Object} nationality @@ -573,7 +574,7 @@ window.Height = (function() { /** * Height multiplier generator; skewed gaussian according to global parameters * @returns {number} - */ + */ const multGenerator = function() { let result = skewedGaussian(skew); while (result < minMult || result > maxMult) { @@ -699,6 +700,7 @@ window.Height = (function() { * @param {any} race * @param {string} genes * @param {number} age + * @returns {Function} // I think */ const _randomHeight = function(nationality, race, genes, age) { const mean = _meanHeight(nationality, race, genes, age); @@ -738,37 +740,37 @@ window.Height = (function() { })(); /** -* Intelligence.random(options) - returns a random intelligence. If no options are passed, the generated number -* will be on a normal distribution with mean 0 and standard deviation 45. -* -* Example: Only generate above-average intelligence based on $activeSlave: -* Intelligence.random({limitIntelligence: [0, 100]}) -* -* Intelligence.config(configuration) - configures the random height generator globally and returns the current configuration -* -* The options and their default values are: -* mean: 0 - What the average intelligence will be. Increasing this will make it more likely -* to generate a smart slave, but will not guarantee it. -* Minimum value: -100, maximum value: 100 -* limitMult: [-3, 3] - Limit to this many standard deviations from the mean. -* 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: 45 - The random standard deviation of the calculated distribution. A higher value -* will make it more likely to have extreme values, a lower value will make any -* generated values cluster around the mean. If spread is 0, it will always return the mean. -* skew: 0 - How much the height distribution skews to the right (positive) or left (negative) side -* of the height. Unless you have a very specific reason, you should not need to change this. -* Minimum value: -1000, maximum value: 1000 -* limitIntelligence: [-100,100] - Limit the resulting height range. -* Warning: A small intelligence limit range not containing the -* mean, and with a low spread value results in the generator -* having to do lots of work generating and re-generating random -* intelligences until one "fits". -* -* This was modeled using the Height generator above. For some more information, see the comments for that. -* @returns {{random: number, _config: Object}} -*/ + * Intelligence.random(options) - returns a random intelligence. If no options are passed, the generated number + * will be on a normal distribution with mean 0 and standard deviation 45. + * + * Example: Only generate above-average intelligence based on $activeSlave: + * Intelligence.random({limitIntelligence: [0, 100]}) + * + * Intelligence.config(configuration) - configures the random height generator globally and returns the current configuration + * + * The options and their default values are: + * mean: 0 - What the average intelligence will be. Increasing this will make it more likely + * to generate a smart slave, but will not guarantee it. + * Minimum value: -100, maximum value: 100 + * limitMult: [-3, 3] - Limit to this many standard deviations from the mean. + * 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: 45 - The random standard deviation of the calculated distribution. A higher value + * will make it more likely to have extreme values, a lower value will make any + * generated values cluster around the mean. If spread is 0, it will always return the mean. + * skew: 0 - How much the height distribution skews to the right (positive) or left (negative) side + * of the height. Unless you have a very specific reason, you should not need to change this. + * Minimum value: -1000, maximum value: 1000 + * limitIntelligence: [-100,100] - Limit the resulting height range. + * Warning: A small intelligence limit range not containing the + * mean, and with a low spread value results in the generator + * having to do lots of work generating and re-generating random + * intelligences until one "fits". + * + * This was modeled using the Height generator above. For some more information, see the comments for that. + * @returns {{random: number, _config: Object}} + */ window.Intelligence = (function() { "use strict"; @@ -782,6 +784,7 @@ window.Intelligence = (function() { let maxIntelligence = 100; /** + * FIXME: JSdoc syntax error * Configuration method for the above values * @param {{ mean: number; limitMult: number[]; limitIntelligence: number[]; skew: number; spread: number; } | { limitMult: number[]; limitIntelligence: number[]; skew: number; spread: number; mean?: undefined; }} [conf] */ @@ -858,6 +861,7 @@ window.Intelligence = (function() { }; /** + * FIXME: JSdoc syntax error * @param {{ mean: number; limitMult: number[]; limitIntelligence: number[]; skew: number; spread: number; } | { limitMult: number[]; limitIntelligence: number[]; skew: number; spread: number; mean?: undefined; }} settings * @returns {number} */ @@ -881,7 +885,7 @@ window.Intelligence = (function() { /** * Helper method - generate two independent Gaussian numbers using Box-Muller transform * @returns {number[]} -*/ + */ window.gaussianPair = function() { let r = Math.sqrt(-2.0 * Math.log(1 - Math.random())); let sigma = 2.0 * Math.PI * (1 - Math.random()); @@ -976,19 +980,19 @@ window.num = function(x) { const SCALES = ["thousand", "million", "billion", "trillion"]; /** - * helper function for use with Array.filter - * @param {any} item - * @returns {boolean} - */ + * helper function for use with Array.filter + * @param {any} item + * @returns {boolean} + */ function isTruthy(item) { return !!item; } /** - * convert a number into "chunks" of 0-999 - * @param {number} number - * @returns {number[]} - */ + * convert a number into "chunks" of 0-999 + * @param {number} number + * @returns {number[]} + */ function chunk(number) { const thousands = []; @@ -1001,10 +1005,10 @@ window.num = function(x) { } /** - * translate a number from 1-999 into English - * @param {number} number - * @returns {string} - */ + * translate a number from 1-999 into English + * @param {number} number + * @returns {string} + */ function inEnglish(number) { let hundreds; let tens; @@ -1034,11 +1038,11 @@ window.num = function(x) { } /** - * append the word for a scale. Made for use with Array.map - * @param {string} chunk - * @param {number} exp - * @returns {string} - */ + * append the word for a scale. Made for use with Array.map + * @param {string} chunk + * @param {number} exp + * @returns {string} + */ function appendScale(chunk, exp) { let scale; if (!chunk) { @@ -1049,9 +1053,9 @@ window.num = function(x) { } /** - * @param {number} s - * @returns {string} - */ + * @param {number} s + * @returns {string} + */ function commaNum(s) { if (!s) { return "0"; @@ -1342,16 +1346,22 @@ window.arr2obj = function arr2obj(arr) { window.hashPush = function hashPush(obj, ...rest) { rest.forEach((item) => { - if (obj[item] === undefined) obj[item] = 1; - else obj[item] += 1; + if (obj[item] === undefined) { + obj[item] = 1; + } else { + obj[item] += 1; + } }); }; window.weightedArray2HashMap = function weightedArray2HashMap(arr) { const obj = {}; arr.forEach((item) => { - if (obj[item] === undefined) obj[item] = 1; - else obj[item] += 1; + if (obj[item] === undefined) { + obj[item] = 1; + } else { + obj[item] += 1; + } }); return obj; }; @@ -1436,9 +1446,9 @@ window.addA = function(word) { }; /** -* @param {App.Entity.SlaveState} slave -* @returns {string} -*/ + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ window.getSlaveDevotionClass = function(slave) { if ((!slave) || (!State)) { return undefined; @@ -1464,9 +1474,9 @@ window.getSlaveDevotionClass = function(slave) { }; /** -* @param {App.Entity.SlaveState} slave -* @returns {string} -*/ + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ window.getSlaveTrustClass = function(slave) { if ((!slave) || (!State)) { return undefined; @@ -1485,22 +1495,31 @@ window.getSlaveTrustClass = function(slave) { } else if (slave.trust <= 20) { return "fearful"; } else if (slave.trust <= 50) { - if (slave.devotion < -20) return "hate-careful"; - else return "careful"; + if (slave.devotion < -20) { + return "hate-careful"; + } else { + return "careful"; + } } else if (slave.trust <= 95) { - if (slave.devotion < -20) return "bold"; - else return "trusting"; + if (slave.devotion < -20) { + return "bold"; + } else { + return "trusting"; + } } else { - if (slave.devotion < -20) return "defiant"; - else return "profoundly-trusting"; + if (slave.devotion < -20) { + return "defiant"; + } else { + return "profoundly-trusting"; + } } }; /** * Takes an integer e.g. $activeSlave.hLength, returns a string in the format 10 inches -* @param {number} s -* @returns {string} -*/ + * @param {number} s + * @returns {string} + */ window.cmToInchString = function(s) { let inches = (Math.round(s / 2.54)).toString(); if (inches === "0") { @@ -1633,9 +1652,9 @@ window.removeDuplicates = function removeDuplicates(array) { }; /** -* @param {App.Entity.SlaveState} slave -* @returns {string} -*/ + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ window.induceLactation = function induceLactation(slave) { let pronouns = getPronouns(slave); let His = capFirstChar(pronouns.possessive); @@ -1676,9 +1695,9 @@ window.ResearchLabStockPile = function() { }; /** -* @param {App.Entity.SlaveState} slave -* @returns {string} -*/ + * @param {App.Entity.SlaveState} slave + * @returns {string} + */ window.originPronounReplace = function(slave) { let r = slave.origin; switch (r) { @@ -1830,7 +1849,7 @@ App.UI.tabbar = function() { function handlePreSelectedTab() { let selectedTab = State.variables.tabChoice[_tabChoiceVarName()]; if (!selectedTab) { selectedTab = "assign"; } - $(document).one(':passagedisplay', function () { + $(document).one(':passagedisplay', function() { let tabBtn = document.getElementById(`tab ${selectedTab}`); if (!tabBtn) { tabBtn = document.getElementsByClassName('tablinks').item(0); @@ -1862,21 +1881,21 @@ App.Utils.escapeHtml = function(text) { }; /** -* Creates a HTML element with custom SugarCube attributes which works as a passage link -* -* The result works in the same way as the wiki markup in the SugarCube -* @see https://www.motoslave.net/sugarcube/2/docs/#markup-html-attribute -* @param {string} linkText link text -* @param {string} passage the passage name to link to -* @param {string} [setter=''] setter tet (optional) -* @param {string} [elementType='a'] element type (optional) default is 'a'. -* Could be any of 'a', 'audio', img', 'source', 'video' -* @returns {string} element text -* -* @example -* // equal to [[Go to town|Town]] -* App.UI.passageLink("Go to town", "Town") -*/ + * Creates a HTML element with custom SugarCube attributes which works as a passage link + * + * The result works in the same way as the wiki markup in the SugarCube + * @see https://www.motoslave.net/sugarcube/2/docs/#markup-html-attribute + * @param {string} linkText link text + * @param {string} passage the passage name to link to + * @param {string} [setter=''] setter tet (optional) + * @param {string} [elementType='a'] element type (optional) default is 'a'. + * Could be any of 'a', 'audio', img', 'source', 'video' + * @returns {string} element text + * + * @example + * // equal to [[Go to town|Town]] + * App.UI.passageLink("Go to town", "Town") + */ App.UI.passageLink = function(linkText, passage, setter, elementType = 'a') { let res = `<${elementType} data-passage="${passage}"`; if (setter) { @@ -1893,7 +1912,7 @@ App.UI.passageLink = function(linkText, passage, setter, elementType = 'a') { * @param {string} selector * @param {string} newContent */ -App.UI.replace = function (selector, newContent) { +App.UI.replace = function(selector, newContent) { let ins = jQuery(document.createDocumentFragment()); ins.wiki(newContent); const target = $(selector); @@ -1918,7 +1937,7 @@ App.UI.replace = function (selector, newContent) { * @param {string} [tag='div'] * @returns {string} */ -App.UI.htag = function (text, attributes, tag = 'div') { +App.UI.htag = function(text, attributes, tag = 'div') { const payload = text.replace(/(^\n+|\n+$)/, ""); if ("object" === typeof attributes) { @@ -2210,7 +2229,7 @@ window.jsDef = function(input) { * Currently only considers their age * @param {App.Entity.SlaveState} slave * @returns {string} -*/ + */ window.randomCareer = function(slave) { if (slave.actualAge < 16) { return setup.veryYoungCareers.random(); @@ -2480,47 +2499,47 @@ window.changeSkinTone = function(skin, value) { } let prop; for (prop in skinToMelanin) { - if (!skinToMelanin.hasOwnProperty(prop)) continue; - if (newSkin >= skinToMelanin[prop]) return prop; + if (!skinToMelanin.hasOwnProperty(prop)) { continue; } + if (newSkin >= skinToMelanin[prop]) { return prop; } } return prop; }; /** -* Creates a span for an link with tooltip containing the reasons why it is disabled -* @param {string} link -* @param {string[]} reasons -* @returns {string} -*/ + * Creates a span for an link with tooltip containing the reasons why it is disabled + * @param {string} link + * @param {string[]} reasons + * @returns {string} + */ App.UI.disabledLink = function(link, reasons) { const tooltips = reasons.length === 1 ? - `<span class="tooltip">${reasons}</span>`: + `<span class="tooltip">${reasons}</span>` : `<div class="tooltip"><ul>${reasons.map(e => `<li>${e}</li>`).join('')}</ul></div>`; return `<span class="textWithTooltip">${link}${tooltips}</span>`; }; /** -* Expression for SugarCube for referencing a slave by index -* @param {number} i slave array index or -1 for activeSlave -* @returns {string} -*/ + * Expression for SugarCube for referencing a slave by index + * @param {number} i slave array index or -1 for activeSlave + * @returns {string} + */ App.Utils.slaveRefString = function(i) { return i >= 0 ? `$slaves[${i}]` : '$activeSlave'; }; /** -* Returns slave by index in the slave array, Accepts -1 for the activeSlave -* @param {number} i slave array index or -1 for activeSlave -* @returns {App.Entity.SlaveState} -*/ + * Returns slave by index in the slave array, Accepts -1 for the activeSlave + * @param {number} i slave array index or -1 for activeSlave + * @returns {App.Entity.SlaveState} + */ App.Utils.slaveByIndex = function(i) { return i === -1 ? State.variables.activeSlave : State.variables.slaves[i]; }; /** -* Sets active slave to the slave with the given index. Does nothing if index < 0 -* @param {number} index -*/ + * Sets active slave to the slave with the given index. Does nothing if index < 0 + * @param {number} index + */ App.Utils.setActiveSlaveByIndex = function(index) { if (index >= 0) { State.variables.activeSlave = State.variables.slaves[index]; @@ -2532,6 +2551,6 @@ App.Utils.setActiveSlaveByIndex = function(index) { * @param {number} id slave ID * @returns {number} */ -App.Utils.slaveIndexForId = function (id) { +App.Utils.slaveIndexForId = function(id) { return State.variables.slaveIndices[id]; }; diff --git a/src/js/wombJS.js b/src/js/wombJS.js index fd6ce592c0bfa6068a24629b2706b9e427960195..ea8ae151fcb7ff42f9e129fd0e510dee4516210d 100644 --- a/src/js/wombJS.js +++ b/src/js/wombJS.js @@ -62,7 +62,7 @@ window.WombInit = function(actor) { // sorry but for already present broodmothers it's impossible to calculate fully, approximation used. let pw = actor.preg, bCount, bLeft; - if (pw > actor.pregData.normalBirth) pw = actor.pregData.normalBirth; // to avoid disaster. + if (pw > actor.pregData.normalBirth) { pw = actor.pregData.normalBirth; } // to avoid disaster. bCount = Math.floor(actor.pregType / pw); bLeft = actor.pregType - (bCount * pw); if (pw > actor.pregType) { @@ -238,22 +238,24 @@ window.WombBirthReady = function(actor, readyAge) { }; window.WombGetVolume = function(actor) { // most legacy code from pregJS.tw with minor adaptation. - if (actor.pregData.sizeType === 0) + if (actor.pregData.sizeType === 0) { return getVolByLen(actor); - else if (actor.pregData.sizeType === 1) + } else if (actor.pregData.sizeType === 1) { return getVolByWeight(actor); - else if (actor.pregData.sizeType === 2) + } else if (actor.pregData.sizeType === 2) { return getVolByRaw(actor); - else + } else { return 0; + } function getCurData(actor, age) { let i = 0; let min, max, ageMin, ageMax, rateMin, rateMax, one, rateOne, rate, cage, csize; let data = {}; - while (actor.pregData.fetusWeek[i + 1] < age && i < actor.pregData.fetusWeek.length - 1) + while (actor.pregData.fetusWeek[i + 1] < age && i < actor.pregData.fetusWeek.length - 1) { i++; + } min = actor.pregData.fetusSize[i]; max = actor.pregData.fetusSize[i + 1]; @@ -327,8 +329,9 @@ window.WombGetVolume = function(actor) { // most legacy code from pregJS.tw with WombInit(actor); alert("WombGetVolume warning - " + actor.slaveName + " " + err); } - if (wombSize < 0) // catch for strange cases, to avoid messing with outside code. + if (wombSize < 0) { // catch for strange cases, to avoid messing with outside code. wombSize = 0; + } return wombSize; } @@ -344,8 +347,9 @@ window.WombGetVolume = function(actor) { // most legacy code from pregJS.tw with wombSize += targetData.size * targetData.rate; }); - if (wombSize < 0) // catch for strange cases, to avoid messing with outside code. + if (wombSize < 0) { // catch for strange cases, to avoid messing with outside code. wombSize = 0; + } return wombSize; } @@ -361,8 +365,9 @@ window.WombGetVolume = function(actor) { // most legacy code from pregJS.tw with wombSize += targetData.size; }); - if (wombSize < 0) // catch for strange cases, to avoid messing with outside code. + if (wombSize < 0) { // catch for strange cases, to avoid messing with outside code. wombSize = 0; + } return wombSize; } @@ -381,18 +386,20 @@ window.WombUpdatePregVars = function(actor) { window.WombMinPreg = function(actor) { WombSort(actor); - if (actor.womb.length > 0) + if (actor.womb.length > 0) { return actor.womb[actor.womb.length - 1].age; - else + } else { return 0; + } }; window.WombMaxPreg = function(actor) { WombSort(actor); - if (actor.womb.length > 0) + if (actor.womb.length > 0) { return actor.womb[0].age; - else + } else { return 0; + } }; window.WombNormalizePreg = function(actor) { @@ -407,14 +414,17 @@ window.WombNormalizePreg = function(actor) { // to avoid legacy code conflicts - broodmother on hold // can't be impregnated, but she is not on normal contraceptives. // So we set this for special case. - if (actor.preg >= 0) + if (actor.preg >= 0) { actor.preg = 0.1; + } - if (actor.pregSource > 0) + if (actor.pregSource > 0) { actor.pregSource = 0; + } - if (actor.pregWeek > 0) + if (actor.pregWeek > 0) { actor.pregWeek = 0; + } actor.broodmotherCountDown = 0; } @@ -423,8 +433,9 @@ window.WombNormalizePreg = function(actor) { let max = WombMaxPreg(actor); // console.log("max: " + max); // console.log(".preg: "+ actor.preg); - if (actor.pregWeek < 1) + if (actor.pregWeek < 1) { actor.pregWeek = 1; + } if (max < actor.preg) { WombProgress(actor, actor.preg - max, actor.preg - max); @@ -442,16 +453,19 @@ window.WombNormalizePreg = function(actor) { actor.pregType = 0; actor.pregKnown = 0; - if (actor.preg > 0) + if (actor.preg > 0) { actor.preg = 0; + } - if (actor.pregSource > 0) + if (actor.pregSource > 0) { actor.pregSource = 0; + } // We can't properly set postpartum here, // but can normalize obvious error with forgotten property. - if (actor.pregWeek > 0) + if (actor.pregWeek > 0) { actor.pregWeek = 0; + } } actor.bellyPreg = WombGetVolume(actor); }; @@ -508,8 +522,9 @@ window.fetalSplit = function(actor, chance) { nft.identical = 1; // this is marker that this fetus has at least one twin. s.identical = 1; // this is marker that this fetus has at least one twin. - if (s.twinID === "" || s.twinID === undefined) + if (s.twinID === "" || s.twinID === undefined) { s.twinID = generateNewID(); + } nft.twinID = s.twinID; @@ -528,10 +543,11 @@ window.WombFetusCount = function(actor) { // give reference to fetus object, but not remove fetus, use for manipulation in the womb. window.WombGetFetus = function(actor, fetusNum) { WombInit(actor); - if (actor.womb.length >= fetusNum) + if (actor.womb.length >= fetusNum) { return actor.womb[fetusNum]; - else + } else { return null; + } }; // give reference to fetus object, and remove it form the womb. @@ -543,8 +559,9 @@ window.WombRemoveFetus = function(actor, fetusNum) { WombSort(actor); actor.pregType = actor.womb.length; return ft; - } else + } else { return null; + } }; /* to add fetus object in the womb. Be warned - you can add one single fetus to many wombs, or even add it many times to one womb. It will not show error, but behavior becomes strange, as fetus object will be the same - it's reference, not full copies. If this is not desired - use clone() on fetus before adding.*/ @@ -611,19 +628,22 @@ window.FetusGlobalReserveCount = function(reserveType) { let cnt = 0; let SV = State.variables; - if (typeof reserveType !== 'string') + if (typeof reserveType !== 'string') { return 0; + } SV.slaves.forEach(function(slave) { slave.womb.forEach(function(ft) { - if (ft.reserve === reserveType) + if (ft.reserve === reserveType) { cnt++; + } }); }); SV.PC.womb.forEach(function(ft) { - if (ft.reserve === reserveType) + if (ft.reserve === reserveType) { cnt++; + } }); return cnt; @@ -742,8 +762,9 @@ window.WombGetLittersData = function(actor) { // in first place we need to know how many litters here (Assuming that unique litter is have similar .realAge). Also we will know their ages. actor.womb.forEach(function(ft) { - if (!unicLiters.includes(Math.ceil(ft.realAge))) + if (!unicLiters.includes(Math.ceil(ft.realAge))) { unicLiters.push(Math.ceil(ft.realAge)); + } }); // now we should find and store separate litters data (count of fetuses): @@ -765,24 +786,31 @@ window.BCReserveInit = function() { SV.slaves.forEach(function(slave) { slave.womb.forEach(function(ft) { - if (typeof ft.reserve !== 'string') + if (typeof ft.reserve !== 'string') { ft.reserve = ""; - if (typeof ft.motherID !== 'number') // setting missing biological mother ID for fetus. + } + if (typeof ft.motherID !== 'number') { // setting missing biological mother ID for fetus. ft.motherID = slave.ID; - if (ft.ID === undefined) + } + if (ft.ID === undefined) { ft.ID = generateNewID(); - if (typeof ft.realAge !== 'number') // setting missing chronological age + } + if (typeof ft.realAge !== 'number') { // setting missing chronological age ft.realAge = ft.age; + } }); }); SV.PC.womb.forEach(function(ft) { - if (typeof ft.reserve !== 'string') + if (typeof ft.reserve !== 'string') { ft.reserve = ""; - if (typeof ft.motherID !== 'number') + } + if (typeof ft.motherID !== 'number') { ft.motherID = SV.PC.ID; - if (typeof ft.realAge !== 'number') // setting missing chronological age + } + if (typeof ft.realAge !== 'number') { // setting missing chronological age ft.realAge = ft.age; + } }); };