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

637 行
16 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.attacks = [];
  6. this.baseStr = str;
  7. this.baseDex = dex;
  8. this.baseCon = con;
  9. this.statBuffs = [];
  10. this.statMultiplier = function(stat) {
  11. let multiplier = 1;
  12. return this.statBuffs.reduce((multiplier, effect) => (effect.stat == stat) ? multiplier * effect.amount : multiplier, multiplier);
  13. };
  14. Object.defineProperty(this, "str", {
  15. get: function() {
  16. return this.baseStr * this.statMultiplier("str");
  17. },
  18. set: function(val) {
  19. this.baseStr = val;
  20. }
  21. });
  22. Object.defineProperty(this, "dex", {
  23. get: function() {
  24. return this.baseDex * this.statMultiplier("dex");
  25. },
  26. set: function(val) {
  27. this.baseDex = val;
  28. }
  29. });
  30. Object.defineProperty(this, "con", {
  31. get: function() {
  32. return this.baseCon * this.statMultiplier("con");
  33. },
  34. set: function(val) {
  35. this.baseCon = val;
  36. }
  37. });
  38. this.hasName = false;
  39. Object.defineProperty(this, "maxHealth", {
  40. get: function() {
  41. return this.str * 5 + this.con * 10;
  42. }
  43. });
  44. this.health = this.maxHealth;
  45. Object.defineProperty(this, "maxStamina", {
  46. get: function() {
  47. return this.dex * 5 + this.con * 10;
  48. }
  49. });
  50. this.stamina = this.maxStamina;
  51. // fraction of max health per second
  52. this.healthRate = 1 / 86400 * 4;
  53. this.staminaRate = 1 / 86400 * 6;
  54. this.restoreHealth = function(time) {
  55. this.health = Math.min(this.maxHealth, this.health + this.maxHealth * time * this.healthRate);
  56. };
  57. this.restoreStamina = function(time) {
  58. this.stamina = Math.min(this.maxStamina, this.stamina + this.maxStamina * time * this.staminaRate);
  59. };
  60. this.flags = {};
  61. this.clear = function() {
  62. this.flags = {};
  63. };
  64. this.prefs = {
  65. prey: true,
  66. scat: true,
  67. grapple: true,
  68. vore: {
  69. oral: 1,
  70. anal: 1,
  71. cock: 1,
  72. unbirth: 1,
  73. breast: 1,
  74. hard: 1,
  75. soul: 1
  76. }
  77. };
  78. this.cash = Math.floor(Math.random() * 10 + 5);
  79. this.text = {};
  80. this.startCombat = function() {
  81. return [this.description("A") + " appears. It's a fight!"];
  82. };
  83. this.finishCombat = function() {
  84. return [this.description("The") + " scoops up your limp body and gulps you down."];
  85. };
  86. this.finishDigest = function() {
  87. return [this.description("The") + " digests you..."];
  88. };
  89. this.defeated = function() {
  90. startDialog(new FallenFoe(this));
  91. };
  92. this.changeStamina = function(amount) {
  93. this.stamina += amount;
  94. this.stamina = Math.min(this.maxStamina, this.stamina);
  95. this.stamina = Math.max(0, this.stamina);
  96. };
  97. this.tickEffects = function() {
  98. this.statBuffs.forEach(function(x) {
  99. x.tick();
  100. });
  101. this.statBuffs.filter(function(x) {
  102. return x.alive;
  103. });
  104. };
  105. }
  106. function Player(name = "Player") {
  107. Creature.call(this, name, 15, 15, 15);
  108. this.fullness = function() {
  109. return this.stomach.fullness() + this.butt.fullness();
  110. };
  111. this.attacks.push(punchAttack(this));
  112. this.attacks.push(flankAttack(this));
  113. this.attacks.push(grapple(this));
  114. this.attacks.push(grappleSubdue(this));
  115. this.attacks.push(grappleDevour(this));
  116. this.attacks.push(grappleAnalVore(this));
  117. this.attacks.push(grappleCockVore(this));
  118. this.attacks.push(grappleUnbirth(this));
  119. this.attacks.push(grappleBreastVore(this));
  120. this.attacks.push(grappleRelease(this));
  121. this.attacks.push(grappledStruggle(this));
  122. this.attacks.push(grappledReverse(this));
  123. this.attacks.push(shrunkGrapple(this));
  124. this.attacks.push(shrunkSwallow(this));
  125. this.attacks.push(shrunkStomp(this));
  126. this.attacks.push(pass(this));
  127. this.attacks.push(flee(this));
  128. this.backupAttack = pass(this);
  129. this.cash = 100;
  130. this.bowels = new Bowels();
  131. this.stomach = new Stomach(this, this.bowels);
  132. this.butt = new Butt(this, this.bowels, this.stomach);
  133. this.balls = new Balls(this);
  134. this.womb = new Womb(this);
  135. this.breasts = new Breasts(this);
  136. this.parts = {};
  137. }
  138. function Anthro(name = "Anthro") {
  139. this.build = pickRandom(["skinny", "fat", "muscular", "sickly", "ordinary"]);
  140. switch (this.build) {
  141. case "skinny":
  142. Creature.call(this, name, 8, 12, 8);
  143. this.mass *= (Math.random() * 0.2 + 0.7);
  144. break;
  145. case "fat":
  146. Creature.call(this, name, 10, 7, 15);
  147. this.mass *= (Math.random() * 0.4 + 1.1);
  148. break;
  149. case "muscular":
  150. Creature.call(this, name, 13, 11, 13);
  151. this.mass *= (Math.random() * 0.1 + 1.1);
  152. break;
  153. case "sickly":
  154. Creature.call(this, name, 6, 8, 6);
  155. this.mass *= (Math.random() * 0.2 + 0.6);
  156. break;
  157. case "ordinary":
  158. Creature.call(this, name, 10, 10, 10);
  159. break;
  160. }
  161. this.species = pickRandom(["dog", "cat", "lizard", "deer", "wolf", "fox"]);
  162. // todo better lol
  163. this.description = function(prefix = "") {
  164. if (this.build == "")
  165. if (prefix == "")
  166. return this.species;
  167. else
  168. return prefix + " " + this.species;
  169. else
  170. if (prefix == "")
  171. return this.build + " " + this.species;
  172. else
  173. return prefix + " " + this.build + " " + this.species;
  174. };
  175. this.attacks.push(new punchAttack(this));
  176. this.attacks.push(new flankAttack(this));
  177. this.attacks.push(new grapple(this));
  178. this.attacks.push(new grappleDevour(this));
  179. this.attacks.push(new grappledStruggle(this));
  180. this.attacks.push(new grappledReverse(this));
  181. this.backupAttack = new pass(this);
  182. this.struggles = [];
  183. this.struggles.push(new plead(this));
  184. this.struggles.push(new struggle(this));
  185. this.struggles.push(new submit(this));
  186. this.digests = [];
  187. this.digests.push(new digestPlayerStomach(this, 20));
  188. this.backupDigest = new digestPlayerStomach(this, 20);
  189. }
  190. function Fen() {
  191. Creature.call(this, name, 1000000, 1099900, 1000000);
  192. this.build = "loomy";
  193. this.species = "crux";
  194. this.description = function(prefix) {
  195. return "Fen";
  196. };
  197. this.attacks = [];
  198. this.attacks.push(new devourPlayer(this));
  199. this.attacks.push(new devourPlayerAnal(this));
  200. this.attacks.push(new leer(this));
  201. this.backupAttack = new poke(this);
  202. this.struggles = [];
  203. this.struggles.push(new rub(this));
  204. this.digests = [];
  205. this.digests.push(new instakillPlayerStomach(this));
  206. this.digests.push(new instakillPlayerBowels(this));
  207. this.backupDigest = new digestPlayerStomach(this, 50);
  208. }
  209. function Micro() {
  210. Creature.call(this, name);
  211. this.health = 5;
  212. this.mass = 0.1 * (Math.random() / 2 - 0.25 + 1);
  213. this.species = pick(["dog", "cat", "lizard", "deer", "wolf", "fox"]);
  214. this.description = function(prefix = "") {
  215. if (prefix == "")
  216. return "micro " + this.species;
  217. else
  218. return prefix + " micro " + this.species;
  219. };
  220. }
  221. // vore stuff here
  222. function Container(owner) {
  223. this.owner = owner;
  224. this.contents = [];
  225. // health/sec
  226. this.damageRate = 15 * 100 / 86400;
  227. // health percent/sec
  228. this.damageRatePercent = 1 / 86400;
  229. // kg/sec
  230. this.digestRate = 80 / 8640;
  231. this.digest = function(time) {
  232. let lines = [];
  233. this.contents.forEach(function(prey) {
  234. if (prey.health > 0) {
  235. let damage = Math.min(prey.health, this.damageRate * time + this.damageRatePercent * prey.maxHealth * time);
  236. prey.health -= damage;
  237. time -= damage / (this.damageRate + this.damageRatePercent * prey.maxHealth);
  238. if (prey.health + damage > 50 && prey.health <= 50) {
  239. lines.push(this.describeDamage(prey));
  240. }
  241. if (prey.health <= 0) {
  242. lines.push(this.describeKill(prey));
  243. }
  244. }
  245. if (prey.health <= 0) {
  246. let digested = Math.min(prey.mass, this.digestRate * time);
  247. prey.mass -= digested;
  248. this.owner.changeStamina(digested * 10);
  249. this.fill(digested);
  250. }
  251. if (prey.mass <= 0) {
  252. lines.push(this.describeFinish(prey));
  253. this.finish(prey);
  254. }
  255. this.contents = this.contents.filter(function(prey) {
  256. return prey.mass > 0;
  257. });
  258. }, this);
  259. return lines;
  260. };
  261. this.feed = function(prey) {
  262. this.contents.push(prey);
  263. };
  264. this.fullness = function() {
  265. return this.contents.reduce((total, prey) => total + prey.mass, 0);
  266. };
  267. }
  268. function Stomach(owner, bowels) {
  269. Container.call(this, owner);
  270. this.bowels = bowels;
  271. this.describeDamage = function(prey) {
  272. return "Your guts gurgle and churn, slowly wearing down " + prey.description("the") + " trapped within.";
  273. };
  274. this.describeKill = function(prey) {
  275. return prey.description("The") + "'s struggles wane as your stomach overpowers them.";
  276. };
  277. this.describeFinish = function(prey) {
  278. return "Your churning guts have reduced " + prey.description("a") + " to meaty chyme.";
  279. };
  280. this.fill = function(amount) {
  281. this.bowels.add(amount);
  282. };
  283. this.finish = function(prey) {
  284. this.bowels.finish(prey);
  285. };
  286. }
  287. function Butt(owner, bowels, stomach) {
  288. Container.call(this, owner);
  289. this.bowels = bowels;
  290. this.stomach = stomach;
  291. this.parentDigest = this.digest;
  292. this.digest = function(time) {
  293. this.contents.forEach(function(x) {
  294. x.timeInButt += time;
  295. });
  296. let lines = this.parentDigest(time);
  297. let pushed = this.contents.filter(prey => prey.timeInButt >= 60 * 30);
  298. pushed.forEach(function(x) {
  299. this.stomach.feed(x);
  300. lines.push("Your winding guts squeeze " + x.description("the") + " into your stomach.");
  301. }, this);
  302. this.contents = this.contents.filter(prey => prey.timeInButt < 60 * 30);
  303. return lines;
  304. };
  305. this.describeDamage = function(prey) {
  306. return "Your bowels gurgle and squeeze, working to wear down " + prey.description("the") + " trapped in those musky confines.";
  307. };
  308. this.describeKill = function(prey) {
  309. return prey.description("The") + " abruptly stops struggling, overpowered by your winding intestines.";
  310. };
  311. this.describeFinish = function(prey) {
  312. return "That delicious " + prey.description() + " didn't even make it to your stomach...now they're gone.";
  313. };
  314. this.parentFeed = this.feed;
  315. this.feed = function(prey) {
  316. prey.timeInButt = 0;
  317. this.parentFeed(prey);
  318. };
  319. this.fill = function(amount) {
  320. this.bowels.add(amount);
  321. };
  322. this.finish = function(prey) {
  323. this.bowels.finish(prey);
  324. };
  325. }
  326. function WasteContainer(name) {
  327. this.name = name;
  328. this.fullness = 0;
  329. this.digested = [];
  330. this.add = function(amount) {
  331. this.fullness += amount;
  332. };
  333. this.finish = function(prey) {
  334. if (prey.prefs.scat)
  335. this.digested.push(prey);
  336. };
  337. }
  338. function Balls(owner) {
  339. Container.call(this, owner);
  340. WasteContainer.call(this, "Balls");
  341. this.describeDamage = function(prey) {
  342. return "Your balls slosh as they wear down the " + prey.description("the") + " trapped within.";
  343. };
  344. this.describeKill = function(prey) {
  345. return prey.description("The") + "'s struggles cease, overpowered by your cum-filled balls.";
  346. };
  347. this.describeFinish = function(prey) {
  348. return "Your churning balls have melted " + prey.description("a") + " down to musky cum.";
  349. };
  350. this.fill = function(amount) {
  351. this.add(amount);
  352. };
  353. this.finish = function(prey) {
  354. if (prey.prefs.scat)
  355. this.digested.push(prey);
  356. };
  357. }
  358. function Womb(owner) {
  359. Container.call(this, owner);
  360. WasteContainer.call(this, "Womb");
  361. this.describeDamage = function(prey) {
  362. return "You shiver as " + prey.description("the") + " squrims within your womb.";
  363. };
  364. this.describeKill = function(prey) {
  365. return "Your womb clenches and squeezes, overwhelming " + prey.description("the") + " trapped within.";
  366. };
  367. this.describeFinish = function(prey) {
  368. return "Your womb dissolves " + prey.description("a") + " into femcum.";
  369. };
  370. this.fill = function(amount) {
  371. this.add(amount);
  372. };
  373. this.finish = function(prey) {
  374. if (prey.prefs.scat)
  375. this.digested.push(prey);
  376. };
  377. }
  378. function Breasts(owner) {
  379. Container.call(this, owner);
  380. WasteContainer.call(this, "Breasts");
  381. this.describeDamage = function(prey) {
  382. return "Your breasts slosh from side to side, steadily softening " + prey.description("the") + " trapped within.";
  383. };
  384. this.describeKill = function(prey) {
  385. return prey.description("The") + " gives one last mighty shove...and then slumps back in your breasts.";
  386. };
  387. this.describeFinish = function(prey) {
  388. return "Your breasts have broken " + prey.description("a") + " down to creamy milk.";
  389. };
  390. this.fill = function(amount) {
  391. this.add(amount);
  392. };
  393. this.finish = function(prey) {
  394. if (prey.prefs.scat)
  395. this.digested.push(prey);
  396. };
  397. }
  398. function Bowels() {
  399. WasteContainer.call(this, "Bowels");
  400. }
  401. // PLAYER PREY
  402. function plead(predator) {
  403. return {
  404. name: "Plead",
  405. desc: "Ask very, very nicely for the predator to let you go. More effective if you haven't hurt your predator.",
  406. struggle: function(player) {
  407. let escape = Math.random() < predator.health / predator.maxHealth && Math.random() < 0.33;
  408. if (player.health <= 0) {
  409. escape = escape && Math.random() < 0.25;
  410. }
  411. if (escape) {
  412. player.clear();
  413. predator.clear();
  414. return {
  415. "escape": "escape",
  416. "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"]
  417. };
  418. } else {
  419. return {
  420. "escape": "stuck",
  421. "lines": ["You plead with " + predator.description("the") + " to let you go, but they refuse."]
  422. };
  423. }
  424. }
  425. };
  426. }
  427. function struggle(predator) {
  428. return {
  429. name: "Struggle",
  430. desc: "Try to squirm free. More effective if you've hurt your predator.",
  431. struggle: function(player) {
  432. let escape = Math.random() > predator.health / predator.maxHealth && Math.random() < 0.33;
  433. if (player.health <= 0 || player.stamina <= 0) {
  434. escape = escape && Math.random() < 0.25;
  435. }
  436. if (escape) {
  437. player.clear();
  438. predator.clear();
  439. return {
  440. "escape": "escape",
  441. "lines": ["You struggle and squirm, forcing " + predator.description("the") + " to hork you up. They groan and stumble away, exhausted by your efforts."]
  442. };
  443. } else {
  444. return {
  445. "escape": "stuck",
  446. "lines": ["You squirm and writhe within " + predator.description("the") + " to no avail."]
  447. };
  448. }
  449. }
  450. };
  451. }
  452. function struggleStay(predator) {
  453. return {
  454. name: "Struggle",
  455. desc: "Try to squirm free. More effective if you've hurt your predator.",
  456. struggle: function(player) {
  457. let escape = Math.random() > predator.health / predator.maxHealth && Math.random() < 0.33;
  458. if (player.health <= 0 || player.stamina <= 0) {
  459. escape = escape && Math.random() < 0.25;
  460. }
  461. if (escape) {
  462. player.clear();
  463. predator.clear();
  464. return {
  465. "escape": "stay",
  466. "lines": ["You struggle and squirm, forcing " + predator.description("the") + " to hork you up. They're not done with you yet..."]
  467. };
  468. } else {
  469. return {
  470. "escape": "stuck",
  471. "lines": ["You squirm and writhe within " + predator.description("the") + " to no avail."]
  472. };
  473. }
  474. }
  475. };
  476. }
  477. function rub(predator) {
  478. return {
  479. name: "Rub",
  480. desc: "Rub rub rub",
  481. struggle: function(player) {
  482. return {
  483. "escape": "stuck",
  484. "lines": ["You rub the crushing walls. At least " + predator.description("the") + " is getting something out of this."]
  485. };
  486. }
  487. };
  488. }
  489. function submit(predator) {
  490. return {
  491. name: "Submit",
  492. desc: "Do nothing",
  493. struggle: function(player) {
  494. return {
  495. "escape": "stuck",
  496. "lines": ["You do nothing."]
  497. };
  498. }
  499. };
  500. }