Przeglądaj źródła

Added a basic disposal system

tags/v0.2.8
Fen Dweller 7 lat temu
rodzic
commit
c871a8f187
5 zmienionych plików z 61 dodań i 4 usunięć
  1. +3
    -1
      .jshintrc
  2. +4
    -0
      feast.css
  3. +7
    -2
      feast.html
  4. +20
    -1
      feast.js
  5. +27
    -0
      objects.js

+ 3
- 1
.jshintrc Wyświetl plik

@@ -2,5 +2,7 @@
"indent": 1,
"esversion": 6,
"node": true,
"sub": true
"sub": true,
"-W117": false,
"-W083": false
}

+ 4
- 0
feast.css Wyświetl plik

@@ -142,3 +142,7 @@ button {
#character-form-list {
list-style-type: none;
}

#character-form {
font-size: 20pt;
}

+ 7
- 2
feast.html Wyświetl plik

@@ -24,14 +24,15 @@
<div id="game">
<div id="game-and-stats">
<div id="log">
Welcome to Feast v0.0.5
Welcome to Feast v0.1.0
</div>
<div id="stats">
<div class="stat-line" id="time">Time: to get a watch</div>
<div class="stat-line" id="time">Time: to file a bug report, because you shouldn't see this!</div>
<div class="stat-line" id="stat-name">Vim: 15</div>
<div class="stat-line" id="stat-health">Pulchritude: 44</div>
<div class="stat-line" id="stat-stamina">Imagination: 97</div>
<div class="stat-line" id="stat-fullness">Candy Corn: 3</div>
<div class="stat-line" id="stat-bowels">Emotions: 35/100</div>
</div>
</div>
<div id="footer">
@@ -145,6 +146,10 @@
<li>
<label for="character-prefs-player-prey">Player can be eaten</label>
<input type="checkbox" id="character-prefs-player-prey" name="prefs-player-prey" checked=true />
<li>
<li>
<label for="character-prefs-player-scat">Disposal/scat</label>
<input type="checkbox" id="character-prefs-player-scat" name="prefs-player-scat"/>
<li>
<button type="button" id="start-button">Start</button>
</li>


+ 20
- 1
feast.js Wyświetl plik

@@ -21,6 +21,19 @@ let prefs = {
}
};

function join(things) {
if (things.length == 1) {
return "a " + things[0].description();
} else if (things.length == 2) {
return "a " + things[0].description() + " and a " + things[1].description();
} else {
let line = "";
line = things.slice(0,-1).reduce((line, prey) => line + "a " + prey.description() + ", ", line);
line += " and a " + things[things.length-1].description();
return line;
}
}

function pickRandom(list) {
return list[Math.floor(Math.random() * list.length)];
}
@@ -195,6 +208,11 @@ function updateDisplay() {
document.getElementById("stat-health").innerHTML = "Health: " + round(player.health,0) + "/" + round(player.maxHealth,0);
document.getElementById("stat-stamina").innerHTML = "Stamina: " + round(player.stamina,0) + "/" + round(player.maxStamina,0);
document.getElementById("stat-fullness").innerHTML = "Fullness: " + round(player.fullness(),0);
if (prefs.player.scat) {
document.getElementById("stat-bowels").innerHTML = "Bowels: " + round(player.bowels.fullness,0);
} else {
document.getElementById("stat-bowels").innerHTML = "";
}
}

function advanceTime(amount) {
@@ -234,7 +252,8 @@ function moveTo(room,desc="You go places lol") {

currentRoom.objects.forEach(function (object) {
object.actions.forEach(function (action) {
actions.push(action);
if (action.conditions == undefined || action.conditions.reduce((result, cond) => result && cond(prefs), true))
actions.push(action);
});
});



+ 27
- 0
objects.js Wyświetl plik

@@ -34,6 +34,33 @@ function Toilet() {
update(["You admire the toilet."]);
}
});
this.actions.push({
"name": "Use toilet",
"action": function() {
let lines = [];

lines.push("You sit down on the toilet.");

if (player.bowels.fullness == 0) {
lines.push("But nothing happens.");
} else {
lines.push("You grunt and clench, squeezing out the remains of your former prey.");
}

if (player.bowels.contents.length > 0) {
lines.push("The remains of " + join(player.bowels.contents) + " empty into the sewers as you flush them away.");
}

player.bowels.contents = [];

update(lines);
},
"conditions": [
function(prefs) {
return prefs.player.scat == true;
}
]
});
}

function TV() {


Ładowanie…
Anuluj
Zapisz