Skip to content

Commit

Permalink
feat: Phobia generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Starciad committed Jan 28, 2024
1 parent 467967a commit 96fc706
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 2 deletions.
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<script src="scripts/collections/background/significant_people_collection.js" type="module"></script>
<script src="scripts/collections/background/important_locations_collection.js" type="module"></script>
<script src="scripts/collections/background/characteristics_collection.js" type="module"></script>
<script src="scripts/collections/background/phobias_collection.js" type="module"></script>
<!-- #endregion -->

<!-- Core -->
Expand Down Expand Up @@ -873,12 +874,18 @@ <h3>Description</h3>
<!-- Phobias -->
<div>
<h2>Phobias</h2>
<p>Empty.</p>

<h3>Collection</h3>
<div class="app-items-collection" id="cs-background-phobias-collection">
<!-- PROCEDURAL LIST -->
</div>
</div>

<!-- Manias -->
<div>
<h2>Manias</h2>

<h3>Listing</h3>
<p>Empty.</p>
</div>
</section>
Expand Down
110 changes: 110 additions & 0 deletions scripts/collections/background/phobias_collection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { Random } from "../../math/random.js";

export const PhobiasCollection = Object.freeze({
phobias: [
{ name: "Ablutophobia", description: "Fear of washing or bathing." },
{ name: "Acrophobia", description: "Fear of heights." },
{ name: "Aerophobia", description: "Fear of flying." },
{ name: "Afefobia", description: "Fear of being touched." },
{ name: "Agoraphobia", description: "Fear of open public spaces (crowded)." },
{ name: "Alectorophobia", description: "Fear of chickens." },
{ name: "Alliumphobia", description: "Fear of garlic." },
{ name: "Amaxophobia", description: "Fear of being inside vehicles or driving them." },
{ name: "Ancraophobia", description: "Fear of wind." },
{ name: "Androphobia", description: "Fear of men." },
{ name: "Anglophobia", description: "Fear of England or English culture, etc." },
{ name: "Anthophobia", description: "Fear of flowers." },
{ name: "Apotemnophobia", description: "Fear of people with amputated limbs." },
{ name: "Arachnophobia", description: "Fear of spiders." },
{ name: "Astraphobia", description: "Fear of lightning." },
{ name: "Atephobia", description: "Fear of ruins." },
{ name: "Aulophobia", description: "Fear of flutes." },
{ name: "Bacteriophobia", description: "Fear of bacteria." },
{ name: "Ballistophobia", description: "Fear of projectiles or bullets." },
{ name: "Basophobia", description: "Fear of falling." },
{ name: "Bibliophobia", description: "Fear of books." },
{ name: "Botanophobia", description: "Fear of plants." },
{ name: "Caligynephobia", description: "Fear of beautiful women." },
{ name: "Ceraunophobia", description: "Fear of thunder." },
{ name: "Cheimaphobia", description: "Fear of cold." },
{ name: "Cynophobia", description: "Fear of dogs." },
{ name: "Claustrophobia", description: "Fear of enclosed or small spaces." },
{ name: "Coulrophobia", description: "Fear of clowns." },
{ name: "Chronomentrophobia", description: "Fear of clocks." },
{ name: "Demophobia", description: "Fear of crowds." },
{ name: "Demonophobia", description: "Fear of spirits or demons." },
{ name: "Dentophobia", description: "Fear of dentists." },
{ name: "Disposophobia", description: "Fear of throwing things away (hoarding)." },
{ name: "Doraphobia", description: "Fear of animal skins." },
{ name: "Dromophobia", description: "Fear of crossing streets." },
{ name: "Ecclesiophobia", description: "Fear of churches." },
{ name: "Eisoptrophobia", description: "Fear of mirrors." },
{ name: "Enetophobia", description: "Fear of needles or pins." },
{ name: "Entomophobia", description: "Fear of insects." },
{ name: "Scotophobia", description: "Fear of darkness or night." },
{ name: "Stenophobia", description: "Fear of narrow things or places." },
{ name: "Phagophobia", description: "Fear of swallowing, eating, or being eaten." },
{ name: "Pharmacophobia", description: "Fear of taking medicines." },
{ name: "Spectrophobia", description: "Fear of ghosts." },
{ name: "Ailurophobia", description: "Fear of cats." },
{ name: "Phengophobia", description: "Fear of daylight." },
{ name: "Gephyrophobia", description: "Fear of crossing bridges." },
{ name: "Gerontophobia", description: "Fear of old people or aging." },
{ name: "Gynophobia", description: "Fear of women." },
{ name: "Hamartophobia", description: "Fear of sinning." },
{ name: "Hemophobia", description: "Fear of blood." },
{ name: "Herpetophobia", description: "Fear of reptiles." },
{ name: "Hydrophobia", description: "Fear of water." },
{ name: "Hypnophobia", description: "Fear of sleeping or being hypnotized." },
{ name: "Homichlophobia", description: "Fear of fog." },
{ name: "Hoplophobia", description: "Fear of firearms." },
{ name: "Iatrophobia", description: "Fear of doctors." },
{ name: "Ichthyophobia", description: "Fear of fish." },
{ name: "Katsaridaphobia", description: "Fear of cockroaches." },
{ name: "Lachanophobia", description: "Fear of vegetables." },
{ name: "Ligyrophobia", description: "Fear of loud noises." },
{ name: "Limnophobia", description: "Fear of lakes." },
{ name: "Mechanophobia", description: "Fear of machines or machinery." },
{ name: "Megalophobia", description: "Fear of large things." },
{ name: "Merinthophobia", description: "Fear of being tied up." },
{ name: "Meteorophobia", description: "Fear of meteors or meteorites." },
{ name: "Mysophobia", description: "Fear of dirt or contamination." },
{ name: "Mixophobia", description: "Fear of sticky substances." },
{ name: "Monophobia", description: "Fear of being alone." },
{ name: "Necrophobia", description: "Fear of dead things." },
{ name: "Octophobia", description: "Fear of the number 8." },
{ name: "Odontophobia", description: "Fear of teeth." },
{ name: "Ophidiophobia", description: "Fear of snakes." },
{ name: "Oneirophobia", description: "Fear of dreams." },
{ name: "Onomatophobia", description: "Fear of hearing a certain word or words." },
{ name: "Ornithophobia", description: "Fear of birds." },
{ name: "Parasitophobia", description: "Fear of parasites." },
{ name: "Pediophobia", description: "Fear of dolls." },
{ name: "Pyrophobia", description: "Fear of fire." },
{ name: "Pogonophobia", description: "Fear of beards." },
{ name: "Potamophobia", description: "Fear of rivers." },
{ name: "Potophobia", description: "Fear of alcohol or alcoholic beverages." },
{ name: "Rabdophobia", description: "Fear of magic." },
{ name: "Selenophobia", description: "Fear of the moon." },
{ name: "Siderodromophobia", description: "Fear of traveling by train." },
{ name: "Siderophobia", description: "Fear of stars." },
{ name: "Symmetrophobia", description: "Fear of symmetry." },
{ name: "Taphophobia", description: "Fear of being buried alive or cemeteries." },
{ name: "Thalassophobia", description: "Fear of the sea." },
{ name: "Taurophobia", description: "Fear of bulls." },
{ name: "Telephonophobia", description: "Fear of telephones." },
{ name: "Teratophobia", description: "Fear of monsters." },
{ name: "Tomophobia", description: "Fear of surgical operations." },
{ name: "Triskaidekaphobia", description: "Fear of the number 13." },
{ name: "Vestiphobia", description: "Fear of clothing." },
{ name: "Wiccaphobia", description: "Fear of witches and witchcraft." },
{ name: "Xanthophobia", description: "Fear of the color yellow or the word 'yellow'." },
{ name: "Xenophobia", description: "Fear of strangers or foreigners." },
{ name: "Xenoglossophobia", description: "Fear of foreign languages." },
{ name: "Zoophobia", description: "Fear of animals." }
],

getRandomPhobia: function () {
return Random.getRandomArrayElement(this.phobias);
},
});
39 changes: 38 additions & 1 deletion scripts/generator/routine/scsg_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { IntensityCollection } from "../../collections/special/intensity_collect
import { Random } from "../../math/random.js";
import { BelovedBelongingsCollection } from "../../collections/background/beloved_belongings_collection.js";
import { CharacteristicsCollection } from "../../collections/background/characteristics_collection.js";
import { PhobiasCollection } from "../../collections/background/phobias_collection.js";

