Implemented copper relic and fix some nodes performing unaffordable operations

This commit is contained in:
thepaperpilot 2023-05-12 14:46:38 -05:00
parent cf33c8d205
commit 536abf6cd2
3 changed files with 35 additions and 19 deletions

View file

@ -110,15 +110,15 @@ export function getIncreaseConnectionsAction(
); );
if (Decimal.gte(main.energy.value, cost)) { if (Decimal.gte(main.energy.value, cost)) {
main.energy.value = Decimal.sub(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 => visibility: (node: BoardNode): boolean =>
Decimal.add( Decimal.add(

View file

@ -463,6 +463,9 @@ export const portalGenerator = {
? { text: "Tap again to confirm" } ? { text: "Tap again to confirm" }
: { text: "Cannot afford", color: "var(--danger)" }, : { text: "Cannot afford", color: "var(--danger)" },
onClick(node) { onClick(node) {
if (Decimal.lt(main.energy.value, main.computedPortalCost.value)) {
return;
}
let id = 0; let id = 0;
while (`portal-${id}` in layers) { while (`portal-${id}` in layers) {
id++; id++;
@ -678,12 +681,12 @@ export const booster = {
); );
if (Decimal.gte(main.energy.value, cost)) { if (Decimal.gte(main.energy.value, cost)) {
main.energy.value = Decimal.sub(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 togglePoweredAction

View file

@ -198,11 +198,24 @@ export const main = createLayer("main", function (this: BaseLayer) {
).length ).length
); );
}); });
const nextPowerCost = computed(() => const effectivePoweredMachines = computed(() => {
Decimal.eq(numPoweredMachines.value, 0) 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 ? 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(() => { const quarryProgressRequired = computed(() => {
if (quarry.value == null) { if (quarry.value == null) {
@ -518,9 +531,9 @@ export const main = createLayer("main", function (this: BaseLayer) {
enabled: () => Decimal.neq(planarMultis.value.energy ?? 1, 1) enabled: () => Decimal.neq(planarMultis.value.energy ?? 1, 1)
})), })),
createAdditiveModifier(() => ({ 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)", 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)); const computedEnergyModifier = computed(() => energyModifier.apply(0));