big steppy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

1248 行
33 KiB

  1. 'use strict';
  2. var things =
  3. {
  4. "Container": Container,
  5. "Person": Person,
  6. "Human": Human,
  7. "Cow": Cow,
  8. "Empty Car": EmptyCar,
  9. "Car": Car,
  10. "Bus": Bus,
  11. "Tram": Tram,
  12. "House": House,
  13. "Barn": Barn,
  14. "Small Skyscraper": SmallSkyscraper,
  15. "Large Skyscraper": LargeSkyscraper,
  16. "Train": Train,
  17. "Train Car": TrainCar,
  18. "Parking Garage": ParkingGarage,
  19. "Town": Town,
  20. "City": City,
  21. "Continent": Continent,
  22. "Planet": Planet,
  23. "Star": Star,
  24. "Solar System": SolarSystem,
  25. "Galaxy": Galaxy,
  26. "Cluster": Cluster,
  27. "Universe": Universe,
  28. "Multiverse": Multiverse,
  29. "Soldier": Soldier,
  30. "Tank": Tank,
  31. "Artillery": Artillery,
  32. "Helicopter": Helicopter,
  33. "Micro": Micro,
  34. "Macro": Macro,
  35. };
  36. var areas =
  37. {
  38. "Container": 0,
  39. "Person": 0.33,
  40. "Human": 0.33,
  41. "Cow": 2,
  42. "Car": 4,
  43. "Bus": 12,
  44. "Tram": 20,
  45. "House": 150,
  46. "Barn": 300,
  47. "Small Skyscraper": 1000,
  48. "Large Skyscraper": 2000,
  49. "Train": 40,
  50. "TrainCar": 20,
  51. "Parking Garage": 750,
  52. "Town": 1e7,
  53. "City": 1e9,
  54. "Continent": 1.5e13,
  55. "Planet": 2.5e14,
  56. "Star": 3e18,
  57. "Solar System": 3e21,
  58. "Galaxy": 2e45,
  59. "Cluster": 2e49,
  60. "Universe": 7e53,
  61. "Multiverse": 5e56,
  62. "Soldier": 1,
  63. "Tank": 10,
  64. "Artillery": 12,
  65. "Helicopter": 8,
  66. "Micro": 0.05,
  67. "Macro": 100,
  68. };
  69. var masses =
  70. {
  71. "Container": 0,
  72. "Person": 80,
  73. "Human": 80,
  74. "Cow": 300,
  75. "Car": 1000,
  76. "Bus": 5000,
  77. "Tram": 10000,
  78. "House": 10000,
  79. "Barn": 5000,
  80. "Small Skyscraper": 10000000,
  81. "Large Skyscraper": 80000000,
  82. "Train": 50000,
  83. "Train Car": 7500,
  84. "Parking Garage": 10000000,
  85. "Town": 1,
  86. "City": 1,
  87. "Continent": 1e21,
  88. "Planet": 5.972e24,
  89. "Star": 1e40,
  90. "Solar System": 1,
  91. "Galaxy": 1,
  92. "Cluster": 1,
  93. "Universe": 1,
  94. "Multiverse": 1,
  95. "Soldier": 80,
  96. "Tank": 5000,
  97. "Artillery": 7000,
  98. "Helicopter": 1500,
  99. "Micro": 0.01,
  100. "Macro": 80000,
  101. };
  102. var clusters =
  103. {
  104. "Container": 0,
  105. "Person": 5,
  106. "Human": 5,
  107. "Cow": 15,
  108. "Car": 3,
  109. "Bus": 1,
  110. "Tram": 1,
  111. "House": 5,
  112. "Barn": 1,
  113. "Small Skyscraper": 2,
  114. "Large Skyscraper": 1,
  115. "Train": 2,
  116. "Train Car": 1,
  117. "Parking Garage": 1,
  118. "Town": 5,
  119. "City": 1,
  120. "Continent": 5,
  121. "Planet": 1,
  122. "Star": 1,
  123. "Solar System": 1,
  124. "Galaxy": 1,
  125. "Cluster": 1,
  126. "Universe": 1,
  127. "Multiverse": 1,
  128. "Soldier": 0,
  129. "Tank": 0,
  130. "Artillery": 0,
  131. "Helicopter": 0,
  132. "Micro": 10,
  133. "Macro": 0,
  134. };
  135. var cluster_chances =
  136. {
  137. "Container": 0,
  138. "Person": 0.8,
  139. "Human": 0.8,
  140. "Cow": 0.5,
  141. "Car": 0.5,
  142. "Bus": 0.25,
  143. "Tram": 0.2,
  144. "House": 0.5,
  145. "Barn": 0.1,
  146. "Small Skyscraper": 0.25,
  147. "Large Skyscraper": 0.25,
  148. "Train": 0.1,
  149. "Train Car": 0.05,
  150. "Parking Garage": 0.1,
  151. "Town": 0.1,
  152. "City": 0.2,
  153. "Continent": 0.5,
  154. "Planet": 1,
  155. "Star": 1,
  156. "Solar System": 1,
  157. "Galaxy": 1,
  158. "Cluster": 1,
  159. "Universe": 1,
  160. "Multiverse": 1,
  161. "Soldier": 0,
  162. "Tank": 0,
  163. "Artillery": 0,
  164. "Helicopter": 0,
  165. "Micro": 10,
  166. "Macro": 0,
  167. };
  168. var contents =
  169. {
  170. "Container": [],
  171. "Person": [],
  172. "Human": [],
  173. "Cow": [],
  174. "Car": [["Person",1,4]],
  175. "Bus": [["Person",2,30]],
  176. "Tram": [["Person",10,50]],
  177. "Train": [["Person",1,4,"engine"],["Train Car",2,10]],
  178. "Train Car": [["Person",10,40]],
  179. "House": [["Person",0,8],["Empty Car",0,2]],
  180. "Barn": [["Person",0,2],["Cow",30,70]],
  181. "Small Skyscraper": [["Person",150,750],["Empty Car",10,50]],
  182. "Large Skyscraper": [["Person",500,1500],["Empty Car",20,100]],
  183. "Parking Garage": [["Person",10,200],["Empty Car",100,300],["Car",5,30]],
  184. "Town": [["Person",10000,100000],["House",5000,50000],["Empty Car",200,800],["Car",500,80000],["Bus",5,25],["Train",5,25]],
  185. "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]],
  186. "Continent": [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250]],
  187. "Planet": [["Continent",4,9]],
  188. "Star": [],
  189. "Solar System": [["Star",1,1],["Planet",5,15]],
  190. "Galaxy": [["Star",1e9,500e9],["Solar System",1e8,500e8]],
  191. "Cluster": [["Galaxy",200,5000]],
  192. "Universe": [["Cluster",1.5e9,2.5e9]],
  193. "Multiverse": [["Universe",100,1000]],
  194. "Soldier": [],
  195. "Tank": [["Soldier",3,5]],
  196. "Artillery": [["Soldier",4,6]],
  197. "Helicopter": [["Soldier",4,16]],
  198. "Micro": [[]],
  199. "Macro": [[]]
  200. };
  201. // replace all instances of from with to
  202. function contents_substitute(from,to) {
  203. for (let key in contents) {
  204. if (contents.hasOwnProperty(key)) {
  205. let type = contents[key];
  206. for (let i=0; i<type.length; i++) {
  207. if (type[i][0] == from) {
  208. type[i][0] = to;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. // remove all instances of thing
  215. function contents_remove(thing) {
  216. for (let key in contents) {
  217. if (contents.hasOwnProperty(key)) {
  218. let type = contents[key];
  219. for (let i=0; i<type.length; i++) {
  220. if (type[i][0] == thing) {
  221. type.splice(i,1);
  222. --i;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. // adds thing to parent
  229. function contents_insert(parent,thing,min,max,label) {
  230. let owner = contents[parent];
  231. if (label == undefined)
  232. owner.push([thing,min,max]);
  233. else
  234. owner.push([thing,min,max,label]);
  235. }
  236. function initContents(name,count) {
  237. let result = {};
  238. let type = contents[name];
  239. for (let i=0; i<type.length; i++) {
  240. let amount = distribution(type[i][1],type[i][2],count);
  241. if (amount > 0) {
  242. // if a custom label is supplied, use it!
  243. if (type[i].length == 4)
  244. result[type[i][3]] = new things[type[i][0]](amount);
  245. else
  246. result[type[i][0]] = new things[type[i][0]](amount);
  247. }
  248. }
  249. return result;
  250. }
  251. function get_living_prey(sum) {
  252. let total = 0;
  253. for (let key in sum) {
  254. if (sum.hasOwnProperty(key)) {
  255. if (key == "Micro" || key == "Macro" || key == "Person" || key == "Cow" || key == 'Soldier')
  256. total += sum[key];
  257. }
  258. }
  259. return total;
  260. }
  261. // general logic: each step fills in a fraction of the remaining space
  262. function fill_area(area, weights, variance=0.15)
  263. {
  264. area = area + Math.random() * variance * 2 * area - variance * area;
  265. var result = [];
  266. var candidates = [];
  267. for (var key in weights) {
  268. if (weights.hasOwnProperty(key)) {
  269. candidates.push({"name": key, "area": areas[key], "weight": weights[key]});
  270. }
  271. }
  272. candidates = candidates.sort(function (x,y) {
  273. return x.area - y.area;
  274. });
  275. while(candidates.length > 0) {
  276. var candidate = candidates.pop();
  277. if (candidate.area > area)
  278. continue;
  279. var max = Math.floor(area / candidate.area);
  280. var limit = Math.min(max, 100);
  281. var count = 0;
  282. var loopvar = limit;
  283. // for small amounts, actually do the randomness
  284. // the first few ones get a much better shot
  285. while (loopvar > 0) {
  286. if (loopvar <= clusters[candidate.name] && loopvar == 1 && Math.random() < cluster_chances[candidate.name])
  287. count += 1;
  288. else if (loopvar <= clusters[candidate.name]) {
  289. if (Math.random() < candidate.weight ? 1 : 0 || Math.random() < 0.75 * cluster_chances[candidate.name]) {
  290. count += 1;
  291. }
  292. }
  293. else
  294. count += Math.random() < candidate.weight ? 1 : 0;
  295. --loopvar;
  296. }
  297. if (limit < max) {
  298. count += Math.round((max-limit) * candidate.weight);
  299. }
  300. area -= count * candidate.area;
  301. if (count > 0)
  302. result.push(new things[candidate.name](count));
  303. }
  304. return new Container(result);
  305. }
  306. // describes everything in the container
  307. function describe_all(contents,verbose=true,except=[]) {
  308. var things = [];
  309. for (var key in contents) {
  310. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  311. things.push(contents[key].describe(verbose));
  312. }
  313. }
  314. return merge_things(things);
  315. }
  316. function random_desc(list, odds=1) {
  317. if (Math.random() < odds)
  318. return list[Math.floor(Math.random() * list.length)];
  319. else
  320. return "";
  321. }
  322. // combine strings into a list with proper grammar
  323. function merge_things(list,semicolons=false) {
  324. if (list.length == 0) {
  325. return "";
  326. } else if (list.length == 1) {
  327. return list[0];
  328. } else if (list.length == 2) {
  329. return list[0] + " and " + list[1];
  330. } else {
  331. var result = "";
  332. list.slice(0,list.length-1).forEach(function(term) {
  333. result += term + ", ";
  334. });
  335. result += "and " + list[list.length-1];
  336. return result;
  337. }
  338. }
  339. // combine the adjectives for something into a single string
  340. function merge_desc(list) {
  341. var result = "";
  342. list.forEach(function(term) {
  343. if (term != "")
  344. result += term + " ";
  345. });
  346. // knock off the last space
  347. if (result.length > 0) {
  348. result = result.substring(0, result.length - 1);
  349. }
  350. return result;
  351. }
  352. // maybe make this something that approximates a
  353. // normal distribution; doing this 15,000,000 times is bad...
  354. // solution: only a few are random lul
  355. // improvement: take up to 100 samples, then use that to scale the final result
  356. function distribution(min, max, samples) {
  357. var result = 0;
  358. var limit = Math.min(100,samples);
  359. if (limit < samples) {
  360. let dist = 0;
  361. for (let i = 0; i < limit; i++) {
  362. dist += Math.random();
  363. }
  364. dist /= 100;
  365. return Math.floor(dist * samples * (max - min + 1) + samples * min);
  366. } else {
  367. for (let i = 0; i < limit; i++) {
  368. result += Math.floor(Math.random() * (max - min + 1) + min);
  369. }
  370. }
  371. return result;
  372. }
  373. function defaultMultiply(thing) {
  374. return function(amount) {
  375. thing.count *= amount;
  376. for (var key in thing.contents) {
  377. if (thing.contents.hasOwnProperty(key)) {
  378. thing.contents[key].multiply(amount);
  379. }
  380. }
  381. };
  382. }
  383. function defaultArea(thing) {
  384. return areas[thing.name];
  385. }
  386. function defaultMass(thing) {
  387. return masses[thing.name];
  388. }
  389. function defaultMerge(thing) {
  390. return function(container) {
  391. var newCount = this.count + container.count;
  392. var newThing = new things[thing.name](newCount);
  393. newThing.contents = {};
  394. for (var key in this.contents) {
  395. if (this.contents.hasOwnProperty(key)) {
  396. newThing.contents[key] = this.contents[key];
  397. }
  398. }
  399. for (key in container.contents) {
  400. if (container.contents.hasOwnProperty(key)) {
  401. if (this.contents.hasOwnProperty(key)) {
  402. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  403. } else {
  404. newThing.contents[key] = container.contents[key];
  405. }
  406. }
  407. }
  408. return newThing;
  409. };
  410. }
  411. function listSum(sum) {
  412. let result = [];
  413. for (let key in sum) {
  414. if (sum.hasOwnProperty(key)) {
  415. result.push(new things[key](sum[key]).describe(false));
  416. }
  417. }
  418. return merge_things(result);
  419. }
  420. function defaultSum(thing) {
  421. return function() {
  422. var counts = {};
  423. if (thing.name != "Container")
  424. counts[thing.name] = thing.count;
  425. for (var key in thing.contents) {
  426. if (thing.contents.hasOwnProperty(key)) {
  427. var subcount = thing.contents[key].sum();
  428. for (var subkey in subcount) {
  429. if (!counts.hasOwnProperty(subkey)) {
  430. counts[subkey] = 0;
  431. }
  432. counts[subkey] += subcount[subkey];
  433. }
  434. }
  435. }
  436. return counts;
  437. };
  438. }
  439. function defaultSumProperty(thing) {
  440. return function(prop) {
  441. var total = 0;
  442. total += thing[prop] * thing.count;
  443. for (var key in thing.contents) {
  444. if (thing.contents.hasOwnProperty(key)) {
  445. total += thing.contents[key].sum_property(prop);
  446. }
  447. }
  448. return total;
  449. };
  450. }
  451. function defaultAddContent(thing) {
  452. return function(name, min, max, count) {
  453. if (min == max) {
  454. let object = new things[name](min*count);
  455. thing.contents[object.name] = object;
  456. } else {
  457. let object = new things[name](distribution(min, max, count));
  458. thing.contents[object.name] = object;
  459. }
  460. };
  461. }
  462. function DefaultEntity() {
  463. this.sum = defaultSum;
  464. this.area = defaultArea;
  465. this.mass = defaultMass;
  466. this.sum_property = defaultSumProperty;
  467. this.merge = defaultMerge;
  468. this.multiply = defaultMultiply;
  469. return this;
  470. }
  471. // god I love reinventing the wheel
  472. function copy_defaults(self,proto) {
  473. for (var key in proto) {
  474. if (proto.hasOwnProperty(key)) {
  475. self[key] = proto[key](self);
  476. }
  477. }
  478. }
  479. function Container(contents = []) {
  480. this.name = "Container";
  481. copy_defaults(this,new DefaultEntity());
  482. if (Number.isInteger(contents))
  483. this.count = contents;
  484. else
  485. this.count = 0;
  486. this.contents = {};
  487. for (var i=0; i < contents.length; i++) {
  488. this.contents[contents[i].name] = contents[i];
  489. }
  490. for (var key in this.contents) {
  491. if (this.contents.hasOwnProperty(key)) {
  492. this.count += this.contents[key].count;
  493. }
  494. }
  495. this.describe = function(verbose = true) {
  496. return describe_all(this.contents,verbose);
  497. };
  498. return this;
  499. }
  500. function Person(count = 1) {
  501. this.name = "Person";
  502. copy_defaults(this,new DefaultEntity());
  503. this.count = count;
  504. this.contents = initContents(this.name,this.count);
  505. this.describeOne = function (verbose=true) {
  506. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  507. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  508. var species = "";
  509. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal"]);
  510. return "a " + merge_desc([body,sex,species]);
  511. };
  512. this.describe = function(verbose=true) {
  513. if (verbose) {
  514. if (count <= 3) {
  515. var list = [];
  516. for (var i = 0; i < count; i++) {
  517. list.push(this.describeOne(this.count <= 2));
  518. }
  519. return merge_things(list);
  520. } else {
  521. return this.count + " people";
  522. }
  523. } else {
  524. return (this.count > 1 ? this.count + " people" : "a person");
  525. }
  526. };
  527. return this;
  528. }
  529. function Human(count = 1) {
  530. this.name = "Person";
  531. copy_defaults(this,new DefaultEntity());
  532. this.count = count;
  533. this.contents = initContents(this.name,this.count);
  534. this.describeOne = function (verbose=true) {
  535. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  536. var sex = random_desc(["man", "woman"], 1);
  537. return "a " + merge_desc([body,sex]);
  538. };
  539. this.describe = function(verbose=true) {
  540. if (verbose) {
  541. if (count <= 3) {
  542. var list = [];
  543. for (var i = 0; i < count; i++) {
  544. list.push(this.describeOne(this.count <= 2));
  545. }
  546. return merge_things(list);
  547. } else {
  548. return this.count + " people";
  549. }
  550. } else {
  551. return (this.count > 1 ? this.count + " people" : "a person");
  552. }
  553. };
  554. return this;
  555. }
  556. function Cow(count = 1) {
  557. this.name = "Cow";
  558. copy_defaults(this,new DefaultEntity());
  559. this.count = count;
  560. this.contents = initContents(this.name,this.count);
  561. this.describeOne = function (verbose=true) {
  562. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  563. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  564. return "a " + merge_desc([body,sex,"cow"]);
  565. };
  566. this.describe = function(verbose=true) {
  567. if (verbose) {
  568. if (count <= 3) {
  569. var list = [];
  570. for (var i = 0; i < count; i++) {
  571. list.push(this.describeOne(this.count <= 2));
  572. }
  573. return merge_things(list);
  574. } else {
  575. return this.count + " cattle";
  576. }
  577. } else {
  578. return (this.count > 1 ? this.count + " cattle" : "a cow");
  579. }
  580. };
  581. return this;
  582. }
  583. function EmptyCar(count = 1) {
  584. this.name = "Car";
  585. copy_defaults(this,new DefaultEntity());
  586. this.count = count;
  587. this.contents = initContents(this.name,this.count);
  588. this.describeOne = function(verbose=true) {
  589. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  590. var adjective = random_desc(["rusty","brand-new"],0.3);
  591. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  592. return "a parked " + merge_desc([adjective,color,type]);
  593. };
  594. this.describe = function(verbose = true) {
  595. if (verbose) {
  596. if (this.count <= 3) {
  597. var list = [];
  598. for (var i = 0; i < this.count; i++) {
  599. list.push(this.describeOne());
  600. }
  601. return merge_things(list);
  602. } else {
  603. return this.count + " parked cars";
  604. }
  605. } else {
  606. return (this.count > 1 ? this.count + " parked cars" : "a parked car");
  607. }
  608. };
  609. }
  610. function Car(count = 1) {
  611. this.name = "Car";
  612. copy_defaults(this,new DefaultEntity());
  613. this.count = count;
  614. this.contents = initContents(this.name,this.count);
  615. this.describeOne = function(verbose=true) {
  616. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  617. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  618. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  619. return "a " + merge_desc([adjective,color,type]);
  620. };
  621. this.describe = function(verbose = true) {
  622. if (verbose) {
  623. if (this.count <= 3) {
  624. var list = [];
  625. for (var i = 0; i < this.count; i++) {
  626. list.push(this.describeOne(this.count < 2));
  627. }
  628. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  629. } else {
  630. return this.count + " cars with " + describe_all(this.contents,verbose) + " inside";
  631. }
  632. } else {
  633. return (this.count > 1 ? this.count + " cars" : "a car");
  634. }
  635. };
  636. }
  637. function Bus(count = 1) {
  638. this.name = "Bus";
  639. copy_defaults(this,new DefaultEntity());
  640. this.count = count;
  641. this.contents = initContents(this.name,this.count);
  642. this.describeOne = function(verbose=true) {
  643. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  644. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  645. var type = random_desc(["bus","double-decker bus","articulating bus"]);
  646. return "a " + merge_desc([adjective,color,type]);
  647. };
  648. this.describe = function(verbose = true) {
  649. if (verbose) {
  650. if (this.count <= 3) {
  651. var list = [];
  652. for (var i = 0; i < this.count; i++) {
  653. list.push(this.describeOne(this.count < 2));
  654. }
  655. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  656. } else {
  657. return this.count + " buses with " + describe_all(this.contents,verbose) + " inside";
  658. }
  659. } else {
  660. return (this.count > 1 ? this.count + " buses" : "a bus");
  661. }
  662. };
  663. }
  664. function Tram(count = 1) {
  665. this.name = "Tram";
  666. copy_defaults(this,new DefaultEntity());
  667. this.count = count;
  668. this.contents = initContents(this.name,this.count);
  669. this.describeOne = function(verbose=true) {
  670. var adjective = random_desc(["rusty","weathered"], (verbose ? 0.3 : 0));
  671. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  672. var type = random_desc(["tram"]);
  673. return "a " + merge_desc([adjective,color,type]);
  674. };
  675. this.describe = function(verbose = true) {
  676. if (verbose) {
  677. if (this.count == 1) {
  678. var list = [];
  679. for (var i = 0; i < this.count; i++) {
  680. list.push(this.describeOne(verbose));
  681. }
  682. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  683. } else {
  684. return this.count + " trams with " + describe_all(this.contents,verbose) + " inside";
  685. }
  686. } else {
  687. return (this.count > 1 ? this.count + " trams" : "a tram");
  688. }
  689. };
  690. this.anal_vore = function() {
  691. return "You slide " + this.describe() + " up your tight ass";
  692. };
  693. }
  694. function Train(count = 1) {
  695. this.name = "Train";
  696. copy_defaults(this,new DefaultEntity());
  697. this.count = count;
  698. this.contents = initContents(this.name,this.count);
  699. this.describeOne = function(verbose=true) {
  700. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  701. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  702. var type = random_desc(["train","passenger train","freight train"]);
  703. return "a " + merge_desc([adjective,color,type]);
  704. };
  705. this.describe = function(verbose = true) {
  706. if (verbose) {
  707. if (this.count == 1) {
  708. var list = [];
  709. for (var i = 0; i < this.count; i++) {
  710. list.push(this.describeOne(verbose));
  711. }
  712. return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  713. } else {
  714. return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  715. }
  716. } else {
  717. return (this.count > 1 ? this.count + " trains" : "a train");
  718. }
  719. };
  720. this.anal_vore = function() {
  721. 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");
  722. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  723. };
  724. }
  725. function TrainCar(count = 1) {
  726. this.name = "Train Car";
  727. copy_defaults(this,new DefaultEntity());
  728. this.count = count;
  729. this.contents = initContents(this.name,this.count);
  730. this.describeOne = function(verbose=true) {
  731. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  732. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  733. var type = random_desc(["train car","passenger train car","freight train car"]);
  734. return "a " + merge_desc([adjective,color,type]);
  735. };
  736. this.describe = function(verbose = true) {
  737. if (verbose) {
  738. return (this.count > 1 ? this.count + " train cars" : "a train car") + " with " + describe_all(this.contents) + " inside";
  739. } else {
  740. return (this.count > 1 ? this.count + " train cars" : "a train car");
  741. }
  742. };
  743. }
  744. function House(count = 1) {
  745. this.name = "House";
  746. copy_defaults(this,new DefaultEntity());
  747. this.count = count;
  748. this.contents = initContents(this.name,this.count);
  749. this.describeOne = function(verbose=true) {
  750. var size = random_desc(["little","two-story","large"], (verbose ? 0.5 : 0));
  751. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  752. var name = random_desc(["house","house","house","house","house","trailer"], 1);
  753. return "a " + merge_desc([size,color,name]);
  754. };
  755. this.describe = function(verbose = true) {
  756. if (verbose) {
  757. if (this.count <= 3) {
  758. var list = [];
  759. for (var i = 0; i < this.count; i++) {
  760. list.push(this.describeOne(this.count < 2));
  761. }
  762. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  763. } else {
  764. return this.count + " homes with " + describe_all(this.contents,verbose) + " inside";
  765. }
  766. } else {
  767. return (this.count > 1 ? this.count + " houses" : "a house");
  768. }
  769. };
  770. }
  771. function Barn(count = 1) {
  772. this.name = "Barn";
  773. copy_defaults(this,new DefaultEntity());
  774. this.count = count;
  775. this.contents = initContents(this.name,this.count);
  776. this.describeOne = function(verbose=true) {
  777. var size = random_desc(["little","big","large"], (verbose ? 0.5 : 0));
  778. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  779. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  780. return "a " + merge_desc([size,color,name]);
  781. };
  782. this.describe = function(verbose = true) {
  783. if (verbose) {
  784. if (this.count <= 3) {
  785. var list = [];
  786. for (var i = 0; i < this.count; i++) {
  787. list.push(this.describeOne(this.count < 2));
  788. }
  789. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  790. } else {
  791. return this.count + " barns with " + describe_all(this.contents,verbose) + " inside";
  792. }
  793. } else {
  794. return (this.count > 1 ? this.count + " barns" : "a barn");
  795. }
  796. };
  797. }
  798. function SmallSkyscraper(count = 1) {
  799. this.name = "Small Skyscraper";
  800. copy_defaults(this,new DefaultEntity());
  801. this.count = count;
  802. this.contents = initContents(this.name,this.count);
  803. this.describeOne = function(verbose=true) {
  804. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  805. var name = random_desc(["skyscraper","office tower","office building"], 1);
  806. return "a " + merge_desc([color,name]);
  807. };
  808. this.describe = function(verbose = true) {
  809. if (verbose) {
  810. if (this.count <= 3) {
  811. var list = [];
  812. for (var i = 0; i < this.count; i++) {
  813. list.push(this.describeOne(this.count < 2));
  814. }
  815. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  816. } else {
  817. return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  818. }
  819. } else {
  820. return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper");
  821. }
  822. };
  823. }
  824. function LargeSkyscraper(count = 1) {
  825. this.name = "Large Skyscraper";
  826. copy_defaults(this,new DefaultEntity());
  827. this.count = count;
  828. this.contents = initContents(this.name,this.count);
  829. this.describeOne = function(verbose=true) {
  830. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  831. var name = random_desc(["skyscraper","office tower","office building"], 1);
  832. return "a " + merge_desc(["towering",color,name]);
  833. };
  834. this.describe = function(verbose = true) {
  835. if (verbose) {
  836. if (this.count <= 3) {
  837. var list = [];
  838. for (var i = 0; i < this.count; i++) {
  839. list.push(this.describeOne(this.count < 2));
  840. }
  841. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  842. } else {
  843. return this.count + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  844. }
  845. } else {
  846. return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper");
  847. }
  848. };
  849. }
  850. function ParkingGarage(count = 1) {
  851. this.name = "Parking Garage";
  852. copy_defaults(this,new DefaultEntity());
  853. this.count = count;
  854. this.contents = initContents(this.name,this.count);
  855. this.describeOne = function(verbose=true) {
  856. return "a parking garage";
  857. };
  858. this.describe = function(verbose = true) {
  859. if (verbose) {
  860. return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose) + " inside";
  861. } else {
  862. return (this.count == 1 ? "a parking garage" : this.count + " parking garages");
  863. }
  864. };
  865. }
  866. function Town(count = 1) {
  867. this.name = "Town";
  868. copy_defaults(this,new DefaultEntity());
  869. this.count = count;
  870. this.contents = initContents(this.name,this.count);
  871. this.describe = function(verbose = true) {
  872. if (verbose) {
  873. return (this.count == 1 ? "a town" : this.count + " towns") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  874. } else {
  875. return (this.count == 1 ? "a town" : this.count + " towns");
  876. }
  877. };
  878. }
  879. function City(count = 1) {
  880. this.name = "City";
  881. copy_defaults(this,new DefaultEntity());
  882. this.count = count;
  883. this.contents = initContents(this.name,this.count);
  884. this.describe = function(verbose = true) {
  885. if (verbose) {
  886. return (this.count == 1 ? "a city" : this.count + " cities") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  887. } else {
  888. return (this.count == 1 ? "a city" : this.count + " cities");
  889. }
  890. };
  891. }
  892. function Continent(count = 1) {
  893. this.name = "Continent";
  894. copy_defaults(this,new DefaultEntity());
  895. this.count = count;
  896. this.contents = initContents(this.name,this.count);
  897. this.describe = function(verbose = true) {
  898. if (verbose) {
  899. return (this.count == 1 ? "a continent" : this.count + " continents") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  900. } else {
  901. return (this.count == 1 ? "a continent" : this.count + " continents");
  902. }
  903. };
  904. }
  905. function Planet(count = 1) {
  906. this.name = "Planet";
  907. copy_defaults(this,new DefaultEntity());
  908. this.count = count;
  909. this.contents = initContents(this.name,this.count);
  910. this.describe = function(verbose = true) {
  911. if (verbose) {
  912. return (this.count == 1 ? "a planet" : this.count + " planets") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  913. } else {
  914. return (this.count == 1 ? "a planet" : this.count + " planets");
  915. }
  916. };
  917. }
  918. function Star(count = 1) {
  919. this.name = "Star";
  920. copy_defaults(this,new DefaultEntity());
  921. this.count = count;
  922. this.contents = initContents(this.name,this.count);
  923. this.describe = function(verbose = true) {
  924. return (this.count == 1 ? "a star" : this.count + " stars");
  925. };
  926. }
  927. function SolarSystem(count = 1) {
  928. this.name = "Solar System";
  929. copy_defaults(this,new DefaultEntity());
  930. this.count = count;
  931. this.contents = initContents(this.name,this.count);
  932. this.describe = function(verbose = true) {
  933. if (verbose) {
  934. return (this.count == 1 ? "a solar system" : this.count + " solar systems") + " made up of " + describe_all(this.contents, verbose);
  935. } else {
  936. return (this.count == 1 ? "a solar system" : this.count + " solar systems");
  937. }
  938. };
  939. }
  940. function Galaxy(count = 1) {
  941. this.name = "Galaxy";
  942. copy_defaults(this,new DefaultEntity());
  943. this.count = count;
  944. this.contents = initContents(this.name,this.count);
  945. this.describe = function(verbose = true) {
  946. if (verbose) {
  947. return (this.count == 1 ? "a galaxy" : this.count + " galaxies") + " made up of " + describe_all(this.contents, verbose);
  948. } else {
  949. return (this.count == 1 ? "a galaxy" : this.count + " galaxies");
  950. }
  951. };
  952. }
  953. function Cluster(count = 1) {
  954. this.name = "Cluster";
  955. copy_defaults(this,new DefaultEntity());
  956. this.count = count;
  957. this.contents = initContents(this.name,this.count);
  958. this.describe = function(verbose = true) {
  959. if (verbose) {
  960. return (this.count == 1 ? "a cluster" : this.count + " clusters") + " made up of " + describe_all(this.contents, verbose);
  961. } else {
  962. return (this.count == 1 ? "a cluster" : this.count + " clusters");
  963. }
  964. };
  965. }
  966. function Universe(count = 1) {
  967. this.name = "Universe";
  968. copy_defaults(this,new DefaultEntity());
  969. this.count = count;
  970. this.contents = initContents(this.name,this.count);
  971. this.describe = function(verbose = true) {
  972. if (verbose) {
  973. return (this.count == 1 ? "a universe" : this.count + " universes") + " made up of " + describe_all(this.contents, verbose);
  974. } else {
  975. return (this.count == 1 ? "a universe" : this.count + " universes");
  976. }
  977. };
  978. }
  979. function Multiverse(count = 1) {
  980. this.name = "Multiverse";
  981. copy_defaults(this,new DefaultEntity());
  982. this.count = count;
  983. this.contents = initContents(this.name,this.count);
  984. this.describe = function(verbose = true) {
  985. if (verbose) {
  986. return (this.count == 1 ? "a multiverse" : this.count + " multiverses") + " made up of " + describe_all(this.contents, verbose);
  987. } else {
  988. return (this.count == 1 ? "a multiverse" : this.count + " multiverses");
  989. }
  990. };
  991. }
  992. function Soldier(count = 1) {
  993. this.name = "Soldier";
  994. copy_defaults(this,new DefaultEntity());
  995. this.count = count;
  996. this.contents = initContents(this.name,this.count);
  997. this.describe = function(verbose = true) {
  998. return (this.count == 1 ? "a soldier" : this.count + " soldiers");
  999. };
  1000. }
  1001. function Tank(count = 1) {
  1002. this.name = "Tank";
  1003. copy_defaults(this,new DefaultEntity());
  1004. this.count = count;
  1005. this.contents = initContents(this.name,this.count);
  1006. this.describe = function(verbose = true) {
  1007. if (verbose) {
  1008. return (this.count == 1 ? "a tank" : this.count + " tanks") + " with " + describe_all(this.contents, verbose) + " trapped inside.";
  1009. } else {
  1010. return (this.count == 1 ? "a tank" : this.count + " tanks");
  1011. }
  1012. };
  1013. }
  1014. function Artillery(count = 1) {
  1015. this.name = "Artillery";
  1016. copy_defaults(this,new DefaultEntity());
  1017. this.count = count;
  1018. this.contents = initContents(this.name,this.count);
  1019. this.describe = function(verbose = true) {
  1020. if (verbose) {
  1021. return (this.count == 1 ? "an artillery unit" : this.count + " artillery units") + " with " + describe_all(this.contents, verbose) + " trapped inside.";
  1022. } else {
  1023. return (this.count == 1 ? "an artillery unit" : this.count + " artillery units");
  1024. }
  1025. };
  1026. }
  1027. function Helicopter(count = 1) {
  1028. this.name = "Helicopter";
  1029. copy_defaults(this,new DefaultEntity());
  1030. this.count = count;
  1031. this.contents = initContents(this.name,this.count);
  1032. this.describe = function(verbose = true) {
  1033. if (verbose) {
  1034. return (this.count == 1 ? "a helicopter" : this.count + " helicopters") + " with " + describe_all(this.contents, verbose) + " riding inside.";
  1035. } else {
  1036. return (this.count == 1 ? "a helicopter" : this.count + " helicopters");
  1037. }
  1038. };
  1039. }
  1040. function Micro(count = 1) {
  1041. this.name = "Micro";
  1042. copy_defaults(this,new DefaultEntity());
  1043. this.count = count;
  1044. this.contents = initContents(this.name,this.count);
  1045. this.describe = function(verbose = true) {
  1046. return (this.count == 1 ? "a micro" : this.count + " micros");
  1047. };
  1048. }
  1049. function Macro(count = 1) {
  1050. this.name = "Macro";
  1051. copy_defaults(this,new DefaultEntity());
  1052. this.count = count;
  1053. this.contents = initContents(this.name,this.count);
  1054. this.describe = function(verbose = true) {
  1055. return (this.count == 1 ? "a smaller macro" : this.count + " smaller macros");
  1056. };
  1057. }