//#endregion

Expand Down Expand Up @@ -69,6 +70,7 @@ export function SCSGData(settings) {
let char_background_important_location = backgroundGenerator.getRandomImportantLocation();
let char_background_dear_belongings = backgroundGenerator.getRandomDarlingBelonging();
let char_background_dear_characteristic = backgroundGenerator.getRandomCharacteristic();
let char_background_dear_phobias = backgroundGenerator.getRandomPhobias();
//#endregion

return {
Expand Down Expand Up @@ -157,7 +159,9 @@ export function SCSGData(settings) {

characteristics: {
target: char_background_dear_characteristic
}
},

phobias: char_background_dear_phobias,
},
};
}
Expand Down Expand Up @@ -333,5 +337,38 @@ const backgroundGenerator = Object.freeze({
getRandomCharacteristic: function () {
return CharacteristicsCollection.getRandomCharacteristic();
},

getRandomPhobias: function () {
let phobias = [];
let phobiasAndIntensity = [];

let count = Random.getRandomNumber(0, 5);

for (let i = 0; i < count; i++) {
let phobiaSelected = PhobiasCollection.getRandomPhobia();

if (phobias.includes(phobiaSelected)) {
continue;
}

phobias.push(phobiaSelected);
}

phobias.forEach(phobia => {
let intensitySelected;

do {
intensitySelected = IntensityCollection.getRandomIntensity();
} while (intensitySelected === "None");

phobiasAndIntensity.push({
name: phobia.name,
description: phobia.description,
intensity: intensitySelected
});
});

return phobiasAndIntensity;
},
});
//#endregion
33 changes: 33 additions & 0 deletions scripts/generator/routine/scsg_updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ let cs_background_significant_people_reason;
let cs_background_important_location;
let cs_background_dear_belongings;
let cs_background_characteristic;
let cs_background_phobias_collection;

// ======================================== //
// Main
Expand Down Expand Up @@ -72,6 +73,7 @@ export function SCSGQueryElements() {
cs_background_important_location = document.querySelector("#cs-background-important-location");
cs_background_dear_belongings = document.querySelector("#cs-background-dear-belongings");
cs_background_characteristic = document.querySelector("#cs-background-characteristic");
cs_background_phobias_collection = document.querySelector("#cs-background-phobias-collection");
}

export function SCSGUpdater(characterInfos) {
Expand Down Expand Up @@ -152,6 +154,37 @@ function updateBackground(characterInfos) {

// Characteristics
cs_background_characteristic.innerHTML = characterInfos.background.characteristics.target;

// Phobias
cs_background_phobias_collection.replaceChildren();

if (characterInfos.background.phobias.length > 0) {
characterInfos.background.phobias.forEach(phobia => {
let phobia_item = document.createElement("div");
let title = document.createElement("span");
let description = document.createElement("span");

phobia_item.classList.add("app-item-square");
title.classList.add("app-item-square-title");
description.classList.add("app-item-square-description");

phobia_item.appendChild(title);
phobia_item.appendChild(description);

title.innerHTML = `${phobia.name} (${phobia.intensity})`;
description.innerHTML = phobia.description;

cs_background_phobias_collection.appendChild(phobia_item);
});
}
else {
let empty_item = document.createElement("div");
empty_item.classList.add("app-item-square");

empty_item.innerHTML = "The character does not have phobias.";

cs_background_phobias_collection.appendChild(empty_item);
}
}

// ================================ //
Expand Down
33 changes: 33 additions & 0 deletions styles/core/elements/app_elements.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,37 @@
margin-left: 16px;

font-size: 120%;
}

/* COLLECTION */
.app-items-collection {
display: flex;
flex-wrap: wrap;
gap: 10px;

width: 100%;
height: auto;
}

.app-item-square {
display: flex;
flex-direction: column;

width: auto;
height: auto;

background-color: #2b2d31;

padding: 16px;

border-radius: 16px;
}

.app-item-square-title {
font-size: 18px;
font-weight: bolder;
}

.app-item-square-description {
text-align: justify;
}

0 comments on commit 96fc706

Please sign in to comment.