diff --git a/src/game/formulas/formulas.ts b/src/game/formulas/formulas.ts index 885adee..6255981 100644 --- a/src/game/formulas/formulas.ts +++ b/src/game/formulas/formulas.ts @@ -421,23 +421,13 @@ export default class Formula { integrate: ops.integrateNeg }); } - public static negate(value: T): Omit; - public static negate(value: FormulaSource): GenericFormula; - public static negate(value: FormulaSource) { - return Formula.neg(value); - } - public static negated(value: T): Omit; - public static negated(value: FormulaSource): GenericFormula; - public static negated(value: FormulaSource) { - return Formula.neg(value); - } + public static negate = Formula.neg; + public static negated = Formula.neg; public static sign(value: FormulaSource): GenericFormula { return new Formula({ inputs: [value], evaluate: Decimal.sign }); } - public static sgn(value: FormulaSource) { - return Formula.sign(value); - } + public static sgn = Formula.sign; public static round(value: FormulaSource): GenericFormula { return new Formula({ inputs: [value], evaluate: Decimal.round }); @@ -469,12 +459,7 @@ export default class Formula { invertIntegral: ops.invertIntegrateAdd }); } - public static plus(value: T, other: FormulaSource): T; - public static plus(value: FormulaSource, other: T): T; - public static plus(value: FormulaSource, other: FormulaSource): GenericFormula; - public static plus(value: FormulaSource, other: FormulaSource) { - return Formula.add(value, other); - } + public static plus = Formula.add; public static sub(value: T, other: FormulaSource): T; public static sub(value: FormulaSource, other: T): T; @@ -490,18 +475,8 @@ export default class Formula { invertIntegral: ops.invertIntegrateSub }); } - public static subtract(value: T, other: FormulaSource): T; - public static subtract(value: FormulaSource, other: T): T; - public static subtract(value: FormulaSource, other: FormulaSource): GenericFormula; - public static subtract(value: FormulaSource, other: FormulaSource) { - return Formula.sub(value, other); - } - public static minus(value: T, other: FormulaSource): T; - public static minus(value: FormulaSource, other: T): T; - public static minus(value: FormulaSource, other: FormulaSource): GenericFormula; - public static minus(value: FormulaSource, other: FormulaSource) { - return Formula.sub(value, other); - } + public static subtract = Formula.sub; + public static minus = Formula.sub; public static mul(value: T, other: FormulaSource): T; public static mul(value: FormulaSource, other: T): T; @@ -516,18 +491,8 @@ export default class Formula { invertIntegral: ops.invertIntegrateMul }); } - public static multiply(value: T, other: FormulaSource): T; - public static multiply(value: FormulaSource, other: T): T; - public static multiply(value: FormulaSource, other: FormulaSource): GenericFormula; - public static multiply(value: FormulaSource, other: FormulaSource) { - return Formula.mul(value, other); - } - public static times(value: T, other: FormulaSource): T; - public static times(value: FormulaSource, other: T): T; - public static times(value: FormulaSource, other: FormulaSource): GenericFormula; - public static times(value: FormulaSource, other: FormulaSource) { - return Formula.mul(value, other); - } + public static multiply = Formula.mul; + public static times = Formula.mul; public static div(value: T, other: FormulaSource): T; public static div(value: FormulaSource, other: T): T; @@ -542,12 +507,9 @@ export default class Formula { invertIntegral: ops.invertIntegrateDiv }); } - public static divide(value: T, other: FormulaSource): T; - public static divide(value: FormulaSource, other: T): T; - public static divide(value: FormulaSource, other: FormulaSource): GenericFormula; - public static divide(value: FormulaSource, other: FormulaSource) { - return Formula.div(value, other); - } + public static divide = Formula.div; + public static divideBy = Formula.div; + public static dividedBy = Formula.div; public static recip(value: T): T; public static recip(value: FormulaSource): GenericFormula; @@ -560,16 +522,8 @@ export default class Formula { invertIntegral: ops.invertIntegrateRecip }); } - public static reciprocal(value: T): T; - public static reciprocal(value: FormulaSource): GenericFormula; - public static reciprocal(value: FormulaSource): GenericFormula { - return Formula.recip(value); - } - public static reciprocate(value: T): T; - public static reciprocate(value: FormulaSource): GenericFormula; - public static reciprocate(value: FormulaSource) { - return Formula.recip(value); - } + public static reciprocal = Formula.recip; + public static reciprocate = Formula.recip; public static max(value: FormulaSource, other: FormulaSource): GenericFormula { return new Formula({ @@ -641,12 +595,7 @@ export default class Formula { invertIntegral: ops.invertIntegrateLog }); } - public static logarithm(value: T, base: FormulaSource): T; - public static logarithm(value: FormulaSource, base: T): T; - public static logarithm(value: FormulaSource, base: FormulaSource): GenericFormula; - public static logarithm(value: FormulaSource, base: FormulaSource) { - return Formula.log(value, base); - } + public static logarithm = Formula.log; public static log2(value: T): T; public static log2(value: FormulaSource): GenericFormula; @@ -1048,23 +997,13 @@ export default class Formula { public neg(this: GenericFormula) { return Formula.neg(this); } - public negate(this: T): Omit; - public negate(this: GenericFormula): GenericFormula; - public negate(this: GenericFormula) { - return Formula.neg(this); - } - public negated(this: T): Omit; - public negated(this: GenericFormula): GenericFormula; - public negated(this: GenericFormula) { - return Formula.neg(this); - } + public negate = this.neg; + public negated = this.neg; public sign() { return Formula.sign(this); } - public sgn() { - return this.sign(); - } + public sgn = this.sign; public round() { return Formula.round(this); @@ -1088,12 +1027,7 @@ export default class Formula { public add(this: GenericFormula, value: FormulaSource) { return Formula.add(this, value); } - public plus(this: T, value: FormulaSource): T; - public plus(this: GenericFormula, value: T): T; - public plus(this: GenericFormula, value: FormulaSource): GenericFormula; - public plus(value: FormulaSource) { - return Formula.add(this, value); - } + public plus = this.add; public sub(this: T, value: FormulaSource): T; public sub(this: GenericFormula, value: T): T; @@ -1101,18 +1035,8 @@ export default class Formula { public sub(value: FormulaSource) { return Formula.sub(this, value); } - public subtract(this: T, value: FormulaSource): T; - public subtract(this: GenericFormula, value: T): T; - public subtract(this: GenericFormula, value: FormulaSource): GenericFormula; - public subtract(value: FormulaSource) { - return Formula.sub(this, value); - } - public minus(this: T, value: FormulaSource): T; - public minus(this: GenericFormula, value: T): T; - public minus(this: GenericFormula, value: FormulaSource): GenericFormula; - public minus(value: FormulaSource) { - return Formula.sub(this, value); - } + public subtract = this.sub; + public minus = this.sub; public mul(this: T, value: FormulaSource): T; public mul(this: GenericFormula, value: T): T; @@ -1120,18 +1044,8 @@ export default class Formula { public mul(value: FormulaSource) { return Formula.mul(this, value); } - public multiply(this: T, value: FormulaSource): T; - public multiply(this: GenericFormula, value: T): T; - public multiply(this: GenericFormula, value: FormulaSource): GenericFormula; - public multiply(value: FormulaSource) { - return Formula.mul(this, value); - } - public times(this: T, value: FormulaSource): T; - public times(this: GenericFormula, value: T): T; - public times(this: GenericFormula, value: FormulaSource): GenericFormula; - public times(value: FormulaSource) { - return Formula.mul(this, value); - } + public multiply = this.mul; + public times = this.mul; public div(this: T, value: FormulaSource): T; public div(this: GenericFormula, value: T): T; @@ -1139,40 +1053,17 @@ export default class Formula { public div(value: FormulaSource) { return Formula.div(this, value); } - public divide(this: T, value: FormulaSource): T; - public divide(this: GenericFormula, value: T): T; - public divide(this: GenericFormula, value: FormulaSource): GenericFormula; - public divide(value: FormulaSource) { - return Formula.div(this, value); - } - public divideBy(this: T, value: FormulaSource): T; - public divideBy(this: GenericFormula, value: T): T; - public divideBy(this: GenericFormula, value: FormulaSource): GenericFormula; - public divideBy(value: FormulaSource) { - return Formula.div(this, value); - } - public dividedBy(this: T, value: FormulaSource): T; - public dividedBy(this: GenericFormula, value: T): T; - public dividedBy(this: GenericFormula, value: FormulaSource): GenericFormula; - public dividedBy(value: FormulaSource) { - return Formula.div(this, value); - } + public divide = this.div; + public divideBy = this.div; + public dividedBy = this.div; public recip(this: T): T; public recip(this: FormulaSource): GenericFormula; public recip() { return Formula.recip(this); } - public reciprocal(this: T): T; - public reciprocal(this: FormulaSource): GenericFormula; - public reciprocal() { - return Formula.recip(this); - } - public reciprocate(this: T): T; - public reciprocate(this: FormulaSource): GenericFormula; - public reciprocate() { - return Formula.recip(this); - } + public reciprocal = this.recip; + public reciprocate = this.recip; public max(value: FormulaSource) { return Formula.max(this, value); @@ -1222,12 +1113,7 @@ export default class Formula { public log(value: FormulaSource) { return Formula.log(this, value); } - public logarithm(this: T, value: FormulaSource): T; - public logarithm(this: FormulaSource, value: T): T; - public logarithm(this: FormulaSource, value: FormulaSource): GenericFormula; - public logarithm(value: FormulaSource) { - return Formula.log(this, value); - } + public logarithm = this.log; public log2(this: T): T; public log2(this: FormulaSource): GenericFormula;