a munch adventure
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

156 行
4.7 KiB

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