diff --git a/js/003-data/policiesData.js b/js/003-data/policiesData.js index 899316574736d6af77b8e7193c1193e0e84c18d2..81de8a3fb03a058067990b91764f216836f5fdbc 100644 --- a/js/003-data/policiesData.js +++ b/js/003-data/policiesData.js @@ -658,5 +658,63 @@ App.Data.Policies.Selection = { note: ["school cost"] } ], + ], + RetirementPolicies: [ + [ + { + activatedTitle: "Redefined Mandatory Menial Retirement Age", + get title() { + const el = new DocumentFragment; + let div = document.createElement("div"); + div.style.fontWeight = "normal"; + let span = document.createElement("span"); + span.style.fontWeight = "bold"; + span.textContent = `No Menial Retirement Plan: `; + div.append(span); + div.append(`without defining a retirement age for menial slaves they will remain slaves until death or freed otherwise.`); + el.append(div); + + div = document.createElement("div"); + div.style.fontWeight = "normal"; + span = document.createElement("span"); + span.style.fontWeight = "bold"; + span.textContent = `Redefined Mandatory Menial Retirement Age: `; + div.append(span); + div.append(`you will set your arcology's retirement age for menial slaves at age`); + div.append( + App.UI.DOM.makeElement( + "div", + App.UI.DOM.makeTextBox( + V.customMenialRetirementAge, + v => { + V.customMenialRetirementAge = v; + policy("RetirementPolicies"); + }, + true + ), + "indent" + ) + ); + el.append(div); + + div = document.createElement("div"); + div.style.fontWeight = "normal"; + span = document.createElement("span"); + span.style.fontWeight = "bold"; + span.textContent = `Menial Slave Citizen Retirement: `; + div.append(span); + el.append(div); + return el; + }, + text: `all slaveowners will be required to pay into accounts to support their slaves as lower-class citizens in retirement.`, + get activatedText() { return `you have set your arcology's retirement age for menial slaves at ${V.customMenialRetirementAge}.`; }, + policy: "policies.retirement.menial2Citizen", + requirements: function() { if (V.arcologies[0].FSDegradationist === "unset") { return true; } else { return false; } }, + note: `Will add upkeep to all menial slaves. Without defining a retirement age for menial slaves they will remain slaves until death or freed otherwise`, + onImplementation: function() { if (V.citizenRetirementTrigger === 0) { V.citizenRetirementTrigger = 1; } }, + onRepeal: function() { V.retirementAge = 45; } + } + ], + ] }; diff --git a/src/interaction/policies/policies.js b/src/interaction/policies/policies.js index afc119356507dad177d93d4fd55808e8284bce7d..ad2726e6fe77a93967f39fdb535facfbd548b325 100644 --- a/src/interaction/policies/policies.js +++ b/src/interaction/policies/policies.js @@ -133,12 +133,13 @@ globalThis.policy = function(category) { // title span.style.fontWeight = "bold"; - span.textContent = p.title; + span.append(p.title); div.append(span); div.append(`: `); // Description text - div.append(`${p.text} `); + div.append(p.text); + div.append(` `); // link if (policyValue === 0) { let enable; @@ -150,7 +151,7 @@ globalThis.policy = function(category) { if (p.hasOwnProperty("requirements")) { if (p.requirements()) { implement(p, enable); - } else { + } else if (p.requirements !== "hide") { link = App.UI.DOM.disabledLink("Implement", [`You do not meet the requirments, or passed a conflicting policy already`]); link.style.color = "white"; div.append(link); @@ -176,22 +177,20 @@ globalThis.policy = function(category) { i = policyValue - 1; } const p = selectedPolicy[i]; + const title = p.activatedTitle || p.title; + const text = p.activatedText || p.text; testArray(p); div = document.createElement("div"); span = document.createElement("span"); // title span.style.fontWeight = "bold"; - span.textContent = p.title; + span.append(title); div.append(span); div.append(`: `); // Description text - if (p.hasOwnProperty("activatedText")) { // Some policies have different text if a policy is activated: "you will use" vs "you are using". - div.append(p.activatedText); - } else { - div.append(p.text); - } + div.append(text); div.append(` `); // link @@ -221,6 +220,9 @@ globalThis.policy = function(category) { () => { _.set(V, p.policy, 0); applyCost(); + if (p.hasOwnProperty("onRepeal")) { + p.onRepeal(); + } policy(category); } ); @@ -245,6 +247,9 @@ globalThis.policy = function(category) { () => { _.set(V, p.policy, enable); applyCost(); + if (p.hasOwnProperty("onImplementation")) { + p.onImplementation(); + } policy(category); } ); diff --git a/src/interaction/policies/policies.tw b/src/interaction/policies/policies.tw index df922758a55919a580e8a067f5f0bbffec1e2183..3d37e68ecd437f18dd4b5fb46ecedfb3e2449e2e 100644 --- a/src/interaction/policies/policies.tw +++ b/src/interaction/policies/policies.tw @@ -114,10 +114,7 @@ <div id="Education" class="tabcontent"> <div class="content"> - <span id="EducationPolicies"></span> - <script> - policy("EducationPolicies"); - </script> + <<if $schoolSuggestion == 0>> <p> @@ -130,15 +127,16 @@ <div id="SRP" class="tabcontent"> <div class="content"> - + <span id="RetirementPolicies"></span> + <script> + policy("RetirementPolicies"); + </script> <<if $policies.retirement.menial2Citizen == 1>> ''Mandatory Menial Retirement Age:'' you have set your arcology's retirement age for menial slaves at $customMenialRetirementAge. <span class="yellow">[[Repeal|Policies][$policies.retirement.menial2Citizen = 0, $retirementAge = 45]]</span> <<else>> ''No Menial Retirement Plan:'' without defining a retirement age for menial slaves they will remain slaves until death or freed otherwise. - <</if>> - <<if $policies.retirement.menial2Citizen == 0>> <br>''Redefined Mandatory Menial Retirement Age:'' you will set your arcology's retirement age for menial slaves at age <br> <<textbox "$customMenialRetirementAge" $customMenialRetirementAge "Policies">> <<if $arcologies[0].FSDegradationist == "unset">>