diff --git a/combat.js b/combat.js
index 015998d..cd24424 100644
--- a/combat.js
+++ b/combat.js
@@ -31,3 +31,14 @@ function flankAttack(attacker) {
}
};
}
+
+function devourPlayer(attacker) {
+ return {
+ name: "Devours YOU!",
+ desc: "You won't see this",
+ attackPlayer: function(defender) {
+ changeMode("eaten");
+ return "The voracious " + attacker.description() + " pins you down and devours you in seconds.";
+ }
+ }
+}
diff --git a/feast.css b/feast.css
index 630aae9..7d856da 100644
--- a/feast.css
+++ b/feast.css
@@ -56,6 +56,13 @@ button {
user-select: none;
}
+.eaten-button {
+ width: 200px;
+ height: 50px;
+ font-size: 18px;
+ user-select: none;
+}
+
#combat-desc {
width: 200px;
height: 400px;
@@ -77,6 +84,10 @@ button {
list-style-type: none;
}
+#eaten {
+ list-style-type: none;
+}
+
#log {
background: #222;
width: 100%;
diff --git a/feast.html b/feast.html
index 05397d6..79601f4 100644
--- a/feast.html
+++ b/feast.html
@@ -1,4 +1,4 @@
-
+0.0.2
@@ -23,7 +23,7 @@
- Welcome to Feast v0.0.1
+ Welcome to Feast v0.0.2
Time: to get a watch
@@ -115,6 +115,12 @@
+
diff --git a/feast.js b/feast.js
index 72b2528..12070cc 100644
--- a/feast.js
+++ b/feast.js
@@ -1,3 +1,4 @@
+
let currentRoom = null;
let currentDialog = null;
@@ -11,6 +12,8 @@ let newline = " ";
let player = new Player();
+let respawnRoom;
+
function round(number, digits) {
return Math.round(number * Math.pow(10,digits)) / Math.pow(10,digits);
}
@@ -53,6 +56,25 @@ function updateExplore() {
updateExploreActions();
}
+function updateEaten() {
+ let list = document.getElementById("eaten");
+
+ while(list.firstChild) {
+ list.removeChild(list.firstChild);
+ }
+
+ for (let i = 0; i < currentFoe.struggles.length; i++) {
+ let li = document.createElement("li");
+ let button = document.createElement("button");
+ button.classList.add("eaten-button");
+ button.innerHTML = currentFoe.struggles[i].name;
+ button.addEventListener("click", function() { struggleClicked(i); } );
+ button.addEventListener("mouseover", function() { struggleHovered(i); } );
+ li.appendChild(button);
+ list.appendChild(li);
+ }
+
+}
function updateCombat() {
let list = document.getElementById("combat");
@@ -91,25 +113,27 @@ function updateDialog() {
}
function updateDisplay() {
+
+ document.querySelectorAll(".selector").forEach(function (x) {
+ x.style.display = "none";
+ });
switch(mode) {
case "explore":
document.getElementById("selector-explore").style.display = "flex";
- document.getElementById("selector-combat").style.display = "none";
- document.getElementById("selector-dialog").style.display = "none";
updateExplore();
break;
case "combat":
- document.getElementById("selector-explore").style.display = "none";
document.getElementById("selector-combat").style.display = "flex";
- document.getElementById("selector-dialog").style.display = "none";
updateCombat();
break;
case "dialog":
- document.getElementById("selector-explore").style.display = "none";
- document.getElementById("selector-combat").style.display = "none";
document.getElementById("selector-dialog").style.display = "flex";
updateDialog();
break;
+ case "eaten":
+ document.getElementById("selector-eaten").style.display = "flex";
+ updateEaten();
+ break;
}
document.getElementById("time").innerHTML = "Time: " + renderTime(time);
@@ -166,6 +190,7 @@ window.addEventListener('load', function(event) {
loadCompass();
loadDialog();
currentRoom = createWorld();
+ respawnRoom = currentRoom;
moveTo(currentRoom);
updateDisplay();
});
@@ -182,8 +207,8 @@ function update(lines=[]) {
updateDisplay();
}
-function changeMode(mode) {
- this.mode = mode;
+function changeMode(newMode) {
+ mode = newMode;
let body = document.querySelector("body");
body.className = "";
switch(mode) {
@@ -198,9 +223,11 @@ function changeMode(mode) {
body.classList.add("eaten");
break;
}
+
+ updateDisplay();
}
function startCombat(opponent) {
- mode = "combat";
+ changeMode("combat");
currentFoe = opponent;
update(["Oh shit it's a " + opponent.description()]);
}
@@ -219,6 +246,7 @@ function attackClicked(index) {
if (player.health <= 0) {
update(["You fall to the ground..."]);
changeMode("eaten");
+ updateDisplay();
}
}
}
@@ -227,8 +255,34 @@ function attackHovered(index) {
document.getElementById("combat-desc").innerHTML = player.attacks[index].desc;
}
+function struggleClicked(index) {
+ let struggle = currentFoe.struggles[index];
+
+ let result = struggle.struggle(player);
+
+ update([result.lines]);
+
+ if (result.escape) {
+ changeMode("explore");
+ } else {
+ player.health -= 20;
+
+ if (player.health <= -100) {
+ update(["You digest in the depths of the " + currentFoe.description()]);
+ moveTo(respawnRoom);
+ changeMode("explore");
+ player.health = 100;
+ update(["You wake back up in your bed."]);
+ }
+ }
+}
+
+function struggleHovered(index) {
+ document.getElementById("eaten-desc").innerHTML = player.struggles[index].desc;
+}
+
function startDialog(dialog) {
- mode = "dialog";
+ changeMode("dialog");
currentDialog = dialog;
update([currentDialog.text]);
currentDialog.visit();
@@ -240,7 +294,7 @@ function dialogClicked(index) {
update([currentDialog.text]);
currentDialog.visit();
if (currentDialog.choices.length == 0) {
- mode = "explore";
+ changeMode("explore");
updateDisplay();
}
}
diff --git a/vore.js b/vore.js
index 4afa060..78068d2 100644
--- a/vore.js
+++ b/vore.js
@@ -46,6 +46,26 @@ function Anthro() {
this.attacks.push(new punchAttack(this));
this.attacks.push(new flankAttack(this));
+
+ this.struggles = [];
+
+ this.struggles.push(new plead(this));
+ this.struggles.push(new struggle(this));
+}
+
+function Fen() {
+ Anthro.call(this, name);
+
+ this.build = "loomy";
+ this.species = "crux";
+
+ this.attacks = [];
+
+ this.attacks.push(new devourPlayer(this));
+
+ this.struggles = [];
+
+ this.struggles.push(new rub(this));
}
function Micro() {
@@ -208,3 +228,62 @@ function WasteContainer(name) {
function Bowels() {
WasteContainer.call(this, "Bowels");
}
+
+// PLAYER PREY
+
+function plead(predator) {
+ return {
+ name: "Plead",
+ desc: "Ask very, very nicely for the predator to let you go. More effective if you haven't hurt your predator.",
+ struggle: function(player) {
+ let escape = Math.random() < predator.health / predator.maxHealth;
+
+ if (escape) {
+ return {
+ "escape": escape,
+ "lines": ["You plead for the " + predator.description() + " to let you free, and they begrudingly agree, horking you up and leaving you shivering on the ground"]
+ };
+ } else {
+ return {
+ "escape": escape,
+ "lines": ["You plead with the " + predator.description() + " to let you go, but they refuse."]
+ };
+ }
+ }
+ };
+}
+
+function struggle(predator) {
+ return {
+ name: "Struggle",
+ desc: "Try to squirm free. More effective if you've hurt your predator.",
+ struggle: function(player) {
+ let escape = Math.random() > predator.health / predator.maxHealth;
+
+ if (escape) {
+ return {
+ "escape": escape,
+ "lines": ["You struggle and squirm, forcing the " + predator.description() + " to hork you up. They groan and stumble away, exhausted by your efforts."]
+ };
+ } else {
+ return {
+ "escape": escape,
+ "lines": ["You squirm and writhe within the " + predator.description() + " to no avail."]
+ };
+ }
+ }
+ };
+}
+
+function rub(predator) {
+ return {
+ name: "Rub",
+ desc: "Rub rub rub",
+ struggle: function(player) {
+ return {
+ "escape": false,
+ "lines": ["You rub the walls of your predator's belly. At least the " + predator.description() + " is getting something out of this."]
+ };
+ }
+ };
+}
diff --git a/world.js b/world.js
index 0105646..882d3eb 100644
--- a/world.js
+++ b/world.js
@@ -161,6 +161,11 @@ let locationsSrc = [
"name": "North Street",
"dir": SOUTH,
"desc": "You walk out of the DANGER ZONE"
+ },
+ {
+ "name": "SUPER DANGER ZONE",
+ "dir": NORTH,
+ "desc": "Getting eaten is fun!"
}
],
"hooks": [
@@ -168,6 +173,22 @@ let locationsSrc = [
startCombat(new Anthro());
}
]
+ },
+ {
+ "name": "SUPER DANGER ZONE",
+ "desc": "Very dangerous",
+ "conn": [
+ {
+ "name": "DANGER ZONE",
+ "dir": SOUTH,
+ "desc": "You hurriedly leave the SUPER DANGER ZONE"
+ }
+ ],
+ "hooks": [
+ function() {
+ startCombat(new Fen());
+ }
+ ]
}
];