munch
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

131 行
3.3 KiB

  1. "use strict";
  2. function DialogNode() {
  3. this.text = "Foo bar baz.";
  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 = "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.";
  55. nodeEat.hooks.push(function() {
  56. player.stomach.feed(foe);
  57. })
  58. }
  59. {
  60. let nodeSpare = new DialogNode();
  61. this.addChoice("Spare",nodeSpare);
  62. nodeSpare.text = "You decide to leave your foe uneaten.";
  63. }
  64. {
  65. let nodeCrush = new DialogNode();
  66. this.addChoice("Crush",nodeCrush);
  67. nodeCrush.text = "You slam your paw down hard, crushing " + foe.description("the") + " like a bug";
  68. nodeCrush.requirements.push( function(attacker, defender) {
  69. return defender.flags.shrunk == true;
  70. });
  71. }
  72. }
  73. function NatureExercise() {
  74. DialogNode.call(this);
  75. this.text = "What do you want to do?";
  76. {
  77. let nodeStrength = new DialogNode();
  78. this.addChoice("Rock Climbing (+STR)", nodeStrength);
  79. nodeStrength.text = "You clamber up walls for a while. You feel a little stronger.";
  80. nodeStrength.hooks.push(function() {
  81. player.str += 1;
  82. advanceTime(60*30);
  83. });
  84. }
  85. {
  86. let nodeDexterity = new DialogNode();
  87. this.addChoice("Jogging (+DEX)", nodeDexterity);
  88. nodeDexterity.text = "You go run for a run around the three-mile-long trail. You feel a little more agile.";
  89. nodeDexterity.hooks.push(function() {
  90. player.dex += 1;
  91. advanceTime(60*30);
  92. });
  93. }
  94. {
  95. let nodeConstitution = new DialogNode();
  96. this.addChoice("Bang your head on a tree (+CON)", nodeConstitution);
  97. nodeConstitution.text = "You bash your face on a tree for half an hour. I guess that helps.";
  98. nodeConstitution.hooks.push(function() {
  99. player.con += 1;
  100. advanceTime(60*30);
  101. });
  102. }
  103. }