munch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

120 lines
3.0 KiB

  1. "use strict";
  2. function DialogNode() {
  3. this.text = "Foo bar baz.";
  4. this.hooks = [];
  5. this.visit = function() {
  6. for (let i=0; i<this.hooks.length; i++)
  7. this.hooks[i]();
  8. };
  9. this.choices = [];
  10. this.addChoice = function(text,node,tests=[]) {
  11. this.choices.push({"text": text, "node": node, "tests": []});
  12. };
  13. }
  14. function EatDude() {
  15. DialogNode.call(this);
  16. let nerd = new Anthro();
  17. this.text = "You approach " + nerd.description("the");
  18. let eatHim = new DialogNode();
  19. eatHim.text = "You eat the nerd. Burp.";
  20. eatHim.hooks.push(function() { player.stomach.feed(nerd); });
  21. let dontEatHim = new DialogNode();
  22. dontEatHim.text = "You don't eat the nerd.";
  23. this.addChoice("Eat him lol",eatHim);
  24. this.addChoice("Actually don't",dontEatHim);
  25. }
  26. function PhoneCall() {
  27. DialogNode.call(this);
  28. this.text = "You pick up the phone. Who do you want to call?";
  29. {
  30. let nodeFen = new DialogNode();
  31. this.addChoice("Fen",nodeFen);
  32. nodeFen.text = "You dial Fen's number. Milliseconds later, he kicks open your front door and dabs on you, then runs away.";
  33. }
  34. {
  35. let nodeNerd = new DialogNode();
  36. this.addChoice("Some nerd",nodeNerd);
  37. nodeNerd.text = "You dial some nerd. He shows up at your front door.";
  38. nodeNerd.hooks.push(function() { startDialog(new EatDude()); });
  39. }
  40. {
  41. let nodeCrash = new DialogNode();
  42. this.addChoice("Crash the game",nodeCrash);
  43. nodeCrash.text = "Oh no oops";
  44. nodeCrash.hooks.push(function() { potato() });
  45. }
  46. }
  47. function FallenFoe(foe) {
  48. DialogNode.call(this);
  49. this.text = "What do you want to do with your enemy?";
  50. {
  51. let nodeEat = new DialogNode();
  52. this.addChoice("Devour!",nodeEat);
  53. nodeEat.text = "You grab your helpless prey and force them down your gullet.";
  54. nodeEat.hooks.push(function() {
  55. player.stomach.feed(foe);
  56. })
  57. }
  58. {
  59. let nodeSpare = new DialogNode();
  60. this.addChoice("Spare",nodeSpare);
  61. nodeSpare.text = "You decide to leave your foe uneaten.";
  62. }
  63. }
  64. function NatureExercise() {
  65. DialogNode.call(this);
  66. this.text = "What do you want to do?";
  67. {
  68. let nodeStrength = new DialogNode();
  69. this.addChoice("Rock Climbing (+STR)", nodeStrength);
  70. nodeStrength.text = "You clamber up walls for a while. You feel a little stronger.";
  71. nodeStrength.hooks.push(function() {
  72. player.str += 1;
  73. advanceTime(60*30);
  74. });
  75. }
  76. {
  77. let nodeDexterity = new DialogNode();
  78. this.addChoice("Jogging (+DEX)", nodeDexterity);
  79. nodeDexterity.text = "You go run for a run around the three-mile-long trail. You feel a little more agile.";
  80. nodeDexterity.hooks.push(function() {
  81. player.dex += 1;
  82. advanceTime(60*30);
  83. });
  84. }
  85. {
  86. let nodeConstitution = new DialogNode();
  87. this.addChoice("Bang your head on a tree (+CON)", nodeConstitution);
  88. nodeConstitution.text = "You bash your face on a tree for half an hour. I guess that helps.";
  89. nodeConstitution.hooks.push(function() {
  90. player.con += 1;
  91. advanceTime(60*30);
  92. });
  93. }
  94. }