mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
generate state salesTax
This commit is contained in:
parent
838ef27359
commit
2e66fd444a
2 changed files with 5 additions and 3 deletions
|
|
@ -74,6 +74,7 @@ window.BurgsAndStates = (function () {
|
||||||
const states = [{i: 0, name: "Neutrals"}];
|
const states = [{i: 0, name: "Neutrals"}];
|
||||||
const colors = getColors(burgs.length - 1);
|
const colors = getColors(burgs.length - 1);
|
||||||
const each5th = each(5);
|
const each5th = each(5);
|
||||||
|
const maxExpansionism = +powerInput.value;
|
||||||
|
|
||||||
burgs.forEach(function (b, i) {
|
burgs.forEach(function (b, i) {
|
||||||
if (!i) return; // skip first element
|
if (!i) return; // skip first element
|
||||||
|
|
@ -86,10 +87,11 @@ window.BurgsAndStates = (function () {
|
||||||
b.capital = 1;
|
b.capital = 1;
|
||||||
|
|
||||||
// states data
|
// states data
|
||||||
const expansionism = rn(Math.random() * powerInput.value + 1, 1);
|
const expansionism = rn(Math.random() * maxExpansionism + 1, 1);
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -183,13 +183,13 @@ function editBurg(id) {
|
||||||
function getExport(dealsArray) {
|
function getExport(dealsArray) {
|
||||||
if (!dealsArray.length) return 'no';
|
if (!dealsArray.length) return 'no';
|
||||||
|
|
||||||
const totalIncome = d3.sum(dealsArray.map((deal) => deal.burgIncome));
|
const totalIncome = rn(d3.sum(dealsArray.map((deal) => deal.burgIncome)));
|
||||||
const exported = dealsArray.map((deal) => {
|
const exported = dealsArray.map((deal) => {
|
||||||
const {resourceId, quantity, burgIncome} = deal;
|
const {resourceId, quantity, burgIncome} = deal;
|
||||||
const {name, unit, icon} = Resources.get(resourceId);
|
const {name, unit, icon} = Resources.get(resourceId);
|
||||||
const unitName = quantity > 1 ? unit + 's' : unit;
|
const unitName = quantity > 1 ? unit + 's' : unit;
|
||||||
|
|
||||||
return `<span data-tip="${name}: ${quantity} ${unitName}. Income: ${burgIncome}">
|
return `<span data-tip="${name}: ${quantity} ${unitName}. Income: ${rn(burgIncome)}">
|
||||||
<svg class="resIcon"><use href="#${icon}"></svg>
|
<svg class="resIcon"><use href="#${icon}"></svg>
|
||||||
<span style="margin: 0 0.2em 0 -0.2em">${quantity}</span>
|
<span style="margin: 0 0.2em 0 -0.2em">${quantity}</span>
|
||||||
</span>`;
|
</span>`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue