munch
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

349 Zeilen
8.3 KiB

  1. "use strict";
  2. function Creature(name = "Creature", str=10, dex=10, con=10) {
  3. this.name = name;
  4. this.mass = 80;
  5. this.bowels = new Bowels();
  6. this.stomach = new Stomach(this.bowels);
  7. this.butt = new Butt(this.bowels,this.stomach);
  8. this.attacks = [];
  9. this.str = str;
  10. this.dex = dex;
  11. this.con = con;
  12. Object.defineProperty(this, "maxHealth", {get: function() { return this.str * 5 + this.con * 10 }});
  13. this.health = this.maxHealth;
  14. Object.defineProperty(this, "maxStamina", {get: function() { return this.dex * 5 + this.con * 10 }});
  15. this.stamina = this.maxStamina;
  16. // fraction of max health per second
  17. this.healthRate = 1 / 86400 * 12;
  18. this.staminaRate = 1 / 86400 * 48;
  19. this.restoreHealth = function(time) {
  20. this.health = Math.min(this.maxHealth, this.health + this.maxHealth * time * this.healthRate);
  21. };
  22. this.restoreStamina = function(time) {
  23. this.stamina = Math.min(this.maxStamina, this.stamina + this.maxStamina * time * this.staminaRate);
  24. };
  25. }
  26. function Player(name = "Player") {
  27. Creature.call(this, name, 15, 15, 15);
  28. this.fullness = function() {
  29. return this.stomach.fullness() + this.butt.fullness();
  30. };
  31. this.attacks.push(new punchAttack(this));
  32. this.attacks.push(new flankAttack(this));
  33. this.attacks.push(new grapple(this));
  34. this.attacks.push(new grappleDevour(this));
  35. this.attacks.push(new grappleAnalVore(this));
  36. this.attacks.push(new grappleRelease(this));
  37. this.attacks.push(new grappledStruggle(this));
  38. this.attacks.push(new grappledReverse(this));
  39. this.backupAttack = new pass(this);
  40. }
  41. function Anthro() {
  42. Creature.call(this, name);
  43. this.mass = 80 * (Math.random()/2 - 0.25 + 1);
  44. this.build = "ordinary";
  45. if (this.mass < 70) {
  46. this.build = "skinny";
  47. } else if (this.mass > 90) {
  48. this.build = "fat";
  49. }
  50. this.species = pick(["dog","cat","lizard","deer","wolf","fox"]);
  51. this.description = function() {
  52. return this.build + " " + this.species;
  53. };
  54. this.attacks.push(new punchAttack(this));
  55. this.attacks.push(new flankAttack(this));
  56. this.attacks.push(new grapple(this));
  57. this.attacks.push(new grappleDevour(this));
  58. this.attacks.push(new grappledStruggle(this));
  59. this.attacks.push(new grappledReverse(this));
  60. this.backupAttack = new pass(this);
  61. this.struggles = [];
  62. this.struggles.push(new plead(this));
  63. this.struggles.push(new struggle(this));
  64. this.digests = [];
  65. this.digests.push(new digestPlayerStomach(this,20));
  66. this.backupDigest = new digestPlayerStomach(this,20);
  67. }
  68. function Fen() {
  69. Anthro.call(this, name, 1000000, 1099900, 1000000);
  70. this.build = "loomy";
  71. this.species = "crux";
  72. this.attacks = [];
  73. this.attacks.push(new devourPlayer(this));
  74. this.attacks.push(new leer(this));
  75. this.backupAttack = new poke(this);
  76. this.struggles = [];
  77. this.struggles.push(new rub(this));
  78. this.digests = [];
  79. this.digests.push(new digestPlayerStomach(this,50));
  80. this.digests.push(new instakillPlayerStomach(this));
  81. this.backupDigest = new digestPlayerStomach(this,50);
  82. }
  83. function Micro() {
  84. Creature.call(this, name);
  85. this.health = 5;
  86. this.mass = 0.1 * (Math.random()/2 - 0.25 + 1);
  87. this.species = pick(["dog","cat","lizard","deer","wolf","fox"]);
  88. this.description = function() {
  89. return "micro " + this.species;
  90. };
  91. }
  92. // vore stuff here
  93. class Container {
  94. constructor(name) {
  95. this.name = name;
  96. this.contents = [];
  97. // health/sec
  98. this.damageRate = 15*100/86400;
  99. // kg/sec
  100. this.digestRate = 80/8640;
  101. }
  102. digest(time) {
  103. let lines = [];
  104. this.contents.forEach(function(prey) {
  105. if (prey.health > 0) {
  106. let damage = Math.min(prey.health, this.damageRate * time);
  107. prey.health -= damage;
  108. time -= damage / this.damageRate;
  109. if (prey.health + damage > 50 && prey.health <= 50) {
  110. lines.push(this.describeDamage(prey));
  111. }
  112. if (prey.health <= 0) {
  113. lines.push(this.describeKill(prey));
  114. }
  115. }
  116. if (prey.health <= 0) {
  117. let digested = Math.min(prey.mass, this.digestRate * time);
  118. prey.mass -= digested;
  119. this.fill(digested);
  120. }
  121. if (prey.mass <= 0) {
  122. lines.push(this.describeFinish(prey));
  123. this.finish(prey);
  124. }
  125. }, this);
  126. this.contents = this.contents.filter(function(prey) {
  127. return prey.mass > 0;
  128. });
  129. return lines;
  130. }
  131. feed(prey) {
  132. this.contents.push(prey);
  133. }
  134. fullness() {
  135. return this.contents.reduce((total, prey) => total + prey.mass, 0);
  136. }
  137. }
  138. class Stomach extends Container {
  139. constructor(bowels) {
  140. super();
  141. this.bowels = bowels;
  142. }
  143. describeDamage(prey) {
  144. return "Your guts gurgle and churn, slowly wearing down the " + prey.description() + " trapped within.";
  145. }
  146. describeKill(prey) {
  147. return "The " + prey.description() + "'s struggles wane as your stomach overpowers them.";
  148. }
  149. describeFinish(prey) {
  150. return "Your churning guts have reduced a " + prey.description() + " to meaty chyme.";
  151. }
  152. fill(amount) {
  153. this.bowels.add(amount);
  154. }
  155. finish(prey) {
  156. this.bowels.finish(prey);
  157. }
  158. }
  159. class Butt extends Container {
  160. constructor(bowels, stomach) {
  161. super();
  162. this.bowels = bowels;
  163. this.stomach = stomach;
  164. }
  165. digest(time) {
  166. this.contents.forEach(function (x) {
  167. x.timeInButt += time;
  168. });
  169. let lines = super.digest(time);
  170. let pushed = this.contents.filter(prey => prey.timeInButt >= 60 * 30);
  171. pushed.forEach(function(x) {
  172. this.stomach.feed(x);
  173. lines.push("Your winding guts squeeze the " + x.description() + " into your stomach.");
  174. },this);
  175. this.contents = this.contents.filter(prey => prey.timeInButt < 60 * 30);
  176. return lines;
  177. }
  178. describeDamage(prey) {
  179. return "Your bowels gurgle and squeeze, working to wear down the " + prey.description() + " trapped in those musky confines.";
  180. }
  181. describeKill(prey) {
  182. return "The " + prey.description() + " abruptly stops struggling, overpowered by your winding intestines.";
  183. }
  184. describeFinish(prey) {
  185. return "That delicious " + prey.description() + " didn't even make it to your stomach...now they're gone.";
  186. }
  187. feed(prey) {
  188. prey.timeInButt = 0;
  189. super.feed(prey);
  190. }
  191. fill(amount) {
  192. this.bowels.add(amount);
  193. }
  194. finish(prey) {
  195. this.bowels.finish(prey);
  196. }
  197. }
  198. function WasteContainer(name) {
  199. this.name = name;
  200. this.fullness = 0;
  201. this.contents = [];
  202. this.add = function(amount) {
  203. this.fullness += amount;
  204. };
  205. this.finish = function(prey) {
  206. this.contents.push(prey);
  207. };
  208. }
  209. function Bowels() {
  210. WasteContainer.call(this, "Bowels");
  211. }
  212. // PLAYER PREY
  213. function plead(predator) {
  214. return {
  215. name: "Plead",
  216. desc: "Ask very, very nicely for the predator to let you go. More effective if you haven't hurt your predator.",
  217. struggle: function(player) {
  218. let escape = Math.random() < predator.health / predator.maxHealth && Math.random() < 0.33;
  219. if (escape) {
  220. return {
  221. "escape": escape,
  222. "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"]
  223. };
  224. } else {
  225. return {
  226. "escape": escape,
  227. "lines": ["You plead with the " + predator.description() + " to let you go, but they refuse."]
  228. };
  229. }
  230. }
  231. };
  232. }
  233. function struggle(predator) {
  234. return {
  235. name: "Struggle",
  236. desc: "Try to squirm free. More effective if you've hurt your predator.",
  237. struggle: function(player) {
  238. let escape = Math.random() > predator.health / predator.maxHealth && Math.random() < 0.33;
  239. if (escape) {
  240. return {
  241. "escape": escape,
  242. "lines": ["You struggle and squirm, forcing the " + predator.description() + " to hork you up. They groan and stumble away, exhausted by your efforts."]
  243. };
  244. } else {
  245. return {
  246. "escape": escape,
  247. "lines": ["You squirm and writhe within the " + predator.description() + " to no avail."]
  248. };
  249. }
  250. }
  251. };
  252. }
  253. function rub(predator) {
  254. return {
  255. name: "Rub",
  256. desc: "Rub rub rub",
  257. struggle: function(player) {
  258. return {
  259. "escape": false,
  260. "lines": ["You rub the walls of your predator's belly. At least the " + predator.description() + " is getting something out of this."]
  261. };
  262. }
  263. };
  264. }