munch
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

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