munch
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

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