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

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