big steppy
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.
 
 
 

1013 lines
26 KiB

  1. var things =
  2. {
  3. "Container": Container,
  4. "Person": Person,
  5. "Cow": Cow,
  6. "Empty Car": EmptyCar,
  7. "Car": Car,
  8. "Bus": Bus,
  9. "Tram": Tram,
  10. "Motorcycle": Motorcycle,
  11. "House": House,
  12. "Barn": Barn,
  13. "Small Skyscraper": SmallSkyscraper,
  14. "Large Skyscraper": LargeSkyscraper,
  15. "Train": Train,
  16. "Train Car": TrainCar,
  17. "Parking Garage": ParkingGarage,
  18. "Overpass": Overpass,
  19. "Town": Town,
  20. "City": City,
  21. "Continent": Continent,
  22. "Planet": Planet,
  23. "Star": Star,
  24. "Solar System": SolarSystem,
  25. "Galaxy": Galaxy
  26. };
  27. var areas =
  28. {
  29. "Container": 0,
  30. "Person": 1,
  31. "Cow": 2,
  32. "Car": 4,
  33. "Bus": 12,
  34. "Tram": 20,
  35. "Motorcycle": 2,
  36. "House": 1000,
  37. "Barn": 750,
  38. "Small Skyscraper": 2500,
  39. "Large Skyscraper": 5000,
  40. "Train": 500,
  41. "TrainCar": 500,
  42. "Parking Garage": 10000,
  43. "Overpass": 10000,
  44. "Town": 1e7,
  45. "City": 1e9,
  46. "Continent": 1.5e13,
  47. "Planet": 2.5e14,
  48. "Star": 3e18,
  49. "Solar System": 3e21,
  50. "Galaxy": 2e42,
  51. };
  52. var masses =
  53. {
  54. "Container": 0,
  55. "Person": 80,
  56. "Cow": 300,
  57. "Car": 1000,
  58. "Bus": 5000,
  59. "Tram": 10000,
  60. "Motorcycle": 200,
  61. "House": 10000,
  62. "Barn": 5000,
  63. "Small Skyscraper": 10000000,
  64. "Large Skyscraper": 80000000,
  65. "Train": 50000,
  66. "Train Car": 7500,
  67. "Parking Garage": 10000000,
  68. "Overpass": 1000000,
  69. "Town": 1,
  70. "City": 1,
  71. "Continent": 1e21,
  72. "Planet": 5.972e24,
  73. "Star": 1e40,
  74. "Solar System": 1,
  75. "Galaxy": 1
  76. };
  77. var clusters =
  78. {
  79. "Container": 0,
  80. "Person": 5,
  81. "Cow": 15,
  82. "Car": 3,
  83. "Bus": 1,
  84. "Tram": 1,
  85. "Motorcycle": 1,
  86. "House": 5,
  87. "Barn": 1,
  88. "Small Skyscraper": 2,
  89. "Large Skyscraper": 1,
  90. "Train": 2,
  91. "Train Car": 1,
  92. "Parking Garage": 1,
  93. "Overpass": 1,
  94. "Town": 1,
  95. "City": 1,
  96. "Continent": 5,
  97. "Planet": 1,
  98. "Star": 1,
  99. "Solar System": 1,
  100. "Galaxy": 1
  101. };
  102. // general logic: each step fills in a fraction of the remaining space
  103. function fill_area(area, weights)
  104. {
  105. result = [];
  106. candidates = [];
  107. for (var key in weights) {
  108. if (weights.hasOwnProperty(key)) {
  109. candidates.push({"name": key, "area": areas[key], "weight": weights[key]});
  110. }
  111. }
  112. candidates = candidates.sort(function (x,y) {
  113. return x.area - y.area;
  114. });
  115. while(candidates.length > 0) {
  116. var candidate = candidates.pop();
  117. if (candidate.area > area)
  118. continue;
  119. var max = Math.floor(area / candidate.area);
  120. var limit = Math.min(max, 100);
  121. var count = 0;
  122. var loopvar = limit;
  123. // for small amounts, actually do the randomness
  124. // the first few ones get a much better shot
  125. while (loopvar > 0) {
  126. if (loopvar <= clusters[candidate.name])
  127. count += 1;
  128. else
  129. count += Math.random() < candidate.weight ? 1 : 0;
  130. --loopvar;
  131. }
  132. if (limit < max) {
  133. count += Math.round((max-limit) * candidate.weight);
  134. }
  135. area -= count * candidate.area;
  136. if (count > 0)
  137. result.push(new things[candidate.name](count));
  138. }
  139. if (result.length > 0)
  140. return new Container(result);
  141. else
  142. return new Container([new Person(1)]);
  143. }
  144. // describes everything in the container
  145. function describe_all(contents,verbose=true,except=[]) {
  146. var things = [];
  147. for (var key in contents) {
  148. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  149. things.push(contents[key].describe(verbose));
  150. }
  151. }
  152. return merge_things(things);
  153. }
  154. function random_desc(list, odds=1) {
  155. if (Math.random() < odds)
  156. return list[Math.floor(Math.random() * list.length)];
  157. else
  158. return "";
  159. }
  160. // combine strings into a list with proper grammar
  161. function merge_things(list,semicolons=false) {
  162. if (list.length == 0) {
  163. return "";
  164. } else if (list.length == 1) {
  165. return list[0];
  166. } else if (list.length == 2) {
  167. return list[0] + " and " + list[1];
  168. } else {
  169. result = "";
  170. list.slice(0,list.length-1).forEach(function(term) {
  171. result += term + ", ";
  172. })
  173. result += "and " + list[list.length-1]
  174. return result;
  175. }
  176. }
  177. // combine the adjectives for something into a single string
  178. function merge_desc(list) {
  179. result = ""
  180. list.forEach(function(term) {
  181. if (term != "")
  182. result += term + " ";
  183. });
  184. // knock off the last space
  185. if (result.length > 0) {
  186. result = result.substring(0, result.length - 1);
  187. }
  188. return result;
  189. }
  190. // maybe make this something that approximates a
  191. // normal distribution; doing this 15,000,000 times is bad...
  192. // solution: only a few are random lul
  193. // improvement: take up to 100 samples, then use that to scale the final result
  194. function distribution(min, max, samples) {
  195. var result = 0;
  196. var limit = Math.min(100,samples)
  197. if (limit < samples) {
  198. for (var i = 0; i < limit; i++) {
  199. result += (i/10 + 1) * Math.floor(Math.random() * (max - min + 1) + min);
  200. }
  201. result = Math.round((result / 595) * samples * (max - min) + min);
  202. } else {
  203. for (var i = 0; i < limit; i++) {
  204. result += Math.floor(Math.random() * (max - min + 1) + min);
  205. }
  206. }
  207. return result;
  208. }
  209. function defaultArea(thing) {
  210. return areas[thing.name];
  211. }
  212. function defaultMass(thing) {
  213. return masses[thing.name];
  214. }
  215. function defaultMerge(thing) {
  216. return function(container) {
  217. var newCount = this.count + container.count;
  218. var newThing = new things[thing.name](newCount);
  219. newThing.contents = {};
  220. for (var key in this.contents) {
  221. if (this.contents.hasOwnProperty(key)) {
  222. newThing.contents[key] = this.contents[key];
  223. }
  224. }
  225. for (var key in container.contents) {
  226. if (container.contents.hasOwnProperty(key)) {
  227. if (this.contents.hasOwnProperty(key)) {
  228. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  229. } else {
  230. newThing.contents[key] = container.contents[key];
  231. }
  232. }
  233. }
  234. return newThing;
  235. }
  236. }
  237. function defaultSum(thing) {
  238. return function() {
  239. var counts = {}
  240. if (thing.name != "Container")
  241. counts[thing.name] = thing.count;
  242. for (var key in thing.contents) {
  243. if (thing.contents.hasOwnProperty(key)) {
  244. subcount = thing.contents[key].sum();
  245. for (var subkey in subcount) {
  246. if (!counts.hasOwnProperty(subkey)) {
  247. counts[subkey] = 0;
  248. }
  249. counts[subkey] += subcount[subkey];
  250. }
  251. }
  252. }
  253. return counts;
  254. }
  255. }
  256. function defaultSumProperty(thing) {
  257. return function(prop) {
  258. var total = 0;
  259. total += thing[prop] * thing.count;
  260. for (var key in thing.contents) {
  261. if (thing.contents.hasOwnProperty(key)) {
  262. total += thing.contents[key].sum_property(prop);
  263. }
  264. }
  265. return total;
  266. }
  267. }
  268. function defaultAddContent(thing) {
  269. return function(name, min, max, count) {
  270. if (min == max) {
  271. var object = new things[name](min*count);
  272. thing.contents[object.name] = object;
  273. } else {
  274. var object = new things[name](distribution(min, max, count));
  275. thing.contents[object.name] = object;
  276. }
  277. }
  278. }
  279. function DefaultEntity() {
  280. this.sum = defaultSum;
  281. this.area = defaultArea;
  282. this.mass = defaultMass;
  283. this.sum_property = defaultSumProperty;
  284. this.merge = defaultMerge;
  285. this.addContent = defaultAddContent;
  286. return this;
  287. }
  288. // god I love reinventing the wheel
  289. function copy_defaults(self,proto) {
  290. for (var key in proto) {
  291. if (proto.hasOwnProperty(key)) {
  292. self[key] = proto[key](self)
  293. }
  294. }
  295. }
  296. function Container(contents = []) {
  297. this.name = "Container";
  298. copy_defaults(this,new DefaultEntity());
  299. this.count = 0;
  300. this.contents = {}
  301. for (var i=0; i < contents.length; i++) {
  302. this.contents[contents[i].name] = contents[i];
  303. }
  304. for (var key in this.contents) {
  305. if (this.contents.hasOwnProperty(key)) {
  306. this.count += this.contents[key].count;
  307. }
  308. }
  309. this.describe = function(verbose = true) {
  310. return describe_all(this.contents,verbose)
  311. }
  312. return this;
  313. }
  314. function Person(count = 1) {
  315. this.name = "Person";
  316. copy_defaults(this,new DefaultEntity());
  317. this.count = count;
  318. this.contents = {};
  319. this.describeOne = function (verbose=true) {
  320. body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  321. sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  322. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal"]);
  323. return "a " + merge_desc([body,sex,species]);
  324. }
  325. this.describe = function(verbose=true) {
  326. if (verbose) {
  327. if (count <= 3) {
  328. list = [];
  329. for (var i = 0; i < count; i++) {
  330. list.push(this.describeOne(this.count <= 2));
  331. }
  332. return merge_things(list);
  333. } else {
  334. return this.count + " people"
  335. }
  336. } else {
  337. return (this.count > 1 ? this.count + " people" : "a person");
  338. }
  339. }
  340. return this;
  341. }
  342. function Cow(count = 1) {
  343. this.name = "Cow";
  344. copy_defaults(this,new DefaultEntity());
  345. this.count = count;
  346. this.contents = {};
  347. this.describeOne = function (verbose=true) {
  348. body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  349. sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  350. return "a " + merge_desc([body,sex,"cow"]);
  351. }
  352. this.describe = function(verbose=true) {
  353. if (verbose) {
  354. if (count <= 3) {
  355. list = [];
  356. for (var i = 0; i < count; i++) {
  357. list.push(this.describeOne(this.count <= 2));
  358. }
  359. return merge_things(list);
  360. } else {
  361. return this.count + " cattle"
  362. }
  363. } else {
  364. return (this.count > 1 ? this.count + " cattle" : "a cow");
  365. }
  366. }
  367. return this;
  368. }
  369. function EmptyCar(count = 1) {
  370. this.name = "Car";
  371. copy_defaults(this,new DefaultEntity());
  372. this.count = count;
  373. this.contents = {};
  374. this.describeOne = function(verbose=true) {
  375. color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  376. adjective = random_desc(["rusty","brand-new"],0.3);
  377. type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  378. return "a parked " + merge_desc([adjective,color,type]);
  379. }
  380. this.describe = function(verbose = true) {
  381. if (verbose) {
  382. if (this.count <= 3) {
  383. list = [];
  384. for (var i = 0; i < this.count; i++) {
  385. list.push(this.describeOne());
  386. }
  387. return merge_things(list);
  388. } else {
  389. return this.count + " parked cars";
  390. }
  391. } else {
  392. return (this.count > 1 ? this.count + " parked cars" : "a parked car");
  393. }
  394. }
  395. }
  396. function Car(count = 1) {
  397. this.name = "Car";
  398. copy_defaults(this,new DefaultEntity());
  399. this.count = count;
  400. this.contents = {};
  401. this.addContent("Person", 2, 5, count);
  402. this.describeOne = function(verbose=true) {
  403. color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  404. adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  405. type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  406. return "a " + merge_desc([adjective,color,type]);
  407. }
  408. this.describe = function(verbose = true) {
  409. if (verbose) {
  410. if (this.count <= 3) {
  411. list = [];
  412. for (var i = 0; i < this.count; i++) {
  413. list.push(this.describeOne(this.count < 2));
  414. }
  415. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  416. } else {
  417. return this.count + " cars with " + describe_all(this.contents,verbose) + " inside";
  418. }
  419. } else {
  420. return (this.count > 1 ? this.count + " cars" : "a car");
  421. }
  422. }
  423. }
  424. function Bus(count = 1) {
  425. this.name = "Bus";
  426. copy_defaults(this,new DefaultEntity());
  427. this.count = count;
  428. this.contents = {};
  429. this.addContent("Person",10,35,count);
  430. this.describeOne = function(verbose=true) {
  431. adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  432. color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  433. type = random_desc(["bus","double-decker bus","articulating bus"]);
  434. return "a " + merge_desc([adjective,color,type]);
  435. }
  436. this.describe = function(verbose = true) {
  437. if (verbose) {
  438. if (this.count <= 3) {
  439. list = [];
  440. for (var i = 0; i < this.count; i++) {
  441. list.push(this.describeOne(this.count < 2));
  442. }
  443. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  444. } else {
  445. return this.count + " buses with " + describe_all(this.contents,verbose) + " inside";
  446. }
  447. } else {
  448. return (this.count > 1 ? this.count + " buses" : "a bus");
  449. }
  450. }
  451. }
  452. function Tram(count = 1) {
  453. this.name = "Tram";
  454. copy_defaults(this,new DefaultEntity());
  455. this.count = count;
  456. this.contents = {};
  457. this.addContent("Person",40,60,count);
  458. this.describeOne = function(verbose=true) {
  459. adjective = random_desc(["rusty","weathered"], (verbose ? 0.3 : 0));
  460. color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  461. type = random_desc(["tram"]);
  462. return "a " + merge_desc([adjective,color,type]);
  463. }
  464. this.describe = function(verbose = true) {
  465. if (verbose) {
  466. if (this.count == 1) {
  467. list = [];
  468. for (var i = 0; i < this.count; i++) {
  469. list.push(this.describeOne(verbose));
  470. }
  471. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  472. } else {
  473. return this.count + " trams with " + describe_all(this.contents,verbose) + " inside";
  474. }
  475. } else {
  476. return (this.count > 1 ? this.count + " trams" : "a tram");
  477. }
  478. }
  479. this.anal_vore = function() {
  480. return "You slide " + this.describe() + " up your tight ass";
  481. }
  482. }
  483. function Motorcycle(count = 1) {
  484. this.name = "Motorcycle";
  485. copy_defaults(this,new DefaultEntity());
  486. this.count = count;
  487. this.contents = {};
  488. this.addContent("Person",1,2,count);
  489. }
  490. function Train(count = 1) {
  491. this.name = "Train";
  492. copy_defaults(this,new DefaultEntity());
  493. this.count = count;
  494. this.contents = {};
  495. this.addContent("Person", 1, 4, count);
  496. this.addContent("Train Car", 2, 10, count);
  497. this.describeOne = function(verbose=true) {
  498. adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  499. color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  500. type = random_desc(["train","passenger train","freight train"]);
  501. return "a " + merge_desc([adjective,color,type]);
  502. }
  503. this.describe = function(verbose = true) {
  504. if (verbose) {
  505. if (this.count == 1) {
  506. list = [];
  507. for (var i = 0; i < this.count; i++) {
  508. list.push(this.describeOne(verbose));
  509. }
  510. return merge_things(list) + " with " + this.contents["Person"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  511. } else {
  512. return this.count + " trains with " + this.contents["Person"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  513. }
  514. } else {
  515. return (this.count > 1 ? this.count + " trains" : "a train");
  516. }
  517. }
  518. this.anal_vore = function() {
  519. var cars = (this.contents["Train Car"].count == 1 ? this.contents["Train Car"].describe() + " follows it inside" : this.contents["Train Car"].describe() + " are pulled slowly inside");
  520. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  521. }
  522. }
  523. function TrainCar(count = 1) {
  524. this.name = "Train Car";
  525. copy_defaults(this,new DefaultEntity());
  526. this.count = count;
  527. this.contents = {};
  528. this.addContent("Person",10,40,count);
  529. this.describeOne = function(verbose=true) {
  530. adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  531. color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  532. type = random_desc(["train car","passenger train car","freight train car"]);
  533. return "a " + merge_desc([adjective,color,type]);
  534. }
  535. this.describe = function(verbose = true) {
  536. if (verbose) {
  537. if (this.count <= 3) {
  538. list = [];
  539. for (var i = 0; i < this.count; i++) {
  540. list.push(this.describeOne(this.count < 2));
  541. }
  542. return merge_things(list) + " with " + describe_all(this.contents) + " inside";
  543. } else {
  544. return this.count + " train cars with " + describe_all(this.contents) + " inside";
  545. }
  546. } else {
  547. return (this.count > 1 ? this.count + " train cars" : "a train car");
  548. }
  549. }
  550. }
  551. function House(count = 1) {
  552. this.name = "House";
  553. copy_defaults(this,new DefaultEntity());
  554. this.count = count;
  555. this.contents = {};
  556. this.addContent("Person",0,8,count);
  557. this.addContent("Empty Car",0,2,count);
  558. this.describeOne = function(verbose=true) {
  559. size = random_desc(["little","two-story","large"], (verbose ? 0.5 : 0));
  560. color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  561. name = random_desc(["house","house","house","house","house","trailer"], 1);
  562. return "a " + merge_desc([size,color,name]);
  563. }
  564. this.describe = function(verbose = true) {
  565. if (verbose) {
  566. if (this.count <= 3) {
  567. list = [];
  568. for (var i = 0; i < this.count; i++) {
  569. list.push(this.describeOne(this.count < 2));
  570. }
  571. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  572. } else {
  573. return this.count + " homes with " + describe_all(this.contents,verbose) + " inside";
  574. }
  575. } else {
  576. return (this.count > 1 ? this.count + " houses" : "a house");
  577. }
  578. }
  579. }
  580. function Barn(count = 1) {
  581. this.name = "Barn";
  582. copy_defaults(this,new DefaultEntity());
  583. this.count = count;
  584. this.contents = {};
  585. this.addContent("Person",0,2,count);
  586. this.addContent("Cow",30,70,count);
  587. this.describeOne = function(verbose=true) {
  588. size = random_desc(["little","big","large"], (verbose ? 0.5 : 0));
  589. color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  590. name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  591. return "a " + merge_desc([size,color,name]);
  592. }
  593. this.describe = function(verbose = true) {
  594. if (verbose) {
  595. if (this.count <= 3) {
  596. list = [];
  597. for (var i = 0; i < this.count; i++) {
  598. list.push(this.describeOne(this.count < 2));
  599. }
  600. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  601. } else {
  602. return this.count + " barns with " + describe_all(this.contents,verbose) + " inside";
  603. }
  604. } else {
  605. return (this.count > 1 ? this.count + " barns" : "a barn");
  606. }
  607. }
  608. }
  609. function SmallSkyscraper(count = 1) {
  610. this.name = "Small Skyscraper";
  611. copy_defaults(this,new DefaultEntity());
  612. this.count = count;
  613. this.contents = {};
  614. this.addContent("Person",50,500,count);
  615. this.addContent("Empty Car",10,50,count);
  616. this.describeOne = function(verbose=true) {
  617. color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  618. name = random_desc(["skyscraper","office tower","office building"], 1);
  619. return "a " + merge_desc([color,name]);
  620. }
  621. this.describe = function(verbose = true) {
  622. if (verbose) {
  623. if (this.count <= 3) {
  624. list = [];
  625. for (var i = 0; i < this.count; i++) {
  626. list.push(this.describeOne(this.count < 2));
  627. }
  628. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  629. } else {
  630. return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  631. }
  632. } else {
  633. return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper");
  634. }
  635. }
  636. this.anal_vore = function(verbose=true,height=10) {
  637. var line = skyscraperAnalVore(this,verbose,height);
  638. if (line == "")
  639. return defaultAnalVore(this)(verbose);
  640. else
  641. return line;
  642. };
  643. }
  644. function LargeSkyscraper(count = 1) {
  645. this.name = "Large Skyscraper";
  646. copy_defaults(this,new DefaultEntity());
  647. this.count = count;
  648. this.contents = {};
  649. this.addContent("Person",150,1500,count);
  650. this.addContent("Empty Car",20,100,count);
  651. this.describeOne = function(verbose=true) {
  652. color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  653. name = random_desc(["skyscraper","office tower","office building"], 1);
  654. return "a " + merge_desc(["towering",color,name]);
  655. }
  656. this.describe = function(verbose = true) {
  657. if (verbose) {
  658. if (this.count <= 3) {
  659. list = [];
  660. for (var i = 0; i < this.count; i++) {
  661. list.push(this.describeOne(this.count < 2));
  662. }
  663. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  664. } else {
  665. return this.count + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  666. }
  667. } else {
  668. return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper");
  669. }
  670. }
  671. }
  672. function ParkingGarage(count = 1) {
  673. this.name = "Parking Garage";
  674. copy_defaults(this,new DefaultEntity());
  675. this.count = count;
  676. this.contents = {};
  677. this.addContent("Person",10,200,count);
  678. this.addContent("Empty Car",30,100,count);
  679. this.addContent("Car",5,30,count);
  680. this.describeOne = function(verbose=true) {
  681. return "a parking garage";
  682. }
  683. this.describe = function(verbose = true) {
  684. if (verbose) {
  685. return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose) + " inside";
  686. } else {
  687. return (this.count == 1 ? "a parking garage" : this.count + " parking garages");
  688. }
  689. }
  690. }
  691. function Overpass(count = 1) {
  692. this.name = "Overpass";
  693. copy_defaults(this,new DefaultEntity());
  694. this.count = count;
  695. this.contents = {};
  696. this.addContent("Person",0,20,count);
  697. this.addContent("Car",25,100,count);
  698. }
  699. function Town(count = 1) {
  700. this.name = "Town";
  701. copy_defaults(this,new DefaultEntity());
  702. this.count = count;
  703. this.contents = {};
  704. this.addContent("Person",1000,15000,count);
  705. this.addContent("House",500,10000,count);
  706. this.addContent("Empty Car",250,3750,count);
  707. this.addContent("Car",250,3750,count);
  708. this.addContent("Train",5,10,count);
  709. this.addContent("Small Skyscraper",2,10,count);
  710. this.addContent("Parking Garage",1,5,count);
  711. this.describe = function(verbose = true) {
  712. if (verbose) {
  713. return (this.count == 1 ? "a town" : this.count + " towns") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  714. } else {
  715. return (this.count == 1 ? "a town" : this.count + " towns");
  716. }
  717. }
  718. }
  719. function City(count = 1) {
  720. this.name = "City";
  721. copy_defaults(this,new DefaultEntity());
  722. this.count = count;
  723. this.contents = {};
  724. this.addContent("Person",10000,150000,count);
  725. this.addContent("House",5000,100000,count);
  726. this.addContent("Empty Car",2500,37500,count);
  727. this.addContent("Car",2500,37500,count);
  728. this.addContent("Train",50,100,count);
  729. this.addContent("Tram",100,300,count);
  730. this.addContent("Small Skyscraper",20,100,count);
  731. this.addContent("Large Skyscraper",10,50,count);
  732. this.addContent("Parking Garage",10,50,count);
  733. this.describe = function(verbose = true) {
  734. if (verbose) {
  735. return (this.count == 1 ? "a city" : this.count + " cities") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  736. } else {
  737. return (this.count == 1 ? "a city" : this.count + " cities");
  738. }
  739. }
  740. }
  741. function Continent(count = 1) {
  742. this.name = "Continent";
  743. copy_defaults(this,new DefaultEntity());
  744. this.count = count;
  745. this.contents = {};
  746. this.addContent("Person",100000,1500000,count);
  747. this.addContent("House",5000,100000,count);
  748. this.addContent("Car",25000,375000,count);
  749. this.addContent("Train",500,1000,count);
  750. this.addContent("Town",2000,5000,count);
  751. this.addContent("City",200,500,count);
  752. this.describe = function(verbose = true) {
  753. if (verbose) {
  754. return (this.count == 1 ? "a continent" : this.count + " continents") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  755. } else {
  756. return (this.count == 1 ? "a continent" : this.count + " continents");
  757. }
  758. }
  759. }
  760. function Planet(count = 1) {
  761. this.name = "Planet";
  762. copy_defaults(this,new DefaultEntity());
  763. this.count = count;
  764. this.contents = {};
  765. this.addContent("Continent",4,9,count);
  766. this.describe = function(verbose = true) {
  767. if (verbose) {
  768. return (this.count == 1 ? "a planet" : this.count + " planets") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  769. } else {
  770. return (this.count == 1 ? "a planet" : this.count + " planets");
  771. }
  772. }
  773. }
  774. function Star(count = 1) {
  775. this.name = "Star";
  776. copy_defaults(this,new DefaultEntity());
  777. this.count = count;
  778. this.contents = {};
  779. this.describe = function(verbose = true) {
  780. return (this.count == 1 ? "a star" : this.count + " stars");
  781. }
  782. }
  783. function SolarSystem(count = 1) {
  784. this.name = "Solar System";
  785. copy_defaults(this,new DefaultEntity());
  786. this.count = count;
  787. this.contents = {};
  788. this.addContent("Star",1,1,count);
  789. this.addContent("Planet",5,15,count);
  790. this.describe = function(verbose = true) {
  791. if (verbose) {
  792. return (this.count == 1 ? "a solar system" : this.count + " solar systems") + " made up of " + describe_all(this.contents, verbose);
  793. } else {
  794. return (this.count == 1 ? "a solar system" : this.count + " solar systems");
  795. }
  796. }
  797. }
  798. function Galaxy(count = 1) {
  799. this.name = "Galaxy";
  800. copy_defaults(this,new DefaultEntity());
  801. this.count = count;
  802. this.contents = {};
  803. this.addContent("Star",1e9,500e9,count);
  804. this.addContent("Solar System",1e8,500e8,count);
  805. this.describe = function(verbose = true) {
  806. if (verbose) {
  807. return (this.count == 1 ? "a galaxy" : this.count + " galaxies") + " made up of " + describe_all(this.contents, verbose);
  808. } else {
  809. return (this.count == 1 ? "a galaxy" : this.count + " galaxies");
  810. }
  811. }
  812. }