mirror of
https://github.com/thepaperpilot/Advent-Incremental.git
synced 2024-11-22 08:31:35 +00:00
More efficient elf canBuy
This commit is contained in:
parent
f31c31c246
commit
4d28e9b843
1 changed files with 3 additions and 2 deletions
|
@ -297,9 +297,10 @@ const layer = createLayer(id, function (this: BaseLayer) {
|
|||
|
||||
const computedAutoBuyCooldown = computed(() => options.cooldownModifier.apply(10));
|
||||
|
||||
const isActive = convertComputable(options.canBuy ?? true);
|
||||
|
||||
function update(diff: number) {
|
||||
const isActive = options.canBuy ? unref(convertComputable(options.canBuy)) : true;
|
||||
if (upgrade.bought.value && isActive) {
|
||||
if (upgrade.bought.value && unref(isActive)) {
|
||||
buyProgress.value = Decimal.add(buyProgress.value, diff);
|
||||
const cooldown = Decimal.recip(computedAutoBuyCooldown.value);
|
||||
while (Decimal.gte(buyProgress.value, cooldown)) {
|
||||
|
|
Loading…
Reference in a new issue