mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-22 08:31:31 +00:00
Implement investments machine
This commit is contained in:
parent
bcce0ebce3
commit
5d26995a72
5 changed files with 114 additions and 11 deletions
|
@ -62,6 +62,12 @@ export interface AutomatorState {
|
||||||
powered: boolean;
|
powered: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface InvestmentsState {
|
||||||
|
portals: string[];
|
||||||
|
maxConnections: number;
|
||||||
|
powered: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export const mineLootTable = {
|
export const mineLootTable = {
|
||||||
dirt: 120,
|
dirt: 120,
|
||||||
sand: 60,
|
sand: 60,
|
||||||
|
|
|
@ -34,6 +34,7 @@ import {
|
||||||
DowsingState,
|
DowsingState,
|
||||||
EmpowererState,
|
EmpowererState,
|
||||||
InfluenceState,
|
InfluenceState,
|
||||||
|
InvestmentsState,
|
||||||
MineState,
|
MineState,
|
||||||
Passives,
|
Passives,
|
||||||
PortalGeneratorState,
|
PortalGeneratorState,
|
||||||
|
@ -793,3 +794,52 @@ export const automator = {
|
||||||
}),
|
}),
|
||||||
draggable: true
|
draggable: true
|
||||||
} as NodeTypeOptions;
|
} as NodeTypeOptions;
|
||||||
|
|
||||||
|
export const investments = {
|
||||||
|
shape: Shape.Diamond,
|
||||||
|
size: 50,
|
||||||
|
title: "💱",
|
||||||
|
label: node => {
|
||||||
|
if (node === main.board.selectedNode.value) {
|
||||||
|
return {
|
||||||
|
text:
|
||||||
|
(node.state as unknown as InvestmentsState).portals.length === 0
|
||||||
|
? "Investments - Drag a portal to me!"
|
||||||
|
: `Investing (${
|
||||||
|
(node.state as unknown as InvestmentsState).portals.length
|
||||||
|
}/${Decimal.add(
|
||||||
|
(node.state as unknown as InvestmentsState).maxConnections,
|
||||||
|
main.computedBonusConnectionsModifier.value
|
||||||
|
)})`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return labelForAcceptingPortal(node, portal => {
|
||||||
|
return `Auto-buy ${(layers[portal] as GenericPlane).name}'s repeatables and dimensions`;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
actionDistance: Math.PI / 4,
|
||||||
|
actions: [
|
||||||
|
{
|
||||||
|
id: "deselect",
|
||||||
|
icon: "close",
|
||||||
|
tooltip: {
|
||||||
|
text: "Disconnect portals"
|
||||||
|
},
|
||||||
|
onClick(node: BoardNode) {
|
||||||
|
node.state = { ...(node.state as object), portals: [] };
|
||||||
|
main.board.selectedAction.value = null;
|
||||||
|
main.board.selectedNode.value = null;
|
||||||
|
},
|
||||||
|
visibility: (node: BoardNode) =>
|
||||||
|
(node.state as unknown as InvestmentsState)?.portals.length ?? 0 > 0
|
||||||
|
},
|
||||||
|
getIncreaseConnectionsAction(x => x.add(3).pow_base(1e8)),
|
||||||
|
togglePoweredAction
|
||||||
|
],
|
||||||
|
canAccept: canAcceptPortal,
|
||||||
|
onDrop: onDropPortal,
|
||||||
|
classes: node => ({
|
||||||
|
running: isPowered(node)
|
||||||
|
}),
|
||||||
|
draggable: true
|
||||||
|
} as NodeTypeOptions;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { GenericAchievement, createAchievement } from "features/achievements/ach
|
||||||
import { createBar } from "features/bars/bar";
|
import { createBar } from "features/bars/bar";
|
||||||
import { BoardNode, getUniqueNodeID } from "features/boards/board";
|
import { BoardNode, getUniqueNodeID } from "features/boards/board";
|
||||||
import { GenericClickable, createClickable, setupAutoClick } from "features/clickables/clickable";
|
import { GenericClickable, createClickable, setupAutoClick } from "features/clickables/clickable";
|
||||||
import { createCumulativeConversion } from "features/conversion";
|
import { createCumulativeConversion, setupPassiveGeneration } from "features/conversion";
|
||||||
import { CoercableComponent, findFeatures, isVisible, jsx } from "features/feature";
|
import { CoercableComponent, findFeatures, isVisible, jsx } from "features/feature";
|
||||||
import { GenericRepeatable, RepeatableType, createRepeatable } from "features/repeatable";
|
import { GenericRepeatable, RepeatableType, createRepeatable } from "features/repeatable";
|
||||||
import { createReset } from "features/reset";
|
import { createReset } from "features/reset";
|
||||||
|
@ -47,6 +47,7 @@ import {
|
||||||
BoosterState,
|
BoosterState,
|
||||||
InfluenceState,
|
InfluenceState,
|
||||||
Influences,
|
Influences,
|
||||||
|
InvestmentsState,
|
||||||
PortalState,
|
PortalState,
|
||||||
ResourceState,
|
ResourceState,
|
||||||
Resources,
|
Resources,
|
||||||
|
@ -536,6 +537,16 @@ export function createPlane(
|
||||||
{renderRow(clickable)}
|
{renderRow(clickable)}
|
||||||
</>
|
</>
|
||||||
));
|
));
|
||||||
|
setupPassiveGeneration(this as GenericLayer, conversion, () =>
|
||||||
|
earnedTreasures.value.length < length &&
|
||||||
|
main.investments.value != null &&
|
||||||
|
isPowered(main.investments.value) &&
|
||||||
|
(
|
||||||
|
main.investments.value.state as unknown as InvestmentsState
|
||||||
|
).portals.includes(id)
|
||||||
|
? 0.01
|
||||||
|
: 0
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "xp": {
|
case "xp": {
|
||||||
const xp = createResource<DecimalSource>(0);
|
const xp = createResource<DecimalSource>(0);
|
||||||
|
|
|
@ -43,6 +43,7 @@ import {
|
||||||
EmpowererState,
|
EmpowererState,
|
||||||
InfluenceState,
|
InfluenceState,
|
||||||
Influences,
|
Influences,
|
||||||
|
InvestmentsState,
|
||||||
MineState,
|
MineState,
|
||||||
Passives,
|
Passives,
|
||||||
PortalGeneratorState,
|
PortalGeneratorState,
|
||||||
|
@ -57,20 +58,21 @@ import {
|
||||||
} from "./data";
|
} from "./data";
|
||||||
import "./main.css";
|
import "./main.css";
|
||||||
import {
|
import {
|
||||||
|
automator,
|
||||||
booster,
|
booster,
|
||||||
brokenFactory,
|
brokenFactory,
|
||||||
dowsing,
|
dowsing,
|
||||||
empowerer,
|
empowerer,
|
||||||
factory,
|
factory,
|
||||||
influence,
|
influence,
|
||||||
|
investments,
|
||||||
mine,
|
mine,
|
||||||
passive,
|
passive,
|
||||||
portal,
|
portal,
|
||||||
portalGenerator,
|
portalGenerator,
|
||||||
quarry,
|
quarry,
|
||||||
resource,
|
resource,
|
||||||
upgrader,
|
upgrader
|
||||||
automator
|
|
||||||
} from "./nodeTypes";
|
} from "./nodeTypes";
|
||||||
import { GenericPlane, createPlane } from "./planes";
|
import { GenericPlane, createPlane } from "./planes";
|
||||||
|
|
||||||
|
@ -90,7 +92,8 @@ const types = {
|
||||||
influence,
|
influence,
|
||||||
booster,
|
booster,
|
||||||
upgrader,
|
upgrader,
|
||||||
automator
|
automator,
|
||||||
|
investments
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +120,8 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
iron: board.types.portalGenerator.nodes.value[0],
|
iron: board.types.portalGenerator.nodes.value[0],
|
||||||
gold: board.types.booster.nodes.value[0],
|
gold: board.types.booster.nodes.value[0],
|
||||||
platinum: board.types.upgrader.nodes.value[0],
|
platinum: board.types.upgrader.nodes.value[0],
|
||||||
berylium: board.types.automator.nodes.value[0]
|
berylium: board.types.automator.nodes.value[0],
|
||||||
|
ultimatum: board.types.investments.nodes.value[0]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const influenceNodes: ComputedRef<Record<Influences, BoardNode>> = computed(() => ({
|
const influenceNodes: ComputedRef<Record<Influences, BoardNode>> = computed(() => ({
|
||||||
|
@ -379,6 +383,18 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (investments.value != null) {
|
||||||
|
(investments.value.state as unknown as InvestmentsState).portals.forEach(portal => {
|
||||||
|
links.push({
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
startNode: investments.value!,
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
endNode: portalNodes.value[portal],
|
||||||
|
stroke: "var(--foreground)",
|
||||||
|
strokeWidth: 4
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Object.values(influenceNodes.value).forEach(node => {
|
Object.values(influenceNodes.value).forEach(node => {
|
||||||
const state = node.state as unknown as InfluenceState;
|
const state = node.state as unknown as InfluenceState;
|
||||||
if (state.type === "increaseResources" || state.type === "decreaseResources") {
|
if (state.type === "increaseResources" || state.type === "decreaseResources") {
|
||||||
|
@ -409,7 +425,19 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
const booster: ComputedRef<BoardNode | undefined> = computed(() => toolNodes.value.gold);
|
const booster: ComputedRef<BoardNode | undefined> = computed(() => toolNodes.value.gold);
|
||||||
const upgrader: ComputedRef<BoardNode | undefined> = computed(() => toolNodes.value.platinum);
|
const upgrader: ComputedRef<BoardNode | undefined> = computed(() => toolNodes.value.platinum);
|
||||||
const automator: ComputedRef<BoardNode | undefined> = computed(() => toolNodes.value.berylium);
|
const automator: ComputedRef<BoardNode | undefined> = computed(() => toolNodes.value.berylium);
|
||||||
const poweredMachines = [mine, dowsing, quarry, empowerer, booster, upgrader, automator];
|
const investments: ComputedRef<BoardNode | undefined> = computed(
|
||||||
|
() => toolNodes.value.ultimatum
|
||||||
|
);
|
||||||
|
const poweredMachines = [
|
||||||
|
mine,
|
||||||
|
dowsing,
|
||||||
|
quarry,
|
||||||
|
empowerer,
|
||||||
|
booster,
|
||||||
|
upgrader,
|
||||||
|
automator,
|
||||||
|
investments
|
||||||
|
];
|
||||||
|
|
||||||
function grantResource(type: Resources, amount: DecimalSource) {
|
function grantResource(type: Resources, amount: DecimalSource) {
|
||||||
let node = resourceNodes.value[type];
|
let node = resourceNodes.value[type];
|
||||||
|
@ -820,6 +848,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
checkConnections(curr, booster, "portals");
|
checkConnections(curr, booster, "portals");
|
||||||
checkConnections(curr, upgrader, "portals");
|
checkConnections(curr, upgrader, "portals");
|
||||||
checkConnections(curr, automator, "portals");
|
checkConnections(curr, automator, "portals");
|
||||||
|
checkConnections(curr, investments, "portals");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -843,6 +872,7 @@ export const main = createLayer("main", function (this: BaseLayer) {
|
||||||
booster,
|
booster,
|
||||||
upgrader,
|
upgrader,
|
||||||
automator,
|
automator,
|
||||||
|
investments,
|
||||||
resourceLevels,
|
resourceLevels,
|
||||||
planarMultis,
|
planarMultis,
|
||||||
display: jsx(() => (
|
display: jsx(() => (
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
import ClickableComponent from "features/clickables/Clickable.vue";
|
import ClickableComponent from "features/clickables/Clickable.vue";
|
||||||
import { GenericDecorator } from "features/decorators/common";
|
import { GenericDecorator } from "features/decorators/common";
|
||||||
import {
|
import type {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
GenericComponent,
|
GenericComponent,
|
||||||
OptionsFunc,
|
OptionsFunc,
|
||||||
Replace,
|
Replace,
|
||||||
StyleValue,
|
StyleValue
|
||||||
findFeatures
|
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import { Component, GatherProps, Visibility, getUniqueID, setDefault } from "features/feature";
|
import {
|
||||||
import type { BaseLayer, GenericLayer } from "game/layers";
|
Component,
|
||||||
|
GatherProps,
|
||||||
|
Visibility,
|
||||||
|
findFeatures,
|
||||||
|
getUniqueID,
|
||||||
|
setDefault
|
||||||
|
} from "features/feature";
|
||||||
|
import type { GenericLayer } from "game/layers";
|
||||||
import type { Unsubscribe } from "nanoevents";
|
import type { Unsubscribe } from "nanoevents";
|
||||||
import type {
|
import type {
|
||||||
Computable,
|
Computable,
|
||||||
|
|
Loading…
Reference in a new issue