diff --git a/index.html b/index.html index d8a46d18..e1130dc5 100644 --- a/index.html +++ b/index.html @@ -2454,7 +2454,7 @@
- + @@ -2587,6 +2587,7 @@ +
@@ -2743,7 +2744,7 @@ - + @@ -3474,6 +3475,7 @@ + diff --git a/modules/ui/battle-screen.js b/modules/ui/battle-screen.js index 53b1e739..91d4a5de 100644 --- a/modules/ui/battle-screen.js +++ b/modules/ui/battle-screen.js @@ -48,6 +48,7 @@ class Battle { document.getElementById("battleRun").addEventListener("click", () => Battle.prototype.context.run()); document.getElementById("battleApply").addEventListener("click", () => Battle.prototype.context.applyResults()); document.getElementById("battleCancel").addEventListener("click", () => Battle.prototype.context.cancelResults()); + document.getElementById("battleWiki").addEventListener("click", () => wiki("Battle-Simulator")); document.getElementById("battlePhase_attackers").addEventListener("click", ev => this.toggleChange(ev)); document.getElementById("battlePhase_attackers").nextElementSibling.addEventListener("click", ev => Battle.prototype.context.changePhase(ev, "attackers")); @@ -293,7 +294,7 @@ class Battle { const forces = this.getJoinedForces(this[side].regiments); const phase = this[side].phase; - const adjuster = populationRate.value / 10; // population adjuster, by default 100 + const adjuster = Math.max(populationRate.value / 10, 10); // population adjuster, by default 100 this[side].power = d3.sum(options.military.map(u => (forces[u.name] || 0) * u.power * scheme[phase][u.type])) / adjuster; const UIvalue = this[side].power ? Math.max(this[side].power|0, 1) : 0; document.getElementById("battlePower_"+side).innerHTML = UIvalue; diff --git a/modules/ui/military-overview.js b/modules/ui/military-overview.js index b720486f..cc1ff082 100644 --- a/modules/ui/military-overview.js +++ b/modules/ui/military-overview.js @@ -26,6 +26,7 @@ function overviewMilitary() { document.getElementById("militaryRegimentsList").addEventListener("click", () => overviewRegiments(-1)); document.getElementById("militaryOverviewRecalculate").addEventListener("click", militaryRecalculate); document.getElementById("militaryExport").addEventListener("click", downloadMilitaryData); + document.getElementById("militaryWiki").addEventListener("click", () => wiki("Military-Forces")); body.addEventListener("change", function(ev) { const el = ev.target, line = el.parentNode, state = +line.dataset.id; diff --git a/modules/utils.js b/modules/utils.js index 7882f37a..6b681018 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -418,6 +418,7 @@ const nth = n => n+(["st","nd","rd"][((n+90)%100-10)%10-1]||"th"); // conjunct array: [A,B,C] => "A, B and C" function list(array) { + if (!Intl.ListFormat) return array.join(", "); const conjunction = new Intl.ListFormat(window.lang || "en", {style:"long", type:"conjunction"}); return conjunction.format(array); } @@ -574,7 +575,12 @@ function getAbsolutePath(href) { // open URL in a new tab or window function openURL(url) { - window.open(url, '_blank'); + window.open(url, "_blank"); +} + +// open project wiki-page +function wiki(page) { + window.open("https://github.com/Azgaar/Fantasy-Map-Generator/wiki/" + page, "_blank"); } // wrap URL into html a element