From e78f5ac73f5d44b6b003356b40cd1c422219c9a4 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 14 Apr 2020 19:18:05 -0400 Subject: [PATCH 1/2] Update some template snippets --- .vscode/templates.code-snippets | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.vscode/templates.code-snippets b/.vscode/templates.code-snippets index da62a33..fe8b876 100644 --- a/.vscode/templates.code-snippets +++ b/.vscode/templates.code-snippets @@ -80,7 +80,7 @@ " \"conditions\": [", "", " ],", - " \"hooks\" [", + " \"hooks\": [", " ", " ]", "}," @@ -97,6 +97,16 @@ ], "description": "Condition" }, + "Hook": { + "prefix": "hook", + "body": [ + "(room, exit, state) => {", + " return ${1:true}", + "}", + "" + ], + "description": "Condition" + }, "Stat": { "prefix": "stat", "body": [ @@ -147,7 +157,7 @@ "", " ],", " \"world\": {", - " s", + " ", " }", "});", "" From 5fd3c7392ee7363156aeae1c9752ff54c4c849e5 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 14 Apr 2020 19:18:15 -0400 Subject: [PATCH 2/2] Add a getStat function --- game.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/game.js b/game.js index 1694c70..eda6e59 100644 --- a/game.js +++ b/game.js @@ -55,6 +55,10 @@ function initGamePostSetup(state) { createStatDisplays(state.player.stats, "player"); } +function getStat(stat, state) { + return state.palyer.stats[stat].value; +} + function changeStat(stat, amount, state) { let value = state.player.stats[stat].value; value += amount;