From 7c09d7376efeebbba9d9c31b1a08c373f8194f64 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Mon, 10 Jan 2022 19:30:51 +0300 Subject: [PATCH] Supporters update --- modules/religions-generator.js | 276 +++++---------------------------- 1 file changed, 38 insertions(+), 238 deletions(-) diff --git a/modules/religions-generator.js b/modules/religions-generator.js index a58396bb..b7b3464c 100644 --- a/modules/religions-generator.js +++ b/modules/religions-generator.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; window.Religions = (function () { // name generation approach and relative chance to be selected @@ -63,46 +63,19 @@ window.Religions = (function () { "Ape", "Badger", "Basilisk", -======= - "God", - "Goddess", - "Lord", - "Lady", - "Deity", - "Creator", - "Maker", - "Master", - "Mother", - "Numen", - "Overlord", - "Reaper" - "Ruler", - "Sister", - "Spirit", - "Virgin", - ], - animal: [ - "Antelope", - "Ape", - "Badger", "Bear", "Beaver", "Bison", "Boar", "Buffalo", -<<<<<<< HEAD "Camel", "Cat", "Centaur", "Chimera", -======= - "Cat", ->>>>>>> c6917a14 (religion gen fix) "Cobra", "Crane", "Crocodile", "Crow", -<<<<<<< HEAD "Cyclope", "Deer", "Dog", @@ -110,10 +83,6 @@ window.Religions = (function () { "Eagle", "Elk", "Falcon", - "Deer", - "Dog", - "Eagle", - "Elk", "Fox", "Goat", "Goose", @@ -140,7 +109,6 @@ window.Religions = (function () { "Panther", "Pegasus", "Phoenix", - "Panther", "Rat", "Raven", "Rook", @@ -150,9 +118,6 @@ window.Religions = (function () { "Sheep", "Snake", "Sphinx", - "Shark", - "Sheep", - "Snake", "Spider", "Swan", "Tiger", @@ -330,166 +295,12 @@ window.Religions = (function () { "White", "Yellow" ] -======= - "Camel", - "Falcon", - "Hound", - "Ox", - "Serpent" - ], - adjective: [ - "Aggressive", - "Almighty", - "Ancient", - "Beautiful", - "Benevolent", - "Big", - "Blind", - "Blond", - "Bloody", - "Brave", - "Broken", - "Brutal", - "Burning", - "Calm", - "Cheerful", - "Crazy", - "Cruel", - "Dead", - "Deadly", - "Devastating", - "Distant", - "Disturbing", - "Divine", - "Dying", - "Eternal", - "Evil", - "Explicit", - "Fair", - "Far", - "Fat", - "Fatal", - "Favorable", - "Flying", - "Friendly", - "Frozen", - "Giant", - "Good", - "Grateful", - "Great", - "Happy", - "High", - "Holy", - "Honest", - "Huge", - "Hungry", - "Immutable", - "Infallible" - "Inherent", - "Last", - "Latter", - "Lost", - "Loud", - "Lucky", - "Mad", - "Magical", - "Main", - "Major", - "Marine", - "Naval", - "New", - "Old", - "Patient", - "Peaceful", - "Pregnant", - "Prime", - "Proud", - "Pure", - "Sacred", - "Sad", - "Scary", - "Secret", - "Selected", - "Severe", - "Silent", - "Sleeping", - "Slumbering", - "Strong", - "Sunny", - "Superior", - "Sustainable", - "Troubled", - "Unhappy", - "Unknown", - "Waking", - "Wild", - "Wise", - "Worried", - "Young", - ], - genitive: [ - "Cold", - "Day", - "Death", - "Doom", - "Fate", - "Fire", - "Fog", - "Frost", - "Gates", - "Heaven", - "Home", - "Ice", - "Justice", - "Life", - "Light", - "Lightning", - "Love", - "Nature", - "Night", - "Pain", - "Snow", - "Springs", - "Summer", - "Thunder", - "Time", - "Victory" - "War", - "Winter", - ], - theGenitive: [ - "Abyss", - "Blood", - "Dawn", - "Earth", - "East", - "Eclipse", - "Fall", - "Harvest", - "Moon", - "North", - "Peak", - "Rainbow", - "Sea", - "Sky", - "South", - "Stars", - "Storm", - "Sun", - "Tree", - "Underworld", - "West", - "Wild" - "Word", - "World", - ], - color: ["Dark", "Light", "Bright", "Golden", "White", "Black", "Red", "Pink", "Purple", "Blue", "Green", "Yellow", "Amber", "Orange", "Brown", "Grey"] }; const forms = { - Folk: {Shamanism: 2, Animism: 2, 'Ancestor worship': 1, Polytheism: 2}, - Organized: {Polytheism: 5, Dualism: 1, Monotheism: 4, 'Non-theism': 1}, - Cult: {Cult: 1, 'Dark Cult': 1}, + Folk: {Shamanism: 2, Animism: 2, "Ancestor worship": 1, Polytheism: 2}, + Organized: {Polytheism: 5, Dualism: 1, Monotheism: 4, "Non-theism": 1}, + Cult: {Cult: 1, "Dark Cult": 1}, Heresy: {Heresy: 1} }; @@ -507,12 +318,12 @@ window.Religions = (function () { const types = { Shamanism: {Beliefs: 3, Shamanism: 2, Spirits: 1}, Animism: {Spirits: 1, Beliefs: 1}, - 'Ancestor worship': {Beliefs: 1, Forefathers: 2, Ancestors: 2}, + "Ancestor worship": {Beliefs: 1, Forefathers: 2, Ancestors: 2}, Polytheism: {Deities: 3, Faith: 1, Gods: 1, Pantheon: 1}, Dualism: {Religion: 3, Faith: 1, Cult: 1}, Monotheism: {Religion: 1, Church: 1}, - 'Non-theism': {Beliefs: 3, Spirits: 1}, + "Non-theism": {Beliefs: 3, Spirits: 1}, Cult: {Cult: 4, Sect: 4, Arcanum: 1, Coterie: 1, Order: 1, Worship: 1}, "Dark Cult": {Cult: 2, Sect: 2, Blasphemy: 1, Circle: 1, Coven: 1, Idols: 1, Occultism: 1}, @@ -532,7 +343,7 @@ window.Religions = (function () { }; const generate = function () { - TIME && console.time('generateReligions'); + TIME && console.time("generateReligions"); const cells = pack.cells, states = pack.states, cultures = pack.cultures; @@ -554,8 +365,8 @@ window.Religions = (function () { } const form = rw(forms.Folk); - const name = c.name + ' ' + rw(types[form]); - const deity = form === 'Animism' ? null : getDeityName(c.i); + const name = c.name + " " + rw(types[form]); + const deity = form === "Animism" ? null : getDeityName(c.i); const color = getMixedColor(c.color, 0.1, 0); // `url(#hatch${rand(8,13)})`; religions.push({i: c.i, name, color, culture: c.i, type: "Folk", form, deity, center: c.center, origins: [0]}); }); @@ -587,13 +398,13 @@ window.Religions = (function () { const state = cells.state[center]; const culture = cells.culture[center]; - const deity = form === 'Non-theism' ? null : getDeityName(culture); + const deity = form === "Non-theism" ? null : getDeityName(culture); let [name, expansion] = getReligionName(form, deity, center); - if (expansion === 'state' && !state) expansion = 'global'; - if (expansion === 'culture' && !culture) expansion = 'global'; + if (expansion === "state" && !state) expansion = "global"; + if (expansion === "culture" && !culture) expansion = "global"; - if (expansion === 'state' && Math.random() > 0.5) center = states[state].center; - if (expansion === 'culture' && Math.random() > 0.5) center = cultures[culture].center; + if (expansion === "state" && Math.random() > 0.5) center = states[state].center; + if (expansion === "culture" && Math.random() > 0.5) center = cultures[culture].center; if (!cells.burg[center] && cells.c[center].some(c => cells.burg[c])) center = cells.c[center].find(c => cells.burg[c]); @@ -666,8 +477,8 @@ window.Religions = (function () { // generate heresies religions - .filter((r) => r.type === 'Organized') - .forEach((r) => { + .filter(r => r.type === "Organized") + .forEach(r => { if (r.expansionism < 3) return; const count = gauss(0, 1, 0, 3); for (let i = 0; i < count; i++) { @@ -681,7 +492,7 @@ window.Religions = (function () { if (religionsTree.find(x, y, spacing / 10) !== undefined) continue; // to close to other const culture = cells.culture[center]; - const name = getCultName('Heresy', center); + const name = getCultName("Heresy", center); const expansionism = gauss(1.2, 0.5, 0, 5); const color = getMixedColor(r.color, 0.4, 0.2); // "url(#hatch6)"; religions.push({ @@ -695,11 +506,7 @@ window.Religions = (function () { expansion: "global", expansionism, center, -<<<<<<< HEAD origins: [r.i] -======= - origin: r.i ->>>>>>> c6917a14 (religion gen fix) }); religionsTree.add([x, y]); } @@ -708,7 +515,7 @@ window.Religions = (function () { expandHeresies(); checkCenters(); - TIME && console.timeEnd('generateReligions'); + TIME && console.timeEnd("generateReligions"); }; const add = function (center) { @@ -725,22 +532,19 @@ window.Religions = (function () { type === "Heresy" ? religions[religionId].deity : form === "Non-theism" ? null : getDeityName(culture); let name, expansion; - if (type === 'Organized') [name, expansion] = getReligionName(form, deity, center); + if (type === "Organized") [name, expansion] = getReligionName(form, deity, center); else { name = getCultName(form, center); - expansion = 'global'; + expansion = "global"; } const formName = type === "Heresy" ? religions[religionId].form : form; const code = abbreviate( name, - religions.map((r) => r.code) + religions.map(r => r.code) ); -<<<<<<< HEAD const i = religions.length; -======= ->>>>>>> c6917a14 (religion gen fix) religions.push({ i, name, @@ -756,11 +560,7 @@ window.Religions = (function () { area: 0, rural: 0, urban: 0, -<<<<<<< HEAD origins: [religionId], -======= - origin: r, ->>>>>>> c6917a14 (religion gen fix) code }); cells.religion[center] = i; @@ -774,8 +574,8 @@ window.Religions = (function () { const cost = []; religions - .filter((r) => r.type === 'Organized' || r.type === 'Cult') - .forEach((r) => { + .filter(r => r.type === "Organized" || r.type === "Cult") + .forEach(r => { cells.religion[r.center] = r.i; queue.queue({e: r.center, p: 0, r: r.i, s: cells.state[r.center], c: r.culture}); cost[r.center] = 1; @@ -794,12 +594,12 @@ window.Religions = (function () { const expansion = religions[r].expansion; cells.c[n].forEach(function (e) { - if (expansion === 'culture' && c !== cells.culture[e]) return; - if (expansion === 'state' && s !== cells.state[e]) return; + if (expansion === "culture" && c !== cells.culture[e]) return; + if (expansion === "state" && s !== cells.state[e]) return; const cultureCost = c !== cells.culture[e] ? 10 : 0; const stateCost = s !== cells.state[e] ? 10 : 0; - const biomeCost = biomesData.cost[cells.biome[e]]; + const biomeCost = cells.road[e] ? 1 : biomesData.cost[cells.biome[e]]; const populationCost = Math.max(rn(popCost - cells.pop[e]), 0); const heightCost = Math.max(cells.h[e], 20) - 20; const waterCost = cells.h[e] < 20 ? (cells.road[e] ? 50 : 1000) : 0; @@ -825,8 +625,8 @@ window.Religions = (function () { const cost = []; religions - .filter((r) => r.type === 'Heresy') - .forEach((r) => { + .filter(r => r.type === "Heresy") + .forEach(r => { const b = cells.religion[r.center]; // "base" religion id cells.religion[r.center] = r.i; // heresy id queue.queue({e: r.center, p: 0, r: r.i, b}); @@ -844,7 +644,7 @@ window.Religions = (function () { cells.c[n].forEach(function (e) { const religionCost = cells.religion[e] === b ? 0 : 2000; - const biomeCost = biomesData.cost[cells.biome[e]]; + const biomeCost = cells.road[e] ? 0 : biomesData.cost[cells.biome[e]]; const heightCost = Math.max(cells.h[e], 20) - 20; const waterCost = cells.h[e] < 20 ? (cells.road[e] ? 50 : 1000) : 0; const totalCost = @@ -878,25 +678,25 @@ window.Religions = (function () { } function updateCultures() { - TIME && console.time('updateCulturesForReligions'); + TIME && console.time("updateCulturesForReligions"); pack.religions = pack.religions.map((religion, index) => { if (index === 0) { return religion; } return {...religion, culture: pack.cells.culture[religion.center]}; }); - TIME && console.timeEnd('updateCulturesForReligions'); + TIME && console.timeEnd("updateCulturesForReligions"); } // get supreme deity name const getDeityName = function (culture) { if (culture === undefined) { - ERROR && console.error('Please define a culture'); + ERROR && console.error("Please define a culture"); return; } const meaning = generateMeaning(); - const cultureName = Names.getCulture(culture, null, null, '', 0.8); - return cultureName + ', The ' + meaning; + const cultureName = Names.getCulture(culture, null, null, "", 0.8); + return cultureName + ", The " + meaning; }; function generateMeaning() { @@ -954,14 +754,14 @@ window.Religions = (function () { return rw(types[form]); }; const random = function () { - return trimVowels(Names.getCulture(cells.culture[center], null, null, '', 0).split(/[ ,]+/)[0]); + return trimVowels(Names.getCulture(cells.culture[center], null, null, "", 0).split(/[ ,]+/)[0]); }; const burg = function () { return trimVowels(pack.burgs[cells.burg[center]].name.split(/[ ,]+/)[0]); }; - if (cells.burg[center]) return burg() + 'ian ' + type(); - if (Math.random() > 0.5) return random() + 'ian ' + type(); - return type() + ' of the ' + generateMeaning(); + if (cells.burg[center]) return burg() + "ian " + type(); + if (Math.random() > 0.5) return random() + "ian " + type(); + return type() + " of the " + generateMeaning(); } return {generate, add, getDeityName, expandReligions, updateCultures};