crunch
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

197 wiersze
4.2 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.waste == 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.waste = 0;
  33. }
  34. if (player.bowels.digested.length > 0) {
  35. lines.push("The remains of " + join(player.bowels.digested) + " empty into the sewers as you flush them away.");
  36. }
  37. player.bowels.digested = [];
  38. update(lines);
  39. },
  40. "conditions": [
  41. function(player) {
  42. return player.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. if (player.health >= player.maxHealth) {
  71. if (Math.random() < 0.33 && (time > EVENING)) {
  72. update(["You crawl into bed and fall asleep...",newline]);
  73. advanceTimeTo(MIDNIGHT);
  74. startDialog(new LalimEncounter());
  75. return;
  76. }
  77. }
  78. update(["You take a nap."]);
  79. advanceTime(3600*2);
  80. updateDisplay();
  81. }
  82. });
  83. this.actions.push({
  84. "name": "Save Game",
  85. "action": function() {
  86. saveGame();
  87. update(["Game saved."]);
  88. updateDisplay();
  89. }
  90. });
  91. this.actions.push({
  92. "name": "Load Game",
  93. "action": function() {
  94. loadGame();
  95. update(["Game loaded."]);
  96. updateDisplay();
  97. }
  98. });
  99. }
  100. function Journal() {
  101. GameObject.call(this, "Journal");
  102. this.actions.push({
  103. "name": "Read Journal",
  104. "action": function() {
  105. if (deaths.length == 0)
  106. update(["You pick up the journal and read it.",newline,"It's empty."]);
  107. else
  108. update(["You pick up the journal and read it.",newline].concat(deaths));
  109. }
  110. });
  111. }
  112. function Sofa() {
  113. GameObject.call(this, "Sofa");
  114. this.actions.push({
  115. "name": "Sit on sofa",
  116. "action": function(){
  117. startDialog(SofaSit());
  118. }
  119. });
  120. }
  121. function NatureTrailExercise() {
  122. GameObject.call(this, "Exercise");
  123. this.actions.push({
  124. "name": "Exercise",
  125. "action": function() {
  126. startDialog(new NatureExercise());
  127. }
  128. });
  129. }
  130. function VendingMachine() {
  131. GameObject.call(this, "Vending Machine");
  132. this.actions.push({
  133. "name": "Use the vending machine",
  134. "action": function() {
  135. startDialog(new VendingMachinePurchase());
  136. }
  137. });
  138. }
  139. function WildernessExplore(natureTrail) {
  140. GameObject.call(this, "Explore the Wilderness");
  141. this.actions.push({
  142. "name": "Explore",
  143. "action": function() {
  144. let outcome = Math.random();
  145. advanceTime(60*15);
  146. if (outcome < 0.25) {
  147. moveToByName("Nature Trail", "You find your way back");
  148. } else if (outcome < 0.35) {
  149. startCombat(new Trance());
  150. } else if (outcome < 0.45) {
  151. startCombat(new Taluthus());
  152. } else if (outcome < 0.55) {
  153. startCombat(new Selicia());
  154. } else {
  155. update(["You wander around for a bit, but haven't found your way out yet."]);
  156. }
  157. }
  158. });
  159. this.actions.push({
  160. "name": "Look for trouble",
  161. "action": function() {
  162. let outcome = Math.random();
  163. advanceTime(60*15);
  164. if (outcome < 0.33) {
  165. startCombat(new Trance());
  166. } else if (outcome < 0.66) {
  167. startCombat(new Taluthus());
  168. } else {
  169. startCombat(new Selicia());
  170. }
  171. }
  172. });
  173. }