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.
 
 
 

202 lignes
5.6 KiB

  1. "use strict";
  2. function DialogNode() {
  3. this.text = [];
  4. this.hooks = [];
  5. this.requirements = [];
  6. this.visit = function() {
  7. for (let i=0; i<this.hooks.length; i++)
  8. this.hooks[i]();
  9. };
  10. this.choices = [];
  11. this.addChoice = function(text,node,tests=[]) {
  12. this.choices.push({"text": text, "node": node, "tests": []});
  13. };
  14. }
  15. function EatDude() {
  16. DialogNode.call(this);
  17. let nerd = new Anthro();
  18. this.text = ["You approach " + nerd.description("the")];
  19. let eatHim = new DialogNode();
  20. eatHim.text = ["You eat the nerd. Burp."];
  21. eatHim.hooks.push(function() { player.stomach.feed(nerd); });
  22. let dontEatHim = new DialogNode();
  23. dontEatHim.text = ["You don't eat the nerd."];
  24. this.addChoice("Eat him lol",eatHim);
  25. this.addChoice("Actually don't",dontEatHim);
  26. }
  27. function PhoneCall() {
  28. DialogNode.call(this);
  29. this.text = ["You pick up the phone. Who do you want to call?"];
  30. {
  31. let nodeFen = new DialogNode();
  32. this.addChoice("Fen",nodeFen);
  33. nodeFen.text = ["You dial Fen's number. Milliseconds later, he kicks open your front door and dabs on you, then runs away."];
  34. }
  35. {
  36. let nodeNerd = new DialogNode();
  37. this.addChoice("Some nerd",nodeNerd);
  38. nodeNerd.text = ["You dial some nerd. He shows up at your front door."];
  39. nodeNerd.hooks.push(function() { startDialog(new EatDude()); });
  40. }
  41. {
  42. let nodeCrash = new DialogNode();
  43. this.addChoice("Crash the game",nodeCrash);
  44. nodeCrash.text = ["Oh no oops"];
  45. nodeCrash.hooks.push(function() { potato() });
  46. }
  47. }
  48. function FallenFoe(foe) {
  49. DialogNode.call(this);
  50. this.text = [foe.description("The") + " falls to the ground!", newline, "What do you want to do with your enemy?"];
  51. {
  52. let nodeEat = new DialogNode();
  53. this.addChoice("Devour!",nodeEat);
  54. nodeEat.text = ["You grab your helpless prey and force them down your gullet. You hack up their wallet a minute later, finding $" + foe.cash + " inside."];
  55. nodeEat.requirements.push( function(attacker, defender) {
  56. return defender.prefs.prey;
  57. });
  58. nodeEat.hooks.push(function() {
  59. player.cash += foe.cash;
  60. });
  61. nodeEat.hooks.push(function() {
  62. player.stomach.feed(foe);
  63. })
  64. }
  65. {
  66. let nodeSpare = new DialogNode();
  67. this.addChoice("Spare",nodeSpare);
  68. nodeSpare.text = ["You decide to leave your foe uneaten.", newline, "You do help yourself to the $" + foe.cash + " in their pockets, though."];
  69. nodeSpare.hooks.push(function() {
  70. player.cash += foe.cash;
  71. });
  72. }
  73. {
  74. let nodeCrush = new DialogNode();
  75. this.addChoice("Crush",nodeCrush);
  76. nodeCrush.text = ["You slam your paw down hard, crushing " + foe.description("the") + " like a bug"];
  77. nodeCrush.requirements.push( function(attacker, defender) {
  78. return defender.flags.shrunk == true;
  79. });
  80. }
  81. }
  82. function NatureExercise() {
  83. DialogNode.call(this);
  84. this.text = ["What do you want to do?"];
  85. {
  86. let nodeStrength = new DialogNode();
  87. this.addChoice("Rock Climbing (+STR)", nodeStrength);
  88. nodeStrength.text = ["You clamber up walls for a while. You feel a little stronger."];
  89. nodeStrength.hooks.push(function() {
  90. player.str += 1;
  91. advanceTime(60*30);
  92. });
  93. }
  94. {
  95. let nodeDexterity = new DialogNode();
  96. this.addChoice("Jogging (+DEX)", nodeDexterity);
  97. nodeDexterity.text = ["You go run for a run around the three-mile-long trail. You feel a little more agile."];
  98. nodeDexterity.hooks.push(function() {
  99. player.dex += 1;
  100. advanceTime(60*30);
  101. });
  102. }
  103. {
  104. let nodeConstitution = new DialogNode();
  105. this.addChoice("Bang your head on a tree (+CON)", nodeConstitution);
  106. nodeConstitution.text = ["You bash your face on a tree for half an hour. I guess that helps."];
  107. nodeConstitution.hooks.push(function() {
  108. player.con += 1;
  109. advanceTime(60*30);
  110. });
  111. }
  112. }
  113. function VendingMachinePurchase() {
  114. DialogNode.call(this);
  115. this.text = ["You walk up to the vending machine. A variety of foodstuffs and drinks are on display...along with some more unconventional items."];
  116. {
  117. let nodeCandy = new DialogNode();
  118. this.addChoice("Buy a candy bar ($2, +50 stamina)", nodeCandy);
  119. nodeCandy.text = ["You insert two dollar bills into the machine and select the candy bar. Chocolate and nougat, mmm."];
  120. nodeCandy.hooks.push(function() {
  121. player.cash -= 2;
  122. player.changeStamina(50);
  123. });
  124. nodeCandy.requirements.push(function(player) {
  125. return player.cash >= 2;
  126. });
  127. }
  128. {
  129. let nodeSoda = new DialogNode();
  130. this.addChoice("Buy a soda ($4, +150 stamina)", nodeSoda);
  131. nodeSoda.text = ["You insert a dollar and coins, then select a soda. You're pretty you saw something on the news about it turning people purple, but you can't resist that delicious Citrus Substitute Flavor&trade;"];
  132. nodeSoda.hooks.push(function() {
  133. player.cash -= 2;
  134. player.changeStamina(150);
  135. });
  136. nodeSoda.requirements.push(function(player) {
  137. return player.cash >= 2;
  138. });
  139. }
  140. {
  141. let prey = new Micro();
  142. let nodeMicro = new DialogNode();
  143. this.addChoice("Buy a micro ($10)", nodeMicro);
  144. nodeMicro.text = ["You stuff a wad of bills into the machine. " + prey.description("A") + " tumbles into the vending slot; you scoop them up and stuff them into your jaws without a second thought. Tasty."];
  145. nodeMicro.hooks.push(function() {
  146. player.stomach.feed(prey);
  147. player.cash -= 10;
  148. });
  149. nodeMicro.requirements.push(function(player) {
  150. return player.cash >= 10;
  151. });
  152. }
  153. {
  154. let nodeCancel = new DialogNode();
  155. this.addChoice("Nevermind", nodeCancel);
  156. nodeCancel.text = ["You decide to not purchase anything."];
  157. }
  158. }