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.
 
 
 

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