munch
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

299 wiersze
6.4 KiB

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