Skip to content

Commit

Permalink
Merge branch 'master' into crowdin
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev authored Aug 12, 2023
2 parents 8a57d19 + 6cf9d03 commit 68005dd
Show file tree
Hide file tree
Showing 69 changed files with 305 additions and 194 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added Pictures/Legacy/Unused/perkhepteractAutocraft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkBorder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Pictures/Legacy/perkGoldenRevolution2.png
Binary file not shown.
Binary file removed Pictures/Legacy/perkGoldenRevolution3.png
Binary file not shown.
Binary file modified Pictures/Legacy/perkantGodsCornucopia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkautomagicalRunes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkautomationUpgrades.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkcongealedblueberries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkcoolQOLCubes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkderpSmithsCornucopia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perketernalAscensions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkevenMoreQuarks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkexaltedAchievements.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkforTheLoveOfTheAntGod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkgenerousOrbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkgoldenCoins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkgoldenRevolution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/Legacy/perkgoldenRevolution2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Pictures/Legacy/perkgoldenRevolution3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Pictures/Legacy/perkgoldenRevolution4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Pictures/Legacy/perkhepteractAutocraft.png
Diff not rendered.
Binary file modified Pictures/Legacy/perkimmaculateAlchemy.png
Binary file modified Pictures/Legacy/perkirishAnt.png
Binary file modified Pictures/Legacy/perkirishAnt2.png
Binary file modified Pictures/Legacy/perkitAllAddsUp.png
Binary file modified Pictures/Legacy/perkmidasMilleniumAgedGold.png
Binary file modified Pictures/Legacy/perknotSoChallenging.png
Binary file modified Pictures/Legacy/perkocteractMetagenesis.png
Binary file modified Pictures/Legacy/perkoverclocked.png
Binary file modified Pictures/Legacy/perkplatSigma.png
Binary file modified Pictures/Legacy/perkplatonicClones.png
Binary file modified Pictures/Legacy/perkpotionAutogenerator.png
Binary file modified Pictures/Legacy/perkresearchDummies.png
Binary file modified Pictures/Legacy/perkrespecBeGone.png
Binary file modified Pictures/Legacy/perkshopSpecialOffer.png
Binary file modified Pictures/Legacy/perkskrauQ.png
Binary file modified Pictures/Legacy/perksuperStart.png
Binary file added Pictures/Legacy/perksweepomatic.png
Binary file modified Pictures/Legacy/perkunlimitedGrowth.png
Binary file added Pictures/Legacy/perkwelcometoSingularity.png
Binary file modified Pictures/Legacy/perkwowCubeAutomatedShipping.png
Binary file modified Pictures/Legacy/perkxyz.png
10 changes: 8 additions & 2 deletions Synergism.css
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ p#themesTitle {
flex-wrap: wrap;
display: flex;
flex-direction: column;
image-rendering: auto;
}

#thirdParty > div > a {
Expand Down Expand Up @@ -2607,12 +2608,16 @@ p#ascendHotKeys {
}

.constUpgradeAvailable {
background-color: green;
background-color: purple;
cursor: pointer;
}

.constUpgradeAvailable:hover {
background-color: #00b300;
background-color: #b300b3;
}

.constUpgradeAuto {
background-color: green;
}

/* .constUpgradeSingle {
Expand Down Expand Up @@ -3800,6 +3805,7 @@ img#singularityPerksIcon {
/* A 1.3 width x height ratio */
width: 96px;
height: 72px;
image-rendering: auto;
}

