mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2025-02-16 09:31:43 +00:00
Safeguard against createdSaplings going negative
This commit is contained in:
parent
e326f94d7e
commit
bbf6c94fe5
1 changed files with 5 additions and 5 deletions
|
@ -596,9 +596,9 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
).floor()
|
||||
)
|
||||
)
|
||||
);
|
||||
).max(0);
|
||||
if (masteryEffectActive.value) {
|
||||
createdSaplings.value = Decimal.add(createdSaplings.value, amount);
|
||||
createdSaplings.value = Decimal.add(createdSaplings.value, amount).max(0);
|
||||
}
|
||||
logs.value = Decimal.add(logs.value, Decimal.times(logGain.apply(1), amount));
|
||||
saplings.value = Decimal.mul(amount, masteryEffectActive.value ? 2 : 1).add(
|
||||
|
@ -652,7 +652,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
).floor()
|
||||
)
|
||||
)
|
||||
);
|
||||
).max(0);
|
||||
saplings.value = Decimal.sub(saplings.value, amount);
|
||||
manualPlantProgress.value = 0;
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
const amountCut = Decimal.min(
|
||||
trees.value,
|
||||
Decimal.times(computedAutoCuttingAmount.value, diff)
|
||||
);
|
||||
).max(0);
|
||||
const logsGained = Decimal.mul(logGain.apply(1), amountCut);
|
||||
|
||||
const effectiveLogsGained = Decimal.div(logsGained, diff);
|
||||
|
@ -779,7 +779,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
const amountPlanted = Decimal.min(
|
||||
saplings.value,
|
||||
Decimal.times(computedAutoPlantingAmount.value, diff)
|
||||
);
|
||||
).max(0);
|
||||
saplings.value = Decimal.sub(saplings.value, amountPlanted);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue