mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
v1.3.24
This commit is contained in:
parent
3fe1c8d27e
commit
b8514c3780
4 changed files with 36 additions and 14 deletions
|
|
@ -2377,10 +2377,10 @@
|
|||
<input id="markerIconShiftX" data-tip="Change icon horizontal shift" type="number" value=50 style="width:3em">
|
||||
<i data-tip="Change marker vertical shift" class="icon-resize-vertical"></i>
|
||||
<input id="markerIconShiftY" data-tip="Change vertical shift" type="number" min=0 max=100 value=50 style="width:3em">
|
||||
<i data-tip="Paste custom unicode symbol to use as icon" class="icon-pencil"></i>
|
||||
<span data-tip="Paste custom unicode symbol to use as icon">Paste here:</span>
|
||||
<input id="markerIconCustom" data-tip="Paste custom unicode symbol to use as icon" style="width:3em">
|
||||
<table id="markerIconTable"></table>
|
||||
<div style="font-style: italic; color: darkgrey;">Please note icons look different in different browsers!</div>
|
||||
<div style="font-style: italic; color: darkgrey;">Emojis look different in different browsers. Visit <a href="https://emojipedia.org/" rel="noopener" target="_blank">Emojipedia</a> to check and find more</div>
|
||||
</div>
|
||||
|
||||
<button id="markerStyle" data-tip="Change marker size and colors" class="icon-brush"></button>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,11 @@
|
|||
"ranged": {"Nomadic":.9, "Highland":1.3, "Lake":1, "Naval":.8, "Hunting":2, "River":.8},
|
||||
"mounted": {"Nomadic":2.3, "Highland":.6, "Lake":.7, "Naval":.3, "Hunting":.7, "River":.8},
|
||||
"machinery":{"Nomadic":.8, "Highland":1.4, "Lake":1.1, "Naval":1.4, "Hunting":.4, "River":1.1},
|
||||
"naval": {"Nomadic":.5, "Highland":.5, "Lake":1.2, "Naval":1.8, "Hunting":.7, "River":1.2}
|
||||
"naval": {"Nomadic":.5, "Highland":.5, "Lake":1.2, "Naval":1.8, "Hunting":.7, "River":1.2},
|
||||
// non-default generic:
|
||||
"armored": {"Nomadic":1, "Highland":.5, "Lake":1, "Naval":1, "Hunting":.7, "River":1.1},
|
||||
"aviation": {"Nomadic":.5, "Highland":.5, "Lake":1.2, "Naval":1.2, "Hunting":.6, "River":1.2},
|
||||
"magical": {"Nomadic":1, "Highland":2, "Lake":1, "Naval":1, "Hunting":1, "River":1}
|
||||
};
|
||||
|
||||
valid.forEach(s => {
|
||||
|
|
@ -59,7 +63,7 @@
|
|||
|
||||
for (const u of options.military) {
|
||||
const perc = +u.rural;
|
||||
if (isNaN(perc) || perc <= 0) continue;
|
||||
if (isNaN(perc) || perc <= 0 || !s.temp[u.name]) continue;
|
||||
|
||||
let army = m * perc; // basic army for rural cell
|
||||
if (nomadic) { // "nomadic" biomes special rules
|
||||
|
|
@ -105,7 +109,7 @@
|
|||
|
||||
for (const u of options.military) {
|
||||
const perc = +u.urban;
|
||||
if (isNaN(perc) || perc <= 0) continue;
|
||||
if (isNaN(perc) || perc <= 0 || !s.temp[u.name]) continue;
|
||||
let army = m * perc; // basic army for rural cell
|
||||
|
||||
if (u.type === "naval" && !b.port) continue; // only ports produce naval units
|
||||
|
|
@ -113,20 +117,24 @@
|
|||
if (nomadic) { // "nomadic" biomes special rules
|
||||
if (u.type === "melee") army /= 3; else
|
||||
if (u.type === "machinery") army /= 2; else
|
||||
if (u.type === "mounted") army *= 3;
|
||||
if (u.type === "mounted") army *= 3; else
|
||||
if (u.type === "armored") army *= 2;
|
||||
}
|
||||
|
||||
if (wetland) { // "wet" biomes special rules
|
||||
if (u.type === "melee") army *= 1.2; else
|
||||
if (u.type === "ranged") army *= 1.4; else
|
||||
if (u.type === "machinery") army *= 1.2; else
|
||||
if (u.type === "mounted") army /= 4;
|
||||
if (u.type === "mounted") army /= 4; else
|
||||
if (u.type === "armored") army /= 3;
|
||||
}
|
||||
|
||||
if (highland) { // highlands special rules
|
||||
if (u.type === "ranged") army *= 2; else
|
||||
if (u.type === "naval") army /= 3; else
|
||||
if (u.type === "mounted") army /= 3;
|
||||
if (u.type === "mounted") army /= 3; else
|
||||
if (u.type === "armored") army /= 2; else
|
||||
if (u.type === "magical") army *= 2;
|
||||
}
|
||||
|
||||
const t = rn(army * s.temp[u.name] * populationRate.value);
|
||||
|
|
@ -265,6 +273,9 @@
|
|||
if (type === "ranged") return "🏹";
|
||||
if (type === "mounted") return "🐴";
|
||||
if (type === "machinery") return "💣";
|
||||
if (type === "armored") return "🐢";
|
||||
if (type === "aviation") return "🦅";
|
||||
if (type === "magical") return "🔮";
|
||||
else return "⚔️";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ function overviewMilitary() {
|
|||
}
|
||||
|
||||
function militaryCustomize() {
|
||||
const types = ["melee", "ranged", "mounted", "machinery", "naval"];
|
||||
const types = ["melee", "ranged", "mounted", "machinery", "naval", "armored", "aviation", "magical"];
|
||||
const table = document.getElementById("militaryOptions").querySelector("tbody");
|
||||
removeUnitLines();
|
||||
options.military.map(u => addUnitLine(u));
|
||||
|
|
@ -182,8 +182,8 @@ function overviewMilitary() {
|
|||
title: "Edit Military Units", resizable: false, width: fitContent(),
|
||||
position: {my: "center", at: "center", of: "svg"},
|
||||
buttons: {
|
||||
Apply: function() {applyMilitaryOptions(); $(this).dialog("close");},
|
||||
Add: () => addUnitLine({name: "custom"+rand(1000), rural: .2, urban: .5, crew: 1, type: "melee"}),
|
||||
Apply: applyMilitaryOptions,
|
||||
Add: () => addUnitLine({name: "custom"+militaryOptionsTable.rows.length, rural: .2, urban: .5, crew: 1, type: "melee"}),
|
||||
Restore: restoreDefaultUnits,
|
||||
Cancel: function() {$(this).dialog("close");}
|
||||
}, open: function() {
|
||||
|
|
@ -221,9 +221,17 @@ function overviewMilitary() {
|
|||
}
|
||||
|
||||
function applyMilitaryOptions() {
|
||||
options.military = Array.from(table.querySelectorAll("tr")).map(r => {
|
||||
const unitLines = Array.from(table.querySelectorAll("tr"));
|
||||
const names = unitLines.map(r => r.querySelector("input").value.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '_'));
|
||||
if (new Set(names).size !== names.length) {
|
||||
tip("All units should have unique names", false, "error");
|
||||
return;
|
||||
}
|
||||
|
||||
$("#militaryOptions").dialog("close");
|
||||
options.military = unitLines.map((r, i) => {
|
||||
const [name, rural, urban, crew, type, separate] = Array.from(r.querySelectorAll("input, select")).map(d => d.value||d.checked);
|
||||
return {name:name.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '_'), rural:+rural||0, urban:+urban||0, crew:+crew||0, type, separate:+separate||0};
|
||||
return {name:names[i], rural:+rural||0, urban:+urban||0, crew:+crew||0, type, separate:+separate||0};
|
||||
});
|
||||
localStorage.setItem("military", JSON.stringify(options.military));
|
||||
Military.generate();
|
||||
|
|
|
|||
|
|
@ -118,7 +118,10 @@ function editRegiment(selector) {
|
|||
|
||||
$("#alert").dialog({
|
||||
resizable: false, width: fitContent(), title: "Select emblem",
|
||||
buttons: {Close: function() {$(this).dialog("close");}}
|
||||
buttons: {
|
||||
Emojipedia: function() {openURL("https://emojipedia.org/");},
|
||||
Close: function() {$(this).dialog("close");}
|
||||
}
|
||||
});
|
||||
|
||||
function showTip(e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue