mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
fix: cults origins if max is 0
This commit is contained in:
parent
510f3dfe33
commit
9f32bb258c
3 changed files with 16 additions and 11 deletions
|
|
@ -7801,7 +7801,7 @@
|
||||||
<script src="modules/cultures-generator.js?v=06062022"></script>
|
<script src="modules/cultures-generator.js?v=06062022"></script>
|
||||||
<script src="modules/burgs-and-states.js?v=29052022"></script>
|
<script src="modules/burgs-and-states.js?v=29052022"></script>
|
||||||
<script src="modules/routes-generator.js"></script>
|
<script src="modules/routes-generator.js"></script>
|
||||||
<script src="modules/religions-generator.js?v=06062022"></script>
|
<script src="modules/religions-generator.js?v=07062022"></script>
|
||||||
<script src="modules/military-generator.js"></script>
|
<script src="modules/military-generator.js"></script>
|
||||||
<script src="modules/markers-generator.js"></script>
|
<script src="modules/markers-generator.js"></script>
|
||||||
<script src="modules/coa-generator.js"></script>
|
<script src="modules/coa-generator.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -385,6 +385,7 @@ window.Religions = (function () {
|
||||||
const count = +religionsInput.value - cultsCount + religions.length;
|
const count = +religionsInput.value - cultsCount + religions.length;
|
||||||
|
|
||||||
function getReligionsInRadius({x, y, r, max}) {
|
function getReligionsInRadius({x, y, r, max}) {
|
||||||
|
if (max === 0) return [0];
|
||||||
const cellsInRadius = findAll(x, y, r);
|
const cellsInRadius = findAll(x, y, r);
|
||||||
const religions = unique(cellsInRadius.map(i => cells.religion[i]).filter(r => r));
|
const religions = unique(cellsInRadius.map(i => cells.religion[i]).filter(r => r));
|
||||||
return religions.length ? religions.slice(0, max) : [0];
|
return religions.length ? religions.slice(0, max) : [0];
|
||||||
|
|
@ -421,6 +422,7 @@ window.Religions = (function () {
|
||||||
const expansionism = rand(3, 8);
|
const expansionism = rand(3, 8);
|
||||||
const baseColor = religions[culture]?.color || states[state]?.color || getRandomColor();
|
const baseColor = religions[culture]?.color || states[state]?.color || getRandomColor();
|
||||||
const color = getMixedColor(baseColor, 0.3, 0);
|
const color = getMixedColor(baseColor, 0.3, 0);
|
||||||
|
|
||||||
religions.push({
|
religions.push({
|
||||||
i: religions.length,
|
i: religions.length,
|
||||||
name,
|
name,
|
||||||
|
|
@ -517,17 +519,17 @@ window.Religions = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
const add = function (center) {
|
const add = function (center) {
|
||||||
const cells = pack.cells,
|
const {cells, religions} = pack;
|
||||||
religions = pack.religions;
|
const religionId = cells.religion[center];
|
||||||
const r = cells.religion[center];
|
|
||||||
const i = religions.length;
|
|
||||||
const culture = cells.culture[center];
|
const culture = cells.culture[center];
|
||||||
const color = getMixedColor(religions[r].color, 0.3, 0);
|
const color = getMixedColor(religions[religionId].color, 0.3, 0);
|
||||||
|
|
||||||
const type =
|
const type =
|
||||||
religions[r].type === "Organized" ? rw({Organized: 4, Cult: 1, Heresy: 2}) : rw({Organized: 5, Cult: 2});
|
religions[religionId].type === "Organized" ? rw({Organized: 4, Cult: 1, Heresy: 2}) : rw({Organized: 5, Cult: 2});
|
||||||
const form = rw(forms[type]);
|
const form = rw(forms[type]);
|
||||||
const deity = type === "Heresy" ? religions[r].deity : form === "Non-theism" ? null : getDeityName(culture);
|
const deity =
|
||||||
|
type === "Heresy" ? religions[religionId].deity : form === "Non-theism" ? null : getDeityName(culture);
|
||||||
|
|
||||||
let name, expansion;
|
let name, expansion;
|
||||||
if (type === "Organized") [name, expansion] = getReligionName(form, deity, center);
|
if (type === "Organized") [name, expansion] = getReligionName(form, deity, center);
|
||||||
|
|
@ -535,11 +537,14 @@ window.Religions = (function () {
|
||||||
name = getCultName(form, center);
|
name = getCultName(form, center);
|
||||||
expansion = "global";
|
expansion = "global";
|
||||||
}
|
}
|
||||||
const formName = type === "Heresy" ? religions[r].form : form;
|
|
||||||
|
const formName = type === "Heresy" ? religions[religionId].form : form;
|
||||||
const code = abbreviate(
|
const code = abbreviate(
|
||||||
name,
|
name,
|
||||||
religions.map(r => r.code)
|
religions.map(r => r.code)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const i = religions.length;
|
||||||
religions.push({
|
religions.push({
|
||||||
i,
|
i,
|
||||||
name,
|
name,
|
||||||
|
|
@ -555,7 +560,7 @@ window.Religions = (function () {
|
||||||
area: 0,
|
area: 0,
|
||||||
rural: 0,
|
rural: 0,
|
||||||
urban: 0,
|
urban: 0,
|
||||||
origins: [r],
|
origins: [religionId],
|
||||||
code
|
code
|
||||||
});
|
});
|
||||||
cells.religion[center] = i;
|
cells.religion[center] = i;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
// version and caching control
|
// version and caching control
|
||||||
|
|
||||||
const version = "1.86.01"; // generator version, update each time
|
const version = "1.86.02"; // generator version, update each time
|
||||||
|
|
||||||
{
|
{
|
||||||
document.title += " v" + version;
|
document.title += " v" + version;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue