about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2024-05-13 09:57:10 -0400
committerelioat <elioat@tilde.institute>2024-05-13 09:57:10 -0400
commitc356ffb437e953122730ca23c7404f78fa2e714c (patch)
treeda689c60a65cc0b0d2197f817fe92a60864d4a63
parent628411e777bb5ed25b49ad67e8c897c1891a4223 (diff)
downloadtour-c356ffb437e953122730ca23c7404f78fa2e714c.tar.gz
*
-rw-r--r--js/princess/game.js53
1 files changed, 47 insertions, 6 deletions
diff --git a/js/princess/game.js b/js/princess/game.js
index 0415b70..aab427c 100644
--- a/js/princess/game.js
+++ b/js/princess/game.js
@@ -25,15 +25,38 @@ const prettyTimeFromNow = (time) => {
     return `${hours} ${hoursText} and ${minutes} ${minutesText}`;
 }
 
+const addPartyPerson = (person) => {
+    if (princess.party.length < 5 && !princess.party.includes(person)) {
+        princess.party.push(person);
+    }
+}
+
+const removePartyPerson = (person) => {
+    if (princess.party.includes(person)) {
+        princess.party = princess.party.filter(p => p !== person);
+    }
+}
+
+const levelUpPrincess = (stat, amount) => {
+    princess[stat] += amount;
+}
+
+const levelUpPartyMember = (person, stat, amount) => {
+    if (princess.party.includes(person) && typeof person[stat] === 'number') {
+        person[stat] += amount;
+    }
+};
+
+// the player character
 let princess = {
     finery: 10,
     knowledge: 10,
     spider: 100,
-    treasure: 100
+    treasure: 100,
+    party: [] // the princesses party of people (an array may not make sense for this, since I'd like to limit it's max size, but maybe I can have a bounding function)
 }
 
-let party = []
-
+// the people the player can recruit
 let people = [
     {
         name: "Hawk",
@@ -41,7 +64,8 @@ let people = [
         aspiration: "To be a knight.",
         power: 1,
         speed: 1,
-        spider: 2
+        spider: 2,
+        loyalty: 3 // loyalty increases whenever the princess pays a person
     },
     {
         name: "Bella",
@@ -49,7 +73,8 @@ let people = [
         aspiration: "To be a pirate.",
         power: 2,
         speed: 2,
-        spider: 1
+        spider: 1,
+        loyalty: 3
     },
     {
         name: "Silver Teeth in the Moonlight, aka Teeth",
@@ -57,6 +82,22 @@ let people = [
         aspiration: "To be the dentist for a king.",
         power: 2,
         speed: 5,
-        spider: 1
+        spider: 1,
+        loyalty: 3
+    }
+]
+
+let quests = [
+    {
+        name: "The Spider of the Silver Forest",
+        description: "The princess must defeat the spider of the silver forest.",
+        reward: "The treasure of the silver forest.",
+        duration: 2 * HOUR
+    },
+    {
+        name: "The Treasure of the Silver Forest",
+        description: "The princess must find the treasure of the silver forest.",
+        reward: "The spider of the silver forest.",
+        duration: 2 * HOUR
     }
 ]
\ No newline at end of file