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

799 行
20 KiB

  1. "use strict";
  2. function StatBuff(type, amount) {
  3. this.stat = type;
  4. this.amount = amount;
  5. }
  6. function Creature(name = "Creature", str = 10, dex = 10, con = 10) {
  7. this.name = name;
  8. this.mass = 80;
  9. this.attacks = [];
  10. this.baseStr = str;
  11. this.baseDex = dex;
  12. this.baseCon = con;
  13. this.statBuffs = [];
  14. this.statMultiplier = function(stat) {
  15. let multiplier = 1;
  16. return this.statBuffs.reduce((multiplier, effect) => (effect.stat == stat) ? multiplier * effect.amount : multiplier, multiplier);
  17. };
  18. Object.defineProperty(this, "str", {
  19. get: function() {
  20. return this.baseStr * this.statMultiplier("str");
  21. },
  22. set: function(val) {
  23. this.baseStr = val;
  24. }
  25. });
  26. Object.defineProperty(this, "dex", {
  27. get: function() {
  28. return this.baseDex * this.statMultiplier("dex");
  29. },
  30. set: function(val) {
  31. this.baseDex = val;
  32. }
  33. });
  34. Object.defineProperty(this, "con", {
  35. get: function() {
  36. return this.baseCon * this.statMultiplier("con");
  37. },
  38. set: function(val) {
  39. this.baseCon = val;
  40. }
  41. });
  42. this.hasName = false;
  43. Object.defineProperty(this, "maxHealth", {
  44. get: function() {
  45. return this.str * 5 + this.con * 10;
  46. }
  47. });
  48. this.health = this.maxHealth;
  49. Object.defineProperty(this, "maxStamina", {
  50. get: function() {
  51. return this.dex * 5 + this.con * 10;
  52. }
  53. });
  54. this.stamina = this.maxStamina;
  55. // fraction of max health per second
  56. this.healthRate = 1 / 86400 * 4;
  57. this.staminaRate = 1 / 86400 * 6;
  58. this.healthPercentage = function() {
  59. return this.health / this.maxHealth;
  60. };
  61. this.staminaPercentage = function() {
  62. return this.stamina / this.maxStamina;
  63. };
  64. this.restoreHealth = function(time) {
  65. this.health = Math.min(this.maxHealth, this.health + this.maxHealth * time * this.healthRate);
  66. };
  67. this.restoreStamina = function(time) {
  68. this.stamina = Math.min(this.maxStamina, this.stamina + this.maxStamina * time * this.staminaRate);
  69. };
  70. this.flags = {};
  71. this.clear = function() {
  72. this.flags = {};
  73. };
  74. this.prefs = {
  75. prey: true,
  76. scat: true,
  77. grapple: true,
  78. vore: {
  79. oral: 1,
  80. anal: 1,
  81. cock: 1,
  82. unbirth: 1,
  83. breast: 1,
  84. hard: 1,
  85. soul: 1
  86. }
  87. };
  88. this.cash = Math.floor(Math.random() * 10 + 5);
  89. this.text = {};
  90. this.startCombat = function() {
  91. return [this.description("A") + " appears. It's a fight!"];
  92. };
  93. this.finishCombat = function() {
  94. return [this.description("The") + " scoops up your limp body and gulps you down."];
  95. };
  96. this.finishDigest = function() {
  97. return [this.description("The") + " digests you..."];
  98. };
  99. this.defeated = function() {
  100. startDialog(new FallenFoe(this));
  101. };
  102. this.changeStamina = function(amount) {
  103. this.stamina += amount;
  104. this.stamina = Math.min(this.maxStamina, this.stamina);
  105. this.stamina = Math.max(0, this.stamina);
  106. };
  107. this.tickEffects = function() {
  108. this.statBuffs.forEach(function(x) {
  109. x.tick();
  110. });
  111. this.statBuffs.filter(function(x) {
  112. return x.alive;
  113. });
  114. };
  115. }
  116. function Player(name = "Player") {
  117. Creature.call(this, name, 15, 15, 15);
  118. this.attacks.push(punchAttack(this));
  119. this.attacks.push(flankAttack(this));
  120. this.attacks.push(grapple(this));
  121. this.attacks.push(grappleSubdue(this));
  122. this.attacks.push(grappleDevour(this));
  123. this.attacks.push(grappleAnalVore(this));
  124. this.attacks.push(grappleCockVore(this));
  125. this.attacks.push(grappleUnbirth(this));
  126. this.attacks.push(grappleBreastVore(this));
  127. this.attacks.push(grappleRelease(this));
  128. this.attacks.push(grappledStruggle(this));
  129. this.attacks.push(grappledReverse(this));
  130. this.attacks.push(shrunkGrapple(this));
  131. this.attacks.push(shrunkSwallow(this));
  132. this.attacks.push(shrunkStomp(this));
  133. this.attacks.push(pass(this));
  134. this.attacks.push(flee(this));
  135. this.backupAttack = pass(this);
  136. this.cash = 100;
  137. this.stomach = new Stomach(this);
  138. this.bowels = new Bowels(this, this.stomach);
  139. this.stomach.bowels = this.bowels;
  140. this.balls = new Balls(this);
  141. this.womb = new Womb(this);
  142. this.breasts = new Breasts(this);
  143. this.parts = {};
  144. this.arousal = 0;
  145. this.arousalRate = 100 / 86400 * 2;
  146. this.arousalLimit = function() {
  147. return 100 * Math.sqrt(this.con / 15);
  148. };
  149. this.buildArousal = function(time) {
  150. this.arousal += this.arousalRate * time;
  151. this.arousal += this.arousalRate * this.bowels.fullnessPercent();
  152. this.arousal += this.arousalRate * this.balls.fullnessPercent();
  153. this.arousal += this.arousalRate * this.womb.fullnessPercent();
  154. this.arousal += this.arousalRate * this.breasts.fullnessPercent();
  155. if (this.arousal >= this.arousalLimit()) {
  156. update(this.orgasm());
  157. }
  158. };
  159. this.orgasm = function() {
  160. this.arousal = 0;
  161. let result = [];
  162. result.push("You're cumming!", newline);
  163. if (this.balls.waste > 0) {
  164. result.push(this.balls.describeOrgasm(), newline);
  165. }
  166. if (this.bowels.waste > 0) {
  167. result.push(this.bowels.describeOrgasm(), newline);
  168. }
  169. if (this.womb.waste > 0) {
  170. result.push(this.womb.describeOrgasm(), newline);
  171. }
  172. if (this.breasts.waste > 0) {
  173. result.push(this.breasts.describeOrgasm(), newline);
  174. }
  175. return result;
  176. };
  177. }
  178. function Anthro(name = "Anthro") {
  179. this.build = pickRandom(["skinny", "fat", "muscular", "sickly", "ordinary"]);
  180. switch (this.build) {
  181. case "skinny":
  182. Creature.call(this, name, 8, 12, 8);
  183. this.mass *= (Math.random() * 0.2 + 0.7);
  184. break;
  185. case "fat":
  186. Creature.call(this, name, 10, 7, 15);
  187. this.mass *= (Math.random() * 0.4 + 1.1);
  188. break;
  189. case "muscular":
  190. Creature.call(this, name, 13, 11, 13);
  191. this.mass *= (Math.random() * 0.1 + 1.1);
  192. break;
  193. case "sickly":
  194. Creature.call(this, name, 6, 8, 6);
  195. this.mass *= (Math.random() * 0.2 + 0.6);
  196. break;
  197. case "ordinary":
  198. Creature.call(this, name, 10, 10, 10);
  199. break;
  200. }
  201. this.species = pickRandom(["dog", "cat", "lizard", "deer", "wolf", "fox"]);
  202. // todo better lol
  203. this.description = function(prefix = "") {
  204. if (this.build == "")
  205. if (prefix == "")
  206. return this.species;
  207. else
  208. return prefix + " " + this.species;
  209. else
  210. if (prefix == "")
  211. return this.build + " " + this.species;
  212. else
  213. return prefix + " " + this.build + " " + this.species;
  214. };
  215. this.attacks.push(new punchAttack(this));
  216. this.attacks.push(new flankAttack(this));
  217. this.attacks.push(new grapple(this));
  218. this.attacks.push(new grappleDevour(this));
  219. this.attacks.push(new grappledStruggle(this));
  220. this.attacks.push(new grappledReverse(this));
  221. this.backupAttack = new pass(this);
  222. this.struggles = [];
  223. this.struggles.push(new plead(this));
  224. this.struggles.push(new struggle(this));
  225. this.struggles.push(new submit(this));
  226. this.digests = [];
  227. this.digests.push(new digestPlayerStomach(this, 20));
  228. this.backupDigest = new digestPlayerStomach(this, 20);
  229. }
  230. function Fen() {
  231. Creature.call(this, name, 1000000, 1099900, 1000000);
  232. this.build = "loomy";
  233. this.species = "crux";
  234. this.description = function(prefix) {
  235. return "Fen";
  236. };
  237. this.attacks = [];
  238. this.attacks.push(new devourPlayer(this));
  239. this.attacks.push(new devourPlayerAnal(this));
  240. this.attacks.push(new devourPlayerSoul(this));
  241. this.attacks.push(new devourPlayerHard(this));
  242. this.attacks.push(new leer(this));
  243. this.backupAttack = new poke(this);
  244. this.struggles = [];
  245. this.struggles.push(new rub(this));
  246. this.struggles.push(new whimper(this));
  247. this.struggles.push(new gurgle(this));
  248. this.struggles.push(new twitch(this));
  249. this.digests = [];
  250. this.digests.push(new instakillPlayerStomach(this));
  251. this.digests.push(new instakillPlayerBowels(this));
  252. this.digests.push(new fenPlayerBowelsSoul(this));
  253. this.digests.push(new fenFeedHard(this));
  254. this.digests.push(new instakillPlayerStomachSoul(this));
  255. this.backupDigest = new digestPlayerStomach(this, 50);
  256. }
  257. function Micro() {
  258. Creature.call(this, name);
  259. this.health = 5;
  260. this.mass = 0.1 * (Math.random() / 2 - 0.25 + 1);
  261. this.species = pick(["dog", "cat", "lizard", "deer", "wolf", "fox"]);
  262. this.description = function(prefix = "") {
  263. if (prefix == "")
  264. return "micro " + this.species;
  265. else
  266. return prefix + " micro " + this.species;
  267. };
  268. }
  269. // vore stuff here
  270. function Container(owner) {
  271. this.owner = owner;
  272. this.contents = [];
  273. this.waste = 0;
  274. this.digested = [];
  275. // health/sec
  276. this.damageRate = 15 * 100 / 86400;
  277. // health percent/sec
  278. this.damageRatePercent = 1 / 86400;
  279. this.capacity = 100;
  280. // kg/sec
  281. this.digestRate = 80 / 8640; //100kg/3hr equivalent
  282. this.digest = function(time) {
  283. let lines = [];
  284. this.contents.forEach(function(prey) {
  285. if (prey.health > 0) {
  286. let damage = Math.min(prey.health, this.damageRate * time + this.damageRatePercent * prey.maxHealth * time);
  287. prey.health -= damage;
  288. time -= damage / (this.damageRate + this.damageRatePercent * prey.maxHealth);
  289. if (prey.health + damage > 50 && prey.health <= 50) {
  290. lines.push(this.describeDamage(prey));
  291. }
  292. if (prey.health <= 0) {
  293. lines.push(this.describeKill(prey));
  294. }
  295. }
  296. if (prey.health <= 0) {
  297. let digested = Math.min(prey.mass, this.digestRate * time * (this.capacity/100));
  298. prey.mass -= digested;
  299. this.owner.changeStamina(digested * 10);
  300. this.fill(digested);
  301. }
  302. if (prey.mass <= 0) {
  303. lines.push(this.describeFinish(prey));
  304. this.finish(prey);
  305. }
  306. this.contents = this.contents.filter(function(prey) {
  307. return prey.mass > 0;
  308. });
  309. }, this);
  310. return lines;
  311. };
  312. this.feed = function(prey) {
  313. this.contents.push(prey);
  314. };
  315. this.fullness = function() {
  316. return this.contents.reduce((total, prey) => total + prey.mass, 0) + this.waste;
  317. };
  318. this.fullnessPercent = function() {
  319. return this.fullness() / this.capacity;
  320. };
  321. this.add = function(amount) {
  322. this.waste += amount;
  323. };
  324. this.finish = function(prey) {
  325. if (prey.prefs.scat)
  326. this.digested.push(prey);
  327. };
  328. }
  329. function Stomach(owner) {
  330. Container.call(this, owner);
  331. this.describeDamage = function(prey) {
  332. return "Your guts gurgle and churn, slowly wearing down " + prey.description("the") + " trapped within.";
  333. };
  334. this.describeKill = function(prey) {
  335. return prey.description("The") + "'s struggles wane as your stomach overpowers them.";
  336. };
  337. this.describeFinish = function(prey) {
  338. return "Your churning guts have reduced " + prey.description("a") + " to meaty chyme.";
  339. };
  340. this.fill = function(amount) {
  341. if (owner.prefs.scat)
  342. this.bowels.add(amount);
  343. };
  344. this.finish = function(prey) {
  345. this.bowels.finish(prey);
  346. };
  347. }
  348. function Bowels(owner, stomach) {
  349. Container.call(this, owner);
  350. this.stomach = stomach;
  351. this.parentDigest = this.digest;
  352. this.digest = function(time) {
  353. this.contents.forEach(function(x) {
  354. x.timeInBowels += time;
  355. });
  356. let lines = this.parentDigest(time);
  357. let pushed = this.contents.filter(prey => prey.timeInBowels >= 60 * 30);
  358. pushed.forEach(function(x) {
  359. this.stomach.feed(x);
  360. lines.push("Your winding guts squeeze " + x.description("the") + " into your stomach.");
  361. }, this);
  362. this.contents = this.contents.filter(prey => prey.timeInBowels < 60 * 30);
  363. return lines;
  364. };
  365. this.describeDamage = function(prey) {
  366. return "Your bowels gurgle and squeeze, working to wear down " + prey.description("the") + " trapped in those musky confines.";
  367. };
  368. this.describeKill = function(prey) {
  369. return prey.description("The") + " abruptly stops struggling, overpowered by your winding intestines.";
  370. };
  371. this.describeFinish = function(prey) {
  372. return "That delicious " + prey.description() + " didn't even make it to your stomach...now they're gone.";
  373. };
  374. this.describeOrgasm = function() {
  375. let line = "Your knees buckle as your bowels clench and squeeze, forcing out a " + Math.round(this.waste) + "-pound heap of shit in several pleasurable - and forceful - heaves.";
  376. if (this.digested.length > 0) {
  377. line += " The bones of " + join(this.digested) + " are streaked throughout your waste.";
  378. this.digested = [];
  379. }
  380. this.waste = 0;
  381. return [line];
  382. };
  383. this.parentFeed = this.feed;
  384. this.feed = function(prey) {
  385. prey.timeInBowels = 0;
  386. this.parentFeed(prey);
  387. };
  388. this.fill = function(amount) {
  389. if (owner.prefs.scat)
  390. this.add(amount);
  391. };
  392. this.finish = function(prey) {
  393. if (prey.prefs.scat)
  394. this.digested.push(prey);
  395. };
  396. }
  397. function Balls(owner) {
  398. Container.call(this, owner);
  399. this.describeDamage = function(prey) {
  400. return "Your balls slosh as they wear down the " + prey.description("the") + " trapped within.";
  401. };
  402. this.describeKill = function(prey) {
  403. return prey.description("The") + "'s struggles cease, overpowered by your cum-filled balls.";
  404. };
  405. this.describeFinish = function(prey) {
  406. return "Your churning balls have melted " + prey.description("a") + " down to musky cum.";
  407. };
  408. this.describeOrgasm = function() {
  409. let line = "You heavy balls empty themselves over a nearby wall, spraying it with " + Math.round(this.waste) + " pounds of thick cum.";
  410. if (this.digested.length > 0) {
  411. line += " All that seed used to be " + join(this.digested) + ".";
  412. this.digested = [];
  413. }
  414. this.waste = 0;
  415. return [line];
  416. };
  417. this.fill = function(amount) {
  418. this.add(amount);
  419. };
  420. this.finish = function(prey) {
  421. this.digested.push(prey);
  422. };
  423. }
  424. function Womb(owner) {
  425. Container.call(this, owner);
  426. this.describeDamage = function(prey) {
  427. return "You shiver as " + prey.description("the") + " squrims within your womb.";
  428. };
  429. this.describeKill = function(prey) {
  430. return "Your womb clenches and squeezes, overwhelming " + prey.description("the") + " trapped within.";
  431. };
  432. this.describeFinish = function(prey) {
  433. return "Your womb dissolves " + prey.description("a") + " into femcum.";
  434. };
  435. this.describeOrgasm = function() {
  436. let line = "You moan and stumble, nethers exploding with ecstasy and gushing out " + Math.round(this.waste/2.2) + " liters of musky, slick femcum.";
  437. if (this.digested.length > 0) {
  438. line += " You pant, fingering yourself as the remains of " + join(this.digested) + " drip onto the floor.";
  439. this.digested = [];
  440. }
  441. this.waste = 0;
  442. return [line];
  443. };
  444. this.fill = function(amount) {
  445. this.add(amount);
  446. };
  447. this.finish = function(prey) {
  448. this.digested.push(prey);
  449. };
  450. }
  451. function Breasts(owner) {
  452. Container.call(this, owner);
  453. this.describeDamage = function(prey) {
  454. return "Your breasts slosh from side to side, steadily softening " + prey.description("the") + " trapped within.";
  455. };
  456. this.describeKill = function(prey) {
  457. return prey.description("The") + " gives one last mighty shove...and then slumps back in your breasts.";
  458. };
  459. this.describeFinish = function(prey) {
  460. return "Your breasts have broken " + prey.description("a") + " down to creamy milk.";
  461. };
  462. this.describeOrgasm = function() {
  463. let line = "Thick, creamy milk leaks from your overfilled breasts. You grab and squeeze, milking out " + Math.round(this.waste/2.2) + " liters of the warm fluid.";
  464. if (this.digested.length > 0) {
  465. line += " All that milk used to be " + join(this.digested) + ".";
  466. this.digested = [];
  467. }
  468. this.waste = 0;
  469. return [line];
  470. };
  471. this.fill = function(amount) {
  472. this.add(amount);
  473. };
  474. this.finish = function(prey) {
  475. this.digested.push(prey);
  476. };
  477. }
  478. // PLAYER PREY
  479. function plead(predator) {
  480. return {
  481. name: "Plead",
  482. desc: "Ask very, very nicely for the predator to let you go. More effective if you haven't hurt your predator.",
  483. struggle: function(player) {
  484. let escape = Math.random() < predator.health / predator.maxHealth && Math.random() < 0.33;
  485. if (player.health <= 0) {
  486. escape = escape && Math.random() < 0.25;
  487. }
  488. if (escape) {
  489. player.clear();
  490. predator.clear();
  491. return {
  492. "escape": "escape",
  493. "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"]
  494. };
  495. } else {
  496. return {
  497. "escape": "stuck",
  498. "lines": ["You plead with " + predator.description("the") + " to let you go, but they refuse."]
  499. };
  500. }
  501. }
  502. };
  503. }
  504. function struggle(predator) {
  505. return {
  506. name: "Struggle",
  507. desc: "Try to squirm free. More effective if you've hurt your predator.",
  508. struggle: function(player) {
  509. let escape = Math.random() > predator.health / predator.maxHealth && Math.random() < 0.33;
  510. if (player.health <= 0 || player.stamina <= 0) {
  511. escape = escape && Math.random() < 0.25;
  512. }
  513. if (escape) {
  514. player.clear();
  515. predator.clear();
  516. return {
  517. "escape": "escape",
  518. "lines": ["You struggle and squirm, forcing " + predator.description("the") + " to hork you up. They groan and stumble away, exhausted by your efforts."]
  519. };
  520. } else {
  521. return {
  522. "escape": "stuck",
  523. "lines": ["You squirm and writhe within " + predator.description("the") + " to no avail."]
  524. };
  525. }
  526. }
  527. };
  528. }
  529. function struggleStay(predator) {
  530. return {
  531. name: "Struggle",
  532. desc: "Try to squirm free. More effective if you've hurt your predator.",
  533. struggle: function(player) {
  534. let escape = Math.random() > predator.health / predator.maxHealth && Math.random() < 0.33;
  535. if (player.health <= 0 || player.stamina <= 0) {
  536. escape = escape && Math.random() < 0.25;
  537. }
  538. if (escape) {
  539. player.clear();
  540. predator.clear();
  541. return {
  542. "escape": "stay",
  543. "lines": ["You struggle and squirm, forcing " + predator.description("the") + " to hork you up. They're not done with you yet..."]
  544. };
  545. } else {
  546. return {
  547. "escape": "stuck",
  548. "lines": ["You squirm and writhe within " + predator.description("the") + " to no avail."]
  549. };
  550. }
  551. }
  552. };
  553. }
  554. function rub(predator) {
  555. return {
  556. name: "Rub",
  557. desc: "Rub rub rub",
  558. struggle: function(player) {
  559. return {
  560. "escape": "stuck",
  561. "lines": ["You rub the crushing walls. At least " + predator.description("the") + " is getting something out of this."]
  562. };
  563. },
  564. requirements: [
  565. function(defender, attacker) {
  566. return defender.flags.voreType != "hard";
  567. }
  568. ]
  569. };
  570. }
  571. function whimper(predator) {
  572. return {
  573. name: "Whimper",
  574. desc: "<i>Whiiiiine</i>",
  575. struggle: function(player) {
  576. return {
  577. "escape": "stuck",
  578. "lines": ["You whimper weakly."]
  579. };
  580. },
  581. requirements: [
  582. function(defender, attacker) {
  583. return defender.flags.voreType == "hard" && defender.flags.hardTurns == 0;
  584. }
  585. ]
  586. };
  587. }
  588. function gurgle(predator) {
  589. return {
  590. name: "Gurgle",
  591. desc: "gurgle gurgle",
  592. struggle: function(player) {
  593. return {
  594. "escape": "stuck",
  595. "lines": ["You let out a faint gurgling sound."]
  596. };
  597. },
  598. requirements: [
  599. function(defender, attacker) {
  600. return defender.flags.voreType == "hard" && defender.flags.hardTurns == 1 || defender.flags.hardTurns == 2;
  601. }
  602. ]
  603. };
  604. }
  605. function twitch(predator) {
  606. return {
  607. name: "Twitch",
  608. desc: "<i>twitch</i>",
  609. struggle: function(player) {
  610. return {
  611. "escape": "stuck",
  612. "lines": ["You twitch."]
  613. };
  614. },
  615. requirements: [
  616. function(defender, attacker) {
  617. return defender.flags.voreType == "hard" && defender.flags.hardTurns >= 3;
  618. }
  619. ]
  620. };
  621. }
  622. function submit(predator) {
  623. return {
  624. name: "Submit",
  625. desc: "Do nothing",
  626. struggle: function(player) {
  627. return {
  628. "escape": "stuck",
  629. "lines": ["You do nothing."]
  630. };
  631. }
  632. };
  633. }