2022-01-25 04:23:30 +00:00
|
|
|
import Modal from "@/components/system/Modal.vue";
|
|
|
|
import Spacer from "@/components/system/Spacer.vue";
|
2022-01-14 04:25:47 +00:00
|
|
|
import { createResource, trackBest, trackOOMPS, trackTotal } from "@/features/resource";
|
|
|
|
import { createTree, GenericTree } from "@/features/tree";
|
|
|
|
import { globalBus } from "@/game/events";
|
|
|
|
import { createLayer, GenericLayer } from "@/game/layers";
|
|
|
|
import player, { PlayerData } from "@/game/player";
|
|
|
|
import { DecimalSource } from "@/lib/break_eternity";
|
|
|
|
import Decimal, { format, formatSmall, formatTime } from "@/util/bignum";
|
2022-01-25 04:23:30 +00:00
|
|
|
import { render } from "@/util/vue";
|
|
|
|
import { computed, ref } from "vue";
|
2022-01-14 04:25:47 +00:00
|
|
|
import a from "./layers/aca/a";
|
|
|
|
import c, {
|
|
|
|
generatorUpgrade,
|
|
|
|
lollipopMultiplierEffect,
|
|
|
|
lollipopMultiplierUpgrade
|
|
|
|
} from "./layers/aca/c";
|
|
|
|
import f from "./layers/aca/f";
|
|
|
|
|
|
|
|
export const points = createResource<DecimalSource>(0);
|
|
|
|
const best = trackBest(points);
|
|
|
|
const total = trackTotal(points);
|
|
|
|
const oomps = trackOOMPS(points);
|
2022-01-25 04:23:30 +00:00
|
|
|
const showModal = ref(false);
|
2022-01-14 04:25:47 +00:00
|
|
|
|
|
|
|
const pointGain = computed(() => {
|
|
|
|
if (!generatorUpgrade.bought) return new Decimal(0);
|
|
|
|
let gain = new Decimal(3.19);
|
|
|
|
if (lollipopMultiplierUpgrade.bought) gain = gain.times(lollipopMultiplierEffect.value);
|
|
|
|
return gain;
|
|
|
|
});
|
|
|
|
globalBus.on("update", diff => {
|
|
|
|
points.value = Decimal.add(points.value, Decimal.times(pointGain.value, diff));
|
|
|
|
});
|
|
|
|
|
|
|
|
// Note: Casting as generic tree to avoid recursive type definitions
|
|
|
|
export const tree = createTree({
|
|
|
|
nodes: () => [[c.treeNode], [f.treeNode, c.spook]],
|
|
|
|
leftSideNodes: [a.treeNode, c.h],
|
|
|
|
branches: [
|
|
|
|
{
|
|
|
|
startNode: f.treeNode,
|
|
|
|
endNode: c.treeNode,
|
|
|
|
stroke: "blue",
|
|
|
|
"stroke-width": "25px",
|
|
|
|
style: {
|
|
|
|
filter: "blur(5px)"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ startNode: c.treeNode, endNode: c.g }
|
|
|
|
]
|
|
|
|
}) as GenericTree;
|
|
|
|
|
|
|
|
// Note: layers don't _need_ a reference to everything, but I'd recommend it over trying to remember
|
|
|
|
// what does and doesn't need to be included. Officially all you need are anything with persistency
|
|
|
|
export const main = createLayer({
|
|
|
|
id: "main",
|
|
|
|
name: "Tree",
|
|
|
|
links: tree.links,
|
2022-01-25 04:25:34 +00:00
|
|
|
display: (
|
|
|
|
<template>
|
|
|
|
<div v-show={player.devSpeed === 0}>Game Paused</div>
|
|
|
|
<div v-show={player.devSpeed && player.devSpeed !== 1}>
|
|
|
|
Dev Speed: {format(player.devSpeed || 0)}x
|
|
|
|
</div>
|
|
|
|
<div v-show={player.offlineTime != undefined}>
|
|
|
|
Offline Time: {formatTime(player.offlineTime || 0)}
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span v-show={Decimal.lt(points.value, "1e1000")}>You have </span>
|
|
|
|
<h2>{format(points.value)}</h2>
|
|
|
|
<span v-show={Decimal.lt(points.value, "1e1e6")}> points</span>
|
|
|
|
</div>
|
|
|
|
<div v-show={Decimal.gt(pointGain.value, 0)}>
|
|
|
|
({oomps.value === "" ? formatSmall(pointGain.value) : oomps.value}/sec)
|
|
|
|
</div>
|
|
|
|
<Spacer />
|
|
|
|
<Modal
|
|
|
|
modelValue={showModal.value}
|
|
|
|
onUpdate:modelValue={value => (showModal.value = value)}
|
|
|
|
>
|
|
|
|
<svg style="height: 80vmin; width: 80vmin;">
|
|
|
|
<path d="M 32 222 Q 128 222, 128 0 Q 128 222, 224 222 L 224 224 L 32 224" />
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-01-25 04:25:34 +00:00
|
|
|
<circle cx="64" cy="128" r="64" fill="#8da8b0" />
|
|
|
|
<circle cx="128" cy="64" r="64" fill="#71368a" />
|
|
|
|
<circle cx="192" cy="128" r="64" fill="#fa8508" />
|
|
|
|
</svg>
|
|
|
|
</Modal>
|
|
|
|
{render(tree)}
|
|
|
|
</template>
|
|
|
|
),
|
2022-01-14 04:25:47 +00:00
|
|
|
points,
|
|
|
|
best,
|
|
|
|
total,
|
|
|
|
oomps,
|
|
|
|
tree
|
|
|
|
});
|
|
|
|
|
|
|
|
export const getInitialLayers = (
|
|
|
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
|
|
player: Partial<PlayerData>
|
|
|
|
): Array<GenericLayer> => [main, f, c, a];
|
|
|
|
|
|
|
|
export const hasWon = computed(() => {
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
|
|
export function fixOldSave(
|
|
|
|
oldVersion: string | undefined,
|
|
|
|
player: Partial<PlayerData>
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
|
|
): void {}
|
|
|
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|