crunch
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.
 
 
 

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