Ergänze individuelle Charakterentwicklung und klare Hochzeitshinweise
Some checks failed
Deploy to production / deploy (push) Failing after 1m18s
Some checks failed
Deploy to production / deploy (push) Failing after 1m18s
This commit is contained in:
17
backend/utils/falukant/characterDevelopment.js
Normal file
17
backend/utils/falukant/characterDevelopment.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// Ages are whole game years (one real calendar day per year).
|
||||
export function hasReachedFertility(character, age) {
|
||||
const threshold = character?.fertileFromAge;
|
||||
return Number.isInteger(threshold) && threshold > 0
|
||||
&& Number.isFinite(age) && age >= threshold;
|
||||
}
|
||||
|
||||
export function getCharacterDevelopment(character, age) {
|
||||
const pubertyStartAge = character?.pubertyStartAge ?? null;
|
||||
return {
|
||||
pubertyStartAge,
|
||||
fertileFromAge: character?.fertileFromAge ?? null,
|
||||
hasReachedPuberty: Number.isInteger(pubertyStartAge) && pubertyStartAge > 0
|
||||
&& Number.isFinite(age) && age >= pubertyStartAge,
|
||||
hasReachedFertility: hasReachedFertility(character, age),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user