From 496d35f865a51bce8f5865d847be168aaf2521a9 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sat, 24 Mar 2018 11:16:06 -0400 Subject: [PATCH] Log can be toggled now --- feast.css | 2 +- feast.html | 1 + feast.js | 22 +++++++++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/feast.css b/feast.css index 22f7938..c7eda9e 100644 --- a/feast.css +++ b/feast.css @@ -133,7 +133,7 @@ button { } #player-stats { - height: 50%; + height: 65%; } #foe-stats { diff --git a/feast.html b/feast.html index 33e0f6e..c5e4be6 100644 --- a/feast.html +++ b/feast.html @@ -50,6 +50,7 @@
Candy Corn: 3
Emotions: 35/100
+
FOE diff --git a/feast.js b/feast.js index 8ac726e..e4220b4 100644 --- a/feast.js +++ b/feast.js @@ -24,11 +24,23 @@ let killingBlow = null; let deaths = []; let respawnRoom; +let noLog = false; + let MIDNIGHT = 0; let MORNING = 21600; let NOON = 43200; let EVENING = 64800; +function toggleLog() { + noLog = !noLog; + + if (noLog) { + document.getElementById("log-button").innerHTML = "Log: Disabled"; + } else { + document.getElementById("log-button").innerHTML = "Log: Enabled"; + } +} + function join(things) { if (things.length == 1) { return things[0].description("a"); @@ -281,6 +293,8 @@ function renderTime(time) { } function move(direction) { + if (noLog) + clearScreen(); let target = currentRoom.exits[direction]; if (target == null) { alert("Tried to move to an empty room!"); @@ -323,6 +337,7 @@ function start() { document.getElementById("create").style.display = "none"; document.getElementById("game").style.display = "block"; document.getElementById("stat-button-status").addEventListener("click", status, false); + document.getElementById("log-button").addEventListener("click", toggleLog, false); loadActions(); loadCompass(); loadDialog(); @@ -502,7 +517,8 @@ function startCombat(opponent) { } function attackClicked(index) { - clearScreen(); + if (noLog) + clearScreen(); update(playerAttacks[index].attack(currentFoe).concat([newline])); if (currentFoe.health <= 0) { @@ -546,6 +562,8 @@ function attackHovered(index) { } function struggleClicked(index) { + if (noLog) + clearScreen(); let struggle = struggles[index]; let result = struggle.struggle(player); @@ -578,6 +596,8 @@ function struggleHovered(index) { } function startDialog(dialog) { + if (noLog) + clearScreen(); currentDialog = dialog; changeMode("dialog"); update(currentDialog.text.concat([newline]));