Skip to content

Commit 694cca1

Browse files
authored
bug fixes (#568)
* minor fixes * rune fixes * auto sacrifice fixes
1 parent 04d55e4 commit 694cca1

File tree

6 files changed

+43
-19
lines changed

6 files changed

+43
-19
lines changed

src/Calculate.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ let lookupTableRuneExp: number[] | null = null
257257

258258
// Returns the amount of exp required to level a rune
259259
export const calculateRuneExpToLevel = (runeIndex: number, runeLevel = player.runelevels[runeIndex]) => {
260-
lookupTableRuneExp ??= Array.from({ length: 40000 }, (_, i) => lookupTableGen(i))
260+
lookupTableRuneExp ??= Array.from({ length: 40000 + 1 }, (_, i) => lookupTableGen(i))
261261

262262
// For runes 6 and 7 we will apply a special multiplier
263263
let multiplier = lookupTableRuneExp[runeLevel]
@@ -1816,9 +1816,14 @@ export const calculateAscensionSpeedMultiplier = () => {
18161816
// Singularity Penalty
18171817
arr.push(1 / calculateSingularityDebuff('Ascension Speed'))
18181818

1819+
let multiplier = productContents(arr)
1820+
if (!isFinite(multiplier)) {
1821+
multiplier = 0
1822+
}
1823+
18191824
return {
18201825
list: arr,
1821-
mult: productContents(arr)
1826+
mult: multiplier
18221827
}
18231828
}
18241829

@@ -2293,11 +2298,11 @@ export const CalcCorruptionStuff = () => {
22932298
Math.floor(baseScore),
22942299
corruptionMultiplier,
22952300
Math.floor(effectiveScore),
2296-
Math.floor(cubeGain),
2297-
Math.max(player.singularityCount, Math.floor(tesseractGain)),
2298-
Math.floor(hypercubeGain),
2299-
Math.floor(platonicGain),
2300-
Math.floor(hepteractGain),
2301+
Math.min(1e300, Math.floor(cubeGain)),
2302+
Math.min(1e300, Math.max(player.singularityCount, Math.floor(tesseractGain))),
2303+
Math.min(1e300, Math.floor(hypercubeGain)),
2304+
Math.min(1e300, Math.floor(platonicGain)),
2305+
Math.min(1e300, Math.floor(hepteractGain)),
23012306
bonusMultiplier
23022307
]
23032308
}

src/CheckVariables.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -622,12 +622,12 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
622622
)
623623
player.worlds.add(
624624
150 * shop.offeringAutoLevel + 25 / 2 * (shop.offeringAutoLevel - 1) * shop.offeringAutoLevel
625-
- 150 * Math.min(1, shop.offeringAutoLevel),
625+
- 150 * Math.min(1, shop.offeringAutoLevel),
626626
false
627627
)
628628
player.worlds.add(
629629
150 * shop.obtainiumAutoLevel + 25 / 2 * (shop.obtainiumAutoLevel - 1) * shop.obtainiumAutoLevel
630-
- 150 * Math.min(1, shop.obtainiumAutoLevel),
630+
- 150 * Math.min(1, shop.obtainiumAutoLevel),
631631
false
632632
)
633633
player.worlds.add(100 * shop.cashGrabLevel + 100 / 2 * (shop.cashGrabLevel - 1) * shop.cashGrabLevel, false)
@@ -720,17 +720,17 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
720720
player.loadedV253 = true
721721
player.worlds.add(
722722
10000 * player.shopUpgrades.calculator
723-
+ 10000 / 2 * (player.shopUpgrades.calculator - 1) * (player.shopUpgrades.calculator),
723+
+ 10000 / 2 * (player.shopUpgrades.calculator - 1) * (player.shopUpgrades.calculator),
724724
false
725725
)
726726
player.worlds.add(
727727
10000 * player.shopUpgrades.calculator2
728-
+ 5000 / 2 * (player.shopUpgrades.calculator2 - 1) * (player.shopUpgrades.calculator2),
728+
+ 5000 / 2 * (player.shopUpgrades.calculator2 - 1) * (player.shopUpgrades.calculator2),
729729
false
730730
)
731731
player.worlds.add(
732732
25000 * player.shopUpgrades.calculator3
733-
+ 25000 / 2 * (player.shopUpgrades.calculator3 - 1) * (player.shopUpgrades.calculator3),
733+
+ 25000 / 2 * (player.shopUpgrades.calculator3 - 1) * (player.shopUpgrades.calculator3),
734734
false
735735
)
736736
player.shopUpgrades.calculator = 0
@@ -744,7 +744,7 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
744744
player.loadedV255 = true
745745
player.worlds.add(
746746
1000 * player.shopUpgrades.powderEX
747-
+ 1000 / 2 * (player.shopUpgrades.powderEX - 1) * (player.shopUpgrades.powderEX),
747+
+ 1000 / 2 * (player.shopUpgrades.powderEX - 1) * (player.shopUpgrades.powderEX),
748748
false
749749
)
750750
player.shopUpgrades.powderEX = 0
@@ -824,7 +824,7 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
824824
if (
825825
player.singularityUpgrades[k].maxLevel !== -1
826826
&& player.singularityUpgrades[k].level <= player.singularityUpgrades[k].maxLevel
827-
&& player.singularityUpgrades[k].goldenQuarksInvested !== cost
827+
&& player.singularityUpgrades[k].goldenQuarksInvested.toExponential(10) !== cost.toExponential(10)
828828
&& player.singularityUpgrades[k].specialCostForm === 'Default'
829829
) {
830830
player.singularityUpgrades[k].refund()

src/Reset.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const resetdetails = (input: resetNames) => {
8282
resetObtainiumText.textContent = ''
8383
}
8484

85-
;(input === 'ascensionChallenge' || input === 'ascension' || input === 'singularity')
85+
; (input === 'ascensionChallenge' || input === 'ascension' || input === 'singularity')
8686
? offeringImage.style.display = offeringText.style.display = 'none'
8787
: offeringImage.style.display = offeringText.style.display = 'block'
8888

@@ -590,6 +590,16 @@ export const reset = (input: resetNames, fast = false, from = 'unknown') => {
590590
player.antSacrificePoints = 0
591591
player.antSacrificeTimer = 0
592592
player.antSacrificeTimerReal = 0
593+
player.sacrificeTimer = 0
594+
// Ascension early automation timer
595+
if (player.autoSacrificeToggle) {
596+
player.sacrificeTimer = 0.9
597+
}
598+
if (player.autoAntSacrifice && player.autoAntSacrificeMode === 2) {
599+
player.antSacrificeTimer = Math.max(0, player.autoAntSacTimer - 0.1)
600+
player.antSacrificeTimerReal = player.antSacrificeTimer
601+
}
602+
593603
player.antUpgrades[12 - 1] = 0
594604
for (let j = 61; j <= 80; j++) {
595605
player.upgrades[j] = 0
@@ -733,7 +743,7 @@ export const reset = (input: resetNames, fast = false, from = 'unknown') => {
733743
if (index >= 2 && index <= 9) {
734744
return Math.min(
735745
maxLevel * (player.challengecompletions[corrChallengeMinimum(index)] > 0
736-
|| player.singularityUpgrades.platonicTau.getEffect().bonus
746+
|| player.singularityUpgrades.platonicTau.getEffect().bonus
737747
? 1
738748
: 0),
739749
curr

src/Runes.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const redeemShards = (runeIndexPlusOne: number, auto = false, cubeUpgrade
148148
const mult = fact.slice(1, fact.length).reduce((x, y) => x * y, 1)
149149
while (toSpendTotal > 0 && levelsAdded < levelsToAdd && player.runelevels[runeIndex] < maxLevel) {
150150
const exp = calculateRuneExpToLevel(runeIndex, player.runelevels[runeIndex]) - player.runeexp[runeIndex]
151-
const expPerOff = (add + a * player.runelevels[runeIndex]) * mult
151+
const expPerOff = Math.min(1e300, (add + a * player.runelevels[runeIndex]) * mult)
152152
let toSpend = Math.min(toSpendTotal, Math.ceil(exp / expPerOff))
153153
if (isNaN(toSpend)) {
154154
toSpend = toSpendTotal
@@ -177,7 +177,9 @@ export const redeemShards = (runeIndexPlusOne: number, auto = false, cubeUpgrade
177177
}
178178
}
179179
}
180-
displayRuneInformation(runeIndexPlusOne)
180+
if (!auto) {
181+
displayRuneInformation(runeIndexPlusOne)
182+
}
181183
}
182184
calculateRuneLevels()
183185
if (player.runeshards < 0 || !player.runeshards) {

src/UpdateHTML.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,11 @@ export const showCorruptionStatsLoadouts = () => {
10981098
}
10991099

11001100
const updateAscensionStats = () => {
1101-
const t = player.ascensionCounter
1101+
let t = player.ascensionCounter
1102+
// Division by 0 is not defined
1103+
if (t === 0) {
1104+
t = 1
1105+
}
11021106
const [cubes, tess, hyper, platonic, hepteract] = CalcCorruptionStuff().slice(4)
11031107
const addedAsterisk = player.singularityUpgrades.oneMind.getEffect().bonus
11041108
const fillers: Record<string, string> = {

src/singularity.ts

+3
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,9 @@ export const calculateSingularityDebuff = (
22032203

22042204
let constitutiveSingularityCount = singularityCount
22052205
constitutiveSingularityCount -= player.shopUpgrades.shopSingularityPenaltyDebuff
2206+
if (constitutiveSingularityCount < 1) {
2207+
return 1
2208+
}
22062209

22072210
const effectiveSingularities = calculateEffectiveSingularities(constitutiveSingularityCount)
22082211

0 commit comments

Comments
 (0)