mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.5.21 - smarted coa generation
This commit is contained in:
parent
4fffb33e19
commit
63e66b1678
2 changed files with 37 additions and 32 deletions
|
|
@ -90,7 +90,7 @@
|
||||||
const name = Names.getState(basename, b.culture);
|
const name = Names.getState(basename, b.culture);
|
||||||
const nomadic = [1, 2, 3, 4].includes(cells.biome[b.cell]);
|
const nomadic = [1, 2, 3, 4].includes(cells.biome[b.cell]);
|
||||||
const type = nomadic ? "Nomadic" : cultures[b.culture].type === "Nomadic" ? "Generic" : cultures[b.culture].type;
|
const type = nomadic ? "Nomadic" : cultures[b.culture].type === "Nomadic" ? "Generic" : cultures[b.culture].type;
|
||||||
const coa = COA.generate(null);
|
const coa = COA.generate(null, null, null, type);
|
||||||
coa.shield = COA.getShield(b.culture, null);
|
coa.shield = COA.getShield(b.culture, null);
|
||||||
states.push({i, color: colors[i-1], name, expansionism, capital: i, type, center: b.cell, culture: b.culture, coa});
|
states.push({i, color: colors[i-1], name, expansionism, capital: i, type, center: b.cell, culture: b.culture, coa});
|
||||||
cells.burg[b.cell] = i;
|
cells.burg[b.cell] = i;
|
||||||
|
|
@ -185,7 +185,9 @@
|
||||||
if (b.capital) kinship += .1;
|
if (b.capital) kinship += .1;
|
||||||
else if (b.port) kinship -= .1;
|
else if (b.port) kinship -= .1;
|
||||||
if (b.culture !== state.culture) kinship -= .25;
|
if (b.culture !== state.culture) kinship -= .25;
|
||||||
b.coa = COA.generate(stateCOA, kinship);
|
b.type = getBurgType(b, i);
|
||||||
|
const type = b.capital && P(.2) ? "Capital" : b.type === "Generic" ? "City" : b.type;
|
||||||
|
b.coa = COA.generate(stateCOA, kinship, null, type === "Generic" ? null : type);
|
||||||
b.coa.shield = COA.getShield(b.culture, b.state);
|
b.coa.shield = COA.getShield(b.culture, b.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,6 +202,17 @@
|
||||||
TIME && console.timeEnd("specifyBurgs");
|
TIME && console.timeEnd("specifyBurgs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getBurgType = function(b, i) {
|
||||||
|
const cells = pack.cells;
|
||||||
|
if (b.port) return "Naval";
|
||||||
|
if (cells.haven[i] && pack.features[cells.f[cells.haven[i]]].type === "lake") return "River";
|
||||||
|
if (cells.h[i] > 60) return "Highland";
|
||||||
|
if (cells.r[i] && cells.r[i].length > 100 && cells.r[i].length >= pack.rivers[0].length) return "River";
|
||||||
|
if ([1, 2, 3, 4].includes(cells.biome[i])) return "Nomadic";
|
||||||
|
if (cells.biome[i] > 4 && cells.biome[i] < 10) return "Hunting";
|
||||||
|
return "Generic";
|
||||||
|
}
|
||||||
|
|
||||||
const defineBurgFeatures = function(newburg) {
|
const defineBurgFeatures = function(newburg) {
|
||||||
const cells = pack.cells;
|
const cells = pack.cells;
|
||||||
pack.burgs.filter(b => newburg ? b.i == newburg.i : (b.i && !b.removed)).forEach(b => {
|
pack.burgs.filter(b => newburg ? b.i == newburg.i : (b.i && !b.removed)).forEach(b => {
|
||||||
|
|
@ -939,7 +952,7 @@
|
||||||
const fullName = name + " " + formName;
|
const fullName = name + " " + formName;
|
||||||
const color = getMixedColor(s.color);
|
const color = getMixedColor(s.color);
|
||||||
const kinship = nameByBurg ? .8 : .4;
|
const kinship = nameByBurg ? .8 : .4;
|
||||||
const coa = COA.generate(stateBurgs[i].coa, kinship);
|
const coa = COA.generate(stateBurgs[i].coa, kinship, null, burg.port ? "Naval" : null);
|
||||||
coa.shield = COA.getShield(c, s.i);
|
coa.shield = COA.getShield(c, s.i);
|
||||||
provinces.push({i:province, state:s.i, center, burg, name, formName, fullName, color, coa});
|
provinces.push({i:province, state:s.i, center, burg, name, formName, fullName, color, coa});
|
||||||
}
|
}
|
||||||
|
|
@ -1036,7 +1049,8 @@
|
||||||
const color = getMixedColor(s.color);
|
const color = getMixedColor(s.color);
|
||||||
const dominion = colony ? P(.95) : singleIsle || isleGroup ? P(.7) : P(.3);
|
const dominion = colony ? P(.95) : singleIsle || isleGroup ? P(.7) : P(.3);
|
||||||
const kinship = dominion ? 0 : .4;
|
const kinship = dominion ? 0 : .4;
|
||||||
const coa = COA.generate(s.coa, kinship, dominion);
|
const naval = singleIsle || !isleGroup || burgs[burg]?.port;
|
||||||
|
const coa = COA.generate(s.coa, kinship, dominion, naval ? "Naval" : null);
|
||||||
coa.shield = COA.getShield(c, s.i);
|
coa.shield = COA.getShield(c, s.i);
|
||||||
provinces.push({i:province, state:s.i, center, burg, name, formName, fullName, color, coa});
|
provinces.push({i:province, state:s.i, center, burg, name, formName, fullName, color, coa});
|
||||||
s.provinces.push(province);
|
s.provinces.push(province);
|
||||||
|
|
|
||||||
|
|
@ -15,25 +15,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const charges = {
|
const charges = {
|
||||||
types: { conventional: 30, crosses: 8, animals: 2, animalHeads: 1, birds: 2, aquatic: 1, seafaring: 1, fantastic: 3, plants: 1, agriculture: 1, arms: 3, bodyparts: 1, people: 1, architecture: 1, miscellaneous: 3, inescutcheon: 3, uploaded: 0 },
|
// categories selection
|
||||||
single: { conventional: 12, crosses: 8, plants: 2, animals: 10, animalHeads: 2, birds: 4, aquatic: 2, seafaring: 2, fantastic: 7, agriculture: 1, arms: 6, bodyparts: 1, people: 1, architecture: 1, miscellaneous: 9, inescutcheon: 5, uploaded: 0 },
|
types: { conventional: 30, crosses: 8, animals: 2, animalHeads: 1, birds: 2, aquatic: 1, seafaring: 1, fantastic: 3, plants: 1, agriculture: 1, arms: 3, bodyparts: 1, people: 1, architecture: 1, miscellaneous: 3, inescutcheon: 3 },
|
||||||
|
single: { conventional: 12, crosses: 8, plants: 2, animals: 10, animalHeads: 2, birds: 4, aquatic: 2, seafaring: 2, fantastic: 7, agriculture: 1, arms: 6, bodyparts: 1, people: 1, architecture: 1, miscellaneous: 9, inescutcheon: 5 },
|
||||||
semy: { conventional: 12, crosses: 3, plants: 1 },
|
semy: { conventional: 12, crosses: 3, plants: 1 },
|
||||||
|
// generic categories
|
||||||
conventional: {
|
conventional: {
|
||||||
lozenge: 2, fusil: 4, mascle: 4, rustre: 2, lozengeFaceted: 3, lozengePloye: 1, roundel: 4, roundel2: 3, annulet: 4,
|
lozenge: 2, fusil: 4, mascle: 4, rustre: 2, lozengeFaceted: 3, lozengePloye: 1, roundel: 4, roundel2: 3, annulet: 4,
|
||||||
mullet: 5, mulletPierced: 1, mulletFaceted: 1, mullet4: 3, mullet6: 4, mullet6Pierced: 1, mullet6Faceted: 1, mullet7: 1, mullet8: 1, mullet10: 1,
|
mullet: 5, mulletPierced: 1, mulletFaceted: 1, mullet4: 3, mullet6: 4, mullet6Pierced: 1, mullet6Faceted: 1, mullet7: 1, mullet8: 1, mullet10: 1,
|
||||||
estoile: 1, compassRose: 1, billet: 5, delf: 0, triangle: 3, trianglePierced: 1, goutte: 4, heart: 4, pique: 2, сarreau: 1, trefle: 2,
|
estoile: 1, compassRose: 1, billet: 5, delf: 0, triangle: 3, trianglePierced: 1, goutte: 4, heart: 4, pique: 2, сarreau: 1, trefle: 2,
|
||||||
fleurDeLis: 6, sun: 3, sunInSplendour: 1, crescent: 5, fountain: 1
|
fleurDeLis: 6, sun: 3, sunInSplendour: 1, crescent: 5, fountain: 1
|
||||||
},
|
},
|
||||||
inescutcheon: {
|
|
||||||
inescutcheonHeater: 1, inescutcheonSpanish: 1, inescutcheonFrench: 1,
|
|
||||||
inescutcheonHorsehead: 1, inescutcheonHorsehead2: 1, inescutcheonPolish: 1, inescutcheonHessen: 1, inescutcheonSwiss: 1,
|
|
||||||
inescutcheonBoeotian: 1, inescutcheonRoman: 1, inescutcheonKite: 1, inescutcheonOldFrench: 1, inescutcheonRenaissance: 1, inescutcheonBaroque: 1,
|
|
||||||
inescutcheonTarge: 1, inescutcheonTarge2: 1, inescutcheonPavise: 1, inescutcheonWedged: 1,
|
|
||||||
inescutcheonFlag: 1, inescutcheonPennon: 1, inescutcheonGuidon: 1, inescutcheonBanner: 1, inescutcheonDovetail: 1, inescutcheonGonfalon: 1, inescutcheonPennant: 1,
|
|
||||||
inescutcheonRound: 1, inescutcheonOval: 1, inescutcheonVesicaPiscis: 1, inescutcheonSquare: 1, inescutcheonDiamond: 1, inescutcheonNo: 1,
|
|
||||||
inescutcheonFantasy1: 1, inescutcheonFantasy2: 1, inescutcheonFantasy3: 1, inescutcheonFantasy4: 1, inescutcheonFantasy5: 1,
|
|
||||||
inescutcheonNoldor: 1, inescutcheonGondor: 1, inescutcheonEasterling: 1, inescutcheonErebor: 1, inescutcheonIronHills: 1, inescutcheonUrukHai: 1, inescutcheonMoriaOrc: 1
|
|
||||||
},
|
|
||||||
crosses: {
|
crosses: {
|
||||||
crossHummetty: 15, crossVoided: 1, crossPattee: 3, crossPotent: 2, crossClechy: 3, crosslet: 1, crossBottony: 1, crossFleury: 3,
|
crossHummetty: 15, crossVoided: 1, crossPattee: 3, crossPotent: 2, crossClechy: 3, crosslet: 1, crossBottony: 1, crossFleury: 3,
|
||||||
crossPatonce: 1, crossPommy: 1, crossGamma: 1, crossArrowed: 1, crossFitchy: 1, crossCercelee: 1, crossMoline: 2, crossFourchy: 1,
|
crossPatonce: 1, crossPommy: 1, crossGamma: 1, crossArrowed: 1, crossFitchy: 1, crossCercelee: 1, crossMoline: 2, crossFourchy: 1,
|
||||||
|
|
@ -43,9 +35,7 @@
|
||||||
lionRampant: 5, lionPassant: 2, wolfRampant: 1, wolfPassant: 1, wolfStatant: 1, greyhoundCourant: 1, boarRampant: 1,
|
lionRampant: 5, lionPassant: 2, wolfRampant: 1, wolfPassant: 1, wolfStatant: 1, greyhoundCourant: 1, boarRampant: 1,
|
||||||
horseRampant: 2, horseSalient: 1, bearRampant: 2, bearPassant: 1, bullPassant: 1, goat: 1, lamb: 1, elephant: 1
|
horseRampant: 2, horseSalient: 1, bearRampant: 2, bearPassant: 1, bullPassant: 1, goat: 1, lamb: 1, elephant: 1
|
||||||
},
|
},
|
||||||
animalHeads: {
|
animalHeads: { wolfHeadErased: 2, bullHeadCaboshed: 1, deerHeadCaboshed: 1 },
|
||||||
wolfHeadErased: 2, bullHeadCaboshed: 1, deerHeadCaboshed: 1
|
|
||||||
},
|
|
||||||
fantastic: { dragonPassant: 2, dragonRampant: 2, wyvern: 1, wyvernWithWingsDisplayed: 1, griffinPassant: 1, griffinRampant: 1, eagleTwoHeards: 2, unicornRampant: 1, pegasus: 1, serpent: 1 },
|
fantastic: { dragonPassant: 2, dragonRampant: 2, wyvern: 1, wyvernWithWingsDisplayed: 1, griffinPassant: 1, griffinRampant: 1, eagleTwoHeards: 2, unicornRampant: 1, pegasus: 1, serpent: 1 },
|
||||||
birds: { eagle: 9, raven: 2, cock: 3, parrot: 1, swan: 2, swanErased: 1, heron: 1 },
|
birds: { eagle: 9, raven: 2, cock: 3, parrot: 1, swan: 2, swanErased: 1, heron: 1 },
|
||||||
plants: { tree: 1, cinquefoil: 1, rose: 1 },
|
plants: { tree: 1, cinquefoil: 1, rose: 1 },
|
||||||
|
|
@ -59,7 +49,18 @@
|
||||||
miscellaneous: {
|
miscellaneous: {
|
||||||
crown: 3, orb: 1, chalice: 1, key: 1, buckle: 1, bugleHorn: 1, bell: 2, pot: 1, horseshoe: 3, stagsAttires: 1, cowHorns: 2, wing: 1, wingSword: 1,
|
crown: 3, orb: 1, chalice: 1, key: 1, buckle: 1, bugleHorn: 1, bell: 2, pot: 1, horseshoe: 3, stagsAttires: 1, cowHorns: 2, wing: 1, wingSword: 1,
|
||||||
lute: 1, harp: 1, wheel: 2, crosier: 1, log: 1},
|
lute: 1, harp: 1, wheel: 2, crosier: 1, log: 1},
|
||||||
uploaded: {},
|
// selection based on culture type:
|
||||||
|
Naval: { anchor: 3, boat: 1, lymphad: 2, armillarySphere: 1, escallop: 1, dolphin: 1 },
|
||||||
|
Highland: { tower: 1, raven: 1, wolfHeadErased: 1, wolfPassant: 1, goat: 1,},
|
||||||
|
River: { tower: 1, garb: 1, rake: 1, boat: 1, pike: 2, bullHeadCaboshed: 1 },
|
||||||
|
Lake: { cancer: 2, escallop: 1, pike: 2, heron: 1, boat: 1 },
|
||||||
|
Nomadic: { pot: 1, buckle: 1, wheel: 2, sabre: 2, sabresCrossed: 1, bow: 2, arrow: 1, horseRampant: 1, horseSalient: 1, crescent: 1 },
|
||||||
|
Hunting: { bugleHorn: 3, stagsAttires: 2, hatchet: 1, bowWithArrow: 2, arrowsSheaf: 1, deerHeadCaboshed: 1, wolfStatant: 1 },
|
||||||
|
// selection based on type
|
||||||
|
City: { key: 3, bell: 2, lute: 1, tower: 1, castle: 1, mallet: 1 },
|
||||||
|
Capital: { crown: 4, orb: 1, lute: 1, castle: 3, tower: 1 },
|
||||||
|
Сathedra: { chalice: 1, orb: 1, crosier: 3, lamb: 1 },
|
||||||
|
// specific cases
|
||||||
natural: { fountain: "azure", garb: "or", raven: "sable" }, // charges to mainly use predefined colours
|
natural: { fountain: "azure", garb: "or", raven: "sable" }, // charges to mainly use predefined colours
|
||||||
sinister: ["crossGamma", "lionRampant", "lionPassant", "wolfRampant", "wolfPassant", "wolfStatant", "wolfHeadErased", "greyhoundСourant", "boarRampant", "horseRampant", "horseSalient", "bullPassant",
|
sinister: ["crossGamma", "lionRampant", "lionPassant", "wolfRampant", "wolfPassant", "wolfStatant", "wolfHeadErased", "greyhoundСourant", "boarRampant", "horseRampant", "horseSalient", "bullPassant",
|
||||||
"bearRampant", "bearPassant", "goat", "lamb", "elephant",
|
"bearRampant", "bearPassant", "goat", "lamb", "elephant",
|
||||||
|
|
@ -190,16 +191,10 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const generate = function(parent, kinship, dominion) {
|
const generate = function(parent, kinship, dominion, type) {
|
||||||
if (parent === "custom") parent = null;
|
if (parent === "custom") parent = null;
|
||||||
let usedPattern = null, usedTinctures = [];
|
let usedPattern = null, usedTinctures = [];
|
||||||
|
|
||||||
// TODO
|
|
||||||
// seafaring etc
|
|
||||||
|
|
||||||
// define emblems layer style for all styles
|
|
||||||
// test in FF
|
|
||||||
|
|
||||||
const t1 = P(kinship) ? parent.t1 : getTincture("field");
|
const t1 = P(kinship) ? parent.t1 : getTincture("field");
|
||||||
if (t1.includes("-")) usedPattern = t1;
|
if (t1.includes("-")) usedPattern = t1;
|
||||||
const coa = {t1};
|
const coa = {t1};
|
||||||
|
|
@ -210,7 +205,7 @@
|
||||||
const rareDivided = ["chief", "terrace", "chevron", "quarter", "flaunches"].includes(ordinary);
|
const rareDivided = ["chief", "terrace", "chevron", "quarter", "flaunches"].includes(ordinary);
|
||||||
const divisioned = rareDivided ? P(.03) : charge && ordinary ? P(.03) : charge ? P(.3) : ordinary ? P(.7) : P(.995); // 33% for division
|
const divisioned = rareDivided ? P(.03) : charge && ordinary ? P(.03) : charge ? P(.3) : ordinary ? P(.7) : P(.995); // 33% for division
|
||||||
const division = divisioned ? parent?.division && P(kinship - .1) ? parent.division.division : rw(divisions.variants) : null;
|
const division = divisioned ? parent?.division && P(kinship - .1) ? parent.division.division : rw(divisions.variants) : null;
|
||||||
if (charge) charge = parent?.charges && P(kinship - .1) ? parent.charges[0].charge : selectCharge();
|
if (charge) charge = parent?.charges && P(kinship - .1) ? parent.charges[0].charge : type && P(.3) ? rw(charges[type]) : selectCharge();
|
||||||
|
|
||||||
if (division) {
|
if (division) {
|
||||||
const t = getTincture("division", usedTinctures, P(.98) ? coa.t1 : null);
|
const t = getTincture("division", usedTinctures, P(.98) ? coa.t1 : null);
|
||||||
|
|
@ -353,10 +348,6 @@
|
||||||
coa.charges.push({charge, t: t2, p: "y", size: 0.5});
|
coa.charges.push({charge, t: t2, p: "y", size: 0.5});
|
||||||
|
|
||||||
coa.ordinaries ? coa.ordinaries.push(canton) : coa.ordinaries = [canton];
|
coa.ordinaries ? coa.ordinaries.push(canton) : coa.ordinaries = [canton];
|
||||||
|
|
||||||
// console.log(encodeURI(`https://azgaar.github.io/Armoria/?coa=${JSON.stringify(coa)}`));
|
|
||||||
// console.log(encodeURI(`https://azgaar.github.io/Armoria/?coa=${JSON.stringify(parent)}`));
|
|
||||||
// console.log("-------");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectCharge(set) {
|
function selectCharge(set) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue