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

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