a munch adventure
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

185 lines
6.0 KiB

  1. (() => {
  2. function devour(state, count) {
  3. state.player.stats.stomach.value += count;
  4. state.player.stats.eaten.value += count;
  5. playRandomSfx("swallow");
  6. }
  7. function digest(state, count) {
  8. if (count === undefined) {
  9. count = state.player.stats.digestrate.value * (state.player.stats.stomach.value / 100 + 2);
  10. }
  11. count = Math.min(state.player.stats.stomach.value, count);
  12. count = Math.floor(count);
  13. state.player.stats.stomach.value -= count;
  14. state.player.stats.digested.value += count;
  15. state.player.stats.gas.value += count * 3;
  16. }
  17. sfxGroups = {
  18. "swallow": [
  19. "sfx/swallows/swallow-1.ogg",
  20. "sfx/swallows/swallow-2.ogg",
  21. "sfx/swallows/swallow-3.ogg",
  22. "sfx/swallows/swallow-4.ogg",
  23. "sfx/swallows/swallow-5.ogg",
  24. "sfx/swallows/swallow-6.ogg",
  25. "sfx/swallows/swallow-7.ogg",
  26. ]
  27. }
  28. function playRandomSfx(category) {
  29. const choice = Math.floor(Math.random() * sfxGroups[category].length);
  30. playSfx(sfxGroups[category][choice]);
  31. }
  32. stories.push({
  33. id: "mass-vore",
  34. name: "Mass Vore",
  35. tags: [
  36. "Player Predator",
  37. "Macro/Micro",
  38. "Digestion"
  39. ],
  40. sounds: [
  41. "sfx/belches/belch.ogg",
  42. "loop/stomach/stomach.ogg"
  43. ].concat(sfxGroups["swallow"]),
  44. preload: [
  45. "loop/stomach/stomach.ogg"
  46. ],
  47. intro: {
  48. start: "city",
  49. setup: state => {
  50. state.player.stats.fullness = {
  51. name: "Fullness",
  52. type: "meter",
  53. get value() {
  54. return state.player.stats.gas.value + state.player.stats.stomach.value;
  55. },
  56. min: 0,
  57. max: 10000,
  58. color: "rgb(200,20,100)"
  59. };
  60. state.player.stats.gas = {
  61. name: "Gas",
  62. type: "meter",
  63. value: 0,
  64. min: 0,
  65. get max() {
  66. return 10000 - state.player.stats.stomach.value;
  67. },
  68. color: "rgb(10,200,100)"
  69. }
  70. state.player.stats.stomach = {
  71. name: "Stomach",
  72. type: "meter",
  73. value: 0,
  74. min: 0,
  75. max: 10000,
  76. color: "rgb(255,10,150)"
  77. }
  78. state.player.stats.eaten = {
  79. name: "Eaten",
  80. type: "counter",
  81. value: 0
  82. }
  83. state.player.stats.digested = {
  84. name: "Digested",
  85. type: "counter",
  86. value: 0
  87. }
  88. state.player.stats.digestrate = {
  89. name: "Digestion Rate",
  90. type: "hidden",
  91. value: 0.5,
  92. min: 0,
  93. max: 1,
  94. color: "rgb(0, 255, 0)"
  95. }
  96. startTimer({
  97. id: "belch",
  98. func: state => {
  99. if (state.player.stats.gas.value > state.player.stats.gas.max) {
  100. print(["BUURRRRRP!"]);
  101. playSfx("sfx/belches/belch.ogg");
  102. state.player.stats.gas.value /= 3;
  103. }
  104. return true;
  105. },
  106. delay: 100,
  107. loop: true,
  108. classes: [
  109. ]
  110. }, state);
  111. startTimer({
  112. id: "digestion",
  113. func: state => {
  114. digest(state);
  115. const rateChange = (state.player.stats.digestrate.value - 0.5) / 1000
  116. state.player.stats.digestrate.value -= rateChange;
  117. let vol = state.player.stats.fullness.value / state.player.stats.fullness.max
  118. vol = Math.sqrt(vol);
  119. playLoop("loop/stomach/stomach.ogg", vol);
  120. return true;
  121. },
  122. delay: 1000/60,
  123. loop: true,
  124. classes: [
  125. ]
  126. }, state);
  127. },
  128. intro: state => {
  129. print(["Munch time"]);
  130. }
  131. },
  132. world: {
  133. "city": {
  134. id: "",
  135. name: "",
  136. desc: "",
  137. move: (room, state) => {
  138. },
  139. enter: (room, state) => {
  140. },
  141. exit: (room, state) => {
  142. },
  143. hooks: [
  144. ],
  145. actions: [
  146. {
  147. name: "Eat",
  148. desc: "Munch!",
  149. execute: (room, state) => {
  150. const victims = Math.floor((0.5 + Math.random()) * 500);
  151. print(["You scoop up " + victims + " people and swallow them down."]);
  152. devour(state, victims);
  153. }
  154. },
  155. {
  156. name: "Rub",
  157. desc: "Rub your belly",
  158. execute: (room, state) => {
  159. print(["You rub over the " + state.player.stats.stomach.value + " prey in your guts, hastening their digestion."]);
  160. state.player.stats.digestrate.value += 0.25;
  161. }
  162. }
  163. ],
  164. exits: {
  165. }
  166. }
  167. }
  168. });
  169. })();