Skip to content
Snippets Groups Projects
Commit a1181a74 authored by Pregmodder's avatar Pregmodder
Browse files

Merge branch 'future-societies' into 'pregmod-master'

Convert FSChangeDecoration to JS

See merge request pregmodfan/fc-pregmod!8435
parents bad9cbdd 6b5b5803
No related branches found
No related tags found
No related merge requests found
...@@ -27,3 +27,124 @@ App.UI.facilityRedecoration = function(variable) { ...@@ -27,3 +27,124 @@ App.UI.facilityRedecoration = function(variable) {
} }
return frag; return frag;
}; };
/**
*
* @param {FC.FutureSociety} FS
* @param {Array} items
* @returns {HTMLElement}
*/
App.UI.FSChangeDecoration = function(FS, items) {
const el = document.createElement("div");
el.classList.add("indent");
const FSDecoration = FS + "Decoration";
let costs;
switch (V.arcologies[0][FSDecoration]) {
case 20:
costs = 2500;
el.append(`${V.arcologies[0].name} is not customized to support this goal. `);
if (V.arcologies[0][FS] >= 10) {
el.append(
App.UI.DOM.link(
`Modify your arcology's internal media to support this goal`,
() => {
V.arcologies[0][FSDecoration] = 40;
cashX(forceNeg(costs), "capEx");
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
el.append(`You must advance this goal before customization to support it becomes available. `);
}
break;
case 40:
el.append(`${V.arcologies[0].name}'s media is supporting this goal. `);
if (V.arcologies[0][FS] >= 30) {
costs = 10000;
el.append(
App.UI.DOM.link(
`Redecorate your arcology's public spaces to support this goal`,
() => {
V.arcologies[0][FSDecoration] = 60;
cashX(forceNeg(costs), "capEx");
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
el.append(`You must advance this goal before further customization to support it becomes available. `);
}
break;
case 60:
el.append(`${V.arcologies[0].name}'s media is supporting this goal, and ${V.arcologies[0].name}'s public spaces are decorated to support it too. `);
if (V.arcologies[0][FS] >= 50) {
costs = 10000;
el.append(
App.UI.DOM.link(
`Station slaves in your arcology's public spaces to promote this goal`,
() => {
V.arcologies[0][FSDecoration] = 80;
cashX(forceNeg(costs), "capEx");
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
el.append(`You must advance this goal before further customization to support it becomes available. `);
}
break;
case 80:
el.append(`${V.arcologies[0].name}'s media is supporting this goal; ${V.arcologies[0].name}'s public spaces are decorated to support it, and have slaves stationed in them to support it too. `);
if (V.arcologies[0][FS] >= 70) {
if (FS === "FSRestart") {
costs = 75000;
el.append(
App.UI.DOM.link(
`Customize the exterior of the arcology to support this goal and fully establish the Societal Elite`,
() => {
V.arcologies[0].FSRestartDecoration = 100;
V.upgradeMultiplierArcology = upgradeMultiplier('engineering');
V.upgradeMultiplierMedicine = upgradeMultiplier('medicine');
for (const item of items) {
_.set(V, item, 1);
}
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
costs = 10000;
el.append(
App.UI.DOM.link(
`Station slaves in your arcology's public spaces to promote this goal`,
() => {
V.arcologies[0][FSDecoration] = 100;
cashX(forceNeg(costs), "capEx");
for (const item of items) {
_.set(V, item, 1);
}
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
}
} else {
el.append(`You must advance this goal before further customization to support it becomes available. `);
}
break;
case 100:
el.append(`${V.arcologies[0].name}'s media is supporting this goal; ${V.arcologies[0].name}'s public spaces are decorated to support it, and have slaves stationed in them to support it. The exterior of the arcology has been remodeled to support it as well; the arcology is fully customized for this goal. `);
}
return el;
};
This diff is collapsed.
...@@ -95,51 +95,3 @@ Allows for dynamic updating of the next button in the storyCaption (left side-ba ...@@ -95,51 +95,3 @@ Allows for dynamic updating of the next button in the storyCaption (left side-ba
<<widget "LoliA">><<if _assistantSlaveLisp>>_LoliALisp<<else>>_LoliA<</if>><</widget>> <<widget "LoliA">><<if _assistantSlaveLisp>>_LoliALisp<<else>>_LoliA<</if>><</widget>>
<<widget "WifeA">><<if _assistantSlaveLisp>>_WifeALisp<<else>>_WifeA<</if>><</widget>> <<widget "WifeA">><<if _assistantSlaveLisp>>_WifeALisp<<else>>_WifeA<</if>><</widget>>
<<widget "WivesA">><<if _assistantSlaveLisp>>_WivesALisp<<else>>_WivesA<</if>><</widget>> <<widget "WivesA">><<if _assistantSlaveLisp>>_WivesALisp<<else>>_WivesA<</if>><</widget>>
/* Called as <<FSChangeDecoration "FSName" "clothesBoughtFSClothes">>, will generate description of current decoration level and a link to increase it if applicable, quotes are needed to pass FSName as reference - DO NOT INCLUDE IT AS PROPERTY OF $arcologies[0]! */
<<widget "FSChangeDecoration">>
<<set _FS = $args[0]>>
<<set _FSDecoration = _FS + "Decoration">>
<<capture _FS, _FSDecoration>>
<<switch $arcologies[0][_FSDecoration]>>
<<case 20>>
$arcologies[0].name is not customized to support this goal.
<<if $arcologies[0][_FS] >= 10>>
[[Modify your arcology's internal media to support this goal|Future Society][$arcologies[0][_FSDecoration] = 40, cashX(-2500, "capEx")]] //Costs <<print cashFormat(2500)>>//
<<else>>
You must advance this goal before customization to support it becomes available.
<</if>>
<<case 40>>
$arcologies[0].name's media is supporting this goal.
<<if $arcologies[0][_FS] >= 30>>
[[Redecorate your arcology's public spaces to support this goal|Future Society][$arcologies[0][_FSDecoration] = 60, cashX(-10000, "capEx")]] //Costs <<print cashFormat(10000)>>//
<<else>>
You must advance this goal before further customization to support it becomes available.
<</if>>
<<case 60>>
$arcologies[0].name's media is supporting this goal, and $arcologies[0].name's public spaces are decorated to support it too.
<<if $arcologies[0][_FS] >= 50>>
[[Station slaves in your arcology's public spaces to promote this goal|Future Society][$arcologies[0][_FSDecoration] = 80, cashX(-10000, "capEx")]] //Costs <<print cashFormat(10000)>>//
<<else>>
You must advance this goal before further customization to support it becomes available.
<</if>>
<<case 80>>
$arcologies[0].name's media is supporting this goal; $arcologies[0].name's public spaces are decorated to support it, and have slaves stationed in them to support it too.
<<if $arcologies[0][_FS] >= 70>>
<<if def $args[3]>> /* Only for FSRepopulation */
[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, State.variables[$args[1]] = 1, State.variables[$args[2]] = 1, State.variables[$args[3]] = 1, cashX(-20000, "capEx")]] //Costs <<print cashFormat(20000)>>//
<<elseif def $args[1]>>
[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, State.variables[$args[1]] = 1, cashX(-20000, "capEx")]] //Costs <<print cashFormat(20000)>>//
<<elseif $args[0] == "FSRestart">>
[[Customize the exterior of the arcology to support this goal and fully establish the Societal Elite|Future Society][$arcologies[0].FSRestartDecoration = 100, $upgradeMultiplierArcology = upgradeMultiplier('engineering'), $upgradeMultiplierMedicine = upgradeMultiplier('medicine'), cashX(-75000, "capEx")]] //Costs <<print cashFormat(75000)>> and may dilute your control over the arcology//
<<else>>
[[Customize the exterior of the arcology to support this goal|Future Society][$arcologies[0][_FSDecoration] = 100, cashX(-20000, "capEx")]] //Costs <<print cashFormat(20000)>>//
<</if>>
<<else>>
You must advance this goal before further customization to support it becomes available.
<</if>>
<<case 100>>
$arcologies[0].name's media is supporting this goal; $arcologies[0].name's public spaces are decorated to support it, and have slaves stationed in them to support it. The exterior of the arcology has been remodeled to support it as well; the arcology is fully customized for this goal.
<</switch>>
<</capture>>
<</widget>>
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