what is locked folk?

This commit is contained in:
Canis Artorus 2023-02-23 12:44:29 -07:00
parent 2ea53d2688
commit 1c3ec99c59
4 changed files with 29 additions and 38 deletions

View file

@ -125,8 +125,7 @@ window.Cultures = (function () {
});
if (cultures.length) {
if (pack.religions?.length > 1) {
if (pack.religions?.length > 2) {
const religions = pack.religions;
const religMap = [];
religions.forEach(r => religMap.push(r.type === "Folk" ? 0 : r.i)); // remove folk religions in general
@ -139,24 +138,11 @@ window.Cultures = (function () {
religions.forEach(r => {
if (r.i === 0) return;
// queue for movement to newId, or removal
// queue for movement to new id, or removal
if (religMap[r.i]) r.i = religMap[r.i];
else if (r.locked) {
// locked folk religion getting a new culture
if (religMap.find(r.i) > 0) { // something already there, shift away from conflict
const nextId = religMap.find(0);
if (nextId > 0) {
religMap[r.i] = nextId;
r.i = nextId;
}
else { // none available...
religMap[r.i] = religMap.length;
r.i = religMap.length;
religMap.push(r.i);
}
}
else {
r.removed = true; // the folk religions that were left behind by unlocked cultures
}
else r.removed = true; // the unlocked folk religions that were left behind by unlocked cultures
// update origin heirarchy to the new ids
r.origins = r.origins.map(i => religMap[i]).filter(i => i);
@ -164,21 +150,19 @@ window.Cultures = (function () {
for (const i of cells.i) {
cells.religion[i] = religMap[cells.religion[i]];
}
}
}
} else {
if (c === def.length) return def;
if (def.every(d => d.odd === 1)) return def.splice(0, c);
if (pack.religions?.length > 2) {
pack.religions.forEach(r => {
if (r.type === "Folk" && !r.lock) r.removed = true;
});
}
}
pack.religions?.forEach(r => {
if (r.type === "Folk" && !r.locked)
cells.religion = cells.religion.map(ri => ri === r.i ? 0 : ri);
});
let culture, rnd;
let i = 0;
do {
for (let culture, rnd, i = 0; cultures.length < c && def.length > 0;) {
do {
rnd = rand(def.length - 1);
culture = def[rnd];
@ -186,7 +170,7 @@ window.Cultures = (function () {
} while (i < 200 && !P(culture.odd));
cultures.push(culture);
def.splice(rnd, 1);
} while (cultures.length < c && def.length > 0);
}
return cultures;
}

View file

@ -234,16 +234,22 @@ function religionsEditorAddLines() {
${r.type === "Folk" ?
`<span data-tip="Potential religion extent" class="hide" style="width: 5em">
culture
</span>`
</span>
<span class="icon-resize-full placeholder hide"></span>
<input class="religionExpan placeholder hide" type="number" />
<span
data-tip="Lock religion, culture changes still take precence"
class="icon-lock${r.lock ? "" : "-open"} hide"
></span>
<span data-tip="Remove religion" class="icon-trash-empty placeholder hide"></span>`
:
`<select data-tip="Potential religion extent" class="religionExtent hide" style="width: 5em">
${getExtentOptions(r.expansion)}
</select>`
}
<span data-tip="Religion expansionism. Defines competitive size" class="icon-resize-full ${r.type === "Folk" ? "placeholder " : ""}hide"></span>
</select>
<span data-tip="Religion expansionism. Defines competitive size" class="icon-resize-full hide"></span>
<input
data-tip="Religion expansionism. Defines competitive size. Click to change, then click Recalculate to apply change"
class="religionExpan ${r.type === "Folk" ? "placeholder " : ""}hide"
class="religionExpan hide"
type="number"
min="0"
max="99"
@ -251,10 +257,11 @@ function religionsEditorAddLines() {
value=${r.expansionism}
/>
<span
data-tip="Lock religion, will regenerate the origin folk and organized religion if they are not also locked"
class="icon-lock${r.lock ? '' : '-open'} hide"
data-tip="Lock this religion"
class="icon-lock${r.lock ? "" : "-open"} hide"
></span>
<span data-tip="Remove religion" class="icon-trash-empty ${r.type === "Folk" ? "placeholder " : ""}hide"></span>
<span data-tip="Remove religion" class="icon-trash-empty hide"></span>`
}
</div>`;
}
$body.innerHTML = lines;

View file

@ -813,7 +813,7 @@ window.Religions = (function () {
for (let i = cultures.length; i < religions.length; i++) {
const faith = religions.find(r => r.i === i);
if (faith) {
if (faith.type === "Folk" && !faith.locked)
if (faith.type === "Folk" && !faith.lock)
tReligions.push({...faith, removed: true});
else tReligions.push(faith);
}

View file

@ -29,7 +29,7 @@ const version = "1.90.00"; // generator version, update each time
<ul>
<strong>Latest changes:</strong>
<li>Religions update by center and expansionism value</li>
<li>Adding a culture manually also adds a folk religion for it</li>
<li>Adding, removing, and regenerating cultures also affect the linked folk religion</li>
<li>Lock states, provinces, cultures, and religions from regeneration</li>
<li>Heightmap brushes: linear edit option</li>
<li>Data Charts screen</li>