big steppy
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

1806 行
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 defaultModProperty(thing) {
  721. return function(prop, func) {
  722. thing[prop] = func(thing[prop]);
  723. for (var key in thing.contents) {
  724. if (thing.contents.hasOwnProperty(key)) {
  725. thing.contents[key].mod_property(prop, func);
  726. }
  727. }
  728. };
  729. }
  730. function defaultAddContent(thing) {
  731. return function(name, min, max, count) {
  732. if (min == max) {
  733. let object = new things[name](min*count);
  734. thing.contents[object.name] = object;
  735. } else {
  736. let object = new things[name](distribution(min, max, count));
  737. thing.contents[object.name] = object;
  738. }
  739. };
  740. }
  741. function DefaultEntity() {
  742. this.sum = defaultSum;
  743. this.area = defaultArea;
  744. this.mass = defaultMass;
  745. this.sum_property = defaultSumProperty;
  746. this.mod_property = defaultModProperty;
  747. this.merge = defaultMerge;
  748. this.multiply = defaultMultiply;
  749. this.describeSimple = defaultDescribeSimple;
  750. this.describeOne = defaultDescribeOne;
  751. return this;
  752. }
  753. // god I love reinventing the wheel
  754. function copy_defaults(self,proto) { //loads the values defined in things into the fuction that calls it
  755. for (var key in proto) { //proto will always be a new DefaultEntity, self is the parent function
  756. if (proto.hasOwnProperty(key)) {
  757. self[key] = proto[key](self);
  758. }
  759. }
  760. }
  761. // combine strings into a list with proper grammar
  762. function merge_things(list,semicolons=false) {
  763. if (list.length == 0) {
  764. return "";
  765. } else if (list.length == 1) {
  766. return list[0];
  767. } else if (list.length == 2) {
  768. return list[0] + " and " + list[1];
  769. } else {
  770. var result = "";
  771. list.slice(0,list.length-1).forEach(function(term) {
  772. result += term + ", ";
  773. });
  774. result += "and " + list[list.length-1];
  775. return result;
  776. }
  777. }
  778. // combine the adjectives for something into a single string
  779. function merge_desc(list) {
  780. var result = "";
  781. list.forEach(function(term) {
  782. if (term != "")
  783. result += term + " ";
  784. });
  785. // knock off the last space
  786. if (result.length > 0) {
  787. result = result.substring(0, result.length - 1);
  788. }
  789. let article = "a "
  790. //a/an overwriting terms
  791. let forcedTerms = ["honor","heir"]; //words that need to start with an but don't start with a,e,i,o,u
  792. let force = false;
  793. for (let i of forcedTerms){
  794. if (i === result.substring(0, i.length)){force = true;}
  795. }
  796. let exceptionTerms = ["uniform","unique"]; //words that need to start with a and start with a,e,i,o,u
  797. let exception = false;
  798. for (let i of exceptionTerms){
  799. if (i === result.substring(0, i.length)){exception = true;}
  800. }
  801. //check if the string should start with an
  802. 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")))){
  803. article = "an ";
  804. }
  805. result = article + result;
  806. return result;
  807. }
  808. // describes everything in the container
  809. function describe_all(contents,verbose=true,except=[]) {
  810. var things = [];
  811. for (var key in contents) {
  812. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  813. things.push(contents[key].describe(verbose));
  814. }
  815. }
  816. return merge_things(things);
  817. }
  818. function random_desc(list, odds=1) { //strings together an array into a series of words
  819. if (Math.random() < odds)
  820. return list[Math.floor(Math.random() * list.length)];
  821. else
  822. return "";
  823. }
  824. function defaultDescribeSimple(thing) {
  825. return function(flat) {
  826. if (flat) {
  827. return flatten(thing).describe(false)
  828. } else {
  829. return thing.describe(false);
  830. }
  831. }
  832. }
  833. function defaultDescribe(verbose=true, parent, descAs){
  834. let descriptorEnd = " inside";
  835. let descriptorConjunction = " with ";
  836. let groupLessThan3 = false;
  837. switch(descAs) {
  838. case "vehicle":
  839. descriptorEnd = pickString(" inside"," inside"," inside", " inside"," riding inside", " trapped inside", " sitting inside");
  840. break;
  841. case "community":
  842. groupLessThan3 = true;
  843. descriptorEnd = " in " + (parent.count == 1 ? "it" : "them");
  844. break;
  845. case "celestial":
  846. groupLessThan3 = true;
  847. descriptorConjunction = pickString(" made up of "," consisting of "," containing ");
  848. descriptorEnd = "";
  849. break;
  850. case "military":
  851. groupLessThan3 = true;
  852. descriptorConjunction = pickString(" of "," of "," made up of "," comprised of "," containing ");
  853. descriptorEnd = "";
  854. break;
  855. case "generic vehicle":
  856. groupLessThan3 = true;
  857. descriptorEnd = pickString(" inside"," inside"," inside", " inside"," riding inside", " trapped inside", " sitting inside");
  858. break;
  859. } if (verbose) {
  860. if (parent.count = 1 ) { //singular parent (specifying single to catch cases where groupLessThan3 = true, otherwise it would output "1 towns" instead of "a town"
  861. if (things[parent.name].contents.length > 0){
  862. return (things[parent.name].descriptor[0] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd);
  863. } else {
  864. return parent.describeOne(verbose);
  865. }
  866. }
  867. else if (parent.count <= 3 && groupLessThan3 == false) { // less than 3 parents and an ojbect that has varety when described
  868. var list = [];
  869. for (var i = 0; i < parent.count; i++) {
  870. list.push(parent.describeOne(parent.count <= 2));
  871. }
  872. if (things[parent.name].contents.length > 0){
  873. return (merge_things(list) + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd);
  874. } else {
  875. return merge_things(list);
  876. }
  877. } else {//if there are more than 3 of the object
  878. if (things[parent.name].contents.length > 0){
  879. return (parent.count + " " + things[parent.name].descriptor[1] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd);
  880. } else {
  881. return (parent.count + " " + things[parent.name].descriptor[1]);
  882. }
  883. }
  884. } else {//not verbose
  885. return (parent.count > 1 ? (parent.count + " " + things[parent.name].descriptor[1]) : things[parent.name].descriptor[0]);
  886. }
  887. }
  888. function Container(contents = []) {
  889. this.name = "Container";
  890. copy_defaults(this,new DefaultEntity());
  891. if (Number.isInteger(contents))
  892. this.count = contents;
  893. else
  894. this.count = 0;
  895. this.contents = {};
  896. for (var i=0; i < contents.length; i++) {
  897. this.contents[contents[i].name] = contents[i];
  898. }
  899. for (var key in this.contents) {
  900. if (this.contents.hasOwnProperty(key)) {
  901. this.count += this.contents[key].count;
  902. }
  903. }
  904. this.describe = function(verbose = true) {
  905. return describe_all(this.contents,verbose);
  906. };
  907. return this;
  908. }
  909. function Person(count = 1) {
  910. this.name = "Person";
  911. copy_defaults(this,new DefaultEntity());
  912. this.mass = ((Math.random() -.5)*20)+this.mass;
  913. this.count = count;
  914. this.contents = initContents(this.name,this.count);
  915. this.describeOne = function (verbose=true) {
  916. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","multi-colored"], (verbose ? 0.6 : 0));
  917. var sex = random_desc(["male", "female"], (verbose ? 0.75 : 0));
  918. var species = "";
  919. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal","coyote","rabbit","lizard","avian"]);
  920. return merge_desc([body,sex,species]);
  921. };
  922. this.describe = function(verbose=true) {
  923. return defaultDescribe(verbose, this);
  924. }
  925. return this;
  926. }
  927. function Human(count = 1) {
  928. this.name = "Person";
  929. copy_defaults(this,new DefaultEntity());
  930. this.mass = ((Math.random() -.5)*20)+this.mass;
  931. this.count = count;
  932. this.contents = initContents(this.name,this.count);
  933. this.describeOne = function (verbose=true) {
  934. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","tanned"], (verbose ? 0.6 : 0));
  935. var sex = random_desc(["man", "woman"], 1);
  936. return merge_desc([body,sex]);
  937. };
  938. this.describe = function(verbose=true) {
  939. return defaultDescribe(verbose, this);
  940. }
  941. return this;
  942. }
  943. function Cow(count = 1) {
  944. this.name = "Cow";
  945. copy_defaults(this,new DefaultEntity());
  946. this.count = count;
  947. this.contents = initContents(this.name,this.count);
  948. this.describeOne = function (verbose=true) {
  949. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","brown"], (verbose ? 0.6 : 0));
  950. var sex = random_desc(["bull","steer","cow","cow","cow","heifer"], (verbose ? 1 : 0));
  951. return merge_desc([body,sex]);
  952. };
  953. this.describe = function(verbose=true) {
  954. return defaultDescribe(verbose, this);
  955. }
  956. return this;
  957. }
  958. function EmptyCar(count = 1) {
  959. this.name = "Empty Car";
  960. copy_defaults(this,new DefaultEntity());
  961. this.count = count;
  962. this.contents = initContents(this.name,this.count);
  963. this.describeOne = function(verbose=true) {
  964. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  965. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"],0.3);
  966. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  967. return merge_desc(["parked",adjective,color,type]);
  968. };
  969. this.describe = function(verbose=true) {
  970. return defaultDescribe(verbose, this, "vehicle");
  971. }
  972. }
  973. function Car(count = 1) {
  974. this.name = "Car";
  975. copy_defaults(this,new DefaultEntity());
  976. this.count = count;
  977. this.contents = initContents(this.name,this.count);
  978. this.describeOne = function(verbose=true) {
  979. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  980. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"], (verbose ? 0.3 : 0));
  981. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  982. return merge_desc([adjective,color,type]);
  983. };
  984. this.describe = function(verbose=true) {
  985. return defaultDescribe(verbose, this, "vehicle");
  986. }
  987. }
  988. function Bus(count = 1) {
  989. this.name = "Bus";
  990. copy_defaults(this,new DefaultEntity());
  991. this.count = count;
  992. this.contents = initContents(this.name,this.count);
  993. this.describeOne = function(verbose=true) {
  994. var adjective = random_desc(["rusty","brand-new","aging","modern"], (verbose ? 0.3 : 0));
  995. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  996. var type = random_desc(["bus","double-decker bus","articulating bus","open-top bus","sleeper bus","intercity bus"]);
  997. return merge_desc([adjective,color,type]);
  998. };
  999. this.describe = function(verbose=true) {
  1000. return defaultDescribe(verbose, this, "vehicle");
  1001. }
  1002. }
  1003. function Tram(count = 1) {
  1004. this.name = "Tram";
  1005. copy_defaults(this,new DefaultEntity());
  1006. this.count = count;
  1007. this.contents = initContents(this.name,this.count);
  1008. this.describeOne = function(verbose=true) {
  1009. var adjective = random_desc(["rusty","weathered","well-maintained",], (verbose ? 0.3 : 0));
  1010. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  1011. var type = random_desc(["tram"]);
  1012. return merge_desc([adjective,color,type]);
  1013. };
  1014. this.describe = function(verbose=true) {
  1015. return defaultDescribe(verbose, this, "vehicle");
  1016. }
  1017. this.anal_vore = function() {
  1018. return "You slide " + this.describe() + " up your tight ass";
  1019. };
  1020. }
  1021. function EmptyHelicopter(count = 1) {
  1022. this.name = "Empty Helicopter";
  1023. copy_defaults(this,new DefaultEntity());
  1024. this.count = count;
  1025. this.contents = initContents(this.name,this.count);
  1026. this.describeOne = function(verbose=true) {
  1027. var color = random_desc(["blue","white","white","red","black","gold","yellow"], (verbose ? 0.6 : 0));
  1028. var type = random_desc(["bubble coptor","helicopter","helicopter","news chopper","police helicopter","chopper"]);
  1029. return merge_desc([adjective,color,type]);
  1030. };
  1031. this.describe = function(verbose=true) {
  1032. return defaultDescribe(verbose, this, "vehicle");
  1033. }
  1034. }
  1035. function Helicopter(count = 1) {
  1036. this.name = "Helicopter";
  1037. copy_defaults(this,new DefaultEntity());
  1038. this.count = count;
  1039. this.contents = initContents(this.name,this.count);
  1040. this.describeOne = function(verbose=true) {
  1041. var color = random_desc(["blue","white","white","red","black","gold","yellow"], (verbose ? 0.6 : 0));
  1042. var type = random_desc(["bubble coptor","helicopter","helicopter","news chopper","police helicopter","chopper"]);
  1043. return merge_desc([adjective,color,type]);
  1044. };
  1045. this.describe = function(verbose=true) {
  1046. return defaultDescribe(verbose, this, "vehicle");
  1047. }
  1048. }
  1049. function EmptyPlane(count = 1) {
  1050. this.name = "Empty Plane";
  1051. copy_defaults(this,new DefaultEntity());
  1052. this.count = count;
  1053. this.contents = initContents(this.name,this.count);
  1054. this.describeOne = function(verbose=true) {
  1055. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1056. var color = random_desc(["blue","white","white","blue and white","red and white","black","gold"], (verbose ? 0.9 : 0));
  1057. var type = random_desc(["luxury jet","business jet","single-engine plane","light aircraft"]);
  1058. return merge_desc([adjective,color,type]);
  1059. };
  1060. this.describe = function(verbose=true) {
  1061. return defaultDescribe(verbose, this, "vehicle");
  1062. }
  1063. }
  1064. function Plane(count = 1) {
  1065. this.name = "Plane";
  1066. copy_defaults(this,new DefaultEntity());
  1067. this.count = count;
  1068. this.contents = initContents(this.name,this.count);
  1069. this.describeOne = function(verbose=true) {
  1070. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1071. var color = random_desc(["blue","white","white","blue and white","red and white","black","gold"], (verbose ? 0.9 : 0));
  1072. var type = random_desc(["luxury jet","business jet","single-engine plane","light aircraft"]);
  1073. return merge_desc([adjective,color,type]);
  1074. };
  1075. this.describe = function(verbose=true) {
  1076. return defaultDescribe(verbose, this, "vehicle");
  1077. }
  1078. }
  1079. function EmptyAirliner(count = 1) {
  1080. this.name = "Empty Airliner";
  1081. copy_defaults(this,new DefaultEntity());
  1082. this.count = count;
  1083. this.contents = initContents(this.name,this.count);
  1084. this.describeOne = function(verbose=true) {
  1085. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1086. var color = random_desc(["blue","white","white","blue and white"], (verbose ? 0.9 : 0));
  1087. var type = random_desc(["airliner","twin-engine jet","trijet","four engine jet","double-decker airliner","widebody airliner","passenger jet","airliner"]);
  1088. return merge_desc([adjective,color,type]);
  1089. };
  1090. this.describe = function(verbose=true) {
  1091. return defaultDescribe(verbose, this, "vehicle");
  1092. }
  1093. }
  1094. function Airliner(count = 1) {
  1095. this.name = "Airliner";
  1096. copy_defaults(this,new DefaultEntity());
  1097. this.count = count;
  1098. this.contents = initContents(this.name,this.count);
  1099. this.describeOne = function(verbose=true) {
  1100. var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0));
  1101. var color = random_desc(["blue","white","white","blue and white"], (verbose ? 0.9 : 0));
  1102. var type = random_desc(["airliner","twin-engine jet","trijet","four engine jet","double-decker airliner","widebody airliner","passenger jet","airliner"]);
  1103. return merge_desc([adjective,color,type]);
  1104. };
  1105. this.describe = function(verbose=true) {
  1106. return defaultDescribe(verbose, this, "vehicle");
  1107. }
  1108. }
  1109. function Train(count = 1) {
  1110. this.name = "Train";
  1111. copy_defaults(this,new DefaultEntity());
  1112. this.count = count;
  1113. this.contents = initContents(this.name,this.count);
  1114. this.describeOne = function(verbose=true) {
  1115. var adjective = random_desc(["rusty","brand-new","steam","freshly-painted"], (verbose ? 0.3 : 0));
  1116. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  1117. var type = random_desc(["train","passenger train","freight train"]);
  1118. return merge_desc([adjective,color,type]);
  1119. };
  1120. this.describe = function(verbose = true) {
  1121. if (verbose) {
  1122. if (this.count == 1) {
  1123. var list = [];
  1124. for (var i = 0; i < this.count; i++) {
  1125. list.push(this.describeOne(verbose));
  1126. }
  1127. return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  1128. } else {
  1129. return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  1130. }
  1131. } else {
  1132. return (this.count > 1 ? this.count + " trains" : "a train");
  1133. }
  1134. };
  1135. this.anal_vore = function() {
  1136. 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");
  1137. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  1138. };
  1139. }
  1140. function TrainCar(count = 1) {
  1141. this.name = "Train Car";
  1142. copy_defaults(this,new DefaultEntity());
  1143. this.count = count;
  1144. this.contents = initContents(this.name,this.count);
  1145. this.describeOne = function(verbose=true) {
  1146. var adjective = random_desc(["rusty","brand-new","vintage","graffitied","well-maintained"], (verbose ? 0.3 : 0));
  1147. var color = random_desc(["black","tan","gray","yellow","steel","wooden"], (verbose ? 1 : 0));
  1148. var type = random_desc(["train car","passenger train car","freight train car"]);
  1149. return merge_desc([adjective,color,type]);
  1150. };
  1151. this.describe = function(verbose=true) {
  1152. return defaultDescribe(verbose, this, "vehicle");
  1153. }
  1154. }
  1155. function House(count = 1) {
  1156. this.name = "House";
  1157. copy_defaults(this,new DefaultEntity());
  1158. this.count = count;
  1159. this.contents = initContents(this.name,this.count);
  1160. this.describeOne = function(verbose=true) {
  1161. var size = random_desc(["little","two-story","large","well-built","run-down","cheap",], (verbose ? 0.5 : 0));
  1162. var color = random_desc(["blue","white","gray","tan","green","wooden","brick"], (verbose ? 0.5 : 0));
  1163. var name = random_desc(["house","home","duplex","house","house","trailer"], 1);
  1164. return merge_desc([size,color,name]);
  1165. };
  1166. this.describe = function(verbose=true) {
  1167. return defaultDescribe(verbose, this);
  1168. }
  1169. }
  1170. //might split this into a general business and resutrant categories
  1171. function Business(count = 1) {
  1172. this.name = "Business";
  1173. copy_defaults(this,new DefaultEntity());
  1174. this.count = count;
  1175. this.contents = initContents(this.name,this.count);
  1176. this.describeOne = function(verbose=true) {
  1177. var size = random_desc(["little","two-story","large","well-built","run-down","cheap","aging","corner"], (verbose ? 0.5 : 0));
  1178. var color = random_desc(["blue","white","gray","tan","green","brick","concrete"], (verbose ? 0.5 : 0));
  1179. 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);
  1180. return merge_desc([size,color,name]);
  1181. };
  1182. this.describe = function(verbose=true) {
  1183. return defaultDescribe(verbose, this);
  1184. }
  1185. }
  1186. function Barn(count = 1) {
  1187. this.name = "Barn";
  1188. copy_defaults(this,new DefaultEntity());
  1189. this.count = count;
  1190. this.contents = initContents(this.name,this.count);
  1191. this.describeOne = function(verbose=true) {
  1192. var size = random_desc(["little","big","large","weathered","rotted","new"], (verbose ? 0.5 : 0));
  1193. var color = random_desc(["blue","white","gray","tan","green","red"], (verbose ? 0.5 : 0));
  1194. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  1195. return merge_desc([size,color,name]);
  1196. };
  1197. this.describe = function(verbose=true) {
  1198. return defaultDescribe(verbose, this);
  1199. }
  1200. }
  1201. function SmallHangar(count = 1) {
  1202. this.name = "Small Hangar";
  1203. copy_defaults(this,new DefaultEntity());
  1204. this.count = count;
  1205. this.contents = initContents(this.name,this.count);
  1206. this.describeOne = function(verbose=true) {
  1207. var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0));
  1208. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1209. var name = random_desc(["hangar","hangar","hangar","aircraft hangar"], 1);
  1210. return merge_desc([size,color,name]);
  1211. };
  1212. this.describe = function(verbose=true) {
  1213. return defaultDescribe(verbose, this);
  1214. }
  1215. }
  1216. function HelicopterHangar(count = 1) {
  1217. this.name = "Helicopter Hangar";
  1218. copy_defaults(this,new DefaultEntity());
  1219. this.count = count;
  1220. this.contents = initContents(this.name,this.count);
  1221. this.describeOne = function(verbose=true) {
  1222. var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0));
  1223. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1224. var name = random_desc(["hangar","hangar","hangar","helicopter hangar"], 1);
  1225. return merge_desc([size,color,name]);
  1226. };
  1227. this.describe = function(verbose=true) {
  1228. return defaultDescribe(verbose, this);
  1229. }
  1230. }
  1231. function LargeHangar(count = 1) {
  1232. this.name = "Large Hangar";
  1233. copy_defaults(this,new DefaultEntity());
  1234. this.count = count;
  1235. this.contents = initContents(this.name,this.count);
  1236. this.describeOne = function(verbose=true) {
  1237. var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0));
  1238. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1239. var name = random_desc(["hangar","hangar","hangar","large hangar","spacious hangar"], 1);
  1240. return merge_desc([size,color,name]);
  1241. };
  1242. this.describe = function(verbose=true) {
  1243. return defaultDescribe(verbose, this);
  1244. }
  1245. }
  1246. function SmallSkyscraper(count = 1) {
  1247. this.name = "Small Skyscraper";
  1248. copy_defaults(this,new DefaultEntity());
  1249. this.count = count;
  1250. this.contents = initContents(this.name,this.count);
  1251. this.describeOne = function(verbose=true) {
  1252. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  1253. var name = random_desc(["skyscraper","office tower","office building","high rise"], 1);
  1254. return merge_desc([color,name]);
  1255. };
  1256. this.describe = function(verbose=true) {
  1257. return defaultDescribe(verbose, this);
  1258. }
  1259. }
  1260. function LargeSkyscraper(count = 1) {
  1261. this.name = "Large Skyscraper";
  1262. copy_defaults(this,new DefaultEntity());
  1263. this.count = count;
  1264. this.contents = initContents(this.name,this.count);
  1265. this.describeOne = function(verbose=true) {
  1266. var color = random_desc(["blue","white","gray","tan","green","glass"], (verbose ? 0.5 : 0));
  1267. var name = random_desc(["skyscraper","office tower","office building"], 1);
  1268. return merge_desc(["towering",color,name]);
  1269. };
  1270. this.describe = function(verbose=true) {
  1271. return defaultDescribe(verbose, this);
  1272. }
  1273. }
  1274. function ParkingGarage(count = 1) {
  1275. this.name = "Parking Garage";
  1276. copy_defaults(this,new DefaultEntity());
  1277. this.count = count;
  1278. this.contents = initContents(this.name,this.count);
  1279. this.describe = function(verbose=true) {
  1280. return defaultDescribe(verbose, this);
  1281. }
  1282. }
  1283. function Ranch(count = 1) {
  1284. this.name = "Ranch";
  1285. copy_defaults(this,new DefaultEntity());
  1286. this.count = count;
  1287. this.contents = initContents(this.name,this.count);
  1288. this.describeOne = function(verbose=true) {
  1289. var size = random_desc(["little","large","prosperous","run-down"], (verbose ? 0.5 : 0));
  1290. var name = random_desc(["ranch","farm","ranch","dairy farm","cattle farm","ranch","farm"], 1);
  1291. return merge_desc([size,name]);
  1292. };
  1293. this.describe = function(verbose=true) {
  1294. return defaultDescribe(verbose, this);
  1295. }
  1296. }
  1297. function Airstrip(count = 1) {
  1298. this.name = "Airstrip";
  1299. copy_defaults(this,new DefaultEntity());
  1300. this.count = count;
  1301. this.contents = initContents(this.name,this.count);
  1302. this.describe = function(verbose=true) {
  1303. return defaultDescribe(verbose, this, "community");
  1304. }
  1305. }
  1306. function Airport(count = 1) {
  1307. this.name = "Airport";
  1308. copy_defaults(this,new DefaultEntity());
  1309. this.count = count;
  1310. this.contents = initContents(this.name,this.count);
  1311. this.describe = function(verbose=true) {
  1312. return defaultDescribe(verbose, this, "community");
  1313. }
  1314. }
  1315. function Town(count = 1) {
  1316. this.name = "Town";
  1317. copy_defaults(this,new DefaultEntity());
  1318. this.count = count;
  1319. this.contents = initContents(this.name,this.count);
  1320. this.describe = function(verbose=true) {
  1321. return defaultDescribe(verbose, this, "community");
  1322. }
  1323. }
  1324. function City(count = 1) {
  1325. this.name = "City";
  1326. copy_defaults(this,new DefaultEntity());
  1327. this.count = count;
  1328. this.contents = initContents(this.name,this.count);
  1329. this.describe = function(verbose=true) {
  1330. return defaultDescribe(verbose, this, "community");
  1331. }
  1332. }
  1333. function Continent(count = 1) {
  1334. this.name = "Continent";
  1335. copy_defaults(this,new DefaultEntity());
  1336. this.count = count;
  1337. this.contents = initContents(this.name,this.count);
  1338. this.describe = function(verbose=true) {
  1339. return defaultDescribe(verbose, this, "community");
  1340. }
  1341. }
  1342. function Planet(count = 1) {
  1343. this.name = "Planet";
  1344. copy_defaults(this,new DefaultEntity());
  1345. this.count = count;
  1346. this.contents = initContents(this.name,this.count);
  1347. this.describe = function(verbose=true) {
  1348. return defaultDescribe(verbose, this, "celestial");
  1349. }
  1350. }
  1351. function Star(count = 1) {
  1352. this.name = "Star";
  1353. copy_defaults(this,new DefaultEntity());
  1354. this.count = count;
  1355. this.contents = initContents(this.name,this.count);
  1356. this.describe = function(verbose = true) {
  1357. return (this.count == 1 ? "a star" : this.count + " stars");
  1358. };
  1359. }
  1360. function SolarSystem(count = 1) {
  1361. this.name = "Solar System";
  1362. copy_defaults(this,new DefaultEntity());
  1363. this.count = count;
  1364. this.contents = initContents(this.name,this.count);
  1365. this.describe = function(verbose=true) {
  1366. return defaultDescribe(verbose, this, "celestial");
  1367. }
  1368. }
  1369. function Galaxy(count = 1) {
  1370. this.name = "Galaxy";
  1371. copy_defaults(this,new DefaultEntity());
  1372. this.count = count;
  1373. this.contents = initContents(this.name,this.count);
  1374. this.describe = function(verbose=true) {
  1375. return defaultDescribe(verbose, this, "celestial");
  1376. }
  1377. }
  1378. function Cluster(count = 1) {
  1379. this.name = "Cluster";
  1380. copy_defaults(this,new DefaultEntity());
  1381. this.count = count;
  1382. this.contents = initContents(this.name,this.count);
  1383. this.describe = function(verbose=true) {
  1384. return defaultDescribe(verbose, this, "celestial");
  1385. }
  1386. }
  1387. function Universe(count = 1) {
  1388. this.name = "Universe";
  1389. copy_defaults(this,new DefaultEntity());
  1390. this.count = count;
  1391. this.contents = initContents(this.name,this.count);
  1392. this.describe = function(verbose=true) {
  1393. return defaultDescribe(verbose, this, "celestial");
  1394. }
  1395. }
  1396. function Multiverse(count = 1) {
  1397. this.name = "Multiverse";
  1398. copy_defaults(this,new DefaultEntity());
  1399. this.count = count;
  1400. this.contents = initContents(this.name,this.count);
  1401. this.describe = function(verbose=true) {
  1402. return defaultDescribe(verbose, this, "celestial");
  1403. }
  1404. }
  1405. function Soldier(count = 1) {
  1406. this.name = "Soldier";
  1407. copy_defaults(this,new DefaultEntity());
  1408. this.count = count;
  1409. this.contents = initContents(this.name,this.count);
  1410. this.describe = function(verbose=true) {
  1411. return defaultDescribe(verbose, this, "military");
  1412. }
  1413. }
  1414. function Tank(count = 1) {
  1415. this.name = "Tank";
  1416. copy_defaults(this,new DefaultEntity());
  1417. this.count = count;
  1418. this.contents = initContents(this.name,this.count);
  1419. this.describe = function(verbose=true) {
  1420. return defaultDescribe(verbose, this, "generic vehicle");
  1421. }
  1422. }
  1423. function Artillery(count = 1) {
  1424. this.name = "Artillery";
  1425. copy_defaults(this,new DefaultEntity());
  1426. this.count = count;
  1427. this.contents = initContents(this.name,this.count);
  1428. this.describe = function(verbose=true) {
  1429. return defaultDescribe(verbose, this, "generic vehicle");
  1430. }
  1431. }
  1432. function MilitaryHelicopter(count = 1) {
  1433. this.name = "Military Helicopter";
  1434. copy_defaults(this,new DefaultEntity());
  1435. this.count = count;
  1436. this.contents = initContents(this.name,this.count);
  1437. this.describe = function(verbose=true) {
  1438. return defaultDescribe(verbose, this, "generic vehicle");
  1439. }
  1440. }
  1441. function Micro(count = 1) {
  1442. this.name = "Micro";
  1443. copy_defaults(this,new DefaultEntity());
  1444. this.count = count;
  1445. this.contents = initContents(this.name,this.count);
  1446. this.describe = function(verbose=true) {
  1447. return defaultDescribe(verbose, this);
  1448. }
  1449. }
  1450. function Macro(count = 1) {
  1451. this.name = "Macro";
  1452. copy_defaults(this,new DefaultEntity());
  1453. this.count = count;
  1454. this.contents = initContents(this.name,this.count);
  1455. this.describe = function(verbose=true) {
  1456. return defaultDescribe(verbose, this);
  1457. }
  1458. }
  1459. function Squad(count = 1) {
  1460. this.name = "Squad";
  1461. copy_defaults(this,new DefaultEntity());
  1462. this.count = count;
  1463. this.contents = initContents(this.name,this.count);
  1464. this.describe = function(verbose=true) {
  1465. return defaultDescribe(verbose, this, "military");
  1466. }
  1467. }
  1468. function Platoon(count = 1) {
  1469. this.name = "Platoon";
  1470. copy_defaults(this,new DefaultEntity());
  1471. this.count = count;
  1472. this.contents = initContents(this.name,this.count);
  1473. this.describe = function(verbose=true) {
  1474. return defaultDescribe(verbose, this, "military");
  1475. }
  1476. }
  1477. function Company(count = 1) {
  1478. this.name = "Company";
  1479. copy_defaults(this,new DefaultEntity());
  1480. this.count = count;
  1481. this.contents = initContents(this.name,this.count);
  1482. this.describe = function(verbose=true) {
  1483. return defaultDescribe(verbose, this, "military");
  1484. }
  1485. }
  1486. function Battalion(count = 1) {
  1487. this.name = "Battalion";
  1488. copy_defaults(this,new DefaultEntity());
  1489. this.count = count;
  1490. this.contents = initContents(this.name,this.count);
  1491. this.describe = function(verbose=true) {
  1492. return defaultDescribe(verbose, this, "military");
  1493. }
  1494. }
  1495. function Brigade(count = 1) {
  1496. this.name = "Brigade";
  1497. copy_defaults(this,new DefaultEntity());
  1498. this.count = count;
  1499. this.contents = initContents(this.name,this.count);
  1500. this.describe = function(verbose=true) {
  1501. return defaultDescribe(verbose, this, "military");
  1502. }
  1503. }
  1504. function Division(count = 1) {
  1505. this.name = "Division";
  1506. copy_defaults(this,new DefaultEntity());
  1507. this.count = count;
  1508. this.contents = initContents(this.name,this.count);
  1509. this.describe = function(verbose=true) {
  1510. return defaultDescribe(verbose, this, "military");
  1511. }
  1512. }
  1513. function TankDivision(count = 1) {
  1514. this.name = "Tank Division";
  1515. copy_defaults(this,new DefaultEntity());
  1516. this.count = count;
  1517. this.contents = initContents(this.name,this.count);
  1518. this.describe = function(verbose=true) {
  1519. return defaultDescribe(verbose, this, "military");
  1520. }
  1521. }
  1522. function Army(count = 1) {
  1523. this.name = "Army";
  1524. copy_defaults(this,new DefaultEntity());
  1525. this.count = count;
  1526. this.contents = initContents(this.name,this.count);
  1527. this.describe = function(verbose=true) {
  1528. return defaultDescribe(verbose, this, "military");
  1529. }
  1530. }
  1531. //todo
  1532. //farms
  1533. //factories
  1534. //racetracks
  1535. //more building types
  1536. //cranes and other construction equipment
  1537. //nebula
  1538. //biome magic also set it so that you can't roll your existing biome
  1539. //chemical factory
  1540. //grand army
  1541. //armada