浏览代码

Str/dex/con are more complex. Beautified some. Player stats shown.

tags/v0.2.8
Fen Dweller 7 年前
父节点
当前提交
4360cda898
共有 5 个文件被更改,包括 125 次插入41 次删除
  1. +4
    -0
      feast.html
  2. +3
    -0
      feast.js
  3. +13
    -0
      status.js
  4. +102
    -41
      vore.js
  5. +3
    -0
      world.js

+ 4
- 0
feast.html 查看文件

@@ -5,6 +5,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>Feast</title> <title>Feast</title>
<link rel="stylesheet" href="feast.css"> <link rel="stylesheet" href="feast.css">
<script src="status.js"></script>
<script src="combat.js"></script> <script src="combat.js"></script>
<script src="objects.js"></script> <script src="objects.js"></script>
<script src="dialog.js"></script> <script src="dialog.js"></script>
@@ -43,6 +44,9 @@
<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>
<div class="stat-line" id="stat-stamina">Imagination: 97</div> <div class="stat-line" id="stat-stamina">Imagination: 97</div>
<div class="stat-line" id="stat-str">Blood Sugar: 235</div>
<div class="stat-line" id="stat-dex">Daylight: Empty</div>
<div class="stat-line" id="stat-con">Sonhearst: River</div>
<div class="stat-line" id="stat-fullness">Candy Corn: 3</div> <div class="stat-line" id="stat-fullness">Candy Corn: 3</div>
<div class="stat-line" id="stat-bowels">Emotions: 35/100</div> <div class="stat-line" id="stat-bowels">Emotions: 35/100</div>
<button class="stat-button" id="stat-button-status">Status</button> <button class="stat-button" id="stat-button-status">Status</button>


+ 3
- 0
feast.js 查看文件

