big steppy
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 

1655 рядки
45 KiB

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