big steppy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

1565 líneas
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 <= clusters[candidate.name]) {
  381. if (Math.random() < candidate.weight ? 1 : Math.random() < cluster_chances[candidate.name]) {
  382. ++count;
  383. }
  384. }
  385. else {
  386. count += Math.random() < candidate.weight ? 1 : 0;
  387. }
  388. ++loopvar;
  389. }
  390. // if we're doing more than 100 victims, then we randomly
  391. if (limit < max) {
  392. count += Math.round((max/limit) * candidate.weight);
  393. }
  394. area -= count * candidate.area;
  395. if (count > 0)
  396. result.push(new things[candidate.name](count));
  397. }
  398. return new Container(result);
  399. }
  400. // describes everything in the container
  401. function describe_all(contents,verbose=true,except=[]) {
  402. var things = [];
  403. for (var key in contents) {
  404. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  405. things.push(contents[key].describe(verbose));
  406. }
  407. }
  408. return merge_things(things);
  409. }
  410. function random_desc(list, odds=1) {
  411. if (Math.random() < odds)
  412. return list[Math.floor(Math.random() * list.length)];
  413. else
  414. return "";
  415. }
  416. // combine strings into a list with proper grammar
  417. function merge_things(list,semicolons=false) {
  418. if (list.length == 0) {
  419. return "";
  420. } else if (list.length == 1) {
  421. return list[0];
  422. } else if (list.length == 2) {
  423. return list[0] + " and " + list[1];
  424. } else {
  425. var result = "";
  426. list.slice(0,list.length-1).forEach(function(term) {
  427. result += term + ", ";
  428. });
  429. result += "and " + list[list.length-1];
  430. return result;
  431. }
  432. }
  433. // combine the adjectives for something into a single string
  434. function merge_desc(list) {
  435. var result = "";
  436. list.forEach(function(term) {
  437. if (term != "")
  438. result += term + " ";
  439. });
  440. // knock off the last space
  441. if (result.length > 0) {
  442. result = result.substring(0, result.length - 1);
  443. }
  444. return result;
  445. }
  446. // maybe make this something that approximates a
  447. // normal distribution; doing this 15,000,000 times is bad...
  448. // solution: only a few are random lul
  449. // improvement: take up to 100 samples, then use that to scale the final result
  450. function distribution(min, max, samples) {
  451. var result = 0;
  452. var limit = Math.min(100,samples);
  453. if (limit < samples) {
  454. let dist = 0;
  455. for (let i = 0; i < limit; i++) {
  456. dist += Math.random();
  457. }
  458. dist /= 100;
  459. return Math.floor(dist * samples * (max - min + 1) + samples * min);
  460. } else {
  461. for (let i = 0; i < limit; i++) {
  462. result += Math.floor(Math.random() * (max - min + 1) + min);
  463. }
  464. }
  465. return result;
  466. }
  467. function defaultMultiply(thing) {
  468. return function(amount) {
  469. thing.count *= amount;
  470. for (var key in thing.contents) {
  471. if (thing.contents.hasOwnProperty(key)) {
  472. thing.contents[key].multiply(amount);
  473. }
  474. }
  475. };
  476. }
  477. function defaultArea(thing) {
  478. return areas[thing.name];
  479. }
  480. function defaultMass(thing) {
  481. return masses[thing.name];
  482. }
  483. function defaultMerge(thing) {
  484. return function(container) {
  485. var newCount = this.count + container.count;
  486. var newThing = new things[thing.name](newCount);
  487. newThing.contents = {};
  488. for (var key in this.contents) {
  489. if (this.contents.hasOwnProperty(key)) {
  490. newThing.contents[key] = this.contents[key];
  491. }
  492. }
  493. for (key in container.contents) {
  494. if (container.contents.hasOwnProperty(key)) {
  495. if (this.contents.hasOwnProperty(key)) {
  496. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  497. } else {
  498. newThing.contents[key] = container.contents[key];
  499. }
  500. }
  501. }
  502. return newThing;
  503. };
  504. }
  505. function listSum(sum) {
  506. let result = [];
  507. for (let key in sum) {
  508. if (sum.hasOwnProperty(key)) {
  509. result.push(new things[key](sum[key]).describe(false));
  510. }
  511. }
  512. return merge_things(result);
  513. }
  514. // turn a nested object into a container with everything on one level
  515. function flatten(thing) {
  516. let dict = defaultSum(thing)();
  517. let list = [];
  518. Object.entries(dict).forEach(function([key, val]) {
  519. let obj = new things[key](val);
  520. obj.contents = [];
  521. list.push(obj);
  522. });
  523. list.sort(function(x,y) {
  524. if (y.area != x.area){
  525. return y.area - x.area;
  526. } else {
  527. return x.name.localeCompare(y.name);
  528. }
  529. });
  530. return new Container(list);
  531. }
  532. function defaultSum(thing) {
  533. return function() {
  534. var counts = {};
  535. if (thing.name != "Container")
  536. counts[thing.name] = thing.count;
  537. for (var key in thing.contents) {
  538. if (thing.contents.hasOwnProperty(key)) {
  539. var subcount = thing.contents[key].sum();
  540. for (var subkey in subcount) {
  541. if (!counts.hasOwnProperty(subkey)) {
  542. counts[subkey] = 0;
  543. }
  544. counts[subkey] += subcount[subkey];
  545. }
  546. }
  547. }
  548. return counts;
  549. };
  550. }
  551. function defaultSumProperty(thing) {
  552. return function(prop) {
  553. var total = 0;
  554. total += thing[prop] * thing.count;
  555. for (var key in thing.contents) {
  556. if (thing.contents.hasOwnProperty(key)) {
  557. total += thing.contents[key].sum_property(prop);
  558. }
  559. }
  560. return total;
  561. };
  562. }
  563. function defaultAddContent(thing) {
  564. return function(name, min, max, count) {
  565. if (min == max) {
  566. let object = new things[name](min*count);
  567. thing.contents[object.name] = object;
  568. } else {
  569. let object = new things[name](distribution(min, max, count));
  570. thing.contents[object.name] = object;
  571. }
  572. };
  573. }
  574. function defaultDescribeSimple(thing) {
  575. return function(flat) {
  576. if (flat) {
  577. return flatten(thing).describe(false)
  578. } else {
  579. return thing.describe(false);
  580. }
  581. }
  582. }
  583. function DefaultEntity() {
  584. this.sum = defaultSum;
  585. this.area = defaultArea;
  586. this.mass = defaultMass;
  587. this.sum_property = defaultSumProperty;
  588. this.merge = defaultMerge;
  589. this.multiply = defaultMultiply;
  590. this.describeSimple = defaultDescribeSimple;
  591. return this;
  592. }
  593. // god I love reinventing the wheel
  594. function copy_defaults(self,proto) {
  595. for (var key in proto) {
  596. if (proto.hasOwnProperty(key)) {
  597. self[key] = proto[key](self);
  598. }
  599. }
  600. }
  601. function Container(contents = []) {
  602. this.name = "Container";
  603. copy_defaults(this,new DefaultEntity());
  604. if (Number.isInteger(contents))
  605. this.count = contents;
  606. else
  607. this.count = 0;
  608. this.contents = {};
  609. for (var i=0; i < contents.length; i++) {
  610. this.contents[contents[i].name] = contents[i];
  611. }
  612. for (var key in this.contents) {
  613. if (this.contents.hasOwnProperty(key)) {
  614. this.count += this.contents[key].count;
  615. }
  616. }
  617. this.describe = function(verbose = true) {
  618. return describe_all(this.contents,verbose);
  619. };
  620. return this;
  621. }
  622. function Person(count = 1) {
  623. this.name = "Person";
  624. copy_defaults(this,new DefaultEntity());
  625. this.count = count;
  626. this.contents = initContents(this.name,this.count);
  627. this.describeOne = function (verbose=true) {
  628. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","multi-colored"], (verbose ? 0.6 : 0));
  629. var sex = random_desc(["male", "female"], (verbose ? 0.75 : 0));
  630. var species = "";
  631. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal","coyote","rabbit","lizard","avian"]);
  632. return "a " + merge_desc([body,sex,species]);
  633. };
  634. this.describe = function(verbose=true) {
  635. if (verbose) {
  636. if (count <= 3) {
  637. var list = [];
  638. for (var i = 0; i < count; i++) {
  639. list.push(this.describeOne(this.count <= 2));
  640. }
  641. return merge_things(list);
  642. } else {
  643. return this.count + " people";
  644. }
  645. } else {
  646. return (this.count > 1 ? this.count + " people" : "a person");
  647. }
  648. };
  649. return this;
  650. }
  651. function Human(count = 1) {
  652. this.name = "Person";
  653. copy_defaults(this,new DefaultEntity());
  654. this.count = count;
  655. this.contents = initContents(this.name,this.count);
  656. this.describeOne = function (verbose=true) {
  657. var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","tanned"], (verbose ? 0.6 : 0));
  658. var sex = random_desc(["man", "woman"], 1);
  659. return "a " + merge_desc([body,sex]);
  660. };
  661. this.describe = function(verbose=true) {
  662. if (verbose) {
  663. if (count <= 3) {
  664. var list = [];
  665. for (var i = 0; i < count; i++) {
  666. list.push(this.describeOne(this.count <= 2));
  667. }
  668. return merge_things(list);
  669. } else {
  670. return this.count + " people";
  671. }
  672. } else {
  673. return (this.count > 1 ? this.count + " people" : "a person");
  674. }
  675. };
  676. return this;
  677. }
  678. function Cow(count = 1) {
  679. this.name = "Cow";
  680. copy_defaults(this,new DefaultEntity());
  681. this.count = count;
  682. this.contents = initContents(this.name,this.count);
  683. this.describeOne = function (verbose=true) {
  684. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  685. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  686. return "a " + merge_desc([body,sex,"cow"]);
  687. };
  688. this.describe = function(verbose=true) {
  689. if (verbose) {
  690. if (count <= 3) {
  691. var list = [];
  692. for (var i = 0; i < count; i++) {
  693. list.push(this.describeOne(this.count <= 2));
  694. }
  695. return merge_things(list);
  696. } else {
  697. return this.count + " cattle";
  698. }
  699. } else {
  700. return (this.count > 1 ? this.count + " cattle" : "a cow");
  701. }
  702. };
  703. return this;
  704. }
  705. function EmptyCar(count = 1) {
  706. this.name = "Car";
  707. copy_defaults(this,new DefaultEntity());
  708. this.count = count;
  709. this.contents = initContents(this.name,this.count);
  710. this.describeOne = function(verbose=true) {
  711. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  712. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"],0.3);
  713. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  714. return "a parked " + merge_desc([adjective,color,type]);
  715. };
  716. this.describe = function(verbose = true) {
  717. if (verbose) {
  718. if (this.count <= 3) {
  719. var list = [];
  720. for (var i = 0; i < this.count; i++) {
  721. list.push(this.describeOne());
  722. }
  723. return merge_things(list);
  724. } else {
  725. return this.count + " parked cars";
  726. }
  727. } else {
  728. return (this.count > 1 ? this.count + " parked cars" : "a parked car");
  729. }
  730. };
  731. }
  732. function Car(count = 1) {
  733. this.name = "Car";
  734. copy_defaults(this,new DefaultEntity());
  735. this.count = count;
  736. this.contents = initContents(this.name,this.count);
  737. this.describeOne = function(verbose=true) {
  738. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  739. var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"], (verbose ? 0.3 : 0));
  740. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  741. return "a " + merge_desc([adjective,color,type]);
  742. };
  743. this.describe = function(verbose = true) {
  744. if (verbose) {
  745. if (this.count <= 3) {
  746. var list = [];
  747. for (var i = 0; i < this.count; i++) {
  748. list.push(this.describeOne(this.count < 2));
  749. }
  750. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  751. } else {
  752. return this.count + " cars with " + describe_all(this.contents,verbose) + " inside";
  753. }
  754. } else {
  755. return (this.count > 1 ? this.count + " cars" : "a car");
  756. }
  757. };
  758. }
  759. function Bus(count = 1) {
  760. this.name = "Bus";
  761. copy_defaults(this,new DefaultEntity());
  762. this.count = count;
  763. this.contents = initContents(this.name,this.count);
  764. this.describeOne = function(verbose=true) {
  765. var adjective = random_desc(["rusty","brand-new","aging","modern"], (verbose ? 0.3 : 0));
  766. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  767. var type = random_desc(["bus","double-decker bus","articulating bus","open-top bus","sleeper bus","intercity bus"]);
  768. return "a " + merge_desc([adjective,color,type]);
  769. };
  770. this.describe = function(verbose = true) {
  771. if (verbose) {
  772. if (this.count <= 3) {
  773. var list = [];
  774. for (var i = 0; i < this.count; i++) {
  775. list.push(this.describeOne(this.count < 2));
  776. }
  777. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  778. } else {
  779. return this.count + " buses with " + describe_all(this.contents,verbose) + " inside";
  780. }
  781. } else {
  782. return (this.count > 1 ? this.count + " buses" : "a bus");
  783. }
  784. };
  785. }
  786. function Tram(count = 1) {
  787. this.name = "Tram";
  788. copy_defaults(this,new DefaultEntity());
  789. this.count = count;
  790. this.contents = initContents(this.name,this.count);
  791. this.describeOne = function(verbose=true) {
  792. var adjective = random_desc(["rusty","weathered","well-maintained",], (verbose ? 0.3 : 0));
  793. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  794. var type = random_desc(["tram"]);
  795. return "a " + merge_desc([adjective,color,type]);
  796. };
  797. this.describe = function(verbose = true) {
  798. if (verbose) {
  799. if (this.count == 1) {
  800. var list = [];
  801. for (var i = 0; i < this.count; i++) {
  802. list.push(this.describeOne(verbose));
  803. }
  804. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  805. } else {
  806. return this.count + " trams with " + describe_all(this.contents,verbose) + " inside";
  807. }
  808. } else {
  809. return (this.count > 1 ? this.count + " trams" : "a tram");
  810. }
  811. };
  812. this.anal_vore = function() {
  813. return "You slide " + this.describe() + " up your tight ass";
  814. };
  815. }
  816. function Train(count = 1) {
  817. this.name = "Train";
  818. copy_defaults(this,new DefaultEntity());
  819. this.count = count;
  820. this.contents = initContents(this.name,this.count);
  821. this.describeOne = function(verbose=true) {
  822. var adjective = random_desc(["rusty","brand-new","steam","freshly-painted"], (verbose ? 0.3 : 0));
  823. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  824. var type = random_desc(["train","passenger train","freight train"]);
  825. return "a " + merge_desc([adjective,color,type]);
  826. };
  827. this.describe = function(verbose = true) {
  828. if (verbose) {
  829. if (this.count == 1) {
  830. var list = [];
  831. for (var i = 0; i < this.count; i++) {
  832. list.push(this.describeOne(verbose));
  833. }
  834. return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  835. } else {
  836. return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  837. }
  838. } else {
  839. return (this.count > 1 ? this.count + " trains" : "a train");
  840. }
  841. };
  842. this.anal_vore = function() {
  843. 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");
  844. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  845. };
  846. }
  847. function TrainCar(count = 1) {
  848. this.name = "Train Car";
  849. copy_defaults(this,new DefaultEntity());
  850. this.count = count;
  851. this.contents = initContents(this.name,this.count);
  852. this.describeOne = function(verbose=true) {
  853. var adjective = random_desc(["rusty","brand-new","vintage","graffitied","well-maintained"], (verbose ? 0.3 : 0));
  854. var color = random_desc(["black","tan","gray","yellow","steel","wooden"], (verbose ? 1 : 0));
  855. var type = random_desc(["train car","passenger train car","freight train car"]);
  856. return "a " + merge_desc([adjective,color,type]);
  857. };
  858. this.describe = function(verbose = true) {
  859. if (verbose) {
  860. return (this.count > 1 ? this.count + " train cars" : "a train car") + " with " + describe_all(this.contents) + " inside";
  861. } else {
  862. return (this.count > 1 ? this.count + " train cars" : "a train car");
  863. }
  864. };
  865. }
  866. function House(count = 1) {
  867. this.name = "House";
  868. copy_defaults(this,new DefaultEntity());
  869. this.count = count;
  870. this.contents = initContents(this.name,this.count);
  871. this.describeOne = function(verbose=true) {
  872. var size = random_desc(["little","two-story","large","well-built","run-down","cheap",], (verbose ? 0.5 : 0));
  873. var color = random_desc(["blue","white","gray","tan","green","wooden","brick"], (verbose ? 0.5 : 0));
  874. var name = random_desc(["house","home","house","house","house","trailer"], 1);
  875. return "a " + merge_desc([size,color,name]);
  876. };
  877. this.describe = function(verbose = true) {
  878. if (verbose) {
  879. if (this.count <= 3) {
  880. var list = [];
  881. for (var i = 0; i < this.count; i++) {
  882. list.push(this.describeOne(this.count < 2));
  883. }
  884. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  885. } else {
  886. return this.count + " homes with " + describe_all(this.contents,verbose) + " inside";
  887. }
  888. } else {
  889. return (this.count > 1 ? this.count + " houses" : "a house");
  890. }
  891. };
  892. }
  893. //might split this into a general business and resutrant categories
  894. function Business(count = 1) {
  895. this.name = "Business";
  896. copy_defaults(this,new DefaultEntity());
  897. this.count = count;
  898. this.contents = initContents(this.name,this.count);
  899. this.describeOne = function(verbose=true) {
  900. var size = random_desc(["little","two-story","large","well-built","run-down","cheap","aging","corner"], (verbose ? 0.5 : 0));
  901. var color = random_desc(["blue","white","gray","tan","green","brick","concrete"], (verbose ? 0.5 : 0));
  902. 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);
  903. return "a " + merge_desc([size,color,name]);
  904. };
  905. this.describe = function(verbose = true) {
  906. if (verbose) {
  907. if (this.count <= 3) {
  908. var list = [];
  909. for (var i = 0; i < this.count; i++) {
  910. list.push(this.describeOne(this.count < 2));
  911. }
  912. return merge_things(list) + " with " + describe_all(this.contents,verbose);
  913. } else {
  914. return this.count + " local business containing " + describe_all(this.contents,verbose);
  915. }
  916. } else {
  917. return (this.count > 1 ? this.count + " buildings" : "a local business");
  918. }
  919. };
  920. }
  921. function Barn(count = 1) {
  922. this.name = "Barn";
  923. copy_defaults(this,new DefaultEntity());
  924. this.count = count;
  925. this.contents = initContents(this.name,this.count);
  926. this.describeOne = function(verbose=true) {
  927. var size = random_desc(["little","big","large","weathered","rotted","new"], (verbose ? 0.5 : 0));
  928. var color = random_desc(["blue","white","gray","tan","green","red"], (verbose ? 0.5 : 0));
  929. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  930. return "a " + merge_desc([size,color,name]);
  931. };
  932. this.describe = function(verbose = true) {
  933. if (verbose) {
  934. if (this.count <= 3) {
  935. var list = [];
  936. for (var i = 0; i < this.count; i++) {
  937. list.push(this.describeOne(this.count < 2));
  938. }
  939. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  940. } else {
  941. return this.count + " barns with " + describe_all(this.contents,verbose) + " inside";
  942. }
  943. } else {
  944. return (this.count > 1 ? this.count + " barns" : "a barn");
  945. }
  946. };
  947. }
  948. function SmallSkyscraper(count = 1) {
  949. this.name = "Small Skyscraper";
  950. copy_defaults(this,new DefaultEntity());
  951. this.count = count;
  952. this.contents = initContents(this.name,this.count);
  953. this.describeOne = function(verbose=true) {
  954. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  955. var name = random_desc(["skyscraper","office tower","office building","high rise"], 1);
  956. return "a " + merge_desc([color,name]);
  957. };
  958. this.describe = function(verbose = true) {
  959. if (verbose) {
  960. if (this.count <= 3) {
  961. var list = [];
  962. for (var i = 0; i < this.count; i++) {
  963. list.push(this.describeOne(this.count < 2));
  964. }
  965. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  966. } else {
  967. return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  968. }
  969. } else {
  970. return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper");
  971. }
  972. };
  973. }
  974. function LargeSkyscraper(count = 1) {
  975. this.name = "Large Skyscraper";
  976. copy_defaults(this,new DefaultEntity());
  977. this.count = count;
  978. this.contents = initContents(this.name,this.count);
  979. this.describeOne = function(verbose=true) {
  980. var color = random_desc(["blue","white","gray","tan","green","glass"], (verbose ? 0.5 : 0));
  981. var name = random_desc(["skyscraper","office tower","office building"], 1);
  982. return "a " + merge_desc(["towering",color,name]);
  983. };
  984. this.describe = function(verbose = true) {
  985. if (verbose) {
  986. if (this.count <= 3) {
  987. var list = [];
  988. for (var i = 0; i < this.count; i++) {
  989. list.push(this.describeOne(this.count < 2));
  990. }
  991. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  992. } else {
  993. return this.count + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  994. }
  995. } else {
  996. return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper");
  997. }
  998. };
  999. }
  1000. function ParkingGarage(count = 1) {
  1001. this.name = "Parking Garage";
  1002. copy_defaults(this,new DefaultEntity());
  1003. this.count = count;
  1004. this.contents = initContents(this.name,this.count);
  1005. this.describeOne = function(verbose=true) {
  1006. return "a parking garage";
  1007. };
  1008. this.describe = function(verbose = true) {
  1009. if (verbose) {
  1010. return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose);
  1011. } else {
  1012. return (this.count == 1 ? "a parking garage" : this.count + " parking garages");
  1013. }
  1014. };
  1015. }
  1016. function Town(count = 1) {
  1017. this.name = "Town";
  1018. copy_defaults(this,new DefaultEntity());
  1019. this.count = count;
  1020. this.contents = initContents(this.name,this.count);
  1021. this.describe = function(verbose = true) {
  1022. if (verbose) {
  1023. return (this.count == 1 ? "a town" : this.count + " towns") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  1024. } else {
  1025. return (this.count == 1 ? "a town" : this.count + " towns");
  1026. }
  1027. };
  1028. }
  1029. function City(count = 1) {
  1030. this.name = "City";
  1031. copy_defaults(this,new DefaultEntity());
  1032. this.count = count;
  1033. this.contents = initContents(this.name,this.count);
  1034. this.describe = function(verbose = true) {
  1035. if (verbose) {
  1036. return (this.count == 1 ? "a city" : this.count + " cities") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  1037. } else {
  1038. return (this.count == 1 ? "a city" : this.count + " cities");
  1039. }
  1040. };
  1041. }
  1042. function Continent(count = 1) {
  1043. this.name = "Continent";
  1044. copy_defaults(this,new DefaultEntity());
  1045. this.count = count;
  1046. this.contents = initContents(this.name,this.count);
  1047. this.describe = function(verbose = true) {
  1048. if (verbose) {
  1049. return (this.count == 1 ? "a continent" : this.count + " continents") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  1050. } else {
  1051. return (this.count == 1 ? "a continent" : this.count + " continents");
  1052. }
  1053. };
  1054. }
  1055. function Planet(count = 1) {
  1056. this.name = "Planet";
  1057. copy_defaults(this,new DefaultEntity());
  1058. this.count = count;
  1059. this.contents = initContents(this.name,this.count);
  1060. this.describe = function(verbose = true) {
  1061. if (verbose) {
  1062. return (this.count == 1 ? "a planet" : this.count + " planets") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  1063. } else {
  1064. return (this.count == 1 ? "a planet" : this.count + " planets");
  1065. }
  1066. };
  1067. }
  1068. function Star(count = 1) {
  1069. this.name = "Star";
  1070. copy_defaults(this,new DefaultEntity());
  1071. this.count = count;
  1072. this.contents = initContents(this.name,this.count);
  1073. this.describe = function(verbose = true) {
  1074. return (this.count == 1 ? "a star" : this.count + " stars");
  1075. };
  1076. }
  1077. function SolarSystem(count = 1) {
  1078. this.name = "Solar System";
  1079. copy_defaults(this,new DefaultEntity());
  1080. this.count = count;
  1081. this.contents = initContents(this.name,this.count);
  1082. this.describe = function(verbose = true) {
  1083. if (verbose) {
  1084. return (this.count == 1 ? "a solar system" : this.count + " solar systems") + " made up of " + describe_all(this.contents, verbose);
  1085. } else {
  1086. return (this.count == 1 ? "a solar system" : this.count + " solar systems");
  1087. }
  1088. };
  1089. }
  1090. function Galaxy(count = 1) {
  1091. this.name = "Galaxy";
  1092. copy_defaults(this,new DefaultEntity());
  1093. this.count = count;
  1094. this.contents = initContents(this.name,this.count);
  1095. this.describe = function(verbose = true) {
  1096. if (verbose) {
  1097. return (this.count == 1 ? "a galaxy" : this.count + " galaxies") + " made up of " + describe_all(this.contents, verbose);
  1098. } else {
  1099. return (this.count == 1 ? "a galaxy" : this.count + " galaxies");
  1100. }
  1101. };
  1102. }
  1103. function Cluster(count = 1) {
  1104. this.name = "Cluster";
  1105. copy_defaults(this,new DefaultEntity());
  1106. this.count = count;
  1107. this.contents = initContents(this.name,this.count);
  1108. this.describe = function(verbose = true) {
  1109. if (verbose) {
  1110. return (this.count == 1 ? "a cluster" : this.count + " clusters") + " made up of " + describe_all(this.contents, verbose);
  1111. } else {
  1112. return (this.count == 1 ? "a cluster" : this.count + " clusters");
  1113. }
  1114. };
  1115. }
  1116. function Universe(count = 1) {
  1117. this.name = "Universe";
  1118. copy_defaults(this,new DefaultEntity());
  1119. this.count = count;
  1120. this.contents = initContents(this.name,this.count);
  1121. this.describe = function(verbose = true) {
  1122. if (verbose) {
  1123. return (this.count == 1 ? "a universe" : this.count + " universes") + " made up of " + describe_all(this.contents, verbose);
  1124. } else {
  1125. return (this.count == 1 ? "a universe" : this.count + " universes");
  1126. }
  1127. };
  1128. }
  1129. function Multiverse(count = 1) {
  1130. this.name = "Multiverse";
  1131. copy_defaults(this,new DefaultEntity());
  1132. this.count = count;
  1133. this.contents = initContents(this.name,this.count);
  1134. this.describe = function(verbose = true) {
  1135. if (verbose) {
  1136. return (this.count == 1 ? "a multiverse" : this.count + " multiverses") + " made up of " + describe_all(this.contents, verbose);
  1137. } else {
  1138. return (this.count == 1 ? "a multiverse" : this.count + " multiverses");
  1139. }
  1140. };
  1141. }
  1142. function Soldier(count = 1) {
  1143. this.name = "Soldier";
  1144. copy_defaults(this,new DefaultEntity());
  1145. this.count = count;
  1146. this.contents = initContents(this.name,this.count);
  1147. this.describe = function(verbose = true) {
  1148. return (this.count == 1 ? "a soldier" : this.count + " soldiers");
  1149. };
  1150. }
  1151. function Tank(count = 1) {
  1152. this.name = "Tank";
  1153. copy_defaults(this,new DefaultEntity());
  1154. this.count = count;
  1155. this.contents = initContents(this.name,this.count);
  1156. this.describe = function(verbose = true) {
  1157. if (verbose) {
  1158. return (this.count == 1 ? "a tank" : this.count + " tanks") + " with " + describe_all(this.contents, verbose) + " trapped inside";
  1159. } else {
  1160. return (this.count == 1 ? "a tank" : this.count + " tanks");
  1161. }
  1162. };
  1163. }
  1164. function Artillery(count = 1) {
  1165. this.name = "Artillery";
  1166. copy_defaults(this,new DefaultEntity());
  1167. this.count = count;
  1168. this.contents = initContents(this.name,this.count);
  1169. this.describe = function(verbose = true) {
  1170. if (verbose) {
  1171. return (this.count == 1 ? "an artillery unit" : this.count + " artillery units") + " with " + describe_all(this.contents, verbose) + " trapped inside";
  1172. } else {
  1173. return (this.count == 1 ? "an artillery unit" : this.count + " artillery units");
  1174. }
  1175. };
  1176. }
  1177. function Helicopter(count = 1) {
  1178. this.name = "Helicopter";
  1179. copy_defaults(this,new DefaultEntity());
  1180. this.count = count;
  1181. this.contents = initContents(this.name,this.count);
  1182. this.describe = function(verbose = true) {
  1183. if (verbose) {
  1184. return (this.count == 1 ? "a helicopter" : this.count + " helicopters") + " with " + describe_all(this.contents, verbose) + " riding inside";
  1185. } else {
  1186. return (this.count == 1 ? "a helicopter" : this.count + " helicopters");
  1187. }
  1188. };
  1189. }
  1190. function Micro(count = 1) {
  1191. this.name = "Micro";
  1192. copy_defaults(this,new DefaultEntity());
  1193. this.count = count;
  1194. this.contents = initContents(this.name,this.count);
  1195. this.describe = function(verbose = true) {
  1196. return (this.count == 1 ? "a micro" : this.count + " micros");
  1197. };
  1198. }
  1199. function Macro(count = 1) {
  1200. this.name = "Macro";
  1201. copy_defaults(this,new DefaultEntity());
  1202. this.count = count;
  1203. this.contents = initContents(this.name,this.count);
  1204. this.describe = function(verbose = true) {
  1205. return (this.count == 1 ? "a smaller macro" : this.count + " smaller macros");
  1206. };
  1207. }
  1208. function Squad(count = 1) {
  1209. this.name = "Squad";
  1210. copy_defaults(this,new DefaultEntity());
  1211. this.count = count;
  1212. this.contents = initContents(this.name,this.count);
  1213. this.describeOne = function(verbose=true) {
  1214. return "a squad";
  1215. };
  1216. this.describe = function(verbose = true) {
  1217. if (verbose) {
  1218. return (this.count == 1 ? "a squad" : this.count + " squads") + " made up of " + describe_all(this.contents, verbose);
  1219. } else {
  1220. return (this.count == 1 ? "a squad" : this.count + " squads");
  1221. }
  1222. };
  1223. }
  1224. function Platoon(count = 1) {
  1225. this.name = "Platoon";
  1226. copy_defaults(this,new DefaultEntity());
  1227. this.count = count;
  1228. this.contents = initContents(this.name,this.count);
  1229. this.describeOne = function(verbose=true) {
  1230. return "a military platoon";
  1231. };
  1232. this.describe = function(verbose = true) {
  1233. if (verbose) {
  1234. return (this.count == 1 ? "a platoon" : this.count + " platoons") + " consisting of " + describe_all(this.contents, verbose);
  1235. } else {
  1236. return (this.count == 1 ? "a platoon" : this.count + " platoons");
  1237. }
  1238. };
  1239. }
  1240. function Company(count = 1) {
  1241. this.name = "Company";
  1242. copy_defaults(this,new DefaultEntity());
  1243. this.count = count;
  1244. this.contents = initContents(this.name,this.count);
  1245. this.describeOne = function(verbose=true) {
  1246. return "a company of soldiers";
  1247. };
  1248. this.describe = function(verbose = true) {
  1249. if (verbose) {
  1250. return (this.count == 1 ? "a company" : this.count + " companies") + " of " + describe_all(this.contents, verbose);
  1251. } else {
  1252. return (this.count == 1 ? "a company" : this.count + " companies");
  1253. }
  1254. };
  1255. }
  1256. function Battalion(count = 1) {
  1257. this.name = "Battalion";
  1258. copy_defaults(this,new DefaultEntity());
  1259. this.count = count;
  1260. this.contents = initContents(this.name,this.count);
  1261. this.describeOne = function(verbose=true) {
  1262. return "a battalion";
  1263. };
  1264. this.describe = function(verbose = true) {
  1265. if (verbose) {
  1266. return (this.count == 1 ? "a battalion" : this.count + " battalions") + " containing " + describe_all(this.contents, verbose);
  1267. } else {
  1268. return (this.count == 1 ? "a battalion" : this.count + " battalions");
  1269. }
  1270. };
  1271. }
  1272. function Brigade(count = 1) {
  1273. this.name = "Brigade";
  1274. copy_defaults(this,new DefaultEntity());
  1275. this.count = count;
  1276. this.contents = initContents(this.name,this.count);
  1277. this.describeOne = function(verbose=true) {
  1278. return "a brigade";
  1279. };
  1280. this.describe = function(verbose = true) {
  1281. if (verbose) {
  1282. return (this.count == 1 ? "a brigade" : this.count + " brigades") + " made up of " + describe_all(this.contents, verbose);
  1283. } else {
  1284. return (this.count == 1 ? "a brigade" : this.count + " brigades");
  1285. }
  1286. };
  1287. }
  1288. function Division(count = 1) {
  1289. this.name = "Division";
  1290. copy_defaults(this,new DefaultEntity());
  1291. this.count = count;
  1292. this.contents = initContents(this.name,this.count);
  1293. this.describeOne = function(verbose=true) {
  1294. return "a division";
  1295. };
  1296. this.describe = function(verbose = true) {
  1297. if (verbose) {
  1298. return (this.count == 1 ? "a division" : this.count + " divisions") + " of " + describe_all(this.contents, verbose);
  1299. } else {
  1300. return (this.count == 1 ? "a division" : this.count + " divisions");
  1301. }
  1302. };
  1303. }
  1304. function TankDivision(count = 1) {
  1305. this.name = "Tank Division";
  1306. copy_defaults(this,new DefaultEntity());
  1307. this.count = count;
  1308. this.contents = initContents(this.name,this.count);
  1309. this.describeOne = function(verbose=true) {
  1310. return "a tank division";
  1311. };
  1312. this.describe = function(verbose = true) {
  1313. if (verbose) {
  1314. return (this.count == 1 ? "a tank division" : this.count + " tank divisions") + " of " + describe_all(this.contents, verbose);
  1315. } else {
  1316. return (this.count == 1 ? "a tank division" : this.count + " tank divisions");
  1317. }
  1318. };
  1319. }
  1320. function Army(count = 1) {
  1321. this.name = "Army";
  1322. copy_defaults(this,new DefaultEntity());
  1323. this.count = count;
  1324. this.contents = initContents(this.name,this.count);
  1325. this.describeOne = function(verbose=true) {
  1326. return "an army";
  1327. };
  1328. this.describe = function(verbose = true) {
  1329. if (verbose) {
  1330. return (this.count == 1 ? "an army" : this.count + " armies") + " made up of " + describe_all(this.contents, verbose);
  1331. } else {
  1332. return (this.count == 1 ? "an army" : this.count + " armies");
  1333. }
  1334. };
  1335. }