Balancing and bug fixes

This commit is contained in:
thepaperpilot 2023-05-13 17:09:22 -05:00
parent 353b13c8fd
commit 10dbd88623
3 changed files with 60 additions and 47 deletions

View file

@ -17,9 +17,9 @@ import { DecimalSource } from "lib/break_eternity";
import { ComputedRef } from "vue"; import { ComputedRef } from "vue";
export const resourceLevelFormula = Formula.variable(0) export const resourceLevelFormula = Formula.variable(0)
.step(2000, x => x.pow_base(1.02))
.step(100, x => x.pow(1.5)) .step(100, x => x.pow(1.5))
.step(Decimal.pow(900, 1.5).add(100), x => x.pow(1.5)) .step(Decimal.pow(900, 1.5).add(100), x => x.pow(1.5))
.step(Decimal.pow(1500, 1.5).pow(1.5).add(Decimal.pow(900, 1.5).add(100)), x => x.pow(2))
.pow(1.5); .pow(1.5);
export const deselectAllAction = { export const deselectAllAction = {

View file

@ -299,7 +299,7 @@ export const passives = {
}, },
goldRelic: { goldRelic: {
description: (empowered: boolean) => description: (empowered: boolean) =>
empowered ? "Each treasure gives +20% XP gain" : "Each treasure gives +10% XP gain" empowered ? "Each treasure gives +50% XP gain" : "Each treasure gives +25% XP gain"
}, },
emeraldRelic: { emeraldRelic: {
description: (empowered: boolean) => description: (empowered: boolean) =>
@ -318,8 +318,8 @@ export const passives = {
beryliumRelic: { beryliumRelic: {
description: (empowered: boolean) => description: (empowered: boolean) =>
empowered empowered
? "log(energy)^0.5 boosts planar speed" ? "log(energy)^0.5 boosts planes' resource gain"
: "log(energy)^0.25 boosts planar speed" : "log(energy)^0.25 boosts planes' resource gain"
}, },
unobtainiumRelic: { unobtainiumRelic: {
description: (empowered: boolean) => description: (empowered: boolean) =>

View file

@ -199,7 +199,7 @@ export function createPlane(
const n = ref(0); const n = ref(0);
// Makes cost formula value reactive on n, so nextCost will update as appropriate // Makes cost formula value reactive on n, so nextCost will update as appropriate
let costFormula = Formula.variable(n).times(0); let costFormula = Formula.variable(n).times(0);
const cachedGain: Record<number, DecimalSource> = {}; let previousGain: DecimalSource = 0;
let visibility: Computable<boolean> = true; let visibility: Computable<boolean> = true;
const nextCost = computed(() => const nextCost = computed(() =>
Decimal.add(difficulty, random() - 0.5) Decimal.add(difficulty, random() - 0.5)
@ -238,7 +238,7 @@ export function createPlane(
const currentN = n.value; const currentN = n.value;
switch (upgradeType) { switch (upgradeType) {
case "add": { case "add": {
const addend = Decimal.add(cost, 10).pow(random() / 4 + 0.875); const addend = Decimal.add(cost, 10).pow(random() / 4 + 1);
description = `Gain ${format(addend)} ${resource.displayName}/s`; description = `Gain ${format(addend)} ${resource.displayName}/s`;
costFormula = costFormula.add(addend); costFormula = costFormula.add(addend);
modifier = condition => modifier = condition =>
@ -258,8 +258,9 @@ export function createPlane(
description = `Multiply previous ${ description = `Multiply previous ${
resource.displayName resource.displayName
} gain by x${format(multiplier)}.`; } gain by x${format(multiplier)}.`;
const prevGain = previousGain;
costFormula = costFormula.add( costFormula = costFormula.add(
Decimal.sub(multiplier, 1).times(cachedGain[currentN - 1]) Decimal.sub(multiplier, 1).times(prevGain)
); );
modifier = condition => modifier = condition =>
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({
@ -281,8 +282,8 @@ export function createPlane(
// resource.displayName // resource.displayName
// } gain to the ^${format(exponent)}`; // } gain to the ^${format(exponent)}`;
// costFormula = costFormula // costFormula = costFormula
// .add(Decimal.pow(cachedGain[currentN - 1], exponent)) // .add(Decimal.pow(prevGain, exponent))
// .sub(cachedGain[currentN - 1]); // .sub(prevGain);
// modifier = condition => // modifier = condition =>
// createExponentialModifier(() => ({ // createExponentialModifier(() => ({
// exponent, // exponent,
@ -295,7 +296,7 @@ export function createPlane(
// previewModifier = createExponentialModifier(() => ({ exponent })); // previewModifier = createExponentialModifier(() => ({ exponent }));
// } // }
} }
cachedGain[n.value] = costFormula.evaluate(); previousGain = costFormula.evaluate();
n.value++; n.value++;
const upgradeVisibility = visibility; const upgradeVisibility = visibility;
const upgrade = createUpgrade(() => ({ const upgrade = createUpgrade(() => ({
@ -354,10 +355,15 @@ export function createPlane(
case "add": { case "add": {
const addend = Decimal.add(initialCost, 10).times(random() + 0.5); const addend = Decimal.add(initialCost, 10).times(random() + 0.5);
description = `Gain ${format(addend)} ${resource.displayName}/s`; description = `Gain ${format(addend)} ${resource.displayName}/s`;
cost = costInput.add(1).times(1.5).times(initialCost); cost = costInput.times(1.5).add(1).times(initialCost);
costFormula = costFormula.add( costFormula = costFormula.add(
computed(() => computed(() =>
Decimal.sub(n.value, currentN).add(1).times(5).times(addend) Decimal.sub(n.value, currentN)
.times(2)
.add(1)
.pow(2)
.clampMax(100)
.times(addend)
) )
); );
effect = computed( effect = computed(
@ -389,14 +395,17 @@ export function createPlane(
cost = costInput cost = costInput
.pow_base(Decimal.times(multiplier, 1.5)) .pow_base(Decimal.times(multiplier, 1.5))
.times(initialCost); .times(initialCost);
const prevGain = previousGain;
costFormula = costFormula.add( costFormula = costFormula.add(
computed(() => computed(() =>
Decimal.sub(n.value, currentN) Decimal.sub(n.value, currentN)
.times(2)
.add(1) .add(1)
.times(5) .pow(2)
.clampMax(100)
.pow_base(multiplier) .pow_base(multiplier)
.sub(1) .sub(1)
.times(cachedGain[currentN - 1]) .times(prevGain)
) )
); );
effect = computed( effect = computed(
@ -422,7 +431,7 @@ export function createPlane(
break; break;
} }
} }
cachedGain[n.value] = costFormula.evaluate(); previousGain = costFormula.evaluate();
n.value++; n.value++;
const repeatableVisibility = visibility; const repeatableVisibility = visibility;
const repeatable = createRepeatable< const repeatable = createRepeatable<
@ -474,19 +483,17 @@ export function createPlane(
} }
features.push(repeatables); features.push(repeatables);
break; break;
case "conversion": case "conversion": {
const prestigeResource = createResource(0, getName(random)); const prestigeResource = createResource(0, getName(random));
const prestigeColor = getColor([0.64, 0.75, 0.55], random); const prestigeColor = getColor([0.64, 0.75, 0.55], random);
const cost = nextCost.value; const cost = nextCost.value;
const costExponent = random() / 2 + 0.25; // Random from 0.25 - 0.75 const costExponent = random() / 2 + 0.25; // Random from 0.25 - 0.75
const effectExponent = random() / 2 + 0.25; // ditto const effectExponent = random() / 2 + 0.25; // ditto
const currentN = n.value; const currentN = n.value;
const prevGain = previousGain;
costFormula = costFormula.add( costFormula = costFormula.add(
computed(() => computed(() =>
Decimal.sub(n.value, currentN) Decimal.sub(n.value, currentN).add(1).times(2).pow10().times(prevGain)
.add(1)
.pow10()
.times(cachedGain[currentN - 1])
) )
); );
const conversion = createCumulativeConversion(() => ({ const conversion = createCumulativeConversion(() => ({
@ -509,8 +516,8 @@ export function createPlane(
resource.value = 0; resource.value = 0;
} }
})); }));
cachedGain[n.value] = costFormula.evaluate(); previousGain = costFormula.evaluate();
n.value += 4; n.value += 2;
const clickableVisibility = visibility; const clickableVisibility = visibility;
const title = getPowerName(random); const title = getPowerName(random);
const formula = Formula.variable(prestigeResource).pow(effectExponent).add(1); const formula = Formula.variable(prestigeResource).pow(effectExponent).add(1);
@ -610,17 +617,18 @@ export function createPlane(
( (
main.investments.value.state as unknown as InvestmentsState main.investments.value.state as unknown as InvestmentsState
).portals.includes(id) ).portals.includes(id)
? 0.01 ? Decimal.div(computedPlanarSpeedModifier.value, 100)
: 0 : 0
); );
break; break;
}
case "xp": { case "xp": {
const xp = createResource<DecimalSource>(0); const xp = createResource<DecimalSource>(0);
const barVisibility = visibility; const barVisibility = visibility;
const currentN = n.value; const currentN = n.value;
const title = getPowerName(random); const title = getPowerName(random);
const cost = Decimal.add(difficulty, random() - 0.5) const cost = Decimal.add(difficulty, random() - 0.5)
.pow_base(2) .pow_base(1.25)
.times(10); .times(10);
const levelDifficulty = random() / 4 + 1.125; // 1.125 - 1.375 const levelDifficulty = random() / 4 + 1.125; // 1.125 - 1.375
const effectExponent = random() / 2 + 1.25; // 1.25 - 1.75 const effectExponent = random() / 2 + 1.25; // 1.25 - 1.75
@ -638,18 +646,19 @@ export function createPlane(
description: title, description: title,
enabled: () => isVisible(bar.visibility) enabled: () => isVisible(bar.visibility)
})); }));
const prevGain = previousGain;
costFormula = costFormula.add( costFormula = costFormula.add(
computed(() => computed(() =>
Decimal.sub(n.value, currentN) Decimal.sub(n.value, currentN)
.add(1) .add(1)
.times(3) .times(3)
.pow(effectExponent) .pow(effectExponent)
.times(cachedGain[currentN - 1]) .times(prevGain)
) )
); );
cachedGain[n.value] = costFormula.evaluate(); previousGain = costFormula.evaluate();
n.value += 3; n.value += 3;
const barColor = getColor([0.18, 0.2, 0.25], random); const barColor = getColor([0.64, 0.75, 0.55], random);
const bar = createBar(() => ({ const bar = createBar(() => ({
direction: Direction.Right, direction: Direction.Right,
width: 300, width: 300,
@ -665,7 +674,8 @@ export function createPlane(
{format(xp.value)}/{format(xpToNextLevel.value)} {format(xp.value)}/{format(xpToNextLevel.value)}
</span> </span>
)), )),
fillStyle: `background-color: ${barColor}` fillStyle: `background-color: ${barColor}`,
textStyle: `text-shadow: 5px 0 10px black`
})); }));
this.on("preUpdate", diff => { this.on("preUpdate", diff => {
if ( if (
@ -678,7 +688,7 @@ export function createPlane(
let totalDiff = Decimal.times(computedPlanarSpeedModifier.value, diff); let totalDiff = Decimal.times(computedPlanarSpeedModifier.value, diff);
if (main.toolNodes.value.goldRelic != null) { if (main.toolNodes.value.goldRelic != null) {
totalDiff = Decimal.times( totalDiff = Decimal.times(
isEmpowered("goldRelic") ? 0.2 : 0.1, isEmpowered("goldRelic") ? 0.5 : 0.25,
earnedTreasures.value.length earnedTreasures.value.length
) )
.add(1) .add(1)
@ -709,6 +719,7 @@ export function createPlane(
const energy = createResource<DecimalSource>(0, title + " energy"); const energy = createResource<DecimalSource>(0, title + " energy");
const energyColor = getColor([0.64, 0.75, 0.55], random); const energyColor = getColor([0.64, 0.75, 0.55], random);
const currentN = n.value; const currentN = n.value;
const prevGain = previousGain;
costFormula = costFormula.add( costFormula = costFormula.add(
computed(() => computed(() =>
Decimal.sub(n.value, currentN) Decimal.sub(n.value, currentN)
@ -717,7 +728,7 @@ export function createPlane(
.add(1) .add(1)
.log2() .log2()
.add(1) .add(1)
.times(cachedGain[currentN - 1]) .times(prevGain)
) )
); );
const effect = computed(() => Decimal.add(energy.value, 1).log2().add(1)); const effect = computed(() => Decimal.add(energy.value, 1).log2().add(1));
@ -825,7 +836,7 @@ export function createPlane(
display: eta, display: eta,
direction: Direction.Down direction: Direction.Down
}); });
cachedGain[n.value] = costFormula.evaluate(); previousGain = costFormula.evaluate();
n.value++; n.value++;
} }
this.on("preUpdate", diff => { this.on("preUpdate", diff => {
@ -882,7 +893,7 @@ export function createPlane(
case "prestige": { case "prestige": {
const title = getPowerName(random); const title = getPowerName(random);
const upgradeVisibility = visibility; const upgradeVisibility = visibility;
const effectExponent = random() / 2 + 1.25; // 1.25 - 1.75 const effectExponent = random() / 10 + 1.1; // 1.1 - 1.2
const cost = nextCost.value; const cost = nextCost.value;
costFormula = costFormula.pow(effectExponent); costFormula = costFormula.pow(effectExponent);
const modifier = createExponentialModifier(() => ({ const modifier = createExponentialModifier(() => ({
@ -890,10 +901,11 @@ export function createPlane(
description: title, description: title,
enabled: upgrade.bought enabled: upgrade.bought
})); }));
cachedGain[n.value] = costFormula.evaluate(); previousGain = costFormula.evaluate();
n.value++; n.value += 20;
const thingsToReset = features.filter((f, i) => i % 2 === 0);
const reset = createReset(() => ({ const reset = createReset(() => ({
thingsToReset: features.filter((f, i) => i % 2 === 0), thingsToReset,
onReset() { onReset() {
resource.value = 0; resource.value = 0;
} }
@ -924,7 +936,7 @@ export function createPlane(
canClick: () => unref(upgrade.canPurchase), canClick: () => unref(upgrade.canPurchase),
modifier, modifier,
cost, cost,
previewCost: resource, previewCost: noPersist(resource),
previewModifier, previewModifier,
showETA: () => !unref(upgrade.bought) showETA: () => !unref(upgrade.bought)
}); });
@ -1084,7 +1096,8 @@ export function createPlane(
direction: Direction.Down direction: Direction.Down
}); });
features.push([milestone]); features.push([milestone]);
visibility = milestone.earned; // Wrap milestone.earned so it doesn't get reset
visibility = computed(() => milestone.earned.value);
} }
const upgrades = findFeatures( const upgrades = findFeatures(
@ -1137,6 +1150,16 @@ export function createPlane(
.pow(0.75), .pow(0.75),
description: () => (isEmpowered("gravelRelic") ? "Empowered " : "") + relics.gravel, description: () => (isEmpowered("gravelRelic") ? "Empowered " : "") + relics.gravel,
enabled: () => main.toolNodes.value.gravelRelic != null enabled: () => main.toolNodes.value.gravelRelic != null
})),
createMultiplicativeModifier(() => ({
multiplier: () =>
Decimal.add(main.energy.value, 1)
.log10()
.add(1)
.pow(isEmpowered("beryliumRelic") ? 0.5 : 0.25),
description: () =>
(isEmpowered("beryliumRelic") ? "Empowered " : "") + relics.berylium,
enabled: () => main.toolNodes.value.beryliumRelic != null
})) }))
); );
@ -1167,16 +1190,6 @@ export function createPlane(
).add(1), ).add(1),
description: () => (isEmpowered("coalRelic") ? "Empowered " : "") + relics.coal, description: () => (isEmpowered("coalRelic") ? "Empowered " : "") + relics.coal,
enabled: () => main.toolNodes.value.coalRelic != null enabled: () => main.toolNodes.value.coalRelic != null
})),
createMultiplicativeModifier(() => ({
multiplier: () =>
Decimal.add(main.energy.value, 1)
.log10()
.add(1)
.pow(isEmpowered("beryliumRelic") ? 0.5 : 0.25),
description: () =>
(isEmpowered("beryliumRelic") ? "Empowered " : "") + relics.berylium,
enabled: () => main.toolNodes.value.beryliumRelic != null
})) }))
]); ]);
const computedPlanarSpeedModifier = computed(() => planarSpeedModifier.apply(1)); const computedPlanarSpeedModifier = computed(() => planarSpeedModifier.apply(1));