| @@ -260,5 +260,81 @@ const upgrades = { | |||
| "prod-2" | |||
| ] | |||
| }, | |||
| } | |||
| }, | |||
| "prod-4": { | |||
| "name": "Quick Metabolism", | |||
| "desc": "Burn those calories.", | |||
| "cost": { | |||
| "food": 5e5 | |||
| }, | |||
| "effect": { | |||
| "type": "prod-all", | |||
| "amount": 1.05 | |||
| }, | |||
| "prereqs": { | |||
| "productivity": { | |||
| "food": 1e4 | |||
| }, | |||
| "upgrades": [ | |||
| "prod-3" | |||
| ] | |||
| }, | |||
| }, | |||
| "prod-5": { | |||
| "name": "Speedy Metabolism", | |||
| "desc": "More prey, more power.", | |||
| "cost": { | |||
| "food": 5e6 | |||
| }, | |||
| "effect": { | |||
| "type": "prod-all", | |||
| "amount": 1.05 | |||
| }, | |||
| "prereqs": { | |||
| "productivity": { | |||
| "food": 1e5 | |||
| }, | |||
| "upgrades": [ | |||
| "prod-4" | |||
| ] | |||
| }, | |||
| }, | |||
| "prod-6": { | |||
| "name": "Fast Metabolism", | |||
| "desc": "You're a furnace.", | |||
| "cost": { | |||
| "food": 5e7 | |||
| }, | |||
| "effect": { | |||
| "type": "prod-all", | |||
| "amount": 1.05 | |||
| }, | |||
| "prereqs": { | |||
| "productivity": { | |||
| "food": 1e6 | |||
| }, | |||
| "upgrades": [ | |||
| "prod-5" | |||
| ] | |||
| }, | |||
| }, | |||
| "prod-7": { | |||
| "name": "Powerful Metabolism", | |||
| "desc": "Digest them all.", | |||
| "cost": { | |||
| "food": 5e8 | |||
| }, | |||
| "effect": { | |||
| "type": "prod-all", | |||
| "amount": 1.05 | |||
| }, | |||
| "prereqs": { | |||
| "productivity": { | |||
| "food": 1e7 | |||
| }, | |||
| "upgrades": [ | |||
| "prod-6" | |||
| ] | |||
| }, | |||
| }, | |||
| } | |||
| @@ -285,7 +285,7 @@ function upgradeReachable(id) { | |||
| for (let upgrade of reqs) { | |||
| if (!ownedUpgrades[upgrade]) { | |||
| return false; | |||
| }currentProductivity["food"] = 0; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -310,8 +310,10 @@ function upgradeAvailable(id) { | |||
| } | |||
| } else if (type == "productivity") { | |||
| console.log(type, reqs); | |||
| if (currentProductivity < reqs) { | |||
| return false; | |||
| for (const [key, value] of Object.entries(reqs)) { | |||
| if (currentProductivity[key] < value) { | |||
| return false; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -418,7 +420,7 @@ function renderPrereqs(prereqs) { | |||
| for (const [id, amount] of Object.entries(prereqs.productivity)) { | |||
| list.push({ | |||
| "text": amount + " " + resourceTypes[id].name + "/s", | |||
| "valid": currentProductivity[id].count >= amount | |||
| "valid": currentProductivity[id] >= amount | |||
| }); | |||
| } | |||
| } | |||