Skip to content

Commit

Permalink
Add ability to buy quarks directly for hepteracts
Browse files Browse the repository at this point in the history
  • Loading branch information
Pseudonian committed May 15, 2021
1 parent 1f2e711 commit a17dcf1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
<img src="Pictures/questionable.png" alt='' class='offlineStatIcon'>
<span id="offlineAscensionTimer" class='offlineStatElement'>Current Ascension Timer: +<span id="offlineAscensionTimerNumber" style="color: gold;"></span> seconds</p>
</div>
<div class='offlineStat' id="offlineQuarkCountDiv">
<img src="Pictures/Quark.png" alt='' class='offlineStatIcon'>
<span id="offlineQuarkCount" class='offlineStatElement'>Export Quarks: +<span id="offlineQuarkCountNumber" style="color:goldenrod"></span></span>
</div>
</div>

<button id="exitOffline">That's cool. Take me to the game!</button>
Expand Down Expand Up @@ -2499,6 +2503,10 @@
<button id="multiplierHepteractCraft">Craft</button>
<button id="multiplierHepteractCap">Expand</button>
</div>
<div class="hepteractType" id="hepteractToQuark">
<img id="hepteractToQuarkImage" src="Pictures/Quark.png">
<button id="hepteractToQuarkTrade">Trade</button>
</div>
</div>

<div id="hepteractCraftTexts">
Expand Down
11 changes: 9 additions & 2 deletions src/Calculate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { resetNames } from './types/Synergism';
import { hepteractEffective } from './Hepteracts';
import { addTimers, automaticTools } from './Helper';
import { Alert, Prompt, } from './UpdateHTML';
import { quarkHandler } from './Quark';

export const calculateTotalCoinOwned = () => {
G['totalCoinOwned'] =
Expand Down Expand Up @@ -809,7 +810,7 @@ export const calculateOffline = (forceTime = 0) => {
toggleTalismanBuy(player.buyTalismanShardPercent);
updateTalismanInventory();

addTimers("quarks", timeAdd);
// addTimers("quarks", timeAdd);

document.getElementById('preload').style.display = (forceTime > 0) ? 'none' : 'block';
document.getElementById("offlineContainer").style.display = "flex";
Expand Down Expand Up @@ -840,6 +841,7 @@ export const calculateOffline = (forceTime = 0) => {
ants: tickValue * G['timeMultiplier'],
antsReal: tickValue,
ascension: player.ascensionCounter, //Calculate this after the fact
quarks: quarkHandler().gain //Calculate this after the fact
};

//The cool shit that forces the repetitive loops [But it's actually just once. Again, fuck you Platonic]
Expand All @@ -849,12 +851,17 @@ export const calculateOffline = (forceTime = 0) => {
addTimers('transcension', tickValue);
addTimers('reincarnation', tickValue);
addTimers('ascension', tickValue);

addTimers('quarks', tickValue);

player.prestigeCount += resetAdd.prestige;
player.transcendCount += resetAdd.transcension;
player.reincarnationCount += resetAdd.reincarnation;

timerAdd.ascension = player.ascensionCounter - timerAdd.ascension
timerAdd.quarks = quarkHandler().gain - timerAdd.quarks

document.getElementById('offlineAscensionTimerNumber').textContent = format(timerAdd.ascension, 2, true)
document.getElementById('offlineQuarkCountNumber').textContent = format(timerAdd.quarks, 0, true)
//Credit Resources
// resourceGain(tickValue * G['timeMultiplier'])

Expand Down
4 changes: 3 additions & 1 deletion src/EventListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { resetHistoryTogglePerSecond } from "./History"
import { resetShopUpgrades, shopDescriptions, buyShopUpgrades, useConsumable } from "./Shop"
import { Globals as G } from './Variables';
import { changeTabColor } from "./UpdateHTML"
import { hepteractDescriptions } from "./Hepteracts"
import { hepteractDescriptions, hepteractToQuarkDescription, tradeHepteractToQuark } from "./Hepteracts"
import { exitOffline, timeWarp } from "./Calculate"

/* STYLE GUIDE */
Expand Down Expand Up @@ -473,6 +473,8 @@ document.getElementById('acceleratorHepteractCap').addEventListener('click', ()
document.getElementById('acceleratorBoostHepteractCap').addEventListener('click', () => player.hepteractCrafts.acceleratorBoost.expand())
document.getElementById('multiplierHepteractCap').addEventListener('click', () => player.hepteractCrafts.multiplier.expand())

document.getElementById('hepteractToQuark').addEventListener('mouseover', () => hepteractToQuarkDescription())
document.getElementById('hepteractToQuarkTrade').addEventListener('click', () => tradeHepteractToQuark())
// CORRUPTION TAB
//Part 0: Subtabs
document.getElementById('corrStatsBtn').addEventListener('click', () => toggleSubTab(9, 0))
Expand Down
33 changes: 33 additions & 0 deletions src/Hepteracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ export const hepteractEffective = (data: hepteractTypes) => {
}

export const hepteractDescriptions = (type: hepteractTypes) => {
document.getElementById('hepteractUnlockedText').style.display = 'block'
document.getElementById('hepteractCurrentEffectText').style.display = 'block'
document.getElementById('hepteractBalanceText').style.display = 'block'
const unlockedText = document.getElementById('hepteractUnlockedText')
const effectText = document.getElementById('hepteractEffectText')
const currentEffectText = document.getElementById('hepteractCurrentEffectText')
Expand Down Expand Up @@ -291,6 +294,36 @@ export const hepteractDescriptions = (type: hepteractTypes) => {
}
}

export const hepteractToQuarkDescription = () => {
document.getElementById('hepteractUnlockedText').style.display = 'none'
document.getElementById('hepteractCurrentEffectText').style.display = 'none'
document.getElementById('hepteractBalanceText').style.display = 'none'
document.getElementById('hepteractEffectText').textContent = "For a (high) price, you can synthesize Quarks using only seven dimensional cubes!"
document.getElementById('hepteractCostText').textContent = "Cost: 100,000 Hepteracts per quark"
}

export const tradeHepteractToQuark = async () => {
const maxBuy = Math.floor(player.wowAbyssals / 100000)
const hepteractInput = await Prompt('How many Quarks would you like to purchase? You can buy up to ' + format(maxBuy, 0, true) + ' with your hepteracts.')
const toUse = Number(hepteractInput);
if (
Number.isNaN(toUse) ||
!Number.isInteger(toUse) ||
toUse <= 0
)
return Alert(`Hey! That's not a valid number!`);

const buyAmount = Math.min(maxBuy, toUse, Math.floor(player.wowAbyssals / 100000))
const before = +player.worlds
player.worlds.add(buyAmount)
const after = +player.worlds
const bonusQuark = after - before - buyAmount
player.wowAbyssals -= 100000 * buyAmount

return Alert(`You have purchased ` + format(after - before) + ` Quarks [${format(bonusQuark)} from Patreon Bonus]. Enjoy!`)

}

// Hepteract of Chronos [UNLOCKED]
export const ChronosHepteract = new HepteractCraft({
BASE_CAP: 1000,
Expand Down

0 comments on commit a17dcf1

Please sign in to comment.