@opendnd/genetica
Version:
This is a tool for using a simplified genetics system to generate inheritable traits for DnD characters.
53 lines (46 loc) • 1.1 kB
JavaScript
// set the command
const cmd = process.argv[2] || 'skin';
// generate skin colors
const skinColor = () => {
const colors = [
'porcelain', // 0
'fair', // 1
'peach', // 2
'olive', // 3
'honey', // 4
'amber', // 5
'hazelnut', // 6
'ebony', // 7
'carob', // 8
];
// skin matrix with color index
const map = [
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
];
// base mapping
const base = 'skin-color:C6';
const genes = {};
map.forEach((row, i) => {
row.forEach((col, j) => {
genes[`${base}:${i + 1}=${j + 1}`] = colors[col];
});
});
console.log(genes);
};
switch (cmd) {
case 'skin':
skinColor();
break;
default:
console.log('No command selected.');
break;
}