forked from profectus/Profectus
Resolving problems
This commit is contained in:
parent
98f18fef43
commit
8806910f5e
11 changed files with 35 additions and 36 deletions
|
@ -2,19 +2,19 @@ import { computed } from "@vue/reactivity";
|
||||||
import { isArray } from "@vue/shared";
|
import { isArray } from "@vue/shared";
|
||||||
import Select from "components/fields/Select.vue";
|
import Select from "components/fields/Select.vue";
|
||||||
import AchievementComponent from "features/achievements/Achievement.vue";
|
import AchievementComponent from "features/achievements/Achievement.vue";
|
||||||
import { Decorator, GenericDecorator } from "features/decorators/common";
|
import { GenericDecorator } from "features/decorators/common";
|
||||||
import {
|
import {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
Component,
|
Component,
|
||||||
GatherProps,
|
GatherProps,
|
||||||
GenericComponent,
|
GenericComponent,
|
||||||
getUniqueID,
|
|
||||||
jsx,
|
|
||||||
OptionsFunc,
|
OptionsFunc,
|
||||||
Replace,
|
Replace,
|
||||||
setDefault,
|
|
||||||
StyleValue,
|
StyleValue,
|
||||||
Visibility
|
Visibility,
|
||||||
|
getUniqueID,
|
||||||
|
jsx,
|
||||||
|
setDefault
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import { globalBus } from "game/events";
|
import { globalBus } from "game/events";
|
||||||
import "game/notifications";
|
import "game/notifications";
|
||||||
|
@ -22,10 +22,10 @@ import type { Persistent } from "game/persistence";
|
||||||
import { persistent } from "game/persistence";
|
import { persistent } from "game/persistence";
|
||||||
import player from "game/player";
|
import player from "game/player";
|
||||||
import {
|
import {
|
||||||
|
Requirements,
|
||||||
createBooleanRequirement,
|
createBooleanRequirement,
|
||||||
createVisibilityRequirement,
|
createVisibilityRequirement,
|
||||||
displayRequirements,
|
displayRequirements,
|
||||||
Requirements,
|
|
||||||
requirementsMet
|
requirementsMet
|
||||||
} from "game/requirements";
|
} from "game/requirements";
|
||||||
import settings, { registerSettingField } from "game/settings";
|
import settings, { registerSettingField } from "game/settings";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import BarComponent from "features/bars/Bar.vue";
|
import BarComponent from "features/bars/Bar.vue";
|
||||||
import { Decorator, GenericDecorator } from "features/decorators/common";
|
import { GenericDecorator } from "features/decorators/common";
|
||||||
import type {
|
import type {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
GenericComponent,
|
GenericComponent,
|
||||||
|
@ -7,7 +7,7 @@ import type {
|
||||||
Replace,
|
Replace,
|
||||||
StyleValue
|
StyleValue
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, Visibility, getUniqueID, setDefault } from "features/feature";
|
||||||
import type { DecimalSource } from "util/bignum";
|
import type { DecimalSource } from "util/bignum";
|
||||||
import { Direction } from "util/common";
|
import { Direction } from "util/common";
|
||||||
import type {
|
import type {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { isArray } from "@vue/shared";
|
import { isArray } from "@vue/shared";
|
||||||
import Toggle from "components/fields/Toggle.vue";
|
import Toggle from "components/fields/Toggle.vue";
|
||||||
import ChallengeComponent from "features/challenges/Challenge.vue";
|
import ChallengeComponent from "features/challenges/Challenge.vue";
|
||||||
import { Decorator, GenericDecorator } from "features/decorators/common";
|
import { GenericDecorator } from "features/decorators/common";
|
||||||
import type {
|
import type {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
GenericComponent,
|
GenericComponent,
|
||||||
|
@ -12,17 +12,17 @@ import type {
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
GatherProps,
|
GatherProps,
|
||||||
|
Visibility,
|
||||||
getUniqueID,
|
getUniqueID,
|
||||||
isVisible,
|
isVisible,
|
||||||
jsx,
|
jsx,
|
||||||
setDefault,
|
setDefault
|
||||||
Visibility
|
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import type { GenericReset } from "features/reset";
|
import type { GenericReset } from "features/reset";
|
||||||
import { globalBus } from "game/events";
|
import { globalBus } from "game/events";
|
||||||
import type { Persistent } from "game/persistence";
|
import type { Persistent } from "game/persistence";
|
||||||
import { persistent } from "game/persistence";
|
import { persistent } from "game/persistence";
|
||||||
import { maxRequirementsMet, Requirements } from "game/requirements";
|
import { Requirements, maxRequirementsMet } from "game/requirements";
|
||||||
import settings, { registerSettingField } from "game/settings";
|
import settings, { registerSettingField } from "game/settings";
|
||||||
import type { DecimalSource } from "util/bignum";
|
import type { DecimalSource } from "util/bignum";
|
||||||
import Decimal from "util/bignum";
|
import Decimal from "util/bignum";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import ClickableComponent from "features/clickables/Clickable.vue";
|
import ClickableComponent from "features/clickables/Clickable.vue";
|
||||||
import { Decorator, GenericDecorator } from "features/decorators/common";
|
import { GenericDecorator } from "features/decorators/common";
|
||||||
import type {
|
import type {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
GenericComponent,
|
GenericComponent,
|
||||||
|
@ -7,7 +7,7 @@ import type {
|
||||||
Replace,
|
Replace,
|
||||||
StyleValue
|
StyleValue
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, Visibility, getUniqueID, setDefault } from "features/feature";
|
||||||
import type { BaseLayer } from "game/layers";
|
import type { BaseLayer } from "game/layers";
|
||||||
import type { Unsubscribe } from "nanoevents";
|
import type { Unsubscribe } from "nanoevents";
|
||||||
import type {
|
import type {
|
||||||
|
|
|
@ -28,7 +28,7 @@ export type Decorator<
|
||||||
export type GenericDecorator = Decorator<unknown>;
|
export type GenericDecorator = Decorator<unknown>;
|
||||||
|
|
||||||
export interface EffectFeatureOptions {
|
export interface EffectFeatureOptions {
|
||||||
effect: Computable<any>;
|
effect: Computable<unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type EffectFeature<T extends EffectFeatureOptions> = Replace<
|
export type EffectFeature<T extends EffectFeatureOptions> = Replace<
|
||||||
|
@ -38,7 +38,7 @@ export type EffectFeature<T extends EffectFeatureOptions> = Replace<
|
||||||
|
|
||||||
export type GenericEffectFeature = Replace<
|
export type GenericEffectFeature = Replace<
|
||||||
EffectFeature<EffectFeatureOptions>,
|
EffectFeature<EffectFeatureOptions>,
|
||||||
{ effect: ProcessedComputable<any> }
|
{ effect: ProcessedComputable<unknown> }
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { globalBus } from "game/events";
|
||||||
import "lib/pixi";
|
import "lib/pixi";
|
||||||
import { processedPropType } from "util/vue";
|
import { processedPropType } from "util/vue";
|
||||||
import type { PropType } from "vue";
|
import type { PropType } from "vue";
|
||||||
import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, unref } from "vue";
|
import { defineComponent, nextTick, onBeforeUnmount, onMounted, shallowRef, unref } from "vue";
|
||||||
|
|
||||||
// TODO get typing support on the Particles component
|
// TODO get typing support on the Particles component
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
|
|
@ -7,14 +7,14 @@ import type {
|
||||||
Replace,
|
Replace,
|
||||||
StyleValue
|
StyleValue
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import { Component, GatherProps, getUniqueID, jsx, setDefault, Visibility } from "features/feature";
|
import { Component, GatherProps, Visibility, getUniqueID, jsx, setDefault } from "features/feature";
|
||||||
import { DefaultValue, Persistent, persistent } from "game/persistence";
|
import { DefaultValue, Persistent, persistent } from "game/persistence";
|
||||||
import {
|
import {
|
||||||
|
Requirements,
|
||||||
createVisibilityRequirement,
|
createVisibilityRequirement,
|
||||||
displayRequirements,
|
displayRequirements,
|
||||||
maxRequirementsMet,
|
maxRequirementsMet,
|
||||||
payRequirements,
|
payRequirements,
|
||||||
Requirements,
|
|
||||||
requirementsMet
|
requirementsMet
|
||||||
} from "game/requirements";
|
} from "game/requirements";
|
||||||
import type { DecimalSource } from "util/bignum";
|
import type { DecimalSource } from "util/bignum";
|
||||||
|
@ -30,7 +30,7 @@ import { createLazyProxy } from "util/proxies";
|
||||||
import { coerceComponent, isCoercableComponent } from "util/vue";
|
import { coerceComponent, isCoercableComponent } from "util/vue";
|
||||||
import type { Ref } from "vue";
|
import type { Ref } from "vue";
|
||||||
import { computed, unref } from "vue";
|
import { computed, unref } from "vue";
|
||||||
import { Decorator, GenericDecorator } from "./decorators/common";
|
import { GenericDecorator } from "./decorators/common";
|
||||||
|
|
||||||
/** A symbol used to identify {@link Repeatable} features. */
|
/** A symbol used to identify {@link Repeatable} features. */
|
||||||
export const RepeatableType = Symbol("Repeatable");
|
export const RepeatableType = Symbol("Repeatable");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { isArray } from "@vue/shared";
|
import { isArray } from "@vue/shared";
|
||||||
import { Decorator, GenericDecorator } from "features/decorators/common";
|
import { GenericDecorator } from "features/decorators/common";
|
||||||
import type {
|
import type {
|
||||||
CoercableComponent,
|
CoercableComponent,
|
||||||
GenericComponent,
|
GenericComponent,
|
||||||
|
@ -9,22 +9,20 @@ import type {
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
findFeatures,
|
|
||||||
GatherProps,
|
GatherProps,
|
||||||
|
Visibility,
|
||||||
|
findFeatures,
|
||||||
getUniqueID,
|
getUniqueID,
|
||||||
setDefault,
|
setDefault
|
||||||
Visibility
|
|
||||||
} from "features/feature";
|
} from "features/feature";
|
||||||
import { createResource } from "features/resources/resource";
|
|
||||||
import UpgradeComponent from "features/upgrades/Upgrade.vue";
|
import UpgradeComponent from "features/upgrades/Upgrade.vue";
|
||||||
import type { GenericLayer } from "game/layers";
|
import type { GenericLayer } from "game/layers";
|
||||||
import type { Persistent } from "game/persistence";
|
import type { Persistent } from "game/persistence";
|
||||||
import { persistent } from "game/persistence";
|
import { persistent } from "game/persistence";
|
||||||
import {
|
import {
|
||||||
createCostRequirement,
|
Requirements,
|
||||||
createVisibilityRequirement,
|
createVisibilityRequirement,
|
||||||
payRequirements,
|
payRequirements,
|
||||||
Requirements,
|
|
||||||
requirementsMet
|
requirementsMet
|
||||||
} from "game/requirements";
|
} from "game/requirements";
|
||||||
import { isFunction } from "util/common";
|
import { isFunction } from "util/common";
|
||||||
|
|
|
@ -267,6 +267,7 @@ export function displayRequirements(requirements: Requirements, amount: DecimalS
|
||||||
<div>
|
<div>
|
||||||
Costs:{" "}
|
Costs:{" "}
|
||||||
{joinJSX(
|
{joinJSX(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
withCosts.map(r => r.partialDisplay!(amount)),
|
withCosts.map(r => r.partialDisplay!(amount)),
|
||||||
<>, </>
|
<>, </>
|
||||||
)}
|
)}
|
||||||
|
@ -276,6 +277,7 @@ export function displayRequirements(requirements: Requirements, amount: DecimalS
|
||||||
<div>
|
<div>
|
||||||
Requires:{" "}
|
Requires:{" "}
|
||||||
{joinJSX(
|
{joinJSX(
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
withoutCosts.map(r => r.partialDisplay!(amount)),
|
withoutCosts.map(r => r.partialDisplay!(amount)),
|
||||||
<>, </>
|
<>, </>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { createResource, Resource } from "features/resources/resource";
|
||||||
import { GenericFormula } from "game/formulas/types";
|
import { GenericFormula } from "game/formulas/types";
|
||||||
import { createLayer, GenericLayer } from "game/layers";
|
import { createLayer, GenericLayer } from "game/layers";
|
||||||
import Decimal from "util/bignum";
|
import Decimal from "util/bignum";
|
||||||
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
|
||||||
import { ref, unref } from "vue";
|
import { ref, unref } from "vue";
|
||||||
import "../utils";
|
import "../utils";
|
||||||
|
|
||||||
|
@ -472,15 +472,15 @@ describe("Passive generation", () => {
|
||||||
setupPassiveGeneration(layer, conversion);
|
setupPassiveGeneration(layer, conversion);
|
||||||
layer.emit("preUpdate", 1);
|
layer.emit("preUpdate", 1);
|
||||||
expect(gainResource.value).compare_tolerance(2);
|
expect(gainResource.value).compare_tolerance(2);
|
||||||
})
|
});
|
||||||
test("Rate is 100", () => {
|
test("Rate is 100", () => {
|
||||||
setupPassiveGeneration(layer, conversion, () => 100);
|
setupPassiveGeneration(layer, conversion, () => 100);
|
||||||
layer.emit("preUpdate", 1);
|
layer.emit("preUpdate", 1);
|
||||||
expect(gainResource.value).compare_tolerance(101);
|
expect(gainResource.value).compare_tolerance(101);
|
||||||
})
|
});
|
||||||
test("Obeys cap", () => {
|
test("Obeys cap", () => {
|
||||||
setupPassiveGeneration(layer, conversion, 100, () => 100);
|
setupPassiveGeneration(layer, conversion, 100, () => 100);
|
||||||
layer.emit("preUpdate", 1);
|
layer.emit("preUpdate", 1);
|
||||||
expect(gainResource.value).compare_tolerance(100);
|
expect(gainResource.value).compare_tolerance(100);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,11 +2,10 @@ import { createResource, Resource } from "features/resources/resource";
|
||||||
import Formula, {
|
import Formula, {
|
||||||
calculateCost,
|
calculateCost,
|
||||||
calculateMaxAffordable,
|
calculateMaxAffordable,
|
||||||
printFormula,
|
|
||||||
unrefFormulaSource
|
unrefFormulaSource
|
||||||
} from "game/formulas/formulas";
|
} from "game/formulas/formulas";
|
||||||
import type { GenericFormula, InvertibleFormula } from "game/formulas/types";
|
import type { GenericFormula, InvertibleFormula } from "game/formulas/types";
|
||||||
import Decimal, { DecimalSource, format } from "util/bignum";
|
import Decimal, { DecimalSource } from "util/bignum";
|
||||||
import { beforeAll, describe, expect, test } from "vitest";
|
import { beforeAll, describe, expect, test } from "vitest";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import "../utils";
|
import "../utils";
|
||||||
|
@ -151,7 +150,7 @@ describe("Formula Equality Checking", () => {
|
||||||
describe("Formula aliases", () => {
|
describe("Formula aliases", () => {
|
||||||
function testAliases<T extends FormulaFunctions>(
|
function testAliases<T extends FormulaFunctions>(
|
||||||
aliases: T[],
|
aliases: T[],
|
||||||
args: Parameters<typeof Formula[T]>
|
args: Parameters<(typeof Formula)[T]>
|
||||||
) {
|
) {
|
||||||
describe(aliases[0], () => {
|
describe(aliases[0], () => {
|
||||||
let formula: GenericFormula;
|
let formula: GenericFormula;
|
||||||
|
@ -239,7 +238,7 @@ describe("Creating Formulas", () => {
|
||||||
|
|
||||||
function checkFormula<T extends FormulaFunctions>(
|
function checkFormula<T extends FormulaFunctions>(
|
||||||
functionName: T,
|
functionName: T,
|
||||||
args: Readonly<Parameters<typeof Formula[T]>>
|
args: Readonly<Parameters<(typeof Formula)[T]>>
|
||||||
) {
|
) {
|
||||||
let formula: GenericFormula;
|
let formula: GenericFormula;
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
@ -261,7 +260,7 @@ describe("Creating Formulas", () => {
|
||||||
// It's a lot of tests, but I'd rather be exhaustive
|
// It's a lot of tests, but I'd rather be exhaustive
|
||||||
function testFormulaCall<T extends FormulaFunctions>(
|
function testFormulaCall<T extends FormulaFunctions>(
|
||||||
functionName: T,
|
functionName: T,
|
||||||
args: Readonly<Parameters<typeof Formula[T]>>
|
args: Readonly<Parameters<(typeof Formula)[T]>>
|
||||||
) {
|
) {
|
||||||
if ((functionName === "slog" || functionName === "layeradd") && args[0] === -1) {
|
if ((functionName === "slog" || functionName === "layeradd") && args[0] === -1) {
|
||||||
// These cases in particular take a long time, so skip them
|
// These cases in particular take a long time, so skip them
|
||||||
|
|
Loading…
Reference in a new issue