mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-24 17:31:54 +00:00
Fix energy efficiency
This commit is contained in:
parent
ab6e04de4b
commit
fa556849c1
1 changed files with 6 additions and 6 deletions
|
@ -129,16 +129,16 @@ const factory = createLayer(id, () => {
|
||||||
.map(c => FACTORY_COMPONENTS[c.type]?.energyCost ?? 0)
|
.map(c => FACTORY_COMPONENTS[c.type]?.energyCost ?? 0)
|
||||||
.reduce((a, b) => a + b, 0)
|
.reduce((a, b) => a + b, 0)
|
||||||
);
|
);
|
||||||
|
const energyEfficiency = computed(() =>
|
||||||
|
Decimal.div(energyConsumption.value, computedEnergy.value).recip().pow(2).min(1)
|
||||||
|
);
|
||||||
const tickRate = createSequentialModifier(() => [
|
const tickRate = createSequentialModifier(() => [
|
||||||
createMultiplicativeModifier(() => ({
|
createMultiplicativeModifier(() => ({
|
||||||
multiplier: elvesEffect,
|
multiplier: elvesEffect,
|
||||||
description: "Trained Elves"
|
description: "Trained Elves"
|
||||||
})),
|
})),
|
||||||
createMultiplicativeModifier(() => ({
|
createMultiplicativeModifier(() => ({
|
||||||
multiplier: Decimal.div(energyConsumption.value, computedEnergy.value)
|
multiplier: energyEfficiency,
|
||||||
.recip()
|
|
||||||
.pow(2)
|
|
||||||
.min(1),
|
|
||||||
description: "Energy Consumption",
|
description: "Energy Consumption",
|
||||||
enabled: () => Decimal.gt(energyConsumption.value, computedEnergy.value)
|
enabled: () => Decimal.gt(energyConsumption.value, computedEnergy.value)
|
||||||
}))
|
}))
|
||||||
|
@ -166,8 +166,8 @@ const factory = createLayer(id, () => {
|
||||||
<div>
|
<div>
|
||||||
{formatWhole(energyConsumption.value)} / {formatWhole(computedEnergy.value)}{" "}
|
{formatWhole(energyConsumption.value)} / {formatWhole(computedEnergy.value)}{" "}
|
||||||
energy used
|
energy used
|
||||||
{Decimal.lt(tickRate.value, 1) ? (
|
{Decimal.gt(energyConsumption.value, computedEnergy.value) ? (
|
||||||
<>{" (" + format(Decimal.mul(tickRate.value, 100))}% efficiency)</>
|
<>{" (" + format(Decimal.mul(energyEfficiency.value, 100))}% efficiency)</>
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue