munch
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

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