form input:hover {
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4163,7 +4163,7 @@ <h1>Artists</h1>
<div id="singularityPerkContainer">
<p id="singularityPerksHeader"></p>
<div id="singualrityPerksInfo">
<img id="singularityPerksIcon" src="Pictures/Default/PerkBorder.png">
<img id="singularityPerksIcon" src="Pictures/Default/perkBorder.png">
<p id="singularityPerksText"></p>
</div>
<p id="singularityPerksDesc"></p>
Expand Down
3 changes: 1 addition & 2 deletions src/Achievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ export const areward = (i: number): string => {
140, 141, 147, 171, 172, 173, 176, 177, 178, 179,
180, 181, 182, 197, 198, 199, 200, 201, 204, 205,
206, 207, 208, 209, 211, 212, 213, 214, 215, 218,
219, 220, 221, 222, 250, 251, 253, 259, 260, 261,
274, 275, 276, 277, 278, 279, 280
219, 220, 221, 222, 250, 251, 253, 259, 260, 261
]

if (descs.includes(i) || i in extra) {
Expand Down
5 changes: 4 additions & 1 deletion src/EventListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,10 @@ TODO: Fix this entire tab it's utter shit
DOMCacheGetOrSet('singularityPerksGrid').append(perkHTML)
DOMCacheGetOrSet(perk.ID).addEventListener('mouseover', () => {
const perkInfo = getLastUpgradeInfo(perk, player.highestSingularityCount)
const levelInfo = `${i18next.t('general.level')} ${perkInfo.level} - (Singularity ${perkInfo.singularity})`
const levelInfo = i18next.t('singularity.perks.levelInfo', {
level: perkInfo.level,
singularity: perkInfo.singularity
})
perkImage.src = `Pictures/${IconSets[player.iconSet][0]}/perk${perk.ID}.png`
perksText.textContent = levelInfo
perksDesc.textContent = perk.description(player.highestSingularityCount, perk.levels)
Expand Down
32 changes: 20 additions & 12 deletions src/Login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,30 @@ interface SynergismUserAPIResponse {

export async function handleLogin () {
const subtabElement = document.querySelector('#accountSubTab > div.scrollbarX')!
const currentBonus = DOMCacheGetOrSet('currentBonus')

const response = await fetch('https://synergism.cc/api/v1/users/me')

if (!response.ok) {
currentBonus.textContent = `Oh no! I couldn't fetch the bonus... Please send this to Khafra in the Discord: ${await response.text()}.`
return
}

const { globalBonus, member, personalBonus } = await response.json() as SynergismUserAPIResponse

player.worlds = new QuarkHandler({
quarks: Number(player.worlds),
bonus: 100 * (1 + globalBonus/100) * (1 + personalBonus/100) - 100 // Multiplicative
})

currentBonus.textContent = `Generous patrons give you a bonus of ${globalBonus}% more Quarks!`

if (location.hostname !== 'synergism.cc') {
// TODO: better error, make link clickable, etc.
subtabElement.textContent = 'Login is not available here, go to https://synergism.cc instead!'
} else if (document.cookie.length) {
const response = await fetch('/api/v1/users/me')
const { globalBonus, member, personalBonus } = await response.json() as SynergismUserAPIResponse

player.worlds = new QuarkHandler({
quarks: Number(player.worlds),
bonus: 100 * (1 + globalBonus/100) * (1 + personalBonus/100) - 100 // Multiplicative
})

DOMCacheGetOrSet('currentBonus').textContent =
`Generous patrons give you a bonus of ${globalBonus}% more Quarks! ` +
`You also receive an extra ${personalBonus}% bonus for being a Patreon and/or boosting the Discord server! Multiplicative with global bonus!`
currentBonus.textContent +=
` You also receive an extra ${personalBonus}% bonus for being a Patreon member and/or boosting the Discord server! Multiplicative with global bonus!`

const user = member?.user?.username ?? 'player'
const boosted = Boolean(member?.premium_since)
Expand All @@ -85,7 +93,7 @@ export async function handleLogin () {
const exMark = '<span style="color: crimson">[✖] {+0%}</span>'

subtabElement.innerHTML = `Hello, ${user}!\n
Your personal bonus is ${personalBonus}%, computed by the following:
Your personal Quark bonus is ${personalBonus}%, computed by the following:
<span style="color: orchid">Transcended Baller</span> [+2%] - ${hasTier1 ? checkMark(2) : exMark}
<span style="color: green">Reincarnated Baller</span> [+3%] - ${hasTier2 ? checkMark(3) : exMark}
<span style="color: orange">ASCENDED Baller</span> [+4%] - ${hasTier3 ? checkMark(4) : exMark}
Expand Down
8 changes: 5 additions & 3 deletions src/Reset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { player, format, blankSave, updateAll, saveSynergy } from './Synergism'
import { player, format, blankSave, updateAll, updateEffectiveLevelMult, saveSynergy } from './Synergism'
import {
calculateOfferings, CalcCorruptionStuff, calculateCubeBlessings, calculateRuneLevels,
calculateAnts, calculateObtainium, calculateTalismanEffects, calculateAntSacrificeELO,
Expand Down Expand Up @@ -984,7 +984,7 @@ export const updateSingularityMilestoneAwards = (singularityReset = true): void
player.researches[135] = 1
player.researches[145] = 1
}
if (player.highestSingularityCount >= 101 && singularityReset) {
if (player.highestSingularityCount >= 100 && singularityReset) {
player.cubeUpgrades[51] = 1
awardAutosCookieUpgrade()
}
Expand Down Expand Up @@ -1126,7 +1126,7 @@ export const singularity = async (setSingNumber = -1): Promise<void> => {
Object.entries(player.octeractUpgrades).map(([key, value]) => {
return [key, {
level: value.level,
goldenQuarksInvested: value.octeractsInvested,
octeractsInvested: value.octeractsInvested,
toggleBuy: value.toggleBuy,
freeLevels: value.freeLevels
}]
Expand Down Expand Up @@ -1382,6 +1382,8 @@ const resetUpgrades = (i: number) => {
player.crystalUpgrades = [0, 0, 0, 0, 0, 0, 0, 0]
player.crystalUpgradesCost = [7, 15, 20, 40, 100, 200, 500, 1000]

updateEffectiveLevelMult() //update before prism rune, fixes c15 bug

let m = 0
m += Math.floor(G.rune3level * G.effectiveLevelMult / 16) * 100 / 100
if (player.upgrades[73] > 0.5 && player.currentChallenge.reincarnation !== 0) {
Expand Down
34 changes: 21 additions & 13 deletions src/Synergism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,11 @@ export const format = (
// returns format (1.23e456,789)
return `${mantissaLook}e${powerLook}`
}
const mantissaLook = (Math.floor(mantissa * Math.pow(10, power) * Math.pow(10, accuracy)) / Math.pow(10, accuracy)).toLocaleString(undefined, {
mantissa = mantissa * Math.pow(10, power)
if (mantissa - Math.floor(mantissa) > 0.9999999) {
mantissa = Math.ceil(mantissa)
}
const mantissaLook = (Math.floor(mantissa * Math.pow(10, accuracy)) / Math.pow(10, accuracy)).toLocaleString(undefined, {
minimumFractionDigits: accuracy, maximumFractionDigits: accuracy
})
return `${mantissaLook}`
Expand Down Expand Up @@ -3417,6 +3421,20 @@ export const resetConfirmation = async (i: string): Promise<void> => {
}
}

export const updateEffectiveLevelMult = (): void => {
G.effectiveLevelMult = 1
G.effectiveLevelMult *= (1 + player.researches[4] / 10 * (1 + 1 / 2 * CalcECC('ascension', player.challengecompletions[14]))) //Research 1x4
G.effectiveLevelMult *= (1 + player.researches[21] / 100) //Research 2x6
G.effectiveLevelMult *= (1 + player.researches[90] / 100) //Research 4x15
G.effectiveLevelMult *= (1 + player.researches[131] / 200) //Research 6x6
G.effectiveLevelMult *= (1 + player.researches[161] / 200 * 3 / 5) //Research 7x11
G.effectiveLevelMult *= (1 + player.researches[176] / 200 * 2 / 5) //Research 8x1
G.effectiveLevelMult *= (1 + player.researches[191] / 200 * 1 / 5) //Research 8x16
G.effectiveLevelMult *= (1 + player.researches[146] / 200 * 4 / 5) //Research 6x21
G.effectiveLevelMult *= (1 + 0.01 * Math.log(player.talismanShards + 1) / Math.log(4) * Math.min(1, player.constantUpgrades[9]))
G.effectiveLevelMult *= G.challenge15Rewards.runeBonus
}

export const updateAll = (): void => {
G.uFourteenMulti = new Decimal(1)
G.uFifteenMulti = new Decimal(1)
Expand Down Expand Up @@ -3521,6 +3539,8 @@ export const updateAll = (): void => {
buyMax(5, 'Diamonds')
}

updateEffectiveLevelMult() //update before prism rune, fixes c15 bug

let c = 0
c += Math.floor(G.rune3level / 16 * G.effectiveLevelMult) * 100 / 100
if (player.upgrades[73] > 0.5 && player.currentChallenge.reincarnation !== 0) {
Expand Down Expand Up @@ -3752,18 +3772,6 @@ export const updateAll = (): void => {
player.researchPoints = 1e300
}

G.effectiveLevelMult = 1
G.effectiveLevelMult *= (1 + player.researches[4] / 10 * (1 + 1 / 2 * CalcECC('ascension', player.challengecompletions[14]))) //Research 1x4
G.effectiveLevelMult *= (1 + player.researches[21] / 100) //Research 2x6
G.effectiveLevelMult *= (1 + player.researches[90] / 100) //Research 4x15
G.effectiveLevelMult *= (1 + player.researches[131] / 200) //Research 6x6
G.effectiveLevelMult *= (1 + player.researches[161] / 200 * 3 / 5) //Research 7x11
G.effectiveLevelMult *= (1 + player.researches[176] / 200 * 2 / 5) //Research 8x1
G.effectiveLevelMult *= (1 + player.researches[191] / 200 * 1 / 5) //Research 8x16
G.effectiveLevelMult *= (1 + player.researches[146] / 200 * 4 / 5) //Research 6x21
G.effectiveLevelMult *= (1 + 0.01 * Math.log(player.talismanShards + 1) / Math.log(4) * Math.min(1, player.constantUpgrades[9]))
G.effectiveLevelMult *= G.challenge15Rewards.runeBonus

G.optimalOfferingTimer = 600 + 30 * player.researches[85] + 0.4 * G.rune5level + 120 * player.shopUpgrades.offeringEX
G.optimalObtainiumTimer = 3600 + 120 * player.shopUpgrades.obtainiumEX
autoBuyAnts()
Expand Down
43 changes: 25 additions & 18 deletions src/UpdateHTML.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,11 @@ export const buttoncolorchange = () => {
k += 10
}

(player.achievements[79] < 1 && player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[0] + G.crystalUpgradeCostIncrement[0] * Math.floor(Math.pow(player.crystalUpgrades[0] + 0.5 - k, 2) / 2))))) ? f.style.backgroundColor = 'purple' : f.style.backgroundColor = '';
(player.achievements[86] < 1 && player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[1] + G.crystalUpgradeCostIncrement[1] * Math.floor(Math.pow(player.crystalUpgrades[1] + 0.5 - k, 2) / 2))))) ? g.style.backgroundColor = 'purple' : g.style.backgroundColor = '';
(player.achievements[93] < 1 && player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[2] + G.crystalUpgradeCostIncrement[2] * Math.floor(Math.pow(player.crystalUpgrades[2] + 0.5 - k, 2) / 2))))) ? h.style.backgroundColor = 'purple' : h.style.backgroundColor = '';
(player.achievements[100] < 1 && player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[3] + G.crystalUpgradeCostIncrement[3] * Math.floor(Math.pow(player.crystalUpgrades[3] + 0.5 - k, 2) / 2))))) ? i.style.backgroundColor = 'purple' : i.style.backgroundColor = '';
(player.achievements[107] < 1 && player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[4] + G.crystalUpgradeCostIncrement[4] * Math.floor(Math.pow(player.crystalUpgrades[4] + 0.5 - k, 2) / 2))))) ? j.style.backgroundColor = 'purple' : j.style.backgroundColor = ''
player.achievements[79] < 1 ? (player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[0] + G.crystalUpgradeCostIncrement[0] * Math.floor(Math.pow(player.crystalUpgrades[0] + 0.5 - k, 2) / 2)))) ? f.style.backgroundColor = 'purple' : f.style.backgroundColor = '') : f.style.backgroundColor = 'green'
player.achievements[86] < 1 ? (player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[1] + G.crystalUpgradeCostIncrement[1] * Math.floor(Math.pow(player.crystalUpgrades[1] + 0.5 - k, 2) / 2)))) ? g.style.backgroundColor = 'purple' : g.style.backgroundColor = '') : g.style.backgroundColor = 'green'
player.achievements[93] < 1 ? (player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[2] + G.crystalUpgradeCostIncrement[2] * Math.floor(Math.pow(player.crystalUpgrades[2] + 0.5 - k, 2) / 2)))) ? h.style.backgroundColor = 'purple' : h.style.backgroundColor = '') : h.style.backgroundColor = 'green'
player.achievements[100] < 1 ? (player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[3] + G.crystalUpgradeCostIncrement[3] * Math.floor(Math.pow(player.crystalUpgrades[3] + 0.5 - k, 2) / 2)))) ? i.style.backgroundColor = 'purple' : i.style.backgroundColor = '') : i.style.backgroundColor = 'green'
player.achievements[107] < 1 ? (player.prestigeShards.gte(Decimal.pow(10, (G.crystalUpgradesCost[4] + G.crystalUpgradeCostIncrement[4] * Math.floor(Math.pow(player.crystalUpgrades[4] + 0.5 - k, 2) / 2)))) ? j.style.backgroundColor = 'purple' : j.style.backgroundColor = '') : j.style.backgroundColor = 'green'
}

if (G.currentTab === 'runes') {
Expand Down Expand Up @@ -841,19 +841,26 @@ export const buttoncolorchange = () => {
: DOMCacheGetOrSet(`buyTesseracts${i}`).classList.remove('buildingPurchaseBtnAvailable')
}
for (let i = 1; i <= 8; i++) {
(player.ascendShards.gte(Decimal.pow(10, player.constantUpgrades[i]!).times(G.constUpgradeCosts[i]!)))
? DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeAvailable')
: DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAvailable')
if (player.researches[190] >= 1) {
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAvailable')
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeAuto')
} else {
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAuto');
(player.ascendShards.gte(Decimal.pow(10, player.constantUpgrades[i]!).times(G.constUpgradeCosts[i]!)))
? DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeAvailable')
: DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAvailable')
}
}

for (let i = 9; i <= 10; i++) {
if (player.constantUpgrades[i]! >= 1) {
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeSingle')
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeSingleAvailable')
} else if (player.ascendShards.gte(Decimal.pow(10, player.constantUpgrades[i]!).times(G.constUpgradeCosts[i]!))) {
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeSingleAvailable')
if (player.researches[190] >= 1 || player.constantUpgrades[i]! >= 1) {
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAvailable')
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeAuto')
} else {
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeSingleAvailable')
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeSingle')
DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAuto');
(player.ascendShards.gte(Decimal.pow(10, player.constantUpgrades[i]!).times(G.constUpgradeCosts[i]!)))
? DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.add('constUpgradeAvailable')
: DOMCacheGetOrSet(`buyConstantUpgrade${i}`).classList.remove('constUpgradeAvailable')
}
}
}
Expand Down Expand Up @@ -1095,7 +1102,7 @@ export const Prompt = (text: string, defaultValue?: string): Promise<string | nu
overlay.style.display = 'block'
popup.querySelector('label')!.textContent = text
if (defaultValue) {
popup.querySelector('input')!.value = defaultValue
popup.querySelector('input')!.placeholder = defaultValue
}
popup.querySelector('input')!.focus()

Expand All @@ -1114,9 +1121,9 @@ export const Prompt = (text: string, defaultValue?: string): Promise<string | nu
confWrap.style.display = 'none'
overlay.style.display = 'none'

p.resolve(targetEl.id === ok.id ? el.value : null)
p.resolve(targetEl.id === ok.id ? el.value || el.placeholder : null)

el.value = el.textContent = ''
el.value = el.textContent = el.placeholder = ''
popup.querySelector('input')!.blur()
}

Expand Down
18 changes: 15 additions & 3 deletions src/Upgrades.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,23 @@ const returnConstUpgDesc = (i: number) => i18next.t(`upgrades.constantUpgrades.$
const returnConstUpgEffect = (i: number) => i18next.t(`upgrades.constantEffects.${i}`, constUpgEffect[i]?.())

export const getConstUpgradeMetadata = (i: number): [number, Decimal] => {
const toBuy = Math.max(0, Math.floor(1 + Decimal.log(Decimal.max(0.01, player.ascendShards), 10) - Math.log(G.constUpgradeCosts[i]!) / Math.log(10)))
let toBuy
let cost: Decimal

if (i >= 9) {
if (player.constantUpgrades[i]! >=1) {
toBuy = 0
} else {
toBuy = Math.min(1, Math.max(0, Math.floor(1 + Decimal.log(Decimal.max(0.01, player.ascendShards), 10) - Math.log(G.constUpgradeCosts[i]!) / Math.log(10))))
}
} else {
toBuy = Math.max(0, Math.floor(1 + Decimal.log(Decimal.max(0.01, player.ascendShards), 10) - Math.log(G.constUpgradeCosts[i]!) / Math.log(10)))
}

if (toBuy > player.constantUpgrades[i]!) {
cost = Decimal.pow(10, toBuy - 1).times(G.constUpgradeCosts[i]!)
} else {
cost = Decimal.pow(10, player.constantUpgrades[i]!).times(G.constUpgradeCosts[i]!)
cost = i >= 9 && player.constantUpgrades[i]! >= 1 ? new Decimal('0') : Decimal.pow(10, player.constantUpgrades[i]!).times(G.constUpgradeCosts[i]!)
}

return [Math.max(1, toBuy - player.constantUpgrades[i]!), cost]
Expand All @@ -401,14 +411,16 @@ export const constantUpgradeDescriptions = (i: number) => {

export const buyConstantUpgrades = (i: number, fast = false) => {
const [level, cost] = getConstUpgradeMetadata(i)
if (player.ascendShards.gte(cost)) {
if (i <= 8 || (i >= 9 && player.constantUpgrades[i]! < 1)) {
if (player.ascendShards.gte(cost)) {
player.constantUpgrades[i]! += level
if (player.researches[175] === 0) {
player.ascendShards = player.ascendShards.sub(cost)
}
if (!fast) {
constantUpgradeDescriptions(i)
}
}
}
calculateAnts()
calculateRuneLevels()
Expand Down
Loading

0 comments on commit 68005dd

Please sign in to comment.