do some management changes

This commit is contained in:
circle-gon 2022-12-12 23:22:20 +00:00
commit 907648af0f
3 changed files with 107 additions and 55 deletions

View file

@ -6,14 +6,14 @@ import { createCollapsibleMilestones, createCollapsibleModifierSections } from "
import { main } from "data/projEntry"; import { main } from "data/projEntry";
import { createBar, GenericBar } from "features/bars/bar"; import { createBar, GenericBar } from "features/bars/bar";
import { createBuyable } from "features/buyable"; import { createBuyable } from "features/buyable";
import { createClickable, GenericClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { jsx, JSXFunction, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createMilestone, GenericMilestone } from "features/milestones/milestone"; import { createMilestone, GenericMilestone } from "features/milestones/milestone";
import { createUpgrade } from "features/upgrades/upgrade"; import { createUpgrade } from "features/upgrades/upgrade";
import { globalBus } from "game/events"; import { globalBus } from "game/events";
import { createLayer } from "game/layers"; import { createLayer } from "game/layers";
import { createMultiplicativeModifier, createSequentialModifier, Modifier } from "game/modifiers"; import { createMultiplicativeModifier, createSequentialModifier, Modifier } from "game/modifiers";
import { Persistent, persistent } from "game/persistence"; import { persistent } from "game/persistence";
import Decimal, { DecimalSource, format, formatTime, formatWhole } from "util/bignum"; import Decimal, { DecimalSource, format, formatTime, formatWhole } from "util/bignum";
import { Direction } from "util/common"; import { Direction } from "util/common";
import { render, renderCol, renderGrid } from "util/vue"; import { render, renderCol, renderGrid } from "util/vue";
@ -32,19 +32,6 @@ const id = "management";
const day = 12; const day = 12;
const advancedDay = 13; const advancedDay = 13;
interface ElfTrainingClickable extends GenericClickable {
name: string;
state: Persistent<boolean>;
displayMilestone: JSXFunction;
level: ComputedRef<number>;
exp: Persistent<DecimalSource>;
milestones: GenericMilestone[];
timeForExp: ComputedRef<DecimalSource>;
amountOfTimesDone: Ref<number>;
elfXPGainComputed: ComputedRef<DecimalSource>;
elfXPGain: Modifier;
}
const layer = createLayer(id, () => { const layer = createLayer(id, () => {
const name = "Management"; const name = "Management";
const color = "green"; // idk what to do const color = "green"; // idk what to do
@ -262,7 +249,7 @@ const layer = createLayer(id, () => {
createMilestone(() => ({ createMilestone(() => ({
display: { display: {
requirement: "Holly Level 4", requirement: "Holly Level 4",
effectDisplay: "Multiply cutting speed by 1.1 per day completed" effectDisplay: "Multiply auto cutting amount by 1.1 per day completed"
}, },
visibility: () => showIf(cutterElfMilestones[2].earned.value && main.day.value >= 13), visibility: () => showIf(cutterElfMilestones[2].earned.value && main.day.value >= 13),
shouldEarn: () => cutterElfTraining.level.value >= 4 shouldEarn: () => cutterElfTraining.level.value >= 4
@ -297,7 +284,7 @@ const layer = createLayer(id, () => {
requirement: "Ivy Level 3", requirement: "Ivy Level 3",
effectDisplay: jsx(() => ( effectDisplay: jsx(() => (
<> <>
Planting speed is multiplied by 2 Auto planting speed is multiplied by 2
<sup> <sup>
(log<sub>10</sub>(logs)<sup>0.2</sup>) (log<sub>10</sub>(logs)<sup>0.2</sup>)
</sup> </sup>
@ -318,7 +305,8 @@ const layer = createLayer(id, () => {
createMilestone(() => ({ createMilestone(() => ({
display: { display: {
requirement: "Ivy Level 5", requirement: "Ivy Level 5",
effectDisplay: "Boost planting/cutting speed based on which is falling behind" effectDisplay:
"The lesser of auto planting and cutting amounts is increased to match the greater"
}, },
visibility: () => showIf(planterElfMilestones[3].earned.value && main.day.value >= 13), visibility: () => showIf(planterElfMilestones[3].earned.value && main.day.value >= 13),
shouldEarn: () => planterElfTraining.level.value >= 5 shouldEarn: () => planterElfTraining.level.value >= 5
@ -861,7 +849,7 @@ const layer = createLayer(id, () => {
paperElfTraining, paperElfTraining,
boxElfTraining, boxElfTraining,
clothElfTraining clothElfTraining
} as Record<string, ElfTrainingClickable>; };
const day12Elves = [ const day12Elves = [
cutterElfTraining, cutterElfTraining,
planterElfTraining, planterElfTraining,
@ -977,7 +965,31 @@ const layer = createLayer(id, () => {
} }
} }
} }
const focusUpgrade1 = createUpgrade(() => ({
display: {
title: "Focus Booster",
description: "Double experience multiplier from focus"
},
resource: trees.trees,
cost: 1e30
}));
const focusUpgrade2 = createUpgrade(() => ({
display: {
title: "Focus Buffer",
description: "Increase elves affected by focus by 1"
},
resource: trees.trees,
cost: 1e40
}));
const focusUpgrade3 = createUpgrade(() => ({
display: {
title: "Focus Upgrader",
description: "Focus can now be rerolled every 10 seconds"
},
resource: trees.trees,
cost: 1e50
}));
const upgrades = { focusUpgrade1, focusUpgrade2, focusUpgrade3 };
// ------------------------------------------------------------------------------- Schools // ------------------------------------------------------------------------------- Schools
const schoolCost = computed(() => { const schoolCost = computed(() => {
@ -1226,9 +1238,15 @@ const layer = createLayer(id, () => {
classroomUpgrade, classroomUpgrade,
focusMultiplier: focusMulti, focusMultiplier: focusMulti,
upgrades,
focusTargets, focusTargets,
<<<<<<< HEAD
focusCooldown, focusCooldown,
focusTime, focusTime,
=======
focusRolling,
>>>>>>> bee8ce7d5169e7205fa7dc409d6488a902a890f5
display: jsx(() => ( display: jsx(() => (
<> <>

View file

@ -27,7 +27,7 @@ import { noPersist, persistent } from "game/persistence";
import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } from "util/bignum"; import Decimal, { DecimalSource, format, formatGain, formatLimit, formatWhole } from "util/bignum";
import { Direction, WithRequired } from "util/common"; import { Direction, WithRequired } from "util/common";
import { render, renderGrid, renderRow } from "util/vue"; import { render, renderGrid, renderRow } from "util/vue";
import { computed, ref } from "vue"; import { computed, ref, watch } from "vue";
import boxes from "./boxes"; import boxes from "./boxes";
import cloth from "./cloth"; import cloth from "./cloth";
import coal from "./coal"; import coal from "./coal";
@ -223,7 +223,11 @@ const layer = createLayer(id, function (this: BaseLayer) {
if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200); if (Decimal.gte(v, 200)) v = Decimal.pow(v, 2).div(200);
if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6); if (Decimal.gte(v, 2e6)) v = Decimal.pow(v, 2).div(2e6);
v = Decimal.pow(0.95, paper.books.plantersBook.amount.value).times(v); v = Decimal.pow(0.95, paper.books.plantersBook.amount.value).times(v);
return Decimal.times(100, v).add(200); let cost = Decimal.times(100, v).add(200);
if (management.elfTraining.planterElfTraining.milestones[3].earned.value) {
cost = Decimal.div(cost, 10);
}
return cost;
}, },
display: { display: {
title: "Generic Planters", title: "Generic Planters",
@ -310,9 +314,24 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: 4, multiplier: 4,
description: "Lumberjack Jeans", description: "Lumberjack Jeans",
enabled: cloth.treesUpgrades.treesUpgrade2.bought enabled: cloth.treesUpgrades.treesUpgrade2.bought
})),
createMultiplicativeModifier(() => ({
multiplier: () => Decimal.pow(1.1, main.day.value),
description: "Holly Level 4",
enabled: management.elfTraining.cutterElfTraining.milestones[3].earned
})),
createAdditiveModifier(() => ({
addend: () =>
Decimal.sub(lastAutoCuttingAmount.value, lastAutoPlantedAmount.value).max(0),
description: "Ivy Level 5",
enabled: management.elfTraining.planterElfTraining.milestones[4].earned
})) }))
]) as WithRequired<Modifier, "description" | "revert">; ]) as WithRequired<Modifier, "description" | "revert">;
const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0)); const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0));
const lastAutoCuttingAmount = ref<DecimalSource>(0);
watch(computedAutoCuttingAmount, cut => {
lastAutoCuttingAmount.value = cut;
});
const manualPlantingAmount = createSequentialModifier(() => [ const manualPlantingAmount = createSequentialModifier(() => [
createAdditiveModifier(() => ({ createAdditiveModifier(() => ({
@ -388,12 +407,22 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: management.elfTraining.heatedPlanterElfTraining.milestones[1].earned enabled: management.elfTraining.heatedPlanterElfTraining.milestones[1].earned
})), })),
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({
multiplier: () => Decimal.pow(trees.value, .2).log10().pow_base(2), multiplier: () => Decimal.pow(trees.value, 0.2).log10().pow_base(2),
description: "Ivy Level 3", description: "Ivy Level 3",
enabled: management.elfTraining.planterElfTraining.milestones[2].earned enabled: management.elfTraining.planterElfTraining.milestones[2].earned
})),
createAdditiveModifier(() => ({
addend: () =>
Decimal.sub(lastAutoPlantedAmount.value, lastAutoCuttingAmount.value).max(0),
description: "Ivy Level 5",
enabled: management.elfTraining.planterElfTraining.milestones[4].earned
})) }))
]) as WithRequired<Modifier, "description" | "revert">; ]) as WithRequired<Modifier, "description" | "revert">;
const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0)); const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0));
const lastAutoPlantedAmount = ref<DecimalSource>(0);
watch(computedAutoPlantingAmount, planted => {
lastAutoPlantedAmount.value = planted;
});
const logGain = createSequentialModifier(() => [ const logGain = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({
@ -454,9 +483,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: dyes.upgrades.blueDyeUpg.bought enabled: dyes.upgrades.blueDyeUpg.bought
})), })),
createMultiplicativeModifier(() => ({ createMultiplicativeModifier(() => ({
multiplier: computed(() => multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(3)),
Decimal.add(computedAutoCuttingAmount.value, 1).root(3)
),
description: "Holly Level 1", description: "Holly Level 1",
enabled: management.elfTraining.cutterElfTraining.milestones[0].earned enabled: management.elfTraining.cutterElfTraining.milestones[0].earned
})), })),

View file

@ -9,35 +9,24 @@ import { createBar } from "features/bars/bar";
import { createClickable } from "features/clickables/clickable"; import { createClickable } from "features/clickables/clickable";
import { import {
addSoftcap, addSoftcap,
Conversion,
createIndependentConversion, createIndependentConversion,
createPolynomialScaling, createPolynomialScaling
ScalingFunction
} from "features/conversion"; } from "features/conversion";
import { jsx, showIf } from "features/feature"; import { jsx, showIf } from "features/feature";
import { createHotkey } from "features/hotkey"; import { createHotkey } from "features/hotkey";
import { createMilestone } from "features/milestones/milestone"; import { createMilestone } from "features/milestones/milestone";
import { createResource, displayResource, Resource } from "features/resources/resource"; import { createResource, displayResource } from "features/resources/resource";
import { BaseLayer, createLayer } from "game/layers"; import { BaseLayer, createLayer } from "game/layers";
import { createExponentialModifier, createSequentialModifier } from "game/modifiers";
import { noPersist } from "game/persistence"; import { noPersist } from "game/persistence";
import Decimal, { DecimalSource, formatWhole } from "util/bignum"; import Decimal, { DecimalSource, formatWhole } from "util/bignum";
import { Direction } from "util/common"; import { Direction } from "util/common";
import { Computable } from "util/computed";
import { render } from "util/vue"; import { render } from "util/vue";
import { computed, unref, watchEffect } from "vue"; import { computed, unref, watchEffect } from "vue";
import elves from "./elves"; import elves from "./elves";
import management from "./management"; import management from "./management";
import trees from "./trees"; import trees from "./trees";
interface FoundationConversionOptions {
scaling: ScalingFunction;
baseResource: Resource;
gainResource: Resource;
roundUpCost: boolean;
buyMax: Computable<boolean>;
spend: (gain: DecimalSource, spent: DecimalSource) => void;
}
const id = "workshop"; const id = "workshop";
const day = 2; const day = 2;
const layer = createLayer(id, function (this: BaseLayer) { const layer = createLayer(id, function (this: BaseLayer) {
@ -47,17 +36,27 @@ const layer = createLayer(id, function (this: BaseLayer) {
const foundationProgress = createResource<DecimalSource>(0, "foundation progress"); const foundationProgress = createResource<DecimalSource>(0, "foundation progress");
const foundationConversion: Conversion<FoundationConversionOptions> = const foundationConversion = createIndependentConversion(() => ({
createIndependentConversion(() => ({ scaling: addSoftcap(
scaling: addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5387, 1/1e10), 1e20, 1e9), addSoftcap(createPolynomialScaling(250, 1.5), 5387, 1 / 1e10),
baseResource: trees.logs, 1e20,
gainResource: noPersist(foundationProgress), 1e9
roundUpCost: true, ),
buyMax: management.elfTraining.heatedCutterElfTraining.milestones[2].earned, baseResource: trees.logs,
spend(gain, spent) { gainResource: noPersist(foundationProgress),
trees.logs.value = Decimal.sub(trees.logs.value, spent); roundUpCost: true,
} buyMax: management.elfTraining.heatedCutterElfTraining.milestones[2].earned,
})); spend(gain, spent) {
trees.logs.value = Decimal.sub(trees.logs.value, spent);
},
costModifier: createSequentialModifier(() => [
createExponentialModifier(() => ({
exponent: 0.95,
description: "Holly Level 5",
enabled: management.elfTraining.cutterElfTraining.milestones[4].earned
}))
])
}));
const buildFoundation = createClickable(() => ({ const buildFoundation = createClickable(() => ({
display: jsx(() => ( display: jsx(() => (
@ -77,10 +76,15 @@ const layer = createLayer(id, function (this: BaseLayer) {
</span> </span>
</> </>
)), )),
visibility: () => showIf(Decimal.lt(foundationProgress.value, 100) || management.elfTraining.expandersElfTraining.milestones[2].earned.value), visibility: () =>
showIf(
Decimal.lt(foundationProgress.value, 100) ||
management.elfTraining.expandersElfTraining.milestones[2].earned.value
),
canClick: () => canClick: () =>
Decimal.gte(foundationConversion.actualGain.value, 1) && Decimal.gte(foundationConversion.actualGain.value, 1) &&
(Decimal.lt(foundationProgress.value, 100) || management.elfTraining.expandersElfTraining.milestones[2].earned.value), (Decimal.lt(foundationProgress.value, 100) ||
management.elfTraining.expandersElfTraining.milestones[2].earned.value),
onClick() { onClick() {
if (!unref(this.canClick)) { if (!unref(this.canClick)) {
return; return;
@ -282,7 +286,10 @@ const layer = createLayer(id, function (this: BaseLayer) {
</h2> </h2>
% completed % completed
</div> </div>
{Decimal.lt(foundationProgress.value, 100) || management.elfTraining.expandersElfTraining.milestones[2].earned.value ? <Spacer /> : null} {Decimal.lt(foundationProgress.value, 100) ||
management.elfTraining.expandersElfTraining.milestones[2].earned.value ? (
<Spacer />
) : null}
{render(buildFoundation)} {render(buildFoundation)}
<Spacer /> <Spacer />
{milestonesDisplay()} {milestonesDisplay()}