crunch
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.

151 lines
3.1 KiB

  1. "use strict";
  2. function GameObject(name="Potato") {
  3. this.name = name;
  4. this.actions = [];
  5. }
  6. function Nerd() {
  7. GameObject.call(this, "Nerd");
  8. this.actions.push({
  9. "name": "Eat Nerd",
  10. "action": function() {
  11. startDialog(new EatDude());
  12. }
  13. });
  14. }
  15. function Toilet() {
  16. GameObject.call(this, "Toilet");
  17. this.actions.push({
  18. "name": "Admire toilet",
  19. "action": function() {
  20. update(["You admire the toilet."]);
  21. }
  22. });
  23. this.actions.push({
  24. "name": "Use toilet",
  25. "action": function() {
  26. let lines = [];
  27. lines.push("You sit down on the toilet.");
  28. if (player.bowels.fullness == 0) {
  29. lines.push("But nothing happens.");
  30. } else {
  31. lines.push("You grunt and clench, squeezing out the remains of your former prey.");
  32. player.bowels.fullness = 0;
  33. }
  34. if (player.bowels.contents.length > 0) {
  35. lines.push("The remains of " + join(player.bowels.contents) + " empty into the sewers as you flush them away.");
  36. }
  37. player.bowels.contents = [];
  38. update(lines);
  39. },
  40. "conditions": [
  41. function(prefs) {
  42. return prefs.scat == true;
  43. }
  44. ]
  45. });
  46. }
  47. function TV() {
  48. GameObject.call(this, "TV");
  49. this.actions.push({
  50. "name": "Watch TV",
  51. "action": function() {
  52. update(["Reruns, again."]);
  53. }
  54. });
  55. }
  56. function Phone() {
  57. GameObject.call(this, "Phone");
  58. this.actions.push({
  59. "name": "Use phone",
  60. "action": function() {
  61. startDialog(new PhoneCall());
  62. }
  63. });
  64. }
  65. function Bed() {
  66. GameObject.call(this, "Bed");
  67. this.actions.push({
  68. "name": "Sleep",
  69. "action": function() {
  70. update(["You take a nap."]);
  71. advanceTime(2700);
  72. updateDisplay();
  73. }
  74. });
  75. }
  76. function Journal() {
  77. GameObject.call(this, "Journal");
  78. this.actions.push({
  79. "name": "Read Journal",
  80. "action": function() {
  81. if (deaths.length == 0)
  82. update(["You pick up the journal and read it.",newline,"It's empty."]);
  83. else
  84. update(["You pick up the journal and read it.",newline].concat(deaths));
  85. }
  86. });
  87. }
  88. function Sofa() {
  89. GameObject.call(this, "Sofa");
  90. this.actions.push({
  91. "name": "Sit on sofa",
  92. "action": function(){
  93. startDialog(SofaSit());
  94. }
  95. });
  96. }
  97. function NatureTrailExercise() {
  98. GameObject.call(this, "Exercise");
  99. this.actions.push({
  100. "name": "Exercise",
  101. "action": function() {
  102. startDialog(new NatureExercise());
  103. }
  104. });
  105. }
  106. function VendingMachine() {
  107. GameObject.call(this, "Vending Machine");
  108. this.actions.push({
  109. "name": "Use the vending machine",
  110. "action": function() {
  111. startDialog(new VendingMachinePurchase());
  112. }
  113. });
  114. }
  115. function WildernessExplore(natureTrail) {
  116. GameObject.call(this, "Explore the Wilderness");
  117. this.actions.push({
  118. "name": "Explore",
  119. "action": function() {
  120. let outcome = Math.random();
  121. advanceTime(60*15);
  122. if (outcome < 0.25) {
  123. moveToByName("Nature Trail", "You find your way back");
  124. } else if (outcome < 0.5) {
  125. startCombat(new Trance());
  126. } else {
  127. update(["You wander around for a bit, but haven't found anything."]);
  128. }
  129. }
  130. });
  131. }