Skip to content

Commit 5f123de

Browse files
Merge pull request #18 from roman-yagodin/master
"About" notes, "follow" actions cost 2 AP, player level counter
2 parents 9a1c593 + c2cecfd commit 5f123de

File tree

6 files changed

+34
-6
lines changed

6 files changed

+34
-6
lines changed

data/about/58ea074f.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: Roman Yagodin
3+
colors: [ white ]
4+
---
5+
The main (and only) resource in Protogame is the _action points_ (AP).
6+
7+
Action points recieved semi-randomly on a daily basis and could be spent to "follow" actions (costs 2 AP) and other actions (costs 1 AP).
8+
9+
When player AP counter reaches 0, he/she will no longer perform any actions in game and should wait at least 12h to recieve more AP in order to continue.

data/about/e6aa104d.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: Roman Yagodin
3+
colors: [ white ]
4+
---
5+
Every Protogame run begins with player level equal to 0.
6+
7+
Every time player returns to the game after 12h interval, his/hers level is increased by 1 point.
8+
9+
Currently there is nothing in game which depends on player level - it's just an indicator of dedication.
File renamed without changes.
File renamed without changes.

js/app.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,17 @@ class Game {
4848
const stateStr = localStorage.getItem("protogame_state");
4949
if (stateStr) {
5050
this.state = JSON.parse(stateStr);
51-
// TODO: Check format of resulting state - if may be from old version
51+
// TODO: Tweak format of resulting state - if may be from old version
52+
if (typeof this.state.playerLevel === "undefined") {
53+
this.state.playerLevel = 0;
54+
}
5255
}
5356
else {
5457
this.state = {
5558
actionCounter: 0,
5659
playerName: randomMsg(playerNames),
5760
returnAfter: null,
61+
playerLevel: 0,
5862
breadCrumbs: []
5963
};
6064

@@ -422,6 +426,7 @@ async function scene2_greeting() {
422426
}
423427
else {
424428
if (game.state.actionCounter <= 0) {
429+
game.state.playerLevel++;
425430
game.resetActionCounter();
426431
game.saveState();
427432
}
@@ -430,7 +435,7 @@ async function scene2_greeting() {
430435
// greeting
431436
const hello = game.isNewGame() ? "Hello" : "Welcome back"
432437
setStyle(styles.bold + styles.green);
433-
await typeln(`> ${hello}, ${styles.cyan}${game.state.playerName}!${styles.green}`);
438+
await typeln(`> ${hello}, ${styles.cyan}${game.state.playerName}${styles.green} of level ${styles.cyan}${game.state.playerLevel}!${styles.green}`);
434439
await typeln("> Take your time and have fun!");
435440
await typeln();
436441
resetStyle();
@@ -636,7 +641,12 @@ async function scene4_world(note) {
636641
const choice = await menu(choices, showMenu);
637642
showMenu = false;
638643

639-
game.decrementActionCounter();
644+
if (choice.startsWith("follow")) {
645+
game.decrementActionCounter(2);
646+
}
647+
else {
648+
game.decrementActionCounter(1);
649+
}
640650
game.saveState();
641651

642652
if (game.state.actionCounter <= 0) {
@@ -789,8 +799,8 @@ async function scene4_world(note) {
789799
}
790800

791801
if (choice === "leave") {
792-
game.incrementActionCounter(randomInt(5, 10));
793-
game.saveState();
802+
//game.incrementActionCounter(randomInt(5, 10));
803+
//game.saveState();
794804
setStyle(styles.bold + styles.green);
795805
await typeln();
796806
await typeln(`> Goodbye, ${styles.cyan}${game.state.playerName}${styles.green}! And come back soon.`);

js/data.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)