From 2e66fd444a9dbdf3a1687df6610be14066505910 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Wed, 11 Aug 2021 22:08:08 +0300 Subject: [PATCH] generate state salesTax --- modules/burgs-and-states.js | 4 +++- modules/ui/burg-editor.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js index b138e918..473c3119 100644 --- a/modules/burgs-and-states.js +++ b/modules/burgs-and-states.js @@ -74,6 +74,7 @@ window.BurgsAndStates = (function () { const states = [{i: 0, name: "Neutrals"}]; const colors = getColors(burgs.length - 1); const each5th = each(5); + const maxExpansionism = +powerInput.value; burgs.forEach(function (b, i) { if (!i) return; // skip first element @@ -86,10 +87,11 @@ window.BurgsAndStates = (function () { b.capital = 1; // 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 name = Names.getState(basename, b.culture); const type = cultures[b.culture].type; + const salesTax = rn(Math.random() * 0.3, 2); const coa = COA.generate(null, null, null, type); coa.shield = COA.getShield(b.culture, null); diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index d22200c9..e37f86f2 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -183,13 +183,13 @@ function editBurg(id) { function getExport(dealsArray) { 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 {resourceId, quantity, burgIncome} = deal; const {name, unit, icon} = Resources.get(resourceId); const unitName = quantity > 1 ? unit + 's' : unit; - return ` + return ` ${quantity} `;