diff --git a/src/features/conversion.ts b/src/features/conversion.ts index c9c22c2..9f7d176 100644 --- a/src/features/conversion.ts +++ b/src/features/conversion.ts @@ -2,11 +2,7 @@ import type { OptionsFunc, Replace } from "features/feature"; import { setDefault } from "features/feature"; import type { Resource } from "features/resources/resource"; import Formula from "game/formulas/formulas"; -import { - IntegrableFormula, - InvertibleFormula, - InvertibleIntegralFormula -} from "game/formulas/types"; +import { InvertibleFormula, InvertibleIntegralFormula } from "game/formulas/types"; import type { BaseLayer } from "game/layers"; import type { DecimalSource } from "util/bignum"; import Decimal from "util/bignum"; @@ -23,9 +19,7 @@ export interface ConversionOptions { * The formula used to determine how much {@link gainResource} should be earned by this converting. * The passed value will be a Formula representing the {@link baseResource} variable. */ - formula: ( - variable: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => InvertibleFormula; + formula: (variable: InvertibleIntegralFormula) => InvertibleFormula; /** * How much of the output resource the conversion can currently convert for. * Typically this will be set for you in a conversion constructor. diff --git a/src/game/formulas/formulas.ts b/src/game/formulas/formulas.ts index e8557b2..bf989b1 100644 --- a/src/game/formulas/formulas.ts +++ b/src/game/formulas/formulas.ts @@ -201,9 +201,7 @@ export abstract class InternalFormula - ): InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula { + public static constant(value: ProcessedComputable): InvertibleIntegralFormula { return new Formula({ inputs: [value] }); } @@ -211,9 +209,7 @@ export abstract class InternalFormula - ): InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula { + public static variable(value: ProcessedComputable): InvertibleIntegralFormula { return new Formula({ variable: value }); } @@ -228,9 +224,7 @@ export abstract class InternalFormula, - formulaModifier: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula + formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula ) { const lhsRef = ref(0); const formula = formulaModifier(Formula.variable(lhsRef)); @@ -271,12 +265,8 @@ export abstract class InternalFormula, - formulaModifier: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula, - elseFormulaModifier?: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula + formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula, + elseFormulaModifier?: (value: InvertibleIntegralFormula) => GenericFormula ) { const lhsRef = ref(0); const variable = Formula.variable(lhsRef); @@ -319,12 +309,8 @@ export abstract class InternalFormula, - formulaModifier: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula, - elseFormulaModifier?: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula + formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula, + elseFormulaModifier?: (value: InvertibleIntegralFormula) => GenericFormula ) { return Formula.if(value, condition, formulaModifier, elseFormulaModifier); } @@ -872,26 +858,20 @@ export abstract class InternalFormula, - formulaModifier: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula + formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula ) { return Formula.step(this, start, formulaModifier); } public if( condition: Computable, - formulaModifier: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula + formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula ) { return Formula.if(this, condition, formulaModifier); } public conditional( condition: Computable, - formulaModifier: ( - value: InvertibleFormula & IntegrableFormula & InvertibleIntegralFormula - ) => GenericFormula + formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula ) { return Formula.if(this, condition, formulaModifier); } diff --git a/tests/features/conversions.test.ts b/tests/features/conversions.test.ts index dc89ac0..09d6569 100644 --- a/tests/features/conversions.test.ts +++ b/tests/features/conversions.test.ts @@ -5,7 +5,7 @@ import { setupPassiveGeneration } from "features/conversion"; import { createResource, Resource } from "features/resources/resource"; -import { GenericFormula } from "game/formulas/types"; +import { InvertibleIntegralFormula } from "game/formulas/types"; import { createLayer, GenericLayer } from "game/layers"; import Decimal from "util/bignum"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; @@ -15,7 +15,7 @@ import "../utils"; describe("Creating conversion", () => { let baseResource: Resource; let gainResource: Resource; - let formula: (x: GenericFormula) => GenericFormula; + let formula: (x: InvertibleIntegralFormula) => InvertibleIntegralFormula; beforeEach(() => { baseResource = createResource(ref(40)); gainResource = createResource(ref(1)); @@ -449,7 +449,7 @@ describe("Creating conversion", () => { describe("Passive generation", () => { let baseResource: Resource; let gainResource: Resource; - let formula: (x: GenericFormula) => GenericFormula; + let formula: (x: InvertibleIntegralFormula) => InvertibleIntegralFormula; let conversion: GenericConversion; let layer: GenericLayer; beforeEach(() => {