Skip to content

Commit

Permalink
feat: Add body type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Starciad committed Jan 24, 2024
1 parent 92aca4c commit 758d527
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<script src="scripts/collections/physical/BloodTypeCollection.js" type="module"></script>
<script src="scripts/collections/physical/HeightCollection.js" type="module"></script>
<script src="scripts/collections/physical/WeightCollection.js" type="module"></script>
<script src="scripts/collections/physical/BodyTypeCollection.js" type="module"></script>

<script src="scripts/collections/appearance/SkinToneCollection.js" type="module"></script>

Expand Down Expand Up @@ -210,6 +211,10 @@ <h2 align="center">Spark your imagination by creating unique characters</h2>
<td>Blood Type</td>
<td id="cs-physical-blood-type">Empty</td>
</tr>
<tr>
<td>Body Type</td>
<td id="cs-physical-body-type">Empty</td>
</tr>
</tbody>
</table>

Expand Down
13 changes: 13 additions & 0 deletions scripts/collections/physical/BodyTypeCollection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { random } from "../../math/random.js";

export const BodyTypeCollection = Object.freeze({
bodyTypes: [
"Ectomorph",
"Mesomorph",
"Endomorph"
],

getRandomBodyType: function () {
return random.getRandomArrayElement(this.bodyTypes);
},
});
28 changes: 24 additions & 4 deletions scripts/core/dataGenerator.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import { BloodTypeCollection } from "../collections/physical/BloodTypeCollection.js";
//#region IMPORTS
// Names
import { EUANamesCollection } from "../collections/names/EUANamesCollection.js";

// General
import { OccupationsCollection } from "../collections/general/OccupationsCollection.js";
import { CivilStatusCollection } from "../collections/general/CivilStatusCollection.js";
import { CountriesCollection } from "../collections/general/CountriesCollection.js";

// Physical
import { BloodTypeCollection } from "../collections/physical/BloodTypeCollection.js";
import { HeightCollection } from "../collections/physical/HeightCollection.js";
import { EUANamesCollection } from "../collections/names/EUANamesCollection.js";
import { OccupationsCollection } from "../collections/general/OccupationsCollection.js";
import { WeightCollection } from "../collections/physical/WeightCollection.js";
import { BodyTypeCollection } from "../collections/physical/BodyTypeCollection.js";

// Appearance
import { SkinToneCollection } from "../collections/appearance/SkinToneCollection.js";

// Math
import { random } from "../math/random.js";

// Core
import { updateCharacterSheetTable } from "./pageUpdater.js";
import { SkinToneCollection } from "../collections/appearance/SkinToneCollection.js";
//#endregion

export function SCSGenerator(nameStyleType, sexType, ageRangeType) {
// General
Expand All @@ -25,6 +39,7 @@ export function SCSGenerator(nameStyleType, sexType, ageRangeType) {
let char_weight = getRandomWeight(char_age);
let char_blood_type = getRandomBloodType();
let char_rh_factor = getRandomRhFactor();
let char_body_type = getRandomBodyType();

// Appearance
let char_appearance_skin_tone = getRandomSkinTone();
Expand All @@ -46,6 +61,7 @@ export function SCSGenerator(nameStyleType, sexType, ageRangeType) {
weight: char_weight,
bloodType: char_blood_type,
rhFactor: char_rh_factor,
bodyType: char_body_type,

// Appearance
skinTone: char_appearance_skin_tone,
Expand Down Expand Up @@ -161,6 +177,10 @@ function getRandomBloodType() {
function getRandomRhFactor() {
return BloodTypeCollection.getRandomRhFactor();
}

function getRandomBodyType() {
return BodyTypeCollection.getRandomBodyType();
}
//#endregion

//#region Appearance
Expand Down
2 changes: 1 addition & 1 deletion scripts/core/pageUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export function updateCharacterSheetTable(characterInfos) {
document.querySelector("#cs-physical-height").innerHTML = characterInfos.height;
document.querySelector("#cs-physical-weight").innerHTML = characterInfos.weight;
document.querySelector("#cs-physical-blood-type").innerHTML = characterInfos.bloodType + characterInfos.rhFactor;
document.querySelector("#cs-physical-body-type").innerHTML = characterInfos.bodyType;

// Appearance
document.querySelector("#cs-appearance-skin-tone").innerHTML = characterInfos.skinTone;

}

function getFormattedDate(date) {
Expand Down

0 comments on commit 758d527

Please sign in to comment.