Untangle the autobuyers

This commit is contained in:
Andrei Andreev 2023-06-10 22:25:18 +02:00 committed by Andrei Andreev
parent af0d9d64b2
commit 7712bb5c54
28 changed files with 115 additions and 117 deletions

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.annihilation = new class AnnihilationAutobuyerState extends AutobuyerState {
export class AnnihilationAutobuyerState extends AutobuyerState {
get data() {
return player.auto.annihilation;
}
@ -42,4 +42,4 @@ Autobuyer.annihilation = new class AnnihilationAutobuyerState extends AutobuyerS
Laitela.annihilate();
}
}
}();
}

View File

@ -1,8 +1,8 @@
import { DC } from "../constants";
import { Autobuyer, UpgradeableAutobuyerState } from "./autobuyer";
import { UpgradeableAutobuyerState } from "./autobuyer";
class AntimatterDimensionAutobuyerState extends UpgradeableAutobuyerState {
export class AntimatterDimensionAutobuyerState extends UpgradeableAutobuyerState {
get tier() {
return this.id;
}
@ -169,5 +169,3 @@ class AntimatterDimensionAutobuyerState extends UpgradeableAutobuyerState {
return accessor;
}
}
Autobuyer.antimatterDimension = AntimatterDimensionAutobuyerState.createAccessor();

View File

@ -2,8 +2,8 @@
* @abstract
*/
export class AutobuyerState {
constructor(id) {
this._id = id ?? null;
constructor(id = null) {
this._id = id;
}
/**
@ -173,6 +173,3 @@ export class UpgradeableAutobuyerState extends IntervaledAutobuyerState {
return accessor;
}
}
export const Autobuyer = {};
window.Autobuyer = Autobuyer;

View File

@ -1,4 +1,51 @@
import { Autobuyer } from "./autobuyer";
import { AnnihilationAutobuyerState } from "./annihilation-autobuyer";
import { AntimatterDimensionAutobuyerState } from "./antimatter-dimension-autobuyer";
import { BigCrunchAutobuyerState } from "./big-crunch-autobuyer";
import { BlackHolePowerAutobuyerState } from "./black-hole-power-autobuyer";
import { DarkMatterDimensionAscensionAutobuyerState } from "./dark-matter-dimension-ascension-autobuyer";
import { DarkMatterDimensionAutobuyerState } from "./dark-matter-dimension-autobuyer";
import { DilationUpgradeAutobuyerState } from "./dilation-upgrade-autobuyer";
import { DimBoostAutobuyerState } from "./dimboost-autobuyer";
import { EternityAutobuyerState } from "./eternity-autobuyer";
import { GalaxyAutobuyerState } from "./galaxy-autobuyer";
import { ImaginaryUpgradeAutobuyerState } from "./imaginary-upgrade-autobuyer";
import { InfinityDimensionAutobuyerState } from "./infinity-dimension-autobuyer";
import { EPMultAutobuyerState, IPMultAutobuyerState } from "./prestige-currency-multiplier-autobuyer";
import { RealityAutobuyerState } from "./reality-autobuyer";
import { RealityUpgradeAutobuyerState } from "./reality-upgrade-autobuyer";
import { ReplicantiGalaxyAutobuyerState } from "./replicanti-galaxy-autobuyer";
import { ReplicantiUpgradeAutobuyerState } from "./replicanti-upgrade-autobuyer";
import { SacrificeAutobuyerState } from "./sacrifice-autobuyer";
import { SingularityAutobuyerState } from "./singularity-autobuyer";
import { TickspeedAutobuyerState } from "./tickspeed-autobuyer";
import { TimeDimensionAutobuyerState } from "./time-dimension-autobuyer";
import { TimeTheoremAutobuyerState } from "./time-theorem-autobuyer";
export const Autobuyer = {
annihilation: new AnnihilationAutobuyerState(),
antimatterDimension: AntimatterDimensionAutobuyerState.createAccessor(),
bigCrunch: new BigCrunchAutobuyerState(),
blackHolePower: BlackHolePowerAutobuyerState.createAccessor(),
darkMatterDimsAscension: new DarkMatterDimensionAscensionAutobuyerState(),
darkMatterDims: new DarkMatterDimensionAutobuyerState(),
dilationUpgrade: DilationUpgradeAutobuyerState.createAccessor(),
dimboost: new DimBoostAutobuyerState(),
eternity: new EternityAutobuyerState(),
galaxy: new GalaxyAutobuyerState(),
imaginaryUpgrade: ImaginaryUpgradeAutobuyerState.createAccessor(),
infinityDimension: InfinityDimensionAutobuyerState.createAccessor(),
ipMult: new IPMultAutobuyerState(),
epMult: new EPMultAutobuyerState(),
reality: new RealityAutobuyerState(),
realityUpgrade: RealityUpgradeAutobuyerState.createAccessor(),
replicantiGalaxy: new ReplicantiGalaxyAutobuyerState(),
replicantiUpgrade: ReplicantiUpgradeAutobuyerState.createAccessor(),
sacrifice: new SacrificeAutobuyerState(),
singularity: new SingularityAutobuyerState(),
tickspeed: new TickspeedAutobuyerState(),
timeDimension: TimeDimensionAutobuyerState.createAccessor(),
timeTheorem: new TimeTheoremAutobuyerState()
};
export const Autobuyers = (function() {
const antimatterDimensions = Autobuyer.antimatterDimension.zeroIndexed;

View File

@ -1,6 +1,6 @@
import { Autobuyer, UpgradeableAutobuyerState } from "./autobuyer";
import { UpgradeableAutobuyerState } from "./autobuyer";
Autobuyer.bigCrunch = new class BigCrunchAutobuyerState extends UpgradeableAutobuyerState {
export class BigCrunchAutobuyerState extends UpgradeableAutobuyerState {
get data() {
return player.auto.bigCrunch;
}
@ -123,4 +123,4 @@ Autobuyer.bigCrunch = new class BigCrunchAutobuyerState extends UpgradeableAutob
if (EternityMilestone.bigCrunchModes.isReached) return;
this.mode = AUTO_CRUNCH_MODE.AMOUNT;
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
class BlackHolePowerAutobuyerState extends AutobuyerState {
export class BlackHolePowerAutobuyerState extends AutobuyerState {
get data() {
return player.auto.blackHolePower.all[this.id - 1];
}
@ -27,5 +27,3 @@ class BlackHolePowerAutobuyerState extends AutobuyerState {
static get isActive() { return player.auto.blackHolePower.isActive; }
static set isActive(value) { player.auto.blackHolePower.isActive = value; }
}
Autobuyer.blackHolePower = BlackHolePowerAutobuyerState.createAccessor();

View File

@ -1,7 +1,6 @@
import { Autobuyer, IntervaledAutobuyerState } from "./autobuyer";
import { IntervaledAutobuyerState } from "./autobuyer";
Autobuyer.darkMatterDimsAscension =
new class DarkMatterDimensionAscensionAutobuyerState extends IntervaledAutobuyerState {
export class DarkMatterDimensionAscensionAutobuyerState extends IntervaledAutobuyerState {
get data() {
return player.auto.ascension;
}
@ -28,4 +27,4 @@ new class DarkMatterDimensionAscensionAutobuyerState extends IntervaledAutobuyer
DarkMatterDimension(i).ascend();
}
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, IntervaledAutobuyerState } from "./autobuyer";
import { IntervaledAutobuyerState } from "./autobuyer";
Autobuyer.darkMatterDims = new class DarkMatterDimensionAutobuyerState extends IntervaledAutobuyerState {
export class DarkMatterDimensionAutobuyerState extends IntervaledAutobuyerState {
get data() {
return player.auto.darkMatterDims;
}
@ -25,4 +25,4 @@ Autobuyer.darkMatterDims = new class DarkMatterDimensionAutobuyerState extends I
super.tick();
Laitela.maxAllDMDimensions(SingularityMilestone.darkDimensionAutobuyers.effectValue);
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, IntervaledAutobuyerState } from "./autobuyer";
import { IntervaledAutobuyerState } from "./autobuyer";
class DilationUpgradeAutobuyerState extends IntervaledAutobuyerState {
export class DilationUpgradeAutobuyerState extends IntervaledAutobuyerState {
get _upgradeName() { return ["dtGain", "galaxyThreshold", "tachyonGain"][this.id - 1]; }
get data() {
@ -38,5 +38,3 @@ class DilationUpgradeAutobuyerState extends IntervaledAutobuyerState {
static get isActive() { return player.auto.dilationUpgrades.isActive; }
static set isActive(value) { player.auto.dilationUpgrades.isActive = value; }
}
Autobuyer.dilationUpgrade = DilationUpgradeAutobuyerState.createAccessor();

View File

@ -1,6 +1,6 @@
import { Autobuyer, UpgradeableAutobuyerState } from "./autobuyer";
import { UpgradeableAutobuyerState } from "./autobuyer";
Autobuyer.dimboost = new class DimBoostAutobuyerState extends UpgradeableAutobuyerState {
export class DimBoostAutobuyerState extends UpgradeableAutobuyerState {
get data() {
return player.auto.dimBoost;
}
@ -113,4 +113,4 @@ Autobuyer.dimboost = new class DimBoostAutobuyerState extends UpgradeableAutobuy
super.tick();
}
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.eternity = new class EternityAutobuyerState extends AutobuyerState {
export class EternityAutobuyerState extends AutobuyerState {
get data() {
return player.auto.eternity;
}
@ -99,4 +99,4 @@ Autobuyer.eternity = new class EternityAutobuyerState extends AutobuyerState {
this.isActive = false;
}
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, UpgradeableAutobuyerState } from "./autobuyer";
import { UpgradeableAutobuyerState } from "./autobuyer";
Autobuyer.galaxy = new class GalaxyAutobuyerState extends UpgradeableAutobuyerState {
export class GalaxyAutobuyerState extends UpgradeableAutobuyerState {
get data() {
return player.auto.galaxy;
}
@ -69,4 +69,4 @@ Autobuyer.galaxy = new class GalaxyAutobuyerState extends UpgradeableAutobuyerSt
const limit = this.limitGalaxies ? this.maxGalaxies : Number.MAX_VALUE;
requestGalaxyReset(this.isBuyMaxUnlocked, limit);
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
class ImaginaryUpgradeAutobuyerState extends AutobuyerState {
export class ImaginaryUpgradeAutobuyerState extends AutobuyerState {
get name() {
return ImaginaryUpgrade(this.id).config.name;
}
@ -27,5 +27,3 @@ class ImaginaryUpgradeAutobuyerState extends AutobuyerState {
static get isActive() { return player.auto.imaginaryUpgrades.isActive; }
static set isActive(value) { player.auto.imaginaryUpgrades.isActive = value; }
}
Autobuyer.imaginaryUpgrade = ImaginaryUpgradeAutobuyerState.createAccessor();

View File

@ -1,27 +0,0 @@
import "./autobuyer";
import "./antimatter-dimension-autobuyer";
import "./tickspeed-autobuyer";
import "./dimboost-autobuyer";
import "./galaxy-autobuyer";
import "./big-crunch-autobuyer";
import "./sacrifice-autobuyer";
import "./eternity-autobuyer";
import "./reality-autobuyer";
import "./infinity-dimension-autobuyer";
import "./time-dimension-autobuyer";
import "./time-theorem-autobuyer";
import "./black-hole-power-autobuyer";
import "./reality-upgrade-autobuyer";
import "./imaginary-upgrade-autobuyer";
import "./replicanti-upgrade-autobuyer";
import "./dilation-upgrade-autobuyer";
import "./prestige-currency-multiplier-autobuyer";
import "./replicanti-galaxy-autobuyer";
import "./dark-matter-dimension-autobuyer";
import "./dark-matter-dimension-ascension-autobuyer";
import "./singularity-autobuyer";
import "./annihilation-autobuyer";
export * from "./autobuyers";

View File

@ -1,8 +1,6 @@
import { InfinityDimensions } from "../globals";
import { IntervaledAutobuyerState } from "./autobuyer";
import { Autobuyer, IntervaledAutobuyerState } from "./autobuyer";
class InfinityDimensionAutobuyerState extends IntervaledAutobuyerState {
export class InfinityDimensionAutobuyerState extends IntervaledAutobuyerState {
get tier() {
return this.id;
}
@ -53,5 +51,3 @@ class InfinityDimensionAutobuyerState extends IntervaledAutobuyerState {
static get isActive() { return player.auto.infinityDims.isActive; }
static set isActive(value) { player.auto.infinityDims.isActive = value; }
}
Autobuyer.infinityDimension = InfinityDimensionAutobuyerState.createAccessor();

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.ipMult = new class IPMultAutobuyerState extends AutobuyerState {
export class IPMultAutobuyerState extends AutobuyerState {
get data() {
return player.auto.ipMultBuyer;
}
@ -20,9 +20,9 @@ Autobuyer.ipMult = new class IPMultAutobuyerState extends AutobuyerState {
tick() {
InfinityUpgrade.ipMult.buyMax();
}
}();
}
Autobuyer.epMult = new class EPMultAutobuyerState extends AutobuyerState {
export class EPMultAutobuyerState extends AutobuyerState {
get data() {
return player.auto.epMultBuyer;
}
@ -48,4 +48,4 @@ Autobuyer.epMult = new class EPMultAutobuyerState extends AutobuyerState {
applyEU2();
EternityUpgrade.epMult.buyMax();
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.reality = new class RealityAutobuyerState extends AutobuyerState {
export class RealityAutobuyerState extends AutobuyerState {
get data() {
return player.auto.reality;
}
@ -120,4 +120,4 @@ Autobuyer.reality = new class RealityAutobuyerState extends AutobuyerState {
}
if (proc) autoReality();
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
class RealityUpgradeAutobuyerState extends AutobuyerState {
export class RealityUpgradeAutobuyerState extends AutobuyerState {
get name() {
return RealityUpgrade(this.id).config.name;
}
@ -27,5 +27,3 @@ class RealityUpgradeAutobuyerState extends AutobuyerState {
static get isActive() { return player.auto.realityUpgrades.isActive; }
static set isActive(value) { player.auto.realityUpgrades.isActive = value; }
}
Autobuyer.realityUpgrade = RealityUpgradeAutobuyerState.createAccessor();

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.replicantiGalaxy = new class ReplicantiGalaxyAutobuyerState extends AutobuyerState {
export class ReplicantiGalaxyAutobuyerState extends AutobuyerState {
get data() {
return player.auto.replicantiGalaxies;
}
@ -25,4 +25,4 @@ Autobuyer.replicantiGalaxy = new class ReplicantiGalaxyAutobuyerState extends Au
if (!this.isEnabled) return;
replicantiGalaxy();
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, IntervaledAutobuyerState } from "./autobuyer";
import { IntervaledAutobuyerState } from "./autobuyer";
class ReplicantiUpgradeAutobuyerState extends IntervaledAutobuyerState {
export class ReplicantiUpgradeAutobuyerState extends IntervaledAutobuyerState {
get _upgradeName() { return ["chance", "interval", "galaxies"][this.id - 1]; }
get name() {
@ -39,5 +39,3 @@ class ReplicantiUpgradeAutobuyerState extends IntervaledAutobuyerState {
static get isActive() { return player.auto.replicantiUpgrades.isActive; }
static set isActive(value) { player.auto.replicantiUpgrades.isActive = value; }
}
Autobuyer.replicantiUpgrade = ReplicantiUpgradeAutobuyerState.createAccessor();

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.sacrifice = new class SacrificeAutobuyerState extends AutobuyerState {
export class SacrificeAutobuyerState extends AutobuyerState {
get data() {
return player.auto.sacrifice;
}
@ -41,4 +41,4 @@ Autobuyer.sacrifice = new class SacrificeAutobuyerState extends AutobuyerState {
if (Sacrifice.nextBoost.lt(Decimal.max(this.multiplier, 1.01))) return;
sacrificeReset();
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.singularity = new class SingularityAutobuyerState extends AutobuyerState {
export class SingularityAutobuyerState extends AutobuyerState {
get data() {
return player.auto.singularity;
}
@ -22,4 +22,4 @@ Autobuyer.singularity = new class SingularityAutobuyerState extends AutobuyerSta
Singularity.perform();
}
}
}();
}

View File

@ -1,8 +1,8 @@
import { DC } from "../constants";
import { Autobuyer, UpgradeableAutobuyerState } from "./autobuyer";
import { UpgradeableAutobuyerState } from "./autobuyer";
Autobuyer.tickspeed = new class TickspeedAutobuyerState extends UpgradeableAutobuyerState {
export class TickspeedAutobuyerState extends UpgradeableAutobuyerState {
get data() {
return player.auto.tickspeed;
}
@ -97,4 +97,4 @@ Autobuyer.tickspeed = new class TickspeedAutobuyerState extends UpgradeableAutob
this.data.isBought = false;
TabNotification.newAutobuyer.clearTrigger();
}
}();
}

View File

@ -1,6 +1,6 @@
import { Autobuyer, IntervaledAutobuyerState } from "./autobuyer";
import { IntervaledAutobuyerState } from "./autobuyer";
class TimeDimensionAutobuyerState extends IntervaledAutobuyerState {
export class TimeDimensionAutobuyerState extends IntervaledAutobuyerState {
get tier() {
return this.id;
}
@ -55,5 +55,3 @@ class TimeDimensionAutobuyerState extends IntervaledAutobuyerState {
static get isActive() { return player.auto.timeDims.isActive; }
static set isActive(value) { player.auto.timeDims.isActive = value; }
}
Autobuyer.timeDimension = TimeDimensionAutobuyerState.createAccessor();

View File

@ -1,6 +1,6 @@
import { Autobuyer, AutobuyerState } from "./autobuyer";
import { AutobuyerState } from "./autobuyer";
Autobuyer.timeTheorem = new class TimeTheoremAutobuyerState extends AutobuyerState {
export class TimeTheoremAutobuyerState extends AutobuyerState {
get data() {
return player.auto.timeTheorems;
}
@ -21,4 +21,4 @@ Autobuyer.timeTheorem = new class TimeTheoremAutobuyerState extends AutobuyerSta
if (this.hasUnlimitedBulk) TimeTheorems.buyMax(true);
else TimeTheorems.buyOneOfEach();
}
}();
}

View File

@ -160,7 +160,7 @@ export const AutomatorCommands = ((() => {
const durationMode = ctx.PrestigeEvent[0].tokenType.$autobuyerDurationMode;
const xHighestMode = ctx.PrestigeEvent[0].tokenType.$autobuyerXHighestMode;
const fixedMode = ctx.PrestigeEvent[0].tokenType.$autobuyerCurrencyMode;
const autobuyer = ctx.PrestigeEvent[0].tokenType.$autobuyer;
const autobuyer = ctx.PrestigeEvent[0].tokenType.$autobuyer();
return () => {
autobuyer.isActive = on;
let currSetting = "";

View File

@ -202,7 +202,7 @@ export const AutomatorLexer = (() => {
// eternity will be triggered by something waiting for reality, for example.
createInCategory(PrestigeEvent, "Infinity", /infinity/i, {
extraCategories: [StudyPath],
$autobuyer: Autobuyer.bigCrunch,
$autobuyer: () => Autobuyer.bigCrunch,
$autobuyerDurationMode: AUTO_CRUNCH_MODE.TIME,
$autobuyerXHighestMode: AUTO_CRUNCH_MODE.X_HIGHEST,
$autobuyerCurrencyMode: AUTO_CRUNCH_MODE.AMOUNT,
@ -213,7 +213,7 @@ export const AutomatorLexer = (() => {
$studyPath: TIME_STUDY_PATH.INFINITY_DIM,
});
createInCategory(PrestigeEvent, "Eternity", /eternity/i, {
$autobuyer: Autobuyer.eternity,
$autobuyer: () => Autobuyer.eternity,
$autobuyerDurationMode: AUTO_ETERNITY_MODE.TIME,
$autobuyerXHighestMode: AUTO_ETERNITY_MODE.X_HIGHEST,
$autobuyerCurrencyMode: AUTO_ETERNITY_MODE.AMOUNT,
@ -226,7 +226,7 @@ export const AutomatorLexer = (() => {
},
});
createInCategory(PrestigeEvent, "Reality", /reality/i, {
$autobuyer: Autobuyer.reality,
$autobuyer: () => Autobuyer.reality,
$autobuyerCurrencyMode: AUTO_REALITY_MODE.RM,
$prestigeAvailable: () => isRealityAvailable(),
$prestigeLevel: 3,

View File

@ -12,7 +12,7 @@ export * from "./galaxy";
export * from "./away-progress";
export * from "./confirmations";
export * from "./autobuyers";
export * from "./autobuyers/autobuyers";
export * from "./storage";
export * from "./notations";