diff --git a/modules/dynamic/editors/religions-editor.js b/modules/dynamic/editors/religions-editor.js
index 3f1d09ce..917db90f 100644
--- a/modules/dynamic/editors/religions-editor.js
+++ b/modules/dynamic/editors/religions-editor.js
@@ -23,13 +23,15 @@ export function open() {
function insertEditorHtml() {
const editorHtml = /* html */ `
-
+
+
+
+
+
`;
@@ -109,6 +116,7 @@ function addListeners() {
byId("religionsManuallyCancel").on("click", () => exitReligionsManualAssignment());
byId("religionsAdd").on("click", enterAddReligionMode);
byId("religionsExport").on("click", downloadReligionsCsv);
+ byId("religionsRecalculate").on("click", () => recalculateReligions(true));
}
function refreshReligionsEditor() {
@@ -166,6 +174,7 @@ function religionsEditorAddLines() {
data-type=""
data-form=""
data-deity=""
+ data-expansion=""
data-expansionism=""
>
@@ -181,6 +190,11 @@ function religionsEditorAddLines() {
${si(area) + unit}
${si(population)}
+
+
+
`;
continue;
}
@@ -195,6 +209,7 @@ function religionsEditorAddLines() {
data-type="${r.type}"
data-form="${r.form}"
data-deity="${r.deity || ""}"
+ data-expansion="${r.expansion}"
data-expansionism="${r.expansionism}"
>
@@ -212,6 +227,19 @@ function religionsEditorAddLines() {
${si(area) + unit}
${si(population)}
+
+
+
input.religionDeity").forEach(el => el.on("input", religionChangeDeity));
$body.querySelectorAll("div > span.icon-arrows-cw").forEach(el => el.on("click", regenerateDeity));
$body.querySelectorAll("div > div.religionPopulation").forEach(el => el.on("click", changePopulation));
+ $body.querySelectorAll("div > select.religionLimit").forEach(el => el.on("change", religionChangeLimit));
+ $body.querySelectorAll("div > input.religionExpan").forEach(el => el.on("change", religionChangeExpansionism));
$body.querySelectorAll("div > span.icon-trash-empty").forEach(el => el.on("click", religionRemovePrompt));
$body.querySelectorAll("div > span.icon-lock").forEach($el => $el.on("click", updateLockStatus));
$body.querySelectorAll("div > span.icon-lock-open").forEach($el => $el.on("click", updateLockStatus));
@@ -264,6 +294,13 @@ function getTypeOptions(type) {
return options;
}
+function getLimitOptions(type) {
+ let options = "";
+ const types = ["global", "state", "culture"];
+ types.forEach(t => (options += ``));
+ return options;
+}
+
const religionHighlightOn = debounce(event => {
const religionId = Number(event.id || event.target.dataset.id);
const $el = $body.querySelector(`div[data-id='${religionId}']`);
@@ -434,6 +471,20 @@ function changePopulation() {
}
}
+function religionChangeLimit() {
+ const religion = +this.parentNode.dataset.id;
+ this.parentNode.dataset.expansion = this.value;
+ pack.religions[religion].expansion = this.value;
+ recalculateReligions();
+}
+
+function religionChangeExpansionism() {
+ const religion = +this.parentNode.dataset.id;
+ this.parentNode.dataset.expansionism = this.value;
+ pack.religions[religion].expansionism = +this.value;
+ recalculateReligions();
+}
+
function religionRemovePrompt() {
if (customization) return;
@@ -507,6 +558,7 @@ function religionCenterDrag() {
const cell = findCell(x, y);
if (pack.cells.h[cell] < 20) return; // ignore dragging on water
pack.religions[religionId].center = cell;
+ recalculateReligions();
});
}
@@ -740,15 +792,15 @@ function addReligion() {
function downloadReligionsCsv() {
const unit = getAreaUnit("2");
- const headers = `Id,Name,Color,Type,Form,Supreme Deity,Area ${unit},Believers,Origins`;
+ const headers = `Id,Name,Color,Type,Form,Supreme Deity,Area ${unit},Believers,Origins,Limit,Expansionism`;
const lines = Array.from($body.querySelectorAll(":scope > div"));
const data = lines.map($line => {
- const {id, name, color, type, form, deity, area, population} = $line.dataset;
+ const {id, name, color, type, form, deity, area, population, expansion, expansionism} = $line.dataset;
const deityText = '"' + deity + '"';
const {origins} = pack.religions[+id];
const originList = (origins || []).filter(origin => origin).map(origin => pack.religions[origin].name);
const originText = '"' + originList.join(", ") + '"';
- return [id, name, color, type, form, deityText, area, population, originText].join(",");
+ return [id, name, color, type, form, deityText, area, population, originText, expansion, expansionism].join(",");
});
const csvData = [headers].concat(data).join("\n");
diff --git a/modules/religions-generator.js b/modules/religions-generator.js
index cc8d55bb..38e57546 100644
--- a/modules/religions-generator.js
+++ b/modules/religions-generator.js
@@ -808,8 +808,16 @@ window.Religions = (function () {
const resetUnlockedReligions = function() {
const religion = pack.cells.religion;
const culture = pack.cells.culture;
+ // ignore cultures added since last folk generation. Known Issue
+ let knownFolk = 1;
+ for(const j = 1; j++; j