diff --git a/.jshintrc b/.jshintrc index 25cfa9f413f4b868c9f25bd8fe899cc61dac402d..9aec78ded8e59caab4e4b1f4898a6eb7e17f12cc 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,8 @@ { "browser": true, - "esversion": 6 + "esversion": 6, + "eqeqeq": true, + "nocomma": true, + "undef": true, + "maxerr": 150 } diff --git a/src/js/assayJS.tw b/src/js/assayJS.tw index c916ceb921308c58a4fe807681bfbe7d25d6e702..3dad892b930e5131fff3a973a12a3b650f079ffb 100644 --- a/src/js/assayJS.tw +++ b/src/js/assayJS.tw @@ -5,14 +5,14 @@ window.isSlim = function(slave) { var ArcologyZero = State.variables.arcologies[0]; if ((slave.boobs < 500) && (slave.butt < 3)) { - if ((slave.muscles <= 30) && (ArcologyZero.FSPhysicalIdealist == "unset") && (slave.weight <= 10) && (ArcologyZero.FSHedonisticDecadence == "unset")) { + if ((slave.muscles <= 30) && (ArcologyZero.FSPhysicalIdealist === "unset") && (slave.weight <= 10) && (ArcologyZero.FSHedonisticDecadence === "unset")) { slim = true; - } else if (ArcologyZero.FSPhysicalIdealist != "unset") { - if ((ArcologyZero.FSPhysicalIdealistStrongFat == 1) && (slave.weight <= 30)) { + } else if (ArcologyZero.FSPhysicalIdealist !== "unset") { + if ((ArcologyZero.FSPhysicalIdealistStrongFat === 1) && (slave.weight <= 30)) { slim = true; } - } else if ((ArcologyZero.FSHedonisticDecadence != "unset") && (slave.weight <= 30)) { - if (ArcologyZero.FSHedonisticDecadenceStrongFat == 1) { + } else if ((ArcologyZero.FSHedonisticDecadence !== "unset") && (slave.weight <= 30)) { + if (ArcologyZero.FSHedonisticDecadenceStrongFat === 1) { slim = true; } else if (slave.muscles <= 30) { slim = true; @@ -39,7 +39,7 @@ window.isUnmodded = function(slave) { var tatScore = TatScore(slave); var piercingScore = PiercingScore(slave); - return !isModded(slave) && (slave.corsetPiercing == 0) && (piercingScore < 3) && (tatScore < 2); + return !isModded(slave) && (slave.corsetPiercing === 0) && (piercingScore < 3) && (tatScore < 2); }; window.isXY = function(slave) { @@ -59,7 +59,7 @@ window.isNotPreg = 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)); + 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)); }; window.modScore = function modScore(slave) { @@ -99,7 +99,7 @@ window.PiercingScore = function(slave) { if (slave.tonguePiercing > 0 ) { piercingScore += slave.tonguePiercing*0.75-0.25; } - if (slave.clitPiercing == 3) { + if (slave.clitPiercing === 3) { piercingScore += 1.25; /* smart piercing */ } else if (slave.clitPiercing > 0) { piercingScore += slave.clitPiercing*0.75-0.25; @@ -119,37 +119,37 @@ window.PiercingScore = function(slave) { window.TatScore = function(slave) { var tatScore = 0; - if (slave.boobsTat != 0) { + if (slave.boobsTat !== 0) { tatScore += 1.25; } - if (slave.buttTat != 0) { + if (slave.buttTat !== 0) { tatScore += 1.25; } - if (slave.lipsTat != 0) { + if (slave.lipsTat !== 0) { tatScore += 1.25; } - if (slave.shouldersTat != 0) { + if (slave.shouldersTat !== 0) { tatScore += 1; } - if (slave.backTat != 0) { + if (slave.backTat !== 0) { tatScore += 1.25; } - if (slave.armsTat != 0) { + if (slave.armsTat !== 0) { tatScore += 1; } - if (slave.legsTat != 0) { + if (slave.legsTat !== 0) { tatScore += 1; } - if (slave.stampTat != 0) { + if (slave.stampTat !== 0) { tatScore += 1; } - if (slave.vaginaTat != 0) { + if (slave.vaginaTat !== 0) { tatScore += 1; } - if (slave.dickTat != 0) { + if (slave.dickTat !== 0) { tatScore += 1; } - if (slave.bellyTat != 0) { + if (slave.bellyTat !== 0) { if (((slave.preg > 30) && (slave.pregType >= 20)) || (slave.belly >= 300000)) { tatScore += 0.75; } else if (((slave.preg > 20) && (slave.pregType >= 20)) || ((slave.preg > 30) && (slave.pregType >= 10)) || (slave.belly >= 150000)) { @@ -164,9 +164,9 @@ window.TatScore = function(slave) { tatScore += 0.1; } } - if (slave.anusTat == "bleached") { + if (slave.anusTat === "bleached") { tatScore += 0.5; - } else if (slave.anusTat != 0) { + } else if (slave.anusTat !== 0) { tatScore += 1.25; } @@ -177,14 +177,14 @@ window.slimPass = function(slave) { var slimPass = 0; var ArcologyZero = State.variables.arcologies[0]; - if (ArcologyZero.FSSlimnessEnthusiastLaw == 1) { + if (ArcologyZero.FSSlimnessEnthusiastLaw === 1) { if ((slave.boobs < 300) && (slave.butt <= 1) && (slave.waist <= 10)) { State.variables.slimPass = 1; - if ((ArcologyZero.FSPhysicalIdealist == "unset") && (ArcologyZero.FSHedonisticDecadenceStrongFat == 0) && (slave.muscles > 30)) { /*muscle check*/ + if ((ArcologyZero.FSPhysicalIdealist === "unset") && (ArcologyZero.FSHedonisticDecadenceStrongFat === 0) && (slave.muscles > 30)) { /*muscle check*/ slimPass = 0; } - if (State.variables.slimPass == 1) { - if ((ArcologyZero.FSHedonisticDecadence != "unset") || (ArcologyZero.FSPhysicalIdealistStrongFat == 1)) { /*weight check*/ + if (State.variables.slimPass === 1) { + if ((ArcologyZero.FSHedonisticDecadence !== "unset") || (ArcologyZero.FSPhysicalIdealistStrongFat === 1)) { /*weight check*/ if (slave.weight > 30) { slimPass = 0; } @@ -313,11 +313,26 @@ window.newSlave = function newSlave(slave) { } if (slave.fuckdoll > 0) { - slave.pronoun = "it", slave.possessivePronoun = "its", slave.possessive = "its", slave.object = "it", slave.objectReflexive = "itself", slave.noun = "toy"; + slave.pronoun = "it"; + slave.possessivePronoun = "its"; + slave.possessive = "its"; + slave.object = "it"; + slave.objectReflexive = "itself"; + slave.noun = "toy"; } else if (slave.dick > 0 && slave.vagina === -1 && V.diversePronouns === 1) { - slave.pronoun = "he", slave.possessivePronoun = "his", slave.possessive = "his", slave.object = "him", slave.objectReflexive = "himself", slave.noun = "boy"; + slave.pronoun = "he"; + slave.possessivePronoun = "his"; + slave.possessive = "his"; + slave.object = "him"; + slave.objectReflexive = "himself"; + slave.noun = "boy"; } else { - slave.pronoun = "she", slave.possessivePronoun = "hers", slave.possessive = "her", slave.object = "her", slave.objectReflexive = "herself", slave.noun = "girl"; + slave.pronoun = "she"; + slave.possessivePronoun = "hers"; + slave.possessive = "her"; + slave.object = "her"; + slave.objectReflexive = "herself"; + slave.noun = "girl"; } SetBellySize(slave); @@ -400,32 +415,32 @@ window.Enunciate = function Enunciate(slave) { else V.titleEnunciate = "Mithtreth"; if (V.allowFamilyTitles === 1) { - if (slave.father == -1) { + if (slave.father === -1) { if (slave.actualAge < 4 && slave.physicalAge < 4) V.titleEnunciate = "Dadda"; else if (slave.actualAge < 9) V.titleEnunciate = "Daddy"; else V.titleEnunciate = "Dad"; - } else if (slave.mother == -1) { + } else if (slave.mother === -1) { if (slave.actualAge < 4 && slave.physicalAge < 4) V.titleEnunciate = "Mama"; else if (slave.actualAge < 9) V.titleEnunciate = "Mommy"; else V.titleEnunciate = "Mom"; - } else if (V.PC.mother == slave.ID || V.PC.father == slave.ID) { - if (V.PC.title == 1) + } else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) { + 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 (V.PC.title === 1) { if (slave.actualAge < 18) V.titleEnunciate = "Bro"; else V.titleEnunciate = "Brother"; - } else if (V.PC.title == 0) { + } else if (V.PC.title === 0) { if (slave.actualAge < 18) V.titleEnunciate = "Thith"; else @@ -448,37 +463,37 @@ window.Enunciate = function Enunciate(slave) { } else { 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 V.titleEnunciate = "Mistress"; - if (V.allowFamilyTitles == 1) { - if (slave.father == -1) { + if (V.allowFamilyTitles === 1) { + if (slave.father === -1) { if (slave.actualAge < 4 && slave.physicalAge < 4) V.titleEnunciate = "Dadda"; else if (slave.actualAge < 9) V.titleEnunciate = "Daddy"; else V.titleEnunciate = "Dad"; - } else if (slave.mother == -1) { + } else if (slave.mother === -1) { if (slave.actualAge < 4 && slave.physicalAge < 4) V.titleEnunciate = "Mama"; else if (slave.actualAge < 9) V.titleEnunciate = "Mommy"; else V.titleEnunciate = "Mom"; - } else if (V.PC.mother == slave.ID || V.PC.father == slave.ID) { - if (V.PC.title == 1) + } else if (V.PC.mother === slave.ID || V.PC.father === slave.ID) { + 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 (V.PC.title === 1) { if (slave.actualAge < 18) V.titleEnunciate = "Bro"; else V.titleEnunciate = "Brother"; - } else if (V.PC.title == 0) { + } else if (V.PC.title === 0) { if (slave.actualAge < 18) V.titleEnunciate = "Sis"; else @@ -486,15 +501,15 @@ window.Enunciate = function Enunciate(slave) { } } } - if (slave.customTitle !== undefined && slave.customTitle != "") + if (slave.customTitle !== undefined && slave.customTitle !== "") V.titleEnunciate = slave.customTitle; 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 V.writtenTitle = "Mistress"; - if (slave.customTitle !== undefined && slave.customTitle != "" && slave.rudeTitle == 0) + if (slave.customTitle !== undefined && slave.customTitle !== "" && slave.rudeTitle === 0) V.writtenTitle = slave.customTitle; V.sayEnunciate = "say"; V.sEnunciate = "s"; @@ -563,46 +578,46 @@ window.PCTitle = function PCTitle() { } else if (V.arcologies[0].FSRestart > 10) { 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 + ", "); - if (V.PC.name == "FC Dev") { + if (V.PC.name === "FC Dev") { titles.push("the Creator"); } @@ -1084,7 +1099,7 @@ window.PoliteRudeTitle = function PoliteRudeTitle(slave) { const V = State.variables, PC = V.PC, s = V.sEnunciate, ss = V.ssEnunciate; var r = ""; - if (slave.nationality == "Japanese") { + if (slave.nationality === "Japanese") { if (slave.trust > 0) { r += `${PC.name}${PC.title > 0 ? "kun" : "chan"}`; } else { @@ -1092,7 +1107,7 @@ window.PoliteRudeTitle = function PoliteRudeTitle(slave) { } } else { if (slave.intelligence < -2) { - r += V.titleEnunciate + r += V.titleEnunciate; } else if (slave.intelligence > 1) { r += (PC.title > 0 ? `Ma${s}ter` : `Mi${s}tre${ss}`); } else if (slave.trust > 0) { @@ -1107,27 +1122,27 @@ window.PoliteRudeTitle = function PoliteRudeTitle(slave) { window.SlaveTitle = function SlaveTitle(slave) { const V = State.variables; let r = ""; - if (V.newDescriptions == 1) { - if (slave.dick > 0 && slave.balls > 0 && slave.boobs > 300 && slave.vagina > -1 && slave.ovaries == 1) { - if (random(1,100) > 50) { + if (V.newDescriptions === 1) { + if (slave.dick > 0 && slave.balls > 0 && slave.boobs > 300 && slave.vagina > -1 && slave.ovaries === 1) { + if (jsRandom(1,100) > 50) { r = "futanari"; } else { r = "herm"; } - } else if (slave.dick > 0 && slave.balls == 0 && slave.boobs > 300 && slave.vagina > -1 && slave.ovaries == 1) { + } else if (slave.dick > 0 && slave.balls === 0 && slave.boobs > 300 && slave.vagina > -1 && slave.ovaries === 1) { r = "dickgirl"; - } else if (slave.dick > 0 && slave.vagina > -1 && slave.ovaries == 0) { + } else if (slave.dick > 0 && slave.vagina > -1 && slave.ovaries === 0) { r = "shemale"; - } else if (slave.dick > 0 && slave.balls == 0 && slave.vagina == -1 && slave.ovaries == 0) { + } else if (slave.dick > 0 && slave.balls === 0 && slave.vagina === -1 && slave.ovaries === 0) { r = "eunuch"; - } else if (slave.dick > 0 && slave.balls > 0 && slave.vagina == -1 && slave.ovaries == 0) { - if (slave.face > 10 && slave.hips > -1 && slave.shoulders < 1 && slave.faceShape != "masculine") { + } else if (slave.dick > 0 && slave.balls > 0 && slave.vagina === -1 && slave.ovaries === 0) { + if (slave.face > 10 && slave.hips > -1 && slave.shoulders < 1 && slave.faceShape !== "masculine") { r = "trap"; } else if (slave.boobs > 800) { r = "tittyboy"; - } else if (slave.dick == 1 && slave.balls == 1) { + } else if (slave.dick === 1 && slave.balls === 1) { r = "sissy"; - } else if (slave.dick > 1 && slave.balls > 1 && slave.height < 165 && slave.muscles < 5 && slave.visualAge < 19 && slave.faceShape != "masculine") { + } else if (slave.dick > 1 && slave.balls > 1 && slave.height < 165 && slave.muscles < 5 && slave.visualAge < 19 && slave.faceShape !== "masculine") { r = "twink"; } else if (slave.dick > 1 && slave.balls > 1 && slave.height < 160 && slave.muscles < 5 && slave.visualAge < 19) { r = "boytoy"; @@ -1138,10 +1153,10 @@ window.SlaveTitle = function SlaveTitle(slave) { } else { r = "slaveboy"; } - } else if (slave.dick == 0 && slave.balls == 0 && slave.vagina > -1) { - if ((slave.shoulders > slave.hips || slave.faceShape == "masculine") && slave.boobs < 400 && slave.genes == "XY") { + } else if (slave.dick === 0 && slave.balls === 0 && slave.vagina > -1) { + if ((slave.shoulders > slave.hips || slave.faceShape === "masculine") && slave.boobs < 400 && slave.genes === "XY") { r = "cuntboy"; - } else if (slave.ovaries == 0 && slave.genes == "XY") { + } else if (slave.ovaries === 0 && slave.genes === "XY") { r = "tranny"; } else if (slave.weight > 10 && slave.boobs > 800 && slave.birthsTotal > 0 && slave.physicalAge > 59) { r = "GMILF"; @@ -1158,16 +1173,16 @@ window.SlaveTitle = function SlaveTitle(slave) { } else { r = "slavegirl"; } - } else if (slave.dick == 0 && slave.balls == 0 && slave.vagina == -1) { + } else if (slave.dick === 0 && slave.balls === 0 && slave.vagina === -1) { r = "neuter"; - } else if (slave.dick == 0 && slave.vagina == -1) { + } else if (slave.dick === 0 && slave.vagina === -1) { r = "ballslave"; } else { r = "slave"; } if (slave.visualAge < 13) { - if (slave.genes == "XY" && slave.vagina == -1) { + if (slave.genes === "XY" && slave.vagina === -1) { r = "shota " + r; } else { r = "loli " + r; @@ -1228,7 +1243,7 @@ window.SlaveTitle = function SlaveTitle(slave) { r = "indentured " + r; } - if (slave.preg > 10 && slave.pregKnown == 1) { + if (slave.preg > 10 && slave.pregKnown === 1) { r = "pregnant " + r; } else if (slave.bellyFluid >= 5000) { r = "bloated " + r; @@ -1241,7 +1256,7 @@ window.SlaveTitle = function SlaveTitle(slave) { } } else { r = "slave"; /* I don't tihnk there is an 'else'? */ - if ((slave.dick == 0) && (slave.vagina == -1)) { /* NULLS */ + if ((slave.dick === 0) && (slave.vagina === -1)) { /* NULLS */ r = "null"; if ((slave.lactation > 0) && (slave.boobs > 2000)) { r = r + " cow"; @@ -1265,7 +1280,7 @@ window.SlaveTitle = function SlaveTitle(slave) { } } - if ((slave.dick == 0) && (slave.vagina != -1)) { /* FEMALES */ + if ((slave.dick === 0) && (slave.vagina !== -1)) { /* FEMALES */ if (slave.visualAge > 55) { r = "GILF"; } else if (slave.visualAge > 35) { @@ -1288,7 +1303,7 @@ window.SlaveTitle = function SlaveTitle(slave) { } } - if ((slave.dick != 0) && (slave.vagina != -1)) { + if ((slave.dick !== 0) && (slave.vagina !== -1)) { if (slave.balls > 0) { /* FUTANARI: cock & balls & vagina */ r = "futanari "; } else { /* FUTANARI: cock & vagina */ @@ -1319,7 +1334,7 @@ window.SlaveTitle = function SlaveTitle(slave) { } } - if ((slave.dick != 0) && (slave.vagina == -1) && (slave.balls > 0) && (slave.boobs > 300) && (slave.butt > 2)) { /* SHEMALES: cock & balls, T&A above minimum */ + if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0) && (slave.boobs > 300) && (slave.butt > 2)) { /* SHEMALES: cock & balls, T&A above minimum */ if (slave.visualAge > 55) { r = "sheGILF"; } else if (slave.visualAge > 35) { @@ -1343,9 +1358,9 @@ window.SlaveTitle = function SlaveTitle(slave) { } if ((slave.boobs < 300) || (slave.butt < 2)) { - if ((slave.dick != 0) && (slave.vagina == -1) && (slave.balls > 0)) { + if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0)) { if ((slave.shoulders < 1) || (slave.muscles <= 30)) { - if ((slave.faceShape == "masculine") || (slave.faceShape == "androgynous")) { /* SISSIES: feminine shoulders or muscles, masculine faces */ + if ((slave.faceShape === "masculine") || (slave.faceShape === "androgynous")) { /* SISSIES: feminine shoulders or muscles, masculine faces */ if (slave.visualAge > 55) { r = "sissyGILF"; } else if (slave.visualAge > 35) { @@ -1374,7 +1389,7 @@ window.SlaveTitle = function SlaveTitle(slave) { } if ((slave.boobs < 300) || (slave.butt < 2)) { - if ((slave.dick != 0) && (slave.vagina == -1) && (slave.balls > 0)) { + if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0)) { if ((slave.shoulders > 1) || (slave.muscles >= 30)) { /* BITCHES: masculine shoulders or muscles */ r = "bitch"; if ((slave.muscles > 30) && (slave.height < 185)) { @@ -1395,7 +1410,7 @@ window.SlaveTitle = function SlaveTitle(slave) { } } - if ((slave.dick != 0) && (slave.vagina == -1) && (slave.balls == 0)) { + if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls === 0)) { r = "dick"; if (slave.visualAge > 55) { r = r + "GILF"; @@ -1439,7 +1454,7 @@ window.SlaveTitle = function SlaveTitle(slave) { r = "indentured " + r; } - if (slave.preg > 10 && slave.pregKnown == 1) { + if (slave.preg > 10 && slave.pregKnown === 1) { r = "pregnant " + r; } else if (slave.bellyFluid >= 5000) { r = "bloated " + r; @@ -1475,7 +1490,7 @@ window.DegradingName = function DegradingName(slave) { if (slave.fuckdoll > 0) { slave.slaveName = "Fuckdoll No. " + slave.ID; slave.slaveSurname = 0; - } else if (slave.assignment == "work in the dairy" && V.dairyRestraintsSetting >= 2) { + } else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting >= 2) { slave.slaveName = "Bioreactor No. " + slave.ID; slave.slaveSurname = 0; } else { @@ -1546,19 +1561,19 @@ window.DegradingName = function DegradingName(slave) { names.push("Huge", "Muscles", "Ripped", "Strong"); } if (slave.fetishKnown === 1) { - if (slave.fetish == "buttslut") { + if (slave.fetish === "buttslut") { names.push("Anal", "Sodomy"); } - if (slave.fetish == "cumslut") { + if (slave.fetish === "cumslut") { names.push("Cum", "Dicksuck", "Sucker"); } - if (slave.fetish == "humiliation") { + if (slave.fetish === "humiliation") { names.push("Rape"); } - if (slave.fetish == "masochist") { + if (slave.fetish === "masochist") { names.push("Pain", "Rape", "Struggle"); } - if (slave.fetish == "pregnancy") { + if (slave.fetish === "pregnancy") { names.push("Fertile"); } } @@ -1569,9 +1584,9 @@ window.DegradingName = function DegradingName(slave) { if (slave.oralSkill <= 30 && slave.analSkill <= 30) { names.push("Cheap", "Fail", "Gutter"); } - if (slave.nipples == "fuckable") { + if (slave.nipples === "fuckable") { names.push("Nipplefuck", "Nipplecunt"); - } else if (slave.nipples != "tiny" && slave.nipples != "cute") { + } else if (slave.nipples !== "tiny" && slave.nipples !== "cute") { names.push("Pointy", "Titclit"); suffixes.push("Nipples"); } @@ -1701,7 +1716,7 @@ window.DegradingName = function DegradingName(slave) { } } } else { - if (slave.vagina != -1) { + if (slave.vagina !== -1) { suffixes.push("Futa"); } else { if (slave.balls > 0) { @@ -1709,7 +1724,7 @@ window.DegradingName = function DegradingName(slave) { suffixes.push("Shemale"); } else { if (slave.shoulders < 1 && slave.muscles <= 30) { - if (slave.faceShape == "masculine" || slave.faceShape == "androgynous") { /* SISSIES: feminine shoulders or muscles, masculine faces */ + if (slave.faceShape === "masculine" || slave.faceShape === "androgynous") { /* SISSIES: feminine shoulders or muscles, masculine faces */ suffixes.push("Sissy"); } else { /* TRAPS: feminine shoulders or muscles, feminine faces */ suffixes.push("Trap"); @@ -1745,19 +1760,19 @@ window.DegradingName = function DegradingName(slave) { suffixes.push("Fuck", "Fuckaddict", "Nympho", "Sexaddict"); } if (slave.fetishKnown === 1) { - if (slave.fetish == "humiliation") { + if (slave.fetish === "humiliation") { suffixes.push("Rapebait", "Showgirl"); } - if (slave.fetish == "submissive") { + if (slave.fetish === "submissive") { suffixes.push("Bottom", "Fuckee", "Rapebait"); } - if (slave.fetish == "dom") { + if (slave.fetish === "dom") { suffixes.push("Dom", "Fucker", "Top"); } - if (slave.fetish == "pregnancy") { + if (slave.fetish === "pregnancy") { suffixes.push("Breeder", "Mommy"); } - if (slave.fetish == "boobs") { + if (slave.fetish === "boobs") { suffixes.push("Boob", "Boobie", "Tit", "Titty"); } } @@ -1833,7 +1848,7 @@ window.DegradingName = function DegradingName(slave) { } } let surname = jsEither(suffixes); - if (typeof surname == "string" && surname.toLowerCase() == slave.slaveName.toLowerCase()) { + if (typeof surname === "string" && surname.toLowerCase() === slave.slaveName.toLowerCase()) { DegradingName(slave); } slave.slaveSurname = surname; @@ -1844,43 +1859,43 @@ window.SlaveSort = function SlaveSort(slaves, main=false) { if (main) { switch (V.sortSlavesBy) { case "name": - if (V.sortSlavesOrder == "ascending") + if (V.sortSlavesOrder === "ascending") slaves = slaves.sort((a, b) => a.slaveName < b.slaveName ? -1 : 1); else slaves = slaves.sort((a, b) => a.slaveName > b.slaveName ? -1 : 1); break; case "assignment": - if (V.sortSlavesOrder == "ascending") + if (V.sortSlavesOrder === "ascending") slaves = slaves.sort((a, b) => a.assignment < b.assignment ? -1 : 1); else slaves = slaves.sort((a, b) => a.assignment > b.assignment ? -1 : 1); break; case "seniority": - if (V.sortSlavesOrder == "ascending") + if (V.sortSlavesOrder === "ascending") slaves = slaves.sort((a, b) => b.weekAcquired - a.weekAcquired); else slaves = slaves.sort((a, b) => a.weekAcquired - b.weekAcquired); break; case "actualAge": - if (V.sortSlavesOrder == "ascending") + if (V.sortSlavesOrder === "ascending") slaves = slaves.sort((a, b) => a.actualAge - b.actualAge); else slaves = slaves.sort((a, b) => b.actualAge - a.actualAge); break; case "visualAge": - if (V.sortSlavesOrder == "ascending") + if (V.sortSlavesOrder === "ascending") slaves = slaves.sort((a, b) => a.visualAge - b.visualAge); else slaves = slaves.sort((a, b) => b.visualAge - a.visualAge); break; case "physicalAge": - if (V.sortSlavesOrder == "physicalAge") + if (V.sortSlavesOrder === "physicalAge") slaves = slaves.sort((a, b) => a.physicalAge - b.physicalAge); else slaves = slaves.sort((a, b) => b.physicalAge - a.physicalAge); break; default: - if (V.sortSlavesOrder == "ascending") + if (V.sortSlavesOrder === "ascending") slaves = slaves.sort((a, b) => a.devotion - b.devotion); else slaves = slaves.sort((a, b) => b.devotion - a.devotion); @@ -1950,7 +1965,9 @@ window.MenialPopCap = function MenialPopCap () { window.faceIncrease = function faceIncrease(slave, amount) { const pronouns = getPronouns(slave); + const his = pronouns.possessive; const His = capFirstChar(his); + let r = ""; 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) @@ -1965,4 +1982,4 @@ window.faceIncrease = function faceIncrease(slave, amount) { 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; -} +}; diff --git a/src/js/removeActiveSlave.tw b/src/js/removeActiveSlave.tw new file mode 100644 index 0000000000000000000000000000000000000000..87020a11b1d4d4fcf6e4cb7e249e6eb5d3926064 --- /dev/null +++ b/src/js/removeActiveSlave.tw @@ -0,0 +1,205 @@ +//:: Remove activeSlave JS [script] + +window.removeActiveSlave = function removeActiveSlave() { + "use strict"; + const V = State.variables; + + const AS_ID = V.activeSlave.ID; + let LENGTH = V.slaves.length; + const INDEX = V.slaveIndices[AS_ID]; + let missing = false; + + WombZeroID(V.PC, AS_ID); + if (V.activeSlave.reservedChildren > 0) { + V.reservedChildren -= V.activeSlave.reservedChildren; + } + if (V.PC.mother === AS_ID) { + V.PC.mother = V.missingParentID; + missing = true; + } + if (V.PC.father === AS_ID) { + V.PC.father = V.missingParentID; + missing = true; + } + if (V.PC.sisters > 0) { + if (areSisters(V.PC, V.activeSlave) > 0) { + V.PC.sisters--; + } + } + if (V.PC.daughters > 0) { + if (V.activeSlave.father === -1 || V.activeSlave.mother === -1) { + V.PC.daughters--; + } + } + + if (INDEX >= 0 && INDEX < LENGTH) { + if (V.incubator > 0) { + V.tanks.forEach(child => { + if (AS_ID === child.mother) { + child.mother = V.missingParentID; + missing = true; + } + if (AS_ID === child.father) { + child.father = V.missingParentID; + missing = true; + } + }); + } + V.slaves.forEach(slave => { + WombZeroID(slave, AS_ID); /* This check is complex, should be done in JS now, all needed will be done here. */ + if (V.activeSlave.daughters > 0) { + if (slave.mother === AS_ID) { + slave.mother = V.missingParentID; + } + if (slave.father === AS_ID) { + slave.father = V.missingParentID; + } + missing = true; + } + if (V.activeSlave.mother > 0 || V.activeSlave.father > 0) { + if (V.activeSlave.mother === slave.ID || V.activeSlave.father === slave.ID) { + slave.daughters--; + } + } + if (V.activeSlave.sisters > 0) { + if (areSisters(V.activeSlave, slave) > 0) { + slave.sisters--; + } + } + if (slave.ID === V.activeSlave.relationTarget) { + slave.relation = 0; + slave.relationTarget = 0; + } + if (slave.milkSource !== 0) { + if (slave.milkSource === AS_ID) { + slave.milkSource = 0; + slave.inflation = 0; + slave.inflationType = "none"; + slave.inflationMethod = 0; + } + } + if (slave.cumSource !== 0) { + if (slave.cumSource === AS_ID) { + slave.cumSource = 0; + slave.inflation = 0; + slave.inflationType = "none"; + slave.inflationMethod = 0; + } + } + if (slave.ID === V.activeSlave.relationshipTarget) { + slave.relationship = 0; + slave.relationshipTarget = 0; + } + if (slave.ID === V.activeSlave.rivalryTarget) { + slave.rivalry = 0; + slave.rivalryTarget = 0; + } + /* moved to saDevotion as a discovery event + if (slave.origBodyOwnerID === AS_ID) { + slave.origBodyOwnerID = 0; + } + */ + }); + + /* remove from Pit fighters list, if needed */ + V.fighterIDs.delete(AS_ID); + + /* remove from Coursing Association, if needed */ + if (V.Lurcher !== 0 && V.Lurcher.ID === AS_ID) { + V.Lurcher = 0; + } + + if (Array.isArray(V.personalAttention)) { + const _rasi = V.personalAttention.findIndex(function(s) { return s.ID === AS_ID; }); + if (_rasi !== -1) { + V.personalAttention.deleteAt(_rasi); + if (V.personalAttention.length === 0) { + if (V.PC.career === "escort") { + V.personalAttention = "whoring"; + } else if (V.PC.career === "servant") { + V.personalAttention = "upkeep"; + } else { + V.personalAttention = "business"; + } + } + } + } + + /* Remove from facility array or leadership role, if needed */ + removeJob(V.activeSlave, V.activeSlave.assignment); + + if (V.traitor !== 0) { + if (AS_ID === V.traitor.pregSource) { + V.traitor.pregSource = 0; + } + if (V.traitor.mother === AS_ID) { + V.traitor.mother = V.missingParentID; + missing = true; + } + if (V.traitor.father === AS_ID) { + V.traitor.father = V.missingParentID; + missing = true; + } + if (V.traitor.origBodyOwnerID === AS_ID) { + V.traitor.origBodyOwnerID = 0; + } + } + if (V.boomerangSlave !== 0) { + if (AS_ID === V.boomerangSlave.pregSource) { + V.boomerangSlave.pregSource = 0; + } + if (V.boomerangSlave.mother === AS_ID) { + V.boomerangSlave.mother = V.missingParentID; + missing = true; + } + if (V.boomerangSlave.father === AS_ID) { + V.boomerangSlave.father = V.missingParentID; + missing = true; + } + if (V.boomerangSlave.origBodyOwnerID === AS_ID) { + V.traitor.origBodyOwnerID = 0; + } + } + + let _o = V.organs.findIndex(function(s) { return s.ID === V.activeSlave.ID; }); + if (_o !== -1) { + V.organs.deleteAt(_o); + } + _o = V.limbs.findIndex(function(s) { return s.ID === V.activeSlave.ID; }); + if (_o !== -1) { + V.limbs.deleteAt(_o); + } + + const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === V.activeSlave.ID; }); + if (_geneIndex !== -1) { + let keep = false; + if (V.traitor !== 0) { + if (isImpregnatedBy(V.traitor, V.activeSlave) || V.traitor.ID === V.activeSlave.ID) { /* did we impregnate the traitor, or are we the traitor? */ + keep = true; + } + } + if (V.boomerangSlave !== 0) { + if (isImpregnatedBy(V.boomerangSlave, V.activeSlave) || V.boomerangSlave.ID === V.activeSlave.ID) { /* did we impregnate the boomerang, or are we the boomerang? */ + keep = true; + } + } + if (!keep) { /* avoid going through this loop if possible */ + keep = V.slaves.some(slave => { + /* have we impregnated a slave that is not ourself? */ + return (slave.ID !== V.activeSlave.ID && isImpregnatedBy(slave, V.activeSlave)) + }); + } + if (!keep) { + V.genePool.deleteAt(_geneIndex); + } + } + + removeSlave(INDEX); + LENGTH--; + V.activeSlave = 0; + + if (missing) { + V.missingParentID--; + } + } +}; diff --git a/src/npc/removeActiveSlave.tw b/src/npc/removeActiveSlave.tw index 44976f116e7395cd94fd4dcad01461eacec4d195..2fcc7d9b02572510c236ba64870302f723bbb052 100644 --- a/src/npc/removeActiveSlave.tw +++ b/src/npc/removeActiveSlave.tw @@ -1,188 +1,3 @@ :: Remove activeSlave [nobr] -<<set _ID = $activeSlave.ID, _SL = $slaves.length, _x = $slaveIndices[_ID]>> - -<<set WombZeroID($PC, _ID)>> -<<if $activeSlave.reservedChildren > 0>> - <<set $reservedChildren -= $activeSlave.reservedChildren>> -<</if>> -<<if $PC.mother == _ID>> - <<set $PC.mother = $missingParentID>> - <<set _missingID = 1>> -<</if>> -<<if $PC.father == _ID>> - <<set $PC.father = $missingParentID>> - <<set _missingID = 1>> -<</if>> -<<if $PC.sisters > 0>> - <<if areSisters($PC, $activeSlave) > 0>> - <<set $PC.sisters-->> - <</if>> -<</if>> -<<if $PC.daughters > 0>> - <<if $activeSlave.father == -1 || $activeSlave.mother == -1>> - <<set $PC.daughters-->> - <</if>> -<</if>> - -<<if _x >= 0 && _x < _SL>> - <<if $incubator > 0>> - <<for _z = 0; _z < $tanks.length; _z++>> - <<if _ID == $tanks[_z].mother>> - <<set $tanks[_z].mother = $missingParentID>> - <<set _missingID = 1>> - <</if>> - <<if _ID == $tanks[_z].father>> - <<set $tanks[_z].father = $missingParentID>> - <<set _missingID = 1>> - <</if>> - <</for>> - <</if>> - <<for _y = 0; _y < _SL; _y++>> - <<set WombZeroID($slaves[_y], _ID)>> /* This check is complex, should be done in JS now, all needed will be done here. */ - <<if $activeSlave.daughters > 0>> - <<if $slaves[_y].mother == _ID>> - <<set $slaves[_y].mother = $missingParentID>> - <</if>> - <<if $slaves[_y].father == _ID>> - <<set $slaves[_y].father = $missingParentID>> - <</if>> - <<set _missingID = 1>> - <</if>> - <<if $activeSlave.mother > 0 || $activeSlave.father > 0>> - <<if $activeSlave.mother == $slaves[_y].ID || $activeSlave.father == $slaves[_y].ID>> - <<set $slaves[_y].daughters-->> - <</if>> - <</if>> - <<if $activeSlave.sisters > 0>> - <<if areSisters($activeSlave, $slaves[_y]) > 0>> - <<set $slaves[_y].sisters-->> - <</if>> - <</if>> - <<if $slaves[_y].ID == $activeSlave.relationTarget>> - <<set $slaves[_y].relation = 0, $slaves[_y].relationTarget = 0>> - <</if>> - <<if $slaves[_y].milkSource != 0>> - <<if $slaves[_y].milkSource == _ID>> - <<set $slaves[_y].milkSource =0, $slaves[_y].inflation = 0, $slaves[_y].inflationType = "none", $slaves[_y].inflationMethod = 0>> - <</if>> - <</if>> - <<if $slaves[_y].cumSource != 0>> - <<if $slaves[_y].cumSource == _ID>> - <<set $slaves[_y].cumSource = 0, $slaves[_y].inflation = 0, $slaves[_y].inflationType = "none", $slaves[_y].inflationMethod = 0>> - <</if>> - <</if>> - <<if $slaves[_y].ID == $activeSlave.relationshipTarget>> - <<set $slaves[_y].relationship = 0, $slaves[_y].relationshipTarget = 0>> - <</if>> - <<if $slaves[_y].ID == $activeSlave.rivalryTarget>> - <<set $slaves[_y].rivalry = 0, $slaves[_y].rivalryTarget = 0>> - <</if>> - /* moved to saDevotion as a discovery event - <<if $slaves[_y].origBodyOwnerID == _ID>> - <<set $slaves[_y].origBodyOwnerID = 0>> - <</if>> - */ - <</for>> - - /* remove from Pit fighters list, if needed */ - <<set $fighterIDs.delete(_ID)>> - - /* remove from Coursing Association, if needed */ - <<if $Lurcher != 0 && $Lurcher.ID == _ID>> - <<set $Lurcher = 0>> - <</if>> - - <<if Array.isArray($personalAttention)>> - <<set _rasi = $personalAttention.findIndex(function(s) { return s.ID == _ID; })>> - <<if _rasi != -1>> - <<set $personalAttention.deleteAt(_rasi)>> - <<if $personalAttention.length == 0>> - <<if $PC.career == "escort">> - <<set $personalAttention = "whoring">> - <<elseif $PC.career == "servant">> - <<set $personalAttention = "upkeep">> - <<else>> - <<set $personalAttention = "business">> - <</if>> - <</if>> - <</if>> - <</if>> - - /% Remove from facility array or leadership role, if needed %/ - <<= removeJob($activeSlave, $activeSlave.assignment)>> - - <<if $traitor != 0>> - <<if _ID == $traitor.pregSource>> - <<set $traitor.pregSource = 0>> - <</if>> - <<if $traitor.mother == _ID>> - <<set $traitor.mother = $missingParentID>> - <<set _missingID = 1>> - <</if>> - <<if $traitor.father == _ID>> - <<set $traitor.father = $missingParentID>> - <<set _missingID = 1>> - <</if>> - <<if $traitor.origBodyOwnerID == _ID>> - <<set $traitor.origBodyOwnerID = 0>> - <</if>> - <</if>> - <<if $boomerangSlave != 0>> - <<if _ID == $boomerangSlave.pregSource>> - <<set $boomerangSlave.pregSource = 0>> - <</if>> - <<if $boomerangSlave.mother == _ID>> - <<set $boomerangSlave.mother = $missingParentID>> - <<set _missingID = 1>> - <</if>> - <<if $boomerangSlave.father == _ID>> - <<set $boomerangSlave.father = $missingParentID>> - <<set _missingID = 1>> - <</if>> - <<if $boomerangSlave.origBodyOwnerID == _ID>> - <<set $traitor.origBodyOwnerID = 0>> - <</if>> - <</if>> - - <<set _o = $organs.findIndex(function(s) { return s.ID == $activeSlave.ID; })>> - <<if _o != -1>> - <<set $organs.deleteAt(_o)>> - <</if>> - <<set _o = $limbs.findIndex(function(s) { return s.ID == $activeSlave.ID; })>> - <<if _o != -1>> - <<set $limbs.deleteAt(_o)>> - <</if>> - - <<set _geneIndex = $genePool.findIndex(function(s) { return s.ID == $activeSlave.ID; })>> - <<if _geneIndex != -1>> - <<set _dontDeleteMe = 0>> - <<if $traitor != 0>> - <<if isImpregnatedBy($traitor, $activeSlave) || $traitor.ID == $activeSlave.ID>> /* did we impregnate the traitor, or are we the traitor? */ - <<set _dontDeleteMe = 1>> - <</if>> - <</if>> - <<if $boomerangSlave != 0>> - <<if isImpregnatedBy($boomerangSlave, $activeSlave) || $boomerangSlave.ID == $activeSlave.ID>> /* did we impregnate the boomerang, or are we the boomerang? */ - <<set _dontDeleteMe = 1>> - <</if>> - <</if>> - <<if _dontDeleteMe == 0>> /* avoid going through this loop if possible */ - <<for _rasi = 0; _rasi < _SL; _rasi++>> - <<if $slaves[_rasi].ID != $activeSlave.ID && isImpregnatedBy($slaves[_rasi], $activeSlave)>> /* have we impregnated a slave that is not ourself? */ - <<set _dontDeleteMe = 1>> - <<break>> - <</if>> - <</for>> - <</if>> - <<if _dontDeleteMe == 0>> - <<set $genePool.deleteAt(_geneIndex)>> - <</if>> - <</if>> - - <<set _dump = removeSlave(_x), _SL--, $activeSlave = 0>> - - <<if _missingID == 1>> - <<set $missingParentID-->> - <</if>> -<</if>> +<<= removeActiveSlave() >>