big steppy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

1569 строки
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, 1000);
  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 == 0 && result.length == 0) {
  381. ++count;
  382. }
  383. else if (loopvar <= clusters[candidate.name]) {
  384. if (Math.random() < candidate.weight ? 1 : Math.random() < cluster_chances[candidate.name]) {
  385. ++count;
  386. }
  387. }
  388. else {
  389. count += Math.random() < candidate.weight ? 1 : 0;
  390. }
  391. ++loopvar;
  392. }
  393. // if we're doing more than the limit, then we just add on the rest, with some variance
  394. if (limit < max) {
  395. const base = (max-limit) * candidate.weight;
  396. count += Math.round(base - base / 10 + base * Math.random() / 5);
  397. }
  398. area -= count * candidate.area;
  399. if (count > 0)
  400. result.push(new things[candidate.name](count));
  401. }
  402. return new Container(result);
  403. }
  404. // describes everything in the container
  405. function describe_all(contents,verbose=true,except=[]) {
  406. var things = [];
  407. for (var key in contents) {
  408. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  409. things.push(contents[key].describe(verbose));
  410. }
  411. }
  412. return merge_things(things);
  413. }
  414. function random_desc(list, odds=1) {
  415. if (Math.random() < odds)
  416. return list[Math.floor(Math.random() * list.length)];
  417. else
  418. return "";
  419. }
  420. // combine strings into a list with proper grammar
  421. function merge_things(list,semicolons=false) {
  422. if (list.length == 0) {
  423. return "";
  424. } else if (list.length == 1) {
  425. return list[0];
  426. } else if (list.length == 2) {
  427. return list[0] + " and " + list[1];
  428. } else {
  429. var result = "";
  430. list.slice(0,list.length-1).forEach(function(term) {
  431. result += term + ", ";
  432. });
  433. result += "and " + list[list.length-1];
  434. return result;
  435. }
  436. }
  437. // combine the adjectives for something into a single string
  438. function merge_desc(list) {
  439. var result = "";
  440. list.forEach(function(term) {
  441. if (term != "")
  442. result += term + " ";
  443. });
  444. // knock off the last space
  445. if (result.length > 0) {
  446. result = result.substring(0, result.length - 1);
  447. }
  448. return result;
  449. }
  450. // maybe make this something that approximates a
  451. // normal distribution; doing this 15,000,000 times is bad...
  452. // solution: only a few are random lul
  453. // improvement: take up to 100 samples, then use that to scale the final result
  454. function distribution(min, max, samples) {
  455. var result = 0;
  456. var limit = Math.min(100,samples);
  457. if (limit < samples) {
  458. let dist = 0;
  459. for (let i = 0; i < limit; i++) {
  460. dist += Math.random();
  461. }
  462. dist /= 100;
  463. return Math.floor(dist * samples * (max - min + 1) + samples * min);
  464. } else {
  465. for (let i = 0; i < limit; i++) {
  466. result += Math.floor(Math.random() * (max - min + 1) + min);
  467. }
  468. }
  469. return result;
  470. }
  471. function defaultMultiply(thing) {
  472. return function(amount) {
  473. thing.count *= amount;
  474. for (var key in thing.contents) {
  475. if (thing.contents.hasOwnProperty(key)) {
  476. thing.contents[key].multiply(amount);
  477. }
  478. }
  479. };
  480. }
  481. function defaultArea(thing) {
  482. return areas[thing.name];
  483. }
  484. function defaultMass(thing) {
  485. return masses[thing.name];
  486. }
  487. function defaultMerge(thing) {
  488. return function(container) {
  489. var newCount = this.count + container.count;
  490. var newThing = new things[thing.name](newCount);
  491. newThing.contents = {};
  492. for (var key in this.contents) {
  493. if (this.contents.hasOwnProperty(key)) {
  494. newThing.contents[key] = this.contents[key];
  495. }
  496. }
  497. for (key in container.contents) {
  498. if (container.contents.hasOwnProperty(key)) {
  499. if (this.contents.hasOwnProperty(key)) {
  500. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  501. } else {
  502. newThing.contents[key] = container.contents[key];
  503. }
  504. }
  505. }
  506. return newThing;
  507. };
  508. }
  509. function listSum(sum) {
  510. let result = [];
  511. for (let key in sum) {
  512. if (sum.hasOwnProperty(key)) {
  513. result.push(new things[key](sum[key]).describe(false));
  514. }
  515. }
  516. return merge_things(result);
  517. }
  518. // turn a nested object into a container with everything on one level
  519. function flatten(thing) {
  520. let dict = defaultSum(thing)();
  521. let list = [];
  522. Object.entries(dict).forEach(function([key, val]) {
  523. let obj = new things[key](val);
  524. obj.contents = [];
  525. list.push(obj);
  526. });
  527. list.sort(function(x,y) {
  528. if (y.area != x.area){
  529. return y.area - x.area;
  530. } else {
  531. return x.name.localeCompare(y.name);
  532. }
  533. });
  534. return new Container(list);
  535. }
  536. function defaultSum(thing) {
  537. return function() {
  538. var counts = {};
  539. if (thing.name != "Container")
  540. counts[thing.name] = thing.count;
  541. for (var key in thing.contents) {
  542. if (thing.contents.hasOwnProperty(key)) {
  543. var subcount = thing.contents[key].sum();
  544. for (var subkey in subcount) {
  545. if (!counts.hasOwnProperty(subkey)) {
  546. counts[subkey] = 0;
  547. }
  548. counts[subkey] += subcount[subkey];
  549. }
  550. }
  551. }
  552. return counts;
  553. };
  554. }
  555. function defaultSumProperty(thing) {
  556. return function(prop) {
  557. var total = 0;
  558. total += thing[prop] * thing.count;
  559. for (var key in thing.contents) {
  560. if (thing.contents.hasOwnProperty(key)) {
  561. total += thing.contents[key].sum_property(prop);
  562. }
  563. }
  564. return total;
  565. };
  566. }
  567. function defaultAddContent(thing) {
  568. return function(name, min, max, count) {
  569. if (min == max) {
  570. let object = new things[name](min*count);
  571. thing.contents[object.name] = object;
  572. } else {
  573. let object = new things[name](distribution(min, max, count));
  574. thing.contents[object.name] = object;
  575. }
  576. };
  577. }
  578. function defaultDescribeSimple(thing) {
  579. return function(flat) {
  580. if (flat) {
  581. return flatten(thing).describe(false)
  582. } else {
  583. return thing.describe(false);
  584. }
  585. }
  586. }
  587. function DefaultEntity() {
  588. this.sum = defaultSum;
  589. this.area = defaultArea;
  590. this.mass = defaultMass;
  591. this.sum_property = defaultSumProperty;
  592. this.merge = defaultMerge;
  593. this.multiply = defaultMultiply;
  594. this.describeSimple = defaultDescribeSimple;
  595. return this;
  596. }
  597. // god I love reinventing the wheel
  598. function copy_defaults(self,proto) {
  599. for (var key in proto) {
  600. if (proto.hasOwnProperty(key)) {
  601. self[key] = proto[key](self);
  602. }
  603. }
  604. }
  605. function Container(contents = []) {
  606. this.name = "Container";
  607. copy_defaults(this,new DefaultEntity());
  608. if (Number.isInteger(contents))
  609. this.count = contents;
  610. else
  611. this.count = 0;
  612. this.contents = {};
  613. for (var i=0; i < contents.length; i++) {
  614. this.contents[contents[i].name] = contents[i];
  615. }
  616. for (var key in this.contents) {
  617. if (this.contents.hasOwnProperty(key)) {
  618. this.count += this.contents[key].count;
  619. }
  620. }
  621. this.describe = function(verbose = true) {
  622. return describe_all(this.contents,verbose);
  623. };
  624. return this;
  625. }
  626. function Person(count = 1) {
  627. this.name = "Person";
  628. copy_defaults(this,new DefaultEntity());
  629. this.count = count;
  630. this.contents = initContents(this.name,this.count);
  631. this.describeOne = function (verbose=true) {
  632. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","multi-colored"], (verbose ? 0.6 : 0));
  633. var sex = random_desc(["male", "female"], (verbose ? 0.75 : 0));
  634. var species = "";
  635. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal","coyote","rabbit","lizard","avian"]);
  636. return "a " + merge_desc([body,sex,species]);
  637. };
  638. this.describe = function(verbose=true) {
  639. if (verbose) {
  640. if (count <= 3) {
  641. var list = [];
  642. for (var i = 0; i < count; i++) {
  643. list.push(this.describeOne(this.count <= 2));
  644. }
  645. return merge_things(list);
  646. } else {
  647. return this.count + " people";
  648. }
  649. } else {
  650. return (this.count > 1 ? this.count + " people" : "a person");
  651. }
  652. };
  653. return this;
  654. }
  655. function Human(count = 1) {
  656. this.name = "Person";
  657. copy_defaults(this,new DefaultEntity());
  658. this.count = count;
  659. this.contents = initContents(this.name,this.count);
  660. this.describeOne = function (verbose=true) {
  661. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","tanned"], (verbose ? 0.6 : 0));
  662. var sex = random_desc(["man", "woman"], 1);
  663. return "a " + merge_desc([body,sex]);
  664. };
  665. this.describe = function(verbose=true) {
  666. if (verbose) {
  667. if (count <= 3) {
  668. var list = [];
  669. for (var i = 0; i < count; i++) {
  670. list.push(this.describeOne(this.count <= 2));
  671. }
  672. return merge_things(list);
  673. } else {
  674. return this.count + " people";
  675. }
  676. } else {
  677. return (this.count > 1 ? this.count + " people" : "a person");
  678. }
  679. };
  680. return this;
  681. }
  682. function Cow(count = 1) {
  683. this.name = "Cow";
  684. copy_defaults(this,new DefaultEntity());
  685. this.count = count;
  686. this.contents = initContents(this.name,this.count);
  687. this.describeOne = function (verbose=true) {
  688. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  689. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  690. return "a " + merge_desc([body,sex,"cow"]);
  691. };
  692. this.describe = function(verbose=true) {
  693. if (verbose) {
  694. if (count <= 3) {
  695. var list = [];
  696. for (var i = 0; i < count; i++) {
  697. list.push(this.describeOne(this.count <= 2));
  698. }
  699. return merge_things(list);
  700. } else {
  701. return this.count + " cattle";
  702. }
  703. } else {
  704. return (this.count > 1 ? this.count + " cattle" : "a cow");
  705. }
  706. };
  707. return this;
  708. }
  709. function EmptyCar(count = 1) {
  710. this.name = "Car";
  711. copy_defaults(this,new DefaultEntity());
  712. this.count = count;
  713. this.contents = initContents(this.name,this.count);
  714. this.describeOne = function(verbose=true) {
  715. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  716. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"],0.3);
  717. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  718. return "a parked " + merge_desc([adjective,color,type]);
  719. };
  720. this.describe = function(verbose = true) {
  721. if (verbose) {
  722. if (this.count <= 3) {
  723. var list = [];
  724. for (var i = 0; i < this.count; i++) {
  725. list.push(this.describeOne());
  726. }
  727. return merge_things(list);
  728. } else {
  729. return this.count + " parked cars";
  730. }
  731. } else {
  732. return (this.count > 1 ? this.count + " parked cars" : "a parked car");
  733. }
  734. };
  735. }
  736. function Car(count = 1) {
  737. this.name = "Car";
  738. copy_defaults(this,new DefaultEntity());
  739. this.count = count;
  740. this.contents = initContents(this.name,this.count);
  741. this.describeOne = function(verbose=true) {
  742. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  743. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"], (verbose ? 0.3 : 0));
  744. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  745. return "a " + merge_desc([adjective,color,type]);
  746. };
  747. this.describe = function(verbose = true) {
  748. if (verbose) {
  749. if (this.count <= 3) {
  750. var list = [];
  751. for (var i = 0; i < this.count; i++) {
  752. list.push(this.describeOne(this.count < 2));
  753. }
  754. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  755. } else {
  756. return this.count + " cars with " + describe_all(this.contents,verbose) + " inside";
  757. }
  758. } else {
  759. return (this.count > 1 ? this.count + " cars" : "a car");
  760. }
  761. };
  762. }
  763. function Bus(count = 1) {
  764. this.name = "Bus";
  765. copy_defaults(this,new DefaultEntity());
  766. this.count = count;
  767. this.contents = initContents(this.name,this.count);
  768. this.describeOne = function(verbose=true) {
  769. var adjective = random_desc(["rusty","brand-new","aging","modern"], (verbose ? 0.3 : 0));
  770. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  771. var type = random_desc(["bus","double-decker bus","articulating bus","open-top bus","sleeper bus","intercity bus"]);
  772. return "a " + merge_desc([adjective,color,type]);
  773. };
  774. this.describe = function(verbose = true) {
  775. if (verbose) {
  776. if (this.count <= 3) {
  777. var list = [];
  778. for (var i = 0; i < this.count; i++) {
  779. list.push(this.describeOne(this.count < 2));
  780. }
  781. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  782. } else {
  783. return this.count + " buses with " + describe_all(this.contents,verbose) + " inside";
  784. }
  785. } else {
  786. return (this.count > 1 ? this.count + " buses" : "a bus");
  787. }
  788. };
  789. }
  790. function Tram(count = 1) {
  791. this.name = "Tram";
  792. copy_defaults(this,new DefaultEntity());
  793. this.count = count;
  794. this.contents = initContents(this.name,this.count);
  795. this.describeOne = function(verbose=true) {
  796. var adjective = random_desc(["rusty","weathered","well-maintained",], (verbose ? 0.3 : 0));
  797. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  798. var type = random_desc(["tram"]);
  799. return "a " + merge_desc([adjective,color,type]);
  800. };
  801. this.describe = function(verbose = true) {
  802. if (verbose) {
  803. if (this.count == 1) {
  804. var list = [];
  805. for (var i = 0; i < this.count; i++) {
  806. list.push(this.describeOne(verbose));
  807. }
  808. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  809. } else {
  810. return this.count + " trams with " + describe_all(this.contents,verbose) + " inside";
  811. }
  812. } else {
  813. return (this.count > 1 ? this.count + " trams" : "a tram");
  814. }
  815. };
  816. this.anal_vore = function() {
  817. return "You slide " + this.describe() + " up your tight ass";
  818. };
  819. }
  820. function Train(count = 1) {
  821. this.name = "Train";
  822. copy_defaults(this,new DefaultEntity());
  823. this.count = count;
  824. this.contents = initContents(this.name,this.count);
  825. this.describeOne = function(verbose=true) {
  826. var adjective = random_desc(["rusty","brand-new","steam","freshly-painted"], (verbose ? 0.3 : 0));
  827. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  828. var type = random_desc(["train","passenger train","freight train"]);
  829. return "a " + merge_desc([adjective,color,type]);
  830. };
  831. this.describe = function(verbose = true) {
  832. if (verbose) {
  833. if (this.count == 1) {
  834. var list = [];
  835. for (var i = 0; i < this.count; i++) {
  836. list.push(this.describeOne(verbose));
  837. }
  838. return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  839. } else {
  840. return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  841. }
  842. } else {
  843. return (this.count > 1 ? this.count + " trains" : "a train");
  844. }
  845. };
  846. this.anal_vore = function() {
  847. 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");
  848. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  849. };
  850. }
  851. function TrainCar(count = 1) {
  852. this.name = "Train Car";
  853. copy_defaults(this,new DefaultEntity());
  854. this.count = count;
  855. this.contents = initContents(this.name,this.count);
  856. this.describeOne = function(verbose=true) {
  857. var adjective = random_desc(["rusty","brand-new","vintage","graffitied","well-maintained"], (verbose ? 0.3 : 0));
  858. var color = random_desc(["black","tan","gray","yellow","steel","wooden"], (verbose ? 1 : 0));
  859. var type = random_desc(["train car","passenger train car","freight train car"]);
  860. return "a " + merge_desc([adjective,color,type]);
  861. };
  862. this.describe = function(verbose = true) {
  863. if (verbose) {
  864. return (this.count > 1 ? this.count + " train cars" : "a train car") + " with " + describe_all(this.contents) + " inside";
  865. } else {
  866. return (this.count > 1 ? this.count + " train cars" : "a train car");
  867. }
  868. };
  869. }
  870. function House(count = 1) {
  871. this.name = "House";
  872. copy_defaults(this,new DefaultEntity());
  873. this.count = count;
  874. this.contents = initContents(this.name,this.count);
  875. this.describeOne = function(verbose=true) {
  876. var size = random_desc(["little","two-story","large","well-built","run-down","cheap",], (verbose ? 0.5 : 0));
  877. var color = random_desc(["blue","white","gray","tan","green","wooden","brick"], (verbose ? 0.5 : 0));
  878. var name = random_desc(["house","home","house","house","house","trailer"], 1);
  879. return "a " + merge_desc([size,color,name]);
  880. };
  881. this.describe = function(verbose = true) {
  882. if (verbose) {
  883. if (this.count <= 3) {
  884. var list = [];
  885. for (var i = 0; i < this.count; i++) {
  886. list.push(this.describeOne(this.count < 2));
  887. }
  888. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  889. } else {
  890. return this.count + " homes with " + describe_all(this.contents,verbose) + " inside";
  891. }
  892. } else {
  893. return (this.count > 1 ? this.count + " houses" : "a house");
  894. }
  895. };
  896. }
  897. //might split this into a general business and resutrant categories
  898. function Business(count = 1) {
  899. this.name = "Business";
  900. copy_defaults(this,new DefaultEntity());
  901. this.count = count;
  902. this.contents = initContents(this.name,this.count);
  903. this.describeOne = function(verbose=true) {
  904. var size = random_desc(["little","two-story","large","well-built","run-down","cheap","aging","corner"], (verbose ? 0.5 : 0));
  905. var color = random_desc(["blue","white","gray","tan","green","brick","concrete"], (verbose ? 0.5 : 0));
  906. 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);
  907. return "a " + merge_desc([size,color,name]);
  908. };
  909. this.describe = function(verbose = true) {
  910. if (verbose) {
  911. if (this.count <= 3) {
  912. var list = [];
  913. for (var i = 0; i < this.count; i++) {
  914. list.push(this.describeOne(this.count < 2));
  915. }
  916. return merge_things(list) + " with " + describe_all(this.contents,verbose);
  917. } else {
  918. return this.count + " local business containing " + describe_all(this.contents,verbose);
  919. }
  920. } else {
  921. return (this.count > 1 ? this.count + " buildings" : "a local business");
  922. }
  923. };
  924. }
  925. function Barn(count = 1) {
  926. this.name = "Barn";
  927. copy_defaults(this,new DefaultEntity());
  928. this.count = count;
  929. this.contents = initContents(this.name,this.count);
  930. this.describeOne = function(verbose=true) {
  931. var size = random_desc(["little","big","large","weathered","rotted","new"], (verbose ? 0.5 : 0));
  932. var color = random_desc(["blue","white","gray","tan","green","red"], (verbose ? 0.5 : 0));
  933. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  934. return "a " + merge_desc([size,color,name]);
  935. };
  936. this.describe = function(verbose = true) {
  937. if (verbose) {
  938. if (this.count <= 3) {
  939. var list = [];
  940. for (var i = 0; i < this.count; i++) {
  941. list.push(this.describeOne(this.count < 2));
  942. }
  943. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  944. } else {
  945. return this.count + " barns with " + describe_all(this.contents,verbose) + " inside";
  946. }
  947. } else {
  948. return (this.count > 1 ? this.count + " barns" : "a barn");
  949. }
  950. };
  951. }
  952. function SmallSkyscraper(count = 1) {
  953. this.name = "Small Skyscraper";
  954. copy_defaults(this,new DefaultEntity());
  955. this.count = count;
  956. this.contents = initContents(this.name,this.count);
  957. this.describeOne = function(verbose=true) {
  958. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  959. var name = random_desc(["skyscraper","office tower","office building","high rise"], 1);
  960. return "a " + merge_desc([color,name]);
  961. };
  962. this.describe = function(verbose = true) {
  963. if (verbose) {
  964. if (this.count <= 3) {
  965. var list = [];
  966. for (var i = 0; i < this.count; i++) {
  967. list.push(this.describeOne(this.count < 2));
  968. }
  969. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  970. } else {
  971. return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  972. }
  973. } else {
  974. return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper");
  975. }
  976. };
  977. }
  978. function LargeSkyscraper(count = 1) {
  979. this.name = "Large Skyscraper";
  980. copy_defaults(this,new DefaultEntity());
  981. this.count = count;
  982. this.contents = initContents(this.name,this.count);
  983. this.describeOne = function(verbose=true) {
  984. var color = random_desc(["blue","white","gray","tan","green","glass"], (verbose ? 0.5 : 0));
  985. var name = random_desc(["skyscraper","office tower","office building"], 1);
  986. return "a " + merge_desc(["towering",color,name]);
  987. };
  988. this.describe = function(verbose = true) {
  989. if (verbose) {
  990. if (this.count <= 3) {
  991. var list = [];
  992. for (var i = 0; i < this.count; i++) {
  993. list.push(this.describeOne(this.count < 2));
  994. }
  995. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  996. } else {
  997. return this.count + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  998. }
  999. } else {
  1000. return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper");
  1001. }
  1002. };
  1003. }
  1004. function ParkingGarage(count = 1) {
  1005. this.name = "Parking Garage";
  1006. copy_defaults(this,new DefaultEntity());
  1007. this.count = count;
  1008. this.contents = initContents(this.name,this.count);
  1009. this.describeOne = function(verbose=true) {
  1010. return "a parking garage";
  1011. };
  1012. this.describe = function(verbose = true) {
  1013. if (verbose) {
  1014. return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose);
  1015. } else {
  1016. return (this.count == 1 ? "a parking garage" : this.count + " parking garages");
  1017. }
  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 (this.count == 1 ? "a micro" : this.count + " micros");
  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 (this.count == 1 ? "a smaller macro" : this.count + " smaller macros");
  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. }