@@ -237,6 +237,9 @@ function updateDisplay() {
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);
document.getElementById("stat-stamina").innerHTML = "Stamina: " + round(player.stamina,0) + "/" + round(player.maxStamina,0); document.getElementById("stat-stamina").innerHTML = "Stamina: " + round(player.stamina,0) + "/" + round(player.maxStamina,0);
document.getElementById("stat-foe-str").innerHTML = "Str: " + player.str;
document.getElementById("stat-foe-dex").innerHTML = "Dex: " + player.dex;
document.getElementById("stat-foe-con").innerHTML = "Con: " + player.con;
document.getElementById("stat-fullness").innerHTML = "Fullness: " + round(player.fullness(),0); document.getElementById("stat-fullness").innerHTML = "Fullness: " + round(player.fullness(),0);
if (player.prefs.scat) { if (player.prefs.scat) {
document.getElementById("stat-bowels").innerHTML = "Bowels: " + round(player.bowels.fullness,0); document.getElementById("stat-bowels").innerHTML = "Bowels: " + round(player.bowels.fullness,0);


+ 13
- 0
status.js 查看文件

@@ -0,0 +1,13 @@
function StatBuff(stat, amount, turns) {
this.stat = stat;
this.amount = amount;
this.turns = turns;
this.alive = true;
}

StatBuff.prototype.tick = function() {
this.turns--;
if (this.turns == 0) {
this.alive = false;
}
};

+ 102
- 41
vore.js 查看文件

@@ -1,23 +1,64 @@
"use strict"; "use strict";


function Creature(name = "Creature", str=10, dex=10, con=10) {
function Creature(name = "Creature", str = 10, dex = 10, con = 10) {
this.name = name; this.name = name;


this.mass = 80; this.mass = 80;
this.bowels = new Bowels(); this.bowels = new Bowels();
this.stomach = new Stomach(this,this.bowels);
this.butt = new Butt(this,this.bowels,this.stomach);
this.stomach = new Stomach(this, this.bowels);
this.butt = new Butt(this, this.bowels, this.stomach);
this.attacks = []; this.attacks = [];


this.str = str;
this.dex = dex;
this.con = con;
this.baseStr = str;
this.baseDex = dex;
this.baseCon = con;

this.statBuffs = [];

this.statMultiplier = function(stat) {
let multiplier = 1;

return this.statBuffs.reduce((multiplier, effect) => (effect.stat == stat) ? multiplier * effect.amount : multiplier, multiplier);
};

Object.defineProperty(this, "str", {
get: function() {
return this.baseStr * this.statMultiplier("str");
},
set: function(val) {
this.baseStr = val;
}
});
Object.defineProperty(this, "dex", {
get: function() {
return this.baseDex * this.statMultiplier("dex");
},
set: function(val) {
this.baseDex = val;
}
});
Object.defineProperty(this, "con", {
get: function() {
return this.baseCon * this.statMultiplier("con");
},
set: function(val) {
this.baseCon = val;
}
});


this.hasName = false; this.hasName = false;


Object.defineProperty(this, "maxHealth", {get: function() { return this.str * 5 + this.con * 10 }});
Object.defineProperty(this, "maxHealth", {
get: function() {
return this.str * 5 + this.con * 10;
}
});
this.health = this.maxHealth; this.health = this.maxHealth;
Object.defineProperty(this, "maxStamina", {get: function() { return this.dex * 5 + this.con * 10 }});
Object.defineProperty(this, "maxStamina", {
get: function() {
return this.dex * 5 + this.con * 10;
}
});
this.stamina = this.maxStamina; this.stamina = this.maxStamina;


// fraction of max health per second // fraction of max health per second
@@ -55,19 +96,37 @@ function Creature(name = "Creature", str=10, dex=10, con=10) {


this.text = {}; this.text = {};


this.startCombat = function() { return [this.description("A") + " appears. It's a fight!"]; };
this.startCombat = function() {
return [this.description("A") + " appears. It's a fight!"];
};


this.finishCombat = function() { return [this.description("The") + " scoops up your limp body and gulps you down."]; };
this.finishCombat = function() {
return [this.description("The") + " scoops up your limp body and gulps you down."];
};


this.finishDigest = function() { return [this.description("The") + " digests you..."]; };
this.finishDigest = function() {
return [this.description("The") + " digests you..."];
};


this.defeated = function() { startDialog(new FallenFoe(this)); };
this.defeated = function() {
startDialog(new FallenFoe(this));
};


this.changeStamina = function(amount) { this.changeStamina = function(amount) {
this.stamina += amount; this.stamina += amount;
this.stamina = Math.min(this.maxStamina, this.stamina); this.stamina = Math.min(this.maxStamina, this.stamina);
this.stamina = Math.max(0, this.stamina); this.stamina = Math.max(0, this.stamina);
}; };

this.tickEffects = function() {
this.statBuffs.forEach(function(x) {
x.tick();
});

this.statBuffs.filter(function(x) {
return x.alive;
});
};
} }


function Player(name = "Player") { function Player(name = "Player") {
@@ -101,25 +160,25 @@ function Player(name = "Player") {
this.cash = 100; this.cash = 100;
} }


function Anthro(name="Anthro") {
function Anthro(name = "Anthro") {
this.build = pickRandom(["skinny", "fat", "muscular", "sickly", "ordinary"]); this.build = pickRandom(["skinny", "fat", "muscular", "sickly", "ordinary"]);


switch(this.build) {
switch (this.build) {
case "skinny": case "skinny":
Creature.call(this, name, 8, 12, 8); Creature.call(this, name, 8, 12, 8);
this.mass *= ( Math.random() * 0.2 + 0.7 );
this.mass *= (Math.random() * 0.2 + 0.7);
break; break;
case "fat": case "fat":
Creature.call(this, name, 10, 7, 15); Creature.call(this, name, 10, 7, 15);
this.mass *= ( Math.random() * 0.4 + 1.1);
this.mass *= (Math.random() * 0.4 + 1.1);
break; break;
case "muscular": case "muscular":
Creature.call(this, name, 13, 11, 13); Creature.call(this, name, 13, 11, 13);
this.mass *= ( Math.random() * 0.1 + 1.1);
this.mass *= (Math.random() * 0.1 + 1.1);
break; break;
case "sickly": case "sickly":
Creature.call(this, name, 6, 8, 6); Creature.call(this, name, 6, 8, 6);
this.mass *= ( Math.random() * 0.2 + 0.6 );
this.mass *= (Math.random() * 0.2 + 0.6);
break; break;
case "ordinary": case "ordinary":
Creature.call(this, name, 10, 10, 10); Creature.call(this, name, 10, 10, 10);
@@ -127,21 +186,21 @@ function Anthro(name="Anthro") {


} }


this.species = pickRandom(["dog","cat","lizard","deer","wolf","fox"]);
this.species = pickRandom(["dog", "cat", "lizard", "deer", "wolf", "fox"]);


// todo better lol // todo better lol


this.description = function(prefix="") {
this.description = function(prefix = "") {
if (this.build == "") if (this.build == "")
if (prefix == "") if (prefix == "")
return this.species; return this.species;
else else
return prefix + " " + this.species; return prefix + " " + this.species;
else else
if (prefix == "")
return this.build + " " + this.species;
else
return prefix + " " + this.build + " " + this.species;
if (prefix == "")
return this.build + " " + this.species;
else
return prefix + " " + this.build + " " + this.species;
}; };


this.attacks.push(new punchAttack(this)); this.attacks.push(new punchAttack(this));
@@ -163,9 +222,9 @@ function Anthro(name="Anthro") {


this.digests = []; this.digests = [];


this.digests.push(new digestPlayerStomach(this,20));
this.digests.push(new digestPlayerStomach(this, 20));


this.backupDigest = new digestPlayerStomach(this,20);
this.backupDigest = new digestPlayerStomach(this, 20);
} }


function Fen() { function Fen() {
@@ -174,7 +233,9 @@ function Fen() {
this.build = "loomy"; this.build = "loomy";
this.species = "crux"; this.species = "crux";


this.description = function(prefix) { return "Fen"; };
this.description = function(prefix) {
return "Fen";
};


this.attacks = []; this.attacks = [];


@@ -192,16 +253,16 @@ function Fen() {
this.digests.push(new instakillPlayerStomach(this)); this.digests.push(new instakillPlayerStomach(this));
this.digests.push(new instakillPlayerBowels(this)); this.digests.push(new instakillPlayerBowels(this));


this.backupDigest = new digestPlayerStomach(this,50);
this.backupDigest = new digestPlayerStomach(this, 50);
} }


function Micro() { function Micro() {
Creature.call(this, name); Creature.call(this, name);


this.health = 5; this.health = 5;
this.mass = 0.1 * (Math.random()/2 - 0.25 + 1);
this.mass = 0.1 * (Math.random() / 2 - 0.25 + 1);


this.species = pick(["dog","cat","lizard","deer","wolf","fox"]);
this.species = pick(["dog", "cat", "lizard", "deer", "wolf", "fox"]);
this.description = function(prefix = "") { this.description = function(prefix = "") {
if (prefix == "") if (prefix == "")
return "micro " + this.species; return "micro " + this.species;
@@ -216,12 +277,12 @@ function Container(owner) {
this.owner = owner; this.owner = owner;
this.contents = []; this.contents = [];
// health/sec // health/sec
this.damageRate = 15*100/86400;
this.damageRate = 15 * 100 / 86400;
// health percent/sec // health percent/sec
this.damageRatePercent = 1/86400;
this.damageRatePercent = 1 / 86400;


// kg/sec // kg/sec
this.digestRate = 80/8640;
this.digestRate = 80 / 8640;
} }


Container.prototype = { Container.prototype = {
@@ -247,7 +308,7 @@ Container.prototype = {


prey.mass -= digested; prey.mass -= digested;


this.owner.changeStamina(digested*10);
this.owner.changeStamina(digested * 10);


this.fill(digested); this.fill(digested);
} }
@@ -275,8 +336,8 @@ Container.prototype = {
} }
}; };


function Stomach(owner,bowels) {
Container.call(this,owner);
function Stomach(owner, bowels) {
Container.call(this, owner);


this.bowels = bowels; this.bowels = bowels;


@@ -303,25 +364,25 @@ function Stomach(owner,bowels) {


Stomach.prototype = Object.create(Container.prototype); Stomach.prototype = Object.create(Container.prototype);


function Butt(owner,bowels,stomach) {
Container.call(this,owner);
function Butt(owner, bowels, stomach) {
Container.call(this, owner);


this.bowels = bowels; this.bowels = bowels;
this.stomach = stomach; this.stomach = stomach;


this.digest = function(time) { this.digest = function(time) {
this.contents.forEach(function (x) {
this.contents.forEach(function(x) {
x.timeInButt += time; x.timeInButt += time;
}); });


let lines = Container.prototype.digest.call(this,time);
let lines = Container.prototype.digest.call(this, time);


let pushed = this.contents.filter(prey => prey.timeInButt >= 60 * 30); let pushed = this.contents.filter(prey => prey.timeInButt >= 60 * 30);


pushed.forEach(function(x) { pushed.forEach(function(x) {
this.stomach.feed(x); this.stomach.feed(x);
lines.push("Your winding guts squeeze " + x.description("the") + " into your stomach."); lines.push("Your winding guts squeeze " + x.description("the") + " into your stomach.");
},this);
}, this);


this.contents = this.contents.filter(prey => prey.timeInButt < 60 * 30); this.contents = this.contents.filter(prey => prey.timeInButt < 60 * 30);




+ 3
- 0
world.js 查看文件

@@ -142,6 +142,9 @@ let locationsSrc = [
"dir": SOUTH, "dir": SOUTH,
"desc": "You step out of the bar" "desc": "You step out of the bar"
} }
],
"objs": [

] ]
}, },
{ {


正在加载...
取消
保存