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

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