浏览代码

Log can be toggled now

tags/v0.2.8
Fen Dweller 7 年前
父节点
当前提交
496d35f865
共有 3 个文件被更改,包括 23 次插入2 次删除
  1. +1
    -1
      feast.css
  2. +1
    -0
      feast.html
  3. +21
    -1
      feast.js

+ 1
- 1
feast.css 查看文件

@@ -133,7 +133,7 @@ button {
} }


#player-stats { #player-stats {
height: 50%;
height: 65%;
} }


#foe-stats { #foe-stats {


+ 1
- 0
feast.html 查看文件

@@ -50,6 +50,7 @@
<div class="stat-line" id="stat-fullness">Candy Corn: 3</div> <div class="stat-line" id="stat-fullness">Candy Corn: 3</div>
<div class="stat-line" id="stat-bowels">Emotions: 35/100</div> <div class="stat-line" id="stat-bowels">Emotions: 35/100</div>
<button class="stat-button" id="stat-button-status">Status</button> <button class="stat-button" id="stat-button-status">Status</button>
<button class="stat-button" id="log-button">Log: Enabled</button>
</div> </div>
<div id="foe-stats"> <div id="foe-stats">
FOE FOE


+ 21
- 1
feast.js 查看文件

@@ -24,11 +24,23 @@ let killingBlow = null;
let deaths = []; let deaths = [];
let respawnRoom; let respawnRoom;


let noLog = false;

let MIDNIGHT = 0; let MIDNIGHT = 0;
let MORNING = 21600; let MORNING = 21600;
let NOON = 43200; let NOON = 43200;
let EVENING = 64800; 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) { function join(things) {
if (things.length == 1) { if (things.length == 1) {
return things[0].description("a"); return things[0].description("a");
@@ -281,6 +293,8 @@ function renderTime(time) {
} }


function move(direction) { function move(direction) {
if (noLog)
clearScreen();
let target = currentRoom.exits[direction]; let target = currentRoom.exits[direction];
if (target == null) { if (target == null) {
alert("Tried to move to an empty room!"); alert("Tried to move to an empty room!");
@@ -323,6 +337,7 @@ function start() {
document.getElementById("create").style.display = "none"; document.getElementById("create").style.display = "none";
document.getElementById("game").style.display = "block"; document.getElementById("game").style.display = "block";
document.getElementById("stat-button-status").addEventListener("click", status, false); document.getElementById("stat-button-status").addEventListener("click", status, false);
document.getElementById("log-button").addEventListener("click", toggleLog, false);
loadActions(); loadActions();
loadCompass(); loadCompass();
loadDialog(); loadDialog();
@@ -502,7 +517,8 @@ function startCombat(opponent) {
} }


function attackClicked(index) { function attackClicked(index) {
clearScreen();
if (noLog)
clearScreen();
update(playerAttacks[index].attack(currentFoe).concat([newline])); update(playerAttacks[index].attack(currentFoe).concat([newline]));


if (currentFoe.health <= 0) { if (currentFoe.health <= 0) {
@@ -546,6 +562,8 @@ function attackHovered(index) {
} }


function struggleClicked(index) { function struggleClicked(index) {
if (noLog)
clearScreen();
let struggle = struggles[index]; let struggle = struggles[index];


let result = struggle.struggle(player); let result = struggle.struggle(player);
@@ -578,6 +596,8 @@ function struggleHovered(index) {
} }


function startDialog(dialog) { function startDialog(dialog) {
if (noLog)
clearScreen();
currentDialog = dialog; currentDialog = dialog;
changeMode("dialog"); changeMode("dialog");
update(currentDialog.text.concat([newline])); update(currentDialog.text.concat([newline]));


正在加载...
取消
保存