From a51625ba09a37c78a945ff672c3edcb7abd84a7c Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sat, 10 Mar 2018 08:33:55 -0500 Subject: [PATCH] Fullness is rounded. Added some locations --- feast.js | 6 +++++- vore.js | 12 ++++++++++-- world.js | 48 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/feast.js b/feast.js index b0fced3..a911d57 100644 --- a/feast.js +++ b/feast.js @@ -11,6 +11,10 @@ let newline = " "; let player = new Player(); +function round(number, digits) { + return Math.round(number * Math.pow(10,digits)) / Math.pow(10,digits); +} + function updateExploreCompass() { for (let i = 0; i < dirButtons.length; i++) { let button = dirButtons[i]; @@ -96,7 +100,7 @@ function updateDisplay() { document.getElementById("time").innerHTML = "Time: " + renderTime(time); document.getElementById("stat-name").innerHTML = "Name: " + player.name; document.getElementById("stat-health").innerHTML = "Health: " + player.health + "/" + player.maxHealth; - document.getElementById("stat-fullness").innerHTML = "Fullness: " + player.fullness(); + document.getElementById("stat-fullness").innerHTML = "Fullness: " + round(player.fullness(),0); } function advanceTime(amount) { diff --git a/vore.js b/vore.js index 6c5d9b9..dd1f86b 100644 --- a/vore.js +++ b/vore.js @@ -55,6 +55,10 @@ function Container(name) { let damage = Math.min(prey.health, this.damageRate * time); prey.health -= damage; time -= damage / this.damageRate; + + if (prey.health <= 0) { + lines.push(this.describeKill(prey)); + } } if (prey.health <= 0) { @@ -66,7 +70,7 @@ function Container(name) { } if (prey.mass <= 0) { - lines.push(this.describeDigest(prey)); + lines.push(this.describeFinish(prey)); this.finish(prey); } @@ -91,7 +95,11 @@ function Container(name) { function Stomach(bowels) { Container.call(this, "stomach"); - this.describeDigest = function(prey) { + this.describeKill = function(prey) { + return "The " + prey.description() + "'s struggles wane as your stomach overpowers them."; + } + + this.describeFinish = function(prey) { return "Your churning guts have reduced a " + prey.description() + " to meaty chyme."; }; diff --git a/world.js b/world.js index fff73dd..a03b542 100644 --- a/world.js +++ b/world.js @@ -56,7 +56,7 @@ let locationsSrc = [ "conn": [ { "name": "North Street", - "dir": NORTH, + "dir": WEST, "desc": "You step outside." }, { @@ -77,12 +77,17 @@ let locationsSrc = [ { "name": "Alley", "dir": WEST, - "desc": "You wander into the dark alley." + "desc": "You wander into the dark alley" }, { "name": "Living Room", "dir": EAST, - "desc": "You step back into your apartment." + "desc": "You step back into your apartment" + }, + { + "name": "Crossroads", + "dir": SOUTH, + "desc": "You walk south" } ], "objs": [ @@ -94,7 +99,7 @@ let locationsSrc = [ "desc": "A suspicious alley", "conn": [ { - "name": "Street", + "name": "North Street", "dir": EAST, "desc": "You hurry back into the open street." }, @@ -115,7 +120,40 @@ let locationsSrc = [ { "name": "Alley", "dir": SOUTH, - "desc": "You step out of the bar." + "desc": "You step out of the bar" + } + ], + "objs": [ + + ] + }, + { + "name": "Crossroads", + "desc": "Where the roads cross", + "conn": [ + { + "name": "North Street", + "dir": NORTH, + "desc": "You walk north" + }, + { + "name": "South Street", + "dir": SOUTH, + "desc": "You walk south" + } + ], + "objs": [ + + ] + }, + { + "name": "South Street", + "desc": "This street is in the south", + "conn": [ + { + "name": "Crossroads", + "dir": NORTH, + "desc": "You walk to the crossroads" } ], "objs": [