| @@ -129,6 +129,14 @@ const effect_types = { | |||||
| "desc": function(effect) { | "desc": function(effect) { | ||||
| return round((effect.amount - 1) * 100) + "% increase to food production"; | return round((effect.amount - 1) * 100) + "% increase to food production"; | ||||
| } | } | ||||
| }, | |||||
| "helper": { | |||||
| "apply": function(effect, productivity, helperCount) { | |||||
| return productivity * (1 + effect.amount * helperCount); | |||||
| }, | |||||
| "desc": function(effect) { | |||||
| return "+" + round(effect.amount * 100) + "% food/sec from " + buildings[effect.helped].name + " for every " + buildings[effect.helper].name + " owned."; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -215,6 +223,29 @@ const upgrades = { | |||||
| ] | ] | ||||
| } | } | ||||
| }, | }, | ||||
| "anthro-help-micro-1": { | |||||
| "name": "Servants", | |||||
| "desc": "Why bother walking anywhere, really?", | |||||
| "cost": { | |||||
| "food": buildings.anthro.cost * 25 + buildings.micro.cost * 50 | |||||
| }, | |||||
| "effects": [ | |||||
| { | |||||
| "type": "helper", | |||||
| "helper": "anthro", | |||||
| "helped": "micro", | |||||
| "amount": 0.01 | |||||
| } | |||||
| ], | |||||
| "prereqs": { | |||||
| "buildings": { | |||||
| "anthro": 10 | |||||
| }, | |||||
| "upgrades": [ | |||||
| "anthro-prod-1" | |||||
| ] | |||||
| } | |||||
| }, | |||||
| "prod-1": { | "prod-1": { | ||||
| "name": "Sloth Metabolism", | "name": "Sloth Metabolism", | ||||
| "desc": "Burn those calories. Eventually.", | "desc": "Burn those calories. Eventually.", | ||||
| @@ -43,6 +43,13 @@ function productivityMultiplierOf(type) { | |||||
| } | } | ||||
| } | } | ||||
| for (let effect of effects["helper"]) { | |||||
| if (ownedUpgrades[effect.parent] && effect.helped == type) { | |||||
| base = effect.apply(base, belongings[effect.helper].count); | |||||
| } | |||||
| } | |||||
| return base; | return base; | ||||
| } | } | ||||
| @@ -111,8 +118,8 @@ function renderResources() { | |||||
| for (const [key, value] of Object.entries(resources)) { | for (const [key, value] of Object.entries(resources)) { | ||||
| let line1 = render(value, 3) + " " + resourceTypes[key].name; | |||||
| let line2 = render(currentProductivity[key]) + " " + resourceTypes[key].name + "/sec"; | |||||
| let line1 = render(value, 3, 0) + " " + resourceTypes[key].name; | |||||
| let line2 = render(currentProductivity[key], 1, 1) + " " + resourceTypes[key].name + "/sec"; | |||||
| list.push({"text": line1, "class": "resource-quantity"}); | list.push({"text": line1, "class": "resource-quantity"}); | ||||
| list.push({"text": line2, "class": "resource-rate"}); | list.push({"text": line2, "class": "resource-rate"}); | ||||
| @@ -1,8 +1,12 @@ | |||||
| function render(val, places=1) { | |||||
| return numberText(val, places); | |||||
| function render(val, places=1, smallPlaces = 0) { | |||||
| return numberText(val, places, smallPlaces); | |||||
| } | } | ||||
| function numberText(val, places=1) { | |||||
| function numberText(val, places=1, smallPlaces = 0) { | |||||
| if (val < 1000) { | |||||
| return round(val, smallPlaces); | |||||
| } | |||||
| let power = Math.floor(Math.log10(val)); | let power = Math.floor(Math.log10(val)); | ||||
| let order = Math.floor(power / 3); | let order = Math.floor(power / 3); | ||||
| @@ -13,7 +17,6 @@ function numberText(val, places=1) { | |||||
| } | } | ||||
| _numberWords = { | _numberWords = { | ||||
| 0: "", | |||||
| 1: "thousand", | 1: "thousand", | ||||
| 2: "million", | 2: "million", | ||||
| 3: "billion", | 3: "billion", | ||||