crunch
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

188 líneas
3.9 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. this.actions.push({
  76. "name": "Save Game",
  77. "action": function() {
  78. saveGame();
  79. update(["Game saved."]);
  80. updateDisplay();
  81. }
  82. });
  83. this.actions.push({
  84. "name": "Load Game",
  85. "action": function() {
  86. loadGame();
  87. update(["Game loaded."]);
  88. updateDisplay();
  89. }
  90. });
  91. }
  92. function Journal() {
  93. GameObject.call(this, "Journal");
  94. this.actions.push({
  95. "name": "Read Journal",
  96. "action": function() {
  97. if (deaths.length == 0)
  98. update(["You pick up the journal and read it.",newline,"It's empty."]);
  99. else
  100. update(["You pick up the journal and read it.",newline].concat(deaths));
  101. }
  102. });
  103. }
  104. function Sofa() {
  105. GameObject.call(this, "Sofa");
  106. this.actions.push({
  107. "name": "Sit on sofa",
  108. "action": function(){
  109. startDialog(SofaSit());
  110. }
  111. });
  112. }
  113. function NatureTrailExercise() {
  114. GameObject.call(this, "Exercise");
  115. this.actions.push({
  116. "name": "Exercise",
  117. "action": function() {
  118. startDialog(new NatureExercise());
  119. }
  120. });
  121. }
  122. function VendingMachine() {
  123. GameObject.call(this, "Vending Machine");
  124. this.actions.push({
  125. "name": "Use the vending machine",
  126. "action": function() {
  127. startDialog(new VendingMachinePurchase());
  128. }
  129. });
  130. }
  131. function WildernessExplore(natureTrail) {
  132. GameObject.call(this, "Explore the Wilderness");
  133. this.actions.push({
  134. "name": "Explore",
  135. "action": function() {
  136. let outcome = Math.random();
  137. advanceTime(60*15);
  138. if (outcome < 0.25) {
  139. moveToByName("Nature Trail", "You find your way back");
  140. } else if (outcome < 0.35) {
  141. startCombat(new Trance());
  142. } else if (outcome < 0.45) {
  143. startCombat(new Taluthus());
  144. } else if (outcome < 0.55) {
  145. startCombat(new Selicia());
  146. } else {
  147. update(["You wander around for a bit, but haven't found your way out yet."]);
  148. }
  149. }
  150. });
  151. this.actions.push({
  152. "name": "Look for trouble",
  153. "action": function() {
  154. let outcome = Math.random();
  155. advanceTime(60*15);
  156. if (outcome < 0.33) {
  157. startCombat(new Trance());
  158. } else if (outcome < 0.66) {
  159. startCombat(new Taluthus());
  160. } else {
  161. startCombat(new Selicia());
  162. }
  163. }
  164. });
  165. }