big steppy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

1088 linhas
28 KiB

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