npc gen : added children
This commit is contained in:
@@ -249,6 +249,7 @@
|
||||
"intrigue": "Intrigue"
|
||||
},
|
||||
"age": "Age",
|
||||
"children": "Children",
|
||||
"marital_status": {
|
||||
"title": "Marital Status",
|
||||
"partner": "Partner",
|
||||
|
||||
@@ -249,6 +249,7 @@
|
||||
"intrigue": "Intriga"
|
||||
},
|
||||
"age": "Age",
|
||||
"children": "Children",
|
||||
"marital_status": {
|
||||
"title": "Marital Status",
|
||||
"partner": "Partner",
|
||||
|
||||
@@ -249,6 +249,7 @@
|
||||
"intrigue": "Intrigue"
|
||||
},
|
||||
"age": "Age",
|
||||
"children": "Enfants",
|
||||
"marital_status": {
|
||||
"title": "État civil",
|
||||
"partner": "Partenaire",
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
* L5R Character generator base object
|
||||
*/
|
||||
export class CharacterGenerator {
|
||||
/**
|
||||
* Base age (minimal)
|
||||
*/
|
||||
static baseAge = 15;
|
||||
|
||||
/**
|
||||
* Payload Object
|
||||
*/
|
||||
@@ -10,7 +15,7 @@ export class CharacterGenerator {
|
||||
clan: "random",
|
||||
family: "",
|
||||
gender: "male",
|
||||
age: 15,
|
||||
age: CharacterGenerator.baseAge,
|
||||
maritalStatus: "",
|
||||
};
|
||||
|
||||
@@ -145,7 +150,10 @@ export class CharacterGenerator {
|
||||
* @return {number}
|
||||
*/
|
||||
static genAge(avgRingsValue) {
|
||||
return CharacterGenerator._randomInt(15, avgRingsValue * 10 + 15);
|
||||
return CharacterGenerator._randomInt(
|
||||
CharacterGenerator.baseAge,
|
||||
avgRingsValue * 10 + CharacterGenerator.baseAge
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,6 +201,36 @@ export class CharacterGenerator {
|
||||
return partner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate children
|
||||
* @param {number} age Current npc age
|
||||
* @param {string} clan Current npc clan
|
||||
* @return {Promise<string[]>}
|
||||
*/
|
||||
static async genChildren(age, clan) {
|
||||
const childs = [];
|
||||
|
||||
let ageLoop = Math.max(0, age - CharacterGenerator.baseAge - 1);
|
||||
while (ageLoop > 0) {
|
||||
const childAge = CharacterGenerator._randomInt(1, ageLoop);
|
||||
|
||||
if (Math.random() > 0.66) {
|
||||
const childIsFemale = Math.random() > 0.5;
|
||||
const childName = await CharacterGenerator.getRandomizedFirstname(childIsFemale, clan);
|
||||
|
||||
childs.push(
|
||||
`${childName} (${childAge}, ${game.i18n.localize(
|
||||
"l5r5e.social.gender." + (childIsFemale ? "female" : "male")
|
||||
)})`
|
||||
);
|
||||
}
|
||||
|
||||
ageLoop -= childAge + 1;
|
||||
}
|
||||
|
||||
return childs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Honor, Glory and Status values
|
||||
* @param {number} age
|
||||
@@ -615,6 +653,12 @@ export class CharacterGenerator {
|
||||
"l5r5e.social.gender." + (partner.female ? "female" : "male")
|
||||
)})` +
|
||||
"</p>";
|
||||
|
||||
// Childs
|
||||
const childs = await CharacterGenerator.genChildren(Math.min(this.data.age, partner.age), this.data.clan);
|
||||
if (childs.length > 0) {
|
||||
actorDatas.notes += `<p>${game.i18n.localize("l5r5e.social.children")}: ${childs.join(", ")}</p>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -919,7 +919,6 @@ button {
|
||||
}
|
||||
|
||||
.autocomplete-wrapper {
|
||||
/*the container must be positioned relative:*/
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
@@ -929,7 +928,6 @@ button {
|
||||
border-bottom: none;
|
||||
border-top: none;
|
||||
z-index: 99;
|
||||
/*position the autocomplete items to be the same width as the container:*/
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
@@ -942,11 +940,9 @@ button {
|
||||
text-align: left;
|
||||
}
|
||||
.autocomplete-items div:hover {
|
||||
/*when hovering an item:*/
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
.autocomplete-active {
|
||||
/*when navigating through the items using the arrow keys:*/
|
||||
background-color: DodgerBlue !important;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user