From 340730f85c013ecad3d2ec82a485a60c01f95799 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 07:37:38 -0700 Subject: [PATCH 01/13] added aging to editor --- public/editor.html | 93 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 82 insertions(+), 11 deletions(-) diff --git a/public/editor.html b/public/editor.html index 5c6ce950..3be21071 100644 --- a/public/editor.html +++ b/public/editor.html @@ -204,6 +204,62 @@

+
+
+
+

Aging

+
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
@@ -904,13 +960,13 @@

Array.from(document.getElementsByClassName("random-attribute")).forEach( (elem) => { if (!elem.checked) { - const attr = elem.id.split("-").slice(1); - if (attr.length === 1) newFace[attr[0]] = oldFace[attr[0]]; - else if (!isNaN(parseInt(attr[1]))) { - const idx = parseInt(attr[1]); - newFace[attr[0]][idx] = oldFace[attr[0]][idx]; - } else if (attr.length === 2) - newFace[attr[0]][attr[1]] = oldFace[attr[0]][attr[1]]; + const parts = elem.id.split("-").slice(1); + if (parts.length === 1) newFace[parts[0]] = oldFace[parts[0]]; + else if (!isNaN(parseInt(parts[1]))) { + const idx = parseInt(parts[1]); + newFace[parts[0]][idx] = oldFace[parts[0]][idx]; + } else if (parts.length === 2) + newFace[parts[0]][parts[1]] = oldFace[parts[0]][parts[1]]; } } ); @@ -929,16 +985,26 @@

}; const initializeSelectOptions = () => { + let selectElement, optionElement; for (const feature of Object.keys(faces.svgsIndex)) { const options = faces.svgsIndex[feature]; - const selectElement = document.getElementById(`${feature}-id`); + selectElement = document.getElementById(`${feature}-id`); for (const option of options) { - const optionElement = document.createElement("option"); + optionElement = document.createElement("option"); optionElement.value = option; optionElement.text = option; selectElement.add(optionElement, null); } } + selectElement = document.getElementById("aging-enabled"); + optionElement = document.createElement("option"); + optionElement.value = "true"; + optionElement.text = "Enabled"; + selectElement.add(optionElement, null); + optionElement = document.createElement("option"); + optionElement.value = "false"; + optionElement.text = "Disabled"; + selectElement.add(optionElement, null); }; const isValue = (obj) => @@ -975,6 +1041,12 @@

if (typeof oldValue === "number") { return parseFloat(event.target.value); } + if ( + typeof oldValue === "boolean" && + typeof event.target.value !== "boolean" + ) { + return event.target.value === "true"; + } if (typeof oldValue === "boolean") { return event.target.checked; } @@ -1008,8 +1080,7 @@

} document.getElementById("randomize").addEventListener("click", () => { - const oldFace = face; - face = randomizeFace(oldFace, faces.generate()); + face = randomizeFace(face, faces.generate()); initializeFormValues(); updateDisplay(); }); From 228855731aca14b2a5c87bd2b86b3f6129463c15 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 07:40:51 -0700 Subject: [PATCH 02/13] modified age input min/max/step --- public/editor.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/editor.html b/public/editor.html index 3be21071..3f64ba4b 100644 --- a/public/editor.html +++ b/public/editor.html @@ -244,9 +244,9 @@

type="number" class="form-control" id="aging-age" - min=".5" - max="1.5" - step="0.01" + min="18" + max="40" + step="1" />

