mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 00:21:31 +00:00
Implemented copper relic and fix some nodes performing unaffordable operations
This commit is contained in:
parent
cf33c8d205
commit
536abf6cd2
3 changed files with 35 additions and 19 deletions
|
@ -110,15 +110,15 @@ export function getIncreaseConnectionsAction(
|
|||
);
|
||||
if (Decimal.gte(main.energy.value, cost)) {
|
||||
main.energy.value = Decimal.sub(main.energy.value, cost);
|
||||
node.state = {
|
||||
...(node.state as object),
|
||||
maxConnections: Decimal.add(
|
||||
(node.state as { maxConnections: number }).maxConnections,
|
||||
1
|
||||
)
|
||||
};
|
||||
main.board.selectedAction.value = null;
|
||||
}
|
||||
node.state = {
|
||||
...(node.state as object),
|
||||
maxConnections: Decimal.add(
|
||||
(node.state as { maxConnections: number }).maxConnections,
|
||||
1
|
||||
)
|
||||
};
|
||||
main.board.selectedAction.value = null;
|
||||
},
|
||||
visibility: (node: BoardNode): boolean =>
|
||||
Decimal.add(
|
||||
|
|
|
@ -463,6 +463,9 @@ export const portalGenerator = {
|
|||
? { text: "Tap again to confirm" }
|
||||
: { text: "Cannot afford", color: "var(--danger)" },
|
||||
onClick(node) {
|
||||
if (Decimal.lt(main.energy.value, main.computedPortalCost.value)) {
|
||||
return;
|
||||
}
|
||||
let id = 0;
|
||||
while (`portal-${id}` in layers) {
|
||||
id++;
|
||||
|
@ -678,12 +681,12 @@ export const booster = {
|
|||
);
|
||||
if (Decimal.gte(main.energy.value, cost)) {
|
||||
main.energy.value = Decimal.sub(main.energy.value, cost);
|
||||
node.state = {
|
||||
...(node.state as object),
|
||||
level: Decimal.add((node.state as unknown as BoosterState).level, 1)
|
||||
};
|
||||
main.board.selectedAction.value = null;
|
||||
}
|
||||
node.state = {
|
||||
...(node.state as object),
|
||||
level: Decimal.add((node.state as unknown as BoosterState).level, 1)
|
||||
};
|
||||
main.board.selectedAction.value = null;
|
||||
}
|
||||
},
|
||||
togglePoweredAction
|
||||
|
|
|
@ -198,11 +198,24 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
|||
).length
|
||||
);
|
||||
});
|
||||
const nextPowerCost = computed(() =>
|
||||
Decimal.eq(numPoweredMachines.value, 0)
|
||||
const effectivePoweredMachines = computed(() => {
|
||||
let numMachines = numPoweredMachines.value;
|
||||
if (toolNodes.value.copperRelic != null) {
|
||||
numMachines--;
|
||||
if (isEmpowered("copperRelic")) {
|
||||
numMachines--;
|
||||
}
|
||||
}
|
||||
return numMachines;
|
||||
});
|
||||
const nextPowerCost = computed(() => {
|
||||
const numMachines = effectivePoweredMachines.value;
|
||||
return Decimal.lt(numMachines, 0)
|
||||
? 0
|
||||
: Decimal.eq(numMachines, 0)
|
||||
? 10
|
||||
: Decimal.add(numPoweredMachines.value, 1).pow_base(100).div(10).times(0.99)
|
||||
);
|
||||
: Decimal.add(numMachines, 1).pow_base(100).div(10).times(0.99);
|
||||
});
|
||||
|
||||
const quarryProgressRequired = computed(() => {
|
||||
if (quarry.value == null) {
|
||||
|
@ -518,9 +531,9 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
|||
enabled: () => Decimal.neq(planarMultis.value.energy ?? 1, 1)
|
||||
})),
|
||||
createAdditiveModifier(() => ({
|
||||
addend: () => Decimal.pow(100, numPoweredMachines.value).div(10).neg(),
|
||||
addend: () => Decimal.pow(100, effectivePoweredMachines.value).div(10).neg(),
|
||||
description: "Powered Machines (100^n/10 energy/s)",
|
||||
enabled: () => Decimal.gt(numPoweredMachines.value, 0)
|
||||
enabled: () => Decimal.gt(effectivePoweredMachines.value, 0)
|
||||
}))
|
||||
]);
|
||||
const computedEnergyModifier = computed(() => energyModifier.apply(0));
|
||||
|
|
Loading…
Reference in a new issue