a munch adventure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

486 lines
14 KiB

  1. (() => {
  2. function checkSuspicion(state, add = 0) {
  3. const old = getStat("suspicion", state);
  4. changeStat("suspicion", add, state);
  5. if (getStat("suspicion", state) >= 100) {
  6. print(["Geta spots you!", "You're snatched up and tossed into the fox's bowl of cereal."]);
  7. goToRoom("in-bowl", state);
  8. return false;
  9. } else if (getStat("suspicion", state) >= 75 && old < 75) {
  10. print(["The fox is very suspicious. You're going to get caught if you keep this up..."]);
  11. }
  12. return true;
  13. }
  14. stories.push({
  15. "id": "unaware-geta",
  16. "name": "Geta's Breakfast",
  17. "tags": [
  18. "Player Prey",
  19. "Digestion",
  20. "Macro/Micro"
  21. ],
  22. "intro": {
  23. "start": "pepper-grinder",
  24. "setup": state => {
  25. state.player.stats.health = { name: "Health", type: "meter", value: 100, min: 0, max: 100, color: "rgb(255,55,55)" };
  26. state.player.stats.suspicion = { name: "Suspicion", type: "meter", value: 0, min: 0, max: 100, color: "rgb(100,100,100)" };
  27. state.info.time.value = 60 * 60 * 7 + 60 * 17;
  28. state.player.flags.caught = false;
  29. startTimer({
  30. id: "clock",
  31. func: state => {
  32. state.info.time.value += 1;
  33. state.info.time.value %= 86000;
  34. return true;
  35. },
  36. delay: 1000,
  37. loop: true,
  38. classes: [
  39. ]
  40. }, state);
  41. startTimer({
  42. id: "suspicion-decay",
  43. func: state => {
  44. checkSuspicion(state, -0.1);
  45. return true;
  46. },
  47. delay: 100,
  48. loop: true,
  49. classes: [
  50. "free"
  51. ]
  52. }, state);
  53. startTimer({
  54. id: "timeout",
  55. func: state => {
  56. if (state.info.time.value == 60 * 60 * 7 + 60 * 19) {
  57. print(["The fox is almost done with his breakfast..."]);
  58. }
  59. if (state.info.time.value >= 60 * 60 * 7 + 60 * 20) {
  60. print(["Time's up! In you go."]);
  61. goToRoom("maw", state);
  62. return false;
  63. }
  64. return true;
  65. },
  66. delay: 1000,
  67. loop: true,
  68. classes: [
  69. "free"
  70. ]
  71. }, state);
  72. },
  73. "intro": state => {
  74. print(["Game started", "", "Exposition goes here later."]);
  75. }
  76. },
  77. "sounds": [
  78. ],
  79. "preload": [
  80. ],
  81. "world": {
  82. "pepper-grinder": {
  83. "id": "pepper-grinder",
  84. "name": "Pepper Grinder",
  85. "desc": "You're hiding behind a pepper grinder",
  86. "move": (room, state) => {
  87. print(["You dart over to the pepper grinder, which looms over you like a greatwood."]);
  88. },
  89. "enter": (room, state) => {
  90. },
  91. "exit": (room, state) => {
  92. },
  93. "actions": [
  94. {
  95. name: "Tap",
  96. desc: "Bang on the pepper shaker",
  97. execute: (room, state) => {
  98. print(["You thump the pepper shaker, making a dull thud."]);
  99. checkSuspicion(state, 25);
  100. },
  101. show: [
  102. ],
  103. conditions: [
  104. ]
  105. },
  106. {
  107. name: "Wait",
  108. desc: "Wait for the fox to finish his breakfast. Surely you'll be able to escape after that...right?",
  109. execute: (room, state) => {
  110. state.info.time.value = 60 * 60 * 7 + 60 * 20;
  111. },
  112. show: [
  113. ],
  114. conditions: [
  115. ]
  116. },
  117. ],
  118. "exits": {
  119. "up": {
  120. "target": "bowl",
  121. "desc": "Walk up to the cereal bowl",
  122. "show": [
  123. ],
  124. "conditions": [
  125. ],
  126. "hooks": [
  127. (room, exit, state) => {
  128. return checkSuspicion(state, 10);
  129. }
  130. ]
  131. },
  132. },
  133. "hooks": [
  134. ],
  135. "data": {
  136. "stats": {
  137. }
  138. }
  139. },
  140. "bowl": {
  141. "id": "bowl",
  142. "name": "Behind the Bowl",
  143. "desc": "You're crouched behind Geta's bowl of cereal",
  144. "move": (room, state) => {
  145. print(["You scurry up to the looming bowl, staying low and out of Geta's sight."]);
  146. },
  147. "enter": (room, state) => {
  148. },
  149. "exit": (room, state) => {
  150. },
  151. "actions": [
  152. ],
  153. "exits": {
  154. "ascend": {
  155. "target": "in-bowl",
  156. "desc": "Climb into Geta's cereal",
  157. "show": [
  158. ],
  159. "conditions": [
  160. ],
  161. "hooks": [
  162. ]
  163. },
  164. "down": {
  165. "target": "pepper-grinder",
  166. "desc": "Run back behind the pepper grinder",
  167. "show": [
  168. ],
  169. "conditions": [
  170. ],
  171. "hooks": [
  172. ]
  173. },
  174. },
  175. "hooks": [
  176. ],
  177. "data": {
  178. "stats": {
  179. }
  180. }
  181. },
  182. "in-bowl": {
  183. "id": "in-bowl",
  184. "name": "Bowl",
  185. "desc": "You're in the cereal bowl...",
  186. "move": (room, state) => {
  187. print(["Why did you do that?"]);
  188. },
  189. "enter": (room, state) => {
  190. stopClassTimers("free", state);
  191. startTimer({
  192. id: "geta-eat",
  193. func: state => {
  194. if (Math.random() < 0.6) {
  195. print(["Geta scoops up a spoonful of cereal; you narrowly avoid being caught."]);
  196. return true;
  197. } else {
  198. print(["Geta scoops you up and slurps you into his maw."]);
  199. goToRoom("maw", state);
  200. return false;
  201. }
  202. },
  203. delay: 3000,
  204. loop: true,
  205. classes: [
  206. ]
  207. }, state);
  208. },
  209. "exit": (room, state) => {
  210. },
  211. "actions": [
  212. ],
  213. "exits": {
  214. },
  215. "hooks": [
  216. ],
  217. "data": {
  218. "stats": {
  219. }
  220. }
  221. },
  222. "maw": {
  223. "id": "maw",
  224. "name": "Geta's Maw",
  225. "desc": "You've been slurped up into the fox's jaws",
  226. "move": (room, state) => {
  227. stopClassTimers("free", state);
  228. },
  229. "enter": (room, state) => {
  230. startTimer({
  231. id: "swallow",
  232. func: state => {
  233. print(["It's too late to escape. You're swallowed down."]);
  234. goToRoom("throat", state);
  235. return true;
  236. },
  237. delay: 5000,
  238. loop: false,
  239. classes: [
  240. ]
  241. }, state);
  242. },
  243. "exit": (room, state) => {
  244. },
  245. "actions": [
  246. ],
  247. "exits": {
  248. },
  249. "hooks": [
  250. ],
  251. "data": {
  252. "stats": {
  253. }
  254. }
  255. },
  256. "throat": {
  257. "id": "throat",
  258. "name": "Geta's Gullet",
  259. "desc": "GULP!",
  260. "move": (room, state) => {
  261. },
  262. "enter": (room, state) => {
  263. startTimer({
  264. id: "throat-swallow",
  265. func: state => {
  266. print(["You slush down into Geta's stomach"]);
  267. goToRoom("stomach", state);
  268. return true;
  269. },
  270. delay: 7000,
  271. loop: false,
  272. classes: [
  273. ]
  274. }, state);
  275. },
  276. "exit": (room, state) => {
  277. },
  278. "actions": [
  279. {
  280. name: "Struggle",
  281. desc: "Try to climb back out!",
  282. execute: (room, state) => {
  283. print(["Nope"]);
  284. },
  285. show: [
  286. ],
  287. conditions: [
  288. ]
  289. },
  290. {
  291. name: "Give up",
  292. desc: "Dive down into Geta's stomach",
  293. execute: (room, state) => {
  294. print(["You submit to your predator."]);
  295. goToRoom("stomach", state);
  296. stopTimer("throat-swallow", state);
  297. },
  298. show: [
  299. ],
  300. conditions: [
  301. ]
  302. },
  303. ],
  304. "exits": {
  305. },
  306. "hooks": [
  307. ],
  308. "data": {
  309. "stats": {
  310. }
  311. }
  312. },
  313. "stomach": {
  314. "id": "stomach",
  315. "name": "Geta's Stomach",
  316. "desc": "Glorp",
  317. "move": (room, state) => {
  318. },
  319. "enter": (room, state) => {
  320. startTimer({
  321. id: "digest",
  322. func: state => {
  323. changeStat("health", -0.3, state);
  324. if (getStat("health", state) <= 0) {
  325. print(["You're digested before too long."]);
  326. goToRoom("digested", state);
  327. return false;
  328. }
  329. return true;
  330. },
  331. delay: 100,
  332. loop: true,
  333. classes: [
  334. ]
  335. }, state);
  336. },
  337. "exit": (room, state) => {
  338. },
  339. "actions": [
  340. {
  341. name: "Squirm",
  342. desc: "Rub at the walls of the fox's churning stomach",
  343. execute: (room, state) => {
  344. printRandom([
  345. ["You punch and kick at the walls"],
  346. ["A powerful churn grabs hold of you, stifling any attempts at struggling"],
  347. ["Your little thumps and kicks do little to faze your captor"]
  348. ]);
  349. },
  350. show: [
  351. ],
  352. conditions: [
  353. ]
  354. },
  355. ],
  356. "exits": {
  357. },
  358. "hooks": [
  359. ],
  360. "data": {
  361. "stats": {
  362. }
  363. }
  364. },
  365. "digested": {
  366. "id": "digested",
  367. "name": "Fat",
  368. "desc": "You're just fat now",
  369. "move": (room, state) => {
  370. },
  371. "enter": (room, state) => {
  372. },
  373. "exit": (room, state) => {
  374. },
  375. "actions": [
  376. {
  377. name: "Gurgle",
  378. desc: "Glorp",
  379. execute: (room, state) => {
  380. printRandom([
  381. ["Grrrrgle"],
  382. ["Glorp"],
  383. ["Glrrrrrrnnnnnn..."],
  384. ["Gwoooooorgle"]
  385. ]);
  386. },
  387. show: [
  388. ],
  389. conditions: [
  390. ]
  391. },
  392. ],
  393. "exits": {
  394. },
  395. "hooks": [
  396. ],
  397. "data": {
  398. "stats": {
  399. }
  400. }
  401. },
  402. }
  403. });
  404. })();