diff --git a/SanityCheck.jar b/SanityCheck.jar index 36c886155cf61858bb6e54466cb88efc05f615cd..478417de473b6dd0de5575eef4d474e2ef3d7073 100644 Binary files a/SanityCheck.jar and b/SanityCheck.jar differ diff --git a/compile-git+java-sanityCheck.bat b/compile-git+java-sanityCheck.bat new file mode 100644 index 0000000000000000000000000000000000000000..b1050a2d7d8a4257f1ba91cdafccb5f6b7f8daec --- /dev/null +++ b/compile-git+java-sanityCheck.bat @@ -0,0 +1,39 @@ +@echo off +:: Free Cities Basic Compiler - Windows + +:: Set working directory +pushd %~dp0 + +:: See if we can find a git installation +setlocal enabledelayedexpansion + +for %%k in (HKCU HKLM) do ( + for %%w in (\ \Wow6432Node\) do ( + for /f "skip=2 delims=: tokens=1*" %%a in ('reg query "%%k\SOFTWARE%%wMicrosoft\Windows\CurrentVersion\Uninstall\Git_is1" /v InstallLocation 2^> nul') do ( + for /f "tokens=3" %%z in ("%%a") do ( + set GIT=%%z:%%b + set GITFOUND=yes + goto FOUND + ) + ) + ) +) +:FOUND +if %GITFOUND% == yes ( + set "PATH=%GIT%bin;%PATH%" + bash --login -c ./java+gitGrep-sanityCheck.sh +) + +:: Compile the game +call "%~dp0compile.bat" + +if %GITFOUND% == yes ( + :: Make the output prettier, replacing \t with a tab and \n with a newline + bash -c "sed -i -e '/^.*<div id=\"store-area\".*$/s/\\\t/\t/g' -e '/^.*<div id=\"store-area\".*$/s/\\\n/\n/g' bin/FC_pregmod.html" + + :: Revert ./src/init/storyInit.tw for next compilation + git checkout -- ./src/init/storyInit.tw +) + +popd +PAUSE diff --git a/compile-git+java-sanityCheck.sh b/compile-git+java-sanityCheck.sh new file mode 100755 index 0000000000000000000000000000000000000000..53f1ec1f7aacd71618fa8276424dea09140751f5 --- /dev/null +++ b/compile-git+java-sanityCheck.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Run sanity check. +./java+gitGrep-sanityCheck.sh + +HASH="$(git rev-list -n 1 --abbrev-commit HEAD)" + +export TWEEGO_PATH=devTools/tweeGo/storyFormats +TWEEGO_EXE="tweego" + +if hash $TWEEGO_EXE 2>/dev/null; then + echo "system tweego binary" +else + case "$(uname -m)" in + x86_64|amd64) + echo "x64 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx64" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix64" + fi + ;; + x86|i[3-6]86) + echo "x86 arch" + if [ "$(uname -s)" = "Darwin" ]; then + TWEEGO_EXE="./devTools/tweeGo/tweego_osx86" + else + TWEEGO_EXE="./devTools/tweeGo/tweego_nix86" + fi + ;; + *) + echo "No system tweego binary found, and no precompiled binary for your platform available" + echo "Please compile tweego and put the executable in PATH" + exit 2 + esac +fi + +$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ + +#Make the output prettier, replacing \t with a tab and \n with a newline +sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \ + && mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html" + +echo "FC_pregmod_$HASH.html compilation finished." diff --git a/devNotes/twine CSS b/devNotes/twine CSS index 0c11d518885273e3fa7335bb94c87d15efb5d4a1..1d74d7da5628dd716ca811c5ede5e0203faae835 100644 --- a/devNotes/twine CSS +++ b/devNotes/twine CSS @@ -623,3 +623,35 @@ div.tab button.active { opacity: 1; } } + +/*:: Options Macro [stylesheet]*/ + +.optionMacroDescription { +} + +.optionMacroOption { +} + +/* Seperate each option with a | */ +.optionMacroOption::after { + content: " | "; +} + +/* But don't add the | after the last one */ +.optionMacroOption:last-child::after { + content: unset; +} + + +.optionMacroOption a { +} + +.optionMacroOption:hover { +} + +.optionMacroSelected { +} + +/* Container div of the list of options */ +.optionMacroOptionsList { +} diff --git a/devTools/javaSanityCheck/src/Main.java b/devTools/javaSanityCheck/src/Main.java index 87b18682d2391fc678a383ccc4b47480278c0473..9c2d72a8ebe019e565a56e8daf3625c50c4b0f6d 100644 --- a/devTools/javaSanityCheck/src/Main.java +++ b/devTools/javaSanityCheck/src/Main.java @@ -261,26 +261,33 @@ public class Main { if (change == 3) { //remove the topmost element from stack since it is complete KnownElement k = stack.pop().getKnownElement(); - //if KnownElement k is closing another tag check if there is one and remove it + //if KnownElement k is closing another element, check if there is one and remove it if (k.isClosing()) { - if (stack.empty()) { //there are no open tags at all - addError(new SyntaxError("Closed tag " + k.getShortDescription() + " without having any open tags.", -2)); + if (stack.empty()) { //there are no open elements at all + addError(new SyntaxError("Closed tag " + k.getShortDescription() + " without " + + "having any open tags.", -2)); } else if (stack.peek() instanceof KnownElement) { + //get opening tag KnownElement kFirst = (KnownElement) stack.pop(); + //check if closing element matches the opening element if (!kFirst.isMatchingElement(k)) { addError(new SyntaxError("Opening tag " + kFirst.getShortDescription() + " does not match closing tag " + k.getShortDescription() + ".", -2)); } } else { + //There closing tag inside another not Known element: <div </html> addError(new SyntaxError("Closing tag " + k.getShortDescription() + " inside " + - "another tag: " + stack.peek().getShortDescription(), -2, true)); + "another tag " + stack.peek().getShortDescription() + " without opening first.", + -2, true)); } } + //check if the element needs to be closed by another if (k.isOpening()) { stack.push(k); } return; } + //means the element couldn't do anything with it and is finished if (change == 4) { stack.pop(); } else { @@ -293,7 +300,7 @@ public class Main { //innermost element was uninterested, trying to find matching element switch (c) { //case '@': - // stack.push(new AtElement(currentLine, currentPosition)); + //stack.push(new AtElement(currentLine, currentPosition)); //break; case '<': stack.push(new AngleBracketElement(currentLine, currentPosition)); diff --git a/devTools/javaSanityCheck/src/element/AngleBracketElement.java b/devTools/javaSanityCheck/src/element/AngleBracketElement.java index 233c4f303205ab5e24b7c7ffd8c45088002ed471..43538bd6986a30cbc1a98966c8f6fea15144a3a3 100644 --- a/devTools/javaSanityCheck/src/element/AngleBracketElement.java +++ b/devTools/javaSanityCheck/src/element/AngleBracketElement.java @@ -218,7 +218,7 @@ public class AngleBracketElement extends Element { private int handleClosingHTML(char c) throws SyntaxError { if (c == '>') { if (tree.getElement() == null) { - throw new SyntaxError("Unknown HTML tag", 2); + throw new SyntaxError("Unknown HTML tag: " + tree.getPath(), 2); } if (tree.getElement().single) { throw new SyntaxError("Single HTML tag used as closing Tag: " + tree.getElement().tag, 2); @@ -243,7 +243,6 @@ public class AngleBracketElement extends Element { if (tree.getElement() == null) { //assuming not listed means widget until better solution return 1; - //throw new SyntaxError("Unknown Twine tag or closing \">>\" missing, found " + tree.getPath(), 1); } if (!tree.getElement().single) { if (logicTags.contains(tree.getElement().tag)) { @@ -260,7 +259,6 @@ public class AngleBracketElement extends Element { state = -5; if (tree.getElement() == null) { //assuming not listed means widget until better solution - //throw new SyntaxError("Unknown Twine tag or closing \">>\" missing, found " + tree.getPath(), 1); return 1; } if (!tree.getElement().single) { @@ -279,7 +277,6 @@ public class AngleBracketElement extends Element { if (tree == null) { //assuming not listed means widget until better solution state = 3; - //throw new SyntaxError("Unknown Twine tag or closing \">>\" missing, found " + c, 1); } return 1; @@ -288,7 +285,7 @@ public class AngleBracketElement extends Element { private int handleClosingTwine(char c) throws SyntaxError { if (c == '>') { if (tree.getElement() == null) { - throw new SyntaxError("Unknown Twine tag", 2); + throw new SyntaxError("Unknown Twine tag: " + tree.getPath(), 2); } if (tree.getElement().single) { throw new SyntaxError("Single Twine tag used as closing Tag: " + tree.getElement().tag, 2); @@ -319,6 +316,7 @@ public class AngleBracketElement extends Element { case 0: builder.append("<"); break; + //TWINE case 1: builder.append("<<"); break; @@ -332,28 +330,49 @@ public class AngleBracketElement extends Element { builder.append("<</").append(tree.getPath()); break; case 3: - builder.append("<<??? ???"); - break; - case 4: - builder.append("<<?").append(tree.getPath()).append(" ???"); + builder.append("<<???"); break; case -3: - builder.append("<<??? ???>"); + builder.append("<<???>"); + break; + case 4: + builder.append("<<").append(tree.getPath()).append(" ???"); break; case -4: - builder.append("<<?").append(tree.getPath()).append(" ???>"); + builder.append("<<").append(tree.getPath()).append(" ???>"); break; case 5: - builder.append("<").append(tree.getPath()).append(" ???"); + builder.append("<<???"); break; case -5: - builder.append("</").append(tree.getPath()); + builder.append("<<").append(tree == null ? "???" : tree.getPath()).append(">"); break; case 6: - builder.append("<").append(tree.getPath()).append(" ???"); + builder.append("<<").append(tree.getPath()).append(" ???>"); + break; + case -6: + builder.append("<</").append(tree.getPath()).append(">"); + break; + //HTML + case -9: + builder.append("</"); break; + case 10: + builder.append("<").append(tree.getPath()); + break; + case -10: + builder.append("</").append(tree.getPath()); + break; + case 11: + builder.append("<?").append(tree == null ? "???" : tree.getPath()); + break; + case -11: + builder.append("</").append(tree == null ? "???" : tree.getPath()); + break; + case 12: + builder.append("<").append(tree.getPath()).append(" ???"); default: - //throw new UnknownStateException(state); + throw new UnknownStateException(state); } return builder.toString(); } diff --git a/devTools/javaSanityCheck/twineTags b/devTools/javaSanityCheck/twineTags index d0c5e0c6f9ee32f472d3a5d3a9453961de54b729..bfaa9ccc4de7ab664404577c17f6e58c9debe228 100644 --- a/devTools/javaSanityCheck/twineTags +++ b/devTools/javaSanityCheck/twineTags @@ -15,6 +15,7 @@ htag;1 include;0 link;1 nobr;1 +options;1 print;0 replace;1 run;0 diff --git a/java+gitGrep-sanityCheck.sh b/java+gitGrep-sanityCheck.sh new file mode 100755 index 0000000000000000000000000000000000000000..02e5e0853125872d38d548a37361eedd16fca35d --- /dev/null +++ b/java+gitGrep-sanityCheck.sh @@ -0,0 +1,111 @@ +#!/bin/bash +if [ ! -d ".git" ]; then + #not running in git repo, so can't use git commands :-) + echo "No .git repo found - skipping sanity checks" + exit 0 +fi + +WARNING='\033[93m' +WARNING='\033[93m' +ENDC='\033[0m' + +myprint() { + while read data; do + echo -n -e "[$1]$WARNING" + echo "$data" + done +} + +GREP="git grep -n --color" +# Check for missing right angle bracket: <</if> +#$GREP "<</[^>]*>[^>]" -- 'src/*' | myprint "MissingClosingAngleBracket" +#$GREP "<<[^>()]*>[^()<>"$'\r]*\r'"\?$" -- 'src/*' | myprint "MissingClosingAngleBracket" +# Check for missing left angle bracket: </if>> +#$GREP "\([^<]\|^\)</\?\(if\|else\|case\|set\|print\|elseif\)" -- 'src/*' | myprint "MissingOpeningAngleBracket2" +# Check for accidental assignment. e.g.: <<if $foo = "hello">> +$GREP "<<[ ]*if[^>=]*[^><\!=]=[^=][^>]*>>" -- 'src/*' | myprint "AccidentalAssignmentInIf" +# Check for accidental assignment. e.g.: <<elseif $foo = "hello">> +$GREP "<<[ ]*elseif[^>=]*[^><\!=]=[^=][^>]*>>" -- 'src/*' | myprint "AccidentalAssignmentInElseIf" +# Check for missing ". e.g.: <<if $foo == "hello>> +$GREP "<<[^\"<>]*\"[^\"<>]*>>" -- 'src/*' | myprint "MissingSpeechMark" +# Check for missing ". e.g.: <<if $foo = "hello) +$GREP -e "<<[^\"<>]*\([^\"<>]*\"[^><\"]*\"\| [<>] \)*\"\([^\"<>]*\"[^><\"]*\"\| [<>] \)*\([^\"<>]\| [<>] \)*>>" --and --not -e "*[^']*" -- 'src/*' | myprint "MissingSpeechMark2" +# Check for colors like: @@color:red - should be @@.red +$GREP -e "@@color:" --and --not -e "@@color:rgb([0-9 ]\+,[0-9 ]\+,[0-9 ]\+)" -- "src/*" | myprint "UseCssColors" +# Check for missing $ in activeSlave or PC +$GREP "<<[ ]*[^\$><_\[]*\(activeSlave\|PC\)[.]" -- "src/*" | myprint "MissingDollar" +# Check for closing bracket without opening bracket. e.g.: <<if foo)>> (but <<case "foo")>> is valid, so ignore those +$GREP -e "<<[ a-zA-Z]\+\([^()<>]\|[^()<>][<>][^()<>]\)*)" --and --not -e "<< *case" -- "src/*" | myprint "MissingOpeningBracket" +# Check for opening bracket without closing bracket. e.g.: <<if (foo>> +$GREP -e "<<[ a-zA-Z]\([^<>]\|[^<>][<>][^<>]\)\+(\([^()<>]\|[^<>()][<>][^<>()]\|([^<>()]*])\)*>>" -- "src/*" | myprint "MissingClosingBracket" +# Check for two closing brackets but one opening bracket. e.g.: <<if (foo))>> +$GREP -e "<<[ a-zA-Z]\+[^()<>]*([^()]*)[^()]*)[^()<>]*>>" -- "src/*" | myprint "MissingOpeningBracket2" +# Check for one closing bracket but two opening brackets. e.g.: <<if ((foo)>> +$GREP -e "<<[ a-zA-Z]\+[^()<>]*([^()]*([^()]*)[^()<>]*>>" -- "src/*" | myprint "MissingClosingBracket2" +$GREP -e "<<.*[(][^<>)]*[(][^<>)]*)\?[^<>)]*>>" -- "src/*" | myprint "MissingClosingBracket3" +# Check for missing >>. e.g.: <<if $foo +#$GREP "<<[^<>]*[^,\"\[{"$'\r]\r'"\?$" -- 'src/*' | myprint "MissingClosingAngleBrackets" +# Check for too many >>>. e.g.: <</if>>> +$GREP "<<[^<>]*[<>]\?[^<>]*>>>" -- "src/*.tw" | myprint "TooManyAngleBrackets" +# Check for too many <<<. e.g.: <<</if>> +#$GREP "<<<[^<>]*[<>]\?[^<>]*>>" -- "src/*.tw" | myprint "TooManyAngleBrackets" +# Check for wrong capitalization on 'activeslave' and other common typos +$GREP -e "\$act" --and --not -e "\$\(activeSlave\|activeChild\|activeArcology\|activeStandard\|activeOrgan\|activeLimbs\|activeUnits\|activeCanine\|activeHooved\|activeFeline\)" -- "src/*" | myprint "WrongCapitilization" +$GREP "\(csae\|[a-z] She \|attepmts\|youreslf\|advnaces\|canAcheive\|setBellySize\|SetbellySize\|setbellySize\|bellypreg\|pregBelly\|bellyimplant\|bellyfluid\|pronounCaps\|carress\|hormonebalance\|fetishknown\)" -- 'src/*' | myprint "SpellCheck" +$GREP "\(recieve\|recieves\)" -- 'src/*' | myprint "PregmodderCannotSpellReceive" +$GREP "\$slave\[" -- 'src/*' | myprint "ShouldBeSlaves" +# Check for strange spaces e.g. $slaves[$i]. lips +$GREP "\$slaves\[\$i\]\. " -- 'src/*' | myprint "MissingPropertyAfterSlaves" +# Check using refreshmentType instead of refreshment +$GREP "\$PC.refreshmentType[^ =]" -- 'src/*' | myprint "ShouldBeRefreshment" +# Check, e.g., <<//if>> +$GREP "<</[a-zA-Z]*[^a-zA-Z<>]\+[a-zA-Z]*>>" -- 'src/*' | myprint "DoubleSlash" +# Check, e.g. <<else $foo==4 +#$GREP "<<else >\?[^>]" -- 'src/*' | myprint "ShouldBeElseIf" +# Check, e.g., =to +$GREP "=to" -- 'src/*' | myprint "EqualAndTo" +# Check doing $slaves.foo instead of $slaves[i].foo +$GREP -e "[$]slaves[.]" --and --not -e '[$]slaves[.]\(length\|random\|map\|filter\|deleteAt\|push\|find\|includes\|delete\|forEach\)' -- 'src/*' | myprint "MissingSlavesIndex" +# Try to check for accidentally mixing slaves[] and activeSlave. This can have a lot of false matches, but has caught a lot of bugs so it's worth the pain +$GREP -e "activeSlave[.]" --and -e "slaves\[..\?\][.]" --and --not -e '[.]ID' --and --not -e 'slaves\[..\?\][.]\(slaveName\|slaveSurname\|actualAge\|relation\|assignment\|age\|devotion\|trust\|vagina\|mother\|father\|training\)' -- 'src/*' | myprint "MaybeAccidentalMixingOfSlavesAndActiveSlave" +# Check, e.g. <<set foo == 4>> +$GREP "<<set[^{>=]*==" -- 'src/*' | myprint "DoubleEqualsInSet" +# Check for, e.g <<if slaves[foo]>> +$GREP "<<\([^>]\|[^>]>[^>]\)*[^$]slaves\[" -- 'src/*' | myprint "MissingDollar" +# Check for missing $ or _ in variable name: +$GREP -e "<<[a-zA-Z]\([^>\"]\|[^>]>[^>]\|\"[^\"]*\"\)* [a-zA-Z]\+ * =" -- src/*.tw | myprint "MissingDollar2" +# Check for missing command, e.g. <<foo = +$GREP -e "<<[a-zA-Z]* = *" -- src/*.tw | myprint "BadCommand" +# Check for duplicate words, e.g. with with +$GREP -e " \(\b[a-zA-Z][a-zA-Z]\+\) \1\b " --and --not -e " her her " --and --not -e " you you " --and --not -e " New New " --and --not -e "Slave Slave " --and --not -e " that that " --and --not -e " in in " --and --not -e " is is " -- 'src/*' | myprint "Duplicate words" +# Check for obsolete SugarCube macros +$GREP -E "<<display |<<click|<<.*\.contains" -- src/*.tw | myprint "ObsoleteMacro" +# Check for double articles +$GREP -E "\Wa an\W" -- src/*.tw | myprint "DoubleArticle" +# Check for incorrect articles +$GREP -i -E "\Wa (a|e|i|o|u)." -- src/*.tw | grep -a -i -vE "\Wa (un|eu|us|ut|on|ur|in)." | grep -a -i -vE "(&|<<s>>|UM)." | myprint "IncorrectArticle" +$GREP -i -E "\Wan (b|c|d|f|g|j|k|l|m|n|p|q|r|s|t|v|w|x|y|z)\w." -- src/*.tw | grep -a -i -vE "[A-Z]{3}" | myprint "IncorrectArticle" +# Check for $ sign mid-word +$GREP -i "\w$\w" -- src/*.tw | myprint "VarSignMidWord" +# check for $ sign at beginning of macro +$GREP '<<\s*\$' -- 'src/*' | myprint "VarSignAtMacroStart" +# check for missing ; before statement +$GREP 'if $ ' -- 'src/*' | myprint "missing ; before statement" +$GREP 'elseif $ ' -- 'src/*' | myprint "missing ; before statement" +# Check for a . inside a <<>> +$GREP "<<[a-zA-Z]\([^\"'>]\|[^\"'>]>[^\"'>]\)*[a-zA-Z][.][^a-zA-Z]" | myprint "StrangeCharacterAfterDot" +# Check for @@. instead of .@@ +$GREP -E "@@(\.|,|;|:)\s" -- src/*.tw | myprint "WrongSelectorPunctuation" + +# Check that we do not have any variables that we use only once. e.g. $onlyUsedOnce +# Ignore *Nationalities +( +cd src/ +cat $(find . -name "*.tw" ) | tr -c '$a-zA-Z' '\n' | sed -n '/^[$]/p' | grep -v "Nationalities" | sort | uniq -u | sed 's/^[$]/-e[$]/' | sed 's/$/\\\\W/' | xargs -r git grep -n --color | myprint "OnlyUsedOnce" +cat $(find . -name "*.tw" ) | tr -c '.$a-zA-Z[]_' '\n' | sed 's/SugarCube\.State\.variables\./$/g' | sed -n -e 's/^[$]\(PC\|activeSlave\|\(slaves\|tanks\)\[[^]]*\]*\)[.]\([a-zA-Z]\+\).*$/[.]\3/p' | sort | uniq -u |sed 's/^\(.*\)$/-e\1\\\\\b/' | xargs -r git grep -n --color | myprint "SlaveAttributeUsedOnce" +$GREP "\$\(PC\|activeSlave\|slaves\|tanks\)[.][^a-zA-Z]" | myprint "UnexpectedCharAfterDot" + +) + +#run the java sanity check +java -jar SanityCheck.jar diff --git a/sanityCheck-java b/sanityCheck-java deleted file mode 100755 index 455bbfbc243ec664f5aac2daa2ad74903d104962..0000000000000000000000000000000000000000 --- a/sanityCheck-java +++ /dev/null @@ -1 +0,0 @@ -java -jar SanityCheck.jar diff --git a/sanityCheck-java.bat b/sanityCheck-java.bat deleted file mode 100644 index 455bbfbc243ec664f5aac2daa2ad74903d104962..0000000000000000000000000000000000000000 --- a/sanityCheck-java.bat +++ /dev/null @@ -1 +0,0 @@ -java -jar SanityCheck.jar diff --git a/src/js/assayJS.js b/src/js/assayJS.js index 5caec9358e1af9245e9a4283a4b576e149529735..af8c87f0631931b64a25289dbda8ba45f4a4015e 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -1,4 +1,4 @@ -window.isSlim = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isSlim = /** @param {App.Entity.SlaveState} slave */ function(slave) { let slim = false; const ArcologyZero = State.variables.arcologies[0]; @@ -27,11 +27,11 @@ window.isSlim = /** @param {App.Entity.SlaveState} slave */ function (slave) { return slim; }; -window.isStacked = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isStacked = /** @param {App.Entity.SlaveState} slave */ function(slave) { return (slave.butt > 4) && (slave.boobs > 800); }; -window.isModded = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isModded = /** @param {App.Entity.SlaveState} slave */ function(slave) { const tatScore = SlaveStatsChecker.tatScore(slave); const piercingScore = SlaveStatsChecker.piercingScore(slave); const modScore = piercingScore+tatScore; @@ -39,39 +39,39 @@ window.isModded = /** @param {App.Entity.SlaveState} slave */ function (slave) { return ((modScore > 15) || (piercingScore > 8 && tatScore > 5)); }; -window.isUnmodded = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isUnmodded = /** @param {App.Entity.SlaveState} slave */ function(slave) { return (!isModded(slave) && (slave.corsetPiercing === 0) && (SlaveStatsChecker.piercingScore(slave) < 3) && (SlaveStatsChecker.tatScore(slave) < 2)); }; -window.isXY = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isXY = /** @param {App.Entity.SlaveState} slave */ function(slave) { return (slave.dick > 0); }; -window.isYoung = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isYoung = /** @param {App.Entity.SlaveState} slave */ function(slave) { return (slave.visualAge < 30); }; -window.isPreg = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isPreg = /** @param {App.Entity.SlaveState} slave */ function(slave) { return ((slave.bellyPreg >= 5000) || (slave.bellyImplant >= 5000)); }; -window.isNotPreg = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.isNotPreg = /** @param {App.Entity.SlaveState} slave */ function(slave) { return (!isPreg(slave) && (slave.belly < 100) && (slave.weight < 30) && !setup.fakeBellies.includes(slave.bellyAccessory)); }; -window.isPure = /** @param {App.Entity.SlaveState} slave */ function (slave) { +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.slimPass = /** @param {App.Entity.SlaveState} slave */ function (slave) { +window.slimPass = /** @param {App.Entity.SlaveState} slave */ function(slave) { let slimPass = 0; - let ArcologyZero = State.variables.arcologies[0]; + const ArcologyZero = State.variables.arcologies[0]; if (ArcologyZero.FSSlimnessEnthusiastLaw === 1) { if ((slave.boobs < 300) && (slave.butt <= 1) && (slave.waist <= 10)) { - 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; - } else if ((ArcologyZero.FSHedonisticDecadence !== "unset") || (ArcologyZero.FSPhysicalIdealistStrongFat === 1)) { /*weight check*/ + } else if ((ArcologyZero.FSHedonisticDecadence !== "unset") || (ArcologyZero.FSPhysicalIdealistStrongFat === 1)) { /* weight check*/ if (slave.weight > 30) { slimPass = 0; } @@ -112,7 +112,7 @@ window.inferiorRaceP = /** @param {App.Entity.SlaveState} slave */ function infe window.hasVisibleHeterochromia = /** @param {App.Entity.SlaveState} slave */ function hasVisibleHeterochromia(slave) { return slave.geneticQuirks.heterochromia !== 0 && slave.geneticQuirks.heterochromia !== 1 && slave.geneticQuirks.albinism !== 2 && slave.geneticQuirks.heterochromia !== slave.eyeColor && slave.eyeColor === slave.origEye; -} +}; window.isLeaderP = /** @param {App.Entity.SlaveState} slave */ function isLeaderP(slave) { const V = State.variables; @@ -250,7 +250,7 @@ window.newSlave = /** @param {App.Entity.SlaveState} slave */ function newSlave( V.genePool.push(slave); /* Store non-albino stats in genePool */ if (slave.geneticQuirks.albinism === 2) { - var 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.genePool[albInd].origSkin = slave.albinismOverride.skin; V.genePool.genePool[albInd].origEye = slave.albinismOverride.eyeColor; V.genePool.genePool[albInd].origHColor = slave.albinismOverride.hColor; @@ -392,7 +392,7 @@ window.getPronouns = /** @param {App.Entity.SlaveState} slave */ function getPro possessive: slave.possessive, object: slave.object, objectReflexive: slave.objectReflexive, - noun: slave.noun }; + noun: slave.noun}; }; window.SlavePronouns = /** @param {App.Entity.SlaveState} slave */ function SlavePronouns(slave) { @@ -557,7 +557,7 @@ window.Enunciate = /** @param {App.Entity.SlaveState} slave */ function Enunciat window.fetishChangeChance = /** @param {App.Entity.SlaveState} slave */ function fetishChangeChance(slave) { const V = State.variables; - var chance = 0, sex = 0; + let chance = 0, sex = 0; if (slave.clitSetting !== slave.fetish) { if (slave.balls) { @@ -566,7 +566,7 @@ window.fetishChangeChance = /** @param {App.Entity.SlaveState} slave */ function else if (slave.ovaries || slave.mpreg) { sex = V.fertilityAge - slave.actualAge; } - chance = Math.trunc(Math.clamp((slave.devotion/4)-(slave.fetishStrength/4)-(Math.max(sex,0)*10), 0, 100)); + chance = Math.trunc(Math.clamp((slave.devotion/4)-(slave.fetishStrength/4)-(Math.max(sex, 0)*10), 0, 100)); } return chance; @@ -590,7 +590,7 @@ window.SlaveFullBirthName = /** @param {App.Entity.SlaveState} slave */ function window.PlayerName = function PlayerName() { const V = State.variables; - let names = V.PC.surname ? [V.PC.name, V.PC.surname] : [V.PC.name]; + 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)) names.reverse(); return names.join(" "); @@ -598,7 +598,7 @@ window.PlayerName = function PlayerName() { window.PCTitle = function PCTitle() { const V = State.variables; - let titles = []; + const titles = []; V.PCTitle = PlayerName(); @@ -680,8 +680,8 @@ window.PCTitle = function PCTitle() { titles.push("The Betrayed"); break; case "Exodus": - titles.push("The Abandoned"); - break; + titles.push("The Abandoned"); + break; } } @@ -994,7 +994,7 @@ window.PCTitle = function PCTitle() { titles.push("Caretaker of the Youth"); } - let schoolsPresent = [], schoolsPerfected = [], schoolTitle = ""; + const schoolsPresent = []; const schoolsPerfected = []; let schoolTitle = ""; if (V.TSS.schoolProsperity >= 10) { schoolsPerfected.push("The Slave School"); } else if (V.TSS.schoolPresent === 1) { @@ -1131,9 +1131,12 @@ window.PCTitle = function PCTitle() { }; window.PoliteRudeTitle = /** @param {App.Entity.SlaveState} slave */ function PoliteRudeTitle(slave) { - const V = State.variables, PC = V.PC, s = V.sEnunciate, ss = V.ssEnunciate; + const V = State.variables; + const PC = V.PC; + const s = V.sEnunciate; + const ss = V.ssEnunciate; - var r = ""; + let r = ""; if (slave.nationality === "Japanese") { if (slave.trust > 0) { r += `${PC.name}${PC.title > 0 ? "kun" : "chan"}`; @@ -1159,7 +1162,7 @@ window.SlaveTitle = /** @param {App.Entity.SlaveState} slave */ function SlaveTi let r = ""; 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) { + if (jsRandom(1, 100) > 50) { r = "futanari"; } else { r = "herm"; @@ -1297,26 +1300,26 @@ window.SlaveTitle = /** @param {App.Entity.SlaveState} slave */ function SlaveTi r = "slave"; /* I don't tihnk there is an 'else'? */ if ((slave.dick === 0) && (slave.vagina === -1)) { /* NULLS */ r = "null"; - if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = r + " cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = r + " bimbo "; - } else if (slave.boobs > 6000) { - r = r + " boob"; - } else if (slave.butt > 6) { - r = r + " ass"; - } else if ((slave.muscles > 30) && (slave.height < 185)) { - r = r + " muscle"; - } - if (slave.visualAge > 55) { - r = r + "GILF"; - } else if (slave.visualAge > 35) { - r = r + "MILF"; - } else if (slave.visualAge >= 25) { - r = r + "slave"; - } else { - r = r + "girl"; - } + if ((slave.lactation > 0) && (slave.boobs > 2000)) { + r = r + " cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = r + " bimbo "; + } else if (slave.boobs > 6000) { + r = r + " boob"; + } else if (slave.butt > 6) { + r = r + " ass"; + } else if ((slave.muscles > 30) && (slave.height < 185)) { + r = r + " muscle"; + } + if (slave.visualAge > 55) { + r = r + "GILF"; + } else if (slave.visualAge > 35) { + r = r + "MILF"; + } else if (slave.visualAge >= 25) { + r = r + "slave"; + } else { + r = r + "girl"; + } } if ((slave.dick === 0) && (slave.vagina !== -1)) { /* FEMALES */ @@ -1329,48 +1332,48 @@ window.SlaveTitle = /** @param {App.Entity.SlaveState} slave */ function SlaveTi } else { r = "slavegirl"; } - if ((slave.muscles > 30) && (slave.height < 185)) { - r = "muscle " + r; - } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = r + " cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = r + " bimbo"; - } else if (slave.boobs > 6000) { - r = "boob" + r; - } else if (slave.butt > 6) { - r = "ass" + r; - } + if ((slave.muscles > 30) && (slave.height < 185)) { + r = "muscle " + r; + } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { + r = r + " cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = r + " bimbo"; + } else if (slave.boobs > 6000) { + r = "boob" + r; + } else if (slave.butt > 6) { + r = "ass" + r; + } } if ((slave.dick !== 0) && (slave.vagina !== -1)) { - if (slave.balls > 0) { /* FUTANARI: cock & balls & vagina */ - r = "futanari "; - } else { /* FUTANARI: cock & vagina */ - r = "futa "; - } - if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = r + "cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = r + "bimbo "; - } else if (slave.boobs > 6000) { - r = r + "boob"; - } else if (slave.butt > 6) { - r = r + "ass"; - } else if ((slave.muscles > 30) && (slave.height < 185)) { - r = r + "muscle"; - } - if (slave.visualAge > 55) { - r = r + "GILF"; - } else if (slave.visualAge > 35) { - r = r + "MILF"; - } else if (slave.visualAge >= 25) { - r = r + "slave"; - } else { - r = r + "girl"; - } - if (slave.dick > 5 && slave.balls > 5 && slave.boobs > 5000) { - r = "hyper " + r; - } + if (slave.balls > 0) { /* FUTANARI: cock & balls & vagina */ + r = "futanari "; + } else { /* FUTANARI: cock & vagina */ + r = "futa "; + } + if ((slave.lactation > 0) && (slave.boobs > 2000)) { + r = r + "cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = r + "bimbo "; + } else if (slave.boobs > 6000) { + r = r + "boob"; + } else if (slave.butt > 6) { + r = r + "ass"; + } else if ((slave.muscles > 30) && (slave.height < 185)) { + r = r + "muscle"; + } + if (slave.visualAge > 55) { + r = r + "GILF"; + } else if (slave.visualAge > 35) { + r = r + "MILF"; + } else if (slave.visualAge >= 25) { + r = r + "slave"; + } else { + r = r + "girl"; + } + if (slave.dick > 5 && slave.balls > 5 && slave.boobs > 5000) { + r = "hyper " + r; + } } if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls > 0) && (slave.boobs > 300) && (slave.butt > 2)) { /* SHEMALES: cock & balls, T&A above minimum */ @@ -1383,17 +1386,17 @@ window.SlaveTitle = /** @param {App.Entity.SlaveState} slave */ function SlaveTi } else { r = "tgirl"; } - if ((slave.muscles > 30) && (slave.height < 185)) { - r = "muscle" + r; - } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = r + " cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = r + " bimbo"; - } else if (slave.boobs > 6000) { - r = "topheavy " + r; - } else if (slave.butt > 6) { - r = "bottomheavy " + r; - } + if ((slave.muscles > 30) && (slave.height < 185)) { + r = "muscle" + r; + } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { + r = r + " cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = r + " bimbo"; + } else if (slave.boobs > 6000) { + r = "topheavy " + r; + } else if (slave.butt > 6) { + r = "bottomheavy " + r; + } } if ((slave.boobs < 300) || (slave.butt < 2)) { @@ -1418,11 +1421,11 @@ window.SlaveTitle = /** @param {App.Entity.SlaveState} slave */ function SlaveTi r = "trapgirl"; } } - if (slave.lactation > 0) { - r = r + " cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = r + " bimbo"; - } + if (slave.lactation > 0) { + r = r + " cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = r + " bimbo"; + } } } } @@ -1431,46 +1434,46 @@ window.SlaveTitle = /** @param {App.Entity.SlaveState} slave */ function SlaveTi 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)) { - r = "muscle" + r; - } else if (slave.lactation > 0) { - r = r + "cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = "bimbo " + r; - } - if (slave.visualAge > 55) { - r = "aged " + r; - } else if (slave.visualAge > 35) { - r = "mature " + r; - } else if (slave.visualAge < 25) { - r = "young " + r; - } + if ((slave.muscles > 30) && (slave.height < 185)) { + r = "muscle" + r; + } else if (slave.lactation > 0) { + r = r + "cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = "bimbo " + r; + } + if (slave.visualAge > 55) { + r = "aged " + r; + } else if (slave.visualAge > 35) { + r = "mature " + r; + } else if (slave.visualAge < 25) { + r = "young " + r; + } } } } if ((slave.dick !== 0) && (slave.vagina === -1) && (slave.balls === 0)) { r = "dick"; - if (slave.visualAge > 55) { - r = r + "GILF"; - } else if (slave.visualAge > 35) { - r = r + "MILF"; - } else if (slave.visualAge >= 25) { - r = r + "slave"; - } else { - r = r + "girl"; - } - if ((slave.muscles > 30) && (slave.height < 185)) { - r = "muscle" + r; - } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { - r = r + " cow"; - } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { - r = r + " bimbo"; - } else if (slave.boobs > 6000) { - r = "boob " + r; - } else if (slave.butt > 6) { - r = "ass " + r; - } + if (slave.visualAge > 55) { + r = r + "GILF"; + } else if (slave.visualAge > 35) { + r = r + "MILF"; + } else if (slave.visualAge >= 25) { + r = r + "slave"; + } else { + r = r + "girl"; + } + if ((slave.muscles > 30) && (slave.height < 185)) { + r = "muscle" + r; + } else if ((slave.lactation > 0) && (slave.boobs > 2000)) { + r = r + " cow"; + } else if ((slave.boobsImplant > 0) && (slave.buttImplant > 0)) { + r = r + " bimbo"; + } else if (slave.boobs > 6000) { + r = "boob " + r; + } else if (slave.butt > 6) { + r = "ass " + r; + } } if ((slave.muscles > 30) && (slave.height > 185)) { @@ -1529,8 +1532,8 @@ window.DegradingName = /** @param {App.Entity.SlaveState} slave */ function Degr "be your Head Girl", "guard you", "recruit girls"]; - let names = []; - let suffixes = []; + const names = []; + const suffixes = []; if (slave.fuckdoll > 0) { slave.slaveName = "Fuckdoll No. " + slave.ID; @@ -1900,7 +1903,7 @@ window.DegradingName = /** @param {App.Entity.SlaveState} slave */ function Degr break; } } - let surname = jsEither(suffixes); + const surname = jsEither(suffixes); if (typeof surname === "string" && surname.toLowerCase() === slave.slaveName.toLowerCase()) { DegradingName(slave); } @@ -1912,48 +1915,48 @@ window.SlaveSort = /** @param {App.Entity.SlaveState[]} slaves */ function Slave const V = State.variables; if (main) { switch (V.sortSlavesBy) { - case "name": - 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") - 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") - 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") - 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") - 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") - 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") - slaves = slaves.sort((a, b) => a.devotion - b.devotion); - else - slaves = slaves.sort((a, b) => b.devotion - a.devotion); - break; + case "name": + 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") + 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") + 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") + 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") + 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") + 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") + slaves = slaves.sort((a, b) => a.devotion - b.devotion); + else + slaves = slaves.sort((a, b) => b.devotion - a.devotion); + break; } V.slaveIndices = slaves2indices(); } else { @@ -1967,7 +1970,7 @@ window.slaveSortMinor = /** @param {App.Entity.SlaveState[]} slaves */ function slaves = slaves.sort((a, b) => a.slaveName < b.slaveName ? -1 : 1); }; -window.MenialPopCap = function MenialPopCap () { +window.MenialPopCap = function MenialPopCap() { const V = State.variables; let popCap = 500; let r = ""; @@ -1979,7 +1982,7 @@ window.MenialPopCap = function MenialPopCap () { } let overMenialCap = V.menials + V.fuckdolls + V.menialBioreactors - popCap; if (overMenialCap > 0) { - let price = menialSlaveCost(-overMenialCap); + const price = menialSlaveCost(-overMenialCap); if (V.menials > 0) { if (V.menials > overMenialCap) { cashX((overMenialCap * price), "menialTrades"); @@ -2038,7 +2041,7 @@ window.faceIncrease = /** @param {App.Entity.SlaveState} slave */ function faceI r += `<span class="green">${His} face is now quite beautiful,</span> rather than merely pretty.`; 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); + slave.face = Math.clamp(slave.face + amount, -100, 100); if (slave.face > 95) slave.face = 100; return r; }; diff --git a/src/js/economyJS.js b/src/js/economyJS.js index 7b441043d74772a5d0fd6ffb5c66387956818da4..b8efa6520e9d7fb20d546cff37509d6b79f72bca 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -6,13 +6,13 @@ window.Job = Object.freeze({ JAIL: 'be confined in the cellblock', WARDEN: 'be the Wardeness', CLINIC: 'get treatment in the clinic', NURSE: 'be the Nurse', HGTOY: 'live with your Head Girl', SCHOOL: 'learn in the schoolroom', TEACHER: 'be the Schoolteacher', SPA: 'rest in the spa', ATTEND: 'be the Attendant', NANNY: 'work as a nanny', MATRON: 'be the Matron', FARMYARD: 'work as a farmhand', FARMER: 'be the Farmer', REST: 'rest' - }); +}); window.PersonalAttention = Object.freeze({TRADE: 'trading', WAR: 'warfare', SLAVING: 'slaving', ENGINEERING: 'engineering', MEDICINE: 'medicine', MAID: 'upkeep', HACKING: 'hacking'}); window.predictCost = function(array) { var array2 = array; var totalCosts = ( - getBrothelCosts() + + getBrothelCosts() + getBrothelAdsCosts() + getArcadeCosts() + getClubCosts() + @@ -46,10 +46,10 @@ window.predictCost = function(array) { //in the old order these were applied after multiplication. Not sure if deliberate, but I'm leaving it for now. totalCosts += ( - getSFCosts() + + getSFCosts() + getWeatherCosts() ); -/* + /* // clean up if(totalCosts > 0) { totalCosts = 0; @@ -292,7 +292,7 @@ window.getSecurityExpansionCost = function() { return secExpCost; }; - //general arcology costs +//general arcology costs window.getLifestyleCosts = function() { var costs = 0; @@ -457,19 +457,19 @@ window.getCyberModCosts = function() { window.getPCTrainingCosts = function() { var costs = 0; if(State.variables.PC.actualAge >= State.variables.IsInPrimePC && State.variables.PC.actualAge < State.variables.IsPastPrimePC) { - if(State.variables.personalAttention === PersonalAttention.TRADE) { - costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; - } else if(State.variables.personalAttention === PersonalAttention.WAR) { - costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; - } else if(State.variables.personalAttention === PersonalAttention.SLAVING) { - costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; - } else if(State.variables.personalAttention === PersonalAttention.ENGINEERING) { - costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; - } else if(State.variables.personalAttention === PersonalAttention.MEDICINE) { - costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; - } else if(State.variables.personalAttention === PersonalAttention.HACKING) { - costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; - } + if(State.variables.personalAttention === PersonalAttention.TRADE) { + costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; + } else if(State.variables.personalAttention === PersonalAttention.WAR) { + costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; + } else if(State.variables.personalAttention === PersonalAttention.SLAVING) { + costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; + } else if(State.variables.personalAttention === PersonalAttention.ENGINEERING) { + costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; + } else if(State.variables.personalAttention === PersonalAttention.MEDICINE) { + costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; + } else if(State.variables.personalAttention === PersonalAttention.HACKING) { + costs += 10000*State.variables.AgeEffectOnTrainerPricingPC; + } } return costs; }; @@ -541,43 +541,43 @@ window.getSlaveMinorCosts = function(slave) { var costs = 0; var rulesCost = State.variables.rulesCost; if(slave.assignment === Job.SERVANT || slave.assignment === Job.SERVER) { - if(slave.trust < -20) { - costs -= rulesCost * 4; - } else if(slave.devotion < -20) { - if (slave.trust >= 20) { - costs -= rulesCost / 2; + if(slave.trust < -20) { + costs -= rulesCost * 4; + } else if(slave.devotion < -20) { + if (slave.trust >= 20) { + costs -= rulesCost / 2; + } else { + costs -= rulesCost * 2; + } + } else if(slave.devotion <= 20) { + costs -= rulesCost * 3; + } else if(slave.devotion <= 50) { + costs -= rulesCost * 4; } else { - costs -= rulesCost * 2; + costs -= rulesCost * 5; + } + if(slave.fetish === 'submissive') { + costs -= rulesCost; + } else if(slave.fetish === 'dom') { + costs += rulesCost; + } + if(slave.relationship < -1) { + costs -= rulesCost; + } + if(slave.energy < 20) { + costs -= rulesCost; + } else if(slave.energy < 40) { + costs -= rulesCost / 2; + } + if(slave.lactation > 0) { + costs -= 25; + } + if(slave.assignment === Job.SERVANT) { + costs -= rulesCost; + } + if(setup.servantCareers.includes(slave.career) || slave.skillS >= State.variables.masteredXP) { + costs -= rulesCost; } - } else if(slave.devotion <= 20) { - costs -= rulesCost * 3; - } else if(slave.devotion <= 50) { - costs -= rulesCost * 4; - } else { - costs -= rulesCost * 5; - } - if(slave.fetish === 'submissive') { - costs -= rulesCost; - } else if(slave.fetish === 'dom') { - costs += rulesCost; - } - if(slave.relationship < -1) { - costs -= rulesCost; - } - if(slave.energy < 20) { - costs -= rulesCost; - } else if(slave.energy < 40) { - costs -= rulesCost / 2; - } - if(slave.lactation > 0) { - costs -= 25; - } - if(slave.assignment === Job.SERVANT) { - costs -= rulesCost; - } - if(setup.servantCareers.includes(slave.career) || slave.skillS >= State.variables.masteredXP) { - costs -= rulesCost; - } } return costs; }; @@ -592,80 +592,80 @@ window.getSlaveCost = function(s) { // Living expenses switch(s.assignment) { - case Job.ARCADE: - cost += rulesCost * 0.75; - break; - case Job.DAIRY: - if(State.variables.dairyRestraintsSetting >= 2) { + case Job.ARCADE: cost += rulesCost * 0.75; - } else if(s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.5; - } else if(State.variables.dairyDecoration === 'Degradationist') { - cost += rulesCost * 0.90; - } else { - cost += rulesCost; - } - break; - case Job.BROTHEL: - if(s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.5; - } else { - cost += rulesCost; - } - break; - case Job.SCHOOL: case Job.CLUB: - cost += rulesCost * 1.5; - break; - case Job.CLINIC: - if(s.livingRules === LivingRule.LUXURIOUS) { - cost += rulesCost * 2; - } else if(s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.5; - } else { - cost += rulesCost; - } - break; - case Job.SPA: case Job.NANNY: - if(s.livingRules === LivingRule.LUXURIOUS) { - cost += rulesCost * 1.75; - } else if(s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.5; - } else { - cost += rulesCost; - } - break; - case Job.SERVANT: - if(s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.5; - } else { - if(State.variables.servantsQuartersDecoration === 'Degradationist') { + break; + case Job.DAIRY: + if(State.variables.dairyRestraintsSetting >= 2) { + cost += rulesCost * 0.75; + } else if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 1.5; + } else if(State.variables.dairyDecoration === 'Degradationist') { cost += rulesCost * 0.90; } else { cost += rulesCost; } - } - break; - case Job.JAIL: - if(s.livingRules === LivingRule.NORMAL) { - cost += rulesCost * 1.25; - } else { - cost += rulesCost * 0.90; - } - break; - case Job.MADAM: case Job.DJ: case Job.NURSE: case Job.WARDEN: - case Job.ATTEND: case Job.STEWARD: case Job.MILKMAID: case Job.TEACHER: - case Job.MATRON: - cost += rulesCost * 2; - break; - default: - if(s.livingRules === LivingRule.LUXURIOUS) { - cost += rulesCost * (s.relationship >= 4 ? 3 : 4); - } else if(s.livingRules === LivingRule.NORMAL) { + break; + case Job.BROTHEL: + if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 1.5; + } else { + cost += rulesCost; + } + break; + case Job.SCHOOL: case Job.CLUB: + cost += rulesCost * 1.5; + break; + case Job.CLINIC: + if(s.livingRules === LivingRule.LUXURIOUS) { + cost += rulesCost * 2; + } else if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 1.5; + } else { + cost += rulesCost; + } + break; + case Job.SPA: case Job.NANNY: + if(s.livingRules === LivingRule.LUXURIOUS) { + cost += rulesCost * 1.75; + } else if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 1.5; + } else { + cost += rulesCost; + } + break; + case Job.SERVANT: + if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 1.5; + } else { + if(State.variables.servantsQuartersDecoration === 'Degradationist') { + cost += rulesCost * 0.90; + } else { + cost += rulesCost; + } + } + break; + case Job.JAIL: + if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 1.25; + } else { + cost += rulesCost * 0.90; + } + break; + case Job.MADAM: case Job.DJ: case Job.NURSE: case Job.WARDEN: + case Job.ATTEND: case Job.STEWARD: case Job.MILKMAID: case Job.TEACHER: + case Job.MATRON: cost += rulesCost * 2; - } else { - cost += rulesCost; - } - break; + break; + default: + if(s.livingRules === LivingRule.LUXURIOUS) { + cost += rulesCost * (s.relationship >= 4 ? 3 : 4); + } else if(s.livingRules === LivingRule.NORMAL) { + cost += rulesCost * 2; + } else { + cost += rulesCost; + } + break; } // Food @@ -792,62 +792,62 @@ window.getSlaveCost = function(s) { // Enemas if(s.inflation === 3) { switch(s.inflationType) { - case 'water': - cost += 100; - break; - case 'food': - cost += (foodCost * 4); - break; - case 'curative': case 'aphrodisiac': case 'tightener': - cost += (100 + (drugsCost * 2)); - break; + case 'water': + cost += 100; + break; + case 'food': + cost += (foodCost * 4); + break; + case 'curative': case 'aphrodisiac': case 'tightener': + cost += (100 + (drugsCost * 2)); + break; } } else if(s.inflation === 2) { switch(s.inflationType) { - case 'water': - cost += 50; - break; - case 'food': - cost += (foodCost * 2); - break; - case 'curative': case 'aphrodisiac': case 'tightener': - cost += (50 + (drugsCost * 2)); - break; + case 'water': + cost += 50; + break; + case 'food': + cost += (foodCost * 2); + break; + case 'curative': case 'aphrodisiac': case 'tightener': + cost += (50 + (drugsCost * 2)); + break; } } else if(s.inflation === 1) { switch(s.inflationType) { - case 'water': - cost += 25; - break; - case 'food': - cost += (foodCost); - break; - case 'curative': case 'aphrodisiac': case 'tightener': - cost += (25 + (drugsCost * 2)); - break; + case 'water': + cost += 25; + break; + case 'food': + cost += (foodCost); + break; + case 'curative': case 'aphrodisiac': case 'tightener': + cost += (25 + (drugsCost * 2)); + break; } } // Drugs switch(s.drugs) { - case 'anti-aging cream': - cost += drugsCost * 10; - break; - case 'female hormone injections': case 'male hormone injections': case 'intensive breast injections': - case 'intensive butt injections': case 'intensive penis enhancement': case 'intensive testicle enhancement': - case 'intensive lip injections': case 'hyper breast injections': case 'hyper butt injections': - case 'hyper penis enhancement': case 'hyper testicle enhancement': case 'hyper lip injections': - case 'growth stimulants': - cost += drugsCost * 5; - break; - case 'sag-B-gone': - cost += Math.trunc(drugsCost * 0.1); - break; - case 'no drugs': case 'none': - break; - default: - cost += drugsCost * 2; - break; + case 'anti-aging cream': + cost += drugsCost * 10; + break; + case 'female hormone injections': case 'male hormone injections': case 'intensive breast injections': + case 'intensive butt injections': case 'intensive penis enhancement': case 'intensive testicle enhancement': + case 'intensive lip injections': case 'hyper breast injections': case 'hyper butt injections': + case 'hyper penis enhancement': case 'hyper testicle enhancement': case 'hyper lip injections': + case 'growth stimulants': + cost += drugsCost * 5; + break; + case 'sag-B-gone': + cost += Math.trunc(drugsCost * 0.1); + break; + case 'no drugs': case 'none': + break; + default: + cost += drugsCost * 2; + break; } if(s.curatives > 0 && s.assignmentVisible === 1) { cost += drugsCost * s.curatives; @@ -1126,8 +1126,8 @@ window.cashX = function(cost, what, who) { //record the slave, if available if (typeof who !== 'undefined') { - who.lastWeeksCashIncome += cost; - who.lifetimeCashIncome += cost; + who.lastWeeksCashIncome += cost; + who.lifetimeCashIncome += cost; } } diff --git a/src/uncategorized/sellSlave.tw b/src/uncategorized/sellSlave.tw index 415f3ad2cbe5fdc9fe52f0c22bac3c28f2ce29ad..5d03d42942c17627f9adc37ea2e53734896604d7 100644 --- a/src/uncategorized/sellSlave.tw +++ b/src/uncategorized/sellSlave.tw @@ -3,8 +3,18 @@ <<set $nextButton = "Back", $nextLink = "Slave Interact">> You prepare $him for sale. $His response to being put up for purchase is -<<if $activeSlave.devotion < -50>>muted; perhaps $he hopes a new master will be less hateful than you. -<<elseif $activeSlave.devotion < -20>>muted weeping; for some reason, $he doesn't like being treated like meat on a slab. +<<if $activeSlave.devotion < -50>> + <<if $activeSlave.trust > 20>> + annoyance; $he must have thought $he had a good thing going here despite $his defiance. + <<else>> + muted; perhaps $he hopes a new master will be less hateful than you. + <</if>> +<<elseif $activeSlave.devotion < -20>> + <<if $activeSlave.trust > 20>> + mild panic; $he seems to be concerned about $his future. + <<else>> + muted weeping; for some reason, $he doesn't like being treated like meat on a slab. + <</if>> <<elseif $activeSlave.devotion <= 20>>hesitant; $he can't seem to make up $his mind whether this is going to mean an improvement or not. <<elseif $activeSlave.devotion <= 50>>obedient, if mechanical; $he may want to stay with you. <<elseif $activeSlave.devotion <= 95>>ill-concealed sorrow; $he clearly wants to stay with you very much. @@ -14,8 +24,18 @@ You prepare $him for sale. $His response to being put up for purchase is <<elseif $activeSlave.trust < -20>>$He's probably hoping $he'll be a little less frightened all the time, wherever $he goes. <<elseif $activeSlave.trust < 20>>$He does seem concerned that, hard as you are, $his buyer may be less fair. <<elseif $activeSlave.trust < 50>>$He's worried, probably because $he's learned how to avoid punishment here and will have to learn new rules. -<<elseif $activeSlave.trust < 95>>$He promises $he will do $his best to make you proud by being a good slave to $his new owners. -<<else>>$He tries to conceal $his terror at going from a trustworthy slave master to the cruel and uncertain world outside your penthouse, but $he fails. +<<elseif $activeSlave.trust < 95>> + <<if $activeSlave.devotion < -20>> + $He's worried, probably because $he thinks you won't harm $him while another owner might. + <<else>> + $He promises $he will do $his best to make you proud by being a good slave to $his new owners. + <</if>> +<<else>> + <<if $activeSlave.devotion < -20>> + $He's rather upset at the notion that $he may be going from a weak willed master to someone with the balls to actually try and break $him. + <<else>> + $He tries to conceal $his terror at going from a trustworthy slave master to the cruel and uncertain world outside your penthouse, but $he fails. + <</if>> <</if>> <<slaveCost $activeSlave>>