crunch
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

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