mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2025-02-16 23:50:17 +00:00
rename to DarkMatterDimension, index: 0, standardize to DimensionState
This commit is contained in:
parent
887bcce2d2
commit
bf6153b198
@ -1,59 +1,13 @@
|
||||
import "../matter-dimension-row.js";
|
||||
|
||||
Vue.component("dark-matter-dimension-group", {
|
||||
data() {
|
||||
return {
|
||||
activeDimensions: [],
|
||||
nextDimensionThreshold: 0,
|
||||
unlockedAnnihilation: false,
|
||||
minAnnihilationDM: 0,
|
||||
hasAnnihilationDM: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
dimensions: () => MatterDimensionState.list,
|
||||
},
|
||||
methods: {
|
||||
update() {
|
||||
this.activeDimensions = Array.range(0, 4).filter(i => MatterDimension(i + 1).amount.neq(0));
|
||||
this.nextDimensionThreshold = Array.range(0, 4)
|
||||
.filter(i => MatterDimension(i + 1).amount.eq(0))
|
||||
.map(i => MatterDimension(i + 1).adjustedStartingCost)
|
||||
.min();
|
||||
this.unlockedAnnihilation = ImaginaryUpgrade(19).isBought;
|
||||
this.minAnnihilationDM = Laitela.annihilationDMRequirement;
|
||||
this.hasAnnihilationDM = Currency.darkMatter.gte(this.minAnnihilationDM);
|
||||
},
|
||||
},
|
||||
template: `
|
||||
<span>
|
||||
<matter-dimension-row
|
||||
v-for="i in activeDimensions"
|
||||
:key="i"
|
||||
:dimension="dimensions[i]"
|
||||
v-for="tier in 4"
|
||||
:key="tier"
|
||||
:tier="tier"
|
||||
/>
|
||||
<div v-if="nextDimensionThreshold === 0 && !unlockedAnnihilation">
|
||||
<b>
|
||||
Unlock Dark Matter Annihilation from an Imaginary Upgrade.
|
||||
<br>
|
||||
(Also requires {{ format(minAnnihilationDM, 2) }} Dark Matter)
|
||||
</b>
|
||||
<br><br>
|
||||
</div>
|
||||
<div v-else-if="nextDimensionThreshold === 0 && !hasAnnihilationDM">
|
||||
<b>
|
||||
Annihilation requires {{ format(minAnnihilationDM, 2) }} Dark Matter.
|
||||
</b>
|
||||
<br><br>
|
||||
</div>
|
||||
<div v-else-if="nextDimensionThreshold !== 0">
|
||||
<b>
|
||||
Unlock the next Dark Matter Dimension from an Imaginary Upgrade.
|
||||
<br>
|
||||
(Starting cost: {{ format(nextDimensionThreshold, 2) }} Dark Matter)
|
||||
</b>
|
||||
<br><br>
|
||||
</div>
|
||||
</span>`
|
||||
});
|
||||
|
||||
@ -65,7 +19,7 @@ Vue.component("annihilation-button", {
|
||||
darkMatterMult: 0,
|
||||
darkMatterMultGain: 0,
|
||||
hasAnnihilated: false,
|
||||
showAnnihilation: false,
|
||||
annihilationButtonVisible: false,
|
||||
matterRequirement: 0,
|
||||
darkMatterMultRatio: 0,
|
||||
autoAnnihilationInput: player.celestials.laitela.autoAnnihilationSetting,
|
||||
@ -87,8 +41,7 @@ Vue.component("annihilation-button", {
|
||||
this.darkMatterMult = Laitela.darkMatterMult;
|
||||
this.darkMatterMultGain = Laitela.darkMatterMultGain;
|
||||
this.hasAnnihilated = Laitela.darkMatterMult > 1;
|
||||
this.showAnnihilation = Laitela.canAnnihilate &&
|
||||
(this.hasAnnihilated || !MatterDimensionState.list.some(d => d.amount.eq(0)));
|
||||
this.annihilationButtonVisible = Laitela.canAnnihilate || this.hasAnnihilated;
|
||||
this.matterRequirement = Laitela.annihilationDMRequirement;
|
||||
this.darkMatterMultRatio = Laitela.darkMatterMultRatio;
|
||||
this.isEnabled = player.celestials.laitela.automation.annihilation;
|
||||
@ -108,9 +61,9 @@ Vue.component("annihilation-button", {
|
||||
},
|
||||
template: `
|
||||
<button
|
||||
class="c-laitela-annihilation-button"
|
||||
class="l-laitela-annihilation-button c-laitela-annihilation-button"
|
||||
@click="annihilate()"
|
||||
v-if="showAnnihilation"
|
||||
v-if="annihilationButtonVisible"
|
||||
>
|
||||
<h2>Annihilation</h2>
|
||||
<span v-if="hasAnnihilated">
|
||||
@ -149,5 +102,12 @@ Vue.component("annihilation-button", {
|
||||
/>
|
||||
to the multiplier.
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-else
|
||||
class="l-laitela-annihilation-button"
|
||||
>
|
||||
Annihilation requires {{ format(matterRequirement, 2) }} Dark Matter.
|
||||
</button>`
|
||||
});
|
||||
|
@ -18,6 +18,7 @@ Vue.component("laitela-tab", {
|
||||
singularitiesUnlocked: false,
|
||||
singularityCap: 0,
|
||||
singularityWaitTime: 0,
|
||||
showAnnihilation: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -42,7 +43,8 @@ Vue.component("laitela-tab", {
|
||||
this.singularitiesUnlocked = Singularity.capIsReached || this.singularityPanelVisible;
|
||||
this.singularityCap = Singularity.cap;
|
||||
this.singularityWaitTime = TimeSpan.fromSeconds((this.singularityCap - this.darkEnergy) /
|
||||
Laitela.darkEnergyPerSecond).toStringShort();
|
||||
Currency.darkEnergy.productionPerSecond).toStringShort();
|
||||
this.showAnnihilation = Laitela.annihilationUnlocked;
|
||||
},
|
||||
maxAll() {
|
||||
Laitela.maxAllDMDimensions(4);
|
||||
@ -88,7 +90,7 @@ Vue.component("laitela-tab", {
|
||||
<laitela-run-button />
|
||||
<div>
|
||||
<dark-matter-dimension-group />
|
||||
<annihilation-button />
|
||||
<annihilation-button v-if="showAnnihilation" />
|
||||
</div>
|
||||
<singularity-milestone-pane v-if="singularityPanelVisible" />
|
||||
</div>
|
||||
|
@ -1,11 +1,13 @@
|
||||
Vue.component("matter-dimension-row", {
|
||||
props: {
|
||||
dimension: Object
|
||||
tier: Number
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tier: 0,
|
||||
isUnlocked: false,
|
||||
ascension: 0,
|
||||
hasAscended: false,
|
||||
powerDMPerAscension: 0,
|
||||
interval: 0,
|
||||
powerDM: new Decimal(0),
|
||||
powerDE: 0,
|
||||
@ -20,27 +22,15 @@ Vue.component("matter-dimension-row", {
|
||||
timer: 0,
|
||||
timerPecent: 0,
|
||||
intervalAscensionBump: 10000,
|
||||
darkEnergyPerSecond: 0,
|
||||
portionDE: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
name() {
|
||||
const suffix = " Dark Matter Dimension";
|
||||
switch (this.tier) {
|
||||
case 0:
|
||||
return `First ${suffix}`;
|
||||
case 1:
|
||||
return `Second ${suffix}`;
|
||||
case 2:
|
||||
return `Third ${suffix}`;
|
||||
case 3:
|
||||
return `Fourth ${suffix}`;
|
||||
default:
|
||||
throw new Error("Invalid Dark Matter Dimension index");
|
||||
}
|
||||
return `${DarkMatterDimension(this.tier).displayName} Dark Matter Dimension`;
|
||||
},
|
||||
ascensionText() {
|
||||
if (this.ascension === 0) return "";
|
||||
return `(⯅${formatInt(this.ascension)})`;
|
||||
},
|
||||
intervalClassObject() {
|
||||
@ -55,33 +45,43 @@ Vue.component("matter-dimension-row", {
|
||||
},
|
||||
ascensionTooltip() {
|
||||
return `Multiply interval by ${formatInt(this.intervalAscensionBump)}, DM by
|
||||
${formatInt(this.dimension.powerDMPerAscension)}, and DE by ${formatInt(POWER_DE_PER_ASCENSION)}.
|
||||
${formatInt(this.powerDMPerAscension)}, and DE by ${formatInt(POWER_DE_PER_ASCENSION)}.
|
||||
After ascension you can upgrade interval even further.`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
update() {
|
||||
this.tier = this.dimension._tier;
|
||||
this.ascension = this.dimension.ascensions;
|
||||
this.interval = this.dimension.interval;
|
||||
this.powerDM.copyFrom(this.dimension.powerDM);
|
||||
this.powerDE = this.dimension.powerDE;
|
||||
this.intervalCost = this.dimension.intervalCost;
|
||||
this.powerDMCost = this.dimension.powerDMCost;
|
||||
this.powerDECost = this.dimension.powerDECost;
|
||||
this.amount.copyFrom(this.dimension.amount);
|
||||
this.canBuyInterval = this.dimension.canBuyInterval;
|
||||
this.canBuyPowerDM = this.dimension.canBuyPowerDM;
|
||||
this.canBuyPowerDE = this.dimension.canBuyPowerDE;
|
||||
this.isIntervalCapped = this.dimension.interval <= this.dimension.intervalPurchaseCap;
|
||||
this.timer = this.dimension.timeSinceLastUpdate;
|
||||
const dim = DarkMatterDimension(this.tier);
|
||||
this.isUnlocked = dim.isUnlocked;
|
||||
this.ascension = dim.ascensions;
|
||||
this.hasAscended = this.ascension > 0;
|
||||
this.powerDMPerAscension = dim.powerDMPerAscension;
|
||||
this.interval = dim.interval;
|
||||
this.powerDM.copyFrom(dim.powerDM);
|
||||
this.powerDE = dim.powerDE;
|
||||
this.intervalCost = dim.intervalCost;
|
||||
this.powerDMCost = dim.powerDMCost;
|
||||
this.powerDECost = dim.powerDECost;
|
||||
this.amount.copyFrom(dim.amount);
|
||||
this.canBuyInterval = dim.canBuyInterval;
|
||||
this.canBuyPowerDM = dim.canBuyPowerDM;
|
||||
this.canBuyPowerDE = dim.canBuyPowerDE;
|
||||
this.isIntervalCapped = dim.interval <= dim.intervalPurchaseCap;
|
||||
this.timer = dim.timeSinceLastUpdate;
|
||||
this.timerPercent = this.timer / this.interval;
|
||||
this.intervalAscensionBump = SingularityMilestone.ascensionIntervalScaling.effectValue;
|
||||
this.portionDE = (this.powerDE * 1000 / this.interval) / Laitela.darkEnergyPerSecond;
|
||||
this.darkEnergyPerSecond = dim.productionPerSecond;
|
||||
this.portionDE = this.darkEnergyPerSecond / Currency.darkEnergy.productionPerSecond;
|
||||
},
|
||||
handleIntervalClick() {
|
||||
if (this.isIntervalCapped) this.dimension.ascend();
|
||||
else this.dimension.buyInterval();
|
||||
if (this.isIntervalCapped) DarkMatterDimension(this.tier).ascend();
|
||||
else DarkMatterDimension(this.tier).buyInterval();
|
||||
},
|
||||
buyPowerDM() {
|
||||
DarkMatterDimension(this.tier).buyPowerDM();
|
||||
},
|
||||
buyPowerDE() {
|
||||
DarkMatterDimension(this.tier).buyPowerDE();
|
||||
},
|
||||
// All the values are internally Decimals and technically allowed to go above Infinity. This is a special case
|
||||
// however; it looks better in-game if we just format it as Infinity instead, as the resource used for these costs
|
||||
@ -91,13 +91,13 @@ Vue.component("matter-dimension-row", {
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class="c-matter-dimension-container">
|
||||
<div class="c-matter-dimension-container" v-if="isUnlocked">
|
||||
<div class="o-matter-dimension-amount">
|
||||
{{ name }} {{ ascensionText }}: {{ format(amount, 2) }}
|
||||
{{ name }}<span v-if="hasAscended"> {{ ascensionText }}</span>: {{ format(amount, 2) }}
|
||||
</div>
|
||||
<div class="c-matter-dimension-buttons">
|
||||
<button
|
||||
@click="handleIntervalClick()"
|
||||
@click="handleIntervalClick"
|
||||
class="o-matter-dimension-button"
|
||||
:class="intervalClassObject"
|
||||
>
|
||||
@ -114,14 +114,14 @@ Vue.component("matter-dimension-row", {
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
@click="dimension.buyPowerDM()"
|
||||
@click="buyPowerDM"
|
||||
class="o-matter-dimension-button"
|
||||
:class="{ 'o-matter-dimension-button--available': canBuyPowerDM }"
|
||||
>
|
||||
DM {{ formatX(powerDM, 2, 2) }}<br>Cost: {{ formatDMCost(powerDMCost) }}
|
||||
</button>
|
||||
<button
|
||||
@click="dimension.buyPowerDE()"
|
||||
@click="buyPowerDE"
|
||||
class="o-matter-dimension-button"
|
||||
:class="{ 'o-matter-dimension-button--available': canBuyPowerDE }"
|
||||
>
|
||||
@ -137,7 +137,7 @@ Vue.component("matter-dimension-row", {
|
||||
{{ format(1000 / interval, 2, 2) }} ticks / sec
|
||||
</div>
|
||||
<div>
|
||||
Dark Energy: {{ format(powerDE * 1000 / interval, 2, 4) }}/s ({{ formatPercents(portionDE, 1) }} of total)
|
||||
Dark Energy: {{ format(darkEnergyPerSecond, 2, 4) }}/s ({{ formatPercents(portionDE, 1) }} of total)
|
||||
</div>
|
||||
</div>`
|
||||
});
|
||||
|
@ -1,18 +1,12 @@
|
||||
import { CelestialQuotes } from "../quotes.js";
|
||||
import { DC } from "../../constants.js";
|
||||
import { DarkMatterDimension, DarkMatterDimensions } from "./matter_dimension.js";
|
||||
|
||||
export const Laitela = {
|
||||
displayName: "Lai'tela",
|
||||
get celestial() {
|
||||
return player.celestials.laitela;
|
||||
},
|
||||
get darkEnergyPerSecond() {
|
||||
return Array.range(1, 4)
|
||||
.map(n => MatterDimension(n))
|
||||
.filter(d => d.amount.gt(0))
|
||||
.map(d => d.powerDE * 1000 / d.interval)
|
||||
.sum();
|
||||
},
|
||||
get isUnlocked() {
|
||||
return ImaginaryUpgrade(15).isBought;
|
||||
},
|
||||
@ -70,61 +64,28 @@ export const Laitela = {
|
||||
get darkMatterMultRatio() {
|
||||
return (this.celestial.darkMatterMult + this.darkMatterMultGain) / this.celestial.darkMatterMult;
|
||||
},
|
||||
get canAnnihilate() {
|
||||
return ImaginaryUpgrade(19).isBought && Currency.darkMatter.gte(this.annihilationDMRequirement);
|
||||
get annihilationUnlocked() {
|
||||
return ImaginaryUpgrade(19).isBought;
|
||||
},
|
||||
get annihilationDMRequirement() {
|
||||
return 1e60;
|
||||
},
|
||||
get canAnnihilate() {
|
||||
return Laitela.annihilationUnlocked && Currency.darkMatter.gte(this.annihilationDMRequirement);
|
||||
},
|
||||
annihilate(force) {
|
||||
if (!force && !this.canAnnihilate) return false;
|
||||
this.celestial.darkMatterMult += this.darkMatterMultGain;
|
||||
this.celestial.dimensions = this.celestial.dimensions.map(
|
||||
() => (
|
||||
{
|
||||
amount: DC.D1,
|
||||
intervalUpgrades: 0,
|
||||
powerDMUpgrades: 0,
|
||||
powerDEUpgrades: 0,
|
||||
timeSinceLastUpdate: 0,
|
||||
ascensionCount: 0
|
||||
}
|
||||
)
|
||||
);
|
||||
Currency.darkMatter.reset();
|
||||
DarkMatterDimensions.reset();
|
||||
Currency.darkEnergy.reset();
|
||||
Laitela.quotes.show(Laitela.quotes.ANNIHILATION);
|
||||
return true;
|
||||
},
|
||||
tickDarkMatter(realDiff) {
|
||||
if (!this.isUnlocked) return;
|
||||
for (let i = 1; i <= 4; i++) {
|
||||
const d = MatterDimension(i);
|
||||
d.timeSinceLastUpdate += realDiff;
|
||||
if (d.interval < d.timeSinceLastUpdate) {
|
||||
const ticks = Math.floor(d.timeSinceLastUpdate / d.interval);
|
||||
const productionDM = d.amount.times(ticks).times(d.powerDM);
|
||||
if (i === 1) {
|
||||
Currency.darkMatter.add(productionDM);
|
||||
} else {
|
||||
MatterDimension(i - 1).amount = MatterDimension(i - 1).amount.plus(productionDM);
|
||||
}
|
||||
if (MatterDimension(i).amount.gt(0)) {
|
||||
Currency.darkEnergy.value =
|
||||
Math.clampMax(Currency.darkEnergy.value + ticks * d.powerDE, Number.MAX_VALUE);
|
||||
}
|
||||
d.timeSinceLastUpdate -= d.interval * ticks;
|
||||
}
|
||||
}
|
||||
if (SingularityMilestone.dim4Generation.isUnlocked && Laitela.canAnnihilate) {
|
||||
MatterDimension(4).amount = MatterDimension(4).amount
|
||||
.plus(SingularityMilestone.dim4Generation.effectValue * realDiff / 1000);
|
||||
}
|
||||
},
|
||||
// Greedily buys the cheapest available upgrade until none are affordable
|
||||
maxAllDMDimensions(maxTier) {
|
||||
// Note that _tier is 0-indexed, so calling with maxTier = 3 will buy up to and including DM3 for example
|
||||
const unlockedDimensions = MatterDimensionState.list
|
||||
.filter(d => d.isUnlocked && d.amount.gt(0) && d._tier < maxTier);
|
||||
// Note that tier is 1-indexed
|
||||
const unlockedDimensions = DarkMatterDimensions.all
|
||||
.filter(d => d.isUnlocked && d.tier <= maxTier);
|
||||
const upgradeInfo = unlockedDimensions
|
||||
.map(d => [
|
||||
[d.rawIntervalCost, d.intervalCostIncrease, d.maxIntervalPurchases, x => d.buyManyInterval(x)],
|
||||
@ -159,7 +120,7 @@ export const Laitela = {
|
||||
}
|
||||
if (laitela.automation.ascension) {
|
||||
for (let i = 1; i <= SingularityMilestone.darkDimensionAutobuyers.effectValue; i++) {
|
||||
MatterDimension(i).ascend();
|
||||
DarkMatterDimension(i).ascend();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,9 +139,12 @@ export const Laitela = {
|
||||
reset() {
|
||||
this.annihilate(true);
|
||||
this.celestial.darkMatterMult = 1;
|
||||
Currency.darkMatter.max = 0;
|
||||
Currency.darkMatter.max = DC.D1;
|
||||
Currency.darkMatter.reset();
|
||||
Currency.singularities.reset();
|
||||
this.celestial.fastestCompletion = 3600;
|
||||
this.celestial.difficultyTier = 0;
|
||||
this.celestial.singularityCapIncreases = 0;
|
||||
},
|
||||
quotes: new CelestialQuotes("laitela", {
|
||||
UNLOCK: {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { DimensionState } from "../../dimensions/dimension.js";
|
||||
import { DC } from "../../constants.js";
|
||||
|
||||
/**
|
||||
@ -18,18 +19,17 @@ export const POWER_DE_PER_ASCENSION = 500;
|
||||
|
||||
const COST_MULT_PER_TIER = 1200;
|
||||
|
||||
export class MatterDimensionState {
|
||||
export class DarkMatterDimensionState extends DimensionState {
|
||||
constructor(tier) {
|
||||
this._tier = tier;
|
||||
super(() => player.celestials.laitela.dimensions, tier);
|
||||
}
|
||||
|
||||
get dimension() {
|
||||
return player.celestials.laitela.dimensions[this._tier];
|
||||
}
|
||||
// Does not include DM, only DE per second
|
||||
get productionPerSecond() { return this.powerDE * 1000 / this.interval; }
|
||||
|
||||
get unlockUpgrade() {
|
||||
// 0-indexed, and the unlocks start at ID 16 to unlock 2nd DMD
|
||||
return ImaginaryUpgrade(this._tier + 15);
|
||||
// The 15th Imaginary Upgrade unlocked Laitela and the 1st DMD
|
||||
return ImaginaryUpgrade(this.tier + 14);
|
||||
}
|
||||
|
||||
get isUnlocked() {
|
||||
@ -37,7 +37,7 @@ export class MatterDimensionState {
|
||||
}
|
||||
|
||||
get ascensions() {
|
||||
return this.dimension.ascensionCount;
|
||||
return this.data.ascensionCount;
|
||||
}
|
||||
|
||||
get intervalPurchaseCap() {
|
||||
@ -46,10 +46,10 @@ export class MatterDimensionState {
|
||||
|
||||
get interval() {
|
||||
const perUpgrade = 0.92;
|
||||
const tierFactor = Math.pow(4, this._tier);
|
||||
const tierFactor = Math.pow(4, this.tier - 1);
|
||||
return Math.clampMin(this.intervalPurchaseCap, 1000 * tierFactor *
|
||||
Math.pow(perUpgrade, this.dimension.intervalUpgrades) *
|
||||
Math.pow(SingularityMilestone.ascensionIntervalScaling.effectValue, this.dimension.ascensionCount) *
|
||||
Math.pow(perUpgrade, this.data.intervalUpgrades) *
|
||||
Math.pow(SingularityMilestone.ascensionIntervalScaling.effectValue, this.ascensions) *
|
||||
SingularityMilestone.darkDimensionIntervalReduction.effectValue);
|
||||
}
|
||||
|
||||
@ -69,22 +69,24 @@ export class MatterDimensionState {
|
||||
}
|
||||
|
||||
get powerDM() {
|
||||
return new Decimal(1 + 2 * Math.pow(1.15, this.dimension.powerDMUpgrades))
|
||||
if (!this.isUnlocked) return new Decimal(0);
|
||||
return new Decimal(1 + 2 * Math.pow(1.15, this.data.powerDMUpgrades))
|
||||
.times(Laitela.realityReward)
|
||||
.times(Laitela.darkMatterMult)
|
||||
.times(this.commonDarkMult)
|
||||
.times(Math.pow(this.powerDMPerAscension, this.dimension.ascensionCount))
|
||||
.times(Math.pow(this.powerDMPerAscension, this.ascensions))
|
||||
.timesEffectsOf(SingularityMilestone.darkMatterMult, SingularityMilestone.multFromInfinitied)
|
||||
.dividedBy(Math.pow(1e4, Math.pow(this._tier, 0.5)));
|
||||
.dividedBy(Math.pow(1e4, Math.pow(this.tier - 1, 0.5)));
|
||||
}
|
||||
|
||||
get powerDE() {
|
||||
const tierFactor = Math.pow(15, this._tier);
|
||||
if (!this.isUnlocked) return 0;
|
||||
const tierFactor = Math.pow(15, this.tier - 1);
|
||||
const destabilizeBoost = Laitela.isFullyDestabilized ? 8 : 1;
|
||||
return new Decimal(((1 + this.dimension.powerDEUpgrades * 0.1) *
|
||||
Math.pow(1.005, this.dimension.powerDEUpgrades)) * tierFactor / 1000)
|
||||
return new Decimal(((1 + this.data.powerDEUpgrades * 0.1) *
|
||||
Math.pow(1.005, this.data.powerDEUpgrades)) * tierFactor / 1000)
|
||||
.times(this.commonDarkMult)
|
||||
.times(Math.pow(POWER_DE_PER_ASCENSION, this.dimension.ascensionCount))
|
||||
.times(Math.pow(POWER_DE_PER_ASCENSION, this.ascensions))
|
||||
.timesEffectsOf(
|
||||
SingularityMilestone.darkEnergyMult,
|
||||
SingularityMilestone.realityDEMultiplier,
|
||||
@ -93,13 +95,13 @@ export class MatterDimensionState {
|
||||
}
|
||||
|
||||
get adjustedStartingCost() {
|
||||
const tiers = [0, 2, 5, 13];
|
||||
return 10 * Math.pow(COST_MULT_PER_TIER, tiers[this._tier]) *
|
||||
const tiers = [null, 0, 2, 5, 13];
|
||||
return 10 * Math.pow(COST_MULT_PER_TIER, tiers[this.tier]) *
|
||||
SingularityMilestone.darkDimensionCostReduction.effectValue;
|
||||
}
|
||||
|
||||
get rawIntervalCost() {
|
||||
return Decimal.pow(this.intervalCostIncrease, this.dimension.intervalUpgrades)
|
||||
return Decimal.pow(this.intervalCostIncrease, this.data.intervalUpgrades)
|
||||
.times(this.adjustedStartingCost).times(INTERVAL_START_COST);
|
||||
}
|
||||
|
||||
@ -112,7 +114,7 @@ export class MatterDimensionState {
|
||||
}
|
||||
|
||||
get rawPowerDMCost() {
|
||||
return Decimal.pow(this.powerDMCostIncrease, this.dimension.powerDMUpgrades)
|
||||
return Decimal.pow(this.powerDMCostIncrease, this.data.powerDMUpgrades)
|
||||
.times(this.adjustedStartingCost).times(POWER_DM_START_COST);
|
||||
}
|
||||
|
||||
@ -125,7 +127,7 @@ export class MatterDimensionState {
|
||||
}
|
||||
|
||||
get rawPowerDECost() {
|
||||
return Decimal.pow(this.powerDECostIncrease, this.dimension.powerDEUpgrades)
|
||||
return Decimal.pow(this.powerDECostIncrease, this.data.powerDEUpgrades)
|
||||
.times(this.adjustedStartingCost).times(POWER_DE_START_COST);
|
||||
}
|
||||
|
||||
@ -134,23 +136,15 @@ export class MatterDimensionState {
|
||||
}
|
||||
|
||||
get powerDECostIncrease() {
|
||||
return POWER_DE_COST_MULTS[this._tier];
|
||||
}
|
||||
|
||||
get amount() {
|
||||
return this.dimension.amount;
|
||||
}
|
||||
|
||||
set amount(value) {
|
||||
this.dimension.amount = value;
|
||||
return POWER_DE_COST_MULTS[this.tier - 1];
|
||||
}
|
||||
|
||||
get timeSinceLastUpdate() {
|
||||
return this.dimension.timeSinceLastUpdate;
|
||||
return this.data.timeSinceLastUpdate;
|
||||
}
|
||||
|
||||
set timeSinceLastUpdate(ms) {
|
||||
this.dimension.timeSinceLastUpdate = ms;
|
||||
this.data.timeSinceLastUpdate = ms;
|
||||
}
|
||||
|
||||
get canBuyInterval() {
|
||||
@ -174,7 +168,7 @@ export class MatterDimensionState {
|
||||
const cost = this.rawIntervalCost.times(
|
||||
Decimal.pow(this.intervalCostIncrease, x).minus(1)).div(this.intervalCostIncrease - 1).floor();
|
||||
if (!Currency.darkMatter.purchase(cost)) return false;
|
||||
this.dimension.intervalUpgrades += x;
|
||||
this.data.intervalUpgrades += x;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -182,7 +176,7 @@ export class MatterDimensionState {
|
||||
const cost = this.rawPowerDMCost.times(
|
||||
Decimal.pow(this.powerDMCostIncrease, x).minus(1)).div(this.powerDMCostIncrease - 1).floor();
|
||||
if (!Currency.darkMatter.purchase(cost)) return false;
|
||||
this.dimension.powerDMUpgrades += x;
|
||||
this.data.powerDMUpgrades += x;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -190,7 +184,7 @@ export class MatterDimensionState {
|
||||
const cost = this.rawPowerDECost.times(
|
||||
Decimal.pow(this.powerDECostIncrease, x).minus(1)).div(this.powerDECostIncrease - 1).floor();
|
||||
if (!Currency.darkMatter.purchase(cost)) return false;
|
||||
this.dimension.powerDEUpgrades += x;
|
||||
this.data.powerDEUpgrades += x;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -208,16 +202,61 @@ export class MatterDimensionState {
|
||||
|
||||
ascend() {
|
||||
if (this.interval > this.intervalPurchaseCap) return;
|
||||
this.dimension.ascensionCount++;
|
||||
this.data.ascensionCount++;
|
||||
}
|
||||
|
||||
static get dimensionCount() { return 4; }
|
||||
|
||||
reset() {
|
||||
this.data.amount = DC.D1;
|
||||
this.data.intervalUpgrades = 0;
|
||||
this.data.powerDMUpgrades = 0;
|
||||
this.data.powerDEUpgrades = 0;
|
||||
this.data.timeSinceLastUpdate = 0;
|
||||
this.data.ascensionCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
MatterDimensionState.list = Array.range(1, 4).map(tier => new MatterDimensionState(tier - 1));
|
||||
|
||||
/**
|
||||
* @function
|
||||
* @param {number} tier
|
||||
* @return {MatterDimensionState}
|
||||
* @return {DarkMatterDimensionState}
|
||||
*/
|
||||
export function MatterDimension(tier) {
|
||||
return MatterDimensionState.list[tier - 1];
|
||||
}
|
||||
export const DarkMatterDimension = DarkMatterDimensionState.createAccessor();
|
||||
|
||||
export const DarkMatterDimensions = {
|
||||
/**
|
||||
* @type {DarkMatterDimension[]}
|
||||
*/
|
||||
all: DarkMatterDimension.index.compact(),
|
||||
|
||||
tick(realDiff) {
|
||||
if (!Laitela.isUnlocked) return;
|
||||
for (let tier = 4; tier >= 1; tier--) {
|
||||
const dim = DarkMatterDimension(tier);
|
||||
if (!dim.isUnlocked) continue;
|
||||
dim.timeSinceLastUpdate += realDiff;
|
||||
if (dim.interval < dim.timeSinceLastUpdate) {
|
||||
const ticks = Math.floor(dim.timeSinceLastUpdate / dim.interval);
|
||||
const productionDM = dim.amount.times(ticks).times(dim.powerDM);
|
||||
if (tier === 1) {
|
||||
Currency.darkMatter.add(productionDM);
|
||||
} else {
|
||||
DarkMatterDimension(tier - 1).amount = DarkMatterDimension(tier - 1).amount.plus(productionDM);
|
||||
}
|
||||
Currency.darkEnergy.add(ticks * dim.powerDE);
|
||||
dim.timeSinceLastUpdate -= dim.interval * ticks;
|
||||
}
|
||||
}
|
||||
if (SingularityMilestone.dim4Generation.isUnlocked && Laitela.annihilationUnlocked) {
|
||||
DarkMatterDimension(4).amount = DarkMatterDimension(4).amount
|
||||
.plus(SingularityMilestone.dim4Generation.effectValue * realDiff / 1000);
|
||||
}
|
||||
},
|
||||
|
||||
reset() {
|
||||
for (const dimension of DarkMatterDimensions.all) {
|
||||
dimension.reset();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -409,10 +409,8 @@ Currency.darkEnergy = new class extends NumberCurrency {
|
||||
set value(value) { player.celestials.laitela.darkEnergy = value; }
|
||||
|
||||
get productionPerSecond() {
|
||||
return Array.range(1, 4)
|
||||
.map(n => MatterDimension(n))
|
||||
.filter(d => d.amount.gt(0))
|
||||
.map(d => d.powerDE * 1000 / d.interval)
|
||||
return DarkMatterDimensions.all
|
||||
.map(d => d.productionPerSecond)
|
||||
.sum();
|
||||
}
|
||||
}();
|
||||
|
@ -44,8 +44,10 @@ export class DimensionState {
|
||||
dimension.amount = dimension.amount.plus(this.productionForDiff(diff));
|
||||
}
|
||||
|
||||
static get dimensionCount() { return 8; }
|
||||
|
||||
static createAccessor() {
|
||||
const index = Array.range(1, 8).map(tier => new this(tier));
|
||||
const index = Array.range(1, this.dimensionCount).map(tier => new this(tier));
|
||||
index.unshift(null);
|
||||
const accessor = tier => index[tier];
|
||||
accessor.index = index;
|
||||
|
@ -42,7 +42,7 @@ class ImaginaryUpgradeState extends BitPurchasableMechanicState {
|
||||
onPurchased() {
|
||||
EventHub.dispatch(GAME_EVENT.REALITY_UPGRADE_BOUGHT);
|
||||
if (this.id >= 15 && this.id <= 18) {
|
||||
MatterDimension(this.id - 14).amount = DC.D1;
|
||||
DarkMatterDimension(this.id - 14).amount = DC.D1;
|
||||
Tab.celestials.laitela.show();
|
||||
}
|
||||
if (this.id === 19) {
|
||||
|
@ -1286,7 +1286,7 @@ GameDatabase.celestials.navigation = (function() {
|
||||
},
|
||||
"laitela-unlock": {
|
||||
visible: () => Ra.has(RA_UNLOCKS.V_UNLOCK),
|
||||
complete: () => (MatterDimension(1).unlockUpgrade.canBeBought || Laitela.isUnlocked
|
||||
complete: () => (DarkMatterDimension(1).unlockUpgrade.canBeBought || Laitela.isUnlocked
|
||||
? 1
|
||||
: Math.clampMax(0.999, player.antimatter.exponent / 1.5e12)),
|
||||
drawOrder: -1,
|
||||
@ -1337,7 +1337,7 @@ GameDatabase.celestials.navigation = (function() {
|
||||
"laitela-2nd-dim": {
|
||||
visible: () => Laitela.isUnlocked,
|
||||
complete: () => {
|
||||
const upgrade = MatterDimension(2).unlockUpgrade;
|
||||
const upgrade = DarkMatterDimension(2).unlockUpgrade;
|
||||
if (upgrade.canBeBought || upgrade.isBought) return 1;
|
||||
if (upgrade.isAvailableForPurchase) return upgrade.currency.value / upgrade.cost;
|
||||
return Laitela.difficultyTier < 1
|
||||
@ -1355,16 +1355,16 @@ GameDatabase.celestials.navigation = (function() {
|
||||
legend: {
|
||||
text: complete => {
|
||||
const dmdText = "2nd Dark Matter Dimension";
|
||||
const dim = MatterDimension(2);
|
||||
if (dim.amount.gte(1)) return [dmdText];
|
||||
const dim = DarkMatterDimension(2);
|
||||
if (dim.isUnlocked) return [dmdText];
|
||||
|
||||
const goal = dim.adjustedStartingCost;
|
||||
if (complete >= 1) return [
|
||||
dmdText,
|
||||
`Dark Matter ${format(Currency.darkMatter.max.min(goal), dim.amount.gte(1) ? 0 : 2)} / ${format(goal)}`
|
||||
`Dark Matter ${format(Currency.darkMatter.max.min(goal), dim.isUnlocked ? 0 : 2)} / ${format(goal)}`
|
||||
];
|
||||
|
||||
const upgrade = MatterDimension(2).unlockUpgrade;
|
||||
const upgrade = dim.unlockUpgrade;
|
||||
if (upgrade.isAvailableForPurchase) return [
|
||||
dmdText,
|
||||
`Imaginary Machines
|
||||
@ -1427,9 +1427,9 @@ GameDatabase.celestials.navigation = (function() {
|
||||
}
|
||||
},
|
||||
"laitela-3rd-dim-left": {
|
||||
visible: () => MatterDimension(2).isUnlocked && Currency.singularities.gte(1),
|
||||
visible: () => DarkMatterDimension(2).isUnlocked && Currency.singularities.gte(1),
|
||||
complete: () => {
|
||||
const upgrade = MatterDimension(3).unlockUpgrade;
|
||||
const upgrade = DarkMatterDimension(3).unlockUpgrade;
|
||||
if (upgrade.canBeBought || upgrade.isBought) return 1;
|
||||
if (upgrade.isAvailableForPurchase) return upgrade.currency.value / upgrade.cost;
|
||||
return Math.clampMax(0.999, Singularity.singularitiesGained / 20);
|
||||
@ -1445,16 +1445,16 @@ GameDatabase.celestials.navigation = (function() {
|
||||
legend: {
|
||||
text: complete => {
|
||||
const dmdText = "3rd Dark Matter Dimension";
|
||||
const dim = MatterDimension(3);
|
||||
if (dim.amount.gte(1)) return [dmdText];
|
||||
const dim = DarkMatterDimension(3);
|
||||
if (dim.isUnlocked) return [dmdText];
|
||||
|
||||
const goal = dim.adjustedStartingCost;
|
||||
if (complete >= 1) return [
|
||||
dmdText,
|
||||
`Dark Matter ${format(Currency.darkMatter.max.min(goal), dim.amount.gte(1) ? 0 : 2)} / ${format(goal)}`
|
||||
`Dark Matter ${format(Currency.darkMatter.max.min(goal), dim.isUnlocked ? 0 : 2)} / ${format(goal)}`
|
||||
];
|
||||
|
||||
const upgrade = MatterDimension(3).unlockUpgrade;
|
||||
const upgrade = dim.unlockUpgrade;
|
||||
if (upgrade.isAvailableForPurchase) return [
|
||||
dmdText,
|
||||
`Imaginary Machines
|
||||
@ -1482,9 +1482,9 @@ GameDatabase.celestials.navigation = (function() {
|
||||
}
|
||||
},
|
||||
"laitela-3rd-dim-right": {
|
||||
visible: () => MatterDimension(2).isUnlocked && Currency.singularities.gte(1),
|
||||
visible: () => DarkMatterDimension(2).isUnlocked && Currency.singularities.gte(1),
|
||||
complete: () => {
|
||||
const upgrade = MatterDimension(3).unlockUpgrade;
|
||||
const upgrade = DarkMatterDimension(3).unlockUpgrade;
|
||||
if (upgrade.canBeBought || upgrade.isBought) return 1;
|
||||
if (upgrade.isAvailableForPurchase) return upgrade.currency.value / upgrade.cost;
|
||||
return Math.clampMax(0.999, Singularity.singularitiesGained / 20);
|
||||
@ -1508,9 +1508,9 @@ GameDatabase.celestials.navigation = (function() {
|
||||
}
|
||||
},
|
||||
"laitela-4th-dim": {
|
||||
visible: () => MatterDimension(3).isUnlocked,
|
||||
visible: () => DarkMatterDimension(3).isUnlocked,
|
||||
complete: () => {
|
||||
const upgrade = MatterDimension(4).unlockUpgrade;
|
||||
const upgrade = DarkMatterDimension(4).unlockUpgrade;
|
||||
if (upgrade.canBeBought || upgrade.isBought) return 1;
|
||||
if (upgrade.isAvailableForPurchase) return upgrade.currency.value / upgrade.cost;
|
||||
return (Replicanti.galaxies.total + player.galaxies + player.dilation.totalTachyonGalaxies) / 80000;
|
||||
@ -1526,16 +1526,16 @@ GameDatabase.celestials.navigation = (function() {
|
||||
legend: {
|
||||
text: complete => {
|
||||
const dmdText = "4th Dark Matter Dimension";
|
||||
const dim = MatterDimension(4);
|
||||
if (dim.amount.gte(1)) return [dmdText];
|
||||
const dim = DarkMatterDimension(4);
|
||||
if (dim.isUnlocked) return [dmdText];
|
||||
|
||||
const goal = dim.adjustedStartingCost;
|
||||
if (complete >= 1) return [
|
||||
dmdText,
|
||||
`Dark Matter ${format(Currency.darkMatter.max.min(goal), dim.amount.gte(1) ? 0 : 2)} / ${format(goal)}`
|
||||
`Dark Matter ${format(Currency.darkMatter.max.min(goal), dim.isUnlocked ? 0 : 2)} / ${format(goal)}`
|
||||
];
|
||||
|
||||
const upgrade = MatterDimension(4).unlockUpgrade;
|
||||
const upgrade = dim.unlockUpgrade;
|
||||
if (upgrade.isAvailableForPurchase) return [
|
||||
dmdText,
|
||||
`Imaginary Machines
|
||||
@ -1564,7 +1564,7 @@ GameDatabase.celestials.navigation = (function() {
|
||||
},
|
||||
},
|
||||
"laitela-annihilation": {
|
||||
visible: () => MatterDimension(4).isUnlocked,
|
||||
visible: () => DarkMatterDimension(4).isUnlocked,
|
||||
complete: () => {
|
||||
const upgrade = ImaginaryUpgrade(19);
|
||||
if (upgrade.canBeBought || upgrade.isBought) return 1;
|
||||
@ -1601,7 +1601,7 @@ GameDatabase.celestials.navigation = (function() {
|
||||
},
|
||||
},
|
||||
"laitela-destabilization-left": {
|
||||
visible: () => MatterDimension(4).isUnlocked && ImaginaryUpgrade(19).isBought,
|
||||
visible: () => DarkMatterDimension(4).isUnlocked && ImaginaryUpgrade(19).isBought,
|
||||
complete: () => Laitela.difficultyTier / 8,
|
||||
node: {
|
||||
incompleteClass: "c-celestial-nav__test-incomplete",
|
||||
@ -1642,7 +1642,7 @@ GameDatabase.celestials.navigation = (function() {
|
||||
}
|
||||
},
|
||||
"laitela-destabilization-right": {
|
||||
visible: () => MatterDimension(4).isUnlocked && ImaginaryUpgrade(19).isBought,
|
||||
visible: () => DarkMatterDimension(4).isUnlocked && ImaginaryUpgrade(19).isBought,
|
||||
complete: () => Laitela.difficultyTier / 8,
|
||||
node: {
|
||||
fill: "white",
|
||||
|
@ -214,7 +214,7 @@ GameDatabase.celestials.singularityMilestones = {
|
||||
repeat: 0,
|
||||
limit: 1,
|
||||
description: "4th Dark Matter Dimension amount boosts Dark Matter and Dark Energy gain",
|
||||
effect: () => Math.clampMin(MatterDimension(4).amount.pow(0.03).toNumber(), 1),
|
||||
effect: () => Math.clampMin(DarkMatterDimension(4).amount.pow(0.03).toNumber(), 1),
|
||||
effectFormat: x => formatX(x, 2, 2),
|
||||
upgradeDirection: LAITELA_UPGRADE_DIRECTION.SELF_BOOST,
|
||||
},
|
||||
|
@ -368,7 +368,7 @@ export function gameLoop(passDiff, options = {}) {
|
||||
}
|
||||
|
||||
// Lai'tela mechanics should bypass stored real time entirely
|
||||
Laitela.tickDarkMatter(realDiff);
|
||||
DarkMatterDimensions.tick(realDiff);
|
||||
Laitela.autobuyerLoop(realDiff);
|
||||
|
||||
// When storing real time, skip everything else having to do with production once stats are updated
|
||||
|
@ -7868,7 +7868,7 @@ kbd {
|
||||
100% {background-position-y: 24rem}
|
||||
}
|
||||
|
||||
.c-laitela-annihilation-button {
|
||||
.l-laitela-annihilation-button {
|
||||
color: var(--color-laitela--accent);
|
||||
background: var(--color-laitela--base);
|
||||
padding: 1rem;
|
||||
@ -7877,12 +7877,15 @@ kbd {
|
||||
border: 0.2rem solid var(--color-laitela--accent);
|
||||
border-radius: 0.5rem;
|
||||
font-family: Typewriter, serif;
|
||||
cursor: pointer;
|
||||
transition-duration: 0.3s;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.s-base--metro .c-laitela-annihilation-button {
|
||||
.c-laitela-annihilation-button {
|
||||
cursor: pointer;
|
||||
transition-duration: 0.3s;
|
||||
}
|
||||
|
||||
.s-base--metro .l-laitela-annihilation-button {
|
||||
border-width: 0.1rem;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user