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 { createBar, GenericBar } from "features/bars/bar";
import { createBuyable } from "features/buyable";
import { createClickable, GenericClickable } from "features/clickables/clickable";
import { jsx, JSXFunction, showIf } from "features/feature";
import { createClickable } from "features/clickables/clickable";
import { jsx, showIf } from "features/feature";
import { createMilestone, GenericMilestone } from "features/milestones/milestone";
import { createUpgrade } from "features/upgrades/upgrade";
import { globalBus } from "game/events";
import { createLayer } from "game/layers";
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 { Direction } from "util/common";
import { render, renderCol, renderGrid } from "util/vue";
@ -32,19 +32,6 @@ const id = "management";
const day = 12;
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 name = "Management";
const color = "green"; // idk what to do
@ -262,7 +249,7 @@ const layer = createLayer(id, () => {
createMilestone(() => ({
display: {
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),
shouldEarn: () => cutterElfTraining.level.value >= 4
@ -297,7 +284,7 @@ const layer = createLayer(id, () => {
requirement: "Ivy Level 3",
effectDisplay: jsx(() => (
<>
Planting speed is multiplied by 2
Auto planting speed is multiplied by 2
<sup>
(log<sub>10</sub>(logs)<sup>0.2</sup>)
</sup>
@ -318,7 +305,8 @@ const layer = createLayer(id, () => {
createMilestone(() => ({
display: {
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),
shouldEarn: () => planterElfTraining.level.value >= 5
@ -861,7 +849,7 @@ const layer = createLayer(id, () => {
paperElfTraining,
boxElfTraining,
clothElfTraining
} as Record<string, ElfTrainingClickable>;
};
const day12Elves = [
cutterElfTraining,
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
const schoolCost = computed(() => {
@ -1226,9 +1238,15 @@ const layer = createLayer(id, () => {
classroomUpgrade,
focusMultiplier: focusMulti,
upgrades,
focusTargets,
<<<<<<< HEAD
focusCooldown,
focusTime,
=======
focusRolling,
>>>>>>> bee8ce7d5169e7205fa7dc409d6488a902a890f5
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 { Direction, WithRequired } from "util/common";
import { render, renderGrid, renderRow } from "util/vue";
import { computed, ref } from "vue";
import { computed, ref, watch } from "vue";
import boxes from "./boxes";
import cloth from "./cloth";
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, 2e6)) v = Decimal.pow(v, 2).div(2e6);
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: {
title: "Generic Planters",
@ -310,9 +314,24 @@ const layer = createLayer(id, function (this: BaseLayer) {
multiplier: 4,
description: "Lumberjack Jeans",
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">;
const computedAutoCuttingAmount = computed(() => autoCuttingAmount.apply(0));
const lastAutoCuttingAmount = ref<DecimalSource>(0);
watch(computedAutoCuttingAmount, cut => {
lastAutoCuttingAmount.value = cut;
});
const manualPlantingAmount = createSequentialModifier(() => [
createAdditiveModifier(() => ({
@ -388,12 +407,22 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: management.elfTraining.heatedPlanterElfTraining.milestones[1].earned
})),
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",
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">;
const computedAutoPlantingAmount = computed(() => autoPlantingAmount.apply(0));
const lastAutoPlantedAmount = ref<DecimalSource>(0);
watch(computedAutoPlantingAmount, planted => {
lastAutoPlantedAmount.value = planted;
});
const logGain = createSequentialModifier(() => [
createMultiplicativeModifier(() => ({
@ -454,9 +483,7 @@ const layer = createLayer(id, function (this: BaseLayer) {
enabled: dyes.upgrades.blueDyeUpg.bought
})),
createMultiplicativeModifier(() => ({
multiplier: computed(() =>
Decimal.add(computedAutoCuttingAmount.value, 1).root(3)
),
multiplier: computed(() => Decimal.add(computedAutoCuttingAmount.value, 1).root(3)),
description: "Holly Level 1",
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 {
addSoftcap,
Conversion,
createIndependentConversion,
createPolynomialScaling,
ScalingFunction
createPolynomialScaling
} from "features/conversion";
import { jsx, showIf } from "features/feature";
import { createHotkey } from "features/hotkey";
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 { createExponentialModifier, createSequentialModifier } from "game/modifiers";
import { noPersist } from "game/persistence";
import Decimal, { DecimalSource, formatWhole } from "util/bignum";
import { Direction } from "util/common";
import { Computable } from "util/computed";
import { render } from "util/vue";
import { computed, unref, watchEffect } from "vue";
import elves from "./elves";
import management from "./management";
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 day = 2;
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 foundationConversion: Conversion<FoundationConversionOptions> =
createIndependentConversion(() => ({
scaling: addSoftcap(addSoftcap(createPolynomialScaling(250, 1.5), 5387, 1/1e10), 1e20, 1e9),
baseResource: trees.logs,
gainResource: noPersist(foundationProgress),
roundUpCost: true,
buyMax: management.elfTraining.heatedCutterElfTraining.milestones[2].earned,
spend(gain, spent) {
trees.logs.value = Decimal.sub(trees.logs.value, spent);
}
}));
const foundationConversion = createIndependentConversion(() => ({
scaling: addSoftcap(
addSoftcap(createPolynomialScaling(250, 1.5), 5387, 1 / 1e10),
1e20,
1e9
),
baseResource: trees.logs,
gainResource: noPersist(foundationProgress),
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(() => ({
display: jsx(() => (
@ -77,10 +76,15 @@ const layer = createLayer(id, function (this: BaseLayer) {
</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: () =>
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() {
if (!unref(this.canClick)) {
return;
@ -282,7 +286,10 @@ const layer = createLayer(id, function (this: BaseLayer) {
</h2>
% completed
</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)}
<Spacer />
{milestonesDisplay()}