v1.5.25 - smarter generation

This commit is contained in:
Azgaar 2021-02-14 15:11:42 +03:00
parent 2f3f5d05fb
commit 66bd7b7f6f
9 changed files with 38 additions and 28 deletions

View file

@ -124,13 +124,14 @@ function addBurg(point) {
const temple = pack.states[state].form === "Theocracy";
const population = Math.max((cells.s[cell] + cells.road[cell]) / 3 + i / 1000 + cell % 100 / 1000, .1);
const type = BurgsAndStates.getType(cell, false);
// generate emblem
const coa = COA.generate(pack.states[state].coa, .25);
const coa = COA.generate(pack.states[state].coa, .25, null, type);
coa.shield = COA.getShield(culture, state);
COArenderer.add("burg", i, coa, x, y);
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: 0, port: 0, temple, population, coa});
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: 0, port: 0, temple, population, coa, type});
cells.burg[cell] = i;
const townSize = burgIcons.select("#towns").attr("size") || 0.5;

View file

@ -167,7 +167,7 @@ function editEmblem(type, id, el) {
}
const shield = el.coa.shield || COA.getShield(el.culture || parent?.culture || 0, el.state);
el.coa = COA.generate(parent ? parent.coa : null);
el.coa = COA.generate(parent ? parent.coa : null, .3, .1, null);
el.coa.shield = shield;
emblemShapeSelector.disabled = false;
emblemShapeSelector.value = el.coa.shield;

View file

@ -193,11 +193,6 @@ function editProvinces() {
openPicker(currentFill, callback);
}
function editCOA(p) {
const coa = COA.toString(pack.provinces[p].coa);
openURL("http://azgaar.github.io/Armoria/?coa=" + coa);
}
function capitalZoomIn(p) {
const capital = pack.provinces[p].burg;
const l = burgLabels.select("[data-id='" + capital + "']");
@ -780,7 +775,8 @@ function editProvinces() {
// generate emblem
const kinship = burg ? .8 : .4;
const parent = burg ? pack.burgs[burg].coa : pack.states[state].coa;
const coa = COA.generate(parent, kinship);
const type = BurgsAndStates.getType(center, parent.port);
const coa = COA.generate(parent, kinship, P(.1), type);
coa.shield = COA.getShield(c, state);
COArenderer.add("province", province, coa, point[0], point[1]);

View file

@ -844,7 +844,8 @@ function editStates() {
const color = getRandomColor();
// generate emblem
const coa = COA.generate(burgs[burg].coa, .4);
const cultureType = pack.cultures[culture].type;
const coa = COA.generate(burgs[burg].coa, .4, null, cultureType);
coa.shield = COA.getShield(culture, null);
// update diplomacy and reverse relations

View file

@ -166,7 +166,8 @@ function regenerateStates() {
const type = nomadic ? "Nomadic" : pack.cultures[culture].type === "Nomadic" ? "Generic" : pack.cultures[culture].type;
const expansionism = rn(Math.random() * powerInput.value + 1, 1);
const coa = COA.generate(capital.coa, .3);
const cultureType = pack.cultures[culture].type;
const coa = COA.generate(capital.coa, .3, null, cultureType);
coa.shield = capital.coa.shield;
return {i, name, type, capital:capital.i, center:capital.cell, culture, expansionism, coa};
@ -272,7 +273,8 @@ function regenerateEmblems() {
// generate new emblems
pack.states.forEach(state => {
if (!state.i || state.removed) return;
state.coa = COA.generate(null);
const cultureType = pack.cultures[state.culture].type;
state.coa = COA.generate(null, null, null, cultureType);
state.coa.shield = COA.getShield(state.culture, null);
});
@ -284,7 +286,7 @@ function regenerateEmblems() {
if (burg.capital) kinship += .1;
else if (burg.port) kinship -= .1;
if (burg.culture !== state.culture) kinship -= .25;
burg.coa = COA.generate(state.coa, kinship);
burg.coa = COA.generate(state.coa, kinship, null, burg.type);
burg.coa.shield = COA.getShield(burg.culture, burg.state);
});
@ -305,8 +307,8 @@ function regenerateEmblems() {
const nameByBurg = province.burg && province.name.slice(0, 3) === parent.name.slice(0, 3);
const kinship = dominion ? 0 : nameByBurg ? .8 : .4;
const culture = pack.cells.culture[province.center];
province.coa = COA.generate(parent.coa, kinship, dominion);
const type = BurgsAndStates.getType(province.center, parent.port);
province.coa = COA.generate(parent.coa, kinship, dominion, type);
province.coa.shield = COA.getShield(culture, province.state);
});