about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2024-05-12 21:21:07 -0400
committerelioat <elioat@tilde.institute>2024-05-12 21:21:07 -0400
commit628411e777bb5ed25b49ad67e8c897c1891a4223 (patch)
tree5ae31e6e4ffcbd784b1c5142c68919684835417d
parent4e466a30285e06b7f36a0a2b89f5e1271a2fe13a (diff)
downloadtour-628411e777bb5ed25b49ad67e8c897c1891a4223.tar.gz
*
-rw-r--r--js/princess/IDEA.md2
-rw-r--r--js/princess/game.js62
2 files changed, 63 insertions, 1 deletions
diff --git a/js/princess/IDEA.md b/js/princess/IDEA.md
index b559398..5951015 100644
--- a/js/princess/IDEA.md
+++ b/js/princess/IDEA.md
@@ -12,7 +12,7 @@ The final, and most expensive task in the game -- the way to win -- is to usurp
 
 HTML5/JS idle game about task assignment, and leveling up the recruited party members.
 
-Every few ticks, without doing anything, you earn X currency (your monthly stippend). 
+Every few ticks, without doing anything, you earn X currency (your monthly stipend). 
 
 Whenever you want, you can spend this money on one of a few actions.
 
diff --git a/js/princess/game.js b/js/princess/game.js
index e69de29..0415b70 100644
--- a/js/princess/game.js
+++ b/js/princess/game.js
@@ -0,0 +1,62 @@
+
+let now = new Date();
+const MINUTE = 60 * 1000;
+const HOUR = 60 * MINUTE;
+const DAY = 24 * HOUR;
+
+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' });
+}
+
+const prettyTimeFromNow = (time) => {
+    let diff = time - new Date();
+    if (diff === 0) {
+        return 'now';
+    }
+    let hours = Math.floor(diff / HOUR);
+    let minutes = Math.floor((diff % HOUR) / MINUTE);
+    let hoursText = hours === 1 ? 'hour' : 'hours';
+    let minutesText = minutes === 1 ? 'minute' : 'minutes';
+    return `${hours} ${hoursText} and ${minutes} ${minutesText}`;
+}
+
+let princess = {
+    finery: 10,
+    knowledge: 10,
+    spider: 100,
+    treasure: 100
+}
+
+let party = []
+
+let people = [
+    {
+        name: "Hawk",
+        description: "Stable boy and goat herd.",
+        aspiration: "To be a knight.",
+        power: 1,
+        speed: 1,
+        spider: 2
+    },
+    {
+        name: "Bella",
+        description: "Scullery maid.",
+        aspiration: "To be a pirate.",
+        power: 2,
+        speed: 2,
+        spider: 1
+    },
+    {
+        name: "Silver Teeth in the Moonlight, aka Teeth",
+        description: "A rotund goblin doctor.",
+        aspiration: "To be the dentist for a king.",
+        power: 2,
+        speed: 5,
+        spider: 1
+    }
+]
\ No newline at end of file
id='n227' href='#n227'>227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293