mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
salesTax to depend on state form
This commit is contained in:
parent
c92862b316
commit
00f48dbcdb
3 changed files with 33 additions and 9 deletions
7
main.js
7
main.js
|
|
@ -652,6 +652,10 @@ function generate() {
|
||||||
|
|
||||||
BurgsAndStates.generate();
|
BurgsAndStates.generate();
|
||||||
|
|
||||||
|
Religions.generate();
|
||||||
|
BurgsAndStates.defineStateForms();
|
||||||
|
BurgsAndStates.defineTaxes();
|
||||||
|
|
||||||
Production.collectResources();
|
Production.collectResources();
|
||||||
|
|
||||||
Trade.defineCenters();
|
Trade.defineCenters();
|
||||||
|
|
@ -662,9 +666,6 @@ function generate() {
|
||||||
pack.cells.road = new Uint16Array(pack.cells.i.length);
|
pack.cells.road = new Uint16Array(pack.cells.i.length);
|
||||||
pack.cells.crossroad = new Uint16Array(pack.cells.i.length);
|
pack.cells.crossroad = new Uint16Array(pack.cells.i.length);
|
||||||
|
|
||||||
Religions.generate();
|
|
||||||
BurgsAndStates.defineStateForms();
|
|
||||||
|
|
||||||
BurgsAndStates.generateProvinces();
|
BurgsAndStates.generateProvinces();
|
||||||
BurgsAndStates.defineBurgFeatures();
|
BurgsAndStates.defineBurgFeatures();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,10 @@ window.BurgsAndStates = (function () {
|
||||||
const basename = b.name.length < 9 && each5th(b.cell) ? b.name : Names.getCultureShort(b.culture);
|
const basename = b.name.length < 9 && each5th(b.cell) ? b.name : Names.getCultureShort(b.culture);
|
||||||
const name = Names.getState(basename, b.culture);
|
const name = Names.getState(basename, b.culture);
|
||||||
const type = cultures[b.culture].type;
|
const type = cultures[b.culture].type;
|
||||||
const salesTax = rn(Math.random() * 0.3, 2);
|
|
||||||
|
|
||||||
const coa = COA.generate(null, null, null, type);
|
const coa = COA.generate(null, null, null, type);
|
||||||
coa.shield = COA.getShield(b.culture, null);
|
coa.shield = COA.getShield(b.culture, null);
|
||||||
states.push({i, color: colors[i - 1], name, expansionism, capital: i, type, center: b.cell, culture: b.culture, coa, salesTax});
|
states.push({i, color: colors[i - 1], name, expansionism, capital: i, type, center: b.cell, culture: b.culture, coa});
|
||||||
cells.burg[b.cell] = i;
|
cells.burg[b.cell] = i;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1051,6 +1050,29 @@ window.BurgsAndStates = (function () {
|
||||||
return adjName ? `${getAdjective(s.name)} ${s.formName}` : `${s.formName} of ${s.name}`;
|
return adjName ? `${getAdjective(s.name)} ${s.formName}` : `${s.formName} of ${s.name}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const defineTaxes = function () {
|
||||||
|
const {states} = pack;
|
||||||
|
const maxTaxPerForm = {
|
||||||
|
Monarchy: 0.3,
|
||||||
|
Republic: 0.1,
|
||||||
|
Union: 0.2,
|
||||||
|
Theocracy: 0.3,
|
||||||
|
Anarchy: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const state of states) {
|
||||||
|
const {i, removed, form} = state;
|
||||||
|
if (removed) continue;
|
||||||
|
if (!i) {
|
||||||
|
state.salesTax = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const maxTax = maxTaxPerForm[form] || 0;
|
||||||
|
state.salesTax = maxTax ? rn(Math.random() * maxTax, 2) : 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const generateProvinces = function (regenerate) {
|
const generateProvinces = function (regenerate) {
|
||||||
TIME && console.time('generateProvinces');
|
TIME && console.time('generateProvinces');
|
||||||
const localSeed = regenerate ? Math.floor(Math.random() * 1e9).toString() : seed;
|
const localSeed = regenerate ? Math.floor(Math.random() * 1e9).toString() : seed;
|
||||||
|
|
@ -1255,6 +1277,7 @@ window.BurgsAndStates = (function () {
|
||||||
generateDiplomacy,
|
generateDiplomacy,
|
||||||
defineStateForms,
|
defineStateForms,
|
||||||
getFullName,
|
getFullName,
|
||||||
|
defineTaxes,
|
||||||
generateProvinces,
|
generateProvinces,
|
||||||
updateCultures
|
updateCultures
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -491,10 +491,10 @@ window.Religions = (function () {
|
||||||
|
|
||||||
const cultureCost = c !== cells.culture[e] ? 10 : 0;
|
const cultureCost = c !== cells.culture[e] ? 10 : 0;
|
||||||
const stateCost = s !== cells.state[e] ? 10 : 0;
|
const stateCost = s !== cells.state[e] ? 10 : 0;
|
||||||
const biomeCost = cells.road[e] ? 1 : biomesData.cost[cells.biome[e]];
|
const biomeCost = biomesData.cost[cells.biome[e]];
|
||||||
const populationCost = Math.max(rn(popCost - cells.pop[e]), 0);
|
const populationCost = Math.max(rn(popCost - cells.pop[e]), 0);
|
||||||
const heightCost = Math.max(cells.h[e], 20) - 20;
|
const heightCost = Math.max(cells.h[e], 20) - 20;
|
||||||
const waterCost = cells.h[e] < 20 ? (cells.road[e] ? 50 : 1000) : 0;
|
const waterCost = cells.h[e] < 20 ? 500 : 0;
|
||||||
const totalCost = p + (cultureCost + stateCost + biomeCost + populationCost + heightCost + waterCost) / religions[r].expansionism;
|
const totalCost = p + (cultureCost + stateCost + biomeCost + populationCost + heightCost + waterCost) / religions[r].expansionism;
|
||||||
if (totalCost > neutral) return;
|
if (totalCost > neutral) return;
|
||||||
|
|
||||||
|
|
@ -534,9 +534,9 @@ window.Religions = (function () {
|
||||||
|
|
||||||
cells.c[n].forEach(function (e) {
|
cells.c[n].forEach(function (e) {
|
||||||
const religionCost = cells.religion[e] === b ? 0 : 2000;
|
const religionCost = cells.religion[e] === b ? 0 : 2000;
|
||||||
const biomeCost = cells.road[e] ? 0 : biomesData.cost[cells.biome[e]];
|
const biomeCost = biomesData.cost[cells.biome[e]];
|
||||||
const heightCost = Math.max(cells.h[e], 20) - 20;
|
const heightCost = Math.max(cells.h[e], 20) - 20;
|
||||||
const waterCost = cells.h[e] < 20 ? (cells.road[e] ? 50 : 1000) : 0;
|
const waterCost = cells.h[e] < 20 ? 500 : 0;
|
||||||
const totalCost = p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(religions[r].expansionism, 0.1);
|
const totalCost = p + (religionCost + biomeCost + heightCost + waterCost) / Math.max(religions[r].expansionism, 0.1);
|
||||||
|
|
||||||
if (totalCost > neutral) return;
|
if (totalCost > neutral) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue