From 4b187060d2645471bbcc7421d521ba55a0f6fce3 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Sun, 22 Dec 2019 18:50:50 -0500 Subject: [PATCH 01/14] Refector of things in recurcive-desc 1 Started refactoring things, basic structure is in. This version is not working, jsdut commiting to pull new changes on master branch into the current branch. --- game.js | 10 +- recursive-desc.js | 2 +- recursive-macro.js | 629 ++++++++++++++++++++++++++++++++++----------- 3 files changed, 481 insertions(+), 160 deletions(-) diff --git a/game.js b/game.js index bba5eaa..0e86e2c 100644 --- a/game.js +++ b/game.js @@ -2089,7 +2089,7 @@ function getOnePrey(biome, area, sameSize = true) let potAreas = []; potential.forEach(function (x) { - potAreas.push([x,areas[x]]); + potAreas.push([x,things[x].area]); }); potAreas = potAreas.sort(function (x,y) { @@ -2099,12 +2099,12 @@ function getOnePrey(biome, area, sameSize = true) for (let i=0; i areas["Planet"]) { + if (area > things["Planet"].area) { weights = { "Planet": 1.47e-10, "Star": 1.7713746e-12, @@ -2123,7 +2123,7 @@ function getWeights(region, area) { "Multiverse": 1 }; } - else if (area > areas["Town"]) { + else if (area > things["Town"].area) { weights = { "Town": 0.001, "City": 0.0005, diff --git a/recursive-desc.js b/recursive-desc.js index 9a5fc3a..0a8054e 100644 --- a/recursive-desc.js +++ b/recursive-desc.js @@ -111,7 +111,7 @@ function hasNothingElse(container, things) { function nothingLarger(container, thing) { for (var key in container.contents) if (container.contents.hasOwnProperty(key)) - if (areas[key] > areas[thing]) + if (things[key].area > things[thing].area) return false; return true; diff --git a/recursive-macro.js b/recursive-macro.js index e7b9217..761a2b0 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -1,150 +1,460 @@ + +/* + +function defaultSumDST(thing) { + return function() { + var counts = {}; + + if (thing.name != "Container") //if a container is detected, sets counts + counts[thing.name] = thing.count; + + for (var key in thing.contents) { + if (thing.contents.hasOwnProperty(key)) { + var subcount = thing.contents[key].sum(); + for (var subkey in subcount) { + if (!counts.hasOwnProperty(subkey)) { + counts[subkey] = 0; + } + counts[subkey] += subcount[subkey]; + } + } + } + + return counts; + }; +} + +function defaultSumProperty(thing) { + return function(prop) { + var total = 0; + + total += thing[prop] * thing.count; + + for (var key in thing.contents) { + if (thing.contents.hasOwnProperty(key)) { + total += thing.contents[key].sum_property(prop); + } + } + + return total; + }; +} + +function defaultArea(thing) { + return areas[thing.name]; +} + +function DefaultDestructable() { + this.name = this.defaults.name; + this.area = this.defaults.area; + this.mass = this.defaults.mass; + this.sum = defaultSumDST; + this.sum_property = defaultSumProperty; + this.merge = defaultMerge; + this.multiply = defaultMultiply; + this.describeSimple = defaultDescribeSimple; + + return this; +} + +function copy_defaultsDST(self,proto) { + for (var key in proto) { + if (proto.hasOwnProperty(key)) { + self[key] = proto[key](self); + } + } +} + + personVar = { + name: "Person", + area: 0.33, + mass: 80, + clusters: 5, + cluster_chances: .8, + contents: [], + body: [["skinny", -10,0],["fat", 15,.05],["tall", 7, 0],["short",-7,0],["stocky",5,.02],["spindly",-5,-.02],["muscular",7,0],["fit",0,0],["multi-colored",0,0]],//["bodytype", mass modifier, area modifier] + sex: [["male",2,.02],["female",2,.02]],//["sex", mass modifier, area modifier] + species: [["wolf",80,.35],["cat",70,.3],["dog",75,.31],["squirrel",68,.29],["horse",90,.4],["hyena",78,.32],["fox",72,.3],["jackal",74,.32],["crux",90,.33],["sergal",77,.34]],//["species", mass modifier, area modifier] + singular: "person", + plural: "people" + } +function PersonDST(count = 1) { + this.defaults = personVar; + + copy_defaultsDST(this,new DefaultDestructable()); + + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function (verbose=true) { + var body = random_desc(this.properties.body, (verbose ? 0.6 : 0)); + var sex = random_desc(this.properties.sex, (verbose ? 1 : 0)); + var species = random_desc(this.properties.species); + return "a " + merge_desc([body,sex,species]); + }; + + this.describe = function(verbose=true) { + if (verbose) { + if (count <= 3) { + var list = []; + for (var i = 0; i < count; i++) { + list.push(this.describeOne(this.count <= 2)); + } + return merge_things(list); + } else { + return this.count + " people"; + } + } else { + return (this.count > 1 ? this.count + " people" : "a person"); + } + }; + + return this; +} +*/ + + 'use strict'; var things = { - "Container": Container, + "Container": { + "Container": Container, + mass: 0, + area: 0, + clusters: 0, + cluster_chances: 0, + contents: [], + }, //Creatures - "Person": Person, - "Human": Human, - "Cow": Cow, - "Micro": Micro, - "Macro": Macro, + "Person": { + "Person": Person, + mass: 80, + area: .33, + clusters: 5, + cluster_chances: .8, + contents: [], + }, + "Human": { + "Human": Human, + mass: 80, + area: .33, + clusters: 5, + cluster_chances: .8, + contents: [], + }, + "Cow": { + "Cow": Cow, + mass: 300, + area: 2, + clusters: 15, + cluster_chances: .5, + contents: [], + }, + "Micro": { + "Micro": Micro, + mass: .01, + area: .05, + clusters: 50, + cluster_chances: 1, + contents: [[]], + }, + "Macro": { + "Macro": Macro, + mass: 8e4, + area: 100, + clusters: 0, + cluster_chances: 0, + contents: [[]], + }, //Vehicles - "Empty Car": EmptyCar, - "Car": Car, - "Bus": Bus, - "Tram": Tram, - "Train": Train, - "Train Car": TrainCar, + "Empty Car": { + "Empty Car": EmptyCar, + mass: 1000, + area: 4, + clusters: 2, + cluster_chances: .3, + contents: [[]], + }, + "Car": { + "Car": Car, + mass: 1000, + area: 4, + clusters: 4, + cluster_chances: .5, + contents: [["Person",1,4]], + }, + "Bus": { + "Bus": Bus, + mass: 5000, + area: 12, + clusters: 1, + cluster_chances: .25, + contents: [["Person",2,30]], + }, + "Tram": { + "Tram": Tram, + mass: 1e4, + area: 20, + clusters: 1, + cluster_chances: .2, + contents: [["Person",10,50]], + }, + "Train": { + "Train": Train, + mass: 5e4, + area: 40, + clusters: 2, + cluster_chances: .1, + contents: [["Person",1,4,"engine"],["Train Car",2,10]], + }, + "Train Car": { + "Train Car": TrainCar, + mass: 7500, + area: 20, + clusters: 1, + cluster_chances: .05, + contents: [["Person",10,40]], + }, //Buildings - "House": House, - "Business": Business, - "Barn": Barn, - "Small Skyscraper": SmallSkyscraper, - "Large Skyscraper": LargeSkyscraper, - "Parking Garage": ParkingGarage, + "House": { + "House": House, + mass: 1e4, + area: 150, + clusters: 5, + cluster_chances: .5, + contents: [["Person",0,8],["Empty Car",0,2]], + }, + "Business": { + "Business": Business, + mass: 5e4, + area: 400, + clusters: 5, + cluster_chances: .25, + contents: [["Person",0,30],["Car",0,5],["Empty Car",0,20]], + }, + "Barn": { + "Barn": Barn, + mass: 5e3, + area: 300, + clusters: 1, + cluster_chances: .1, + contents: [["Person",0,2],["Cow",30,70]], + }, + "Small Skyscraper": { + "Small Skyscraper": SmallSkyscraper, + mass: 1e7, + area: 1000, + clusters: 2, + cluster_chances: .25, + contents: [["Person",150,750],["Empty Car",10,50]], + }, + "Large Skyscraper": { + "Large Skyscraper": LargeSkyscraper, + mass: 8e7, + area: 2000, + clusters: 1, + cluster_chances: .25, + contents: [["Person",500,1500],["Empty Car",20,100]], + }, + "Parking Garage": { + "Parking Garage": ParkingGarage, + mass: 1e7, + area: 750, + clusters: 1, + cluster_chances: .1, + contents: [["Person",10,200],["Empty Car",100,300],["Car",5,30]], + }, //Places - "Town": Town, - "City": City, - "Continent": Continent, - "Planet": Planet, - "Star": Star, - "Solar System": SolarSystem, - "Galaxy": Galaxy, - "Cluster": Cluster, - "Universe": Universe, - "Multiverse": Multiverse, + "Town": { + "Town": Town, + mass: 1, + area: 1e7, + clusters: 5, + cluster_chances: .1, + contents: [["Person",10000,100000],["House",5000,50000],["Empty Car",200,800],["Car",500,80000],["Bus",5,25],["Train",5,25],["Business",500,5000]], + }, + "City": { + "City": City, + mass: 1, + area: 1e9, + clusters: 0, + cluster_chances: .2, + 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]], + }, + "Continent": { + "Continent": Continent, + mass: 1e21, + area: 1.5e13, + clusters: 5, + cluster_chances: .5, + contents: [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250],["Business",250,1000]], + }, + "Planet": { + "Planet": Planet, + mass: 5.972e24, + area: 2.5e14, + clusters: 0, + cluster_chances: 1, + contents: [["Continent",4,9]], + }, + "Star": { + "Star": Star, + mass: 1e40, + area: 3e18, + clusters: 1, + cluster_chances: 1, + contents: [], + }, + "Solar System": { + "Solar System": SolarSystem, + mass: 1, + area: 3e21, + clusters: 1, + cluster_chances: 1, + contents: [["Star",1,1],["Planet",5,15]], + }, + "Galaxy": { + "Galaxy": Galaxy, + mass: 1, + area: 2e45, + clusters: 1, + cluster_chances: 1, + contents: [["Star",1e9,500e9],["Solar System",1e8,500e8]], + }, + "Cluster": { + "Cluster": Cluster, + mass: 1, + area: 2e49, + clusters: 1, + cluster_chances: 1, + contents: [["Galaxy",200,5000]], + }, + "Universe": { + "Universe": Universe, + mass: 1, + area: 7e53, + clusters: 1, + cluster_chances: 1, + contents: [["Cluster",1.5e9,2.5e9]], + }, + "Multiverse": { + "Multiverse": Multiverse, + mass: 1, + area: 5e56, + clusters: 1, + cluster_chances: 1, + contents: [["Universe",100,1000]], + }, //Military - "Soldier": Soldier, - "Tank": Tank, - "Artillery": Artillery, - "Helicopter": Helicopter, - "Squad": Squad, - "Platoon": Platoon, - "Company": Company, - "Battalion": Battalion, - "Brigade": Brigade, - "Division": Division, - "Tank Division": TankDivision, - "Army": Army, -}; - -var areas = -{ - "Container": 0, -//Creatures - "Person": 0.33, - "Human": 0.33, - "Cow": 2, - "Micro": 0.05, - "Macro": 100, -//Vehicles - "Car": 4, - "Bus": 12, - "Tram": 20, - "Train": 40, - "Train Car": 20, -//Buildings - "House": 150, - "Business": 400, - "Barn": 300, - "Small Skyscraper": 1000, - "Large Skyscraper": 2000, - "Parking Garage": 750, -//Places - "Town": 1e7, - "City": 1e9, - "Continent": 1.5e13, - "Planet": 2.5e14, - "Star": 3e18, - "Solar System": 3e21, - "Galaxy": 2e45, - "Cluster": 2e49, - "Universe": 7e53, - "Multiverse": 5e56, -//Military - "Soldier": 1, - "Tank": 10, - "Artillery": 12, - "Helicopter": 8, - "Squad": 20, - "Platoon": 100, - "Company": 500, - "Battalion": 3000, - "Brigade": 20000, - "Division": 80000, - "Tank Division": 100000, - "Army": 750000, + "Soldier": { + "Soldier": Soldier, + mass: 80, + area: 1, + clusters: 2, + cluster_chances: .2, + contents: [], + }, + "Tank": { + "Tank": Tank, + mass: 5000, + area: 20, + clusters: 2, + cluster_chances: .25, + contents: [["Soldier",3,5]], + }, + "Artillery": { + "Artillery": Artillery, + mass: 7000, + area: 25, + clusters: 3, + cluster_chances: .5, + contents: [["Soldier",4,6]], + }, + "Helicopter": { + "Helicopter": Helicopter, + mass: 1500, + area: 12, + clusters: 0, + cluster_chances: 0, + contents: [["Soldier",4,16]], + }, + "Squad": { + "Squad": Squad, + mass: 1, + area: 30, + clusters: 20, + cluster_chances: .05, + contents: [["Soldier",6,9]], + }, + "Platoon": { + "Platoon": Platoon, + mass: 100, + area: 150, + clusters: 2, + cluster_chances: .1, + contents: [["Soldier",16,44]], + }, + "Company": { + "Company": Company, + mass: 500, + area: 600, + clusters: 2, + cluster_chances: .1, + contents: [["Soldier",60,200]], + }, + "Battalion": { + "Battalion": Battalion, + mass: 1000, + area: 3500, + clusters: 2, + cluster_chances: .1, + contents: [["Soldier",300,1000]], + }, + "Brigade": { + "Brigade": Brigade, + mass: 1500, + area: 2e4, + clusters: 2, + cluster_chances: .1, + contents: [["Soldier",1500,3200]], + }, + "Division": { + "Division": Division, + mass: 2000, + area: 8e4, + clusters: 3, + cluster_chances: .1, + contents: [["Soldier",10000,16000]], + }, + "Tank Division": { + "Tank Division": TankDivision, + mass: 3000, + area: 1e5, + clusters: 1, + cluster_chances: .15, + contents: [["Soldier",8000,1200],["Tank",250,500]], + }, + "Army": { + "Army": Army, + mass: 5000, + area: 1e6, + clusters: 2, + cluster_chances: .1, + contents: [["Soldier",40000,75000]], + }, }; + //Alterante Army Structuring, may be used later + //"Squad": [["Soldier",6,9]], + // "Platoon": [["Squad",3,4]], + //"Company": [["Platoon",3,5],["Squad",0,2]], + //"Battalion": [["Company",4,6]], + //"Brigade": [["Battalion",2,5],["Company",0,3]], + //"Division": [["Brigade",2,4]], + //"Tank Division": [["Brigade",2,4],["Tank",250,500]], + //"Army": [["Division",3,8],["Tank Division",1,5]], -var masses = -{ - "Container": 0, -//Creatures - "Person": 80, - "Human": 80, - "Cow": 300, - "Micro": 0.01, - "Macro": 80000, -//Vehicles - "Car": 1000, - "Bus": 5000, - "Tram": 10000, - "Train": 50000, - "Train Car": 7500, -//Buildings - "House": 10000, - "Business": 50000, - "Barn": 5000, - "Small Skyscraper": 10000000, - "Large Skyscraper": 80000000, - "Parking Garage": 10000000, -//Places - "Town": 1, - "City": 1, - "Continent": 1e21, - "Planet": 5.972e24, - "Star": 1e40, - "Solar System": 1, - "Galaxy": 1, - "Cluster": 1, - "Universe": 1, - "Multiverse": 1, -//Military - "Soldier": 80, - "Tank": 5000, - "Artillery": 7000, - "Helicopter": 1500, - "Squad": 1, - "Platoon": 100, - "Company": 500, - "Battalion": 1000, - "Brigade": 1500, - "Division": 2000, - "Tank Division": 3000, - "Army": 5000, -}; var clusters = { @@ -337,18 +647,18 @@ function contents_insert(parent,thing,min,max,label) { owner.push([thing,min,max,label]); } -function initContents(name,count) { +function initContents(name,count) { //builds the contents for each destrucable(thing) when called let result = {}; - let type = contents[name]; + let type = things[name].contents; for (let i=0; i 0) { // if a custom label is supplied, use it! - if (type[i].length == 4) - result[type[i][3]] = new things[type[i][0]](amount); + if (type[i].length == 4) //if has optional name + result[type[i][3]] = new things[type[i][0]][type[i][0]](amount); //creates a "thing name" under the key of "optional name" else - result[type[i][0]] = new things[type[i][0]](amount); + result[type[i][0]] = new things[type[i][0]][type[i][0]](amount); } } @@ -377,7 +687,7 @@ function fill_area(area, weights, variance=0.15) var candidates = []; for (var key in weights) { if (weights.hasOwnProperty(key)) { - candidates.push({"name": key, "area": areas[key], "weight": weights[key]}); + candidates.push({"name": key, "area": things[key].area, "weight": weights[key]}); } } @@ -430,7 +740,7 @@ function fill_area(area, weights, variance=0.15) area -= count * candidate.area; if (count > 0) - result.push(new things[candidate.name](count)); + result.push(new things[candidate.name][candidate.name](count)); } return new Container(result); @@ -535,18 +845,17 @@ function defaultMultiply(thing) { } function defaultArea(thing) { - return areas[thing.name]; + return things[thing.name].area; } function defaultMass(thing) { - return masses[thing.name]; + return things[thing.name].mass; } -function defaultMerge(thing) { +function defaultMerge(thing) { //this merges all objects into one containers return function(container) { var newCount = this.count + container.count; - - var newThing = new things[thing.name](newCount); + var newThing = new things[thing.name][thing.name](newCount); newThing.contents = {}; for (var key in this.contents) { @@ -573,7 +882,7 @@ function listSum(sum) { let result = []; for (let key in sum) { if (sum.hasOwnProperty(key)) { - result.push(new things[key](sum[key]).describe(false)); + result.push(new things[key][key](sum[key]).describe(false)); } } @@ -588,7 +897,7 @@ function flatten(thing) { let list = []; Object.entries(dict).forEach(function([key, val]) { - let obj = new things[key](val); + let obj = new things[key][key](val); obj.contents = []; @@ -680,8 +989,8 @@ function DefaultEntity() { // god I love reinventing the wheel -function copy_defaults(self,proto) { - for (var key in proto) { +function copy_defaults(self,proto) { //loads the values defined in things into the fuction that calls it + for (var key in proto) { //proto will always be a new DefaultEntity, self is the parent function if (proto.hasOwnProperty(key)) { self[key] = proto[key](self); } @@ -727,9 +1036,9 @@ function Person(count = 1) { this.describeOne = function (verbose=true) { var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","multi-colored"], (verbose ? 0.6 : 0)); - var sex = random_desc(["male", "female"], (verbose ? 1 : 0)); + var sex = random_desc(["male", "female"], (verbose ? 0.75 : 0)); var species = ""; - species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal"]); + species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal","coyote","rabbit","lizard","avian"]); return "a " + merge_desc([body,sex,species]); }; @@ -1567,3 +1876,15 @@ function Army(count = 1) { } }; } + + + + //todo + //redo everything + //airports + //farms + //racetracks + //more building types + //nebula + //grand army + //armada \ No newline at end of file From c56d3fe2aa799c7759b52c59aa1fea180882e9df Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Mon, 23 Dec 2019 01:16:31 -0500 Subject: [PATCH 02/14] Refector of things in recurcive-desc 2 Finished refactor of recursive-macro removed now useless comments at beginning of file all default values now stored in things all calls should be redirected to call the appropriate values in things added ability to chose and add a or an to text in merge_desc removed "a " + from functions that called merge_desc --- recursive-macro.js | 325 ++++++--------------------------------------- 1 file changed, 38 insertions(+), 287 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index eb2edd6..c5e119a 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -1,119 +1,3 @@ - -/* - -function defaultSumDST(thing) { - return function() { - var counts = {}; - - if (thing.name != "Container") //if a container is detected, sets counts - counts[thing.name] = thing.count; - - for (var key in thing.contents) { - if (thing.contents.hasOwnProperty(key)) { - var subcount = thing.contents[key].sum(); - for (var subkey in subcount) { - if (!counts.hasOwnProperty(subkey)) { - counts[subkey] = 0; - } - counts[subkey] += subcount[subkey]; - } - } - } - - return counts; - }; -} - -function defaultSumProperty(thing) { - return function(prop) { - var total = 0; - - total += thing[prop] * thing.count; - - for (var key in thing.contents) { - if (thing.contents.hasOwnProperty(key)) { - total += thing.contents[key].sum_property(prop); - } - } - - return total; - }; -} - -function defaultArea(thing) { - return areas[thing.name]; -} - -function DefaultDestructable() { - this.name = this.defaults.name; - this.area = this.defaults.area; - this.mass = this.defaults.mass; - this.sum = defaultSumDST; - this.sum_property = defaultSumProperty; - this.merge = defaultMerge; - this.multiply = defaultMultiply; - this.describeSimple = defaultDescribeSimple; - - return this; -} - -function copy_defaultsDST(self,proto) { - for (var key in proto) { - if (proto.hasOwnProperty(key)) { - self[key] = proto[key](self); - } - } -} - - personVar = { - name: "Person", - area: 0.33, - mass: 80, - clusters: 5, - cluster_chances: .8, - contents: [], - body: [["skinny", -10,0],["fat", 15,.05],["tall", 7, 0],["short",-7,0],["stocky",5,.02],["spindly",-5,-.02],["muscular",7,0],["fit",0,0],["multi-colored",0,0]],//["bodytype", mass modifier, area modifier] - sex: [["male",2,.02],["female",2,.02]],//["sex", mass modifier, area modifier] - species: [["wolf",80,.35],["cat",70,.3],["dog",75,.31],["squirrel",68,.29],["horse",90,.4],["hyena",78,.32],["fox",72,.3],["jackal",74,.32],["crux",90,.33],["sergal",77,.34]],//["species", mass modifier, area modifier] - singular: "person", - plural: "people" - } -function PersonDST(count = 1) { - this.defaults = personVar; - - copy_defaultsDST(this,new DefaultDestructable()); - - this.count = count; - this.contents = initContents(this.name,this.count); - - this.describeOne = function (verbose=true) { - var body = random_desc(this.properties.body, (verbose ? 0.6 : 0)); - var sex = random_desc(this.properties.sex, (verbose ? 1 : 0)); - var species = random_desc(this.properties.species); - return "a " + merge_desc([body,sex,species]); - }; - - this.describe = function(verbose=true) { - if (verbose) { - if (count <= 3) { - var list = []; - for (var i = 0; i < count; i++) { - list.push(this.describeOne(this.count <= 2)); - } - return merge_things(list); - } else { - return this.count + " people"; - } - } else { - return (this.count > 1 ? this.count + " people" : "a person"); - } - }; - - return this; -} -*/ - - 'use strict'; var things = @@ -455,160 +339,6 @@ var things = //"Tank Division": [["Brigade",2,4],["Tank",250,500]], //"Army": [["Division",3,8],["Tank Division",1,5]], - -var clusters = -{ - "Container": 0, -//Creatures - "Person": 5, - "Human": 5, - "Cow": 15, - "Micro": 50, - "Macro": 0, -//Vehicles - "Car": 3, - "Bus": 1, - "Tram": 1, - "Train": 2, - "Train Car": 1, -//Buildings - "House": 5, - "Business": 5, - "Barn": 1, - "Small Skyscraper": 2, - "Large Skyscraper": 1, - "Parking Garage": 1, -//Places - "Town": 5, - "City": 1, - "Continent": 5, - "Planet": 9, - "Star": 1, - "Solar System": 1, - "Galaxy": 1, - "Cluster": 1, - "Universe": 1, - "Multiverse": 1, -//Military - "Soldier": 0, - "Tank": 0, - "Artillery": 0, - "Helicopter": 0, - "Squad": 20, - "Platoon": 2, - "Company": 2, - "Battalion": 2, - "Brigade": 2, - "Division": 3, - "Tank Division": 1, - "Army": 2, -}; - -var cluster_chances = -{ - "Container": 0, -//Creatures - "Person": 0.8, - "Human": 0.8, - "Cow": 0.5, - "Micro": 1, - "Macro": 0, -//Vehicles - "Car": 0.5, - "Bus": 0.25, - "Tram": 0.2, - "Train": 0.1, - "Train Car": 0.05, -//Buildings - "House": 0.5, - "Business": .05, - "Barn": 0.1, - "Small Skyscraper": 0.25, - "Large Skyscraper": 0.25, - "Parking Garage": 0.1, -//Places - "Town": 0.1, - "City": 0.2, - "Continent": 0.5, - "Planet": 1, - "Star": 1, - "Solar System": 1, - "Galaxy": 1, - "Cluster": 1, - "Universe": 1, - "Multiverse": 1, -//Military - "Soldier": 0, - "Tank": 0, - "Artillery": 0, - "Helicopter": 0, - "Squad": .05, - "Platoon": .05, - "Company": .1, - "Battalion": .1, - "Brigade": .1, - "Division": .1, - "Tank Division": 0.15, - "Army": .1, -}; - -var contents = -{ - "Container": [], -//Creatures - "Person": [], - "Human": [], - "Cow": [], - "Micro": [[]], - "Macro": [[]], -//Vehicles - "Car": [["Person",1,4]], - "Bus": [["Person",2,30]], - "Tram": [["Person",10,50]], - "Train": [["Person",1,4,"engine"],["Train Car",2,10]], - "Train Car": [["Person",10,40]], -//Buildings - "House": [["Person",0,8],["Empty Car",0,2]], - "Business": [["Person",0,30],["Car",0,20]], - "Barn": [["Person",0,2],["Cow",30,70]], - "Small Skyscraper": [["Person",150,750],["Empty Car",10,50]], - "Large Skyscraper": [["Person",500,1500],["Empty Car",20,100]], - "Parking Garage": [["Person",10,200],["Empty Car",100,300],["Car",5,30]], -//Places - "Town": [["Person",10000,100000],["House",5000,50000],["Empty Car",200,800],["Car",500,80000],["Bus",5,25],["Train",5,25],["Business",500,5000]], - "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]], - "Continent": [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250],["Business",250,1000]], - "Planet": [["Continent",4,9]], - "Star": [], - "Solar System": [["Star",1,1],["Planet",5,15]], - "Galaxy": [["Star",1e9,500e9],["Solar System",1e8,500e8]], - "Cluster": [["Galaxy",200,5000]], - "Universe": [["Cluster",1.5e9,2.5e9]], - "Multiverse": [["Universe",100,1000]], -//Military - "Soldier": [], - "Tank": [["Soldier",3,5]], - "Artillery": [["Soldier",4,6]], - "Helicopter": [["Soldier",4,16]], - //Alterante Army Structuring, may be used later - //"Squad": [["Soldier",6,9]], - // "Platoon": [["Squad",3,4]], - //"Company": [["Platoon",3,5],["Squad",0,2]], - //"Battalion": [["Company",4,6]], - //"Brigade": [["Battalion",2,5],["Company",0,3]], - //"Division": [["Brigade",2,4]], - //"Tank Division": [["Brigade",2,4],["Tank",250,500]], - //"Army": [["Division",3,8],["Tank Division",1,5]], - "Squad": [["Soldier",6,9]], - "Platoon": [["Soldier",16,44]], - "Company": [["Soldier",60,200]], - "Battalion": [["Soldier",300,1000]], - "Brigade": [["Soldier",1500,3200]], - "Division": [["Soldier",10000,16000]], - "Tank Division": [["Soldier",8000,1200],["Tank",250,500]], - "Army": [["Soldier",40000,75000]], -}; - // replace all instances of from with to function contents_substitute(from,to) { for (let key in contents) { @@ -640,7 +370,7 @@ function contents_remove(thing) { // adds thing to parent function contents_insert(parent,thing,min,max,label) { - let owner = contents[parent]; + let owner = things[parent].contents; if (label == undefined) owner.push([thing,min,max]); else @@ -718,8 +448,8 @@ function fill_area(area, weights, variance=0.15) if (loopvar == 0 && result.length == 0) { ++count; } - else if (loopvar <= clusters[candidate.name]) { - if (Math.random() < candidate.weight ? 1 : Math.random() < cluster_chances[candidate.name]) { + else if (loopvar <= things[candidate.name].clusters) { + if (Math.random() < candidate.weight ? 1 : Math.random() < things[candidate.name].cluster_chances) { ++count; } } @@ -799,6 +529,25 @@ function merge_desc(list) { if (result.length > 0) { result = result.substring(0, result.length - 1); } + //a/an overwriting terms + let forcedTerms = ["honor","heir"]; //words that need to start with an but don't start with a,e,i,o,u + let force = false; + for (let i of forcedTerms){ + if (i === result.substring(0, i.length)){force = true;} + } + + let exceptionTerms = ["uniform","unique"]; //words that need to start with a and start with a,e,i,o,u + let exception = false; + for (let i of exceptionTerms){ + if (i === result.substring(0, i.length)){exception = true;} + } + //check if the string should start with a or an + 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")))){ + result = "an " + result; + }else{ + result = "a " + result; + } + return result; } @@ -1030,6 +779,7 @@ function Person(count = 1) { copy_defaults(this,new DefaultEntity()); + this.mass = ((Math.random() -.5)*20)+this.mass; this.count = count; this.contents = initContents(this.name,this.count); @@ -1038,7 +788,7 @@ function Person(count = 1) { var sex = random_desc(["male", "female"], (verbose ? 0.75 : 0)); var species = ""; species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal","coyote","rabbit","lizard","avian"]); - return "a " + merge_desc([body,sex,species]); + return merge_desc([body,sex,species]); }; this.describe = function(verbose=true) { @@ -1065,13 +815,14 @@ function Human(count = 1) { copy_defaults(this,new DefaultEntity()); + this.mass = ((Math.random() -.5)*20)+this.mass; this.count = count; this.contents = initContents(this.name,this.count); this.describeOne = function (verbose=true) { var body = random_desc(["skinny","fat","tall","short","stocky","spindly","muscular","fit","tanned"], (verbose ? 0.6 : 0)); var sex = random_desc(["man", "woman"], 1); - return "a " + merge_desc([body,sex]); + return merge_desc([body,sex]); }; this.describe = function(verbose=true) { @@ -1104,7 +855,7 @@ function Cow(count = 1) { this.describeOne = function (verbose=true) { var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0)); var sex = random_desc(["male", "female"], (verbose ? 1 : 0)); - return "a " + merge_desc([body,sex,"cow"]); + return merge_desc([body,sex,"cow"]); }; this.describe = function(verbose=true) { @@ -1137,7 +888,7 @@ function EmptyCar(count = 1) { var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]); var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"],0.3); var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]); - return "a parked " + merge_desc([adjective,color,type]); + return merge_desc(["parked",adjective,color,type]); }; this.describe = function(verbose = true) { @@ -1169,7 +920,7 @@ function Car(count = 1) { var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0)); var adjective = random_desc(["rusty","brand-new","luxury","beat-up","dented","restored","classic"], (verbose ? 0.3 : 0)); var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]); - return "a " + merge_desc([adjective,color,type]); + return merge_desc([adjective,color,type]); }; this.describe = function(verbose = true) { @@ -1201,7 +952,7 @@ function Bus(count = 1) { var adjective = random_desc(["rusty","brand-new","aging","modern"], (verbose ? 0.3 : 0)); var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0)); var type = random_desc(["bus","double-decker bus","articulating bus","open-top bus","sleeper bus","intercity bus"]); - return "a " + merge_desc([adjective,color,type]); + return merge_desc([adjective,color,type]); }; this.describe = function(verbose = true) { @@ -1233,7 +984,7 @@ function Tram(count = 1) { var adjective = random_desc(["rusty","weathered","well-maintained",], (verbose ? 0.3 : 0)); var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0)); var type = random_desc(["tram"]); - return "a " + merge_desc([adjective,color,type]); + return merge_desc([adjective,color,type]); }; this.describe = function(verbose = true) { @@ -1268,7 +1019,7 @@ function Train(count = 1) { var adjective = random_desc(["rusty","brand-new","steam","freshly-painted"], (verbose ? 0.3 : 0)); var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0)); var type = random_desc(["train","passenger train","freight train"]); - return "a " + merge_desc([adjective,color,type]); + return merge_desc([adjective,color,type]); }; this.describe = function(verbose = true) { @@ -1305,7 +1056,7 @@ function TrainCar(count = 1) { var adjective = random_desc(["rusty","brand-new","vintage","graffitied","well-maintained"], (verbose ? 0.3 : 0)); var color = random_desc(["black","tan","gray","yellow","steel","wooden"], (verbose ? 1 : 0)); var type = random_desc(["train car","passenger train car","freight train car"]); - return "a " + merge_desc([adjective,color,type]); + return merge_desc([adjective,color,type]); }; this.describe = function(verbose = true) { @@ -1327,7 +1078,7 @@ function House(count = 1) { var size = random_desc(["little","two-story","large","well-built","run-down","cheap",], (verbose ? 0.5 : 0)); var color = random_desc(["blue","white","gray","tan","green","wooden","brick"], (verbose ? 0.5 : 0)); var name = random_desc(["house","home","house","house","house","trailer"], 1); - return "a " + merge_desc([size,color,name]); + return merge_desc([size,color,name]); }; this.describe = function(verbose = true) { @@ -1357,7 +1108,7 @@ function Business(count = 1) { var size = random_desc(["little","two-story","large","well-built","run-down","cheap","aging","corner"], (verbose ? 0.5 : 0)); var color = random_desc(["blue","white","gray","tan","green","brick","concrete"], (verbose ? 0.5 : 0)); 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); - return "a " + merge_desc([size,color,name]); + return merge_desc([size,color,name]); }; this.describe = function(verbose = true) { @@ -1387,7 +1138,7 @@ function Barn(count = 1) { var size = random_desc(["little","big","large","weathered","rotted","new"], (verbose ? 0.5 : 0)); var color = random_desc(["blue","white","gray","tan","green","red"], (verbose ? 0.5 : 0)); var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1); - return "a " + merge_desc([size,color,name]); + return merge_desc([size,color,name]); }; this.describe = function(verbose = true) { @@ -1416,7 +1167,7 @@ function SmallSkyscraper(count = 1) { this.describeOne = function(verbose=true) { var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); var name = random_desc(["skyscraper","office tower","office building","high rise"], 1); - return "a " + merge_desc([color,name]); + return merge_desc([color,name]); }; this.describe = function(verbose = true) { @@ -1446,7 +1197,7 @@ function LargeSkyscraper(count = 1) { this.describeOne = function(verbose=true) { var color = random_desc(["blue","white","gray","tan","green","glass"], (verbose ? 0.5 : 0)); var name = random_desc(["skyscraper","office tower","office building"], 1); - return "a " + merge_desc(["towering",color,name]); + return merge_desc(["towering",color,name]); }; this.describe = function(verbose = true) { From b449bf797df202dc15d8d0085a3eb4714e24f630 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Wed, 25 Dec 2019 13:45:16 -0500 Subject: [PATCH 03/14] recursive-desc refactor 3 Implemented a function to handle repeated description logic, added duplex text option to house --- recursive-macro.js | 75 +++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index c5e119a..d56ccd9 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -19,6 +19,7 @@ var things = clusters: 5, cluster_chances: .8, contents: [], + descriptor: ["a person", "people"] }, "Human": { "Human": Human, @@ -27,6 +28,7 @@ var things = clusters: 5, cluster_chances: .8, contents: [], + descriptor: ["a person", "people"] }, "Cow": { "Cow": Cow, @@ -35,6 +37,7 @@ var things = clusters: 15, cluster_chances: .5, contents: [], + descriptor: ["a cow", "cattle"] }, "Micro": { "Micro": Micro, @@ -43,6 +46,7 @@ var things = clusters: 50, cluster_chances: 1, contents: [[]], + descriptor: ["a micro", "micros"] }, "Macro": { "Macro": Macro, @@ -51,6 +55,7 @@ var things = clusters: 0, cluster_chances: 0, contents: [[]], + descriptor: ["a smaller macro", "smaller macros"] }, //Vehicles "Empty Car": { @@ -60,6 +65,7 @@ var things = clusters: 2, cluster_chances: .3, contents: [[]], + descriptor: ["a parked car", "parked cars"] }, "Car": { "Car": Car, @@ -68,6 +74,7 @@ var things = clusters: 4, cluster_chances: .5, contents: [["Person",1,4]], + descriptor: ["a car", "cars"] }, "Bus": { "Bus": Bus, @@ -76,6 +83,7 @@ var things = clusters: 1, cluster_chances: .25, contents: [["Person",2,30]], + descriptor: ["a bus", "busses"] }, "Tram": { "Tram": Tram, @@ -84,6 +92,7 @@ var things = clusters: 1, cluster_chances: .2, contents: [["Person",10,50]], + descriptor: ["a tram", "trams"] }, "Train": { "Train": Train, @@ -109,6 +118,7 @@ var things = clusters: 5, cluster_chances: .5, contents: [["Person",0,8],["Empty Car",0,2]], + descriptor: ["house", "houses"] }, "Business": { "Business": Business, @@ -117,6 +127,7 @@ var things = clusters: 5, cluster_chances: .25, contents: [["Person",0,30],["Car",0,5],["Empty Car",0,20]], + descriptor: ["a local business", "buildings"] }, "Barn": { "Barn": Barn, @@ -125,6 +136,7 @@ var things = clusters: 1, cluster_chances: .1, contents: [["Person",0,2],["Cow",30,70]], + descriptor: ["a barn", "barns"] }, "Small Skyscraper": { "Small Skyscraper": SmallSkyscraper, @@ -133,6 +145,7 @@ var things = clusters: 2, cluster_chances: .25, contents: [["Person",150,750],["Empty Car",10,50]], + descriptor: ["a small skyscraper", "small skyscrapers"] }, "Large Skyscraper": { "Large Skyscraper": LargeSkyscraper, @@ -141,6 +154,7 @@ var things = clusters: 1, cluster_chances: .25, contents: [["Person",500,1500],["Empty Car",20,100]], + descriptor: ["a large skyscraper", "large skyscrapers"] }, "Parking Garage": { "Parking Garage": ParkingGarage, @@ -745,6 +759,31 @@ function copy_defaults(self,proto) { //loads the values defined in things into t } } +function defaultDescribe(verbose=true, parent){ + if (verbose) { + if (parent.count <= 3) { + var list = []; + for (var i = 0; i < parent.count; i++) { + list.push(parent.describeOne(parent.count <= 2)); + } + if (parent.contents == []){ + return merge_things(list); + } else { + return merge_things(list) + " with " + describe_all(parent.contents,verbose) + " inside"; + } + } else { + if (parent.contents == []){ + return parent.count + " " + things[parent.name].descriptor[1]; + } else { + return parent.count + " homes with " + describe_all(parent.contents,verbose) + " inside"; + } + } + } else {//not verbose + return (parent.count > 1 ? parent.count + " " + things[parent.name].descriptor[1] : things[parent.name].descriptor[0]); + } +} + + function Container(contents = []) { this.name = "Container"; @@ -792,26 +831,14 @@ function Person(count = 1) { }; this.describe = function(verbose=true) { - if (verbose) { - if (count <= 3) { - var list = []; - for (var i = 0; i < count; i++) { - list.push(this.describeOne(this.count <= 2)); - } - return merge_things(list); - } else { - return this.count + " people"; - } - } else { - return (this.count > 1 ? this.count + " people" : "a person"); - } - }; + return defaultDescribe(verbose, this); + } return this; } function Human(count = 1) { - this.name = "Person"; + this.name = "Human"; copy_defaults(this,new DefaultEntity()); @@ -826,20 +853,8 @@ function Human(count = 1) { }; this.describe = function(verbose=true) { - if (verbose) { - if (count <= 3) { - var list = []; - for (var i = 0; i < count; i++) { - list.push(this.describeOne(this.count <= 2)); - } - return merge_things(list); - } else { - return this.count + " people"; - } - } else { - return (this.count > 1 ? this.count + " people" : "a person"); - } - }; + return defaultDescribe(verbose, this); + } return this; } @@ -1077,7 +1092,7 @@ function House(count = 1) { this.describeOne = function(verbose=true) { var size = random_desc(["little","two-story","large","well-built","run-down","cheap",], (verbose ? 0.5 : 0)); var color = random_desc(["blue","white","gray","tan","green","wooden","brick"], (verbose ? 0.5 : 0)); - var name = random_desc(["house","home","house","house","house","trailer"], 1); + var name = random_desc(["house","home","duplex","house","house","trailer"], 1); return merge_desc([size,color,name]); }; From 65cabe9e0443a6fc88988bb58292cb9c664bbe9c Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Wed, 25 Dec 2019 13:45:52 -0500 Subject: [PATCH 04/14] fixed typo in cumming text changed "plaent" to "planet" --- recursive-desc.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recursive-desc.js b/recursive-desc.js index 840df36..bc27f69 100644 --- a/recursive-desc.js +++ b/recursive-desc.js @@ -3763,7 +3763,7 @@ rules["male-orgasm"].push({ isFatal(macro); }, "desc": function(container, macro, spurtVolume) { - return "You're cumming! Your " + macro.describeDick + " launches $VOLUMEs of frothing load into the atmosphere. As the ocean of cum roars across the plaent, it smashes through " + container.describe(verbose) + "."; + return "You're cumming! Your " + macro.describeDick + " launches $VOLUMEs of frothing load into the atmosphere. As the ocean of cum roars across the planet, it smashes through " + container.describe(verbose) + "."; } }); @@ -3775,7 +3775,7 @@ rules["male-orgasm"].push({ isGory(macro); }, "desc": function(container, macro, spurtVolume) { - return "You're cumming! Your " + macro.describeDick + " launches $VOLUMEs of frothing load into the atmosphere. As the ocean of cum roars across the plaent, it smashes through " + container.describe(verbose) + ". Everything your semen rolls across \ + return "You're cumming! Your " + macro.describeDick + " launches $VOLUMEs of frothing load into the atmosphere. As the ocean of cum roars across the planet, it smashes through " + container.describe(verbose) + ". Everything your semen rolls across \ is basted to smithereens as it carves a deep chasm. The destroyed buildings and people it swept along are deposited at the sides of the chasm, forming an unstable wall of gore and rubble."; } }); @@ -3788,7 +3788,7 @@ rules["male-orgasm"].push({ isSadistic(macro); }, "desc": function(container, macro, spurtVolume) { - return "You're cumming! Your " + macro.describeDick + " launches $VOLUMEs of frothing load into the atmosphere. As the ocean of cum roars across the plaent, it smashes through " + container.describe(verbose) + ". Everything your semen rolls across \ + return "You're cumming! Your " + macro.describeDick + " launches $VOLUMEs of frothing load into the atmosphere. As the ocean of cum roars across the planet, it smashes through " + container.describe(verbose) + ". Everything your semen rolls across \ is basted to smithereens as it carves a deep gore lined chasm that extends from where it landed to the ocean. As it hits the ocean the resulting wave reverses the tide, dashes ships, and turns the water into an inhabitable murky soup. The destroyed \ buildings and people it swept along are deposited at the bottom of the bay."; } From d58145c5a1c0a07b25e969d1238988255046a837 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Wed, 25 Dec 2019 13:47:24 -0500 Subject: [PATCH 05/14] recursive-macro refactor 4 changed some biome weights to add more variety changed where victimsHuman flag rewrites person --- game.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game.js b/game.js index ac18a8d..ae4520e 100644 --- a/game.js +++ b/game.js @@ -1808,6 +1808,7 @@ const biomeEnum = { biomeWeights: { //Weights determine if and how often you run into something while inside of a biome "Car": 0.1, "Bus": 0.05, + "Tram": 0.03, "Business": 0.075, "Parking Garage": 0.003, "Small Skyscraper": 0.06, @@ -1817,10 +1818,11 @@ const biomeEnum = { enabled: "ruralEnabled", biomeSize: [4000,8000], //[min,max] Note: this is the distance you will walk until getting to the end of the biome biomeWeights: { //Weights determine if and how often you run into something while inside of a biome - "Cow": 0, + "Cow": 0.005, "House": 0.1, "Barn": 0.08, "Car": 0.1, + "Train": 0.002, "Business": 0.075, "Town": 0.00001 }}, @@ -5314,7 +5316,7 @@ function startGame(e) { if (macro.victimsHuman) { // eh this is ok - things["Person"] = Human; + things["Person"]["Person"] = Human; } if (macro.victimsMacros) { From ff53f1f529f80ea4a2c4e143b29e416062dcf28d Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Wed, 25 Dec 2019 15:58:35 -0500 Subject: [PATCH 06/14] Refactor 5 Added defualtDescribe to a bunch of things that were using it. Made defautlDescribe work correctly Fixed issue I cause in previous commit where humans counted as 0 prey --- recursive-macro.js | 215 +++++++++------------------------------------ 1 file changed, 43 insertions(+), 172 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index d56ccd9..04bbc65 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -766,16 +766,16 @@ function defaultDescribe(verbose=true, parent){ for (var i = 0; i < parent.count; i++) { list.push(parent.describeOne(parent.count <= 2)); } - if (parent.contents == []){ + if (things[parent.name].contents.length <= 1){ return merge_things(list); } else { - return merge_things(list) + " with " + describe_all(parent.contents,verbose) + " inside"; + return merge_things(list) + " with " + describe_all(parent.contents,verbose) + " inside"; } } else { - if (parent.contents == []){ + if (things[parent.name].contents.length <= 1){ return parent.count + " " + things[parent.name].descriptor[1]; } else { - return parent.count + " homes with " + describe_all(parent.contents,verbose) + " inside"; + return parent.count + " " + things[parent.name].descriptor[1] +" with " + describe_all(parent.contents,verbose) + " inside"; } } } else {//not verbose @@ -838,7 +838,7 @@ function Person(count = 1) { } function Human(count = 1) { - this.name = "Human"; + this.name = "Person"; copy_defaults(this,new DefaultEntity()); @@ -874,20 +874,8 @@ function Cow(count = 1) { }; this.describe = function(verbose=true) { - if (verbose) { - if (count <= 3) { - var list = []; - for (var i = 0; i < count; i++) { - list.push(this.describeOne(this.count <= 2)); - } - return merge_things(list); - } else { - return this.count + " cattle"; - } - } else { - return (this.count > 1 ? this.count + " cattle" : "a cow"); - } - }; + return defaultDescribe(verbose, this); + } return this; } @@ -906,22 +894,9 @@ function EmptyCar(count = 1) { return merge_desc(["parked",adjective,color,type]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne()); - } - return merge_things(list); - } else { - return this.count + " parked cars"; - } - } else { - return (this.count > 1 ? this.count + " parked cars" : "a parked car"); - } - - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Car(count = 1) { @@ -938,22 +913,9 @@ function Car(count = 1) { return merge_desc([adjective,color,type]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " cars with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " cars" : "a car"); - } - - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Bus(count = 1) { @@ -970,22 +932,9 @@ function Bus(count = 1) { return merge_desc([adjective,color,type]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " buses with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " buses" : "a bus"); - } - - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Tram(count = 1) { @@ -1002,21 +951,9 @@ function Tram(count = 1) { return merge_desc([adjective,color,type]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count == 1) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(verbose)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " trams with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " trams" : "a tram"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } this.anal_vore = function() { return "You slide " + this.describe() + " up your tight ass"; @@ -1096,21 +1033,9 @@ function House(count = 1) { return merge_desc([size,color,name]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " homes with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " houses" : "a house"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } //might split this into a general business and resutrant categories function Business(count = 1) { @@ -1126,21 +1051,9 @@ function Business(count = 1) { return merge_desc([size,color,name]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose); - } else { - return this.count + " local business containing " + describe_all(this.contents,verbose); - } - } else { - return (this.count > 1 ? this.count + " buildings" : "a local business"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Barn(count = 1) { @@ -1156,21 +1069,9 @@ function Barn(count = 1) { return merge_desc([size,color,name]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " barns with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " barns" : "a barn"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function SmallSkyscraper(count = 1) { @@ -1185,22 +1086,9 @@ function SmallSkyscraper(count = 1) { return merge_desc([color,name]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper"); - } - - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function LargeSkyscraper(count = 1) { @@ -1215,21 +1103,9 @@ function LargeSkyscraper(count = 1) { return merge_desc(["towering",color,name]); }; - this.describe = function(verbose = true) { - if (verbose) { - if (this.count <= 3) { - var list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); - } - return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; - } else { - return this.count + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside"; - } - } else { - return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function ParkingGarage(count = 1) { @@ -1242,13 +1118,9 @@ function ParkingGarage(count = 1) { return "a parking garage"; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a parking garage" : this.count + " parking garages"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Town(count = 1) { this.name = "Town"; @@ -1473,9 +1345,9 @@ function Micro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - return (this.count == 1 ? "a micro" : this.count + " micros"); - }; + tthis.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Macro(count = 1) { @@ -1485,9 +1357,9 @@ function Macro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - return (this.count == 1 ? "a smaller macro" : this.count + " smaller macros"); - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Squad(count = 1) { @@ -1645,7 +1517,6 @@ function Army(count = 1) { //todo - //redo everything //airports //farms //racetracks From 2767215b6b6bcb00cbefaf3dc501536a795a2c48 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Wed, 25 Dec 2019 17:45:40 -0500 Subject: [PATCH 07/14] Actually fixed defaultDescribe I had the if conditions wrong, corrected --- recursive-macro.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index 04bbc65..d01374b 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -766,16 +766,16 @@ function defaultDescribe(verbose=true, parent){ for (var i = 0; i < parent.count; i++) { list.push(parent.describeOne(parent.count <= 2)); } - if (things[parent.name].contents.length <= 1){ - return merge_things(list); + if (things[parent.name].contents.length > 0){ + return merge_things(list) + " with " + describe_all(parent.contents,verbose) + " inside"; } else { - return merge_things(list) + " with " + describe_all(parent.contents,verbose) + " inside"; + return merge_things(list); } } else { - if (things[parent.name].contents.length <= 1){ - return parent.count + " " + things[parent.name].descriptor[1]; - } else { + if (things[parent.name].contents.length > 0){ return parent.count + " " + things[parent.name].descriptor[1] +" with " + describe_all(parent.contents,verbose) + " inside"; + } else { + return parent.count + " " + things[parent.name].descriptor[1]; } } } else {//not verbose @@ -1522,5 +1522,6 @@ function Army(count = 1) { //racetracks //more building types //nebula + //chemical factory //grand army //armada \ No newline at end of file From cdd6b0e8aac3857df909c0f26d9f8c85818878c9 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Thu, 26 Dec 2019 23:34:52 -0500 Subject: [PATCH 08/14] Refactor 6 improved how merge_desc works gave more fade time on the text modes as text was fading too fast to read before --- game.js | 4 ++-- recursive-macro.js | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/game.js b/game.js index ae4520e..45bd110 100644 --- a/game.js +++ b/game.js @@ -48,12 +48,12 @@ const textFadeChoices = { }, dims: { name: "Text Dims", - animation: "log-dim 10s linear", + animation: "log-dim 15s linear", next: "fades" }, fades: { name: "Text Fades", - animation: "log-fade 10s linear", + animation: "log-fade 20s linear", next: "stays" } }; diff --git a/recursive-macro.js b/recursive-macro.js index d01374b..bf69a45 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -543,6 +543,7 @@ function merge_desc(list) { if (result.length > 0) { result = result.substring(0, result.length - 1); } + let article = "a " //a/an overwriting terms let forcedTerms = ["honor","heir"]; //words that need to start with an but don't start with a,e,i,o,u let force = false; @@ -555,14 +556,11 @@ function merge_desc(list) { for (let i of exceptionTerms){ if (i === result.substring(0, i.length)){exception = true;} } - //check if the string should start with a or an + //check if the string should start with an 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")))){ - result = "an " + result; - }else{ - result = "a " + result; + article = "an "; } - - + result = article + result; return result; } From 83e2375ed517f3d60096db2ba7bb5021ca2999e3 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Thu, 26 Dec 2019 23:40:11 -0500 Subject: [PATCH 09/14] Fixed some typos fixed typos in stomp and stench flavor texts --- recursive-desc.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/recursive-desc.js b/recursive-desc.js index bc27f69..0f5d4ff 100644 --- a/recursive-desc.js +++ b/recursive-desc.js @@ -772,7 +772,7 @@ function defaultSoulAbsorbPaw(container, macro, verbose, flat) { function defaultPawStench(container, macro, verbose, flat) { let sum = get_living_prey(container.sum()); if (isSadistic(macro)) - return "Horrific miasma flows from your " + macro.footDesc(true)+ ", the corrsoive fumes reducing " + (sum > 1 ? sum + " people" : "a person") + " to charred flesh as they wash over " + container.describeSimple(flat) + "."; + return "Horrific miasma flows from your " + macro.footDesc(true)+ ", the corrosive fumes reducing " + (sum > 1 ? sum + " people" : "a person") + " to charred flesh as they wash over " + container.describeSimple(flat) + "."; if (isFatal(macro)) return "Vile fumes waft from your " + macro.footDesc(true) + " , choking the life from " + (sum > 1 ? sum + " people." : "a person."); else @@ -2557,7 +2557,7 @@ rules["stomp"].push({ isNonFatal(macro); }, "desc": function(container, macro, verbose, flat) { return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". You feel it make contact, and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of \ - your " + macro.toeDesc(true) + "preserved in newly formed hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide \ + your " + macro.toeDesc(true) + " preserved in newly formed hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide \ dust-filled crater you created."; } }); @@ -2569,8 +2569,8 @@ rules["stomp"].push({ !hasAtleast(container, "Planet", 1) && isFatal(macro); }, "desc": function(container, macro, verbose, flat) { - return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". You feel it make contact, and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of your " + macro.toeDesc(true) + "\ - preserved in newly formed hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone and twisted steel; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide debris-filled crater you created."; + return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". You feel it make contact, and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of your " + macro.toeDesc(true) + " preserved \ + in newly formed hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone and twisted steel; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide debris-filled crater you created."; } }); @@ -2581,8 +2581,8 @@ rules["stomp"].push({ !hasAtleast(container, "Planet", 1) && isGory(macro); }, "desc": function(container, macro, verbose, flat) { - return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". You feel it make contact, and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of your " + macro.toeDesc(true) + "\ - preserved in debris strewn hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone and twisted steel; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide gore-filled crater you created. \ + return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". You feel it make contact, and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of your " + macro.toeDesc(true) + " preserved \ + in debris-strewn hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone and twisted steel; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide gore-filled crater you created. \ The basin of the crater lined with with a smooth steel, glass, and bone aggregate. Steam rises from the mix as it cools and hardens"; } }); @@ -2594,8 +2594,8 @@ rules["stomp"].push({ !hasAtleast(container, "Planet", 1) && isSadistic(macro); }, "desc": function(container, macro, verbose, flat) { - return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". As you lower your leg, you feel it catch the tops of the taller skycrapers first, collapsing them with no effort. As they fall, you \ - crush more and more buildings until you feel your " + macro.footDesc() + " smash into the ground. You settle into the landscape and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of your " + macro.toeDesc(true) + "preserved in debris strewn \ + return "Your massive " + macro.footDesc() + " casts a shadow over the landscape. You lazily bring it down on "+ container.describe(verbose) + ". As you lower your leg, you feel it catch the tops of the taller skyscrapers first, collapsing them with no effort. As they fall, you \ + crush more and more buildings until you feel your " + macro.footDesc() + " smash into the ground. You settle into the landscape and cloud of dust spreads around the area. As the dust settles, you can see the clear outline of your " + macro.toeDesc(true) + " preserved in debris-strewn \ hills and valleys. Surrounding your " + macro.footDesc() + "print is a jagged mound of cracked stone and twisted steel; forming the wall of the " + length((Math.pow(macro.pawArea/Math.PI, .5)* 2.5), unit, true) + " wide gore-filled crater you created. The basin of the crater \ lined with with a smooth steel, glass, and bone aggregate. Steam rises from the mix as it cools and hardens"; } From dfe824be508d948e15634a7dd941de00eccd97e8 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Thu, 26 Dec 2019 23:47:02 -0500 Subject: [PATCH 10/14] refactor 7 removed a typo in code and shifted defaultDescibeSimple to be next to defualtDescribe --- recursive-macro.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index bf69a45..5da543c 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -726,15 +726,6 @@ function defaultAddContent(thing) { }; } -function defaultDescribeSimple(thing) { - return function(flat) { - if (flat) { - return flatten(thing).describe(false) - } else { - return thing.describe(false); - } - } -} function DefaultEntity() { this.sum = defaultSum; this.area = defaultArea; @@ -757,6 +748,16 @@ function copy_defaults(self,proto) { //loads the values defined in things into t } } +function defaultDescribeSimple(thing) { + return function(flat) { + if (flat) { + return flatten(thing).describe(false) + } else { + return thing.describe(false); + } + } +} + function defaultDescribe(verbose=true, parent){ if (verbose) { if (parent.count <= 3) { @@ -1343,7 +1344,7 @@ function Micro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - tthis.describe = function(verbose=true) { + this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } } From c2564c81ee4207e7d124e1667e8f7a40fa115268 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Sun, 29 Dec 2019 01:12:51 -0500 Subject: [PATCH 11/14] More Things *added busines jet and airliner things which don't spawn yet but will appear in the yet to be added airstrip and airport things --- recursive-macro.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/recursive-macro.js b/recursive-macro.js index 5da543c..983abee 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -109,6 +109,23 @@ var things = clusters: 1, cluster_chances: .05, contents: [["Person",10,40]], + "Business Jet": { + "Business Jet": BusinessJet, + mass: 6500, + area: 50, + clusters: 1, + cluster_chances: .05, + contents: [["Person",2,9]], + descriptor: ["a business jet", "business jets"] + }, + "Airliner": { + "Airliner": Airliner, + mass: 6500, + area: 50, + clusters: 1, + cluster_chances: .05, + contents: [["Person",5,300]], + descriptor: ["an airliner", "airliners"] }, //Buildings "House": { @@ -959,6 +976,44 @@ function Tram(count = 1) { }; } +function BusinessJet(count = 1) { + this.name = "Business Jet"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0)); + var color = random_desc(["blue","white","white","blue and white","red and white","black","gold"], (verbose ? 0.9 : 0)); + var type = random_desc(["luxury jet","business jet","single-engine plane","light aircraft"]); + return merge_desc([adjective,color,type]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } +} + +function Airliner(count = 1) { + this.name = "Airliner"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0)); + var color = random_desc(["blue","white","white","blue and white"], (verbose ? 0.9 : 0)); + var type = random_desc(["airliner","twin-engine jet","trijet","four engine jet","double-decker airliner","widebody airliner","passenger jet","airliner"]); + return merge_desc([adjective,color,type]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } +} + function Train(count = 1) { this.name = "Train"; copy_defaults(this,new DefaultEntity()); From 56d0a0855364536d7438bd1087f837d6747700c3 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Sun, 29 Dec 2019 01:52:21 -0500 Subject: [PATCH 12/14] More Universal descriptions Basically rebuilt descriptions from the ground up. It will look the same from the player side but allows for a much simplier definition of things, with each thing following a much more definite pattern with repeated code somewhat reduced also moved all the description based functions to the same area for each of refrencing --- recursive-macro.js | 503 ++++++++++++++++++++++++--------------------- 1 file changed, 265 insertions(+), 238 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index 983abee..aa2c14b 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -45,7 +45,7 @@ var things = area: .05, clusters: 50, cluster_chances: 1, - contents: [[]], + contents: [], descriptor: ["a micro", "micros"] }, "Macro": { @@ -54,7 +54,7 @@ var things = area: 100, clusters: 0, cluster_chances: 0, - contents: [[]], + contents: [], descriptor: ["a smaller macro", "smaller macros"] }, //Vehicles @@ -64,7 +64,7 @@ var things = area: 4, clusters: 2, cluster_chances: .3, - contents: [[]], + contents: [], descriptor: ["a parked car", "parked cars"] }, "Car": { @@ -109,6 +109,8 @@ var things = clusters: 1, cluster_chances: .05, contents: [["Person",10,40]], + descriptor: ["a train car", "train cars"] + }, "Business Jet": { "Business Jet": BusinessJet, mass: 6500, @@ -180,6 +182,7 @@ var things = clusters: 1, cluster_chances: .1, contents: [["Person",10,200],["Empty Car",100,300],["Car",5,30]], + descriptor: ["a parking garage", "parking garages"] }, //Places "Town": { @@ -189,6 +192,7 @@ var things = clusters: 5, cluster_chances: .1, contents: [["Person",10000,100000],["House",5000,50000],["Empty Car",200,800],["Car",500,80000],["Bus",5,25],["Train",5,25],["Business",500,5000]], + descriptor: ["a town", "towns"] }, "City": { "City": City, @@ -197,6 +201,7 @@ var things = clusters: 0, cluster_chances: .2, 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]], + descriptor: ["a city", "cities"] }, "Continent": { "Continent": Continent, @@ -205,6 +210,7 @@ var things = clusters: 5, cluster_chances: .5, contents: [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250],["Business",250,1000]], + descriptor: ["a continent", "continents"] }, "Planet": { "Planet": Planet, @@ -213,6 +219,7 @@ var things = clusters: 0, cluster_chances: 1, contents: [["Continent",4,9]], + descriptor: ["a planet", "planets"] }, "Star": { "Star": Star, @@ -229,6 +236,7 @@ var things = clusters: 1, cluster_chances: 1, contents: [["Star",1,1],["Planet",5,15]], + descriptor: ["a solar system", "solar systems"] }, "Galaxy": { "Galaxy": Galaxy, @@ -237,6 +245,7 @@ var things = clusters: 1, cluster_chances: 1, contents: [["Star",1e9,500e9],["Solar System",1e8,500e8]], + descriptor: ["a galaxy", "galaxies"] }, "Cluster": { "Cluster": Cluster, @@ -245,6 +254,7 @@ var things = clusters: 1, cluster_chances: 1, contents: [["Galaxy",200,5000]], + descriptor: ["a cluster", "clusters"] }, "Universe": { "Universe": Universe, @@ -253,6 +263,7 @@ var things = clusters: 1, cluster_chances: 1, contents: [["Cluster",1.5e9,2.5e9]], + descriptor: ["a universe", "universes"] }, "Multiverse": { "Multiverse": Multiverse, @@ -261,6 +272,7 @@ var things = clusters: 1, cluster_chances: 1, contents: [["Universe",100,1000]], + descriptor: ["a multiverse", "multiverses"] }, //Military "Soldier": { @@ -270,6 +282,7 @@ var things = clusters: 2, cluster_chances: .2, contents: [], + descriptor: ["a soldier","soldiers"] }, "Tank": { "Tank": Tank, @@ -278,6 +291,7 @@ var things = clusters: 2, cluster_chances: .25, contents: [["Soldier",3,5]], + descriptor: ["a tank", "tanks"] }, "Artillery": { "Artillery": Artillery, @@ -286,6 +300,7 @@ var things = clusters: 3, cluster_chances: .5, contents: [["Soldier",4,6]], + descriptor: ["an artillery tank", "artillery tanks"] }, "Helicopter": { "Helicopter": Helicopter, @@ -294,6 +309,7 @@ var things = clusters: 0, cluster_chances: 0, contents: [["Soldier",4,16]], + descriptor: ["a helicoptor", "helicoptors"] }, "Squad": { "Squad": Squad, @@ -302,6 +318,7 @@ var things = clusters: 20, cluster_chances: .05, contents: [["Soldier",6,9]], + descriptor: ["a squad", "squads"] }, "Platoon": { "Platoon": Platoon, @@ -310,6 +327,7 @@ var things = clusters: 2, cluster_chances: .1, contents: [["Soldier",16,44]], + descriptor: ["a military platoon", "platoons"] }, "Company": { "Company": Company, @@ -318,6 +336,7 @@ var things = clusters: 2, cluster_chances: .1, contents: [["Soldier",60,200]], + descriptor: ["a company of soldiers", "companies"] }, "Battalion": { "Battalion": Battalion, @@ -326,6 +345,7 @@ var things = clusters: 2, cluster_chances: .1, contents: [["Soldier",300,1000]], + descriptor: ["a battalion", "battalions"] }, "Brigade": { "Brigade": Brigade, @@ -334,6 +354,7 @@ var things = clusters: 2, cluster_chances: .1, contents: [["Soldier",1500,3200]], + descriptor: ["a brigade", "brigades"] }, "Division": { "Division": Division, @@ -342,6 +363,7 @@ var things = clusters: 3, cluster_chances: .1, contents: [["Soldier",10000,16000]], + descriptor: ["a division", "divisions"] }, "Tank Division": { "Tank Division": TankDivision, @@ -350,6 +372,7 @@ var things = clusters: 1, cluster_chances: .15, contents: [["Soldier",8000,1200],["Tank",250,500]], + descriptor: ["a tank division", "tank divisions"] }, "Army": { "Army": Army, @@ -358,6 +381,7 @@ var things = clusters: 2, cluster_chances: .1, contents: [["Soldier",40000,75000]], + descriptor: ["an army", "armies"] }, }; //Alterante Army Structuring, may be used later @@ -505,81 +529,6 @@ function fill_area(area, weights, variance=0.15) return new Container(result); } -// describes everything in the container - -function describe_all(contents,verbose=true,except=[]) { - var things = []; - for (var key in contents) { - if (contents.hasOwnProperty(key) && !except.includes(key)) { - things.push(contents[key].describe(verbose)); - } - } - return merge_things(things); -} - -function random_desc(list, odds=1) { - if (Math.random() < odds) - return list[Math.floor(Math.random() * list.length)]; - else - return ""; -} - -// combine strings into a list with proper grammar - -function merge_things(list,semicolons=false) { - if (list.length == 0) { - return ""; - } else if (list.length == 1) { - return list[0]; - } else if (list.length == 2) { - return list[0] + " and " + list[1]; - } else { - var result = ""; - - list.slice(0,list.length-1).forEach(function(term) { - result += term + ", "; - }); - - result += "and " + list[list.length-1]; - - return result; - } -} - -// combine the adjectives for something into a single string - -function merge_desc(list) { - var result = ""; - - list.forEach(function(term) { - if (term != "") - result += term + " "; - }); - - // knock off the last space - if (result.length > 0) { - result = result.substring(0, result.length - 1); - } - let article = "a " - //a/an overwriting terms - let forcedTerms = ["honor","heir"]; //words that need to start with an but don't start with a,e,i,o,u - let force = false; - for (let i of forcedTerms){ - if (i === result.substring(0, i.length)){force = true;} - } - - let exceptionTerms = ["uniform","unique"]; //words that need to start with a and start with a,e,i,o,u - let exception = false; - for (let i of exceptionTerms){ - if (i === result.substring(0, i.length)){exception = true;} - } - //check if the string should start with an - 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")))){ - article = "an "; - } - result = article + result; - return result; -} // maybe make this something that approximates a // normal distribution; doing this 15,000,000 times is bad... @@ -765,6 +714,84 @@ function copy_defaults(self,proto) { //loads the values defined in things into t } } +// combine strings into a list with proper grammar + +function merge_things(list,semicolons=false) { + if (list.length == 0) { + return ""; + } else if (list.length == 1) { + return list[0]; + } else if (list.length == 2) { + return list[0] + " and " + list[1]; + } else { + var result = ""; + + list.slice(0,list.length-1).forEach(function(term) { + result += term + ", "; + }); + + result += "and " + list[list.length-1]; + + return result; + } +} + +// combine the adjectives for something into a single string + +function merge_desc(list) { + var result = ""; + + list.forEach(function(term) { + if (term != "") + result += term + " "; + }); + + // knock off the last space + if (result.length > 0) { + result = result.substring(0, result.length - 1); + } + + let article = "a " + //a/an overwriting terms + let forcedTerms = ["honor","heir"]; //words that need to start with an but don't start with a,e,i,o,u + let force = false; + for (let i of forcedTerms){ + if (i === result.substring(0, i.length)){force = true;} + } + + let exceptionTerms = ["uniform","unique"]; //words that need to start with a and start with a,e,i,o,u + let exception = false; + for (let i of exceptionTerms){ + if (i === result.substring(0, i.length)){exception = true;} + } + + //check if the string should start with an + 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")))){ + article = "an "; + } + result = article + result; + return result; +} + +// describes everything in the container + +function describe_all(contents,verbose=true,except=[]) { + var things = []; + for (var key in contents) { + if (contents.hasOwnProperty(key) && !except.includes(key)) { + things.push(contents[key].describe(verbose)); + } + } + return merge_things(things); +} + +function random_desc(list, odds=1) { //strings together an array into a series of words + if (Math.random() < odds) + return list[Math.floor(Math.random() * list.length)]; + else + return ""; +} + function defaultDescribeSimple(thing) { return function(flat) { if (flat) { @@ -775,27 +802,49 @@ function defaultDescribeSimple(thing) { } } -function defaultDescribe(verbose=true, parent){ - if (verbose) { - if (parent.count <= 3) { +function defaultDescribe(verbose=true, parent, descAs){ + let descriptorEnd = " inside"; + let descriptorConjunction = " with "; + let groupLessThan3 = false; + switch(descAs) { + case "vehicle": + descriptorEnd = pickString(" inside"," inside"," inside", " inside"," riding inside", " trapped inside", " sitting inside"); + break; + case "community": + groupLessThan3 = true; + descriptorEnd = " in " + (parent.count == 1 ? "it" : "them"); + break; + case "celestial": + groupLessThan3 = true; + descriptorConjunction = pickString(" made up of "," consisting of "," containing "); + descriptorEnd = ""; + break; + case "military": + groupLessThan3 = true; + descriptorConjunction = pickString(" of "," of "," made up of "," comprised of "," containing "); + descriptorEnd = ""; + break; + + } if (verbose) { + if (parent.count <= 3 && groupLessThan3 == false) { var list = []; for (var i = 0; i < parent.count; i++) { list.push(parent.describeOne(parent.count <= 2)); } if (things[parent.name].contents.length > 0){ - return merge_things(list) + " with " + describe_all(parent.contents,verbose) + " inside"; + return (merge_things(list) + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd); } else { - return merge_things(list); + return (merge_things(list)); } - } else { + } else {//if there are more than 3 of the object if (things[parent.name].contents.length > 0){ - return parent.count + " " + things[parent.name].descriptor[1] +" with " + describe_all(parent.contents,verbose) + " inside"; + return (parent.count + " " + things[parent.name].descriptor[1] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd); } else { - return parent.count + " " + things[parent.name].descriptor[1]; + return (parent.count + " " + things[parent.name].descriptor[0]); } } } else {//not verbose - return (parent.count > 1 ? parent.count + " " + things[parent.name].descriptor[1] : things[parent.name].descriptor[0]); + return (parent.count > 1 ? (parent.count + " " + things[parent.name].descriptor[1]) : things[parent.name].descriptor[0]); } } @@ -897,7 +946,7 @@ function Cow(count = 1) { } function EmptyCar(count = 1) { - this.name = "Car"; + this.name = "Empty Car"; copy_defaults(this,new DefaultEntity()); this.count = count; @@ -930,7 +979,7 @@ function Car(count = 1) { }; this.describe = function(verbose=true) { - return defaultDescribe(verbose, this); + return defaultDescribe(verbose, this, "vehicle"); } } @@ -949,7 +998,7 @@ function Bus(count = 1) { }; this.describe = function(verbose=true) { - return defaultDescribe(verbose, this); + return defaultDescribe(verbose, this, "vehicle"); } } @@ -968,7 +1017,7 @@ function Tram(count = 1) { }; this.describe = function(verbose=true) { - return defaultDescribe(verbose, this); + return defaultDescribe(verbose, this, "vehicle"); } this.anal_vore = function() { @@ -1065,13 +1114,9 @@ function TrainCar(count = 1) { return merge_desc([adjective,color,type]); }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count > 1 ? this.count + " train cars" : "a train car") + " with " + describe_all(this.contents) + " inside"; - } else { - return (this.count > 1 ? this.count + " train cars" : "a train car"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } } function House(count = 1) { @@ -1169,13 +1214,14 @@ function ParkingGarage(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a parking garage"; + return things[this.name].descriptor[0]; }; this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } } + function Town(count = 1) { this.name = "Town"; @@ -1183,13 +1229,13 @@ function Town(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a town" : this.count + " towns") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them"); - } else { - return (this.count == 1 ? "a town" : this.count + " towns"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "community"); + } } function City(count = 1) { @@ -1199,13 +1245,13 @@ function City(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a city" : this.count + " cities") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them"); - } else { - return (this.count == 1 ? "a city" : this.count + " cities"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "community"); + } } function Continent(count = 1) { @@ -1215,13 +1261,13 @@ function Continent(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a continent" : this.count + " continents") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them"); - } else { - return (this.count == 1 ? "a continent" : this.count + " continents"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "community"); + } } function Planet(count = 1) { @@ -1231,13 +1277,13 @@ function Planet(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a planet" : this.count + " planets") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them"); - } else { - return (this.count == 1 ? "a planet" : this.count + " planets"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "community"); + } } function Star(count = 1) { @@ -1259,13 +1305,13 @@ function SolarSystem(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a solar system" : this.count + " solar systems") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a solar system" : this.count + " solar systems"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "celestial"); + } } function Galaxy(count = 1) { @@ -1275,13 +1321,13 @@ function Galaxy(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a galaxy" : this.count + " galaxies") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a galaxy" : this.count + " galaxies"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "celestial"); + } } function Cluster(count = 1) { @@ -1291,13 +1337,13 @@ function Cluster(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a cluster" : this.count + " clusters") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a cluster" : this.count + " clusters"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "celestial"); + } } function Universe(count = 1) { @@ -1307,13 +1353,13 @@ function Universe(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a universe" : this.count + " universes") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a universe" : this.count + " universes"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "celestial"); + } } function Multiverse(count = 1) { @@ -1323,13 +1369,13 @@ function Multiverse(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a multiverse" : this.count + " multiverses") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a multiverse" : this.count + " multiverses"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "celestial"); + } } function Soldier(count = 1) { @@ -1339,9 +1385,13 @@ function Soldier(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - return (this.count == 1 ? "a soldier" : this.count + " soldiers"); + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } } function Tank(count = 1) { @@ -1351,13 +1401,13 @@ function Tank(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a tank" : this.count + " tanks") + " with " + describe_all(this.contents, verbose) + " trapped inside"; - } else { - return (this.count == 1 ? "a tank" : this.count + " tanks"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } } function Artillery(count = 1) { @@ -1367,13 +1417,13 @@ function Artillery(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "an artillery unit" : this.count + " artillery units") + " with " + describe_all(this.contents, verbose) + " trapped inside"; - } else { - return (this.count == 1 ? "an artillery unit" : this.count + " artillery units"); - } + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } } function Helicopter(count = 1) { @@ -1383,13 +1433,13 @@ function Helicopter(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a helicopter" : this.count + " helicopters") + " with " + describe_all(this.contents, verbose) + " riding inside"; - } else { - return (this.count == 1 ? "a helicopter" : this.count + " helicopters"); - } - }; + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } } function Micro(count = 1) { @@ -1399,6 +1449,10 @@ function Micro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; + }; + this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } @@ -1411,6 +1465,10 @@ function Macro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); + this.describeOne = function(verbose=true) { + return things[this.name].descriptor[0]; + }; + this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } @@ -1423,16 +1481,12 @@ function Squad(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a squad"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a squad" : this.count + " squads") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a squad" : this.count + " squads"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function Platoon(count = 1) { @@ -1442,16 +1496,12 @@ function Platoon(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a military platoon"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a platoon" : this.count + " platoons") + " consisting of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a platoon" : this.count + " platoons"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function Company(count = 1) { @@ -1461,16 +1511,12 @@ function Company(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a company of soldiers"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a company" : this.count + " companies") + " of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a company" : this.count + " companies"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function Battalion(count = 1) { @@ -1480,16 +1526,12 @@ function Battalion(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a battalion"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a battalion" : this.count + " battalions") + " containing " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a battalion" : this.count + " battalions"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function Brigade(count = 1) { @@ -1499,16 +1541,12 @@ function Brigade(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a brigade"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a brigade" : this.count + " brigades") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a brigade" : this.count + " brigades"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function Division(count = 1) { @@ -1518,16 +1556,12 @@ function Division(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a division"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a division" : this.count + " divisions") + " of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a division" : this.count + " divisions"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function TankDivision(count = 1) { @@ -1537,16 +1571,12 @@ function TankDivision(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "a tank division"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "a tank division" : this.count + " tank divisions") + " of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "a tank division" : this.count + " tank divisions"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } function Army(count = 1) { @@ -1556,16 +1586,12 @@ function Army(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function(verbose=true) { - return "an army"; + return things[this.name].descriptor[0]; }; - this.describe = function(verbose = true) { - if (verbose) { - return (this.count == 1 ? "an army" : this.count + " armies") + " made up of " + describe_all(this.contents, verbose); - } else { - return (this.count == 1 ? "an army" : this.count + " armies"); - } - }; + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "military"); + } } @@ -1575,6 +1601,7 @@ function Army(count = 1) { //farms //racetracks //more building types + //cranes and other construction equipment //nebula //chemical factory //grand army From f8a952f0a20980acd1deac70b448bbfeb7d75b23 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Mon, 30 Dec 2019 00:01:13 -0500 Subject: [PATCH 13/14] Cleanup Added exception for singular objects that have groupLessThan3 enabled in defaultDescribe fixed case where wrong plurality was given by defaultDescriptor made describeOne one of the things added in copy_defaults to make functions cleaner --- recursive-macro.js | 130 +++++++++------------------------------------ 1 file changed, 26 insertions(+), 104 deletions(-) diff --git a/recursive-macro.js b/recursive-macro.js index aa2c14b..39d7b43 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -9,6 +9,7 @@ var things = clusters: 0, cluster_chances: 0, contents: [], + descriptor: ["", ""] }, //Creatures @@ -101,6 +102,7 @@ var things = clusters: 2, cluster_chances: .1, contents: [["Person",1,4,"engine"],["Train Car",2,10]], + descriptor: ["a train", "trains"] }, "Train Car": { "Train Car": TrainCar, @@ -228,6 +230,7 @@ var things = clusters: 1, cluster_chances: 1, contents: [], + descriptor: ["a star", "stars"] }, "Solar System": { "Solar System": SolarSystem, @@ -578,6 +581,10 @@ function defaultMass(thing) { return things[thing.name].mass; } +function defaultDescribeOne(thing) { + return things[thing.name].descriptor[0]; +} + function defaultMerge(thing) { //this merges all objects into one containers return function(container) { var newCount = this.count + container.count; @@ -700,7 +707,7 @@ function DefaultEntity() { this.merge = defaultMerge; this.multiply = defaultMultiply; this.describeSimple = defaultDescribeSimple; - + this.describeOne = defaultDescribeOne; return this; } @@ -824,9 +831,20 @@ function defaultDescribe(verbose=true, parent, descAs){ descriptorConjunction = pickString(" of "," of "," made up of "," comprised of "," containing "); descriptorEnd = ""; break; + case "generic vehicle": + groupLessThan3 = true; + descriptorEnd = pickString(" inside"," inside"," inside", " inside"," riding inside", " trapped inside", " sitting inside"); + break; } if (verbose) { - if (parent.count <= 3 && groupLessThan3 == false) { + if (parent.count = 1 ) { //singular parent (specifying single to catch cases where groupLessThan3 = true, otherwise it would output "1 towns" instead of "a town" + if (things[parent.name].contents.length > 0){ + return (things[parent.name].descriptor[0] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd); + } else { + return parent.describeOne(verbose); + } + } + else if (parent.count <= 3 && groupLessThan3 == false) { // less than 3 parents and an ojbect that has varety when described var list = []; for (var i = 0; i < parent.count; i++) { list.push(parent.describeOne(parent.count <= 2)); @@ -834,13 +852,13 @@ function defaultDescribe(verbose=true, parent, descAs){ if (things[parent.name].contents.length > 0){ return (merge_things(list) + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd); } else { - return (merge_things(list)); + return merge_things(list); } } else {//if there are more than 3 of the object if (things[parent.name].contents.length > 0){ return (parent.count + " " + things[parent.name].descriptor[1] + descriptorConjunction + describe_all(parent.contents,false) + descriptorEnd); } else { - return (parent.count + " " + things[parent.name].descriptor[0]); + return (parent.count + " " + things[parent.name].descriptor[1]); } } } else {//not verbose @@ -1213,10 +1231,6 @@ function ParkingGarage(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } @@ -1229,10 +1243,6 @@ function Town(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "community"); } @@ -1245,10 +1255,6 @@ function City(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "community"); } @@ -1261,10 +1267,6 @@ function Continent(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "community"); } @@ -1277,10 +1279,6 @@ function Planet(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "community"); } @@ -1305,10 +1303,6 @@ function SolarSystem(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "celestial"); } @@ -1321,10 +1315,6 @@ function Galaxy(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "celestial"); } @@ -1337,10 +1327,6 @@ function Cluster(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "celestial"); } @@ -1353,10 +1339,6 @@ function Universe(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "celestial"); } @@ -1369,10 +1351,6 @@ function Multiverse(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "celestial"); } @@ -1385,12 +1363,8 @@ function Soldier(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { - return defaultDescribe(verbose, this); + return defaultDescribe(verbose, this, "military"); } } @@ -1401,12 +1375,8 @@ function Tank(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { - return defaultDescribe(verbose, this, "vehicle"); + return defaultDescribe(verbose, this, "generic vehicle"); } } @@ -1417,12 +1387,8 @@ function Artillery(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { - return defaultDescribe(verbose, this, "vehicle"); + return defaultDescribe(verbose, this, "generic vehicle"); } } @@ -1433,12 +1399,8 @@ function Helicopter(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { - return defaultDescribe(verbose, this, "vehicle"); + return defaultDescribe(verbose, this, "generic vehicle"); } } @@ -1449,10 +1411,6 @@ function Micro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } @@ -1465,10 +1423,6 @@ function Macro(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this); } @@ -1480,10 +1434,6 @@ function Squad(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1495,10 +1445,6 @@ function Platoon(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1510,10 +1456,6 @@ function Company(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1525,10 +1467,6 @@ function Battalion(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1540,10 +1478,6 @@ function Brigade(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1555,10 +1489,6 @@ function Division(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1570,10 +1500,6 @@ function TankDivision(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } @@ -1585,10 +1511,6 @@ function Army(count = 1) { this.count = count; this.contents = initContents(this.name,this.count); - this.describeOne = function(verbose=true) { - return things[this.name].descriptor[0]; - }; - this.describe = function(verbose=true) { return defaultDescribe(verbose, this, "military"); } From ae9ceac96275f641e408d5e94020dafa66ce4cd7 Mon Sep 17 00:00:00 2001 From: jsb5468 Date: Tue, 7 Jan 2020 17:32:08 -0500 Subject: [PATCH 14/14] More Things Changed old helicopter to military helipcopter added normal helicopter variant changed business jet to generic plane added empty varients of airliner, plane, helicopter added hangars for aircraft added airstrip and airports added ranch Fixed DescribeOne improved description of cows, made empty car describe as a vehicle type to fix bad description appearing --- game.js | 5 +- recursive-macro.js | 295 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 283 insertions(+), 17 deletions(-) diff --git a/game.js b/game.js index 45bd110..6d6d86e 100644 --- a/game.js +++ b/game.js @@ -1824,6 +1824,9 @@ const biomeEnum = { "Car": 0.1, "Train": 0.002, "Business": 0.075, + "Ranch": 0.01, + "Airstrip": 0.002, + "Airport": 0.002, "Town": 0.00001 }}, Suburb: { @@ -2161,7 +2164,7 @@ function getWeights(region, area) { weights["Soldier"] = 0.08; weights["Tank"] = 0.07; weights["Artillery"] = 0.06; - weights["Helicopter"] = 0.05, + weights["Military Helicopter"] = 0.05, weights["Squad"]= .04; weights["Platoon"]= .2, weights["Company"]= .3, diff --git a/recursive-macro.js b/recursive-macro.js index 39d7b43..7aff03f 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -113,24 +113,60 @@ var things = contents: [["Person",10,40]], descriptor: ["a train car", "train cars"] }, - "Business Jet": { - "Business Jet": BusinessJet, + "Helicopter": { + "Helicopter": Helicopter, + mass: 1500, + area: 12, + clusters: 0, + cluster_chances: 0, + contents: [["Person",4,16]], + descriptor: ["a helicopter", "helicopters"] + }, + "Empty Helicopter": { + "Empty Helicopter": EmptyHelicopter, + mass: 1500, + area: 12, + clusters: 3, + cluster_chances: 0.05, + contents: [], + descriptor: ["a parked helicopter", "parked helicopters"] + }, + "Plane": { + "Plane": Plane, + mass: 6500, + area: 50, + clusters: 1, + cluster_chances: .05, + contents: [], + descriptor: ["a small plane", "small planes"] + }, + "Empty Plane": { + "Empty Plane": EmptyPlane, mass: 6500, area: 50, clusters: 1, cluster_chances: .05, contents: [["Person",2,9]], - descriptor: ["a business jet", "business jets"] + descriptor: ["a parked plane", "parked aircraft"] }, "Airliner": { "Airliner": Airliner, mass: 6500, - area: 50, + area: 1250, clusters: 1, cluster_chances: .05, contents: [["Person",5,300]], descriptor: ["an airliner", "airliners"] }, + "Empty Airliner": { + "Empty Airliner": EmptyAirliner, + mass: 6500, + area: 1250, + clusters: 1, + cluster_chances: .05, + contents: [], + descriptor: ["a parked airliner", "parked airliners"] + }, //Buildings "House": { "House": House, @@ -159,6 +195,33 @@ var things = contents: [["Person",0,2],["Cow",30,70]], descriptor: ["a barn", "barns"] }, + "Small Hangar": { + "Small Hangar": SmallHangar, + mass: 5e5, + area: 2500, + clusters: 1, + cluster_chances: .1, + contents: [["Person",0,3],["Plane",0,1],["Empty Plane",2,6]], + descriptor: ["a small hangar", "small hangars"] + }, + "Helicopter Hangar": { + "Helicopter Hangar": HelicopterHangar, + mass: 5e5, + area: 2000, + clusters: 1, + cluster_chances: .1, + contents: [["Person",0,3],["Helicopter",0,1],["Helicopter",2,6]], + descriptor: ["a helicopter hangar", "helicopter hangar"] + }, + "Large Hangar": { + "Large Hangar": LargeHangar, + mass: 5e6, + area: 8000, + clusters: 1, + cluster_chances: .1, + contents: [["Person",0,5],["Airliner",0,1],["Empty Airliner",1,2]], + descriptor: ["an aircraft hangar", "hangars"] + }, "Small Skyscraper": { "Small Skyscraper": SmallSkyscraper, mass: 1e7, @@ -187,6 +250,33 @@ var things = descriptor: ["a parking garage", "parking garages"] }, //Places + "Ranch": { + "Ranch": Ranch, + mass: 2e7, + area: 4e4, + clusters: 0, + cluster_chances: 0, + contents: [["Person",10,50],["House",1,3],["Barn",1,2]], + descriptor: ["a ranch", "ranchs"] + }, + "Airstrip": { + "Airstrip": Airstrip, + mass: 2e7, + area: 9e5, + clusters: 0, + cluster_chances: 0, + contents: [["Person",10,50],["Small Hangar",1,3],["Plane",0,2],["Helicopter",0,1],["Helicopter Hangar",0,1],["Car",0,5],["Empty Car",0,20]], + descriptor: ["an airstrip", "airstrips"] + }, + "Airport": { + "Airport": Airport, + mass: 1.5e8, + area: 6e6, + clusters: 0, + cluster_chances: 0, + contents: [["Person",1500,4000],["Small Hangar",4,12],["Plane",2,5],["Helicopter",1,3],["Helicopter Hangar",2,6],["Airliner",1,3],["Large Hangar",2,6],["Car",20,75],["Empty Car",400,1000]], + descriptor: ["an airport", "airports"] + }, "Town": { "Town": Town, mass: 1, @@ -214,6 +304,7 @@ var things = contents: [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250],["Business",250,1000]], descriptor: ["a continent", "continents"] }, +//Celestial Bodies "Planet": { "Planet": Planet, mass: 5.972e24, @@ -305,14 +396,14 @@ var things = contents: [["Soldier",4,6]], descriptor: ["an artillery tank", "artillery tanks"] }, - "Helicopter": { - "Helicopter": Helicopter, + "Military Helicopter": { + "Military Helicopter": MilitaryHelicopter, mass: 1500, area: 12, clusters: 0, cluster_chances: 0, contents: [["Soldier",4,16]], - descriptor: ["a helicoptor", "helicoptors"] + descriptor: ["a helicopter", "helicopters"] }, "Squad": { "Squad": Squad, @@ -582,7 +673,9 @@ function defaultMass(thing) { } function defaultDescribeOne(thing) { + return function(verbose){ //verbose doesn't matter for this case, becasue it handles things with no extra text to use when being verbose return things[thing.name].descriptor[0]; + } } function defaultMerge(thing) { //this merges all objects into one containers @@ -951,9 +1044,9 @@ function Cow(count = 1) { this.contents = initContents(this.name,this.count); this.describeOne = function (verbose=true) { - var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0)); - var sex = random_desc(["male", "female"], (verbose ? 1 : 0)); - return merge_desc([body,sex,"cow"]); + var body = random_desc(["skinny","fat","tall","short","stocky","spindly","brown"], (verbose ? 0.6 : 0)); + var sex = random_desc(["bull","steer","cow","cow","cow","heifer"], (verbose ? 1 : 0)); + return merge_desc([body,sex]); }; this.describe = function(verbose=true) { @@ -978,7 +1071,7 @@ function EmptyCar(count = 1) { }; this.describe = function(verbose=true) { - return defaultDescribe(verbose, this); + return defaultDescribe(verbose, this, "vehicle"); } } @@ -1043,8 +1136,44 @@ function Tram(count = 1) { }; } -function BusinessJet(count = 1) { - this.name = "Business Jet"; +function EmptyHelicopter(count = 1) { + this.name = "Empty Helicopter"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var color = random_desc(["blue","white","white","red","black","gold","yellow"], (verbose ? 0.6 : 0)); + var type = random_desc(["bubble coptor","helicopter","helicopter","news chopper","police helicopter","chopper"]); + return merge_desc([adjective,color,type]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } +} + +function Helicopter(count = 1) { + this.name = "Helicopter"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var color = random_desc(["blue","white","white","red","black","gold","yellow"], (verbose ? 0.6 : 0)); + var type = random_desc(["bubble coptor","helicopter","helicopter","news chopper","police helicopter","chopper"]); + return merge_desc([adjective,color,type]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } +} + +function EmptyPlane(count = 1) { + this.name = "Empty Plane"; copy_defaults(this,new DefaultEntity()); this.count = count; @@ -1062,6 +1191,44 @@ function BusinessJet(count = 1) { } } +function Plane(count = 1) { + this.name = "Plane"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0)); + var color = random_desc(["blue","white","white","blue and white","red and white","black","gold"], (verbose ? 0.9 : 0)); + var type = random_desc(["luxury jet","business jet","single-engine plane","light aircraft"]); + return merge_desc([adjective,color,type]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } +} + +function EmptyAirliner(count = 1) { + this.name = "Empty Airliner"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var adjective = random_desc(["brand-new","aging","modern"], (verbose ? 0.2 : 0)); + var color = random_desc(["blue","white","white","blue and white"], (verbose ? 0.9 : 0)); + var type = random_desc(["airliner","twin-engine jet","trijet","four engine jet","double-decker airliner","widebody airliner","passenger jet","airliner"]); + return merge_desc([adjective,color,type]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "vehicle"); + } +} + function Airliner(count = 1) { this.name = "Airliner"; @@ -1191,6 +1358,60 @@ function Barn(count = 1) { } } +function SmallHangar(count = 1) { + this.name = "Small Hangar"; + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0)); + var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); + var name = random_desc(["hangar","hangar","hangar","aircraft hangar"], 1); + return merge_desc([size,color,name]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } +} + +function HelicopterHangar(count = 1) { + this.name = "Helicopter Hangar"; + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0)); + var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); + var name = random_desc(["hangar","hangar","hangar","helicopter hangar"], 1); + return merge_desc([size,color,name]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } +} + +function LargeHangar(count = 1) { + this.name = "Large Hangar"; + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var size = random_desc(["weathered","aging","new"], (verbose ? 0.5 : 0)); + var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); + var name = random_desc(["hangar","hangar","hangar","large hangar","spacious hangar"], 1); + return merge_desc([size,color,name]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } +} + function SmallSkyscraper(count = 1) { this.name = "Small Skyscraper"; copy_defaults(this,new DefaultEntity()); @@ -1236,6 +1457,47 @@ function ParkingGarage(count = 1) { } } +function Ranch(count = 1) { + this.name = "Ranch"; + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describeOne = function(verbose=true) { + var size = random_desc(["little","large","prosperous","run-down"], (verbose ? 0.5 : 0)); + var name = random_desc(["ranch","farm","ranch","dairy farm","cattle farm","ranch","farm"], 1); + return merge_desc([size,name]); + }; + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this); + } +} + +function Airstrip(count = 1) { + this.name = "Airstrip"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "community"); + } +} + +function Airport(count = 1) { + this.name = "Airport"; + + copy_defaults(this,new DefaultEntity()); + this.count = count; + this.contents = initContents(this.name,this.count); + + this.describe = function(verbose=true) { + return defaultDescribe(verbose, this, "community"); + } +} + function Town(count = 1) { this.name = "Town"; @@ -1392,8 +1654,8 @@ function Artillery(count = 1) { } } -function Helicopter(count = 1) { - this.name = "Helicopter"; +function MilitaryHelicopter(count = 1) { + this.name = "Military Helicopter"; copy_defaults(this,new DefaultEntity()); this.count = count; @@ -1519,12 +1781,13 @@ function Army(count = 1) { //todo - //airports //farms + //factories //racetracks //more building types //cranes and other construction equipment //nebula + //biome magic also set it so that you can't roll your existing biome //chemical factory //grand army //armada \ No newline at end of file