Skip to content
Snippets Groups Projects
Commit 58447b76 authored by Blank_Alt's avatar Blank_Alt Committed by Pregmodder
Browse files

changeLanguageJS

parent ab772291
No related branches found
No related tags found
No related merge requests found
......@@ -26,3 +26,11 @@ new App.DomPassage("retire",
return retireScene(getSlave(V.AS));
}
);
new App.DomPassage("Change Language",
() => {
V.nextButton = "Confirm changes";
V.nextLink = "Main"
return App.Arcology.changeLanguage();
}, ["jump-from-safe"]
);
App.Arcology.changeLanguage = function() {
let el = document.createElement("div");
let revivalist = {language: ""};
let r = [];
const options = new App.UI.OptionsGroup();
const languageList = new Set(["English", "Spanish", "Arabic", "Chinese", "Japanese", V.seed]);
if (["North America", "Western Europe", "Australia"].includes(V.continent)) {
languageList.add("English");
} else if (V.continent === "South America") {
languageList.add("Spanish");
} else if (V.continent === "Brazil") {
languageList.add("Portuguese");
} else if (V.continent === "Central Europe") {
languageList.add("German");
} else if (V.continent === "Eastern Europe") {
languageList.add("Russian");
} else if (V.continent === "Southern Europe") {
languageList.add("Italian");
} else if (V.continent === "Scandinavia") {
languageList.add("Norwegian");
} else if (V.continent === "the Middle East" || V.continent === "Africa") {
languageList.add("Arabic");
} else if (V.continent === "Asia") {
languageList.add("Chinese");
} else if (V.continent === "Japan") {
languageList.add("Japanese");
}
if (V.arcologies[0].FSRomanRevivalist !== "unset") {
revivalist = {language: "Latin", name: "Roman"};
} else if (V.arcologies[0].FSAztecRevivalist !== "unset") {
revivalist = {language: "Nahuatl", name: "Aztec"};
} else if (V.arcologies[0].FSEgyptianRevivalist !== "unset") {
revivalist = {language: "Ancient Egyptian", name: "Egyptian"};
} else if (V.arcologies[0].FSEdoRevivalist !== "unset") {
revivalist = {language: "Japanese", name: "Edo"};
} else if (V.arcologies[0].FSArabianRevivalist !== "unset") {
revivalist = {language: "Arabic", name: "Arabian"};
} else if (V.arcologies[0].FSChineseRevivalist !== "unset") {
revivalist = {language: "Chinese", name: "Chinese"};
}
if (revivalist.language !== "") {
languageList.add(revivalist.language);
}
r.push(`The lingua franca of the arcology is <span class='bold'>${V.language}</span>.`);
App.Events.addParagraph(el, r);
r = [];
r.push(`Changing the lingua franca of the arcology is a difficult process.`);
r.push(`Doing so will slightly reduce the arcology's prosperity due to the difficulty changing languages will impose on businesses.`);
r.push(`It will also cost ${cashFormat(500)} for each mentally competent slave you own, since it will be necessary to build time into their schedules for them to learn basic commands in the new language.`);
r.push(`Slaves' starting fluency in the new language will depend on their intelligence, nationality, education, and in some cases, ethnicity.`);
r.push(`Previous linguistic experience will not be saved, meaning that repeated language changes will wipe out slaves' previous language skills.`);
App.Events.addParagraph(el, r);
options.addOption("Select a custom language to be applied: ", "seed").showTextBox().addComment("A single capitalized word is recommended.");
el.append(options.render());
for (const targetLanguage of languageList) {
App.UI.DOM.appendNewElement("div", el, App.UI.DOM.link(targetLanguage, () => {
V.language = targetLanguage;
V.arcologies[0].prosperity = Math.trunc(0.9 * V.arcologies[0].prosperity);
for (const slave of V.slaves) {
if (slave.fetish !== "mindbroken") {
nationalityToAccent(slave);
if (slave.accent >= 3) {
if ((slave.intelligence + slave.intelligenceImplant + 100) > random(0, 100)) {
slave.accent--;
}
}
cashX(-500, "capEx");
}
}
},
[], passage(),
`${revivalist.language !== "" && V.language !== revivalist.language && targetLanguage === revivalist.language ? ` Failing to take this step will retard adoption of ${revivalist.name} Revivalism.` : ""}`
));
}
return el;
};
:: Change Language [nobr jump-from-safe]
<<set $nextButton = "Confirm changes">>
<<set $nextLink = "Main">>
<<set _revivalistLanguage = 0>>
<<if $arcologies[0].FSRomanRevivalist != "unset">>
<<set _revivalistLanguage = "Latin">>
<<elseif $arcologies[0].FSAztecRevivalist != "unset">>
<<set _revivalistLanguage = "Nahuatl">>
<<elseif $arcologies[0].FSEgyptianRevivalist != "unset">>
<<set _revivalistLanguage = "Ancient Egyptian">>
<<elseif $arcologies[0].FSEdoRevivalist != "unset">>
<<set _revivalistLanguage = "Japanese">>
<<elseif $arcologies[0].FSArabianRevivalist != "unset">>
<<set _revivalistLanguage = "Arabic">>
<<elseif $arcologies[0].FSChineseRevivalist != "unset">>
<<set _revivalistLanguage = "Chinese">>
<</if>>
The lingua franca of the arcology is ''$language''.
<br><br>
//Changing the lingua franca of the arcology is a difficult process. Doing so will slightly reduce the arcology's prosperity due to the difficulty changing languages will impose on businesses. It will also cost <<print cashFormat(500)>> for each mentally competent slave you own, since it will be necessary to build time into their schedules for them to learn basic commands in the new language. Slaves' starting fluency in the new language will depend on their intelligence, nationality, education, and in some cases, ethnicity. Previous linguistic experience will not be saved, meaning that repeated language changes will wipe out slaves' previous language skills.//
<br><br>
Select a custom language to be applied: <<textbox "$seed" $seed "Change Language">> //A single capitalized word is recommended.//
<br><br>
<span id="result">
<<if $language != "English">>
<br><<link "English">>
<<replace "#result">>
<<set $language = "English">>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>>
<</if>>
<<if $language != "Spanish">>
<br><<link "Spanish">>
<<replace "#result">>
<<set $language = "Spanish">>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>>
<</if>>
<<if $language != "Portuguese">>
<br><<link "Portuguese">>
<<replace "#result">>
<<set $language = "Portuguese">>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>>
<</if>>
<<if $language != "Arabic">>
<br><<link "Arabic">>
<<replace "#result">>
<<set $language = "Arabic">>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>>
<</if>>
<<if $language != "Chinese">>
<br><<link "Chinese">>
<<replace "#result">>
<<set $language = "Chinese">>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>>
<</if>>
<<if $language != $seed>>
<br><<link "Apply custom language">>
<<replace "#result">>
<<set $language = $seed>>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>>
<</if>>
<<if _revivalistLanguage != 0 && $language != _revivalistLanguage>>
<br><<link "Match language to Revivalist future society">>
<<replace "#result">>
<<set $language = _revivalistLanguage>>
<<set $arcologies[0].prosperity = Math.trunc(0.9*$arcologies[0].prosperity)>>
<<for _cl = 0; _cl < $slaves.length; _cl++>>
<<if $slaves[_cl].fetish != "mindbroken">>
<<run nationalityToAccent($slaves[_cl])>>
<<if ($slaves[_cl].accent >= 3)>>
<<if ($slaves[_cl].intelligence+$slaves[_cl].intelligenceImplant+100) > random(0,100)>>
<<set $slaves[_cl].accent -= 1>>
<</if>>
<</if>>
<<run cashX(-500, "capEx")>>
<</if>>
<</for>>
<br><br>//Language changed to $language.//
<</replace>>
<</link>> //Failing to take this step will retard adoption of Revivalism//
<</if>>
</span>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment