From fa556849c1c78869509dbb68482cc0f18a0be8b2 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Thu, 22 Dec 2022 12:06:53 -0600 Subject: [PATCH] Fix energy efficiency --- src/data/layers/factory.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data/layers/factory.tsx b/src/data/layers/factory.tsx index eeb95c7..150bbcb 100644 --- a/src/data/layers/factory.tsx +++ b/src/data/layers/factory.tsx @@ -129,16 +129,16 @@ const factory = createLayer(id, () => { .map(c => FACTORY_COMPONENTS[c.type]?.energyCost ?? 0) .reduce((a, b) => a + b, 0) ); + const energyEfficiency = computed(() => + Decimal.div(energyConsumption.value, computedEnergy.value).recip().pow(2).min(1) + ); const tickRate = createSequentialModifier(() => [ createMultiplicativeModifier(() => ({ multiplier: elvesEffect, description: "Trained Elves" })), createMultiplicativeModifier(() => ({ - multiplier: Decimal.div(energyConsumption.value, computedEnergy.value) - .recip() - .pow(2) - .min(1), + multiplier: energyEfficiency, description: "Energy Consumption", enabled: () => Decimal.gt(energyConsumption.value, computedEnergy.value) })) @@ -166,8 +166,8 @@ const factory = createLayer(id, () => {
{formatWhole(energyConsumption.value)} / {formatWhole(computedEnergy.value)}{" "} energy used - {Decimal.lt(tickRate.value, 1) ? ( - <>{" (" + format(Decimal.mul(tickRate.value, 100))}% efficiency) + {Decimal.gt(energyConsumption.value, computedEnergy.value) ? ( + <>{" (" + format(Decimal.mul(energyEfficiency.value, 100))}% efficiency) ) : ( "" )}