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.
 
 
 

84 lines
2.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 the " + nerd.description();
  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. }