munch
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.
 
 
 

435 wiersze
8.8 KiB

  1. "use strict";
  2. /*jshint browser: true*/
  3. /*jshint devel: true*/
  4. let NORTH = 0;
  5. let NORTH_EAST = 1;
  6. let EAST = 2;
  7. let SOUTH_EAST = 3;
  8. let SOUTH = 4;
  9. let SOUTH_WEST = 5;
  10. let WEST = 6;
  11. let NORTH_WEST = 7;
  12. let locations = {};
  13. let locationsSrc = [
  14. {
  15. "name": "Bedroom",
  16. "desc": "A bedroom. It has a bed in it.",
  17. "conn": [
  18. {
  19. "name": "Bathroom",
  20. "dir": EAST,
  21. "desc": "You step into your bathroom."
  22. },
  23. {
  24. "name": "Living Room",
  25. "dir": NORTH,
  26. "desc": "You walk into the living room."
  27. }
  28. ],
  29. "objs": [
  30. Bed,
  31. Journal,
  32. AnacondaTest,
  33. ],
  34. },
  35. {
  36. "name": "Bathroom",
  37. "desc": "Your modest bathroom.",
  38. "conn": [
  39. {
  40. "name": "Bedroom",
  41. "dir": WEST,
  42. "desc": "You walk back into your bedroom."
  43. }
  44. ],
  45. "objs": [
  46. Toilet
  47. ]
  48. },
  49. {
  50. "name": "Living Room",
  51. "desc": "A bare living room",
  52. "conn": [
  53. {
  54. "name": "Lobby",
  55. "dir": NORTH,
  56. "desc": "You leave your apartment and head to the lobby."
  57. },
  58. {
  59. "name": "Bedroom",
  60. "dir": SOUTH,
  61. "desc": "You walk into your bedroom."
  62. }
  63. ],
  64. "objs": [
  65. TV,
  66. Phone
  67. ]
  68. },
  69. {
  70. "name": "North Street",
  71. "desc": "It's a street",
  72. "conn": [
  73. {
  74. "name": "Alley",
  75. "dir": WEST,
  76. "desc": "You wander into the dark alley"
  77. },
  78. {
  79. "name": "Lobby",
  80. "dir": EAST,
  81. "desc": "You step into your apartment's lobby"
  82. },
  83. {
  84. "name": "Crossroads",
  85. "dir": SOUTH,
  86. "desc": "You walk south"
  87. },
  88. {
  89. "name": "DANGER ZONE",
  90. "dir": NORTH,
  91. "desc": "You walk into the DANGER ZONE"
  92. }
  93. ],
  94. "objs": [
  95. Nerd
  96. ]
  97. },
  98. {
  99. "name": "Lobby",
  100. "desc": "The modest lobby of your modest apartment complex",
  101. "conn": [
  102. {
  103. "name": "North Street",
  104. "dir": WEST,
  105. "desc": "You walk out into the street"
  106. },
  107. {
  108. "name": "Living Room",
  109. "dir": SOUTH,
  110. "desc": "You walk back into your apartment"
  111. }
  112. ],
  113. "objs": [
  114. VendingMachine
  115. ]
  116. },
  117. {
  118. "name": "Alley",
  119. "desc": "A suspicious alley",
  120. "conn": [
  121. {
  122. "name": "North Street",
  123. "dir": EAST,
  124. "desc": "You hurry back into the open street."
  125. },
  126. {
  127. "name": "Seedy Bar",
  128. "dir": NORTH,
  129. "desc": "You step into the bar."
  130. },
  131. {
  132. "name": "Dark Alley",
  133. "dir": WEST,
  134. "desc": "You step into the darkness..."
  135. }
  136. ]
  137. },
  138. {
  139. "name": "Dark Alley",
  140. "desc": "A dark, claustrophobic alley",
  141. "conn": [
  142. {
  143. "name": "Alley",
  144. "dir": EAST,
  145. "desc": "You emerge from the darkness"
  146. }
  147. ],
  148. "hooks": [
  149. function() {
  150. if (player.prefs.prey && (player.prefs.vore.oral > 0 || player.prefs.vore.anal > 0))
  151. startCombat(new KuroLuxray());
  152. }
  153. ]
  154. },
  155. {
  156. "name": "Seedy Bar",
  157. "desc": "God this place is seedy",
  158. "conn": [
  159. {
  160. "name": "Alley",
  161. "dir": SOUTH,
  162. "desc": "You step out of the bar"
  163. }
  164. ],
  165. "objs": [
  166. PoojawaEncounter
  167. ]
  168. },
  169. {
  170. "name": "Crossroads",
  171. "desc": "Where the roads cross",
  172. "conn": [
  173. {
  174. "name": "North Street",
  175. "dir": NORTH,
  176. "desc": "You walk north"
  177. },
  178. {
  179. "name": "East Street",
  180. "dir": EAST,
  181. "desc": "You walk east"
  182. },
  183. {
  184. "name": "South Street",
  185. "dir": SOUTH,
  186. "desc": "You walk south"
  187. },
  188. {
  189. "name": "Corner Mart",
  190. "dir": SOUTH_EAST,
  191. "desc": "You walk into the convenience store"
  192. }
  193. ]
  194. },
  195. {
  196. "name": "East Street",
  197. "desc": "This street is in the east",
  198. "conn": [
  199. {
  200. "name": "Crossroads",
  201. "dir": WEST,
  202. "desc": "You walk to the crossroads"
  203. },
  204. {
  205. "name": "East Trail",
  206. "dir": EAST,
  207. "desc": "You head out on the road."
  208. }
  209. ]
  210. },
  211. {
  212. "name": "East Trail",
  213. "desc": "A trail from your hometown to lands beyond",
  214. "conn": [
  215. {
  216. "name": "East Street",
  217. "dir": WEST,
  218. "desc": "You walk back into town"
  219. },
  220. {
  221. "name": "Woods",
  222. "dir": NORTH,
  223. "desc": "You wander into the woods."
  224. },
  225. {
  226. "name": "Mountains",
  227. "dir": EAST,
  228. "desc": "You head up into the mountains, passing by a...noticeably stained sign reading \"WATCH OUT FOR HORNY DRAGONS\". Weird. You see a cave off in the distance, as well as some jagged cliffs and plateaus to explore."
  229. },
  230. {
  231. "name": "Woods",
  232. "dir": SOUTH,
  233. "desc": "You wander into the woods."
  234. },
  235. ]
  236. },
  237. {
  238. "name": "Woods",
  239. "desc": "A thick forest. It's easy to get lost here, but it's not too dangerous, at least.",
  240. "conn": [
  241. ],
  242. "objs": [
  243. ForestExplore,
  244. ],
  245. "hooks": [
  246. function() {
  247. currentRoom.flags.exit = false;
  248. }
  249. ]
  250. },
  251. {
  252. "name": "South Street",
  253. "desc": "This street is in the south",
  254. "conn": [
  255. {
  256. "name": "Crossroads",
  257. "dir": NORTH,
  258. "desc": "You walk to the crossroads"
  259. },
  260. {
  261. "name": "Nature Trail",
  262. "dir": SOUTH,
  263. "desc": "You head out into the woods"
  264. }
  265. ]
  266. },
  267. {
  268. "name": "Nature Trail",
  269. "desc": "A winding train cutting through a thick forest",
  270. "conn": [
  271. {
  272. "name": "South Street",
  273. "dir": NORTH,
  274. "desc": "You return to town."
  275. },
  276. {
  277. "name": "Wilderness",
  278. "dir": SOUTH,
  279. "desc": "You wander into the wilderness...and immediately get lost."
  280. }
  281. ],
  282. "objs": [
  283. NatureTrailExercise,
  284. GetaObj
  285. ]
  286. },
  287. {
  288. "name": "Wilderness",
  289. "desc": "Pretty spooky",
  290. "conn": [
  291. ],
  292. "objs": [
  293. WildernessExplore
  294. ]
  295. },
  296. {
  297. "name": "DANGER ZONE",
  298. "desc": "THE DANGER ZONE",
  299. "conn": [
  300. {
  301. "name": "North Street",
  302. "dir": SOUTH,
  303. "desc": "You walk out of the DANGER ZONE"
  304. },
  305. {
  306. "name": "SUPER DANGER ZONE",
  307. "dir": NORTH,
  308. "desc": "Getting eaten is fun!",
  309. }
  310. ],
  311. "hooks": [
  312. function() {
  313. startCombat(new Anthro());
  314. }
  315. ]
  316. },
  317. {
  318. "name": "SUPER DANGER ZONE",
  319. "desc": "Very dangerous",
  320. "conn": [
  321. {
  322. "name": "DANGER ZONE",
  323. "dir": SOUTH,
  324. "desc": "You hurriedly leave the SUPER DANGER ZONE"
  325. }
  326. ],
  327. "hooks": [
  328. function() {
  329. startCombat(new Fen());
  330. }
  331. ]
  332. },
  333. {
  334. "name": "Corner Mart",
  335. "desc": "A convenience store with a variety of snacks and supplies",
  336. "conn": [
  337. {
  338. "name": "Crossroads",
  339. "dir": NORTH_WEST,
  340. "desc": "You leave the store."
  341. }
  342. ]
  343. },
  344. {
  345. "name": "Mountains",
  346. "desc": "Steep, chilly slopes.",
  347. "conn": [
  348. {
  349. "name": "East Trail",
  350. "dir": WEST,
  351. "desc": "You clamber down from the mountains."
  352. }
  353. ],
  354. "objs": [
  355. MountainExplore
  356. ]
  357. }
  358. ];
  359. function Location(name="Nowhere",desc="Nada") {
  360. this.name = name;
  361. this.description = desc;
  362. this.exits = [null,null,null,null,null,null,null,null];
  363. this.exitDescs = [null,null,null,null,null,null,null,null];
  364. this.objects = [];
  365. this.hooks = [];
  366. this.conditions = [];
  367. this.flags = [];
  368. this.visit = function() {
  369. this.hooks.forEach(function (x) {
  370. x();
  371. });
  372. };
  373. }
  374. function opposite(direction) {
  375. return (direction + 4) % 8;
  376. }
  377. function connectLocations(loc1,loc2,dir,desc) {
  378. if (loc1.exits[dir] != null) {
  379. alert(loc1.name + " is already connected to " + loc1.exits[dir].name);
  380. return;
  381. } else {
  382. if (dir >= 0 && dir <= 7) {
  383. loc1.exits[dir] = loc2;
  384. loc1.exitDescs[dir] = desc;
  385. } else {
  386. alert("Invalid direction given when linking " + loc1.name + " and " + loc2.name + ": " + dir);
  387. }
  388. }
  389. }
  390. function createWorld() {
  391. for (let i = 0; i < locationsSrc.length; i++) {
  392. let src = locationsSrc[i];
  393. let location = new Location(src.name,src.desc);
  394. locations[src.name] = location;
  395. if (src.objs != undefined) {
  396. src.objs.forEach(function (obj) {
  397. location.objects.push(new obj());
  398. });
  399. }
  400. if (src.hooks != undefined) {
  401. src.hooks.forEach(function (hook) {
  402. location.hooks.push(hook);
  403. });
  404. }
  405. if (src.conditions != undefined) {
  406. src.conditions.forEach(function (cond) {
  407. location.conditions.push(cond);
  408. });
  409. }
  410. }
  411. for (let i = 0; i < locationsSrc.length; i++) {
  412. let src = locationsSrc[i];
  413. let from = locations[src.name];
  414. for (let j = 0; j < src.conn.length; j++) {
  415. let to = locations[src.conn[j].name];
  416. connectLocations(from, to, src.conn[j].dir, src.conn[j].desc);
  417. }
  418. }
  419. return locations;
  420. }