crunch
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

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