mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.5.13 - Anarchy state form
This commit is contained in:
parent
a5b2f23cee
commit
d25965b618
4 changed files with 82 additions and 72 deletions
|
|
@ -804,9 +804,6 @@
|
|||
|
||||
const generic = {Monarchy:25, Republic:2, Union:1};
|
||||
const naval = {Monarchy:25, Republic:8, Union:3};
|
||||
const genericArray = [], navalArray = []; // turn weighted array into simple array
|
||||
for (const t in generic) {for (let j=0; j < generic[t]; j++) {genericArray.push(t);}}
|
||||
for (const t in naval) {for (let j=0; j < naval[t]; j++) {navalArray.push(t);}}
|
||||
|
||||
const median = d3.median(pack.states.map(s => s.area));
|
||||
const empireMin = states.map(s => s.area).sort((a, b) => b - a)[Math.max(Math.ceil(states.length ** .4) - 2, 0)];
|
||||
|
|
@ -819,21 +816,19 @@
|
|||
const monarchy = ["Duchy", "Grand Duchy", "Principality", "Kingdom", "Empire"]; // per expansionism tier
|
||||
const republic = {Republic:75, Federation:4, Oligarchy:2, Tetrarchy:1, Triumvirate:1, Diarchy:1, "Trade Company":4, Junta:1}; // weighted random
|
||||
const union = {Union:3, League:4, Confederation:1, "United Kingdom":1, "United Republic":1, "United Provinces":2, Commonwealth:1, Heptarchy:1}; // weighted random
|
||||
const theocracy = {Theocracy: 20, Brotherhood:1, Thearchy:2, See:1};
|
||||
const anarchy = {"Free Territory":2, Council:3, Commune:1, Community:1};
|
||||
|
||||
for (const s of states) {
|
||||
if (list && !list.includes(s.i)) continue;
|
||||
|
||||
// some nomadic states
|
||||
if (s.type === "Nomadic" && P(.8)) {
|
||||
s.form = "Horde";
|
||||
s.formName = expTiers[s.i] > 2 ? "United Hordes" : "Horde";
|
||||
s.fullName = getFullName(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
const religion = pack.cells.religion[s.center];
|
||||
const theocracy = religion && pack.religions[religion].expansion === "state" || (P(.1) && pack.religions[religion].type === "Organized");
|
||||
s.form = theocracy ? "Theocracy" : s.type === "Naval" ? ra(navalArray) : ra(genericArray);
|
||||
const isTheocracy = religion && pack.religions[religion].expansion === "state" || (P(.1) && ["Organized", "Cult"].includes(pack.religions[religion].type));
|
||||
const isAnarchy = P(.01 - expTiers[s.i]/500);
|
||||
|
||||
if (isTheocracy) s.form = "Theocracy";
|
||||
else if (isAnarchy) s.form = "Anarchy";
|
||||
else s.form = s.type === "Naval" ? rw(naval) : rw(generic);
|
||||
s.formName = selectForm(s);
|
||||
s.fullName = getFullName(s);
|
||||
}
|
||||
|
|
@ -851,13 +846,13 @@
|
|||
|
||||
if (base === 16 && (form === "Empire" || form === "Kingdom")) return "Sultanate"; // Turkic
|
||||
if (base === 5 && (form === "Empire" || form === "Kingdom")) return "Tsardom"; // Ruthenian
|
||||
if (base === 31 && (form === "Empire" || form === "Kingdom")) return "Khaganate"; // Mongolian
|
||||
if ([16, 31].includes(base) && (form === "Empire" || form === "Kingdom")) return "Khaganate"; // Turkic, Mongolian
|
||||
if (base === 12 && (form === "Kingdom" || form === "Grand Duchy")) return "Shogunate"; // Japanese
|
||||
if ([18, 17].includes(base) && form === "Empire") return "Caliphate"; // Arabic, Berber
|
||||
if (base === 18 && (form === "Grand Duchy" || form === "Duchy")) return "Emirate"; // Arabic
|
||||
if (base === 7 && (form === "Grand Duchy" || form === "Duchy")) return "Despotate"; // Greek
|
||||
if (base === 31 && (form === "Grand Duchy" || form === "Duchy")) return "Ulus"; // Mongolian
|
||||
if (base === 16 && (form === "Grand Duchy" || form === "Duchy")) return "Beylik"; // Turkic
|
||||
if (base === 16 && (form === "Grand Duchy" || form === "Duchy")) return "Horde"; // Turkic
|
||||
if (base === 24 && (form === "Grand Duchy" || form === "Duchy")) return "Satrapy"; // Iranian
|
||||
return form;
|
||||
}
|
||||
|
|
@ -875,28 +870,28 @@
|
|||
}
|
||||
|
||||
if (s.form === "Union") return rw(union);
|
||||
if (s.form === "Anarchy") return rw(anarchy);
|
||||
|
||||
if (s.form === "Theocracy") {
|
||||
// default name is "Theocracy"
|
||||
if (P(.5) && [0, 1, 2, 3, 4, 6, 8, 9, 13, 15, 20].includes(base)) return "Diocese"; // Euporean
|
||||
if (P(.9) && [7, 5].includes(base)) return "Eparchy"; // Greek, Ruthenian
|
||||
if (P(.9) && [21, 16].includes(base)) return "Imamah"; // Nigerian, Turkish
|
||||
if (P(.8) && [18, 17, 28].includes(base)) return "Caliphate"; // Arabic, Berber, Swahili
|
||||
if (P(.02)) return "Thearchy"; // "Thearchy" in very rare case
|
||||
if (P(.05)) return "See"; // "See" in rare case
|
||||
return "Theocracy";
|
||||
return rw(theocracy);
|
||||
}
|
||||
}
|
||||
|
||||
TIME && console.timeEnd("defineStateForms");
|
||||
}
|
||||
|
||||
// state forms requiring Adjective + Name, all other forms use scheme Form + Of + Name
|
||||
const adjForms = ["Empire", "Sultanate", "Khaganate", "Shogunate", "Caliphate", "Despotate", "Theocracy", "Oligarchy", "Union", "Confederation", "Trade Company", "League", "Tetrarchy", "Triumvirate", "Diarchy", "Horde"];
|
||||
|
||||
const getFullName = function(s) {
|
||||
if (!s.formName) return s.name;
|
||||
if (!s.name && s.formName) return "The " + s.formName;
|
||||
// state forms requiring Adjective + Name, all other forms use scheme Form + Of + Name
|
||||
const adj = ["Empire", "Sultanate", "Khaganate", "Shogunate", "Caliphate", "Despotate", "Theocracy", "Oligarchy", "Union", "Confederation", "Trade Company", "League", "Tetrarchy", "Triumvirate", "Diarchy", "Horde"];
|
||||
return adj.includes(s.formName) ? getAdjective(s.name) + " " + s.formName : s.formName + " of " + s.name;
|
||||
const adjName = adjForms.includes(s.formName) && !(/-| /).test(s.name);
|
||||
return adjName ? `${getAdjective(s.name)} ${s.formName}` : `${s.formName} of ${s.name}`;
|
||||
}
|
||||
|
||||
const generateProvinces = function(regenerate) {
|
||||
|
|
@ -916,8 +911,7 @@
|
|||
Republic:{Province:6, Department:2, Governorate:2, District:1, Canton:1, Prefecture:1},
|
||||
Theocracy:{Parish:3, Deanery:1},
|
||||
Union:{Province:1, State:1, Canton:1, Republic:1, County:1, Council:1},
|
||||
Wild:{Territory:10, Land:5, Region:2, Tribe:1, Clan:1, Dependency:1, Area: 1},
|
||||
Horde:{Horde:1}
|
||||
Wild:{Territory:10, Land:5, Region:2, Tribe:1, Clan:1, Dependency:1, Area: 1}
|
||||
}
|
||||
|
||||
// generate provinces for a selected burgs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue