浏览代码

Added a death log. Fixed some gory attacks ignoring prefs. Fixed dying when prey is disabled

tags/v0.2.8
Fen Dweller 7 年前
父节点
当前提交
14ad0e28d1
共有 5 个文件被更改,包括 55 次插入4 次删除
  1. +11
    -1
      customs.js
  2. +1
    -0
      feast.html
  3. +28
    -2
      feast.js
  4. +13
    -0
      objects.js
  5. +2
    -1
      world.js

+ 11
- 1
customs.js 查看文件

@@ -285,7 +285,7 @@ function tranceGrapple(attacker) {
function tranceStomp(attacker) { function tranceStomp(attacker) {
return { return {
attackPlayer: function(defender) { attackPlayer: function(defender) {
let result = [attacker.description("The") + " shoves you to the ground, planting one foot on your chest and crushing your entire head beneath the other, crippling you and dealing " + attack(attacker, defender, attacker.str * 5) + " damage"];
let result = [attacker.description("The") + " shoves you to the ground, planting one foot on your chest and crushing your head beneath the other, crippling you and dealing " + attack(attacker, defender, attacker.str * 5) + " damage"];
if (defender.health <= 0) { if (defender.health <= 0) {
result[0] += ". Your skull breaks open as his crushing weight snuffs you out like a candle, smearing your brain across the ground and splitting your jaw in half. <i>Ouch.</i>"; result[0] += ". Your skull breaks open as his crushing weight snuffs you out like a candle, smearing your brain across the ground and splitting your jaw in half. <i>Ouch.</i>";
defender.health = -100; defender.health = -100;
@@ -332,6 +332,11 @@ function tranceGrappleMaul(attacker) {
return isNormal(attacker) && isGrappled(defender); return isNormal(attacker) && isGrappled(defender);
} }
], ],
conditions: [
function(attacker, defender) {
return defender.prefs.gore;
}
],
priority: 1, priority: 1,
weight: function(attacker, defender) { return defender.health / defender.maxHealth; } weight: function(attacker, defender) { return defender.health / defender.maxHealth; }
}; };
@@ -349,6 +354,11 @@ function tranceGrappleThroat(attacker) {
return ["The sergal lunges for your throat, but you manage to keep his terrifying jaws at bay."]; return ["The sergal lunges for your throat, but you manage to keep his terrifying jaws at bay."];
} }
}, },
conditions: [
function(attacker, defender) {
return defender.prefs.gore;
}
],
requirements: [ requirements: [
function(attacker, defender) { function(attacker, defender) {
return isNormal(attacker) && isGrappled(defender); return isNormal(attacker) && isGrappled(defender);


+ 1
- 0
feast.html 查看文件

@@ -30,6 +30,7 @@
<div class="stats"> <div class="stats">
<div id="player-stats"> <div id="player-stats">
<div class="stat-line" id="time">Time: to file a bug report, because you shouldn't see this!</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="date">Date: you'll have to buy me dinner first :v</div>
<div class="stat-line" id="stat-name">Vim: 15</div> <div class="stat-line" id="stat-name">Vim: 15</div>
<div class="stat-line" id="stat-cash">Spondulicks: 150000</div> <div class="stat-line" id="stat-cash">Spondulicks: 150000</div>
<div class="stat-line" id="stat-health">Pulchritude: 44</div> <div class="stat-line" id="stat-health">Pulchritude: 44</div>


+ 28
- 2
feast.js 查看文件

@@ -11,11 +11,15 @@ let actionButtons = [];
let mode = "explore"; let mode = "explore";
let actions = []; let actions = [];
let time = 9*60*60; let time = 9*60*60;
let date = 1;
let newline = "&nbsp;"; let newline = "&nbsp;";


let player = new Player(); let player = new Player();
let playerAttacks = []; let playerAttacks = [];


let killingBlow = null;

let deaths = [];
let respawnRoom; let respawnRoom;


function join(things) { function join(things) {
@@ -210,6 +214,7 @@ function updateDisplay() {
} }


document.getElementById("time").innerHTML = "Time: " + renderTime(time); document.getElementById("time").innerHTML = "Time: " + renderTime(time);
document.getElementById("date").innerHTML = "Day " + date;
document.getElementById("stat-name").innerHTML = "Name: " + player.name; document.getElementById("stat-name").innerHTML = "Name: " + player.name;
document.getElementById("stat-health").innerHTML = "Health: " + round(player.health,0) + "/" + round(player.maxHealth,0); document.getElementById("stat-health").innerHTML = "Health: " + round(player.health,0) + "/" + round(player.maxHealth,0);
document.getElementById("stat-cash").innerHTML = "Cash: $" + round(player.cash,0); document.getElementById("stat-cash").innerHTML = "Cash: $" + round(player.cash,0);
@@ -223,7 +228,12 @@ function updateDisplay() {
} }


function advanceTime(amount) { function advanceTime(amount) {
time = (time + amount) % 86400;
time = (time + amount);

date += Math.floor(time / 86400);

time = time % 86400;

player.restoreHealth(amount); player.restoreHealth(amount);
player.restoreStamina(amount); player.restoreStamina(amount);
update(player.stomach.digest(amount)); update(player.stomach.digest(amount));
@@ -378,11 +388,23 @@ function changeMode(newMode) {
} }


function respawn(respawnRoom) { function respawn(respawnRoom) {

if (killingBlow.gameover == undefined) {
if (player.prefs.prey) {
deaths.push("Digested by " + currentFoe.description("a") + " at " + renderTime(time) + " on day " + date);
} else {
deaths.push("Defeated by " + currentFoe.description("a") + " at " + renderTime(time) + " on day " + date);
}
}


moveTo(respawnRoom,"You drift through space and time..."); moveTo(respawnRoom,"You drift through space and time...");
player.clear(); player.clear();
player.stomach.contents = []; player.stomach.contents = [];
player.butt.contents = []; player.butt.contents = [];
advanceTime(86400/2);
player.bowels.contents = [];
player.bowels.fullness = 0;
advanceTime(Math.floor(86400 / 2 * (Math.random() * 0.5 - 0.25 + 1)));
changeMode("explore"); changeMode("explore");
player.health = 100; player.health = 100;
update(["You wake back up in your bed."]); update(["You wake back up in your bed."]);
@@ -409,6 +431,7 @@ function attackClicked(index) {
update(attack.attackPlayer(player)); update(attack.attackPlayer(player));


if (player.health <= -100) { if (player.health <= -100) {
killingBlow = attack;
update(["You die..."]); update(["You die..."]);
respawn(respawnRoom); respawn(respawnRoom);
} else if (player.health <= 0) { } else if (player.health <= 0) {
@@ -416,6 +439,8 @@ function attackClicked(index) {
if (player.prefs.prey) { if (player.prefs.prey) {
changeMode("eaten"); changeMode("eaten");
} else { } else {
killingBlow = attack;
update(["You die..."]);
respawn(respawnRoom); respawn(respawnRoom);
} }
} }
@@ -447,6 +472,7 @@ function struggleClicked(index) {
update([digest.digest(player)]); update([digest.digest(player)]);


if (player.health <= -100) { if (player.health <= -100) {
killingBlow = digest;
update(currentFoe.finishDigest()); update(currentFoe.finishDigest());
respawn(respawnRoom); respawn(respawnRoom);
} }


+ 13
- 0
objects.js 查看文件

@@ -96,6 +96,19 @@ function Bed() {
}); });
} }


function Journal() {
GameObject.call(this, "Journal");
this.actions.push({
"name": "Read Journal",
"action": function() {
if (deaths.length == 0)
update(["You pick up the journal and read it.",newline,"It's empty."]);
else
update(["You pick up the journal and read it.",newline].concat(deaths));
}
});
}

function Sofa() { function Sofa() {
GameObject.call(this, "Sofa"); GameObject.call(this, "Sofa");
this.actions.push({ this.actions.push({


+ 2
- 1
world.js 查看文件

@@ -31,7 +31,8 @@ let locationsSrc = [
} }
], ],
"objs": [ "objs": [
Bed
Bed,
Journal
], ],
}, },
{ {


正在加载...
取消
保存