mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-04-04 06:27:24 +02:00
fix: clean up regiment notes and improve emblem retrieval logic
This commit is contained in:
parent
020c454380
commit
47c52c5d28
1 changed files with 2 additions and 1 deletions
|
|
@ -487,6 +487,7 @@ class MilitaryModule {
|
||||||
// remove all existing regiment notes before regenerating
|
// remove all existing regiment notes before regenerating
|
||||||
for (let i = notes.length - 1; i >= 0; i--) {
|
for (let i = notes.length - 1; i >= 0; i--) {
|
||||||
if (notes[i].id.startsWith("regiment")) notes.splice(i, 1);
|
if (notes[i].id.startsWith("regiment")) notes.splice(i, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// get regiments for each state
|
// get regiments for each state
|
||||||
valid.forEach((s) => {
|
valid.forEach((s) => {
|
||||||
|
|
@ -621,10 +622,10 @@ class MilitaryModule {
|
||||||
)
|
)
|
||||||
return "👑"; // "Royal" regiment based in capital
|
return "👑"; // "Royal" regiment based in capital
|
||||||
const mainUnit = Object.entries(r.u).sort((a, b) => b[1] - a[1])[0][0]; // unit with more troops in regiment
|
const mainUnit = Object.entries(r.u).sort((a, b) => b[1] - a[1])[0][0]; // unit with more troops in regiment
|
||||||
|
const unit = options.military.find(
|
||||||
(u: { name: string; icon: string }) => u.name === mainUnit,
|
(u: { name: string; icon: string }) => u.name === mainUnit,
|
||||||
);
|
);
|
||||||
return unit ? unit.icon : "⚔️";
|
return unit ? unit.icon : "⚔️";
|
||||||
return unit.icon;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.Military = new MilitaryModule();
|
window.Military = new MilitaryModule();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue