crunch
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.
 
 
 

290 Zeilen
6.2 KiB

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