crunch
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

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