2022-03-04 03:39:48 +00:00
|
|
|
import Spacer from "components/layout/Spacer.vue";
|
|
|
|
import { jsx } from "features/feature";
|
|
|
|
import { createResource, trackBest, trackOOMPS, trackTotal } from "features/resources/resource";
|
|
|
|
import { branchedResetPropagation, createTree, GenericTree } from "features/trees/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, formatTime } from "util/bignum";
|
|
|
|
import { render } from "util/vue";
|
2022-02-27 23:06:38 +00:00
|
|
|
import { computed, toRaw } from "vue";
|
2022-02-28 00:31:51 +00:00
|
|
|
import prestige from "./layers/prestige";
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-01-28 04:47:26 +00:00
|
|
|
export const main = createLayer(() => {
|
2022-02-27 19:49:34 +00:00
|
|
|
const points = createResource<DecimalSource>(10);
|
2022-01-28 04:47:26 +00:00
|
|
|
const best = trackBest(points);
|
|
|
|
const total = trackTotal(points);
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-01-28 04:47:26 +00:00
|
|
|
const pointGain = computed(() => {
|
2022-02-28 04:10:42 +00:00
|
|
|
// eslint-disable-next-line prefer-const
|
2022-02-28 00:31:51 +00:00
|
|
|
let gain = new Decimal(1);
|
2022-01-28 04:47:26 +00:00
|
|
|
return gain;
|
|
|
|
});
|
|
|
|
globalBus.on("update", diff => {
|
|
|
|
points.value = Decimal.add(points.value, Decimal.times(pointGain.value, diff));
|
|
|
|
});
|
2022-02-27 19:49:34 +00:00
|
|
|
const oomps = trackOOMPS(points, pointGain);
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-02-27 19:49:34 +00:00
|
|
|
const tree = createTree(() => ({
|
2022-02-28 00:31:51 +00:00
|
|
|
nodes: [[prestige.treeNode]],
|
|
|
|
branches: [],
|
2022-02-27 19:49:34 +00:00
|
|
|
onReset() {
|
2022-02-28 00:31:51 +00:00
|
|
|
points.value = toRaw(this.resettingNode.value) === toRaw(prestige.treeNode) ? 0 : 10;
|
2022-02-27 19:49:34 +00:00
|
|
|
best.value = points.value;
|
|
|
|
total.value = points.value;
|
|
|
|
},
|
|
|
|
resetPropagation: branchedResetPropagation
|
|
|
|
})) as GenericTree;
|
2022-01-14 04:25:47 +00:00
|
|
|
|
2022-01-28 04:47:26 +00:00
|
|
|
return {
|
|
|
|
id: "main",
|
|
|
|
name: "Tree",
|
|
|
|
links: tree.links,
|
2022-02-27 19:49:34 +00:00
|
|
|
display: jsx(() => (
|
|
|
|
<>
|
2022-01-28 04:47:26 +00:00
|
|
|
<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>
|
2022-02-27 19:49:34 +00:00
|
|
|
<div v-show={Decimal.gt(pointGain.value, 0)}>({oomps.value})</div>
|
2022-01-28 04:47:26 +00:00
|
|
|
<Spacer />
|
|
|
|
{render(tree)}
|
2022-02-27 19:49:34 +00:00
|
|
|
</>
|
|
|
|
)),
|
2022-01-28 04:47:26 +00:00
|
|
|
points,
|
|
|
|
best,
|
|
|
|
total,
|
|
|
|
oomps,
|
2022-02-28 00:31:51 +00:00
|
|
|
tree
|
2022-01-28 04:47:26 +00:00
|
|
|
};
|
2022-01-14 04:25:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export const getInitialLayers = (
|
|
|
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
|
|
player: Partial<PlayerData>
|
2022-02-28 00:31:51 +00:00
|
|
|
): Array<GenericLayer> => [main, prestige];
|
2022-01-14 04:25:47 +00:00
|
|
|
|
|
|
|
export const hasWon = computed(() => {
|
2022-02-28 00:31:51 +00:00
|
|
|
return false;
|
2022-01-14 04:25:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
/* 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 */
|