munch
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

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