Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored CalcECC function to simplify calls. #440

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Buy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const getReductionValue = () => {
let reduction = 1;
reduction += Math.min(1e15, (G['rune4level'] * G['effectiveLevelMult']) / 160);
reduction += (player.researches[56] + player.researches[57] + player.researches[58] + player.researches[59] + player.researches[60]) / 200;
reduction += CalcECC('transcend', player.challengecompletions[4]) / 200;
reduction += CalcECC(4) / 200;
reduction += Math.min(99999.9, (3 * (player.antUpgrades[7-1]! + G['bonusant7'])) / 100);
return reduction;
}
Expand All @@ -28,15 +28,15 @@ const getCostAccelerator = (buyingTo: number): Decimal => {

cost = cost.times(Decimal.pow(4 / G['costDivisor'], buyingTo));

if (buyingTo > (125 + 5 * CalcECC('transcend', player.challengecompletions[4]))) {
const num = buyingTo - 125 - 5 * CalcECC('transcend', player.challengecompletions[4]);
if (buyingTo > (125 + 5 * CalcECC(4))) {
const num = buyingTo - 125 - 5 * CalcECC(4);
const factorialBit = new Decimal(num).factorial();
const multBit = Decimal.pow(4, num);
cost = cost.times(multBit.times(factorialBit));
}

if (buyingTo > (2000 + 5 * CalcECC('transcend', player.challengecompletions[4]))) {
const sumNum = buyingTo - 2000 - 5 * CalcECC('transcend', player.challengecompletions[4]);
if (buyingTo > (2000 + 5 * CalcECC(4))) {
const sumNum = buyingTo - 2000 - 5 * CalcECC(4);
const sumBit = sumNum * (sumNum + 1) / 2
cost = cost.times(Decimal.pow(2, sumBit));
}
Expand Down Expand Up @@ -173,15 +173,15 @@ const getCostMultiplier = (buyingTo: number): Decimal => {
let cost = new Decimal(originalCost);
cost = cost.times(Decimal.pow(10, buyingTo / G['costDivisor']));

if (buyingTo > (75 + 2 * CalcECC('transcend', player.challengecompletions[4]))) {
const num = buyingTo - 75 - 2 * CalcECC('transcend', player.challengecompletions[4]);
if (buyingTo > (75 + 2 * CalcECC(4))) {
const num = buyingTo - 75 - 2 * CalcECC(4);
const factorialBit = new Decimal(num).factorial();
const powBit = Decimal.pow(10, num);
cost = cost.times(factorialBit.times(powBit));
}

if (buyingTo > (2000 + 2 * CalcECC('transcend', player.challengecompletions[4]))) {
const sumNum = buyingTo - 2000 - 2 * CalcECC('transcend', player.challengecompletions[4]);
if (buyingTo > (2000 + 2 * CalcECC(4))) {
const sumNum = buyingTo - 2000 - 2 * CalcECC(4);
const sumBit = sumNum * (sumNum + 1) / 2;
cost = cost.times(Decimal.pow(2, sumBit));
}
Expand Down Expand Up @@ -585,7 +585,7 @@ export const buyProducer = (pos: FirstToFifth, type: keyof typeof buyProducerTyp
let r = 1;
r += (G['rune4level'] * G['effectiveLevelMult']) / 160;
r += (player.researches[56] + player.researches[57] + player.researches[58] + player.researches[59] + player.researches[60]) / 200;
r += CalcECC('transcend', player.challengecompletions[4]) / 200
r += CalcECC(4) / 200
r += (3 * (G['bonusant7'] + player.antUpgrades[7-1]!)) / 100;

const posCostType = `${pos}Cost${type}` as const;
Expand Down
34 changes: 17 additions & 17 deletions src/Calculate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const calculateTotalAcceleratorBoost = () => {

b += player.researches[93] * Math.floor(1 / 20 * (G['rune1level'] + G['rune2level'] + G['rune3level'] + G['rune4level'] + G['rune5level']))
b += Math.floor((0.01 + G['rune1level']) * G['effectiveLevelMult'] / 20);
b *= (1 + 1 / 5 * player.researches[3] * (1 + 1 / 2 * CalcECC('ascension', player.challengecompletions[14])))
b *= (1 + 1 / 5 * player.researches[3] * (1 + 1 / 2 * CalcECC(14)))
b *= (1 + 1 / 20 * player.researches[16] + 1 / 20 * player.researches[17])
b *= (1 + 1 / 20 * player.researches[88])
b *= calculateSigmoidExponential(20, (player.antUpgrades[4-1]! + G['bonusant4']) / 1000 * 20 / 19)
Expand All @@ -79,7 +79,7 @@ export const calculateAcceleratorMultiplier = () => {
G['acceleratorMultiplier'] *= (1 + player.achievements[60] / 100)
G['acceleratorMultiplier'] *= (1 + player.achievements[61] / 100)
G['acceleratorMultiplier'] *= (1 + player.achievements[62] / 100)
G['acceleratorMultiplier'] *= (1 + 1 / 5 * player.researches[1] * (1 + 1 / 2 * CalcECC('ascension', player.challengecompletions[14])))
G['acceleratorMultiplier'] *= (1 + 1 / 5 * player.researches[1] * (1 + 1 / 2 * CalcECC(14)))
G['acceleratorMultiplier'] *= (1 + 1 / 20 * player.researches[6] + 1 / 25 * player.researches[7] + 1 / 40 * player.researches[8] + 3 / 200 * player.researches[9] + 1 / 200 * player.researches[10]);
G['acceleratorMultiplier'] *= (1 + 1 / 20 * player.researches[86])
G['acceleratorMultiplier'] *= (1 + 1 / 100 * player.researches[126])
Expand Down Expand Up @@ -173,19 +173,19 @@ export function calculateRuneExpGiven(runeIndex: number, all = false, runeLevel
// Rune multiplier that gets applied to specific runes
const runeExpMultiplier = [
productContents([
1 + (player.researches[78] / 50), 1 + (player.researches[111] / 100), 1 + (CalcECC('reincarnation', player.challengecompletions[7]) / 10), droughtEffect
1 + (player.researches[78] / 50), 1 + (player.researches[111] / 100), 1 + (CalcECC(7) / 10), droughtEffect
]),
productContents([
1 + (player.researches[80] / 50), 1 + (player.researches[112] / 100), 1 + (CalcECC('reincarnation', player.challengecompletions[7]) / 10), droughtEffect
1 + (player.researches[80] / 50), 1 + (player.researches[112] / 100), 1 + (CalcECC(7) / 10), droughtEffect
]),
productContents([
1 + (player.researches[79] / 50), 1 + (player.researches[113] / 100), 1 + (CalcECC('reincarnation', player.challengecompletions[8]) / 5), droughtEffect
1 + (player.researches[79] / 50), 1 + (player.researches[113] / 100), 1 + (CalcECC(8) / 5), droughtEffect
]),
productContents([
1 + (player.researches[77] / 50), 1 + (player.researches[114] / 100), 1 + (CalcECC('reincarnation', player.challengecompletions[6]) / 10), droughtEffect
1 + (player.researches[77] / 50), 1 + (player.researches[114] / 100), 1 + (CalcECC(6) / 10), droughtEffect
]),
productContents([
1 + (player.researches[83] / 20), 1 + (player.researches[115] / 100), 1 + (CalcECC('reincarnation', player.challengecompletions[9]) / 5), droughtEffect
1 + (player.researches[83] / 20), 1 + (player.researches[115] / 100), 1 + (CalcECC(9) / 5), droughtEffect
]),
productContents([1]),
productContents([1])
Expand Down Expand Up @@ -236,8 +236,8 @@ export const calculateMaxRunes = (i: number) => {
let max = 1000;

const increaseAll = 20 * (player.cubeUpgrades[16] + player.cubeUpgrades[37])
+ 3 * player.constantUpgrades[7] + 80 * CalcECC('ascension', player.challengecompletions[11])
+ 200 * CalcECC('ascension', player.challengecompletions[14])
+ 3 * player.constantUpgrades[7] + 80 * CalcECC(11)
+ 200 * CalcECC(14)
+ Math.floor(0.04 * player.researches[200] + 0.04 * player.cubeUpgrades[50])
const increaseMaxLevel = [
null,
Expand Down Expand Up @@ -308,7 +308,7 @@ export function calculateOfferings(input: resetNames, calcMult = true, statistic
b += 0.2 * player.researches[24]
b += 1 / 200 * G['rune5level'] * G['effectiveLevelMult'] * (1 + player.researches[85] / 200)
b *= (1 + Math.pow(Decimal.log(player.transcendShards.add(1), 10), 1 / 2) / 5);
b *= (1 + CalcECC('reincarnation', player.challengecompletions[8]) / 25)
b *= (1 + CalcECC(8) / 25)
b *= Math.min(Math.pow(player.transcendcounter / 10, 2), 1)
if (player.transcendCount >= 5) {
b *= Math.max(1, player.transcendcounter / 10)
Expand All @@ -331,7 +331,7 @@ export function calculateOfferings(input: resetNames, calcMult = true, statistic
c += 0.2 * player.researches[24]
c += 1 / 200 * G['rune5level'] * G['effectiveLevelMult'] * (1 + player.researches[85] / 200)
c *= (1 + Math.pow(Decimal.log(player.prestigeShards.add(1), 10), 1 / 2) / 5);
c *= (1 + CalcECC('reincarnation', player.challengecompletions[6]) / 50)
c *= (1 + CalcECC(6) / 50)
c *= Math.min(Math.pow(player.prestigecounter / 10, 2), 1)
if (player.prestigeCount >= 5) {
c *= Math.max(1, player.prestigecounter / 10)
Expand All @@ -352,7 +352,7 @@ export function calculateOfferings(input: resetNames, calcMult = true, statistic
G['cubeBonusMultiplier'][3], // Brutus
1 + 0.02 * player.constantUpgrades[3], // Constant Upgrade 3
1 + 0.0003 * player.talismanLevels[3-1] * player.researches[149] + 0.0004 * player.talismanLevels[3-1] * player.researches[179], // Research 6x24,8x4
1 + 0.12 * CalcECC('ascension', player.challengecompletions[12]), // Challenge 12
1 + 0.12 * CalcECC(12), // Challenge 12
1 + 0.01 / 100 * player.researches[200], // Research 8x25
1 + Math.min(1, player.ascensionCount / 1e6) * player.achievements[187], // Ascension Count Achievement
1 + .6 * player.achievements[250] + 1 * player.achievements[251], // Sun&Moon Achievements
Expand Down Expand Up @@ -439,7 +439,7 @@ export const calculateObtainium = () => {
G['obtainiumGain'] *= (1 + 0.04 * player.constantUpgrades[4])
G['obtainiumGain'] *= (1 + 0.1 * player.cubeUpgrades[47])
G['obtainiumGain'] *= (1 + 0.1 * player.cubeUpgrades[3])
G['obtainiumGain'] *= (1 + 0.5 * CalcECC('ascension', player.challengecompletions[12]))
G['obtainiumGain'] *= (1 + 0.5 * CalcECC(12))
G['obtainiumGain'] *= (1 + calculateCorruptionPoints() / 400 * G['effectiveRuneSpiritPower'][4])
G['obtainiumGain'] *= (1 + 0.03 * Math.log(player.uncommonFragments + 1) / Math.log(4) * player.researches[144])
G['obtainiumGain'] *= (1 + 0.02 / 100 * player.cubeUpgrades[50])
Expand Down Expand Up @@ -693,9 +693,9 @@ export const calculateAnts = () => {

let bonusLevels = 0;
bonusLevels += 2 * (player.talismanRarity[6-1] - 1);
bonusLevels += CalcECC('reincarnation', player.challengecompletions[9]);
bonusLevels += CalcECC(9);
bonusLevels += 2 * player.constantUpgrades[6];
bonusLevels += 12 * CalcECC('ascension', player.challengecompletions[11]);
bonusLevels += 12 * CalcECC(11);
bonusLevels += Math.floor(1 / 200 * player.researches[200]);
bonusLevels *= G['challenge15Rewards'].bonusAntLevel
let c11 = 0;
Expand Down Expand Up @@ -756,7 +756,7 @@ export const calculateAntSacrificeELO = () => {
G['antELO'] += 25 * player.researches[108]
G['antELO'] += 25 * player.researches[109]
G['antELO'] += 40 * player.researches[123]
G['antELO'] += 100 * CalcECC('reincarnation', player.challengecompletions[10])
G['antELO'] += 100 * CalcECC(10)
G['antELO'] += 75 * player.upgrades[80]
G['antELO'] = 1 / 10 * Math.floor(10 * G['antELO'])

Expand Down Expand Up @@ -791,7 +791,7 @@ const calculateAntSacrificeMultipliers = () => {
G['upgradeMultiplier'] *= 1.25
}
G['upgradeMultiplier'] *= (1 + 20 / 3 * G['effectiveRuneBlessingPower'][3]);
G['upgradeMultiplier'] *= (1 + 1 / 50 * CalcECC('reincarnation', player.challengecompletions[10]));
G['upgradeMultiplier'] *= (1 + 1 / 50 * CalcECC(10));
G['upgradeMultiplier'] *= (1 + 1 / 50 * player.researches[122]);
G['upgradeMultiplier'] *= (1 + 3 / 100 * player.researches[133]);
G['upgradeMultiplier'] *= (1 + 2 / 100 * player.researches[163]);
Expand Down
Loading