From 8bb86385ba765e27da3060692838a2ebb2d37bb7 Mon Sep 17 00:00:00 2001 From: klorpa <30924131+klorpa@users.noreply.github.com> Date: Wed, 12 Dec 2018 19:45:06 -0600 Subject: [PATCH] TwineUpdate --- devNotes/twine JS.txt | 58 +++++++++++++++++-- .../nursery/longChildDescription.tw | 12 ++-- src/js/slaveGenerationJS.tw | 2 +- src/uncategorized/longSlaveDescription.tw | 12 ++-- src/uncategorized/remoteSurgery.tw | 2 +- 5 files changed, 66 insertions(+), 20 deletions(-) diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt index f262fa23b97..3fbd0cb3877 100644 --- a/devNotes/twine JS.txt +++ b/devNotes/twine JS.txt @@ -31575,6 +31575,20 @@ window.nationalityToRace = function nationalityToRace(slave) { slave.race = hashChoice(setup.raceSelector[slave.nationality] || setup.raceSelector[""]); }; +window.raceToNationality = function raceToNationality(slave) { + /* consider this placeholder until raceNationalities gets fixed up */ + const V = State.variables; + slave.nationality = hashChoice(V.nationalities); + /* Maximum of 100 attempts */ + for (var i = 0; setup.raceSelector[slave.nationality] && !(slave.race in setup.raceSelector[slave.nationality]) && i < 100; i++) { + slave.nationality = hashChoice(V.nationalities); + } + /* No success after 100 attempts, so just randomize according to race */ + if (setup.raceSelector[slave.nationality] && !(slave.race in setup.raceSelector[slave.nationality]) && i == 100) { + slave.nationality = hashChoice(setup[slave.race.toLowerCase().replace(/[ -]/g, '')+'Nationalities']); + } +}; + window.generateName = function generateName(nationality, race, male, filter) { filter = filter || _.stubTrue; /* default: allow all */ const lookup = (male ? setup.malenamePoolSelector : setup.namePoolSelector); @@ -31777,7 +31791,13 @@ window.nationalityToAccent = function nationalityToAccent(slave) { slave.accent = (V.language === "Spanish") ? jsEither([0, 1, 1, 1, 1, 2]) : naturalAccent; break; case "Bosnian": - slave.accent = naturalAccent; + if (V.language === "Croatian") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else if (V.language === "Serbian") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else { + slave.accent = naturalAccent; + } break; case "Brazilian": slave.accent = (V.language === "Portuguese") ? jsEither([0, 1, 1, 1, 1, 2]) : naturalAccent; @@ -31891,7 +31911,13 @@ window.nationalityToAccent = function nationalityToAccent(slave) { slave.accent = (V.language === "Spanish") ? jsEither([0, 1, 1, 1, 1, 2]) : naturalAccent; break; case "Croatian": - slave.accent = naturalAccent; + if (V.language === "Bosnian") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else if (V.language === "Serbian") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else { + slave.accent = naturalAccent; + } break; case "Cuban": slave.accent = (V.language === "Spanish") ? jsEither([0, 1, 1, 1, 1, 2]) : naturalAccent; @@ -32234,7 +32260,9 @@ window.nationalityToAccent = function nationalityToAccent(slave) { slave.accent = naturalAccent; break; case "Luxembourgian": - if (V.language === "German") { + if (V.language === "Luxembourgish") { + slave.accent = jsEither([0, 0, 0, 0, 0, 0, 1]); + } else if (V.language === "German") { slave.accent = jsEither([0, 1, 1, 1, 1, 2]); } else if (V.language === "French") { slave.accent = jsEither([0, 1, 1, 1, 1, 2]); @@ -32246,10 +32274,22 @@ window.nationalityToAccent = function nationalityToAccent(slave) { slave.accent = naturalAccent; break; case "Malagasy": - slave.accent = naturalAccent; + if (V.language === "French") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else if (V.language === "English") { + slave.accent = jsEither([0, 1, 2, 2, 2, 3, 3]); + } else { + slave.accent = naturalAccent; + } break; case "Malawian": - slave.accent = naturalAccent; + if (V.language === "English") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else if (V.language === "Chichewa") { + slave.accent = jsEither([0, 0, 0, 0, 0, 0, 1]); + } else { + slave.accent = naturalAccent; + } break; case "Malaysian": slave.accent = (V.language === "Malay") ? jsEither([0, 0, 0, 0, 0, 0, 1]) : naturalAccent; @@ -32488,7 +32528,13 @@ window.nationalityToAccent = function nationalityToAccent(slave) { slave.accent = (V.language === "French") ? jsEither([0, 1, 1, 1, 1, 2]) : naturalAccent; break; case "Serbian": - slave.accent = naturalAccent; + if (V.language === "Bosnian") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else if (V.language === "Serbian") { + slave.accent = jsEither([0, 1, 1, 1, 1, 2]); + } else { + slave.accent = naturalAccent; + } break; case "Seychellois": if (V.language === "French") { diff --git a/src/facilities/nursery/longChildDescription.tw b/src/facilities/nursery/longChildDescription.tw index c78360913b5..2e083f4cbbd 100644 --- a/src/facilities/nursery/longChildDescription.tw +++ b/src/facilities/nursery/longChildDescription.tw @@ -105,17 +105,17 @@ is <</if>> <<if $activeSlave.birthName !== "" || $activeSlave.birthSurname !== "">> <<if $activeSlave.devotion > 95>> - $he adores $his slave name and affects to have forgotten that $he was ever called + $He adores $his slave name and affects to have forgotten that $he was ever called <<elseif $activeSlave.devotion > 50>> - $he uses $his slave name automatically and gives no sign that $he was ever called + $He uses $his slave name automatically and gives no sign that $he was ever called <<elseif $activeSlave.devotion > 20>> - $he uses $his slave name despite once being known as + $He uses $his slave name despite once being known as <<elseif $activeSlave.devotion >= -20>> - $he uses $his slave name hesitantly since $he was once called + $He uses $his slave name hesitantly since $he was once called <<elseif $activeSlave.devotion >= -50>> - $he uses $his slave name with resentment since $he prefers $his original name, + $He uses $his slave name with resentment since $he prefers $his original name, <<else>> - $he uses $his slave name only when constantly punished, since $he feels $his real name is + $He uses $his slave name only when constantly punished, since $he feels $his real name is <</if>> <<if $activeSlave.birthName === "">> $activeSlave.birthSurname. diff --git a/src/js/slaveGenerationJS.tw b/src/js/slaveGenerationJS.tw index e33945d90b6..2443056b4c2 100644 --- a/src/js/slaveGenerationJS.tw +++ b/src/js/slaveGenerationJS.tw @@ -14,7 +14,7 @@ window.raceToNationality = function raceToNationality(slave) { } /* No success after 100 attempts, so just randomize according to race */ if (setup.raceSelector[slave.nationality] && !(slave.race in setup.raceSelector[slave.nationality]) && i == 100) { - slave.nationality = Object.keys(setup[slave.race.toLowerCase().replace(/[ -]/g, '')+'Nationalities']).random(); + slave.nationality = hashChoice(setup[slave.race.toLowerCase().replace(/[ -]/g, '')+'Nationalities']); } }; diff --git a/src/uncategorized/longSlaveDescription.tw b/src/uncategorized/longSlaveDescription.tw index 01e8c40d62e..c55eb2c2d72 100644 --- a/src/uncategorized/longSlaveDescription.tw +++ b/src/uncategorized/longSlaveDescription.tw @@ -328,17 +328,17 @@ is <</if>> <<if $activeSlave.birthName !== "" || $activeSlave.birthSurname !== "">> <<if $activeSlave.devotion > 95>> - $he adores $his slave name and affects to have forgotten that $he was ever called + $He adores $his slave name and affects to have forgotten that $he was ever called <<elseif $activeSlave.devotion > 50>> - $he uses $his slave name automatically and gives no sign that $he was ever called + $He uses $his slave name automatically and gives no sign that $he was ever called <<elseif $activeSlave.devotion > 20>> - $he uses $his slave name despite once being known as + $He uses $his slave name despite once being known as <<elseif $activeSlave.devotion >= -20>> - $he uses $his slave name hesitantly since $he was once called + $He uses $his slave name hesitantly since $he was once called <<elseif $activeSlave.devotion >= -50>> - $he uses $his slave name with resentment since $he prefers $his original name, + $He uses $his slave name with resentment since $he prefers $his original name, <<else>> - $he uses $his slave name only when constantly punished, since $he feels $his real name is + $He uses $his slave name only when constantly punished, since $he feels $his real name is <</if>> <<if $activeSlave.birthName === "">> $activeSlave.birthSurname. diff --git a/src/uncategorized/remoteSurgery.tw b/src/uncategorized/remoteSurgery.tw index 6324f4503ce..205335989d7 100644 --- a/src/uncategorized/remoteSurgery.tw +++ b/src/uncategorized/remoteSurgery.tw @@ -1701,7 +1701,7 @@ Work on $him structurally: $He is no longer in $his native body. <</if>> <<if $activeSlave.indenture == -1>> - [[Swap " + $his + " body with another of your stock|Slave Slave Swap Workaround]] + [["Swap " + $his + " body with another of your stock"|Slave Slave Swap Workaround]] <<else>> //Indentured servants must remain in their own bodies.// <</if>> -- GitLab