munch
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

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