diff options
author | elioat <elioat@tilde.institute> | 2024-05-25 09:08:56 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-05-25 09:08:56 -0400 |
commit | 57c3a65b4a297c3182406be73e2559198e8b1adc (patch) | |
tree | 240aabe11f72c6d154f8006232cfb7543d456b9d /js/princess | |
parent | 9e025ff2ea3e7ff2bab44f068b63e35b558bb59a (diff) | |
download | tour-57c3a65b4a297c3182406be73e2559198e8b1adc.tar.gz |
*
Diffstat (limited to 'js/princess')
-rw-r--r-- | js/princess/game.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/js/princess/game.js b/js/princess/game.js index 17d70e2..152a69c 100644 --- a/js/princess/game.js +++ b/js/princess/game.js @@ -1,4 +1,3 @@ - let now = new Date(); const MINUTE = 60 * 1000; const HOUR = 60 * MINUTE; @@ -8,7 +7,6 @@ const futureTime = (now, hours, minutes = 0) => { return new Date(now.getTime() + hours * HOUR + minutes * MINUTE); } - const prettyTime = (time) => { return time.toLocaleTimeString('en-US', { hour: 'numeric', minute: 'numeric' }); } @@ -25,6 +23,7 @@ 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); @@ -37,6 +36,7 @@ const removePartyPerson = (person) => { } } + const levelUpPrincess = (stat, amount) => { princess[stat] += amount; } @@ -47,6 +47,7 @@ const levelUpPartyMember = (person, stat, amount) => { } }; + const addQuest = (quest) => { if (!princess.activeQuests.includes(quest)) { quest.start = new Date(); // Update the quest's start time to the current time @@ -65,13 +66,14 @@ const checkQuests = () => { }); } + // the player character let princess = { finery: 10, knowledge: 10, spider: 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) + party: [], // the princess' 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) activeQuests: [], completedQuests: [] } |