From 57c3a65b4a297c3182406be73e2559198e8b1adc Mon Sep 17 00:00:00 2001 From: elioat Date: Sat, 25 May 2024 09:08:56 -0400 Subject: * --- js/princess/game.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'js') 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: [] } -- cgit 1.4.1-2-gfad0