diff --git a/game.js b/game.js index 4c2aa51..258842c 100644 --- a/game.js +++ b/game.js @@ -17,6 +17,27 @@ var newline = " "; victims = {}; +var macro = +{ + "species": "crux", + "color" : "blue" +} + +function look() +{ + var line1 = "You are a " + length(baseHeight * scale, metric, true) + " tall " + macro.species + ". You weigh " + mass(baseMass * Math.pow(scale,3)) + "."; + + var line2 = "" + + switch(biome) { + case "rural": line2 = "You're standing amongst rural farmhouses and expansive ranches. Cattle are milling about at your feet."; break; + case "suburb": line2 = "You're striding through the winding roads of a suburb."; break; + case "city": line2 = "You're terrorizing the streets of a city. Heavy traffic, worsened by your rampage, is everywhere."; break; + case "downtown": line2 = "You're lurking amongst the skyscrapers of downtown. The streets are packed, and the buildings are practically begging you to knock them over."; + } + update([line1,newline,line2,newline]); +} + function get_living_prey(sum) { var total = 0; for (var key in sum) { @@ -443,14 +464,15 @@ window.addEventListener('load', function(event) { victims["stomach"] = initVictims(); victims["bowels"] = initVictims(); + document.getElementById("button-look").addEventListener("click",look); document.getElementById("button-grow").addEventListener("click",grow); document.getElementById("button-feed").addEventListener("click",feed); document.getElementById("button-stomp").addEventListener("click",stomp); document.getElementById("button-anal_vore").addEventListener("click",anal_vore); document.getElementById("button-stroll").addEventListener("click",toggle_auto); + document.getElementById("button-location").addEventListener("click",change_location); document.getElementById("button-units").addEventListener("click",toggle_units); document.getElementById("button-verbose").addEventListener("click",toggle_verbose); - document.getElementById("button-location").addEventListener("click",change_location); setTimeout(pick_move, 2000); update(); diff --git a/recursive-desc.js b/recursive-desc.js index 2bdd133..dd0a6a2 100644 --- a/recursive-desc.js +++ b/recursive-desc.js @@ -1,3 +1,8 @@ +function configure(dict) { + foot = dict.foot; + +} + function subset(list1,list2) { for (var i = 0; i < list1.length; i++) { if (!list2.includes(list1[i])){ diff --git a/stroll.html b/stroll.html index e816aae..12199bd 100644 --- a/stroll.html +++ b/stroll.html @@ -39,6 +39,7 @@
+ diff --git a/units.js b/units.js index 2e78c5f..8b6303b 100644 --- a/units.js +++ b/units.js @@ -2,68 +2,76 @@ function round(number,precision=3) { return Math.round(number*Math.pow(10,precision)) / Math.pow(10,precision); } -function metricMass(kg) { +function mass(kg, metric=true, singular=false) { + return metric ? metricMass(kg, singular) : customaryMass(kg, singular); +} + +function length(m, metric=true, singular=false) { + return metric ? metricLength(m, singular) : customaryLength(m, singular); +} + +function metricMass(kg, singular=false) { if (kg < 1) { var mass = round(kg * 1000,0); - return mass + (mass == 1 ? " gram" : " grams"); + return mass + (singular || mass == 1 ? " gram" : " grams"); } else if (kg < 5000,0) { var mass = round(kg); - return mass + (mass == 1 ? " kilogram" : " kilograms"); + return mass + (singular || mass == 1 ? " kilogram" : " kilograms"); } else if (kg < 5000000) { var mass = round(kg / 1000,1); - return mass + (mass == 1 ? " metric ton" : " metric tons"); + return mass + (singular || mass == 1 ? " metric ton" : " metric tons"); } else if (kg < 5000000000) { var mass = round(kg / 1000000,1); - return mass + (mass == 1 ? " kiloton" : " kilotons"); + return mass + (singular || mass == 1 ? " kiloton" : " kilotons"); } else if (kg < 5000000000000) { var mass = round(kg / 1000000000,1); - return mass + (mass == 1 ? " megaton" : " megatons"); + return mass + (singular || mass == 1 ? " megaton" : " megatons"); } else { var mass = round(kg / 1000000000000,1); - return mass + (mass == 1 ? " gigaton" : " gigatons"); + return mass + (singular || mass == 1 ? " gigaton" : " gigatons"); } } -function customaryMass(kg) { +function customaryMass(kg, singular=false) { var lbs = kg * 2.2; if (lbs < 1) { var mass = round(lbs * 16,0); - return mass + (mass == 1 ? " ounce" : " ounces"); + return mass + (singular || mass == 1 ? " ounce" : " ounces"); } else if (lbs < 2000) { var mass = round(lbs,0); - return mass + (mass == 1 ? " pound" : " pounds"); + return mass + (singular || mass == 1 ? " pound" : " pounds"); } else { var mass = round(lbs / 2000,1); - return mass + (mass == 1 ? "ton" : " tons"); + return mass + (singular || mass == 1 ? "ton" : " tons"); } } -function metricLength(m) { +function metricLength(m, singular=false) { if (m < 1) { var length = round(m * 100,0); - return length + (length == 1 ? " centimeter" : " centimeters"); + return length + (singular || length == 1 ? " centimeter" : " centimeters"); } else if (m < 500) { var length = round(m,2); - return length + (length == 1 ? " meter" : " meters"); + return length + (singular || length == 1 ? " meter" : " meters"); } else { var length = round(m / 1000,1); - return length + (length == 1 ? " kilometer" : " kilometers"); + return length + (singular || length == 1 ? " kilometer" : " kilometers"); } } -function customaryLength(m) { +function customaryLength(m, singular=false) { var ft = m * 3.28084; if (ft < 1) { var length = round(ft * 12,0); - return length + (length == 1 ? " inch" : " inches"); + return length + (singular || length == 1 ? " inch" : " inches"); } else if (ft < 5280) { var end = customaryLength((ft - Math.floor(ft))/3.28084); var length = Math.floor(ft); - return length + (length == 1 ? " foot" : " feet") + " " + end; + return length + (singular || length == 1 ? " foot" : " feet") + " " + end; } else { var length = round(ft/5280,1); - return length + (length == 1 ? " mile" : " miles"); + return length + (singular || length == 1 ? " mile" : " miles"); } }