Skip to content

Commit

Permalink
bug fixes (#568)
Browse files Browse the repository at this point in the history
* minor fixes

* rune fixes

* auto sacrifice fixes
  • Loading branch information
httpsnet authored Dec 30, 2023
1 parent 04d55e4 commit 694cca1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 19 deletions.
19 changes: 12 additions & 7 deletions src/Calculate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ let lookupTableRuneExp: number[] | null = null

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

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

let multiplier = productContents(arr)
if (!isFinite(multiplier)) {
multiplier = 0
}

return {
list: arr,
mult: productContents(arr)
mult: multiplier
}
}

Expand Down Expand Up @@ -2293,11 +2298,11 @@ export const CalcCorruptionStuff = () => {
Math.floor(baseScore),
corruptionMultiplier,
Math.floor(effectiveScore),
Math.floor(cubeGain),
Math.max(player.singularityCount, Math.floor(tesseractGain)),
Math.floor(hypercubeGain),
Math.floor(platonicGain),
Math.floor(hepteractGain),
Math.min(1e300, Math.floor(cubeGain)),
Math.min(1e300, Math.max(player.singularityCount, Math.floor(tesseractGain))),
Math.min(1e300, Math.floor(hypercubeGain)),
Math.min(1e300, Math.floor(platonicGain)),
Math.min(1e300, Math.floor(hepteractGain)),
bonusMultiplier
]
}
Expand Down
14 changes: 7 additions & 7 deletions src/CheckVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,12 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
)
player.worlds.add(
150 * shop.offeringAutoLevel + 25 / 2 * (shop.offeringAutoLevel - 1) * shop.offeringAutoLevel
- 150 * Math.min(1, shop.offeringAutoLevel),
- 150 * Math.min(1, shop.offeringAutoLevel),
false
)
player.worlds.add(
150 * shop.obtainiumAutoLevel + 25 / 2 * (shop.obtainiumAutoLevel - 1) * shop.obtainiumAutoLevel
- 150 * Math.min(1, shop.obtainiumAutoLevel),
- 150 * Math.min(1, shop.obtainiumAutoLevel),
false
)
player.worlds.add(100 * shop.cashGrabLevel + 100 / 2 * (shop.cashGrabLevel - 1) * shop.cashGrabLevel, false)
Expand Down Expand Up @@ -720,17 +720,17 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
player.loadedV253 = true
player.worlds.add(
10000 * player.shopUpgrades.calculator
+ 10000 / 2 * (player.shopUpgrades.calculator - 1) * (player.shopUpgrades.calculator),
+ 10000 / 2 * (player.shopUpgrades.calculator - 1) * (player.shopUpgrades.calculator),
false
)
player.worlds.add(
10000 * player.shopUpgrades.calculator2
+ 5000 / 2 * (player.shopUpgrades.calculator2 - 1) * (player.shopUpgrades.calculator2),
+ 5000 / 2 * (player.shopUpgrades.calculator2 - 1) * (player.shopUpgrades.calculator2),
false
)
player.worlds.add(
25000 * player.shopUpgrades.calculator3
+ 25000 / 2 * (player.shopUpgrades.calculator3 - 1) * (player.shopUpgrades.calculator3),
+ 25000 / 2 * (player.shopUpgrades.calculator3 - 1) * (player.shopUpgrades.calculator3),
false
)
player.shopUpgrades.calculator = 0
Expand All @@ -744,7 +744,7 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
player.loadedV255 = true
player.worlds.add(
1000 * player.shopUpgrades.powderEX
+ 1000 / 2 * (player.shopUpgrades.powderEX - 1) * (player.shopUpgrades.powderEX),
+ 1000 / 2 * (player.shopUpgrades.powderEX - 1) * (player.shopUpgrades.powderEX),
false
)
player.shopUpgrades.powderEX = 0
Expand Down Expand Up @@ -824,7 +824,7 @@ export const checkVariablesOnLoad = (data: PlayerSave) => {
if (
player.singularityUpgrades[k].maxLevel !== -1
&& player.singularityUpgrades[k].level <= player.singularityUpgrades[k].maxLevel
&& player.singularityUpgrades[k].goldenQuarksInvested !== cost
&& player.singularityUpgrades[k].goldenQuarksInvested.toExponential(10) !== cost.toExponential(10)
&& player.singularityUpgrades[k].specialCostForm === 'Default'
) {
player.singularityUpgrades[k].refund()
Expand Down
14 changes: 12 additions & 2 deletions src/Reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const resetdetails = (input: resetNames) => {
resetObtainiumText.textContent = ''
}

;(input === 'ascensionChallenge' || input === 'ascension' || input === 'singularity')
; (input === 'ascensionChallenge' || input === 'ascension' || input === 'singularity')
? offeringImage.style.display = offeringText.style.display = 'none'
: offeringImage.style.display = offeringText.style.display = 'block'

Expand Down Expand Up @@ -590,6 +590,16 @@ export const reset = (input: resetNames, fast = false, from = 'unknown') => {
player.antSacrificePoints = 0
player.antSacrificeTimer = 0
player.antSacrificeTimerReal = 0
player.sacrificeTimer = 0
// Ascension early automation timer
if (player.autoSacrificeToggle) {
player.sacrificeTimer = 0.9
}
if (player.autoAntSacrifice && player.autoAntSacrificeMode === 2) {
player.antSacrificeTimer = Math.max(0, player.autoAntSacTimer - 0.1)
player.antSacrificeTimerReal = player.antSacrificeTimer
}

player.antUpgrades[12 - 1] = 0
for (let j = 61; j <= 80; j++) {
player.upgrades[j] = 0
Expand Down Expand Up @@ -733,7 +743,7 @@ export const reset = (input: resetNames, fast = false, from = 'unknown') => {
if (index >= 2 && index <= 9) {
return Math.min(
maxLevel * (player.challengecompletions[corrChallengeMinimum(index)] > 0
|| player.singularityUpgrades.platonicTau.getEffect().bonus
|| player.singularityUpgrades.platonicTau.getEffect().bonus
? 1
: 0),
curr
Expand Down
6 changes: 4 additions & 2 deletions src/Runes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export const redeemShards = (runeIndexPlusOne: number, auto = false, cubeUpgrade
const mult = fact.slice(1, fact.length).reduce((x, y) => x * y, 1)
while (toSpendTotal > 0 && levelsAdded < levelsToAdd && player.runelevels[runeIndex] < maxLevel) {
const exp = calculateRuneExpToLevel(runeIndex, player.runelevels[runeIndex]) - player.runeexp[runeIndex]
const expPerOff = (add + a * player.runelevels[runeIndex]) * mult
const expPerOff = Math.min(1e300, (add + a * player.runelevels[runeIndex]) * mult)
let toSpend = Math.min(toSpendTotal, Math.ceil(exp / expPerOff))
if (isNaN(toSpend)) {
toSpend = toSpendTotal
Expand Down Expand Up @@ -177,7 +177,9 @@ export const redeemShards = (runeIndexPlusOne: number, auto = false, cubeUpgrade
}
}
}
displayRuneInformation(runeIndexPlusOne)
if (!auto) {
displayRuneInformation(runeIndexPlusOne)
}
}
calculateRuneLevels()
if (player.runeshards < 0 || !player.runeshards) {
Expand Down
6 changes: 5 additions & 1 deletion src/UpdateHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,11 @@ export const showCorruptionStatsLoadouts = () => {
}

const updateAscensionStats = () => {
const t = player.ascensionCounter
let t = player.ascensionCounter
// Division by 0 is not defined
if (t === 0) {
t = 1
}
const [cubes, tess, hyper, platonic, hepteract] = CalcCorruptionStuff().slice(4)
const addedAsterisk = player.singularityUpgrades.oneMind.getEffect().bonus
const fillers: Record<string, string> = {
Expand Down
3 changes: 3 additions & 0 deletions src/singularity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,9 @@ export const calculateSingularityDebuff = (

let constitutiveSingularityCount = singularityCount
constitutiveSingularityCount -= player.shopUpgrades.shopSingularityPenaltyDebuff
if (constitutiveSingularityCount < 1) {
return 1
}

const effectiveSingularities = calculateEffectiveSingularities(constitutiveSingularityCount)

Expand Down

0 comments on commit 694cca1

Please sign in to comment.