diff --git a/src/js/assayJS.js b/src/js/assayJS.js index e766c252991a5fb4561661343e797571296f2289..5caec9358e1af9245e9a4283a4b576e149529735 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -32,15 +32,15 @@ window.isStacked = /** @param {App.Entity.SlaveState} slave */ function (slave) }; window.isModded = /** @param {App.Entity.SlaveState} slave */ function (slave) { - let tatScore = TatScore(slave); - let piercingScore = PiercingScore(slave); - let modScore = piercingScore+tatScore; + const tatScore = SlaveStatsChecker.tatScore(slave); + const piercingScore = SlaveStatsChecker.piercingScore(slave); + const modScore = piercingScore+tatScore; return ((modScore > 15) || (piercingScore > 8 && tatScore > 5)); }; window.isUnmodded = /** @param {App.Entity.SlaveState} slave */ function (slave) { - return (!isModded(slave) && (slave.corsetPiercing === 0) && (PiercingScore(slave) < 3) && (TatScore(slave) < 2)); + return (!isModded(slave) && (slave.corsetPiercing === 0) && (SlaveStatsChecker.piercingScore(slave) < 3) && (SlaveStatsChecker.tatScore(slave) < 2)); }; window.isXY = /** @param {App.Entity.SlaveState} slave */ function (slave) { @@ -63,120 +63,6 @@ window.isPure = /** @param {App.Entity.SlaveState} slave */ 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)); }; -window.modScore = /** @param {App.Entity.SlaveState} slave */ function modScore(slave) { - const V = State.variables; - V.piercingScore = PiercingScore(slave); - V.tatScore = TatScore(slave); - V.modScore = V.tatScore + V.piercingScore; -}; - -window.PiercingScore = /** @param {App.Entity.SlaveState} slave */ function (slave) { - let piercingScore = 0; - - if (slave.earPiercing > 0) { - piercingScore += slave.earPiercing*0.75-0.5; - } - if (slave.nosePiercing > 0) { - piercingScore += slave.nosePiercing*0.75-0.5; - } - if (slave.eyebrowPiercing > 0) { - piercingScore += slave.eyebrowPiercing*0.75-0.5; - } - if (slave.navelPiercing > 0) { - piercingScore += slave.navelPiercing*0.75-0.5; - } - if (slave.corsetPiercing > 0) { - piercingScore += slave.corsetPiercing*0.75+0.5; - } - if (slave.nipplesPiercing > 0) { - piercingScore += slave.nipplesPiercing*0.75-0.25; - } - if (slave.areolaePiercing > 0) { - piercingScore += slave.areolaePiercing*0.75+0.5; - } - if (slave.lipsPiercing > 0) { - piercingScore += slave.lipsPiercing*0.75-0.25; - } - if (slave.tonguePiercing > 0 ) { - piercingScore += slave.tonguePiercing*0.75-0.25; - } - if (slave.clitPiercing === 3) { - piercingScore += 1.25; /* smart piercing */ - } else if (slave.clitPiercing > 0) { - piercingScore += slave.clitPiercing*0.75-0.25; - } - if (slave.vaginaPiercing > 0) { - piercingScore += slave.vaginaPiercing*0.75-0.25; - } - if (slave.dickPiercing > 0) { - piercingScore += slave.dickPiercing*0.75-0.25; - } - if (slave.anusPiercing > 0) { - piercingScore += slave.anusPiercing*0.75-0.25; - } - return piercingScore; -}; - -window.TatScore = /** @param {App.Entity.SlaveState} slave */ function (slave) { - let tatScore = 0; - - if (slave.boobsTat !== 0) { - tatScore += 1.25; - } - if (slave.buttTat !== 0) { - tatScore += 1.25; - } - if (slave.lipsTat !== 0) { - tatScore += 1.25; - } - if (slave.shouldersTat !== 0) { - tatScore += 1; - } - if (slave.backTat !== 0) { - tatScore += 1.25; - } - if (slave.armsTat !== 0) { - tatScore += 1; - } - if (slave.legsTat !== 0) { - tatScore += 1; - } - if (slave.stampTat !== 0) { - tatScore += 1; - } - if (slave.vaginaTat !== 0) { - tatScore += 1; - } - if (slave.dickTat !== 0) { - tatScore += 1; - } - if (slave.bellyTat !== 0) { - if (((slave.preg > slave.pregData.normalBirth/1.33) && (slave.pregType >= 20)) || (slave.belly >= 300000)) { - tatScore += 0.75; - } else if (((slave.preg > slave.pregData.normalBirth/2) && (slave.pregType >= 20)) || ((slave.preg > slave.pregData.normalBirth/1.33) && (slave.pregType >= 10)) || (slave.belly >= 150000)) { - tatScore += 1; - } else if ((slave.belly >= 10000) || (slave.bellyImplant >= 8000)) { - tatScore += 1; - } else if (((slave.preg >= slave.pregData.normalBirth/4) && (slave.pregType >= 20)) || ((slave.preg > slave.pregData.normalBirth/4) && (slave.pregType >= 10)) || (slave.belly >= 5000)) { - tatScore += 0.5; - } else if (slave.belly >= 1500) { - tatScore += 0.25; - } else { - tatScore += 0.1; - } - } - if (slave.anusTat === "bleached") { - tatScore += 0.5; - } else if (slave.anusTat !== 0) { - tatScore += 1.25; - } - if (slave.abortionTat > 0 || (slave.abortionTat == 0 && slave.pregKnown == 1)) { - tatScore += 1; - } - - return tatScore; -}; - window.slimPass = /** @param {App.Entity.SlaveState} slave */ function (slave) { let slimPass = 0; let ArcologyZero = State.variables.arcologies[0]; diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index 920e579d867fe47654e99febba7a4f0b9c512dfe..8aa75bdaf377fb909b9fc649ff4d00ef278ec5db 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -6,7 +6,7 @@ window.Beauty = (function() { function Beauty(slave) { V = State.variables; arcology = V.arcologies[0]; - modScore(slave); + V.modScore = SlaveStatsChecker.modScore(slave); beauty = 120; calcInitBeauty(slave); diff --git a/src/js/slaveStatsChecker.js b/src/js/slaveStatsChecker.js new file mode 100644 index 0000000000000000000000000000000000000000..c9fd17b4d5e24f359da2b6fabe0a11b82dee1d04 --- /dev/null +++ b/src/js/slaveStatsChecker.js @@ -0,0 +1,110 @@ +window.SlaveStatsChecker = (function() { + return { + checkForLisp: hasLisp, + modScore: modScore, + piercingScore: piercingScore, + tatScore: tatScore + }; + + function hasLisp(slave) { + if (State.variables.disableLisping === 1) { + return false; + } + return (slave.lips > 70 || (slave.lipsPiercing + slave.tonguePiercing > 2) || slave.teeth === "gapped"); + } + + /** @param {App.Entity.SlaveState} slave */ + function modScore(slave) { + const V = State.variables; + V.piercingScore = piercingScore(slave); + V.tatScore = tatScore(slave); + return V.tatScore + V.piercingScore; + } + + /** @param {App.Entity.SlaveState} slave */ + function piercingScore(slave) { + let score = 0; + + if (slave.earPiercing > 0) + score += slave.earPiercing*0.75 - 0.5; + if (slave.nosePiercing > 0) + score += slave.nosePiercing*0.75 - 0.5; + if (slave.eyebrowPiercing > 0) + score += slave.eyebrowPiercing*0.75 - 0.5; + if (slave.navelPiercing > 0) + score += slave.navelPiercing*0.75 - 0.5; + if (slave.corsetPiercing > 0) + score += slave.corsetPiercing*0.75 + 0.5; + if (slave.nipplesPiercing > 0) + score += slave.nipplesPiercing*0.75 - 0.25; + if (slave.areolaePiercing > 0) + score += slave.areolaePiercing*0.75 + 0.5; + if (slave.lipsPiercing > 0) + score += slave.lipsPiercing*0.75 - 0.25; + if (slave.tonguePiercing > 0 ) + score += slave.tonguePiercing*0.75 - 0.25; + if (slave.clitPiercing === 3) /* smart piercing */ + score += 1.25; + else if (slave.clitPiercing > 0) + score += slave.clitPiercing*0.75 - 0.25; + + if (slave.vaginaPiercing > 0) + score += slave.vaginaPiercing*0.75 - 0.25; + if (slave.dickPiercing > 0) + score += slave.dickPiercing*0.75 - 0.25; + if (slave.anusPiercing > 0) + score += slave.anusPiercing*0.75 - 0.25; + + return score; + } + + /** @param {App.Entity.SlaveState} slave */ + function tatScore(slave) { + let score = 0; + + if (slave.boobsTat !== 0) + score += 1.25; + if (slave.buttTat !== 0) + score += 1.25; + if (slave.lipsTat !== 0) + score += 1.25; + if (slave.shouldersTat !== 0) + score += 1; + if (slave.backTat !== 0) + score += 1.25; + if (slave.armsTat !== 0) + score += 1; + if (slave.legsTat !== 0) + score += 1; + if (slave.stampTat !== 0) + score += 1; + if (slave.vaginaTat !== 0) + score += 1; + if (slave.dickTat !== 0) + score += 1; + if (slave.bellyTat !== 0) { + if ((slave.preg > slave.pregData.normalBirth/1.33 && slave.pregType >= 20) || slave.belly >= 300000) + score += 0.75; + else if ((slave.preg > slave.pregData.normalBirth/2 && slave.pregType >= 20) || (slave.preg > slave.pregData.normalBirth/1.33 && slave.pregType >= 10) || slave.belly >= 150000) + score += 1; + else if (slave.belly >= 10000 || slave.bellyImplant >= 8000) + score += 1; + else if ((slave.preg >= slave.pregData.normalBirth/4 && slave.pregType >= 20) || (slave.preg > slave.pregData.normalBirth/4 && slave.pregType >= 10) || slave.belly >= 5000) + score += 0.5; + else if (slave.belly >= 1500) + score += 0.25; + else + score += 0.1; + } + if (slave.anusTat === "bleached") + score += 0.5; + else if (slave.anusTat !== 0) + score += 1.25; + + if (slave.abortionTat > 0 || (slave.abortionTat === 0 && slave.pregKnown === 1)) { + score += 1; + } + + return score; + } +}()); diff --git a/src/js/slaveSummaryWidgets.js b/src/js/slaveSummaryWidgets.js index f965be1269fbeb9bce7db79e6d53070081518fc3..216a12bb1a72c4d4c2d7f8a27f553a2e4d22b005 100644 --- a/src/js/slaveSummaryWidgets.js +++ b/src/js/slaveSummaryWidgets.js @@ -2274,7 +2274,7 @@ window.SlaveSummaryUncached = (function(){ /** @param {App.Entity.SlaveState} slave */ function short_mods(slave) { - modScore(slave); + V.modScore = SlaveStatsChecker.modScore(slave); if (slave.corsetPiercing === 0 && V.piercingScore < 3 && V.tatScore < 2) { return; } else if (V.modScore > 15 || (V.piercingScore > 8 && V.tatScore > 5)) { @@ -2611,7 +2611,7 @@ window.SlaveSummaryUncached = (function(){ /** @param {App.Entity.SlaveState} slave */ function long_mods(slave) { - modScore(slave); + V.modScore = SlaveStatsChecker.modScore(slave); if (slave.corsetPiercing === 0 && V.piercingScore < 3 && V.tatScore < 2) { return; } else if (V.modScore > 15 || (V.piercingScore > 8 && V.tatScore > 5)) { diff --git a/src/js/storyJS.js b/src/js/storyJS.js index fcc99af35f0efccb5909c061dd470f64aa9e5d01..6be585c2aac75263a070bdefe2656b562b30bc4c 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -73,24 +73,6 @@ if (typeof BoobGenerator === "undefined") { window.BoobGenerator = BoobGenerator; } -/** - * Slave checker namespace. - */ -if (typeof SlaveStatsChecker === "undefined") { - var SlaveStatsChecker = { - checkForLisp: function (slave) { - /* Begin mod section: toggle whether slaves lisp. */ - if (State && State.variables.disableLisping === 1) { - return false; - } - /* End mod section: toggle whether slaves lisp. */ - return ((slave.lips > 70) || (slave.lipsPiercing + slave.tonguePiercing > 2) || (slave.teeth === "gapped")); - } - }; - // Raise namespace scope to Global. - window.SlaveStatsChecker = SlaveStatsChecker; -} - window.removeFromArray = function(arr, val) { for (var i = 0; i < arr.length; i++) { if (val === arr[i]) diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw index 40b0af39d0fce05061340fe5c16d3cef9b33f170..9d5266ee9645b19f3d692ad1278451addd92387f 100644 --- a/src/uncategorized/saLongTermEffects.tw +++ b/src/uncategorized/saLongTermEffects.tw @@ -4303,7 +4303,7 @@ <</if>> <<if $arcologies[0].FSPaternalist != "unset" || $arcologies[0].FSDegradationist != "unset" || $arcologies[0].FSBodyPurist != "unset">> - <<run modScore($slaves[$i])>> + <<set $modScore = SlaveStatsChecker.modScore($slaves[$i])>> <</if>> <<if $arcologies[0].FSSupremacist != "unset">> diff --git a/src/uncategorized/saRecruitGirls.tw b/src/uncategorized/saRecruitGirls.tw index 494bc425d68aed2b6ba286935066d518b66110a9..3677455aff2aa1a906617ab34a7ebf07d31ab0c2 100644 --- a/src/uncategorized/saRecruitGirls.tw +++ b/src/uncategorized/saRecruitGirls.tw @@ -482,7 +482,7 @@ <<set _seed += 1>> <</if>> <<elseif $arcologies[0].FSDegradationist != "unset">> - <<run modScore($slaves[$i])>> + <<set $modScore = SlaveStatsChecker.modScore($slaves[$i])>> <<if $slaves[$i].intelligence+$slaves[$i].intelligenceImplant > 50>> <<set _seed += 1, _FSdefend++, $arcologies[0].FSDegradationist += 0.01*$FSSingleSlaveRep*_FSIntMod>> <</if>> @@ -491,7 +491,7 @@ <</if>> <</if>> <<if $arcologies[0].FSBodyPurist != "unset">> - <<run modScore($slaves[$i])>> + <<set $modScore = SlaveStatsChecker.modScore($slaves[$i])>> <<if $slaves[$i].corsetPiercing == 0 && $piercingScore < 3 && $tatScore < 2>> <<if $slaves[$i].boobsImplant == 0>> <<set _seed += 1>>