import Spacer from "components/layout/Spacer.vue"; import { jsx } from "features/feature"; import { createResource, trackBest, trackOOMPS, trackTotal } from "features/resources/resource"; import type { GenericTree } from "features/trees/tree"; import { branchedResetPropagation, createTree } from "features/trees/tree"; import { globalBus } from "game/events"; import Formula, { calculateCost, calculateMaxAffordable } from "game/formulas/formulas"; import type { BaseLayer, GenericLayer } from "game/layers"; import { createLayer } from "game/layers"; import type { Player } from "game/player"; import player from "game/player"; import type { DecimalSource } from "util/bignum"; import Decimal, { format, formatTime } from "util/bignum"; import { render } from "util/vue"; import { computed, ref, toRaw, unref } from "vue"; import prestige from "./layers/prestige"; window.Formula = Formula; window.calculateMaxAffordable = calculateMaxAffordable; window.calculateCost = calculateCost; window.unref = unref; window.ref = ref; window.createResource = createResource; /** * @hidden */ export const main = createLayer("main", function (this: BaseLayer) { const points = createResource(10); const best = trackBest(points); const total = trackTotal(points); const pointGain = computed(() => { // eslint-disable-next-line prefer-const let gain = new Decimal(1); return gain; }); globalBus.on("update", diff => { points.value = Decimal.add(points.value, Decimal.times(pointGain.value, diff)); }); const oomps = trackOOMPS(points, pointGain); const tree = createTree(() => ({ nodes: [[prestige.treeNode]], branches: [], onReset() { points.value = toRaw(this.resettingNode.value) === toRaw(prestige.treeNode) ? 0 : 10; best.value = points.value; total.value = points.value; }, resetPropagation: branchedResetPropagation })) as GenericTree; return { name: "Tree", links: tree.links, display: jsx(() => ( <> {player.devSpeed === 0 ?
Game Paused
: null} {player.devSpeed != null && player.devSpeed !== 0 && player.devSpeed !== 1 ? (
Dev Speed: {format(player.devSpeed)}x
) : null} {player.offlineTime != null && player.offlineTime !== 0 ? (
Offline Time: {formatTime(player.offlineTime)}
) : null}
{Decimal.lt(points.value, "1e1000") ? You have : null}

{format(points.value)}

{Decimal.lt(points.value, "1e1e6") ? points : null}
{Decimal.gt(pointGain.value, 0) ?
({oomps.value})
: null} {render(tree)} )), points, best, total, oomps, tree }; }); /** * Given a player save data object being loaded, return a list of layers that should currently be enabled. * If your project does not use dynamic layers, this should just return all layers. */ export const getInitialLayers = ( /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ player: Partial ): Array => [main, prestige]; /** * A computed ref whose value is true whenever the game is over. */ export const hasWon = computed(() => { return false; }); /** * Given a player save data object being loaded with a different version, update the save data object to match the structure of the current version. * @param oldVersion The version of the save being loaded in * @param player The save data being loaded in */ /* eslint-disable @typescript-eslint/no-unused-vars */ export function fixOldSave( oldVersion: string | undefined, player: Partial // eslint-disable-next-line @typescript-eslint/no-empty-function ): void {} /* eslint-enable @typescript-eslint/no-unused-vars */