Quellcode durchsuchen

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

tags/v0.2.8
Fen Dweller vor 7 Jahren
Ursprung
Commit
14ad0e28d1
5 geänderte Dateien mit 55 neuen und 4 gelöschten Zeilen
  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 Datei anzeigen

@@ -285,7 +285,7 @@ function tranceGrapple(attacker) {
function tranceStomp(attacker) {
return {
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) {
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;
@@ -332,6 +332,11 @@ function tranceGrappleMaul(attacker) {
return isNormal(attacker) && isGrappled(defender);
}
],
conditions: [
function(attacker, defender) {
return defender.prefs.gore;
}
],
priority: 1,
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."];
}
},
conditions: [
function(attacker, defender) {
return defender.prefs.gore;
}
],
requirements: [
function(attacker, defender) {
return isNormal(attacker) && isGrappled(defender);


+ 1
- 0
feast.html Datei anzeigen

@@ -30,6 +30,7 @@
<div class="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="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-cash">Spondulicks: 150000</div>
<div class="stat-line" id="stat-health">Pulchritude: 44</div>


+ 28
- 2
feast.js Datei anzeigen

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

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

let killingBlow = null;

let deaths = [];
let respawnRoom;

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

document.getElementById("time").innerHTML = "Time: " + renderTime(time);
document.getElementById("date").innerHTML = "Day " + date;
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-cash").innerHTML = "Cash: $" + round(player.cash,0);
@@ -223,7 +228,12 @@ function updateDisplay() {
}

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

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

time = time % 86400;

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

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...");
player.clear();
player.stomach.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");
player.health = 100;
update(["You wake back up in your bed."]);
@@ -409,6 +431,7 @@ function attackClicked(index) {
update(attack.attackPlayer(player));

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

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


+ 13
- 0
objects.js Datei anzeigen

@@ -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() {
GameObject.call(this, "Sofa");
this.actions.push({


+ 2
- 1
world.js Datei anzeigen

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


Laden…
Abbrechen
Speichern