big steppy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1565 lines
42 KiB

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