big steppy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

1793 行
49 KiB

  1. 'use strict';
  2. var things =
  3. {
  4. "Container": {
  5. "Container": Container,
  6. mass: 0,
  7. area: 0,
  8. clusters: 0,
  9. cluster_chances: 0,
  10. contents: [],
  11. descriptor: ["", ""]
  12. },
  13. //Creatures
  14. "Person": {
  15. "Person": Person,
  16. mass: 80,
  17. area: .33,
  18. clusters: 5,
  19. cluster_chances: .8,
  20. contents: [],
  21. descriptor: ["a person", "people"]
  22. },
  23. "Human": {
  24. "Human": Human,
  25. mass: 80,
  26. area: .33,
  27. clusters: 5,
  28. cluster_chances: .8,
  29. contents: [],
  30. descriptor: ["a person", "people"]
  31. },
  32. "Cow": {
  33. "Cow": Cow,
  34. mass: 300,
  35. area: 2,
  36. clusters: 15,
  37. cluster_chances: .5,
  38. contents: [],
  39. descriptor: ["a cow", "cattle"]
  40. },
  41. "Micro": {
  42. "Micro": Micro,
  43. mass: .01,
  44. area: .05,
  45. clusters: 50,
  46. cluster_chances: 1,
  47. contents: [],
  48. descriptor: ["a micro", "micros"]
  49. },
  50. "Macro": {
  51. "Macro": Macro,
  52. mass: 8e4,
  53. area: 100,
  54. clusters: 0,
  55. cluster_chances: 0,
  56. contents: [],
  57. descriptor: ["a smaller macro", "smaller macros"]
  58. },
  59. //Vehicles
  60. "Empty Car": {
  61. "Empty Car": EmptyCar,
  62. mass: 1000,
  63. area: 4,
  64. clusters: 2,
  65. cluster_chances: .3,
  66. contents: [],
  67. descriptor: ["a parked car", "parked cars"]
  68. },
  69. "Car": {
  70. "Car": Car,
  71. mass: 1000,
  72. area: 4,
  73. clusters: 4,
  74. cluster_chances: .5,
  75. contents: [["Person",1,4]],
  76. descriptor: ["a car", "cars"]
  77. },
  78. "Bus": {
  79. "Bus": Bus,
  80. mass: 5000,
  81. area: 12,
  82. clusters: 1,
  83. cluster_chances: .25,
  84. contents: [["Person",2,30]],
  85. descriptor: ["a bus", "busses"]
  86. },
  87. "Tram": {
  88. "Tram": Tram,
  89. mass: 1e4,
  90. area: 20,
  91. clusters: 1,
  92. cluster_chances: .2,
  93. contents: [["Person",10,50]],
  94. descriptor: ["a tram", "trams"]
  95. },
  96. "Train": {
  97. "Train": Train,
  98. mass: 5e4,
  99. area: 40,
  100. clusters: 2,
  101. cluster_chances: .1,
  102. contents: [["Person",1,4,"engine"],["Train Car",2,10]],
  103. descriptor: ["a train", "trains"]
  104. },
  105. "Train Car": {
  106. "Train Car": TrainCar,
  107. mass: 7500,
  108. area: 20,
  109. clusters: 1,
  110. cluster_chances: .05,
  111. contents: [["Person",10,40]],
  112. descriptor: ["a train car", "train cars"]
  113. },
  114. "Helicopter": {
  115. "Helicopter": Helicopter,
  116. mass: 1500,
  117. area: 12,
  118. clusters: 0,
  119. cluster_chances: 0,
  120. contents: [["Person",4,16]],
  121. descriptor: ["a helicopter", "helicopters"]
  122. },
  123. "Empty Helicopter": {
  124. "Empty Helicopter": EmptyHelicopter,
  125. mass: 1500,
  126. area: 12,
  127. clusters: 3,
  128. cluster_chances: 0.05,
  129. contents: [],
  130. descriptor: ["a parked helicopter", "parked helicopters"]
  131. },
  132. "Plane": {
  133. "Plane": Plane,
  134. mass: 6500,
  135. area: 50,
  136. clusters: 1,
  137. cluster_chances: .05,
  138. contents: [],
  139. descriptor: ["a small plane", "small planes"]
  140. },
  141. "Empty Plane": {
  142. "Empty Plane": EmptyPlane,
  143. mass: 6500,
  144. area: 50,
  145. clusters: 1,
  146. cluster_chances: .05,
  147. contents: [["Person",2,9]],
  148. descriptor: ["a parked plane", "parked aircraft"]
  149. },
  150. "Airliner": {
  151. "Airliner": Airliner,
  152. mass: 6500,
  153. area: 1250,
  154. clusters: 1,
  155. cluster_chances: .05,
  156. contents: [["Person",5,300]],
  157. descriptor: ["an airliner", "airliners"]
  158. },
  159. "Empty Airliner": {
  160. "Empty Airliner": EmptyAirliner,
  161. mass: 6500,
  162. area: 1250,
  163. clusters: 1,
  164. cluster_chances: .05,
  165. contents: [],
  166. descriptor: ["a parked airliner", "parked airliners"]
  167. },
  168. //Buildings
  169. "House": {
  170. "House": House,
  171. mass: 1e4,
  172. area: 150,
  173. clusters: 5,
  174. cluster_chances: .5,
  175. contents: [["Person",0,8],["Empty Car",0,2]],
  176. descriptor: ["house", "houses"]
  177. },
  178. "Business": {
  179. "Business": Business,
  180. mass: 5e4,
  181. area: 400,
  182. clusters: 5,
  183. cluster_chances: .25,
  184. contents: [["Person",0,30],["Car",0,5],["Empty Car",0,20]],
  185. descriptor: ["a local business", "buildings"]
  186. },
  187. "Barn": {
  188. "Barn": Barn,
  189. mass: 5e3,
  190. area: 300,
  191. clusters: 1,
  192. cluster_chances: .1,
  193. contents: [["Person",0,2],["Cow",30,70]],
  194. descriptor: ["a barn", "barns"]
  195. },
  196. "Small Hangar": {
  197. "Small Hangar": SmallHangar,
  198. mass: 5e5,
  199. area: 2500,
  200. clusters: 1,
  201. cluster_chances: .1,
  202. contents: [["Person",0,3],["Plane",0,1],["Empty Plane",2,6]],
  203. descriptor: ["a small hangar", "small hangars"]
  204. },
  205. "Helicopter Hangar": {
  206. "Helicopter Hangar": HelicopterHangar,
  207. mass: 5e5,
  208. area: 2000,
  209. clusters: 1,
  210. cluster_chances: .1,
  211. contents: [["Person",0,3],["Helicopter",0,1],["Helicopter",2,6]],
  212. descriptor: ["a helicopter hangar", "helicopter hangar"]
  213. },
  214. "Large Hangar": {
  215. "Large Hangar": LargeHangar,
  216. mass: 5e6,
  217. area: 8000,
  218. clusters: 1,
  219. cluster_chances: .1,
  220. contents: [["Person",0,5],["Airliner",0,1],["Empty Airliner",1,2]],
  221. descriptor: ["an aircraft hangar", "hangars"]
  222. },
  223. "Small Skyscraper": {
  224. "Small Skyscraper": SmallSkyscraper,
  225. mass: 1e7,
  226. area: 1000,
  227. clusters: 2,
  228. cluster_chances: .25,
  229. contents: [["Person",150,750],["Empty Car",10,50]],
  230. descriptor: ["a small skyscraper", "small skyscrapers"]
  231. },
  232. "Large Skyscraper": {
  233. "Large Skyscraper": LargeSkyscraper,
  234. mass: 8e7,
  235. area: 2000,
  236. clusters: 1,
  237. cluster_chances: .25,
  238. contents: [["Person",500,1500],["Empty Car",20,100]],
  239. descriptor: ["a large skyscraper", "large skyscrapers"]
  240. },
  241. "Parking Garage": {
  242. "Parking Garage": ParkingGarage,
  243. mass: 1e7,
  244. area: 750,
  245. clusters: 1,
  246. cluster_chances: .1,
  247. contents: [["Person",10,200],["Empty Car",100,300],["Car",5,30]],
  248. descriptor: ["a parking garage", "parking garages"]
  249. },
  250. //Places
  251. "Ranch": {
  252. "Ranch": Ranch,
  253. mass: 2e7,
  254. area: 4e4,
  255. clusters: 0,
  256. cluster_chances: 0,
  257. contents: [["Person",10,50],["House",1,3],["Barn",1,2]],
  258. descriptor: ["a ranch", "ranchs"]
  259. },
  260. "Airstrip": {
  261. "Airstrip": Airstrip,
  262. mass: 2e7,
  263. area: 9e5,
  264. clusters: 0,
  265. cluster_chances: 0,
  266. contents: [["Person",10,50],["Small Hangar",1,3],["Plane",0,2],["Helicopter",0,1],["Helicopter Hangar",0,1],["Car",0,5],["Empty Car",0,20]],
  267. descriptor: ["an airstrip", "airstrips"]
  268. },
  269. "Airport": {
  270. "Airport": Airport,
  271. mass: 1.5e8,
  272. area: 6e6,
  273. clusters: 0,
  274. cluster_chances: 0,
  275. contents: [["Person",1500,4000],["Small Hangar",4,12],["Plane",2,5],["Helicopter",1,3],["Helicopter Hangar",2,6],["Airliner",1,3],["Large Hangar",2,6],["Car",20,75],["Empty Car",400,1000]],
  276. descriptor: ["an airport", "airports"]
  277. },
  278. "Town": {
  279. "Town": Town,
  280. mass: 1,
  281. area: 1e7,
  282. clusters: 5,
  283. cluster_chances: .1,
  284. contents: [["Person",10000,100000],["House",5000,50000],["Empty Car",200,800],["Car",500,80000],["Bus",5,25],["Train",5,25],["Business",500,5000]],
  285. descriptor: ["a town", "towns"]
  286. },
  287. "City": {
  288. "City": City,
  289. mass: 1,
  290. area: 1e9,
  291. clusters: 0,
  292. cluster_chances: .2,
  293. contents: [["Person",100000,1500000],["House",20000,200000],["Empty Car",10000,100000],["Car",7500,125000],["Bus",200,400],["Train",10,50],["Tram",25,100],["Small Skyscraper",50,300],["Large Skyscraper",10,75],["Parking Garage",5,10],["Business",2000,10000]],
  294. descriptor: ["a city", "cities"]
  295. },
  296. "Continent": {
  297. "Continent": Continent,
  298. mass: 1e21,
  299. area: 1.5e13,
  300. clusters: 5,
  301. cluster_chances: .5,
  302. contents: [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250],["Business",250,1000]],
  303. descriptor: ["a continent", "continents"]
  304. },
  305. //Celestial Bodies
  306. "Planet": {
  307. "Planet": Planet,
  308. mass: 5.972e24,
  309. area: 2.5e14,
  310. clusters: 0,
  311. cluster_chances: 1,
  312. contents: [["Continent",4,9]],
  313. descriptor: ["a planet", "planets"]
  314. },
  315. "Star": {
  316. "Star": Star,
  317. mass: 1e40,
  318. area: 3e18,
  319. clusters: 1,
  320. cluster_chances: 1,
  321. contents: [],
  322. descriptor: ["a star", "stars"]
  323. },
  324. "Solar System": {
  325. "Solar System": SolarSystem,
  326. mass: 1,
  327. area: 3e21,
  328. clusters: 1,
  329. cluster_chances: 1,
  330. contents: [["Star",1,1],["Planet",5,15]],
  331. descriptor: ["a solar system", "solar systems"]
  332. },
  333. "Galaxy": {
  334. "Galaxy": Galaxy,
  335. mass: 1,
  336. area: 2e45,
  337. clusters: 1,
  338. cluster_chances: 1,
  339. contents: [["Star",1e9,500e9],["Solar System",1e8,500e8]],
  340. descriptor: ["a galaxy", "galaxies"]
  341. },
  342. "Cluster": {
  343. "Cluster": Cluster,
  344. mass: 1,
  345. area: 2e49,
  346. clusters: 1,
  347. cluster_chances: 1,
  348. contents: [["Galaxy",200,5000]],
  349. descriptor: ["a cluster", "clusters"]
  350. },
  351. "Universe": {
  352. "Universe": Universe,
  353. mass: 1,
  354. area: 7e53,
  355. clusters: 1,
  356. cluster_chances: 1,
  357. contents: [["Cluster",1.5e9,2.5e9]],
  358. descriptor: ["a universe", "universes"]
  359. },
  360. "Multiverse": {
  361. "Multiverse": Multiverse,
  362. mass: 1,
  363. area: 5e56,
  364. clusters: 1,
  365. cluster_chances: 1,
  366. contents: [["Universe",100,1000]],
  367. descriptor: ["a multiverse", "multiverses"]
  368. },
  369. //Military
  370. "Soldier": {
  371. "Soldier": Soldier,
  372. mass: 80,
  373. area: 1,
  374. clusters: 2,
  375. cluster_chances: .2,
  376. contents: [],
  377. descriptor: ["a soldier","soldiers"]
  378. },
  379. "Tank": {
  380. "Tank": Tank,
  381. mass: 5000,
  382. area: 20,
  383. clusters: 2,
  384. cluster_chances: .25,
  385. contents: [["Soldier",3,5]],
  386. descriptor: ["a tank", "tanks"]
  387. },
  388. "Artillery": {
  389. "Artillery": Artillery,
  390. mass: 7000,
  391. area: 25,
  392. clusters: 3,
  393. cluster_chances: .5,
  394. contents: [["Soldier",4,6]],
  395. descriptor: ["an artillery tank", "artillery tanks"]
  396. },
  397. "Military Helicopter": {
  398. "Military Helicopter": MilitaryHelicopter,
  399. mass: 1500,
  400. area: 12,
  401. clusters: 0,
  402. cluster_chances: 0,
  403. contents: [["Soldier",4,16]],
  404. descriptor: ["a helicopter", "helicopters"]
  405. },
  406. "Squad": {
  407. "Squad": Squad,
  408. mass: 1,
  409. area: 30,
  410. clusters: 20,
  411. cluster_chances: .05,
  412. contents: [["Soldier",6,9]],
  413. descriptor: ["a squad", "squads"]
  414. },
  415. "Platoon": {
  416. "Platoon": Platoon,
  417. mass: 100,
  418. area: 150,
  419. clusters: 2,
  420. cluster_chances: .1,
  421. contents: [["Soldier",16,44]],
  422. descriptor: ["a military platoon", "platoons"]
  423. },
  424. "Company": {
  425. "Company": Company,
  426. mass: 500,
  427. area: 600,
  428. clusters: 2,
  429. cluster_chances: .1,
  430. contents: [["Soldier",60,200]],
  431. descriptor: ["a company of soldiers", "companies"]
  432. },
  433. "Battalion": {
  434. "Battalion": Battalion,
  435. mass: 1000,
  436. area: 3500,
  437. clusters: 2,
  438. cluster_chances: .1,
  439. contents: [["Soldier",300,1000]],
  440. descriptor: ["a battalion", "battalions"]
  441. },
  442. "Brigade": {
  443. "Brigade": Brigade,
  444. mass: 1500,
  445. area: 2e4,
  446. clusters: 2,
  447. cluster_chances: .1,
  448. contents: [["Soldier",1500,3200]],
  449. descriptor: ["a brigade", "brigades"]
  450. },
  451. "Division": {
  452. "Division": Division,
  453. mass: 2000,
  454. area: 8e4,
  455. clusters: 3,
  456. cluster_chances: .1,
  457. contents: [["Soldier",10000,16000]],
  458. descriptor: ["a division", "divisions"]
  459. },
  460. "Tank Division": {
  461. "Tank Division": TankDivision,
  462. mass: 3000,
  463. area: 1e5,
  464. clusters: 1,
  465. cluster_chances: .15,
  466. contents: [["Soldier",8000,1200],["Tank",250,500]],
  467. descriptor: ["a tank division", "tank divisions"]
  468. },
  469. "Army": {
  470. "Army": Army,
  471. mass: 5000,
  472. area: 1e6,
  473. clusters: 2,
  474. cluster_chances: .1,
  475. contents: [["Soldier",40000,75000]],
  476. descriptor: ["an army", "armies"]
  477. },
  478. };
  479. //Alterante Army Structuring, may be used later
  480. //"Squad": [["Soldier",6,9]],
  481. // "Platoon": [["Squad",3,4]],
  482. //"Company": [["Platoon",3,5],["Squad",0,2]],
  483. //"Battalion": [["Company",4,6]],
  484. //"Brigade": [["Battalion",2,5],["Company",0,3]],
  485. //"Division": [["Brigade",2,4]],
  486. //"Tank Division": [["Brigade",2,4],["Tank",250,500]],
  487. //"Army": [["Division",3,8],["Tank Division",1,5]],
  488. // replace all instances of from with to
  489. function contents_substitute(from,to) {
  490. for (let key in contents) {
  491. if (contents.hasOwnProperty(key)) {
  492. let type = contents[key];
  493. for (let i=0; i<type.length; i++) {
  494. if (type[i][0] == from) {
  495. type[i][0] = to;
  496. }
  497. }
  498. }
  499. }
  500. }
  501. // remove all instances of thing
  502. function contents_remove(thing) {
  503. for (let key in contents) {
  504. if (contents.hasOwnProperty(key)) {
  505. let type = contents[key];
  506. for (let i=0; i<type.length; i++) {
  507. if (type[i][0] == thing) {
  508. type.splice(i,1);
  509. --i;
  510. }
  511. }
  512. }
  513. }
  514. }
  515. // adds thing to parent
  516. function contents_insert(parent,thing,min,max,label) {
  517. let owner = things[parent].contents;
  518. if (label == undefined)
  519. owner.push([thing,min,max]);
  520. else
  521. owner.push([thing,min,max,label]);
  522. }
  523. function initContents(name,count) { //builds the contents for each destrucable(thing) when called
  524. let result = {};
  525. let type = things[name].contents;
  526. for (let i=0; i<type.length; i++) {
  527. let amount = distribution(type[i][1],type[i][2],count); //arrays of contents look like ["thing name",min,max,"optional name"] so those values have to pulled out
  528. if (amount > 0) {
  529. // if a custom label is supplied, use it!
  530. if (type[i].length == 4) //if has optional name
  531. result[type[i][3]] = new things[type[i][0]][type[i][0]](amount); //creates a "thing name" under the key of "optional name"
  532. else
  533. result[type[i][0]] = new things[type[i][0]][type[i][0]](amount);
  534. }
  535. }
  536. return result;
  537. }
  538. function get_living_prey(sum) {
  539. let total = 0;
  540. for (let key in sum) {
  541. if (sum.hasOwnProperty(key)) {
  542. if (key == "Micro" || key == "Macro" || key == "Person" || key == "Cow" || key == 'Soldier')
  543. total += sum[key];
  544. }
  545. }
  546. return total;
  547. }
  548. // general logic: each step fills in a fraction of the remaining space
  549. function fill_area(area, weights, variance=0.15)
  550. {
  551. area = area + Math.random() * variance * 2 * area - variance * area;
  552. var result = [];
  553. var candidates = [];
  554. for (var key in weights) {
  555. if (weights.hasOwnProperty(key)) {
  556. candidates.push({"name": key, "area": things[key].area, "weight": weights[key]});
  557. }
  558. }
  559. candidates = candidates.sort(function (x,y) {
  560. return x.area - y.area;
  561. });
  562. while(candidates.length > 0) {
  563. var candidate = candidates.pop();
  564. if (candidate.area > area)
  565. continue;
  566. var max = Math.floor(area / candidate.area);
  567. var limit = Math.min(max, 1000);
  568. var count = 0;
  569. var loopvar = 0;
  570. // for small amounts, actually do the randomness
  571. // the first few ones get a much better shot
  572. // if we have nothing at all, it's even better!
  573. while (loopvar < limit) {
  574. if (loopvar == 0 && result.length == 0) {
  575. ++count;
  576. }
  577. else if (loopvar <= things[candidate.name].clusters) {
  578. if (Math.random() < candidate.weight ? 1 : Math.random() < things[candidate.name].cluster_chances) {
  579. ++count;
  580. }
  581. }
  582. else {
  583. count += Math.random() < candidate.weight ? 1 : 0;
  584. }
  585. ++loopvar;
  586. }
  587. // if we're doing more than the limit, then we just add on the rest, with some variance
  588. if (limit < max) {
  589. const base = (max-limit) * candidate.weight;
  590. count += Math.round(base - base / 10 + base * Math.random() / 5);
  591. }
  592. area -= count * candidate.area;
  593. if (count > 0)
  594. result.push(new things[candidate.name][candidate.name](count));
  595. }
  596. return new Container(result);
  597. }
  598. // maybe make this something that approximates a
  599. // normal distribution; doing this 15,000,000 times is bad...
  600. // solution: only a few are random lul
  601. // improvement: take up to 100 samples, then use that to scale the final result
  602. function distribution(min, max, samples) {
  603. var result = 0;
  604. var limit = Math.min(100,samples);
  605. if (limit < samples) {
  606. let dist = 0;
  607. for (let i = 0; i < limit; i++) {
  608. dist += Math.random();
  609. }
  610. dist /= 100;
  611. return Math.floor(dist * samples * (max - min + 1) + samples * min);
  612. } else {
  613. for (let i = 0; i < limit; i++) {
  614. result += Math.floor(Math.random() * (max - min + 1) + min);
  615. }
  616. }
  617. return result;
  618. }
  619. function defaultMultiply(thing) {
  620. return function(amount) {
  621. thing.count *= amount;
  622. for (var key in thing.contents) {
  623. if (thing.contents.hasOwnProperty(key)) {
  624. thing.contents[key].multiply(amount);
  625. }
  626. }
  627. };
  628. }
  629. function defaultArea(thing) {
  630. return things[thing.name].area;
  631. }
  632. function defaultMass(thing) {
  633. return things[thing.name].mass;
  634. }
  635. function defaultDescribeOne(thing) {
  636. return function(verbose){ //verbose doesn't matter for this case, becasue it handles things with no extra text to use when being verbose
  637. return things[thing.name].descriptor[0];
  638. }
  639. }
  640. function defaultMerge(thing) { //this merges all objects into one containers
  641. return function(container) {
  642. var newCount = this.count + container.count;
  643. var newThing = new things[thing.name][thing.name](newCount);
  644. newThing.contents = {};
  645. for (var key in this.contents) {
  646. if (this.contents.hasOwnProperty(key)) {
  647. newThing.contents[key] = this.contents[key];
  648. }
  649. }
  650. for (key in container.contents) {
  651. if (container.contents.hasOwnProperty(key)) {
  652. if (this.contents.hasOwnProperty(key)) {
  653. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  654. } else {
  655. newThing.contents[key] = container.contents[key];
  656. }
  657. }
  658. }
  659. return newThing;
  660. };
  661. }
  662. function listSum(sum) {
  663. let result = [];
  664. for (let key in sum) {
  665. if (sum.hasOwnProperty(key)) {
  666. result.push(new things[key][key](sum[key]).describe(false));
  667. }
  668. }
  669. return merge_things(result);
  670. }
  671. // turn a nested object into a container with everything on one level
  672. function flatten(thing) {
  673. let dict = defaultSum(thing)();
  674. let list = [];
  675. Object.entries(dict).forEach(function([key, val]) {
  676. let obj = new things[key][key](val);
  677. obj.contents = [];
  678. list.push(obj);
  679. });
  680. list.sort(function(x,y) {
  681. if (y.area != x.area){
  682. return y.area - x.area;
  683. } else {
  684. return x.name.localeCompare(y.name);
  685. }
  686. });
  687. return new Container(list);
  688. }
  689. function defaultSum(thing) {
  690. return function() {
  691. var counts = {};
  692. if (thing.name != "Container")
  693. counts[thing.name] = thing.count;
  694. for (var key in thing.contents) {
  695. if (thing.contents.hasOwnProperty(key)) {
  696. var subcount = thing.contents[key].sum();
  697. for (var subkey in subcount) {
  698. if (!counts.hasOwnProperty(subkey)) {
  699. counts[subkey] = 0;
  700. }
  701. counts[subkey] += subcount[subkey];
  702. }
  703. }
  704. }
  705. return counts;
  706. };
  707. }
  708. function defaultSumProperty(thing) {
  709. return function(prop) {
  710. var total = 0;
  711. total += thing[prop] * thing.count;
  712. for (var key in thing.contents) {
  713. if (thing.contents.hasOwnProperty(key)) {
  714. total += thing.contents[key].sum_property(prop);
  715. }
  716. }
  717. return total;
  718. };
  719. }
  720. function defaultAddContent(thing) {
  721. return function(name, min, max, count) {
  722. if (min == max) {
  723. let object = new things[name](min*count);
  724. thing.contents[object.name] = object;
  725. } else {
  726. let object = new things[name](distribution(min, max, count));
  727. thing.contents[object.name] = object;
  728. }
  729. };
  730. }
  731. function DefaultEntity() {
  732. this.sum = defaultSum;
  733. this.area = defaultArea;
  734. this.mass = defaultMass;
  735. this.sum_property = defaultSumProperty;
  736. this.merge = defaultMerge;
  737. this.multiply = defaultMultiply;
  738. this.describeSimple = defaultDescribeSimple;
  739. this.describeOne = defaultDescribeOne;
  740. return this;
  741. }
  742. // god I love reinventing the wheel
  743. function copy_defaults(self,proto) { //loads the values defined in things into the fuction that calls it
  744. for (var key in proto) { //proto will always be a new DefaultEntity, self is the parent function
  745. if (proto.hasOwnProperty(key)) {
  746. self[key] = proto[key](self);
  747. }
  748. }
  749. }
  750. // combine strings into a list with proper grammar
  751. function merge_things(list,semicolons=false) {
  752. if (list.length == 0) {
  753. return "";
  754. } else if (list.length == 1) {
  755. return list[0];
  756. } else if (list.length == 2) {
  757. return list[0] + " and " + list[1];
  758. } else {
  759. var result = "";
  760. list.slice(0,list.length-1).forEach(function(term) {
  761. result += term + ", ";
  762. });
  763. result += "and " + list[list.length-1];
  764. return result;
  765. }
  766. }
  767. // combine the adjectives for something into a single string
  768. function merge_desc(list) {
  769. var result = "";
  770. list.forEach(function(term) {
  771. if (term != "")
  772. result += term + " ";
  773. });
  774. // knock off the last space
  775. if (result.length > 0) {
  776. result = result.substring(0, result.length - 1);
  777. }
  778. let article = "a "
  779. //a/an overwriting terms
  780. let forcedTerms = ["honor","heir"]; //words that need to start with an but don't start with a,e,i,o,u
  781. let force = false;
  782. for (let i of forcedTerms){
  783. if (i === result.substring(0, i.length)){force = true;}
  784. }
  785. let exceptionTerms = ["uniform","unique"]; //words that need to start with a and start with a,e,i,o,u
  786. let exception = false;
  787. for (let i of exceptionTerms){
  788. if (i === result.substring(0, i.length)){exception = true;}
  789. }
  790. //check if the string should start with an
  791. if ((force == true) || (exception == false && ((result.charAt(0) == "a")||(result.charAt(0) == "e")||(result.charAt(0) == "i")||(result.charAt(0) == "o")||(result.charAt(0) == "u")))){
  792. article = "an ";
  793. }
  794. result = article + result;
  795. return result;
  796. }
  797. // describes everything in the container
  798. function describe_all(contents,verbose=true,except=[]) {
  799. var things = [];
  800. for (var key in contents) {
  801. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  802. things.push(contents[key].describe(verbose));
  803. }
  804. }
  805. return merge_things(things);
  806. }
  807. function random_desc(list, odds=1) { //strings together an array into a series of words
  808. if (Math.random() < odds)
  809. return list[Math.floor(Math.random() * list.length)];
  810. else
  811. return "";
  812. }
  813. function defaultDescribeSimple(thing) {
  814. return function(flat) {
  815. if (flat) {
  816. return flatten(thing).describe(false)
  817. } else {
  818. return thing.describe(false);
  819. }
  820. }
  821. }
  822. function defaultDescribe(verbose=true, parent, descAs){
  823. let descriptorEnd = " inside";
  824. let descriptorConjunction = " with ";
  825. let groupLessThan3 = false;
  826. switch(descAs) {
  827. case "vehicle":
  828. descriptorEnd = pickString(" inside"," inside"," inside", " inside"," riding inside", " trapped inside", " sitting inside");
  829. break;
  830. case "community":
  831. groupLessThan3 = true;
  832. descriptorEnd = " in " + (parent.count == 1 ? "it" : "them");
  833. break;
  834. case "celestial":
  835. groupLessThan3 = true;
  836. descriptorConjunction = pickString(" made up of "," consisting of "," containing ");
  837. descriptorEnd = "";
  838. break;
  839. case "military":
  840. groupLessThan3 = true;
  841. descriptorConjunction = pickString(" of "," of "," made up of "," comprised of "," containing ");
  842. descriptorEnd = "";
  843. break;
  844. case "generic vehicle":
  845. groupLessThan3 = true;
  846. descriptorEnd = pickString(" inside"," inside"," inside", " inside"," riding inside", " trapped inside", " sitting inside");
  847. break;
  848. } if (verbose) {
  849. if (parent.count = 1 ) { //singular parent (specifying single to catch cases where groupLessThan3 = true, otherwise it would output "1 towns" instead of "a town"
  850. if (things[parent.name].contents.length > 0){
  851. return (things[parent.name].descriptor[0] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd);
  852. } else {
  853. return parent.describeOne(verbose);
  854. }
  855. }
  856. else if (parent.count <= 3 && groupLessThan3 == false) { // less than 3 parents and an ojbect that has varety when described
  857. var list = [];
  858. for (var i = 0; i < parent.count; i++) {
  859. list.push(parent.describeOne(parent.count <= 2));
  860. }
  861. if (things[parent.name].contents.length > 0){
  862. return (merge_things(list) + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd);
  863. } else {
  864. return merge_things(list);
  865. }
  866. } else {//if there are more than 3 of the object
  867. if (things[parent.name].contents.length > 0){
  868. return (parent.count + " " + things[parent.name].descriptor[1] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd);
  869. } else {
  870. return (parent.count + " " + things[parent.name].descriptor[1]);
  871. }
  872. }
  873. } else {//not verbose
  874. return (parent.count > 1 ? (parent.count + " " + things[parent.name].descriptor[1]) : things[parent.name].descriptor[0]);
  875. }
  876. }
  877. function Container(contents = []) {
  878. this.name = "Container";
  879. copy_defaults(this,new DefaultEntity());
  880. if (Number.isInteger(contents))
  881. this.count = contents;
  882. else
  883. this.count = 0;
  884. this.contents = {};
  885. for (var i=0; i < contents.length; i++) {
  886. this.contents[contents[i].name] = contents[i];
  887. }
  888. for (var key in this.contents) {
  889. if (this.contents.hasOwnProperty(key)) {
  890. this.count += this.contents[key].count;
  891. }
  892. }
  893. this.describe = function(verbose = true) {
  894. return describe_all(this.contents,verbose);
  895. };
  896. return this;
  897. }
  898. function Person(count = 1) {
  899. this.name = "Person";
  900. copy_defaults(this,new DefaultEntity());
  901. this.mass = ((Math.random() -.5)*20)+this.mass;
  902. this.count = count;
  903. this.contents = initContents(this.name,this.count);
  904. this.describeOne = function (verbose=true) {
  905. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","multi-colored"], (verbose ? 0.6 : 0));
  906. var sex = random_desc(["male", "female"], (verbose ? 0.75 : 0));
  907. var species = "";
  908. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal","coyote","rabbit","lizard","avian"]);
  909. return merge_desc([body,sex,species]);
  910. };
  911. this.describe = function(verbose=true) {
  912. return defaultDescribe(verbose, this);
  913. }
  914. return this;
  915. }
  916. function Human(count = 1) {
  917. this.name = "Person";
  918. copy_defaults(this,new DefaultEntity());
  919. this.mass = ((Math.random() -.5)*20)+this.mass;
  920. this.count = count;
  921. this.contents = initContents(this.name,this.count);
  922. this.describeOne = function (verbose=true) {
  923. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","tanned"], (verbose ? 0.6 : 0));
  924. var sex = random_desc(["man", "woman"], 1);
  925. return merge_desc([body,sex]);
  926. };
  927. this.describe = function(verbose=true) {
  928. return defaultDescribe(verbose, this);
  929. }
  930. return this;
  931. }
  932. function Cow(count = 1) {
  933. this.name = "Cow";
  934. copy_defaults(this,new DefaultEntity());
  935. this.count = count;
  936. this.contents = initContents(this.name,this.count);
  937. this.describeOne = function (verbose=true) {
  938. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","brown"], (verbose ? 0.6 : 0));
  939. var sex = random_desc(["bull","steer","cow","cow","cow","heifer"], (verbose ? 1 : 0));
  940. return merge_desc([body,sex]);
  941. };
  942. this.describe = function(verbose=true) {
  943. return defaultDescribe(verbose, this);
  944. }
  945. return this;
  946. }
  947. function EmptyCar(count = 1) {
  948. this.name = "Empty Car";
  949. copy_defaults(this,new DefaultEntity());
  950. this.count = count;
  951. this.contents = initContents(this.name,this.count);
  952. this.describeOne = function(verbose=true) {
  953. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  954. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"],0.3);
  955. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  956. return merge_desc(["parked",adjective,color,type]);
  957. };
  958. this.describe = function(verbose=true) {
  959. return defaultDescribe(verbose, this, "vehicle");
  960. }
  961. }
  962. function Car(count = 1) {
  963. this.name = "Car";
  964. copy_defaults(this,new DefaultEntity());
  965. this.count = count;
  966. this.contents = initContents(this.name,this.count);
  967. this.describeOne = function(verbose=true) {
  968. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  969. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"], (verbose ? 0.3 : 0));
  970. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  971. return merge_desc([adjective,color,type]);
  972. };
  973. this.describe = function(verbose=true) {
  974. return defaultDescribe(verbose, this, "vehicle");
  975. }
  976. }
  977. function Bus(count = 1) {
  978. this.name = "Bus";
  979. copy_defaults(this,new DefaultEntity());
  980. this.count = count;
  981. this.contents = initContents(this.name,this.count);
  982. this.describeOne = function(verbose=true) {
  983. var adjective = random_desc(["rusty","brand-new","aging","modern"], (verbose ? 0.3 : 0));
  984. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  985. var type = random_desc(["bus","double-decker bus","articulating bus","open-top bus","sleeper bus","intercity bus"]);
  986. return merge_desc([adjective,color,type]);
  987. };
  988. this.describe = function(verbose=true) {
  989. return defaultDescribe(verbose, this, "vehicle");
  990. }
  991. }
  992. function Tram(count = 1) {
  993. this.name = "Tram";
  994. copy_defaults(this,new DefaultEntity());
  995. this.count = count;
  996. this.contents = initContents(this.name,this.count);
  997. this.describeOne = function(verbose=true) {
  998. var adjective = random_desc(["rusty","weathered","well-maintained",], (verbose ? 0.3 : 0));
  999. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  1000. var type = random_desc(["tram"]);
  1001. return merge_desc([adjective,color,type]);
  1002. };
  1003. this.describe = function(verbose=true) {
  1004. return defaultDescribe(verbose, this, "vehicle");
  1005. }
  1006. this.anal_vore = function() {
  1007. return "You slide " + this.describe() + " up your tight ass";
  1008. };
  1009. }
  1010. function EmptyHelicopter(count = 1) {
  1011. this.name = "Empty Helicopter";
  1012. copy_defaults(this,new DefaultEntity());
  1013. this.count = count;
  1014. this.contents = initContents(this.name,this.count);
  1015. this.describeOne = function(verbose=true) {
  1016. var color = random_desc(["blue","white","white","red","black","gold","yellow"], (verbose ? 0.6 : 0));
  1017. var type = random_desc(["bubble coptor","helicopter","helicopter","news chopper","police helicopter","chopper"]);
  1018. return merge_desc([adjective,color,type]);
  1019. };
  1020. this.describe = function(verbose=true) {
  1021. return defaultDescribe(verbose, this, "vehicle");
  1022. }
  1023. }
  1024. function Helicopter(count = 1) {
  1025. this.name = "Helicopter";
  1026. copy_defaults(this,new DefaultEntity());
  1027. this.count = count;
  1028. this.contents = initContents(this.name,this.count);
  1029. this.describeOne = function(verbose=true) {
  1030. var color = random_desc(["blue","white","white","red","black","gold","yellow"], (verbose ? 0.6 : 0));
  1031. var type = random_desc(["bubble coptor","helicopter","helicopter","news chopper","police helicopter","chopper"]);
  1032. return merge_desc([adjective,color,type]);
  1033. };
  1034. this.describe = function(verbose=true) {
  1035. return defaultDescribe(verbose, this, "vehicle");
  1036. }
  1037. }
  1038. function EmptyPlane(count = 1) {
  1039. this.name = "Empty Plane";
  1040. copy_defaults(this,new DefaultEntity());
  1041. this.count = count;
  1042. this.contents = initContents(this.name,this.count);
  1043. this.describeOne = function(verbose=true) {
  1044. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1045. var color = random_desc(["blue","white","white","blue and white","red and white","black","gold"], (verbose ? 0.9 : 0));
  1046. var type = random_desc(["luxury jet","business jet","single-engine plane","light aircraft"]);
  1047. return merge_desc([adjective,color,type]);
  1048. };
  1049. this.describe = function(verbose=true) {
  1050. return defaultDescribe(verbose, this, "vehicle");
  1051. }
  1052. }
  1053. function Plane(count = 1) {
  1054. this.name = "Plane";
  1055. copy_defaults(this,new DefaultEntity());
  1056. this.count = count;
  1057. this.contents = initContents(this.name,this.count);
  1058. this.describeOne = function(verbose=true) {
  1059. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1060. var color = random_desc(["blue","white","white","blue and white","red and white","black","gold"], (verbose ? 0.9 : 0));
  1061. var type = random_desc(["luxury jet","business jet","single-engine plane","light aircraft"]);
  1062. return merge_desc([adjective,color,type]);
  1063. };
  1064. this.describe = function(verbose=true) {
  1065. return defaultDescribe(verbose, this, "vehicle");
  1066. }
  1067. }
  1068. function EmptyAirliner(count = 1) {
  1069. this.name = "Empty Airliner";
  1070. copy_defaults(this,new DefaultEntity());
  1071. this.count = count;
  1072. this.contents = initContents(this.name,this.count);
  1073. this.describeOne = function(verbose=true) {
  1074. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1075. var color = random_desc(["blue","white","white","blue and white"], (verbose ? 0.9 : 0));
  1076. var type = random_desc(["airliner","twin-engine jet","trijet","four engine jet","double-decker airliner","widebody airliner","passenger jet","airliner"]);
  1077. return merge_desc([adjective,color,type]);
  1078. };
  1079. this.describe = function(verbose=true) {
  1080. return defaultDescribe(verbose, this, "vehicle");
  1081. }
  1082. }
  1083. function Airliner(count = 1) {
  1084. this.name = "Airliner";
  1085. copy_defaults(this,new DefaultEntity());
  1086. this.count = count;
  1087. this.contents = initContents(this.name,this.count);
  1088. this.describeOne = function(verbose=true) {
  1089. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1090. var color = random_desc(["blue","white","white","blue and white"], (verbose ? 0.9 : 0));
  1091. var type = random_desc(["airliner","twin-engine jet","trijet","four engine jet","double-decker airliner","widebody airliner","passenger jet","airliner"]);
  1092. return merge_desc([adjective,color,type]);
  1093. };
  1094. this.describe = function(verbose=true) {
  1095. return defaultDescribe(verbose, this, "vehicle");
  1096. }
  1097. }
  1098. function Train(count = 1) {
  1099. this.name = "Train";
  1100. copy_defaults(this,new DefaultEntity());
  1101. this.count = count;
  1102. this.contents = initContents(this.name,this.count);
  1103. this.describeOne = function(verbose=true) {
  1104. var adjective = random_desc(["rusty","brand-new","steam","freshly-painted"], (verbose ? 0.3 : 0));
  1105. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  1106. var type = random_desc(["train","passenger train","freight train"]);
  1107. return merge_desc([adjective,color,type]);
  1108. };
  1109. this.describe = function(verbose = true) {
  1110. if (verbose) {
  1111. if (this.count == 1) {
  1112. var list = [];
  1113. for (var i = 0; i < this.count; i++) {
  1114. list.push(this.describeOne(verbose));
  1115. }
  1116. return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  1117. } else {
  1118. return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  1119. }
  1120. } else {
  1121. return (this.count > 1 ? this.count + " trains" : "a train");
  1122. }
  1123. };
  1124. this.anal_vore = function() {
  1125. 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");
  1126. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  1127. };
  1128. }
  1129. function TrainCar(count = 1) {
  1130. this.name = "Train Car";
  1131. copy_defaults(this,new DefaultEntity());
  1132. this.count = count;
  1133. this.contents = initContents(this.name,this.count);
  1134. this.describeOne = function(verbose=true) {
  1135. var adjective = random_desc(["rusty","brand-new","vintage","graffitied","well-maintained"], (verbose ? 0.3 : 0));
  1136. var color = random_desc(["black","tan","gray","yellow","steel","wooden"], (verbose ? 1 : 0));
  1137. var type = random_desc(["train car","passenger train car","freight train car"]);
  1138. return merge_desc([adjective,color,type]);
  1139. };
  1140. this.describe = function(verbose=true) {
  1141. return defaultDescribe(verbose, this, "vehicle");
  1142. }
  1143. }
  1144. function House(count = 1) {
  1145. this.name = "House";
  1146. copy_defaults(this,new DefaultEntity());
  1147. this.count = count;
  1148. this.contents = initContents(this.name,this.count);
  1149. this.describeOne = function(verbose=true) {
  1150. var size = random_desc(["little","two-story","large","well-built","run-down","cheap",], (verbose ? 0.5 : 0));
  1151. var color = random_desc(["blue","white","gray","tan","green","wooden","brick"], (verbose ? 0.5 : 0));
  1152. var name = random_desc(["house","home","duplex","house","house","trailer"], 1);
  1153. return merge_desc([size,color,name]);
  1154. };
  1155. this.describe = function(verbose=true) {
  1156. return defaultDescribe(verbose, this);
  1157. }
  1158. }
  1159. //might split this into a general business and resutrant categories
  1160. function Business(count = 1) {
  1161. this.name = "Business";
  1162. copy_defaults(this,new DefaultEntity());
  1163. this.count = count;
  1164. this.contents = initContents(this.name,this.count);
  1165. this.describeOne = function(verbose=true) {
  1166. var size = random_desc(["little","two-story","large","well-built","run-down","cheap","aging","corner"], (verbose ? 0.5 : 0));
  1167. var color = random_desc(["blue","white","gray","tan","green","brick","concrete"], (verbose ? 0.5 : 0));
  1168. var name = random_desc(["mall","resturant","bank","clinic","shop","post office","tire shop","chain resturant","grocery store","barber shop","pizza resturant","hardware store","movie theather","gas station"], 1);
  1169. return merge_desc([size,color,name]);
  1170. };
  1171. this.describe = function(verbose=true) {
  1172. return defaultDescribe(verbose, this);
  1173. }
  1174. }
  1175. function Barn(count = 1) {
  1176. this.name = "Barn";
  1177. copy_defaults(this,new DefaultEntity());
  1178. this.count = count;
  1179. this.contents = initContents(this.name,this.count);
  1180. this.describeOne = function(verbose=true) {
  1181. var size = random_desc(["little","big","large","weathered","rotted","new"], (verbose ? 0.5 : 0));
  1182. var color = random_desc(["blue","white","gray","tan","green","red"], (verbose ? 0.5 : 0));
  1183. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  1184. return merge_desc([size,color,name]);
  1185. };
  1186. this.describe = function(verbose=true) {
  1187. return defaultDescribe(verbose, this);
  1188. }
  1189. }
  1190. function SmallHangar(count = 1) {
  1191. this.name = "Small Hangar";
  1192. copy_defaults(this,new DefaultEntity());
  1193. this.count = count;
  1194. this.contents = initContents(this.name,this.count);
  1195. this.describeOne = function(verbose=true) {
  1196. var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0));
  1197. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1198. var name = random_desc(["hangar","hangar","hangar","aircraft hangar"], 1);
  1199. return merge_desc([size,color,name]);
  1200. };
  1201. this.describe = function(verbose=true) {
  1202. return defaultDescribe(verbose, this);
  1203. }
  1204. }
  1205. function HelicopterHangar(count = 1) {
  1206. this.name = "Helicopter Hangar";
  1207. copy_defaults(this,new DefaultEntity());
  1208. this.count = count;
  1209. this.contents = initContents(this.name,this.count);
  1210. this.describeOne = function(verbose=true) {
  1211. var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0));
  1212. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1213. var name = random_desc(["hangar","hangar","hangar","helicopter hangar"], 1);
  1214. return merge_desc([size,color,name]);
  1215. };
  1216. this.describe = function(verbose=true) {
  1217. return defaultDescribe(verbose, this);
  1218. }
  1219. }
  1220. function LargeHangar(count = 1) {
  1221. this.name = "Large Hangar";
  1222. copy_defaults(this,new DefaultEntity());
  1223. this.count = count;
  1224. this.contents = initContents(this.name,this.count);
  1225. this.describeOne = function(verbose=true) {
  1226. var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0));
  1227. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1228. var name = random_desc(["hangar","hangar","hangar","large hangar","spacious hangar"], 1);
  1229. return merge_desc([size,color,name]);
  1230. };
  1231. this.describe = function(verbose=true) {
  1232. return defaultDescribe(verbose, this);
  1233. }
  1234. }
  1235. function SmallSkyscraper(count = 1) {
  1236. this.name = "Small Skyscraper";
  1237. copy_defaults(this,new DefaultEntity());
  1238. this.count = count;
  1239. this.contents = initContents(this.name,this.count);
  1240. this.describeOne = function(verbose=true) {
  1241. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1242. var name = random_desc(["skyscraper","office tower","office building","high rise"], 1);
  1243. return merge_desc([color,name]);
  1244. };
  1245. this.describe = function(verbose=true) {
  1246. return defaultDescribe(verbose, this);
  1247. }
  1248. }
  1249. function LargeSkyscraper(count = 1) {
  1250. this.name = "Large Skyscraper";
  1251. copy_defaults(this,new DefaultEntity());
  1252. this.count = count;
  1253. this.contents = initContents(this.name,this.count);
  1254. this.describeOne = function(verbose=true) {
  1255. var color = random_desc(["blue","white","gray","tan","green","glass"], (verbose ? 0.5 : 0));
  1256. var name = random_desc(["skyscraper","office tower","office building"], 1);
  1257. return merge_desc(["towering",color,name]);
  1258. };
  1259. this.describe = function(verbose=true) {
  1260. return defaultDescribe(verbose, this);
  1261. }
  1262. }
  1263. function ParkingGarage(count = 1) {
  1264. this.name = "Parking Garage";
  1265. copy_defaults(this,new DefaultEntity());
  1266. this.count = count;
  1267. this.contents = initContents(this.name,this.count);
  1268. this.describe = function(verbose=true) {
  1269. return defaultDescribe(verbose, this);
  1270. }
  1271. }
  1272. function Ranch(count = 1) {
  1273. this.name = "Ranch";
  1274. copy_defaults(this,new DefaultEntity());
  1275. this.count = count;
  1276. this.contents = initContents(this.name,this.count);
  1277. this.describeOne = function(verbose=true) {
  1278. var size = random_desc(["little","large","prosperous","run-down"], (verbose ? 0.5 : 0));
  1279. var name = random_desc(["ranch","farm","ranch","dairy farm","cattle farm","ranch","farm"], 1);
  1280. return merge_desc([size,name]);
  1281. };
  1282. this.describe = function(verbose=true) {
  1283. return defaultDescribe(verbose, this);
  1284. }
  1285. }
  1286. function Airstrip(count = 1) {
  1287. this.name = "Airstrip";
  1288. copy_defaults(this,new DefaultEntity());
  1289. this.count = count;
  1290. this.contents = initContents(this.name,this.count);
  1291. this.describe = function(verbose=true) {
  1292. return defaultDescribe(verbose, this, "community");
  1293. }
  1294. }
  1295. function Airport(count = 1) {
  1296. this.name = "Airport";
  1297. copy_defaults(this,new DefaultEntity());
  1298. this.count = count;
  1299. this.contents = initContents(this.name,this.count);
  1300. this.describe = function(verbose=true) {
  1301. return defaultDescribe(verbose, this, "community");
  1302. }
  1303. }
  1304. function Town(count = 1) {
  1305. this.name = "Town";
  1306. copy_defaults(this,new DefaultEntity());
  1307. this.count = count;
  1308. this.contents = initContents(this.name,this.count);
  1309. this.describe = function(verbose=true) {
  1310. return defaultDescribe(verbose, this, "community");
  1311. }
  1312. }
  1313. function City(count = 1) {
  1314. this.name = "City";
  1315. copy_defaults(this,new DefaultEntity());
  1316. this.count = count;
  1317. this.contents = initContents(this.name,this.count);
  1318. this.describe = function(verbose=true) {
  1319. return defaultDescribe(verbose, this, "community");
  1320. }
  1321. }
  1322. function Continent(count = 1) {
  1323. this.name = "Continent";
  1324. copy_defaults(this,new DefaultEntity());
  1325. this.count = count;
  1326. this.contents = initContents(this.name,this.count);
  1327. this.describe = function(verbose=true) {
  1328. return defaultDescribe(verbose, this, "community");
  1329. }
  1330. }
  1331. function Planet(count = 1) {
  1332. this.name = "Planet";
  1333. copy_defaults(this,new DefaultEntity());
  1334. this.count = count;
  1335. this.contents = initContents(this.name,this.count);
  1336. this.describe = function(verbose=true) {
  1337. return defaultDescribe(verbose, this, "community");
  1338. }
  1339. }
  1340. function Star(count = 1) {
  1341. this.name = "Star";
  1342. copy_defaults(this,new DefaultEntity());
  1343. this.count = count;
  1344. this.contents = initContents(this.name,this.count);
  1345. this.describe = function(verbose = true) {
  1346. return (this.count == 1 ? "a star" : this.count + " stars");
  1347. };
  1348. }
  1349. function SolarSystem(count = 1) {
  1350. this.name = "Solar System";
  1351. copy_defaults(this,new DefaultEntity());
  1352. this.count = count;
  1353. this.contents = initContents(this.name,this.count);
  1354. this.describe = function(verbose=true) {
  1355. return defaultDescribe(verbose, this, "celestial");
  1356. }
  1357. }
  1358. function Galaxy(count = 1) {
  1359. this.name = "Galaxy";
  1360. copy_defaults(this,new DefaultEntity());
  1361. this.count = count;
  1362. this.contents = initContents(this.name,this.count);
  1363. this.describe = function(verbose=true) {
  1364. return defaultDescribe(verbose, this, "celestial");
  1365. }
  1366. }
  1367. function Cluster(count = 1) {
  1368. this.name = "Cluster";
  1369. copy_defaults(this,new DefaultEntity());
  1370. this.count = count;
  1371. this.contents = initContents(this.name,this.count);
  1372. this.describe = function(verbose=true) {
  1373. return defaultDescribe(verbose, this, "celestial");
  1374. }
  1375. }
  1376. function Universe(count = 1) {
  1377. this.name = "Universe";
  1378. copy_defaults(this,new DefaultEntity());
  1379. this.count = count;
  1380. this.contents = initContents(this.name,this.count);
  1381. this.describe = function(verbose=true) {
  1382. return defaultDescribe(verbose, this, "celestial");
  1383. }
  1384. }
  1385. function Multiverse(count = 1) {
  1386. this.name = "Multiverse";
  1387. copy_defaults(this,new DefaultEntity());
  1388. this.count = count;
  1389. this.contents = initContents(this.name,this.count);
  1390. this.describe = function(verbose=true) {
  1391. return defaultDescribe(verbose, this, "celestial");
  1392. }
  1393. }
  1394. function Soldier(count = 1) {
  1395. this.name = "Soldier";
  1396. copy_defaults(this,new DefaultEntity());
  1397. this.count = count;
  1398. this.contents = initContents(this.name,this.count);
  1399. this.describe = function(verbose=true) {
  1400. return defaultDescribe(verbose, this, "military");
  1401. }
  1402. }
  1403. function Tank(count = 1) {
  1404. this.name = "Tank";
  1405. copy_defaults(this,new DefaultEntity());
  1406. this.count = count;
  1407. this.contents = initContents(this.name,this.count);
  1408. this.describe = function(verbose=true) {
  1409. return defaultDescribe(verbose, this, "generic vehicle");
  1410. }
  1411. }
  1412. function Artillery(count = 1) {
  1413. this.name = "Artillery";
  1414. copy_defaults(this,new DefaultEntity());
  1415. this.count = count;
  1416. this.contents = initContents(this.name,this.count);
  1417. this.describe = function(verbose=true) {
  1418. return defaultDescribe(verbose, this, "generic vehicle");
  1419. }
  1420. }
  1421. function MilitaryHelicopter(count = 1) {
  1422. this.name = "Military Helicopter";
  1423. copy_defaults(this,new DefaultEntity());
  1424. this.count = count;
  1425. this.contents = initContents(this.name,this.count);
  1426. this.describe = function(verbose=true) {
  1427. return defaultDescribe(verbose, this, "generic vehicle");
  1428. }
  1429. }
  1430. function Micro(count = 1) {
  1431. this.name = "Micro";
  1432. copy_defaults(this,new DefaultEntity());
  1433. this.count = count;
  1434. this.contents = initContents(this.name,this.count);
  1435. this.describe = function(verbose=true) {
  1436. return defaultDescribe(verbose, this);
  1437. }
  1438. }
  1439. function Macro(count = 1) {
  1440. this.name = "Macro";
  1441. copy_defaults(this,new DefaultEntity());
  1442. this.count = count;
  1443. this.contents = initContents(this.name,this.count);
  1444. this.describe = function(verbose=true) {
  1445. return defaultDescribe(verbose, this);
  1446. }
  1447. }
  1448. function Squad(count = 1) {
  1449. this.name = "Squad";
  1450. copy_defaults(this,new DefaultEntity());
  1451. this.count = count;
  1452. this.contents = initContents(this.name,this.count);
  1453. this.describe = function(verbose=true) {
  1454. return defaultDescribe(verbose, this, "military");
  1455. }
  1456. }
  1457. function Platoon(count = 1) {
  1458. this.name = "Platoon";
  1459. copy_defaults(this,new DefaultEntity());
  1460. this.count = count;
  1461. this.contents = initContents(this.name,this.count);
  1462. this.describe = function(verbose=true) {
  1463. return defaultDescribe(verbose, this, "military");
  1464. }
  1465. }
  1466. function Company(count = 1) {
  1467. this.name = "Company";
  1468. copy_defaults(this,new DefaultEntity());
  1469. this.count = count;
  1470. this.contents = initContents(this.name,this.count);
  1471. this.describe = function(verbose=true) {
  1472. return defaultDescribe(verbose, this, "military");
  1473. }
  1474. }
  1475. function Battalion(count = 1) {
  1476. this.name = "Battalion";
  1477. copy_defaults(this,new DefaultEntity());
  1478. this.count = count;
  1479. this.contents = initContents(this.name,this.count);
  1480. this.describe = function(verbose=true) {
  1481. return defaultDescribe(verbose, this, "military");
  1482. }
  1483. }
  1484. function Brigade(count = 1) {
  1485. this.name = "Brigade";
  1486. copy_defaults(this,new DefaultEntity());
  1487. this.count = count;
  1488. this.contents = initContents(this.name,this.count);
  1489. this.describe = function(verbose=true) {
  1490. return defaultDescribe(verbose, this, "military");
  1491. }
  1492. }
  1493. function Division(count = 1) {
  1494. this.name = "Division";
  1495. copy_defaults(this,new DefaultEntity());
  1496. this.count = count;
  1497. this.contents = initContents(this.name,this.count);
  1498. this.describe = function(verbose=true) {
  1499. return defaultDescribe(verbose, this, "military");
  1500. }
  1501. }
  1502. function TankDivision(count = 1) {
  1503. this.name = "Tank Division";
  1504. copy_defaults(this,new DefaultEntity());
  1505. this.count = count;
  1506. this.contents = initContents(this.name,this.count);
  1507. this.describe = function(verbose=true) {
  1508. return defaultDescribe(verbose, this, "military");
  1509. }
  1510. }
  1511. function Army(count = 1) {
  1512. this.name = "Army";
  1513. copy_defaults(this,new DefaultEntity());
  1514. this.count = count;
  1515. this.contents = initContents(this.name,this.count);
  1516. this.describe = function(verbose=true) {
  1517. return defaultDescribe(verbose, this, "military");
  1518. }
  1519. }
  1520. //todo
  1521. //farms
  1522. //factories
  1523. //racetracks
  1524. //more building types
  1525. //cranes and other construction equipment
  1526. //nebula
  1527. //biome magic also set it so that you can't roll your existing biome
  1528. //chemical factory
  1529. //grand army
  1530. //armada