From 22ee2281e1f2a13d3ee836b72e7d7ddbbe9def2f Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 09:01:14 -0700 Subject: [PATCH 03/13] implemented aging --- src/display.ts | 41 ++++++++++++++++++++++++++++++++++++++++- src/generate.ts | 4 ++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/display.ts b/src/display.ts index f5721c38..b2857368 100644 --- a/src/display.ts +++ b/src/display.ts @@ -98,11 +98,28 @@ type FeatureInfo = { }; const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { - const feature = face[info.name]; + const feature = Object.assign({}, face[info.name]); if (!feature || !svgs[info.name]) { return; } + if ( + face.aging.enabled && + info.name === "hair" && + feature.id === "short-bald" && + face.aging.age < 30 + ) { + feature.id = "short2"; + } + if ( + face.aging.enabled && + info.name === "miscLine" && + feature.id === "none" && + face.aging.age >= 34 + ) { + feature.id = "forehead3"; + } + // @ts-ignore let featureSVGString = svgs[info.name][feature.id]; if (!featureSVGString) { @@ -311,6 +328,28 @@ const display = ( ]; for (const info of featureInfos) { + if (face.aging.enabled) { + if ( + info.name === "miscLine" && + face.aging.age >= 22 && + face.miscLine.id.startsWith("freckles") + ) + continue; + if ( + info.name === "miscLine" && + face.aging.age < 25 && + face.miscLine.id.startsWith("chin") + ) + continue; + if (info.name === "smileLine" && face.aging.age < 27) continue; + if (info.name === "eyeLine" && face.aging.age < 30) continue; + if ( + info.name === "miscLine" && + face.aging.age < 34 && + face.miscLine.id.startsWith("forehead") + ) + continue; + } drawFeature(svg, face, info); } }; diff --git a/src/generate.ts b/src/generate.ts index 5847a315..0ca324d3 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -75,6 +75,10 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { const isFlipped = Math.random() < 0.5; const face = { + aging: { + enabled: Math.random() < 0.5, + age: Math.floor(Math.random() * 23 + 18), + }, fatness: roundTwoDecimals(Math.random()), teamColors: defaultTeamColors, hairBg: { From a83c3a377c056a6bc85748f8cb69ca7966dfe9fc Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 09:27:23 -0700 Subject: [PATCH 04/13] added lines for backwards compatability (no aging key) --- src/display.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/display.ts b/src/display.ts index b2857368..7e76cea5 100644 --- a/src/display.ts +++ b/src/display.ts @@ -104,6 +104,7 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { } if ( + face.aging && face.aging.enabled && info.name === "hair" && feature.id === "short-bald" && @@ -112,6 +113,7 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { feature.id = "short2"; } if ( + face.aging && face.aging.enabled && info.name === "miscLine" && feature.id === "none" && @@ -328,7 +330,7 @@ const display = ( ]; for (const info of featureInfos) { - if (face.aging.enabled) { + if (face.aging && face.aging.enabled) { if ( info.name === "miscLine" && face.aging.age >= 22 && From 2dd6e5f5d1e0b466b50cd51c0b1d3e53e36c90f9 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 13:07:41 -0700 Subject: [PATCH 05/13] added shave to aging process --- src/display.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/display.ts b/src/display.ts index 7e76cea5..a18e37e0 100644 --- a/src/display.ts +++ b/src/display.ts @@ -130,14 +130,14 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { // @ts-ignore if (feature.shave) { + let shave; + if (face.aging && face.aging.enabled && face.aging.age > 23) + shave = feature.shave; + else shave = "rgba(0,0,0,0)"; // @ts-ignore - featureSVGString = featureSVGString.replace("$[faceShave]", feature.shave); - } - - // @ts-ignore - if (feature.shave) { + featureSVGString = featureSVGString.replace("$[faceShave]", shave); // @ts-ignore - featureSVGString = featureSVGString.replace("$[headShave]", feature.shave); + featureSVGString = featureSVGString.replace("$[headShave]", shave); } featureSVGString = featureSVGString.replace("$[skinColor]", face.body.color); From d891d7d4923c36dd340828768b8cdd48f02c6c34 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 13:17:07 -0700 Subject: [PATCH 06/13] added shave to aging process --- src/display.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/display.ts b/src/display.ts index a18e37e0..de0a0f59 100644 --- a/src/display.ts +++ b/src/display.ts @@ -131,9 +131,10 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { // @ts-ignore if (feature.shave) { let shave; - if (face.aging && face.aging.enabled && face.aging.age > 23) - shave = feature.shave; - else shave = "rgba(0,0,0,0)"; + if (face.aging && face.aging.enabled) + if (face.aging.age > 23) shave = feature.shave; + else shave = "rgba(0,0,0,0)"; + else shave = feature.shave; // @ts-ignore featureSVGString = featureSVGString.replace("$[faceShave]", shave); // @ts-ignore From a23084f5fbdbeb9ca2d7234fd78504c038b9bc89 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 17 Mar 2021 17:40:09 -0700 Subject: [PATCH 07/13] refactored svg folder to svgs in process-svgs.js --- tools/process-svgs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/process-svgs.js b/tools/process-svgs.js index 89c5b303..de262881 100644 --- a/tools/process-svgs.js +++ b/tools/process-svgs.js @@ -15,11 +15,13 @@ const processSVGs = async () => { const svgs = {}; for (const folder of folders) { + if (folder === ".DS_Store") continue; svgs[folder] = {}; const subfolder = path.join(svgFolder, folder); const files = fs.readdirSync(subfolder); for (const file of files) { + if (file === ".DS_Store") continue; const key = path.basename(file, ".svg"); const contents = fs.readFileSync(path.join(subfolder, file), "utf8"); @@ -38,7 +40,7 @@ const processSVGs = async () => { ); const svgsIndex = { - ...svgs + ...svgs, }; for (const key of Object.keys(svgsIndex)) { svgsIndex[key] = Object.keys(svgsIndex[key]); From a6e335e826c2dd6809e11948c588336c290d2275 Mon Sep 17 00:00:00 2001 From: gtabot Date: Sun, 21 Mar 2021 18:12:16 -0700 Subject: [PATCH 08/13] must specify aging enabled/disabled; generate() respects aging.enabled and selects aging lines --- public/editor.html | 18 ++++++++---------- src/generate.ts | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/public/editor.html b/public/editor.html index 3f64ba4b..26d1ffa4 100644 --- a/public/editor.html +++ b/public/editor.html @@ -226,13 +226,7 @@

- +  
@@ -946,13 +940,13 @@

let face; if (location.hash.length <= 1) { - face = faces.generate(); + face = faces.generate({ aging: { enabled: true } }); } else { try { face = JSON.parse(atob(location.hash.slice(1))); } catch (error) { console.error(error); - face = faces.generate(); + face = faces.generate({ aging: { enabled: true } }); } } @@ -998,6 +992,7 @@

} selectElement = document.getElementById("aging-enabled"); optionElement = document.createElement("option"); + optionElement.selected = true; optionElement.value = "true"; optionElement.text = "Enabled"; selectElement.add(optionElement, null); @@ -1080,7 +1075,10 @@

} document.getElementById("randomize").addEventListener("click", () => { - face = randomizeFace(face, faces.generate()); + face = randomizeFace( + face, + faces.generate({ aging: { enabled: face.aging.enabled } }) + ); initializeFormValues(); updateDisplay(); }); diff --git a/src/generate.ts b/src/generate.ts index 0ca324d3..377f7819 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -74,11 +74,18 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { palette.hair[Math.floor(Math.random() * palette.hair.length)]; const isFlipped = Math.random() < 0.5; - const face = { - aging: { + let aging; + if (overrides && overrides.aging) { + aging = overrides.aging; + // @ts-ignore + if (!overrides.aging.age) aging.age = Math.floor(Math.random() * 16 + 19); + } else + aging = { enabled: Math.random() < 0.5, - age: Math.floor(Math.random() * 23 + 18), - }, + age: Math.floor(Math.random() * 16 + 19), + }; + const face = { + aging: aging, fatness: roundTwoDecimals(Math.random()), teamColors: defaultTeamColors, hairBg: { @@ -102,14 +109,17 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { })`, }, eyeLine: { - id: Math.random() < 0.75 ? getID("eyeLine") : "none", + // @ts-ignore + id: aging.enabled || Math.random() < 0.75 ? getID("eyeLine") : "none", }, smileLine: { - id: Math.random() < 0.75 ? getID("smileLine") : "none", + // @ts-ignore + id: aging.enabled || Math.random() < 0.75 ? getID("smileLine") : "none", size: roundTwoDecimals(0.25 + 2 * Math.random()), }, miscLine: { - id: Math.random() < 0.5 ? getID("miscLine") : "none", + // @ts-ignore + id: aging.enabled || Math.random() < 0.5 ? getID("miscLine") : "none", }, facialHair: { id: Math.random() < 0.5 ? getID("facialHair") : "none", From 298895ed276809d8f1ddee8a1e9a0c68dffc5b73 Mon Sep 17 00:00:00 2001 From: gtabot Date: Sun, 21 Mar 2021 18:36:58 -0700 Subject: [PATCH 09/13] implemented maturity; require age lines to not be none when aging enabled --- public/editor.html | 24 ++++++++++++++++++++++++ src/display.ts | 27 +++++++++++---------------- src/generate.ts | 29 +++++++++++++++++++++++------ 3 files changed, 58 insertions(+), 22 deletions(-) diff --git a/public/editor.html b/public/editor.html index 26d1ffa4..aefddf63 100644 --- a/public/editor.html +++ b/public/editor.html @@ -253,6 +253,30 @@

/>

+
+
+ +
+
+ +
+
+ +
+
diff --git a/src/display.ts b/src/display.ts index de0a0f59..03345d21 100644 --- a/src/display.ts +++ b/src/display.ts @@ -102,7 +102,6 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { if (!feature || !svgs[info.name]) { return; } - if ( face.aging && face.aging.enabled && @@ -112,15 +111,6 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { ) { feature.id = "short2"; } - if ( - face.aging && - face.aging.enabled && - info.name === "miscLine" && - feature.id === "none" && - face.aging.age >= 34 - ) { - feature.id = "forehead3"; - } // @ts-ignore let featureSVGString = svgs[info.name][feature.id]; @@ -132,7 +122,7 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { if (feature.shave) { let shave; if (face.aging && face.aging.enabled) - if (face.aging.age > 23) shave = feature.shave; + if (face.aging.age + face.aging.maturity > 23) shave = feature.shave; else shave = "rgba(0,0,0,0)"; else shave = feature.shave; // @ts-ignore @@ -334,21 +324,26 @@ const display = ( if (face.aging && face.aging.enabled) { if ( info.name === "miscLine" && - face.aging.age >= 22 && + face.aging.age + face.aging.maturity >= 22 && face.miscLine.id.startsWith("freckles") ) continue; if ( info.name === "miscLine" && - face.aging.age < 25 && + face.aging.age + face.aging.maturity < 25 && face.miscLine.id.startsWith("chin") ) continue; - if (info.name === "smileLine" && face.aging.age < 27) continue; - if (info.name === "eyeLine" && face.aging.age < 30) continue; + if ( + info.name === "smileLine" && + face.aging.age + face.aging.maturity < 27 + ) + continue; + if (info.name === "eyeLine" && face.aging.age + face.aging.maturity < 30) + continue; if ( info.name === "miscLine" && - face.aging.age < 34 && + face.aging.age + face.aging.maturity < 34 && face.miscLine.id.startsWith("forehead") ) continue; diff --git a/src/generate.ts b/src/generate.ts index 377f7819..6cb03aaf 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -1,9 +1,13 @@ import override, { Overrides } from "./override"; import svgsIndex from "./svgs-index"; -const getID = (type: string): string => { - // @ts-ignore - return svgsIndex[type][Math.floor(Math.random() * svgsIndex[type].length)]; +const getID = (type: string, canBeNone?: true): string => { + let id; + do { + // @ts-ignore + id = svgsIndex[type][Math.floor(Math.random() * svgsIndex[type].length)]; + } while (!canBeNone && id == "none"); + return id; }; type Race = "asian" | "black" | "brown" | "white"; @@ -79,10 +83,14 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { aging = overrides.aging; // @ts-ignore if (!overrides.aging.age) aging.age = Math.floor(Math.random() * 16 + 19); + // @ts-ignore + if (!overrides.aging.maturity) + aging.maturity = Math.floor(Math.random() * 5 - 1); } else aging = { enabled: Math.random() < 0.5, age: Math.floor(Math.random() * 16 + 19), + maturity: Math.floor(Math.random() * 5 - 1), }; const face = { aging: aging, @@ -110,16 +118,25 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { }, eyeLine: { // @ts-ignore - id: aging.enabled || Math.random() < 0.75 ? getID("eyeLine") : "none", + id: + aging.enabled || Math.random() < 0.75 + ? getID("eyeLine", !aging.enabled) + : "none", }, smileLine: { // @ts-ignore - id: aging.enabled || Math.random() < 0.75 ? getID("smileLine") : "none", + id: + aging.enabled || Math.random() < 0.75 + ? getID("smileLine", !aging.enabled) + : "none", size: roundTwoDecimals(0.25 + 2 * Math.random()), }, miscLine: { // @ts-ignore - id: aging.enabled || Math.random() < 0.5 ? getID("miscLine") : "none", + id: + aging.enabled || Math.random() < 0.5 + ? getID("miscLine", !aging.enabled) + : "none", }, facialHair: { id: Math.random() < 0.5 ? getID("facialHair") : "none", From 851aeddbfba575f33e6a2ca9d63ba178b81c68c7 Mon Sep 17 00:00:00 2001 From: gtabot Date: Sun, 21 Mar 2021 18:41:35 -0700 Subject: [PATCH 10/13] aging enabled by default if not specified --- src/generate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generate.ts b/src/generate.ts index 6cb03aaf..21dae51e 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -88,7 +88,7 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { aging.maturity = Math.floor(Math.random() * 5 - 1); } else aging = { - enabled: Math.random() < 0.5, + enabled: true, age: Math.floor(Math.random() * 16 + 19), maturity: Math.floor(Math.random() * 5 - 1), }; From c3973515d50e42d5a5acd769a7ea659df3d86c30 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 24 Mar 2021 17:00:16 -0700 Subject: [PATCH 11/13] now aging hairstyles --- public/editor.html | 2 +- src/display.ts | 72 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/public/editor.html b/public/editor.html index aefddf63..1a320c86 100644 --- a/public/editor.html +++ b/public/editor.html @@ -427,7 +427,7 @@

{ + let hash = 0; + for (let i = 0; i < str.length; i++) { + const character = str.charCodeAt(i); + hash = (hash << 5) - hash + character; + hash = hash & hash; // Convert to 32bit integer + } + return Math.abs(hash); +}; + +const deterministicRandom = (face: Face) => { + const hash = + hashCode(face.body.id) + + hashCode(face.body.color) + + hashCode(face.head.id) + + hashCode("" + face.fatness) + + hashCode(face.hair.id) + + hashCode(face.hair.color); + return (hash % 1000) / 1000; +}; + +const ageHair = (hairId: String) => { + switch (hairId) { + case "afro": + return "short"; + case "afro2": + return "short"; + case "blowoutFade": + return "cropFade2"; + case "cornrows": + return "short-fade"; + case "curly3": + return "short3"; + case "dreads": + return "short-fade"; + case "emo": + return "short2"; + case "faux-hawk": + return "short3"; + case "fauxhawk-fade": + return "short-fade"; + case "high": + return "short"; + case "juice": + return "short2"; + case "longHair": + return "short-fade"; + case "shaggy2": + return "shaggy1"; + case "short-bald": + return "short-bald"; + case "shortBangs": + return "short-bald"; + case "spike2": + return "short2"; + case "spike3": + return "short2"; + case "spike4": + return "short2"; + case "tall-fade": + return "crop-fade"; + default: + return "short-fade"; + } +}; + const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { const feature = Object.assign({}, face[info.name]); if (!feature || !svgs[info.name]) { @@ -106,10 +172,10 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { face.aging && face.aging.enabled && info.name === "hair" && - feature.id === "short-bald" && - face.aging.age < 30 + face.aging.age + face.aging.maturity / 2 >= 30 && + deterministicRandom(face) < 0.5 ) { - feature.id = "short2"; + feature.id = ageHair(feature.id); } // @ts-ignore From 71054962ae6eabdf3e029ce6cc42dce6a72ed390 Mon Sep 17 00:00:00 2001 From: gtabot Date: Wed, 24 Mar 2021 17:15:13 -0700 Subject: [PATCH 12/13] removed long hair as player ages --- src/display.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/display.ts b/src/display.ts index ea3892a0..c4f6e723 100644 --- a/src/display.ts +++ b/src/display.ts @@ -168,14 +168,19 @@ const drawFeature = (svg: SVGSVGElement, face: Face, info: FeatureInfo) => { if (!feature || !svgs[info.name]) { return; } - if ( - face.aging && - face.aging.enabled && - info.name === "hair" && - face.aging.age + face.aging.maturity / 2 >= 30 && - deterministicRandom(face) < 0.5 - ) { - feature.id = ageHair(feature.id); + if (face.aging && face.aging.enabled) { + if ( + info.name === "hair" && + face.aging.age + face.aging.maturity / 2 >= 30 && + deterministicRandom(face) < 0.5 + ) + feature.id = ageHair(feature.id); + else if ( + info.name === "hairBg" && + face.aging.age + face.aging.maturity / 2 >= 27 && + deterministicRandom(face) < 0.75 + ) + feature.id = "none"; } // @ts-ignore From 6f5a62b8c068fc4e5d0d12bb1fa9eb581251e036 Mon Sep 17 00:00:00 2001 From: gtabot Date: Sat, 27 Mar 2021 19:56:03 -0700 Subject: [PATCH 13/13] changed range for maturity to [-2, 2] --- .idea/.gitignore | 5 +++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++++ .idea/facesjs.iml | 12 ++++++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ src/display.ts | 8 +++++--- src/generate.ts | 2 +- 7 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/facesjs.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/facesjs.iml b/.idea/facesjs.iml new file mode 100644 index 00000000..0c8867d7 --- /dev/null +++ b/.idea/facesjs.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..42e034d7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/display.ts b/src/display.ts index c4f6e723..eadca995 100644 --- a/src/display.ts +++ b/src/display.ts @@ -150,12 +150,14 @@ const ageHair = (hairId: String) => { return "short-bald"; case "shortBangs": return "short-bald"; + case "spike": + return "short"; case "spike2": - return "short2"; + return "short"; case "spike3": - return "short2"; + return "short"; case "spike4": - return "short2"; + return "short"; case "tall-fade": return "crop-fade"; default: diff --git a/src/generate.ts b/src/generate.ts index 21dae51e..eff6656a 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -85,7 +85,7 @@ const generate = (overrides?: Overrides, options?: { race?: Race }) => { if (!overrides.aging.age) aging.age = Math.floor(Math.random() * 16 + 19); // @ts-ignore if (!overrides.aging.maturity) - aging.maturity = Math.floor(Math.random() * 5 - 1); + aging.maturity = Math.floor(Math.random() * 5 - 2); } else aging = { enabled: true,