From 6b6d4a688c8f3bf5a802ba62dc9243c192a5cab9 Mon Sep 17 00:00:00 2001 From: Porygon-Z208 <65074681+Porygon-Z208@users.noreply.github.com> Date: Sun, 10 May 2020 23:14:32 -0400 Subject: [PATCH 1/5] Update normal_dimension.js --- javascripts/core/normal_dimension.js | 63 +++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/javascripts/core/normal_dimension.js b/javascripts/core/normal_dimension.js index 744d0bd22..1dab2799d 100644 --- a/javascripts/core/normal_dimension.js +++ b/javascripts/core/normal_dimension.js @@ -232,11 +232,70 @@ function hasInfinityMult(tier) { return player[TIER_NAMES[tier]+"Bought"] % 10; } - function buyOneDimension(tier) { + function buyOneDimension(tier) { var name = TIER_NAMES[tier]; var cost = player[name + 'Cost']; auto = false; + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { + if (tier >= 2) { + if (player[TIER_NAMES[tier-1] + 'Amount'].lt(cost)) return false; + } else if (!canBuyDimension(tier)) { + return false; + } else if (tier < 2 && !canAfford(cost)){ + return false; + } + } else { + if (tier >= 3 && player.currentChallenge == "challenge10") { + if (player[TIER_NAMES[tier-2] + 'Amount'].lt(cost)) return false + } + else if (!canBuyDimension(tier)) { + return false; + } else if (tier < 3 && !canAfford(cost)){ + return false; + } + } + + + + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1" && tier < 2) { + if (!canAfford(cost)) { + return false; + } + } + + + if ((player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") || tier < 3) { + if (tier > 2) { + player[TIER_NAMES[tier-1] + 'Amount'] = player[TIER_NAMES[tier-1] + 'Amount'].minus(cost); + } else { + player.money = player.money.minus(cost); + } + } else { + player[TIER_NAMES[tier-2] + 'Amount'] = player[TIER_NAMES[tier-2] + 'Amount'].minus(cost) + } + + player[name + 'Amount'] = player[name + 'Amount'].plus(1); + player[name + 'Bought']++; + + if (dimBought(tier) === 0) { + player[name + 'Pow'] = player[name + 'Pow'].times(getDimensionPowerMultiplier(tier)); + if (player.currentChallenge != "challenge5" && player.currentChallenge != "postc5") player[name + 'Cost'] = player[name + 'Cost'].times(getDimensionCostMultiplier(tier)); + else if (player.currentChallenge == "postc5") multiplyPC5Costs(player[name + 'Cost'], tier) + else multiplySameCosts(cost); + if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) + floatText(name+"D", "x" + shortenMoney(getDimensionPowerMultiplier(tier))) + } + + if (player.currentChallenge == "challenge2" || player.currentChallenge == "postc1") player.chall2Pow = 0; + if (player.currentChallenge == "challenge8" || player.currentChallenge == "postc1") clearDimensions(tier-1); + + onBuyDimension(tier); + + + return true; + } + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { if (!canBuyDimension(tier)) { return false; @@ -570,4 +629,4 @@ function getDimensionProductionPerSecond(tier) { ret = Decimal.floor(player[TIER_NAMES[tier] + 'Amount']).times(getDimensionFinalMultiplier(tier)).times(1000).dividedBy(tick) } return ret; -} \ No newline at end of file +} From 1ce861502203a02c7a47447d3d502d33b76cb6c9 Mon Sep 17 00:00:00 2001 From: Porygon-Z208 <65074681+Porygon-Z208@users.noreply.github.com> Date: Sun, 10 May 2020 23:31:18 -0400 Subject: [PATCH 2/5] Update normal_dimension.js --- javascripts/core/normal_dimension.js | 53 +--------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/javascripts/core/normal_dimension.js b/javascripts/core/normal_dimension.js index 1dab2799d..6bc2c7c16 100644 --- a/javascripts/core/normal_dimension.js +++ b/javascripts/core/normal_dimension.js @@ -295,58 +295,7 @@ function hasInfinityMult(tier) { return true; } - - if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { - if (!canBuyDimension(tier)) { - return false; - } - } else { - if (tier >= 3) { - if (player[TIER_NAMES[tier-2] + 'Amount'].lt(cost)) return false - } - else if (!canBuyDimension(tier)) { - return false; - } else if (tier < 3 && !canAfford(cost)){ - return false; - } - } - - - - if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { - if (!canAfford(cost)) { - return false; - } - } - - - if ((player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") || tier < 3) { - player.money = player.money.minus(cost); - } else { - player[TIER_NAMES[tier-2] + 'Amount'] = player[TIER_NAMES[tier-2] + 'Amount'].minus(cost) - } - - player[name + 'Amount'] = player[name + 'Amount'].plus(1); - player[name + 'Bought']++; - - if (dimBought(tier) === 0) { - player[name + 'Pow'] = player[name + 'Pow'].times(getDimensionPowerMultiplier(tier)); - if (player.currentChallenge != "challenge5" && player.currentChallenge != "postc5") player[name + 'Cost'] = player[name + 'Cost'].times(getDimensionCostMultiplier(tier)); - else if (player.currentChallenge == "postc5") multiplyPC5Costs(player[name + 'Cost'], tier) - else multiplySameCosts(cost); - if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) - floatText(name+"D", "x" + shortenMoney(getDimensionPowerMultiplier(tier))) - } - - if (player.currentChallenge == "challenge2" || player.currentChallenge == "postc1") player.chall2Pow = 0; - if (player.currentChallenge == "challenge8" || player.currentChallenge == "postc1") clearDimensions(tier-1); - - onBuyDimension(tier); - - - return true; - } - + function buyManyDimension(tier) { var name = TIER_NAMES[tier]; var cost = player[name + 'Cost'].times(10 - dimBought(tier)); From fa8f499a30846844d2163211b6d24726f32cf770 Mon Sep 17 00:00:00 2001 From: Porygon-Z208 <65074681+Porygon-Z208@users.noreply.github.com> Date: Tue, 12 May 2020 10:21:18 -0400 Subject: [PATCH 3/5] dims cost dims --- javascripts/core/normal_dimension.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascripts/core/normal_dimension.js b/javascripts/core/normal_dimension.js index 6bc2c7c16..a87d5fc6a 100644 --- a/javascripts/core/normal_dimension.js +++ b/javascripts/core/normal_dimension.js @@ -232,7 +232,7 @@ function hasInfinityMult(tier) { return player[TIER_NAMES[tier]+"Bought"] % 10; } - function buyOneDimension(tier) { + function buyOneDimension(tier) { var name = TIER_NAMES[tier]; var cost = player[name + 'Cost']; auto = false; @@ -295,7 +295,7 @@ function hasInfinityMult(tier) { return true; } - + function buyManyDimension(tier) { var name = TIER_NAMES[tier]; var cost = player[name + 'Cost'].times(10 - dimBought(tier)); From eb3715c3bcc64572903833f45e9c622eb7a81301 Mon Sep 17 00:00:00 2001 From: Porygon-Z208 <65074681+Porygon-Z208@users.noreply.github.com> Date: Tue, 12 May 2020 10:36:07 -0400 Subject: [PATCH 4/5] probably just broke it --- javascripts/core/normal_dimension.js | 220 ++++++++++++++------------- 1 file changed, 111 insertions(+), 109 deletions(-) diff --git a/javascripts/core/normal_dimension.js b/javascripts/core/normal_dimension.js index a87d5fc6a..f736b8e0c 100644 --- a/javascripts/core/normal_dimension.js +++ b/javascripts/core/normal_dimension.js @@ -353,119 +353,121 @@ function hasInfinityMult(tier) { const costMults = [null, new Decimal(1e3), new Decimal(1e4), new Decimal(1e5), new Decimal(1e6), new Decimal(1e8), new Decimal(1e10), new Decimal(1e12), new Decimal(1e15)] function buyManyDimensionAutobuyer(tier, bulk) { - var name = TIER_NAMES[tier]; - var cost = player[name + 'Cost'].times(10 - dimBought(tier)) - if (!player.break && player.money.gt(Number.MAX_VALUE)) return false; - - if (tier >= 3 && (player.currentChallenge == "challenge10" || player.currentChallenge == "postc1")) { - if (!canBuyDimension(tier)) return false - if (player[TIER_NAMES[tier-2] + 'Amount'].lt(cost)) return false - if (canBuyDimension(tier)) { - if (cost.lt(player[TIER_NAMES[tier-2]+"Amount"]) && dimBought(tier) != 0) { - player[TIER_NAMES[tier-2]+"Amount"] = player[TIER_NAMES[tier-2]+"Amount"].minus(cost) - player[name + "Amount"] = Decimal.round(player[name + "Amount"].plus(10 - dimBought(tier))) - player[name + 'Bought'] += (10 - dimBought(tier)); - player[name + 'Pow'] = player[name + 'Pow'].times(getDimensionPowerMultiplier(tier)) - player[name + "Cost"] = player[name + "Cost"].times(getDimensionCostMultiplier(tier)) - } - var x = bulk - while (player[TIER_NAMES[tier-2]+"Amount"].gt(player[name + "Cost"].times(10)) && x > 0) { - player[TIER_NAMES[tier-2]+"Amount"] = player[TIER_NAMES[tier-2]+"Amount"].minus(player[name + "Cost"].times(10)) - player[name + "Cost"] = player[name + "Cost"].times(getDimensionCostMultiplier(tier)) - player[name + "Amount"] = Decimal.round(player[name + "Amount"].plus(10)) - player[name + 'Bought'] += 10 - player[name + "Pow"] = player[name + "Pow"].times(getDimensionPowerMultiplier(tier)) - if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) - x--; - } - - - onBuyDimension(tier); - } + var name = TIER_NAMES[tier]; + var cost = player[name + 'Cost']; + auto = false; + + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { + if (tier >= 2) { + if (player[TIER_NAMES[tier-1] + 'Amount'].lt(cost)) return false; + } else if (!canBuyDimension(tier)) { + return false; + } else if (tier < 2 && !canAfford(cost)){ + return false; + } } else { - if (!canBuyDimension(tier)) return false - if (cost.lt(player.money) && dimBought(tier) != 0) { - player.money = player.money.minus(cost) - player[name + "Amount"] = Decimal.round(player[name + "Amount"].plus(10 - dimBought(tier))) - player[name + 'Bought'] += (10 - dimBought(tier)); - player[name + 'Pow'] = player[name + 'Pow'].times(getDimensionPowerMultiplier(tier)) - player[name + "Cost"] = player[name + "Cost"].times(getDimensionCostMultiplier(tier)) - } - if (player.money.lt(player[name + "Cost"].times(10))) return false - var x = bulk - - if ((player.dimensionMultDecrease > 3 || player.currentChallenge == "postc5" || player.currentChallenge == "challenge5")) { - while (player.money.gte(player[name + "Cost"].times(10)) && x > 0) { - player.money = player.money.minus(player[name + "Cost"].times(10)) - if (player.currentChallenge != "challenge5" && player.currentChallenge != "postc5") player[name + "Cost"] = player[name + "Cost"].times(getDimensionCostMultiplier(tier)) - else if (player.currentChallenge == "postc5") multiplyPC5Costs(player[name + 'Cost'], tier) - else multiplySameCosts(player[name + 'Cost']) - player[name + "Amount"] = Decimal.round(player[name + "Amount"].plus(10)) - player[name + 'Bought'] += 10 - player[name + "Pow"] = player[name + "Pow"].times(getDimensionPowerMultiplier(tier)) - if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) - if (player.currentChallenge == "challenge8") clearDimensions(tier-1) - x--; - } + if (tier >= 3 && player.currentChallenge == "challenge10") { + if (player[TIER_NAMES[tier-2] + 'Amount'].lt(cost)) return false + } + else if (!canBuyDimension(tier)) { + return false; + } else if (tier < 3 && !canAfford(cost)){ + return false; + } + } + + + + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1" && tier < 2) { + if (!canAfford(cost)) { + return false; + } + } + + + if ((player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") || tier < 3) { + if (tier > 2) { + player[TIER_NAMES[tier-1] + 'Amount'] = player[TIER_NAMES[tier-1] + 'Amount'].minus(cost); } else { - if (player[name + "Cost"].lt(Number.MAX_VALUE)) { - let failsafe = 0 - while (player.money.gt(player[name + "Cost"].times(10)) && x > 0 && player[name + "Cost"].lte(Number.MAX_VALUE) && failsafe < 150) { - player.money = player.money.minus(player[name + "Cost"].times(10)) - if (player.currentChallenge != "challenge5" && player.currentChallenge != "postc5") player[name + "Cost"] = player[name + "Cost"].times(getDimensionCostMultiplier(tier)) - else if (player.currentChallenge == "postc5") multiplyPC5Costs(player[name + 'Cost'], tier) - else multiplySameCosts(player[name + 'Cost']) - player[name + "Amount"] = Decimal.round(player[name + "Amount"].plus(10)) - player[name + 'Bought'] += 10 - player[name + "Pow"] = player[name + "Pow"].times(getDimensionPowerMultiplier(tier)) - if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) - if (player.currentChallenge == "challenge8") clearDimensions(tier-1) - x--; - failsafe++; - } - } - if (player[name + "Cost"].gte(Number.MAX_VALUE)) { - var a = Math.log10(Math.sqrt(player.dimensionMultDecrease)) - var b = player.costMultipliers[tier-1].dividedBy(Math.sqrt(player.dimensionMultDecrease)).log10() - var c = player[name + "Cost"].dividedBy(player.money).log10() - var discriminant = Math.pow(b, 2) - (c *a* 4) - if (discriminant < 0) return false - var buying = Math.floor((Math.sqrt(Math.pow(b, 2) - (c *a *4))-b)/(2 * a))+1 - if (buying <= 0) return false - if (buying > bulk) buying = bulk - player[name+"Amount"] = Decimal.round(player[name+"Amount"].plus(10*buying)) - preInfBuy = Math.floor(1 + (308 - initCost[tier].log10()) / costMults[tier].log10()) - postInfBuy = player[name + 'Bought']/10+buying - preInfBuy - 1 - postInfInitCost = initCost[tier].times(Decimal.pow(costMults[tier], preInfBuy)) - player[name + 'Bought'] += 10*buying - player[name + "Pow"] = player[name + "Pow"].times(Decimal.pow(getDimensionPowerMultiplier(tier), buying)) - - newCost = postInfInitCost.times(Decimal.pow(costMults[tier], postInfBuy)).times(Decimal.pow(player.dimensionMultDecrease, postInfBuy * (postInfBuy+1)/2)) - newMult = costMults[tier].times(Decimal.pow(player.dimensionMultDecrease, postInfBuy+1)) - //if (buying > 0 )player[name + "Cost"] = player.costMultipliers[tier-1].times(Decimal.pow(player.dimensionMultDecrease, (buying * buying - buying)/2)).times(player[name + "Cost"]) - - player[name + "Cost"] = newCost - player.costMultipliers[tier-1] = newMult - if (player.money.gte(player[name + "Cost"])) player.money = player.money.minus(player[name + "Cost"]) - player[name + "Cost"] = player[name + "Cost"].times(player.costMultipliers[tier-1]) - player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) - } + player.money = player.money.minus(cost); } + } else { + player[TIER_NAMES[tier-2] + 'Amount'] = player[TIER_NAMES[tier-2] + 'Amount'].minus(cost) } - if ((player.currentChallenge == "challenge12" || player.currentChallenge == "postc1" || player.currentChallenge == "postc6") && player.matter.equals(0)) player.matter = new Decimal(1); - if (player.currentChallenge == "challenge2" || player.currentChallenge == "postc1") player.chall2Pow = 0; - if (player.currentChallenge == "postc1") clearDimensions(tier-1); - player.postC4Tier = tier; - if (tier != 8) player.dimlife = false - if (tier != 1) player.dead = false -} - - -function canAfford(cost) { - return ((cost.lt(new Decimal("1.79e308")) && !player.break) || player.break) && cost.lte(player.money); -} - - + + player[name + 'Amount'] = player[name + 'Amount'].plus(1); + player[name + 'Bought']++; + + if (dimBought(tier) === 0) { + player[name + 'Pow'] = player[name + 'Pow'].times(getDimensionPowerMultiplier(tier)); + if (player.currentChallenge != "challenge5" && player.currentChallenge != "postc5") player[name + 'Cost'] = player[name + 'Cost'].times(getDimensionCostMultiplier(tier)); + else if (player.currentChallenge == "postc5") multiplyPC5Costs(player[name + 'Cost'], tier) + else multiplySameCosts(cost); + if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) + floatText(name+"D", "x" + shortenMoney(getDimensionPowerMultiplier(tier))) + } + + if (player.currentChallenge == "challenge2" || player.currentChallenge == "postc1") player.chall2Pow = 0; + if (player.currentChallenge == "challenge8" || player.currentChallenge == "postc1") clearDimensions(tier-1); + + onBuyDimension(tier); + + + return true; + } + + function buyManyDimension(tier) { + var name = TIER_NAMES[tier]; + var cost = player[name + 'Cost'].times(10 - dimBought(tier)); + + auto = false; + + if ((player.currentChallenge == "challenge12" || player.currentChallenge == "postc1" || player.currentChallenge == "postc6") && player.matter.equals(0)) player.matter = new Decimal(1); + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { + if (!canBuyDimension(tier)) { + return false; + } + } else { + if (tier >= 3) { + if (!canBuyDimension(tier)) return false + if (player[TIER_NAMES[tier-2] + 'Amount'].lt(cost)) return false + } + else if (!canBuyDimension(tier)) { + return false; + } else if (tier < 3 && !canAfford(cost)){ + return false; + } + } + + + + if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { + if (!canAfford(cost)) { + return false; + } + } + + if ((player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") || tier < 3) { + player.money = player.money.minus(cost); + } else { + player[TIER_NAMES[tier-2] + 'Amount'] = player[TIER_NAMES[tier-2] + 'Amount'].minus(cost) + } + + player[name + 'Amount'] = player[name + 'Amount'].plus(10 - dimBought(tier)); + player[name + 'Bought'] = player[name + 'Bought'] + (10 - dimBought(tier)); + player[name + 'Pow'] = player[name + 'Pow'].times(getDimensionPowerMultiplier(tier)); + if (player.currentChallenge != "challenge5" && player.currentChallenge != "postc5" ) player[name + 'Cost'] = player[name + 'Cost'].times((getDimensionCostMultiplier(tier))); + else if (player.currentChallenge == "postc5") multiplyPC5Costs(player[name + 'Cost'], tier) + else multiplySameCosts(player[name + 'Cost']); + if (player[name + 'Cost'].gte(Number.MAX_VALUE)) player.costMultipliers[tier-1] = player.costMultipliers[tier-1].times(player.dimensionMultDecrease) + if (player.currentChallenge == "challenge2" || player.currentChallenge == "postc1") player.chall2Pow = 0; + if (player.currentChallenge == "challenge8" || player.currentChallenge == "postc1") clearDimensions(tier-1); + floatText(name+"D", "x" + shortenMoney(getDimensionPowerMultiplier(tier))) + onBuyDimension(tier); + + return true; + } + document.getElementById("first").onclick = function () { if (buyOneDimension(1)) { // This achievement is granted only if the buy one button is pressed. From 47fbe0be8081badd534fece653681945fa48f274 Mon Sep 17 00:00:00 2001 From: Porygon-Z208 <65074681+Porygon-Z208@users.noreply.github.com> Date: Wed, 13 May 2020 07:43:37 -0400 Subject: [PATCH 5/5] Update normal_dimension.js --- javascripts/core/normal_dimension.js | 1 + 1 file changed, 1 insertion(+) diff --git a/javascripts/core/normal_dimension.js b/javascripts/core/normal_dimension.js index f736b8e0c..2511ee177 100644 --- a/javascripts/core/normal_dimension.js +++ b/javascripts/core/normal_dimension.js @@ -304,6 +304,7 @@ function hasInfinityMult(tier) { if ((player.currentChallenge == "challenge12" || player.currentChallenge == "postc1" || player.currentChallenge == "postc6") && player.matter.equals(0)) player.matter = new Decimal(1); if (player.currentChallenge != "challenge10" && player.currentChallenge != "postc1") { + if (dimension[tier-1].amount >= dimension[tier].cost * 10) if (!canBuyDimension(tier)) { return false; }