From 6067d88e37ff02048965f6ab9c92d270cd1a18da Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sat, 24 Feb 2018 13:51:27 -0500 Subject: [PATCH] Violently linted all of my code --- .jshintrc | 20 ++ game.js | 665 ++++++++++++++++++++++----------------------- recursive-desc.js | 157 +++++------ recursive-macro.js | 123 ++++----- stroll.html | 4 +- units.js | 116 ++++---- 6 files changed, 528 insertions(+), 557 deletions(-) create mode 100644 .jshintrc diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..6b75d5d --- /dev/null +++ b/.jshintrc @@ -0,0 +1,20 @@ +{ + "esversion": 6, + "node": true, + "sub": true, + "globals": { + "Container": true, + "Person": true, + "things": true, + "areas": true, + "fill_area": true, + "length": true, + "mass": true, + "volume": true, + "round": true, + "number": true, + "describe": true, + "humanMode": true, + "describe_all": true + } +} diff --git a/game.js b/game.js index d8aa797..17ed792 100644 --- a/game.js +++ b/game.js @@ -1,27 +1,29 @@ "use strict"; -var started = false; +/*jshint browser: true*/ -var strolling = false; +let started = false; -var maxStomachDigest = 10; -var maxBowelsDigest = 10; +let strolling = false; -var unit = "metric"; +let maxStomachDigest = 10; +let maxBowelsDigest = 10; -var numbers = "full"; +let unit = "metric"; -var verbose = true; +let numbers = "full"; -var biome = "suburb"; +let verbose = true; -var newline = " "; +let biome = "suburb"; -var victims = {}; +let newline = " "; -var humanMode = true; +let victims = {}; -var macro = +let humanMode = true; + +let macro = { "scaling": function(value, scale, factor) { return value * Math.pow(scale,factor); }, "name": "", @@ -76,7 +78,7 @@ var macro = "dickDensity": 1000, "dickScale": 1, get dickLength() { - var factor = 1; + let factor = 1; if (!this.arousalEnabled || this.arousal < 25) { factor = 0.5; } else if (this.arousal < 75) { @@ -86,7 +88,7 @@ var macro = return this.scaling(this.baseDickLength * this.dickScale * factor, this.scale, 1); }, get dickDiameter() { - var factor = 1; + let factor = 1; if (!this.arousalEnabled || this.arousal < 25) { factor = 0.5; } else if (this.arousal < 75) { @@ -113,11 +115,11 @@ var macro = get ballDiameter() { return this.scaling(this.baseBallDiameter * this.ballScale, this.scale, 1); }, get ballArea() { return 2 * Math.PI * Math.pow(this.ballDiameter/2, 2); }, get ballVolume() { - var radius = this.ballDiameter / 2; + let radius = this.ballDiameter / 2; return 4/3 * Math.PI * Math.pow(radius,3); }, get ballMass() { - var volume = this.ballVolume; + let volume = this.ballVolume; return volume * this.ballDensity; }, @@ -158,42 +160,42 @@ var macro = return 2 * Math.PI * Math.pow(this.breastDiameter/2,2); }, get breastVolume() { - var radius = this.breastDiameter / 2; + let radius = this.breastDiameter / 2; return 4/3 * Math.PI * Math.pow(radius,3); }, get breastMass() { - var volume = this.breastVolume; + let volume = this.breastVolume; return volume * this.breastDensity; }, "digest": function(owner,organ) { - var count = Math.min(organ.contents.length, organ.maxDigest); + let count = Math.min(organ.contents.length, organ.maxDigest); - var container = new Container(); + let container = new Container(); while (count > 0) { - var victim = organ.contents.shift(); + let victim = organ.contents.shift(); if (victim.name != "Container") victim = new Container([victim]); container = container.merge(victim); --count; } - var digested = container.sum(); + let digested = container.sum(); - for (var key in victims[organ.name]) { + for (let key in victims[organ.name]) { if (victims[organ.name].hasOwnProperty(key) && digested.hasOwnProperty(key) ) { victims["digested"][key] += digested[key]; victims[organ.name][key] -= digested[key]; } } - var line = organ.describeDigestion(container); + let line = organ.describeDigestion(container); organ.fill(this,container); - var summary = summarize(container.sum()); + let summary = summarize(container.sum()); if (organ.contents.length > 0) { - setTimeout(function() { owner.digest(owner,organ) }, 15000); + setTimeout(function() { owner.digest(owner,organ); }, 15000); } update([line,summary,newline]); @@ -226,7 +228,7 @@ var macro = }, "feedFunc": function(prey,self,owner) { if (self.contents.length == 0) - setTimeout(function() { owner.digest(owner,self) }, 15000); + setTimeout(function() { owner.digest(owner,self); }, 15000); this.contents.push(prey); }, "describeDigestion" : function(container) { @@ -246,7 +248,7 @@ var macro = }, "feedFunc": function(prey,self,owner) { if (self.contents.length == 0) - setTimeout(function() { owner.digest(owner,self) }, 15000); + setTimeout(function() { owner.digest(owner,self); }, 15000); this.contents.push(prey); }, "describeDigestion" : function(container) { @@ -266,7 +268,7 @@ var macro = }, "feedFunc": function(prey,self,owner) { if (self.contents.length == 0) - setTimeout(function() { owner.digest(owner,self) }, 15000); + setTimeout(function() { owner.digest(owner,self); }, 15000); this.contents.push(prey); }, "describeDigestion": function(container) { @@ -286,7 +288,7 @@ var macro = }, "feedFunc": function(prey,self,owner) { if (self.contents.length == 0) - setTimeout(function() { owner.digest(owner,self) }, 1500); + setTimeout(function() { owner.digest(owner,self); }, 1500); this.contents.push(prey); }, "describeDigestion": function(container) { @@ -376,7 +378,7 @@ var macro = self.cumStorage.amount += self.cumScale * self.ballVolume / 1200; if (self.cumStorage.amount > self.cumStorage.limit) self.arouse(1 * (self.cumStorage.amount / self.cumStorage.limit - 1)); - setTimeout(function () { self.fillCum(self) }, 100); + setTimeout(function () { self.fillCum(self); }, 100); update(); }, @@ -384,7 +386,7 @@ var macro = self.femcumStorage.amount += self.femcumScale * self.vaginaVolume / 1200; if (self.femcumStorage.amount > self.femcumStorage.limit) self.arouse(1 * (self.femcumStorage.amount / self.femcumStorage.limit - 1)); - setTimeout(function () { self.fillFemcum(self) }, 100); + setTimeout(function () { self.fillFemcum(self); }, 100); update(); }, @@ -397,7 +399,7 @@ var macro = if (self.milkStorage.amount > self.milkStorage.limit) { self.milkStorage.amount = self.milkStorage.limit; } - setTimeout(function () { self.fillBreasts(self) }, 100); + setTimeout(function () { self.fillBreasts(self); }, 100); update(); }, @@ -521,10 +523,10 @@ var macro = if (self.orgasm) { self.quench(10); - var amount = Math.min(this.cumVolume, this.cumStorage.amount); + let amount = Math.min(this.cumVolume, this.cumStorage.amount); this.cumStorage.amount -= amount; male_orgasm(amount); - setTimeout(function() { self.maleOrgasm(self) }, 2000); + setTimeout(function() { self.maleOrgasm(self); }, 2000); } }, @@ -534,10 +536,10 @@ var macro = if (this.orgasm) { this.quench(10); - var amount = Math.min(this.femcumVolume, this.femcumStorage.amount); + let amount = Math.min(this.femcumVolume, this.femcumStorage.amount); this.femcumStorage.amount -= amount; female_orgasm(amount); - setTimeout(function() { self.femaleOrgasm(self) }, 2000); + setTimeout(function() { self.femaleOrgasm(self); }, 2000); } }, @@ -547,15 +549,15 @@ var macro = if (this.orgasm) { this.quench(10); - setTimeout(function() { self.nullOrgasm(self) }, 2000); + setTimeout(function() { self.nullOrgasm(self); }, 2000); } }, get description() { - var result = []; + let result = []; - var line = "You are " + (macro.name == "" ? "" : macro.name + ", ") + "a " + length(macro.height, unit, true) + " tall " + macro.species + ". You weigh " + mass(macro.mass, unit) + "."; + let line = "You are " + (macro.name == "" ? "" : macro.name + ", ") + "a " + length(macro.height, unit, true) + " tall " + macro.species + ". You weigh " + mass(macro.mass, unit) + "."; result.push(line); @@ -591,7 +593,7 @@ var macro = } if (this.femaleParts) { - line = "Your glistening " + this.describeVagina + " slit peeks out from between your legs." + line = "Your glistening " + this.describeVagina + " slit peeks out from between your legs."; result.push(line); } @@ -619,7 +621,7 @@ var macro = get describeDick() { - var state = ""; + let state = ""; if (!this.arousalEnabled) { state = "limp"; } else if (this.orgasm) { @@ -641,7 +643,7 @@ var macro = }, get describeVagina() { - var state = ""; + let state = ""; if (!this.arousalEnabled) { state = "unassuming"; } else if (this.orgasm) { @@ -660,7 +662,7 @@ var macro = } } - return length(this.vaginaLength, unit, true) + " long " + state + return length(this.vaginaLength, unit, true) + " long " + state; }, "growthPoints": 0, @@ -676,13 +678,13 @@ var macro = "brutality": 1, "scale": 1, -} +}; function look() { - var desc = macro.description; + let desc = macro.description; - var line2 = "" + let line2 = ""; if (macro.height > 1e12) line2 = "You're pretty much everywhere at once."; @@ -701,8 +703,8 @@ function look() } function get_living_prey(sum) { - var total = 0; - for (var key in sum) { + let total = 0; + for (let key in sum) { if (sum.hasOwnProperty(key)) { if (key == "Person" || key == "Cow") total += sum[key]; @@ -810,13 +812,13 @@ function initVictims() "Solar System": 0, "Galaxy": 0 }; -}; +} // lists out total people function summarize(sum, fatal = true) { - var word; - var count = get_living_prey(sum); + let word; + let count = get_living_prey(sum); if (fatal && macro.brutality > 0) word = count > 1 ? "kills" : "kill"; else if (!fatal && macro.brutality > 0) @@ -829,7 +831,7 @@ function summarize(sum, fatal = true) function getOnePrey(biome,area) { - var potential = ["Person"]; + let potential = ["Person"]; if (macro.height > 1e12) potential = ["Planet","Star","Solar System","Galaxy"]; @@ -843,7 +845,7 @@ function getOnePrey(biome,area) case "rural": potential = ["Person", "Barn", "House", "Cow"]; break; } - var potAreas = [] + let potAreas = []; potential.forEach(function (x) { potAreas.push([x,areas[x]]); @@ -853,18 +855,18 @@ function getOnePrey(biome,area) return y[1] - x[1]; }); - for (var i=0; i 1e12) { weights = { @@ -872,7 +874,7 @@ function getPrey(region, area) "Star": 1.7713746e-12, "Solar System": 4e-10, "Galaxy": 0.1, - } + }; } else if (macro.height > 1e6) { weights = { @@ -880,7 +882,7 @@ function getPrey(region, area) "City": 0.05, "Continent": 0.005, "Planet": 0.0001 - } + }; } else { switch(region) @@ -925,9 +927,9 @@ function getPrey(region, area) function updateVictims(type,prey) { /* - var sums = prey.sum(); + let sums = prey.sum(); - for (var key in sums) { + for (let key in sums) { if (sums.hasOwnProperty(key)) { victims[type][key] += sums[key]; } @@ -936,14 +938,14 @@ function updateVictims(type,prey) function feed() { - var area = macro.handArea; - var prey = getPrey(biome, area); + let area = macro.handArea; + let prey = getPrey(biome, area); - var line = describe("eat", prey, macro, verbose) - var linesummary = summarize(prey.sum(), false); + let line = describe("eat", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); - var sound = ""; + let people = get_living_prey(prey.sum()); + let sound = ""; if (people == 0) { sound = ""; } else if (people < 3) { @@ -960,7 +962,7 @@ function feed() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -974,14 +976,15 @@ function feed() function chew() { - var area = macro.handArea; - var prey = getPrey(biome, area); + let area = macro.handArea; + let prey = getPrey(biome, area); - var line = describe("chew", prey, macro, verbose) - var linesummary = summarize(prey.sum(), false); + let line = describe("chew", prey, macro, verbose); - var people = get_living_prey(prey.sum()); - var sound = ""; + let linesummary = summarize(prey.sum(), false); + + let people = get_living_prey(prey.sum()); + let sound = ""; if (people == 0) { sound = ""; } else if (people < 3) { @@ -998,7 +1001,7 @@ function chew() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1010,14 +1013,14 @@ function chew() function stomp() { - var area = macro.pawArea; - var prey = getPrey(biome, area); - var line = describe("stomp", prey, macro, verbose) - var linesummary = summarize(prey.sum(), true); + let area = macro.pawArea; + let prey = getPrey(biome, area); + let line = describe("stomp", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1032,7 +1035,7 @@ function stomp() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1044,20 +1047,20 @@ function stomp() function grind() { - var area = macro.assArea / 2; + let area = macro.assArea / 2; if (macro.maleParts) - area += macro.dickArea + area += macro.dickArea; if (macro.femalePartS) area += macro.vaginaArea; - var prey = getPrey(biome,area); + let prey = getPrey(biome,area); - var line = describe("grind", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let line = describe("grind", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); - var sound = ""; + let people = get_living_prey(prey.sum()); + let sound = ""; if (people < 3) { sound = "Thump."; @@ -1073,7 +1076,7 @@ function grind() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1085,14 +1088,14 @@ function grind() function anal_vore() { - var area = macro.analVoreArea; - var prey = getOnePrey(biome,area); + let area = macro.analVoreArea; + let prey = getOnePrey(biome,area); - var line = describe("anal-vore", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let line = describe("anal-vore", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); - var sound = "Shlp"; + let people = get_living_prey(prey.sum()); + let sound = "Shlp"; if (people < 3) { sound = "Shlp."; @@ -1108,7 +1111,7 @@ function anal_vore() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1126,14 +1129,14 @@ function sit() if (macro.analVore) anal_vore(); - var area = macro.assArea; - var crushed = getPrey(biome,area); + let area = macro.assArea; + let crushed = getPrey(biome,area); - var line = describe("ass-crush", crushed, macro, verbose); - var linesummary = summarize(crushed.sum(), true); + let line = describe("ass-crush", crushed, macro, verbose); + let linesummary = summarize(crushed.sum(), true); - var people = get_living_prey(crushed.sum()); - var sound = "Thump"; + let people = get_living_prey(crushed.sum()); + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1149,7 +1152,7 @@ function sit() sound = "Oh the humanity!"; } - var crushedMass = crushed.sum_property("mass"); + let crushedMass = crushed.sum_property("mass"); macro.addGrowthPoints(crushedMass); @@ -1162,14 +1165,14 @@ function sit() function cleavage_stuff() { - var area = macro.handArea; - var prey = getPrey(biome, area); - var line = describe("cleavage-stuff", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = macro.handArea; + let prey = getPrey(biome, area); + let line = describe("cleavage-stuff", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1194,14 +1197,14 @@ function cleavage_stuff() function cleavage_crush() { - var prey = macro.cleavage.container; + let prey = macro.cleavage.container; macro.cleavage.container = new Container(); - var line = describe("cleavage-crush", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let line = describe("cleavage-crush", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1216,7 +1219,7 @@ function cleavage_crush() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1228,14 +1231,14 @@ function cleavage_crush() function cleavage_drop() { - var prey = macro.cleavage.container; + let prey = macro.cleavage.container; macro.cleavage.container = new Container(); - var line = describe("cleavage-drop", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let line = describe("cleavage-drop", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump."; @@ -1250,7 +1253,7 @@ function cleavage_drop() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1262,14 +1265,14 @@ function cleavage_drop() function cleavage_absorb() { - var prey = macro.cleavage.container; + let prey = macro.cleavage.container; macro.cleavage.container = new Container(); - var line = describe("cleavage-absorb", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let line = describe("cleavage-absorb", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Shlp."; @@ -1285,7 +1288,7 @@ function cleavage_absorb() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1297,14 +1300,14 @@ function cleavage_absorb() function breast_crush() { - var area = macro.breastArea; - var prey = getPrey(biome, area); - var line = describe("breast-crush", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let area = macro.breastArea; + let prey = getPrey(biome, area); + let line = describe("breast-crush", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1319,7 +1322,7 @@ function breast_crush() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1329,7 +1332,7 @@ function breast_crush() update([sound,line,linesummary,newline]); if (macro.lactationEnabled && macro.milkStorage.amount / macro.milkStorage.limit > 0.5) { - var amount = Math.min(macro.lactationVolume, (macro.milkStorage.amount / macro.milkStorage.limit - 0.5) * macro.milkStorage.limit); + let amount = Math.min(macro.lactationVolume, (macro.milkStorage.amount / macro.milkStorage.limit - 0.5) * macro.milkStorage.limit); milk_breasts(null, amount); } } @@ -1337,14 +1340,14 @@ function breast_crush() function breast_vore() { // todo nipple areas? - var area = macro.breastArea/2; - var prey = getPrey(biome, area); - var line = describe("breast-vore", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = macro.breastArea/2; + let prey = getPrey(biome, area); + let line = describe("breast-vore", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people < 3) { sound = "Shlp."; @@ -1359,7 +1362,7 @@ function breast_vore() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1371,7 +1374,7 @@ function breast_vore() update([sound,line,linesummary,newline]); if (macro.lactationEnabled && macro.milkStorage.amount / macro.milkStorage.limit > 0.5) { - var amount = Math.min(macro.lactationVolume, (macro.milkStorage.amount / macro.milkStorage.limit - 0.5) * macro.milkStorage.limit); + let amount = Math.min(macro.lactationVolume, (macro.milkStorage.amount / macro.milkStorage.limit - 0.5) * macro.milkStorage.limit); milk_breasts(null, amount); } } @@ -1384,15 +1387,15 @@ function milk_breasts(e,vol) macro.milkStorage.amount -= vol; - var area = Math.pow(vol, 2/3); + let area = Math.pow(vol, 2/3); - var prey = getPrey(biome, area); - var line = describe("breast-milk", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); - var linesummary = summarize(prey.sum(), true); + let prey = getPrey(biome, area); + let line = describe("breast-milk", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Dribble."; + let sound = "Dribble."; if (people < 3) { sound = "Dribble."; @@ -1407,7 +1410,7 @@ function milk_breasts(e,vol) } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1419,14 +1422,14 @@ function milk_breasts(e,vol) function unbirth() { - var area = macro.vaginaArea; - var prey = getPrey(biome, area); - var line = describe("unbirth", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = macro.vaginaArea; + let prey = getPrey(biome, area); + let line = describe("unbirth", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people < 3) { sound = "Shlp."; @@ -1442,7 +1445,7 @@ function unbirth() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1456,14 +1459,14 @@ function unbirth() function sheath_stuff() { - var area = Math.min(macro.handArea, macro.dickGirth*3); - var prey = getPrey(biome, area); - var line = describe("sheath-stuff", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = Math.min(macro.handArea, macro.dickGirth*3); + let prey = getPrey(biome, area); + let line = describe("sheath-stuff", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people < 3) { sound = "Shlp."; @@ -1489,13 +1492,13 @@ function sheath_stuff() function sheath_squeeze() { - var prey = macro.sheath.container; - var line = describe("sheath-squeeze", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let prey = macro.sheath.container; + let line = describe("sheath-squeeze", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people < 3) { sound = "Shlp."; @@ -1518,14 +1521,14 @@ function sheath_squeeze() function sheath_crush() { - var prey = macro.sheath.container; + let prey = macro.sheath.container; macro.sheath.container = new Container(); - var line = describe("sheath-crush", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let line = describe("sheath-crush", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people < 3) { sound = "Shlp."; @@ -1548,14 +1551,14 @@ function sheath_crush() function sheath_absorb() { - var prey = macro.sheath.container; + let prey = macro.sheath.container; macro.sheath.container = new Container(); - var line = describe("sheath-absorb", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let line = describe("sheath-absorb", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people < 3) { sound = "Shlp."; @@ -1579,14 +1582,14 @@ function sheath_absorb() function cockslap() { - var area = macro.dickArea; - var prey = getPrey(biome, area); - var line = describe("cockslap", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let area = macro.dickArea; + let prey = getPrey(biome, area); + let line = describe("cockslap", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1602,7 +1605,7 @@ function cockslap() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1614,14 +1617,14 @@ function cockslap() function cock_vore() { - var area = macro.dickGirth; - var prey = getPrey(biome, area); - var line = describe("cock-vore", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = macro.dickGirth; + let prey = getPrey(biome, area); + let line = describe("cock-vore", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "lp"; + let sound = "lp"; if (people < 3) { sound = "Shlp."; @@ -1636,7 +1639,7 @@ function cock_vore() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1650,14 +1653,14 @@ function cock_vore() function ball_smother() { - var area = macro.ballArea * 2; - var prey = getPrey(biome, area); - var line = describe("ball-smother", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let area = macro.ballArea * 2; + let prey = getPrey(biome, area); + let line = describe("ball-smother", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1672,7 +1675,7 @@ function ball_smother() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1684,15 +1687,15 @@ function ball_smother() function male_spurt(vol) { - var area = Math.pow(vol, 2/3); + let area = Math.pow(vol, 2/3); - var prey = getPrey(biome, area); - var line = describe("male-spurt", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); - var linesummary = summarize(prey.sum(), true); + let prey = getPrey(biome, area); + let line = describe("male-spurt", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Spurt!"; + let sound = "Spurt!"; if (people < 3) { sound = "Spurt!"; @@ -1707,7 +1710,7 @@ function male_spurt(vol) } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1717,15 +1720,15 @@ function male_spurt(vol) function male_orgasm(vol) { - var area = Math.pow(vol, 2/3); + let area = Math.pow(vol, 2/3); - var prey = getPrey(biome, area); - var line = describe("male-orgasm", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); - var linesummary = summarize(prey.sum(), true); + let prey = getPrey(biome, area); + let line = describe("male-orgasm", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Spurt!"; + let sound = "Spurt!"; if (people < 3) { sound = "Spurt!"; @@ -1740,7 +1743,7 @@ function male_orgasm(vol) } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1750,15 +1753,15 @@ function male_orgasm(vol) function female_spurt(vol) { - var area = Math.pow(vol, 2/3); + let area = Math.pow(vol, 2/3); - var prey = getPrey(biome, area); - var line = describe("female-spurt", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); - var linesummary = summarize(prey.sum(), true); + let prey = getPrey(biome, area); + let line = describe("female-spurt", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Spurt!"; + let sound = "Spurt!"; if (people < 3) { sound = "Spurt!"; @@ -1773,7 +1776,7 @@ function female_spurt(vol) } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1783,15 +1786,15 @@ function female_spurt(vol) function female_orgasm(vol) { - var area = Math.pow(vol, 2/3); + let area = Math.pow(vol, 2/3); - var prey = getPrey(biome, area); - var line = describe("female-orgasm", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); - var linesummary = summarize(prey.sum(), true); + let prey = getPrey(biome, area); + let line = describe("female-orgasm", prey, macro, verbose).replace("$VOLUME",volume(vol,unit,false)); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Spurt!"; + let sound = "Spurt!"; if (people < 3) { sound = "Spurt!"; @@ -1806,7 +1809,7 @@ function female_orgasm(vol) } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1816,14 +1819,14 @@ function female_orgasm(vol) function tail_slap() { - var area = macro.tailArea * macro.tailCount; - var prey = getPrey(biome, area); - var line = describe("tail-slap", prey, macro, verbose); - var linesummary = summarize(prey.sum(), true); + let area = macro.tailArea * macro.tailCount; + let prey = getPrey(biome, area); + let line = describe("tail-slap", prey, macro, verbose); + let linesummary = summarize(prey.sum(), true); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Thump!"; @@ -1838,7 +1841,7 @@ function tail_slap() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1850,14 +1853,14 @@ function tail_slap() function tail_vore() { - var area = macro.tailGirth * macro.tailCount; - var prey = getPrey(biome, area); - var line = describe("tail-vore", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = macro.tailGirth * macro.tailCount; + let prey = getPrey(biome, area); + let line = describe("tail-vore", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = ""; + let sound = ""; if (people == 0) { sound = ""; } else if (people < 3) { @@ -1873,7 +1876,7 @@ function tail_vore() } else { sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1887,14 +1890,14 @@ function tail_vore() function pouch_stuff() { - var area = macro.handArea; - var prey = getPrey(biome, area); - var line = describe("pouch-stuff", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let area = macro.handArea; + let prey = getPrey(biome, area); + let line = describe("pouch-stuff", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); + let people = get_living_prey(prey.sum()); - var sound = "Thump"; + let sound = "Thump"; if (people < 3) { sound = "Slp."; @@ -1920,14 +1923,14 @@ function pouch_stuff() function pouch_eat() { - var prey = macro.pouch.container; + let prey = macro.pouch.container; macro.pouch.container = new Container(); - var line = describe("pouch-eat", prey, macro, verbose); - var linesummary = summarize(prey.sum(), false); + let line = describe("pouch-eat", prey, macro, verbose); + let linesummary = summarize(prey.sum(), false); - var people = get_living_prey(prey.sum()); - var sound = ""; + let people = get_living_prey(prey.sum()); + let sound = ""; if (people == 0) { sound = ""; } else if (people < 3) { @@ -1944,7 +1947,7 @@ function pouch_eat() sound = "Oh the humanity!"; } - var preyMass = prey.sum_property("mass"); + let preyMass = prey.sum_property("mass"); macro.addGrowthPoints(preyMass); @@ -1963,10 +1966,10 @@ function transformNumbers(line) function update(lines = []) { - var log = document.getElementById("log"); + let log = document.getElementById("log"); lines.forEach(function (x) { - var line = document.createElement('div'); + let line = document.createElement('div'); line.innerHTML = transformNumbers(x); log.appendChild(line); }); @@ -1979,16 +1982,16 @@ function update(lines = []) document.getElementById("growth-points").innerHTML = "Growth Points:" + macro.growthPoints; document.getElementById("arousal").innerHTML = "Arousal: " + round(macro.arousal,0) + "%"; document.getElementById("edge").innerHTML = "Edge: " + round(macro.edge * 100,0) + "%"; - document.getElementById("cum").innerHTML = "Cum: " + transformNumbers(volume(macro.cumStorage.amount,unit,false)) + document.getElementById("cum").innerHTML = "Cum: " + transformNumbers(volume(macro.cumStorage.amount,unit,false)); document.getElementById("cumPercent").innerHTML = Math.round(macro.cumStorage.amount / macro.cumStorage.limit * 100) + "%"; document.getElementById("femcum").innerHTML = "Femcum: " + transformNumbers(volume(macro.femcumStorage.amount,unit,false)); document.getElementById("femcumPercent").innerHTML = Math.round(macro.femcumStorage.amount / macro.femcumStorage.limit * 100) + "%"; document.getElementById("milk").innerHTML = "Milk: " + transformNumbers(volume(macro.milkStorage.amount,unit,false)); document.getElementById("milkPercent").innerHTML = Math.round(macro.milkStorage.amount / macro.milkStorage.limit * 100) + "%"; - for (var type in victims) { + for (let type in victims) { if (victims.hasOwnProperty(type)) { - for (var key in victims[type]){ + for (let key in victims[type]){ if (victims[type].hasOwnProperty(key) && victims[type][key] > 0) { document.getElementById("stat-" + key).style.display = "table-row"; document.getElementById("stat-" + type + "-" + key).innerHTML = number(victims[type][key],numbers); @@ -2004,7 +2007,7 @@ function pick_move() setTimeout(pick_move, 1500 * Math.sqrt(macro.scale)); return; } - var choice = Math.random(); + let choice = Math.random(); if (choice < 0.2) { sit(); @@ -2046,19 +2049,19 @@ function grow(times=1) macro.growthPoints -= 100 * times; - var oldHeight = macro.height; - var oldMass = macro.mass; + let oldHeight = macro.height; + let oldMass = macro.mass; macro.scale *= Math.pow(1.02,times); - var newHeight = macro.height; - var newMass = macro.mass; + let newHeight = macro.height; + let newMass = macro.mass; - var heightDelta = newHeight - oldHeight; - var massDelta = newMass - oldMass; + let heightDelta = newHeight - oldHeight; + let massDelta = newMass - oldMass; - var heightStr = length(heightDelta, unit); - var massStr = mass(massDelta, unit); + let heightStr = length(heightDelta, unit); + let massStr = mass(massDelta, unit); update(["Power surges through you as you grow " + heightStr + " taller and gain " + massStr + " of mass",newline]); } @@ -2072,13 +2075,13 @@ function grow_dick(times=1) macro.growthPoints -= 10 * times; - var oldLength = macro.dickLength; - var oldMass = macro.dickMass; + let oldLength = macro.dickLength; + let oldMass = macro.dickMass; macro.dickScale = Math.pow(macro.dickScale * macro.dickScale + 1.02*times, 1/2) ; - var lengthDelta = macro.dickLength - oldLength; - var massDelta = macro.dickMass - oldMass; + let lengthDelta = macro.dickLength - oldLength; + let massDelta = macro.dickMass - oldMass; update(["Power surges through you as your " + macro.dickType + " cock grows " + length(lengthDelta, unit, false) + " longer and gains " + mass(massDelta, unit, false) + " of mass",newline]); } @@ -2091,13 +2094,13 @@ function grow_balls(times=1) macro.growthPoints -= 10 * times; - var oldDiameter = macro.ballDiameter; - var oldMass = macro.ballMass; + let oldDiameter = macro.ballDiameter; + let oldMass = macro.ballMass; macro.ballScale = Math.pow(macro.ballScale * macro.ballScale + 1.02*times, 1/2) ; - var diameterDelta = macro.ballDiameter - oldDiameter; - var massDelta = macro.ballMass - oldMass; + let diameterDelta = macro.ballDiameter - oldDiameter; + let massDelta = macro.ballMass - oldMass; update(["Power surges through you as your balls swell by " + length(diameterDelta, unit, false) + ", gaining " + mass(massDelta, unit, false) + " of mass apiece",newline]); } @@ -2110,13 +2113,13 @@ function grow_breasts(times=1) macro.growthPoints -= 10 * times; - var oldDiameter = macro.breastDiameter; - var oldMass = macro.breastMass; + let oldDiameter = macro.breastDiameter; + let oldMass = macro.breastMass; macro.breastScale = Math.pow(macro.breastScale * macro.breastScale + 1.02*times, 1/2) ; - var diameterDelta = macro.breastDiameter - oldDiameter; - var massDelta = macro.breastMass - oldMass; + let diameterDelta = macro.breastDiameter - oldDiameter; + let massDelta = macro.breastMass - oldMass; update(["Power surges through you as your breasts swell by " + length(diameterDelta, unit, false) + ", gaining " + mass(massDelta, unit, false) + " of mass apiece",newline]); } @@ -2129,11 +2132,11 @@ function grow_vagina(times=1) macro.growthPoints -= 10 * times; - var oldLength = macro.vaginaLength; + let oldLength = macro.vaginaLength; macro.vaginaScale = Math.pow(macro.vaginaScale * macro.vaginaScale + 1.02*times, 1/2) ; - var lengthDelta = macro.vaginaLength - oldLength; + let lengthDelta = macro.vaginaLength - oldLength; update(["Power surges through you as your moist slit expands by by " + length(lengthDelta, unit, false),newline]); } @@ -2147,57 +2150,39 @@ function grow_ass(times=1) macro.growthPoints -= 10 * times; - var oldDiameter = Math.pow(macro.assArea,1/2); + let oldDiameter = Math.pow(macro.assArea,1/2); macro.assScale = Math.pow(macro.assScale * macro.assScale + 1.02*times, 1/2) ; - var diameterDelta = Math.pow(macro.assArea,1/2) - oldDiameter; + let diameterDelta = Math.pow(macro.assArea,1/2) - oldDiameter; update(["Power surges through you as your ass swells by " + length(diameterDelta, unit, false),newline]); } function grow_lots() { - var oldHeight = macro.height; - var oldMass = macro.mass; + let oldHeight = macro.height; + let oldMass = macro.mass; macro.scale *= 100; - var newHeight = macro.height; - var newMass = macro.mass; + let newHeight = macro.height; + let newMass = macro.mass; - var heightDelta = newHeight - oldHeight; - var massDelta = newMass - oldMass; + let heightDelta = newHeight - oldHeight; + let massDelta = newMass - oldMass; - var heightStr = length(heightDelta, unit); - var massStr = mass(massDelta, unit); + let heightStr = length(heightDelta, unit); + let massStr = mass(massDelta, unit); update(["Power surges through you as you grow " + heightStr + " taller and gain " + massStr + " of mass",newline]); } -function preset(name) { - switch(name){ - case "Fen": - macro.species = "crux"; - macro.baseHeight = 2.2606; - macro.baseMass = 124.738; - break; - case "Renard": - macro.species = "fox"; - macro.baseHeight = 1.549; - macro.baseMass = 83.9; - case "Vulpes": - macro.species = "fox"; - macro.baseHeight = 20000; - macro.baseMass = 180591661866272; - } -} - function saveSettings() { - var storage = window.localStorage; - var settings = {}; - var form = document.forms.namedItem("custom-species-form"); + let storage = window.localStorage; + let settings = {}; + let form = document.forms.namedItem("custom-species-form"); - for (var i=0; i 1 ? " tails swing" : " tail swings") + " into " + container.describe(verbose) + ", smashing everything in " - + (macro.tailCount > 1 ? "their" : "its") + " path."; + return "Your " + macro.describeTail + (macro.tailCount > 1 ? " tails swing" : " tail swings") + " into " + container.describe(verbose) + ", smashing everything in " + + (macro.tailCount > 1 ? "their" : "its") + " path."; else return "Your " + macro.describeTail + (macro.tailCount > 1 ? " tails slap" : " tail slaps") + " against " + container.describe(verbose) + ", bowling them over."; } function defaultTailVore(container, macro, verbose) { if (isFatal(macro)) - return "Your " + macro.describeTail + (macro.tailCount > 1 ? " tails lunge, maws agape, " : " tail lunges, maw agape, ") + "at " + container.describe(verbose) - + ". " + (macro.tailCount > 1 ? "They" : "It") + " scarf down everything in a second, gulping forcefully to drag your prey into your sloppy guts."; + return "Your " + macro.describeTail + (macro.tailCount > 1 ? " tails lunge, maws agape, " : " tail lunges, maw agape, ") + "at " + container.describe(verbose) + + ". " + (macro.tailCount > 1 ? "They" : "It") + " scarf down everything in a second, gulping forcefully to drag your prey into your sloppy guts."; else - return "Your " + macro.describeTail + (macro.tailCount > 1 ? " tails lunge, maws agape, " : " tail lunges, maw agape, ") + "at " + container.describe(verbose) - + ". " + (macro.tailCount > 1 ? "They" : "It") + " scarf down everything in a second, gulping forcefully and pulling everything into your belly."; + return "Your " + macro.describeTail + (macro.tailCount > 1 ? " tails lunge, maws agape, " : " tail lunges, maw agape, ") + "at " + container.describe(verbose) + + ". " + (macro.tailCount > 1 ? "They" : "It") + " scarf down everything in a second, gulping forcefully and pulling everything into your belly."; } function defaultCleavageStuff(container, macro, verbose) { @@ -433,9 +406,9 @@ rules["eat"].push({ rules["eat"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasLessThan(container, "Person", 6) - && macro.height >= 10; + return hasOnly(container, ["Person"]) && + hasLessThan(container, "Person", 6) && + macro.height >= 10; }, "desc": function(container, macro, verbose) { return "You pluck up the " + container.describe() + " and stuff them into your mouth, swallowing lightly to drag them down to your bubbling guts."; @@ -444,9 +417,9 @@ rules["eat"].push({ rules["eat"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 1) - && macro.height < 10; + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 1) && + macro.height < 10; }, "desc": function(container, macro, verbose) { return "You grasp " + container.describe() + " and greedily wolf them down, swallowing forcefully to cram them into your bulging stomach. A crass belch escapes your lips as they curl up in your slimy gut."; @@ -455,9 +428,9 @@ rules["eat"].push({ rules["eat"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person","Car"]) - && hasExactly(container, "Car", 1) - && hasLessThan(container, "Person", 5); + return hasOnly(container, ["Person","Car"]) && + hasExactly(container, "Car", 1) && + hasLessThan(container, "Person", 5); }, "desc": function(container, macro, verbose) { return "You crush the " + container.contents["Car"].describe() + " with your tight throat, washing it down with " + container.contents["Person"].describe(); @@ -466,9 +439,9 @@ rules["eat"].push({ rules["eat"].push({ "test": function(container, macro) { - return hasExactly(container, "Small Skyscraper", 1) - && nothingLarger(container, "Small Skyscraper") - && macro.height < 500; + return hasExactly(container, "Small Skyscraper", 1) && + nothingLarger(container, "Small Skyscraper") && + macro.height < 500; }, "desc": function(container, macro, verbose) { return "You drop onto your hands and knees, jaws opening wide to envelop the skyscraper. It glides into your throat as your snout touches the ground,\ @@ -479,9 +452,9 @@ rules["eat"].push({ rules["eat"].push({ "test": function(container, macro) { - return hasExactly(container, "Small Skyscraper", 2) - && nothingLarger(container, "Small Skyscraper") - && macro.height < 750; + return hasExactly(container, "Small Skyscraper", 2) && + nothingLarger(container, "Small Skyscraper") && + macro.height < 750; }, "desc": function(container, macro, verbose) { return "You drop onto your hands and knees, jaws opening wide to envelop the skyscraper. It glides into your throat as your snout touches the ground,\ @@ -496,34 +469,34 @@ rules["eat"].push({ rules["chew"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 1) - && isGory(macro) - && macro.height < 5; + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 1) && + isGory(macro) && + macro.height < 5; }, "desc": function(container, macro, verbose) { return "You tackle a " + container.describe(verbose) + " and dig into your meal, powerful jaws ripping them to shreds in seconds. You wolf down great mouthfuls \ of meat, consuming them in a terrifying frenzy that ends with naught but bones lying on the ground."; } -}) +}); rules["chew"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 1) - && isGory(macro) - && macro.height >= 5; + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 1) && + isGory(macro) && + macro.height >= 5; }, "desc": function(container, macro, verbose) { return "You snatch up a " + container.describe(verbose) + ", then stuff their lower body into the guillotine that is your ravenous maw - slicing off their legs with \ a single disgusting crunch, then finishing them off with another ravenous bite that obliterates their torso. Their bleeding head falls from your lips, only to be \ caught between two fingers and popped back in to be crunched between molars and swallowed."; } -}) +}); rules["chew"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 2) - && isGory(macro) + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 2) && + isGory(macro); }, "desc": function(container, macro, verbose) { var prey1 = new Person(1).describe(verbose); var prey2 = new Person(1).describe(verbose); @@ -531,15 +504,15 @@ rules["chew"].push({ in a vice. A heartbeat later, their face is jammed into your bloody throat. A squeeze of your jaws snaps their spine with ease, and their limp body plunges down into \ your churning depths to be destroyed."; } -}) +}); // STOMPING rules["stomp"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 1) - && isFatal(macro); + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 1) && + isFatal(macro); }, "desc": function(container, macro, verbose) { return "Your heavy paw slams down on " + container.describe(verbose) + ", smashing the poor thing like an insect."; } @@ -547,9 +520,9 @@ rules["stomp"].push({ rules["stomp"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 1) - && isGory(macro); + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 1) && + isGory(macro); }, "desc": function(container, macro, verbose) { return "Your paw thumps " + container.describe(verbose) + ", shoving your victim to the ground and cracking them open like an egg."; } @@ -557,9 +530,9 @@ rules["stomp"].push({ rules["stomp"].push({ "test": function(container, macro) { - return hasOnly(container, ["Person"]) - && hasExactly(container, "Person", 1) - && isGory(macro); + return hasOnly(container, ["Person"]) && + hasExactly(container, "Person", 1) && + isGory(macro); }, "desc": function(container, macro, verbose) { return "Your shadow falls over " + container.describe(verbose) + ", and your paw follows, crushing their soft body and reducing them to a heap of broken gore."; } @@ -567,8 +540,8 @@ rules["stomp"].push({ rules["stomp"].push({ "test": function(container, macro) { - return hasNothingElse(container, ["Person","Cow","Car"]) - && isNonFatal(macro); + return hasNothingElse(container, ["Person","Cow","Car"]) && + isNonFatal(macro); }, "desc": function(container, macro, verbose) { return "Your soft paws smoosh over " + container.describe(verbose) + ". They stick to your toes, carried along for the ride as you take another few steps before finally\ falling off."; @@ -579,19 +552,19 @@ rules["stomp"].push({ rules["anal-vore"].push({ "test": function(container, macro) { - return hasExactly(container, "Person", 1) - && hasOnly(container, ["Person"]); + return hasExactly(container, "Person", 1) && + hasOnly(container, ["Person"]); }, "desc": function(container, macro, verbose) { let adjective = ["musky","winding","churning"][Math.floor(Math.random()*3)]; - return "Your weighty rump slams against the ground. A shock of pleasure runs up your spine as a " + container.describe(verbose) + " slides up your ass," - + (macro.maleParts ? " grinding against your prostate" : "") + ". A powerful clench drags them deeper into your bowels, sealing them away in your " + adjective + " depths."; + return "Your weighty rump slams against the ground. A shock of pleasure runs up your spine as a " + container.describe(verbose) + " slides up your ass," + + (macro.maleParts ? " grinding against your prostate" : "") + ". A powerful clench drags them deeper into your bowels, sealing them away in your " + adjective + " depths."; } }); rules["anal-vore"].push({ "test": function(container, macro) { - return hasExactly(container, "Car", 1) - && hasOnly(container, ["Car"]); + return hasExactly(container, "Car", 1) && + hasOnly(container, ["Car"]); }, "desc": function(container, macro, verbose) { return "You ram " + container.describe(verbose) + " up your ass, biting your lip as it" + (macro.maleParts ? " rubs along your prostate" : " slides into velvety depths") + ".\ You moan and clench hard, yanking it in with a wet shlrrp and abruplty silencing its blaring horn."; @@ -600,8 +573,8 @@ rules["anal-vore"].push({ rules["anal-vore"].push({ "test": function(container, macro) { - return hasExactly(container, "Bus", 1) - && hasOnly(container, ["Bus"]); + return hasExactly(container, "Bus", 1) && + hasOnly(container, ["Bus"]); }, "desc": function(container, macro, verbose) { return "A speeding bus slams on its brakes as you abruptly sit - but it's too late to stop. A gasp flies from your lips as it penetrates your greedy ass, sinking halfway in and coming to a halt. \ You grunt and squeeze, causing its frame to creak and groan. Two fingers to the back are enough to get it moving again, and it slowly works inside. You shiver and moan, taking it in all the way. \ @@ -611,8 +584,8 @@ rules["anal-vore"].push({ rules["anal-vore"].push({ "test": function(container, macro) { - return hasExactly(container, "Train", 1) - && hasOnly(container, ["Train"]); + return hasExactly(container, "Train", 1) && + hasOnly(container, ["Train"]); }, "desc": function(container, macro, verbose) { var cars = container.contents["Train"].contents["Train Car"].count; return "Your massive fingers wrap around a train, yanking it from the rails with a tremendous screech of metal-on-metal. You squat down low, eyes rolling back in anticipation as you thrust the locomotive towards your massive ass - and then it hits home. A moan of pleasure shakes the earth, your ravenous pucker spread around the engine and sucking it in with a squelch. Powerful muscles squeeze and grab...and " + container.describe(verbose) + " swiftly vanishes into your bowels, every one of the " + cars + " cars a fresh shock of pleasure as they glide into your musky depths."; diff --git a/recursive-macro.js b/recursive-macro.js index 29dc093..d301633 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -109,7 +109,7 @@ var clusters = function fill_area(area, weights, variance=0.15) { - var area = area + Math.random() * variance * 2 - variance; + area = area + Math.random() * variance * 2 - variance; var result = []; var candidates = []; for (var key in weights) { @@ -193,9 +193,9 @@ function merge_things(list,semicolons=false) { list.slice(0,list.length-1).forEach(function(term) { result += term + ", "; - }) + }); - result += "and " + list[list.length-1] + result += "and " + list[list.length-1]; return result; } @@ -204,7 +204,7 @@ function merge_things(list,semicolons=false) { // combine the adjectives for something into a single string function merge_desc(list) { - var result = "" + var result = ""; list.forEach(function(term) { if (term != "") @@ -228,17 +228,17 @@ function merge_desc(list) { function distribution(min, max, samples) { var result = 0; - var limit = Math.min(100,samples) + var limit = Math.min(100,samples); if (limit < samples) { - for (var i = 0; i < limit; i++) { + for (let i = 0; i < limit; i++) { result += (i/10 + 1) * Math.floor(Math.random() * (max - min + 1) + min); } result = Math.round((result / 595) * samples * (max - min) + min); } else { - for (var i = 0; i < limit; i++) { + for (let i = 0; i < limit; i++) { result += Math.floor(Math.random() * (max - min + 1) + min); } } @@ -268,7 +268,7 @@ function defaultMerge(thing) { } } - for (var key in container.contents) { + for (key in container.contents) { if (container.contents.hasOwnProperty(key)) { if (this.contents.hasOwnProperty(key)) { newThing.contents[key] = this.contents[key].merge(container.contents[key]); @@ -279,12 +279,12 @@ function defaultMerge(thing) { } return newThing; - } + }; } function defaultSum(thing) { return function() { - var counts = {} + var counts = {}; if (thing.name != "Container") counts[thing.name] = thing.count; @@ -302,7 +302,7 @@ function defaultSum(thing) { } return counts; - } + }; } function defaultSumProperty(thing) { @@ -318,19 +318,19 @@ function defaultSumProperty(thing) { } return total; - } + }; } function defaultAddContent(thing) { return function(name, min, max, count) { if (min == max) { - var object = new things[name](min*count); + let object = new things[name](min*count); thing.contents[object.name] = object; } else { - var object = new things[name](distribution(min, max, count)); + let object = new things[name](distribution(min, max, count)); thing.contents[object.name] = object; } - } + }; } function DefaultEntity() { @@ -348,7 +348,7 @@ function DefaultEntity() { function copy_defaults(self,proto) { for (var key in proto) { if (proto.hasOwnProperty(key)) { - self[key] = proto[key](self) + self[key] = proto[key](self); } } } @@ -363,7 +363,7 @@ function Container(contents = []) { else this.count = 0; - this.contents = {} + this.contents = {}; for (var i=0; i < contents.length; i++) { this.contents[contents[i].name] = contents[i]; @@ -376,8 +376,8 @@ function Container(contents = []) { } this.describe = function(verbose = true) { - return describe_all(this.contents,verbose) - } + return describe_all(this.contents,verbose); + }; return this; } @@ -394,12 +394,13 @@ function Person(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)); + var species = ""; if (!humanMode) - var 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"]); else - var species = random_desc(["jogger","police officer","road worker","pastor","dog-walker","clerk","accountant","CEO","millionaire","mailman"]); + species = random_desc(["jogger","police officer","road worker","pastor","dog-walker","clerk","accountant","CEO","millionaire","mailman"]); return "a " + merge_desc([body,sex,species]); - } + }; this.describe = function(verbose=true) { if (verbose) { @@ -410,12 +411,12 @@ function Person(count = 1) { } return merge_things(list); } else { - return this.count + " people" + return this.count + " people"; } } else { return (this.count > 1 ? this.count + " people" : "a person"); } - } + }; return this; } @@ -433,7 +434,7 @@ function Cow(count = 1) { 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"]); - } + }; this.describe = function(verbose=true) { if (verbose) { @@ -444,12 +445,12 @@ function Cow(count = 1) { } return merge_things(list); } else { - return this.count + " cattle" + return this.count + " cattle"; } } else { return (this.count > 1 ? this.count + " cattle" : "a cow"); } - } + }; return this; } @@ -469,7 +470,7 @@ function EmptyCar(count = 1) { var adjective = random_desc(["rusty","brand-new"],0.3); var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]); return "a parked " + merge_desc([adjective,color,type]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -486,7 +487,7 @@ function EmptyCar(count = 1) { return (this.count > 1 ? this.count + " parked cars" : "a parked car"); } - } + }; } function Car(count = 1) { @@ -503,7 +504,7 @@ function Car(count = 1) { var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0)); var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]); return "a " + merge_desc([adjective,color,type]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -520,7 +521,7 @@ function Car(count = 1) { return (this.count > 1 ? this.count + " cars" : "a car"); } - } + }; } function Bus(count = 1) { @@ -537,7 +538,7 @@ function Bus(count = 1) { var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0)); var type = random_desc(["bus","double-decker bus","articulating bus"]); return "a " + merge_desc([adjective,color,type]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -554,7 +555,7 @@ function Bus(count = 1) { return (this.count > 1 ? this.count + " buses" : "a bus"); } - } + }; } function Tram(count = 1) { @@ -571,7 +572,7 @@ function Tram(count = 1) { var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0)); var type = random_desc(["tram"]); return "a " + merge_desc([adjective,color,type]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -587,12 +588,12 @@ function Tram(count = 1) { } else { return (this.count > 1 ? this.count + " trams" : "a tram"); } - } + }; this.anal_vore = function() { return "You slide " + this.describe() + " up your tight ass"; - } + }; } function Motorcycle(count = 1) { @@ -621,7 +622,7 @@ function Train(count = 1) { 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]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -638,12 +639,12 @@ function Train(count = 1) { return (this.count > 1 ? this.count + " trains" : "a train"); } - } + }; this.anal_vore = function() { var cars = (this.contents["Train Car"].count == 1 ? this.contents["Train Car"].describe() + " follows it inside" : this.contents["Train Car"].describe() + " are pulled slowly inside"); return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars; - } + }; } function TrainCar(count = 1) { @@ -660,7 +661,7 @@ function TrainCar(count = 1) { var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0)); var type = random_desc(["train car","passenger train car","freight train car"]); return "a " + merge_desc([adjective,color,type]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -668,7 +669,7 @@ function TrainCar(count = 1) { } else { return (this.count > 1 ? this.count + " train cars" : "a train car"); } - } + }; } function House(count = 1) { @@ -685,7 +686,7 @@ function House(count = 1) { var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); var name = random_desc(["house","house","house","house","house","trailer"], 1); return "a " + merge_desc([size,color,name]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -701,7 +702,7 @@ function House(count = 1) { } else { return (this.count > 1 ? this.count + " houses" : "a house"); } - } + }; } function Barn(count = 1) { @@ -719,7 +720,7 @@ function Barn(count = 1) { var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1); return "a " + merge_desc([size,color,name]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -735,7 +736,7 @@ function Barn(count = 1) { } else { return (this.count > 1 ? this.count + " barns" : "a barn"); } - } + }; } function SmallSkyscraper(count = 1) { @@ -752,7 +753,7 @@ function SmallSkyscraper(count = 1) { var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); var name = random_desc(["skyscraper","office tower","office building"], 1); return "a " + merge_desc([color,name]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -769,14 +770,6 @@ function SmallSkyscraper(count = 1) { return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper"); } - } - - this.anal_vore = function(verbose=true,height=10) { - var line = skyscraperAnalVore(this,verbose,height); - if (line == "") - return defaultAnalVore(this)(verbose); - else - return line; }; } @@ -794,7 +787,7 @@ function LargeSkyscraper(count = 1) { var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0)); var name = random_desc(["skyscraper","office tower","office building"], 1); return "a " + merge_desc(["towering",color,name]); - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -810,7 +803,7 @@ function LargeSkyscraper(count = 1) { } else { return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper"); } - } + }; } function ParkingGarage(count = 1) { @@ -828,7 +821,7 @@ function ParkingGarage(count = 1) { this.describeOne = function(verbose=true) { return "a parking garage"; - } + }; this.describe = function(verbose = true) { if (verbose) { @@ -836,7 +829,7 @@ function ParkingGarage(count = 1) { } else { return (this.count == 1 ? "a parking garage" : this.count + " parking garages"); } - } + }; } function Overpass(count = 1) { @@ -879,7 +872,7 @@ function Town(count = 1) { } else { return (this.count == 1 ? "a town" : this.count + " towns"); } - } + }; } function City(count = 1) { @@ -915,7 +908,7 @@ function City(count = 1) { } else { return (this.count == 1 ? "a city" : this.count + " cities"); } - } + }; } function Continent(count = 1) { @@ -943,7 +936,7 @@ function Continent(count = 1) { } else { return (this.count == 1 ? "a continent" : this.count + " continents"); } - } + }; } function Planet(count = 1) { @@ -961,7 +954,7 @@ function Planet(count = 1) { } else { return (this.count == 1 ? "a planet" : this.count + " planets"); } - } + }; } function Star(count = 1) { @@ -973,7 +966,7 @@ function Star(count = 1) { this.describe = function(verbose = true) { return (this.count == 1 ? "a star" : this.count + " stars"); - } + }; } function SolarSystem(count = 1) { @@ -993,7 +986,7 @@ function SolarSystem(count = 1) { } else { return (this.count == 1 ? "a solar system" : this.count + " solar systems"); } - } + }; } function Galaxy(count = 1) { @@ -1013,5 +1006,5 @@ function Galaxy(count = 1) { } else { return (this.count == 1 ? "a galaxy" : this.count + " galaxies"); } - } + }; } diff --git a/stroll.html b/stroll.html index 3ac965f..29e412c 100644 --- a/stroll.html +++ b/stroll.html @@ -72,7 +72,7 @@
-
Welcome to Stroll 0.5.0
+
Welcome to Stroll 0.5.1
This game features 18+ content
It's a nice day for a walk
@@ -128,7 +128,7 @@
-

Welcome to Stroll 0.5.0

+

Welcome to Stroll 0.5.1

This game features 18+ content

Changelog
diff --git a/units.js b/units.js index 41d62fa..4effd1e 100644 --- a/units.js +++ b/units.js @@ -82,201 +82,201 @@ function number_prefix(value) { function mass(kg, type="metric", singular=false) { switch(type) { - case "metric": return metricMass(kg, singular); break; - case "customary": return customaryMass(kg, singular); break; - case "approx": return approxMass(kg, singular); break; + case "metric": return metricMass(kg, singular); + case "customary": return customaryMass(kg, singular); + case "approx": return approxMass(kg, singular); } } function length(m, type="metric", singular=false) { switch(type) { - case "metric": return metricLength(m, singular); break; - case "customary": return customaryLength(m, singular); break; - case "approx": return approxLength(m, singular); break; + case "metric": return metricLength(m, singular); + case "customary": return customaryLength(m, singular); + case "approx": return approxLength(m, singular); } } function volume(m3, type="metric", singular=false) { switch(type) { - case "metric": return metricVolume(m3, singular); break; - case "customary": return customaryVolume(m3, singular); break; - case "approx": return approxVolume(m3, singular); break; + case "metric": return metricVolume(m3, singular); + case "customary": return customaryVolume(m3, singular); + case "approx": return approxVolume(m3, singular); } } function metricMass(kg, singular=false) { if (kg < 1/1000) { - var mass = round(kg * 1e6,0); + let mass = round(kg * 1e6,0); return mass + (singular || mass == 1 ? " milligram" : " milligrams"); } else if (kg < 1) { - var mass = round(kg * 1000,0); + let mass = round(kg * 1000,0); return mass + (singular || mass == 1 ? " gram" : " grams"); } else if (kg < 5000) { - var mass = round(kg,0); + let mass = round(kg,0); return mass + (singular || mass == 1 ? " kilogram" : " kilograms"); } else if (kg < 5000000) { - var mass = round(kg / 1000,1); + let mass = round(kg / 1000,1); return mass + (singular || mass == 1 ? " metric ton" : " metric tons"); } else if (kg < 5000000000) { - var mass = round(kg / 1000000,1); + let mass = round(kg / 1000000,1); return mass + (singular || mass == 1 ? " kiloton" : " kilotons"); } else if (kg < 5000000000000) { - var mass = round(kg / 1000000000,1); + let mass = round(kg / 1000000000,1); return mass + (singular || mass == 1 ? " megaton" : " megatons"); } else { - var mass = round(kg / 1000000000000,1); + let mass = round(kg / 1000000000000,1); return mass + (singular || mass == 1 ? " gigaton" : " gigatons"); } } function customaryMass(kg, singular=false) { - var lbs = kg * 2.2; + let lbs = kg * 2.2; if (lbs < 1) { - var mass = round(lbs * 16,0); + let mass = round(lbs * 16,0); return mass + (singular || mass == 1 ? " ounce" : " ounces"); } else if (lbs < 2000) { - var mass = round(lbs,0); + let mass = round(lbs,0); return mass + (singular || mass == 1 ? " pound" : " pounds"); } else { - var mass = round(lbs / 2000,1); + let mass = round(lbs / 2000,1); return mass + (singular || mass == 1 ? "ton" : " tons"); } } function approxMass(kg, singular=false) { if (kg < 10000) { - var mass = round(kg/1000,2); + let mass = round(kg/1000,2); return (singular || mass == 1 ? "a car" : mass + " cars"); } else if (kg < 100000) { - var mass = round(kg/6000,2); + let mass = round(kg/6000,2); return (singular || mass == 1 ? "an elephant" : mass + " elephants"); } else if (kg < 1000000000) { - var mass = round(kg/54431.1,2); + let mass = round(kg/54431.1,2); return (singular || mass == 1 ? "a tank" : mass + " tanks"); } else if (kg < 1e21) { - var mass = round(kg/1.01605e8,2); + let mass = round(kg/1.01605e8,2); return (singular || mass == 1 ? "an aircraft carrier" : mass + " aircraft carriers"); } else { - var mass = round(kg/5.972e24,4); + let mass = round(kg/5.972e24,4); return (singular || mass == 1 ? "the Earth" : mass + " Earths"); } } function metricLength(m, singular=false) { if (m < 1/100) { - var length = round(m * 1000,2); + let length = round(m * 1000,2); return length + (singular || length == 1 ? " millimeter" : " millimeters"); } else if (m < 1) { - var length = round(m * 100,0); + let length = round(m * 100,0); return length + (singular || length == 1 ? " centimeter" : " centimeters"); } else if (m < 500) { - var length = round(m,2); + let length = round(m,2); return length + (singular || length == 1 ? " meter" : " meters"); } else { - var length = round(m / 1000,1); + let length = round(m / 1000,1); return length + (singular || length == 1 ? " kilometer" : " kilometers"); } } function customaryLength(m, singular=false) { - var ft = m * 3.28084; + let ft = m * 3.28084; if (ft < 1) { - var length = round(ft * 12,0); + let length = round(ft * 12,0); return length + (singular || length == 1 ? " inch" : " inches"); } else if (ft < 5280) { - var end = customaryLength((ft - Math.floor(ft))/3.28084, singular); - var length = Math.floor(ft); + let end = customaryLength((ft - Math.floor(ft))/3.28084, singular); + let length = Math.floor(ft); return length + (singular || length == 1 ? " foot" : " feet") + " " + end; } else { - var length = round(ft/5280,1); + let length = round(ft/5280,1); return length + (singular || length == 1 ? " mile" : " miles"); } } function approxLength(m, singular=false) { if (m < 1000) { - var length = round(m/49,1); + let length = round(m/49,1); return length + (singular || length == 1 ? " football field" : " football fields"); } else if (m < 5000000) { - var length = round(m/449,1); + let length = round(m/449,1); return length + (singular || length == 1 ? " Empire State Building" : " Empire State Buildings"); } else if (m < 3474574*2) { - var length = round(m/3474574,1); + let length = round(m/3474574,1); return length + (singular || length == 1 ? " moon" : " moons"); } else if (m < 12.742e6*100) { - var length = round(m/12.742e6,1); + let length = round(m/12.742e6,1); return length + (singular || length == 1 ? " earth" : " earths"); } else if (m < 149.6e12) { - var length = round(m/149.6e9,1); + let length = round(m/149.6e9,1); return length + (singular || length == 1 ? " AU" : " AUs"); } else { - var length = round(m/9.4607e15,4); + let length = round(m/9.4607e15,4); return length + (singular || length == 1 ? " light year" : " light years"); } } function metricVolume(m3, singular=false) { if (m3 < 1/1000) { - var volume = round(m3*1e6, 0); + let volume = round(m3*1e6, 0); return volume + (singular || volume == 1 ? " milliliter" : " milliliters"); } else if (m3 < 1) { - var volume = round(m3*1000, 1); + let volume = round(m3*1000, 1); return volume + (singular || volume == 1 ? " liter" : " liters"); } else if (m3 < 1000000) { - var volume = round(m3, 0); + let volume = round(m3, 0); return volume + (singular || volume == 1 ? " cubic meter" : " cubic meters"); } else if (m3 < 1e12){ - var volume = round(m3/1e9, 6); + let volume = round(m3/1e9, 6); return volume + (singular || volume == 1 ? " cubic kilometer" : " cubic kilometers"); } else { - var volume = round(m3/1e9, 0); + let volume = round(m3/1e9, 0); return volume + (singular || volume == 1 ? " cubic kilometer" : " cubic kilometers"); } } function customaryVolume(m3, singular=false) { - var gallons = m3 * 264.172; + let gallons = m3 * 264.172; if (gallons < 1/16) { - var volume = round(gallons*128,0); + let volume = round(gallons*128,0); return volume + (singular || volume == 1 ? " fluid ounce" : " fluid ounces"); } else if (gallons < 1/4) { - var volume = round(gallons*16,1); + let volume = round(gallons*16,1); return volume + (singular || volume == 1 ? " cup" : " cups"); } else if (gallons < 1/2) { - var volume = round(gallons*8,1); + let volume = round(gallons*8,1); return volume + (singular || volume == 1 ? " pint" : " pints"); } else if (gallons < 1) { - var volume = round(gallons*4,1); + let volume = round(gallons*4,1); return volume + (singular || volume == 1 ? " quart" : " quarts"); } else if (gallons < 100) { - var volume = round(gallons,1); + let volume = round(gallons,1); return volume + (singular || volume == 1 ? " gallon" : " gallons"); } else { - var volume = round(gallons,0); + let volume = round(gallons,0); return volume + (singular || volume == 1 ? " gallon" : " gallons"); } } function approxVolume(m3, singular=false) { if (m3 < 1/10000) { - var volume = round(m3*1e6,0); + let volume = round(m3*1e6,0); return (singular || volume == 1 ? "a shot" : volume + " shots"); } else if (m3 < 1) { - var volume = round(m3*2000,0); + let volume = round(m3*2000,0); return (singular || volume == 1 ? "a glass" : volume + " glasses"); } else if (m3 < 10) { - var volume = round(m3*2.64,1); + let volume = round(m3*2.64,1); return(singular || volume == 1 ? "a bathtub" : volume + " bathtubs"); } else if (m3 < 1e9) { - var volume = round(m3/1000,2); + let volume = round(m3/1000,2); return (singular || volume == 1 ? "an Olympic swimming pool" : volume + " Olympic swimming pools"); } else if (m3 < 1e15) { - var volume = round(m3/1.8919e10,3); + let volume = round(m3/1.8919e10,3); return (singular || volume == 1 ? "a Great Salt Lake" : volume + " Great Salt Lakes"); } else { - var volume = round(m3/3.547e17, 3); + let volume = round(m3/3.547e17, 3); return (singular || volume == 1 ? "an ocean" : volume + " oceans"); } }