Added prettier (#661)

* Added prettier

* Added prettier

* Added prettier
This commit is contained in:
Daniël van Noord
2021-03-14 18:57:07 +01:00
committed by GitHub
parent f3e7964262
commit 932509a877
132 changed files with 7143 additions and 4894 deletions

View File

@@ -8,7 +8,16 @@ import SimHas from '../ReplacedGameFunctions/SimHas';
import SimHasGod from '../ReplacedGameFunctions/SimHasGod';
import SimWin from '../SimulationData/SimWin';
import {
SimAchievementsOwned, SimCookiesPs, SimCookiesPsRaw, SimDateAges, SimDateCentury, SimEffs, SimHeavenlyPower, SimObjects, SimPrestige, SimUpgrades,
SimAchievementsOwned,
SimCookiesPs,
SimCookiesPsRaw,
SimDateAges,
SimDateCentury,
SimEffs,
SimHeavenlyPower,
SimObjects,
SimPrestige,
SimUpgrades,
} from '../VariablesAndData';
/**
@@ -18,201 +27,232 @@ import {
* @global {number} CM.Sim.cookiesPs The CPS of the current sim data
*/
export default function CalculateGains() {
SimCookiesPs = 0;
let mult = 1;
// Include minigame effects
const effs = {};
for (const i of Object.keys(Game.Objects)) {
if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs) {
const myEffs = Game.Objects[i].minigame.effs;
for (const ii in myEffs) {
if (effs[ii]) effs[ii] *= myEffs[ii];
else effs[ii] = myEffs[ii];
}
}
}
SimEffs = effs;
SimCookiesPs = 0;
let mult = 1;
// Include minigame effects
const effs = {};
for (const i of Object.keys(Game.Objects)) {
if (Game.Objects[i].minigameLoaded && Game.Objects[i].minigame.effs) {
const myEffs = Game.Objects[i].minigame.effs;
for (const ii in myEffs) {
if (effs[ii]) effs[ii] *= myEffs[ii];
else effs[ii] = myEffs[ii];
}
}
}
SimEffs = effs;
if (Game.ascensionMode !== 1) mult += parseFloat(SimPrestige) * 0.01 * SimHeavenlyPower * SimGetHeavenlyMultiplier();
if (Game.ascensionMode !== 1)
mult +=
parseFloat(SimPrestige) *
0.01 *
SimHeavenlyPower *
SimGetHeavenlyMultiplier();
mult *= SimEff('cps');
mult *= SimEff('cps');
if (SimHas('Heralds') && Game.ascensionMode !== 1) mult *= 1 + 0.01 * Game.heralds;
if (SimHas('Heralds') && Game.ascensionMode !== 1)
mult *= 1 + 0.01 * Game.heralds;
for (const i of Object.keys(Game.cookieUpgrades)) {
const me = Game.cookieUpgrades[i];
if (SimHas(me.name)) {
// Some upgrades have a functio as .power (notably the valentine cookies)
// CM.Sim.InitialBuildingData has changed to use CM.Sim.Has instead of Game.Has etc.
// Therefore this call is to the .power of the Sim.Object
if (typeof (me.power) === 'function') {
mult *= 1 + (SimUpgrades[me.name].power(SimUpgrades[me.name]) * 0.01);
} else mult *= 1 + (me.power * 0.01);
}
}
for (const i of Object.keys(Game.cookieUpgrades)) {
const me = Game.cookieUpgrades[i];
if (SimHas(me.name)) {
// Some upgrades have a functio as .power (notably the valentine cookies)
// CM.Sim.InitialBuildingData has changed to use CM.Sim.Has instead of Game.Has etc.
// Therefore this call is to the .power of the Sim.Object
if (typeof me.power === 'function') {
mult *= 1 + SimUpgrades[me.name].power(SimUpgrades[me.name]) * 0.01;
} else mult *= 1 + me.power * 0.01;
}
}
if (SimHas('Specialized chocolate chips')) mult *= 1.01;
if (SimHas('Designer cocoa beans')) mult *= 1.02;
if (SimHas('Underworld ovens')) mult *= 1.03;
if (SimHas('Exotic nuts')) mult *= 1.04;
if (SimHas('Arcane sugar')) mult *= 1.05;
if (SimHas('Specialized chocolate chips')) mult *= 1.01;
if (SimHas('Designer cocoa beans')) mult *= 1.02;
if (SimHas('Underworld ovens')) mult *= 1.03;
if (SimHas('Exotic nuts')) mult *= 1.04;
if (SimHas('Arcane sugar')) mult *= 1.05;
if (SimHas('Increased merriness')) mult *= 1.15;
if (SimHas('Improved jolliness')) mult *= 1.15;
if (SimHas('A lump of coal')) mult *= 1.01;
if (SimHas('An itchy sweater')) mult *= 1.01;
if (SimHas('Santa\'s dominion')) mult *= 1.2;
if (SimHas('Increased merriness')) mult *= 1.15;
if (SimHas('Improved jolliness')) mult *= 1.15;
if (SimHas('A lump of coal')) mult *= 1.01;
if (SimHas('An itchy sweater')) mult *= 1.01;
if (SimHas("Santa's dominion")) mult *= 1.2;
if (SimHas('Fortune #100')) mult *= 1.01;
if (SimHas('Fortune #101')) mult *= 1.07;
if (SimHas('Fortune #100')) mult *= 1.01;
if (SimHas('Fortune #101')) mult *= 1.07;
if (SimHas('Dragon scale')) mult *= 1.03;
if (SimHas('Dragon scale')) mult *= 1.03;
// Check effect of chosen Gods
let buildMult = 1;
if (SimHasGod) {
let godLvl = SimHasGod('asceticism');
if (godLvl === 1) mult *= 1.15;
else if (godLvl === 2) mult *= 1.1;
else if (godLvl === 3) mult *= 1.05;
// Check effect of chosen Gods
let buildMult = 1;
if (SimHasGod) {
let godLvl = SimHasGod('asceticism');
if (godLvl === 1) mult *= 1.15;
else if (godLvl === 2) mult *= 1.1;
else if (godLvl === 3) mult *= 1.05;
godLvl = SimHasGod('ages');
if (godLvl === 1) mult *= 1 + 0.15 * Math.sin((SimDateAges / 1000 / (60 * 60 * 3)) * Math.PI * 2);
else if (godLvl === 2) mult *= 1 + 0.15 * Math.sin((SimDateAges / 1000 / (60 * 60 * 12)) * Math.PI * 2);
else if (godLvl === 3) mult *= 1 + 0.15 * Math.sin((SimDateAges / 1000 / (60 * 60 * 24)) * Math.PI * 2);
godLvl = SimHasGod('ages');
if (godLvl === 1)
mult *=
1 + 0.15 * Math.sin((SimDateAges / 1000 / (60 * 60 * 3)) * Math.PI * 2);
else if (godLvl === 2)
mult *=
1 +
0.15 * Math.sin((SimDateAges / 1000 / (60 * 60 * 12)) * Math.PI * 2);
else if (godLvl === 3)
mult *=
1 +
0.15 * Math.sin((SimDateAges / 1000 / (60 * 60 * 24)) * Math.PI * 2);
godLvl = SimHasGod('decadence');
if (godLvl === 1) buildMult *= 0.93;
else if (godLvl === 2) buildMult *= 0.95;
else if (godLvl === 3) buildMult *= 0.98;
godLvl = SimHasGod('decadence');
if (godLvl === 1) buildMult *= 0.93;
else if (godLvl === 2) buildMult *= 0.95;
else if (godLvl === 3) buildMult *= 0.98;
godLvl = SimHasGod('industry');
if (godLvl === 1) buildMult *= 1.1;
else if (godLvl === 2) buildMult *= 1.06;
else if (godLvl === 3) buildMult *= 1.03;
godLvl = SimHasGod('industry');
if (godLvl === 1) buildMult *= 1.1;
else if (godLvl === 2) buildMult *= 1.06;
else if (godLvl === 3) buildMult *= 1.03;
godLvl = SimHasGod('labor');
if (godLvl === 1) buildMult *= 0.97;
else if (godLvl === 2) buildMult *= 0.98;
else if (godLvl === 3) buildMult *= 0.99;
}
godLvl = SimHasGod('labor');
if (godLvl === 1) buildMult *= 0.97;
else if (godLvl === 2) buildMult *= 0.98;
else if (godLvl === 3) buildMult *= 0.99;
}
if (SimHas('Santa\'s legacy')) mult *= 1 + (Game.santaLevel + 1) * 0.03;
if (SimHas("Santa's legacy")) mult *= 1 + (Game.santaLevel + 1) * 0.03;
const milkProgress = SimAchievementsOwned / 25;
let milkMult = 1;
if (SimHas('Santa\'s milk and cookies')) milkMult *= 1.05;
// if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05;
milkMult *= 1 + SimAuraMult('Breath of Milk') * 0.05;
if (SimHasGod) {
const godLvl = SimHasGod('mother');
if (godLvl === 1) milkMult *= 1.1;
else if (godLvl === 2) milkMult *= 1.05;
else if (godLvl === 3) milkMult *= 1.03;
}
milkMult *= SimEff('milk');
const milkProgress = SimAchievementsOwned / 25;
let milkMult = 1;
if (SimHas("Santa's milk and cookies")) milkMult *= 1.05;
// if (CM.Sim.hasAura('Breath of Milk')) milkMult *= 1.05;
milkMult *= 1 + SimAuraMult('Breath of Milk') * 0.05;
if (SimHasGod) {
const godLvl = SimHasGod('mother');
if (godLvl === 1) milkMult *= 1.1;
else if (godLvl === 2) milkMult *= 1.05;
else if (godLvl === 3) milkMult *= 1.03;
}
milkMult *= SimEff('milk');
let catMult = 1;
let catMult = 1;
if (SimHas('Kitten helpers')) catMult *= (1 + milkProgress * 0.1 * milkMult);
if (SimHas('Kitten workers')) catMult *= (1 + milkProgress * 0.125 * milkMult);
if (SimHas('Kitten engineers')) catMult *= (1 + milkProgress * 0.15 * milkMult);
if (SimHas('Kitten overseers')) catMult *= (1 + milkProgress * 0.175 * milkMult);
if (SimHas('Kitten managers')) catMult *= (1 + milkProgress * 0.2 * milkMult);
if (SimHas('Kitten accountants')) catMult *= (1 + milkProgress * 0.2 * milkMult);
if (SimHas('Kitten specialists')) catMult *= (1 + milkProgress * 0.2 * milkMult);
if (SimHas('Kitten experts')) catMult *= (1 + milkProgress * 0.2 * milkMult);
if (SimHas('Kitten consultants')) catMult *= (1 + milkProgress * 0.2 * milkMult);
if (SimHas('Kitten assistants to the regional manager')) catMult *= (1 + milkProgress * 0.175 * milkMult);
if (SimHas('Kitten marketeers')) catMult *= (1 + milkProgress * 0.15 * milkMult);
if (SimHas('Kitten analysts')) catMult *= (1 + milkProgress * 0.125 * milkMult);
if (SimHas('Kitten executives')) catMult *= (1 + milkProgress * 0.115 * milkMult);
if (SimHas('Kitten angels')) catMult *= (1 + milkProgress * 0.1 * milkMult);
if (SimHas('Fortune #103')) catMult *= (1 + milkProgress * 0.05 * milkMult);
if (SimHas('Kitten helpers')) catMult *= 1 + milkProgress * 0.1 * milkMult;
if (SimHas('Kitten workers')) catMult *= 1 + milkProgress * 0.125 * milkMult;
if (SimHas('Kitten engineers')) catMult *= 1 + milkProgress * 0.15 * milkMult;
if (SimHas('Kitten overseers'))
catMult *= 1 + milkProgress * 0.175 * milkMult;
if (SimHas('Kitten managers')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten accountants'))
catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten specialists'))
catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten experts')) catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten consultants'))
catMult *= 1 + milkProgress * 0.2 * milkMult;
if (SimHas('Kitten assistants to the regional manager'))
catMult *= 1 + milkProgress * 0.175 * milkMult;
if (SimHas('Kitten marketeers'))
catMult *= 1 + milkProgress * 0.15 * milkMult;
if (SimHas('Kitten analysts')) catMult *= 1 + milkProgress * 0.125 * milkMult;
if (SimHas('Kitten executives'))
catMult *= 1 + milkProgress * 0.115 * milkMult;
if (SimHas('Kitten angels')) catMult *= 1 + milkProgress * 0.1 * milkMult;
if (SimHas('Fortune #103')) catMult *= 1 + milkProgress * 0.05 * milkMult;
for (const i of Object.keys(SimObjects)) {
const me = SimObjects[i];
let storedCps = me.cps(me);
if (Game.ascensionMode !== 1) storedCps *= (1 + me.level * 0.01) * buildMult;
if (me.name === 'Grandma' && SimHas('Milkhelp® lactose intolerance relief tablets')) storedCps *= 1 + 0.05 * milkProgress * milkMult;
SimCookiesPs += me.amount * storedCps;
}
for (const i of Object.keys(SimObjects)) {
const me = SimObjects[i];
let storedCps = me.cps(me);
if (Game.ascensionMode !== 1)
storedCps *= (1 + me.level * 0.01) * buildMult;
if (
me.name === 'Grandma' &&
SimHas('Milkhelp® lactose intolerance relief tablets')
)
storedCps *= 1 + 0.05 * milkProgress * milkMult;
SimCookiesPs += me.amount * storedCps;
}
if (SimHas('"egg"')) SimCookiesPs += 9;// "egg"
if (SimHas('"egg"')) SimCookiesPs += 9; // "egg"
mult *= catMult;
mult *= catMult;
let eggMult = 1;
if (SimHas('Chicken egg')) eggMult *= 1.01;
if (SimHas('Duck egg')) eggMult *= 1.01;
if (SimHas('Turkey egg')) eggMult *= 1.01;
if (SimHas('Quail egg')) eggMult *= 1.01;
if (SimHas('Robin egg')) eggMult *= 1.01;
if (SimHas('Ostrich egg')) eggMult *= 1.01;
if (SimHas('Cassowary egg')) eggMult *= 1.01;
if (SimHas('Salmon roe')) eggMult *= 1.01;
if (SimHas('Frogspawn')) eggMult *= 1.01;
if (SimHas('Shark egg')) eggMult *= 1.01;
if (SimHas('Turtle egg')) eggMult *= 1.01;
if (SimHas('Ant larva')) eggMult *= 1.01;
if (SimHas('Century egg')) {
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day
let day = Math.floor((SimDateCentury - Game.startDate) / 1000 / 10) * 10 / 60 / 60 / 24;
day = Math.min(day, 100);
// Sets a Cache value to be displayed in the Stats page, could be moved...
CacheCentEgg = 1 + (1 - (1 - day / 100) ** 3) * 0.1;
eggMult *= CacheCentEgg;
}
mult *= eggMult;
let eggMult = 1;
if (SimHas('Chicken egg')) eggMult *= 1.01;
if (SimHas('Duck egg')) eggMult *= 1.01;
if (SimHas('Turkey egg')) eggMult *= 1.01;
if (SimHas('Quail egg')) eggMult *= 1.01;
if (SimHas('Robin egg')) eggMult *= 1.01;
if (SimHas('Ostrich egg')) eggMult *= 1.01;
if (SimHas('Cassowary egg')) eggMult *= 1.01;
if (SimHas('Salmon roe')) eggMult *= 1.01;
if (SimHas('Frogspawn')) eggMult *= 1.01;
if (SimHas('Shark egg')) eggMult *= 1.01;
if (SimHas('Turtle egg')) eggMult *= 1.01;
if (SimHas('Ant larva')) eggMult *= 1.01;
if (SimHas('Century egg')) {
// The boost increases a little every day, with diminishing returns up to +10% on the 100th day
let day =
(Math.floor((SimDateCentury - Game.startDate) / 1000 / 10) * 10) /
60 /
60 /
24;
day = Math.min(day, 100);
// Sets a Cache value to be displayed in the Stats page, could be moved...
CacheCentEgg = 1 + (1 - (1 - day / 100) ** 3) * 0.1;
eggMult *= CacheCentEgg;
}
mult *= eggMult;
if (SimHas('Sugar baking')) mult *= (1 + Math.min(100, Game.lumps) * 0.01);
if (SimHas('Sugar baking')) mult *= 1 + Math.min(100, Game.lumps) * 0.01;
// if (CM.Sim.hasAura('Radiant Appetite')) mult *= 2;
mult *= 1 + SimAuraMult('Radiant Appetite');
// if (CM.Sim.hasAura('Radiant Appetite')) mult *= 2;
mult *= 1 + SimAuraMult('Radiant Appetite');
const rawCookiesPs = SimCookiesPs * mult;
for (const i of Object.keys(Game.CpsAchievements)) {
if (rawCookiesPs >= Game.CpsAchievements[i].threshold) SimWin(Game.CpsAchievements[i].name);
}
const rawCookiesPs = SimCookiesPs * mult;
for (const i of Object.keys(Game.CpsAchievements)) {
if (rawCookiesPs >= Game.CpsAchievements[i].threshold)
SimWin(Game.CpsAchievements[i].name);
}
SimCookiesPsRaw = rawCookiesPs;
SimCookiesPsRaw = rawCookiesPs;
const n = Game.shimmerTypes.golden.n;
const auraMult = SimAuraMult('Dragon\'s Fortune');
for (let i = 0; i < n; i++) {
mult *= 1 + auraMult * 1.23;
}
const n = Game.shimmerTypes.golden.n;
const auraMult = SimAuraMult("Dragon's Fortune");
for (let i = 0; i < n; i++) {
mult *= 1 + auraMult * 1.23;
}
const name = Game.bakeryName.toLowerCase();
if (name === 'orteil') mult *= 0.99;
else if (name === 'ortiel') mult *= 0.98;
const name = Game.bakeryName.toLowerCase();
if (name === 'orteil') mult *= 0.99;
else if (name === 'ortiel') mult *= 0.98;
if (SimHas('Elder Covenant')) mult *= 0.95;
if (SimHas('Elder Covenant')) mult *= 0.95;
if (SimHas('Golden switch [off]')) {
let goldenSwitchMult = 1.5;
if (SimHas('Residual luck')) {
const upgrades = Game.goldenCookieUpgrades;
for (const i of Object.keys(upgrades)) {
if (SimHas(upgrades[i])) goldenSwitchMult += 0.1;
}
}
mult *= goldenSwitchMult;
}
if (SimHas('Shimmering veil [off]')) {
let veilMult = 0.5;
if (SimHas('Reinforced membrane')) veilMult += 0.1;
mult *= 1 + veilMult;
}
if (SimHas('Golden switch [off]')) {
let goldenSwitchMult = 1.5;
if (SimHas('Residual luck')) {
const upgrades = Game.goldenCookieUpgrades;
for (const i of Object.keys(upgrades)) {
if (SimHas(upgrades[i])) goldenSwitchMult += 0.1;
}
}
mult *= goldenSwitchMult;
}
if (SimHas('Shimmering veil [off]')) {
let veilMult = 0.5;
if (SimHas('Reinforced membrane')) veilMult += 0.1;
mult *= 1 + veilMult;
}
if (SimHas('Magic shenanigans')) mult *= 1000;
if (SimHas('Occult obstruction')) mult *= 0;
if (SimHas('Magic shenanigans')) mult *= 1000;
if (SimHas('Occult obstruction')) mult *= 0;
SimCookiesPs = Game.runModHookOnValue('cps', SimCookiesPs);
SimCookiesPs = Game.runModHookOnValue('cps', SimCookiesPs);
mult *= GetCPSBuffMult();
mult *= GetCPSBuffMult();
SimCookiesPs *= mult;
SimCookiesPs *= mult;
// if (Game.hasBuff('Cursed finger')) Game.cookiesPs = 0;
// if (Game.hasBuff('Cursed finger')) Game.cookiesPs = 0;
}

View File

@@ -10,79 +10,89 @@ import { SimObjects, SimUpgradesOwned } from '../VariablesAndData';
* It is called at the end of any functions that simulates certain behaviour
*/
export default function CheckOtherAchiev() {
let grandmas = 0;
for (const i of Object.keys(Game.GrandmaSynergies)) {
if (SimHas(Game.GrandmaSynergies[i])) grandmas++;
}
if (!SimHasAchiev('Elder') && grandmas >= 7) SimWin('Elder');
if (!SimHasAchiev('Veteran') && grandmas >= 14) SimWin('Veteran');
let grandmas = 0;
for (const i of Object.keys(Game.GrandmaSynergies)) {
if (SimHas(Game.GrandmaSynergies[i])) grandmas++;
}
if (!SimHasAchiev('Elder') && grandmas >= 7) SimWin('Elder');
if (!SimHasAchiev('Veteran') && grandmas >= 14) SimWin('Veteran');
let buildingsOwned = 0;
let mathematician = 1;
let base10 = 1;
let minAmount = 100000;
for (const i of Object.keys(SimObjects)) {
buildingsOwned += SimObjects[i].amount;
minAmount = Math.min(SimObjects[i].amount, minAmount);
if (!SimHasAchiev('Mathematician')) {
if (SimObjects[i].amount < Math.min(128, 2 ** ((Game.ObjectsById.length - Game.Objects[i].id) - 1))) mathematician = 0;
}
if (!SimHasAchiev('Base 10')) {
if (SimObjects[i].amount < (Game.ObjectsById.length - Game.Objects[i].id) * 10) base10 = 0;
}
}
if (minAmount >= 1) SimWin('One with everything');
if (mathematician === 1) SimWin('Mathematician');
if (base10 === 1) SimWin('Base 10');
if (minAmount >= 100) SimWin('Centennial');
if (minAmount >= 150) SimWin('Centennial and a half');
if (minAmount >= 200) SimWin('Bicentennial');
if (minAmount >= 250) SimWin('Bicentennial and a half');
if (minAmount >= 300) SimWin('Tricentennial');
if (minAmount >= 350) SimWin('Tricentennial and a half');
if (minAmount >= 400) SimWin('Quadricentennial');
if (minAmount >= 450) SimWin('Quadricentennial and a half');
if (minAmount >= 500) SimWin('Quincentennial');
if (minAmount >= 550) SimWin('Quincentennial and a half');
if (minAmount >= 600) SimWin('Sexcentennial');
let buildingsOwned = 0;
let mathematician = 1;
let base10 = 1;
let minAmount = 100000;
for (const i of Object.keys(SimObjects)) {
buildingsOwned += SimObjects[i].amount;
minAmount = Math.min(SimObjects[i].amount, minAmount);
if (!SimHasAchiev('Mathematician')) {
if (
SimObjects[i].amount <
Math.min(128, 2 ** (Game.ObjectsById.length - Game.Objects[i].id - 1))
)
mathematician = 0;
}
if (!SimHasAchiev('Base 10')) {
if (
SimObjects[i].amount <
(Game.ObjectsById.length - Game.Objects[i].id) * 10
)
base10 = 0;
}
}
if (minAmount >= 1) SimWin('One with everything');
if (mathematician === 1) SimWin('Mathematician');
if (base10 === 1) SimWin('Base 10');
if (minAmount >= 100) SimWin('Centennial');
if (minAmount >= 150) SimWin('Centennial and a half');
if (minAmount >= 200) SimWin('Bicentennial');
if (minAmount >= 250) SimWin('Bicentennial and a half');
if (minAmount >= 300) SimWin('Tricentennial');
if (minAmount >= 350) SimWin('Tricentennial and a half');
if (minAmount >= 400) SimWin('Quadricentennial');
if (minAmount >= 450) SimWin('Quadricentennial and a half');
if (minAmount >= 500) SimWin('Quincentennial');
if (minAmount >= 550) SimWin('Quincentennial and a half');
if (minAmount >= 600) SimWin('Sexcentennial');
if (buildingsOwned >= 100) SimWin('Builder');
if (buildingsOwned >= 500) SimWin('Architect');
if (buildingsOwned >= 1000) SimWin('Engineer');
if (buildingsOwned >= 2000) SimWin('Lord of Constructs');
if (buildingsOwned >= 4000) SimWin('Grand design');
if (buildingsOwned >= 8000) SimWin('Ecumenopolis');
if (buildingsOwned >= 100) SimWin('Builder');
if (buildingsOwned >= 500) SimWin('Architect');
if (buildingsOwned >= 1000) SimWin('Engineer');
if (buildingsOwned >= 2000) SimWin('Lord of Constructs');
if (buildingsOwned >= 4000) SimWin('Grand design');
if (buildingsOwned >= 8000) SimWin('Ecumenopolis');
if (SimUpgradesOwned >= 20) SimWin('Enhancer');
if (SimUpgradesOwned >= 50) SimWin('Augmenter');
if (SimUpgradesOwned >= 100) SimWin('Upgrader');
if (SimUpgradesOwned >= 200) SimWin('Lord of Progress');
if (SimUpgradesOwned >= 300) SimWin('The full picture');
if (SimUpgradesOwned >= 400) SimWin('When there\'s nothing left to add');
if (SimUpgradesOwned >= 20) SimWin('Enhancer');
if (SimUpgradesOwned >= 50) SimWin('Augmenter');
if (SimUpgradesOwned >= 100) SimWin('Upgrader');
if (SimUpgradesOwned >= 200) SimWin('Lord of Progress');
if (SimUpgradesOwned >= 300) SimWin('The full picture');
if (SimUpgradesOwned >= 400) SimWin("When there's nothing left to add");
if (buildingsOwned >= 4000 && SimUpgradesOwned >= 300) SimWin('Polymath');
if (buildingsOwned >= 8000 && SimUpgradesOwned >= 400) SimWin('Renaissance baker');
if (buildingsOwned >= 4000 && SimUpgradesOwned >= 300) SimWin('Polymath');
if (buildingsOwned >= 8000 && SimUpgradesOwned >= 400)
SimWin('Renaissance baker');
if (SimObjects.Cursor.amount + SimObjects.Grandma.amount >= 777) SimWin('The elder scrolls');
if (SimObjects.Cursor.amount + SimObjects.Grandma.amount >= 777)
SimWin('The elder scrolls');
let hasAllHalloCook = true;
for (const i of Object.keys(HalloCookies)) {
if (!SimHas(HalloCookies[i])) hasAllHalloCook = false;
}
if (hasAllHalloCook) SimWin('Spooky cookies');
let hasAllHalloCook = true;
for (const i of Object.keys(HalloCookies)) {
if (!SimHas(HalloCookies[i])) hasAllHalloCook = false;
}
if (hasAllHalloCook) SimWin('Spooky cookies');
let hasAllChristCook = true;
for (const i of Object.keys(ChristCookies)) {
if (!SimHas(ChristCookies[i])) hasAllChristCook = false;
}
if (hasAllChristCook) SimWin('Let it snow');
let hasAllChristCook = true;
for (const i of Object.keys(ChristCookies)) {
if (!SimHas(ChristCookies[i])) hasAllChristCook = false;
}
if (hasAllChristCook) SimWin('Let it snow');
if (SimHas('Fortune cookies')) {
const list = Game.Tiers.fortune.upgrades;
let fortunes = 0;
for (const i of Object.keys(list)) {
if (SimHas(list[i].name)) fortunes++;
}
if (fortunes >= list.length) SimWin('O Fortuna');
}
if (SimHas('Fortune cookies')) {
const list = Game.Tiers.fortune.upgrades;
let fortunes = 0;
for (const i of Object.keys(list)) {
if (SimHas(list[i].name)) fortunes++;
}
if (fortunes >= list.length) SimWin('O Fortuna');
}
}

View File

@@ -7,8 +7,8 @@ import CalculateGains from './CalculateGains';
* It is called by CM.Cache.NoGoldSwitchCPS()
*/
export default function CalcNoGoldSwitchCPS() {
CopyData();
SimUpgrades['Golden switch [off]'].bought = 0;
CalculateGains();
return SimCookiesPs;
CopyData();
SimUpgrades['Golden switch [off]'].bought = 0;
CalculateGains();
return SimCookiesPs;
}

View File

@@ -4,8 +4,8 @@
* @returns {Object} you The static object
*/
export default function InitAchievement(achievementName) {
const me = Game.Achievements[achievementName];
const you = {};
you.name = me.name;
return you;
const me = Game.Achievements[achievementName];
const you = {};
you.name = me.name;
return you;
}

View File

@@ -10,22 +10,22 @@ import InitUpgrade from './InitUpgrade';
* This function creates static objects for Buildings, Upgrades and Achievements
*/
export default function InitData() {
// Buildings
SimObjects = [];
for (const i of Object.keys(Game.Objects)) {
SimObjects[i] = InitialBuildingData(i);
}
// Buildings
SimObjects = [];
for (const i of Object.keys(Game.Objects)) {
SimObjects[i] = InitialBuildingData(i);
}
// Upgrades
SimUpgrades = [];
for (const i of Object.keys(Game.Upgrades)) {
SimUpgrades[i] = InitUpgrade(i);
}
// Upgrades
SimUpgrades = [];
for (const i of Object.keys(Game.Upgrades)) {
SimUpgrades[i] = InitUpgrade(i);
}
// Achievements
SimAchievements = [];
for (const i of Object.keys(Game.Achievements)) {
SimAchievements[i] = InitAchievement(i);
}
CopyData();
// Achievements
SimAchievements = [];
for (const i of Object.keys(Game.Achievements)) {
SimAchievements[i] = InitAchievement(i);
}
CopyData();
}

View File

@@ -8,33 +8,33 @@ import { SimObjects } from '../VariablesAndData';
* @returns {Object} you The static object
*/
export default function InitUpgrade(upgradeName) {
const me = Game.Upgrades[upgradeName];
const you = {};
// Some upgrades have a function for .power (notably the valentine cookies)
you.power = me.power;
if (typeof (me.power) === 'function') {
if (me.name === 'Sugar crystal cookies') {
me.power = function () {
let n = 5;
for (const i in SimObjects) {
if (SimObjects[i].level >= 10) n += 1;
}
return n;
};
}
me.power = function () {
let pow = 2;
if (SimHas('Starlove')) pow = 3;
if (Game.hasGod) {
const godLvl = SimHasGod('seasons');
if (godLvl === 1) pow *= 1.3;
else if (godLvl === 2) pow *= 1.2;
else if (godLvl === 3) pow *= 1.1;
}
return pow;
};
}
you.pool = me.pool;
you.name = me.name;
return you;
const me = Game.Upgrades[upgradeName];
const you = {};
// Some upgrades have a function for .power (notably the valentine cookies)
you.power = me.power;
if (typeof me.power === 'function') {
if (me.name === 'Sugar crystal cookies') {
me.power = function () {
let n = 5;
for (const i in SimObjects) {
if (SimObjects[i].level >= 10) n += 1;
}
return n;
};
}
me.power = function () {
let pow = 2;
if (SimHas('Starlove')) pow = 3;
if (Game.hasGod) {
const godLvl = SimHasGod('seasons');
if (godLvl === 1) pow *= 1.3;
else if (godLvl === 2) pow *= 1.2;
else if (godLvl === 3) pow *= 1.1;
}
return pow;
};
}
you.pool = me.pool;
you.name = me.name;
return you;
}

View File

@@ -12,84 +12,97 @@ import { SimObjects } from '../VariablesAndData';
* @returns {Object} you The static object
*/
export default function InitialBuildingData(buildingName) {
const me = Game.Objects[buildingName];
const you = {};
if (me.name === 'Cursor') {
you.cps = function (it) {
let add = 0;
if (SimHas('Thousand fingers')) add += 0.1;
if (SimHas('Million fingers')) add *= 5;
if (SimHas('Billion fingers')) add *= 10;
if (SimHas('Trillion fingers')) add *= 20;
if (SimHas('Quadrillion fingers')) add *= 20;
if (SimHas('Quintillion fingers')) add *= 20;
if (SimHas('Sextillion fingers')) add *= 20;
if (SimHas('Septillion fingers')) add *= 20;
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
let mult = 1;
let num = 0;
for (const i in SimObjects) { if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount; }
add *= num;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS('Cursor');
mult *= SimEff('cursorCps');
return Game.ComputeCps(0.1, SimHas('Reinforced index finger') + SimHas('Carpal tunnel prevention cream') + SimHas('Ambidextrous'), add) * mult;
};
} else if (me.name === 'Grandma') {
you.cps = function (it) {
let mult = 1;
for (const i in Game.GrandmaSynergies) {
if (SimHas(Game.GrandmaSynergies[i])) mult *= 2;
}
if (SimHas('Bingo center/Research facility')) mult *= 4;
if (SimHas('Ritual rolling pins')) mult *= 2;
if (SimHas('Naughty list')) mult *= 2;
const me = Game.Objects[buildingName];
const you = {};
if (me.name === 'Cursor') {
you.cps = function (it) {
let add = 0;
if (SimHas('Thousand fingers')) add += 0.1;
if (SimHas('Million fingers')) add *= 5;
if (SimHas('Billion fingers')) add *= 10;
if (SimHas('Trillion fingers')) add *= 20;
if (SimHas('Quadrillion fingers')) add *= 20;
if (SimHas('Quintillion fingers')) add *= 20;
if (SimHas('Sextillion fingers')) add *= 20;
if (SimHas('Septillion fingers')) add *= 20;
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
let mult = 1;
let num = 0;
for (const i in SimObjects) {
if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount;
}
add *= num;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS('Cursor');
mult *= SimEff('cursorCps');
return (
Game.ComputeCps(
0.1,
SimHas('Reinforced index finger') +
SimHas('Carpal tunnel prevention cream') +
SimHas('Ambidextrous'),
add,
) * mult
);
};
} else if (me.name === 'Grandma') {
you.cps = function (it) {
let mult = 1;
for (const i in Game.GrandmaSynergies) {
if (SimHas(Game.GrandmaSynergies[i])) mult *= 2;
}
if (SimHas('Bingo center/Research facility')) mult *= 4;
if (SimHas('Ritual rolling pins')) mult *= 2;
if (SimHas('Naughty list')) mult *= 2;
if (SimHas('Elderwort biscuits')) mult *= 1.02;
if (SimHas('Elderwort biscuits')) mult *= 1.02;
mult *= SimEff('grandmaCps');
mult *= SimEff('grandmaCps');
if (SimHas('Cat ladies')) {
for (let i = 0; i < Game.UpgradesByPool.kitten.length; i++) {
if (SimHas(Game.UpgradesByPool.kitten[i].name)) mult *= 1.29;
}
}
if (SimHas('Cat ladies')) {
for (let i = 0; i < Game.UpgradesByPool.kitten.length; i++) {
if (SimHas(Game.UpgradesByPool.kitten[i].name)) mult *= 1.29;
}
}
mult *= SimGetTieredCpsMult(it);
mult *= SimGetTieredCpsMult(it);
let add = 0;
if (SimHas('One mind')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Communal brainsweep')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
let add = 0;
if (SimHas('One mind')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Communal brainsweep'))
add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
let num = 0;
for (const i in SimObjects) { if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount; }
// if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num;
let num = 0;
for (const i in SimObjects) {
if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount;
}
// if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num;
mult *= Game.magicCpS(me.name);
mult *= Game.magicCpS(me.name);
return (me.baseCps + add) * mult;
};
} else {
you.cps = function (it) {
let mult = 1;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS(it.name);
return it.baseCPS * mult;
};
}
return (me.baseCps + add) * mult;
};
} else {
you.cps = function (it) {
let mult = 1;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS(it.name);
return it.baseCPS * mult;
};
}
// Below is needed for above eval, specifically for the GetTieredCpsMult function
you.baseCps = me.baseCps;
you.name = me.name;
you.tieredUpgrades = me.tieredUpgrades;
you.synergies = me.synergies;
you.fortune = me.fortune;
you.grandma = me.grandma;
you.baseCPS = me.baseCps;
you.id = me.id;
you.vanilla = me.vanilla;
return you;
// Below is needed for above eval, specifically for the GetTieredCpsMult function
you.baseCps = me.baseCps;
you.name = me.name;
you.tieredUpgrades = me.tieredUpgrades;
you.synergies = me.synergies;
you.fortune = me.fortune;
you.grandma = me.grandma;
you.baseCPS = me.baseCps;
you.id = me.id;
you.vanilla = me.vanilla;
return you;
}

View File

@@ -4,8 +4,16 @@ import { SimDragonAura, SimDragonAura2 } from '../VariablesAndData';
* This functions creates functions similarly to Game.auraMult but checks Sim Data instead of Game Data
*/
export default function SimAuraMult(what) {
let n = 0;
if (Game.dragonAuras[SimDragonAura].name === what || Game.dragonAuras[SimDragonAura2].name === what) n = 1;
if (Game.dragonAuras[SimDragonAura].name === 'Reality Bending' || Game.dragonAuras[SimDragonAura2].name === 'Reality Bending') n += 0.1;
return n;
let n = 0;
if (
Game.dragonAuras[SimDragonAura].name === what ||
Game.dragonAuras[SimDragonAura2].name === what
)
n = 1;
if (
Game.dragonAuras[SimDragonAura].name === 'Reality Bending' ||
Game.dragonAuras[SimDragonAura2].name === 'Reality Bending'
)
n += 0.1;
return n;
}

View File

@@ -4,7 +4,8 @@ import { SimEffs } from '../VariablesAndData';
* This functions creates functions similarly to Game.Eff but checks Sim Data instead of Game Data
*/
export default function SimEff(name, def) {
if (typeof SimEffs[name] === 'undefined') {
return (typeof def === 'undefined' ? 1 : def);
} return SimEffs[name];
if (typeof SimEffs[name] === 'undefined') {
return typeof def === 'undefined' ? 1 : def;
}
return SimEffs[name];
}

View File

@@ -6,22 +6,22 @@ import SimHasGod from './SimHasGod';
* This functions creates functions similarly to Game.GetHeavenlyMultiplier but checks Sim Data instead of Game Data
*/
export default function SimGetHeavenlyMultiplier() {
let heavenlyMult = 0;
if (SimHas('Heavenly chip secret')) heavenlyMult += 0.05;
if (SimHas('Heavenly cookie stand')) heavenlyMult += 0.20;
if (SimHas('Heavenly bakery')) heavenlyMult += 0.25;
if (SimHas('Heavenly confectionery')) heavenlyMult += 0.25;
if (SimHas('Heavenly key')) heavenlyMult += 0.25;
// if (SimHasAura('Dragon God')) heavenlyMult*=1.05;
heavenlyMult *= 1 + SimAuraMult('Dragon God') * 0.05;
if (SimHas('Lucky digit')) heavenlyMult *= 1.01;
if (SimHas('Lucky number')) heavenlyMult *= 1.01;
if (SimHas('Lucky payout')) heavenlyMult *= 1.01;
if (Game.hasGod) {
const godLvl = SimHasGod('creation');
if (godLvl === 1) heavenlyMult *= 0.7;
else if (godLvl === 2) heavenlyMult *= 0.8;
else if (godLvl === 3) heavenlyMult *= 0.9;
}
return heavenlyMult;
let heavenlyMult = 0;
if (SimHas('Heavenly chip secret')) heavenlyMult += 0.05;
if (SimHas('Heavenly cookie stand')) heavenlyMult += 0.2;
if (SimHas('Heavenly bakery')) heavenlyMult += 0.25;
if (SimHas('Heavenly confectionery')) heavenlyMult += 0.25;
if (SimHas('Heavenly key')) heavenlyMult += 0.25;
// if (SimHasAura('Dragon God')) heavenlyMult*=1.05;
heavenlyMult *= 1 + SimAuraMult('Dragon God') * 0.05;
if (SimHas('Lucky digit')) heavenlyMult *= 1.01;
if (SimHas('Lucky number')) heavenlyMult *= 1.01;
if (SimHas('Lucky payout')) heavenlyMult *= 1.01;
if (Game.hasGod) {
const godLvl = SimHasGod('creation');
if (godLvl === 1) heavenlyMult *= 0.7;
else if (godLvl === 2) heavenlyMult *= 0.8;
else if (godLvl === 3) heavenlyMult *= 0.9;
}
return heavenlyMult;
}

View File

@@ -6,7 +6,7 @@ import SimAuraMult from './SimAuraMult';
* @returns {number} giveBack The multiplier
*/
export default function SimGetSellMultiplier() {
let giveBack = 0.25;
giveBack *= 1 + SimAuraMult('Earth Shatterer');
return giveBack;
let giveBack = 0.25;
giveBack *= 1 + SimAuraMult('Earth Shatterer');
return giveBack;
}

View File

@@ -5,28 +5,43 @@ import SimHas from './SimHas';
* This functions creates functions similarly to Game.GetTieredCpsMult but checks Sim Data instead of Game Data
*/
export default function SimGetTieredCpsMult(me) {
let mult = 1;
for (const i in me.tieredUpgrades) {
if (!Game.Tiers[me.tieredUpgrades[i].tier].special && SimHas(me.tieredUpgrades[i].name)) mult *= 2;
}
for (const i in me.synergies) {
if (SimHas(me.synergies[i].name)) {
const syn = me.synergies[i];
if (syn.buildingTie1.name === me.name) mult *= (1 + 0.05 * syn.buildingTie2.amount);
else if (syn.buildingTie2.name === me.name) mult *= (1 + 0.001 * syn.buildingTie1.amount);
}
}
if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07;
if (me.grandma && SimHas(me.grandma.name)) mult *= (1 + SimObjects.Grandma.amount * 0.01 * (1 / (me.id - 1)));
if (typeof me.tieredUpgrades.misfortune === 'object') {
if (me.vanilla === 1 && SimHas(me.tieredUpgrades.misfortune.name)) {
switch (Game.elderWrath) {
default: mult *= 1; break;
case 1: mult *= 1.02; break;
case 2: mult *= 1.04; break;
case 3: mult *= 1.06; break;
}
}
}
return mult;
let mult = 1;
for (const i in me.tieredUpgrades) {
if (
!Game.Tiers[me.tieredUpgrades[i].tier].special &&
SimHas(me.tieredUpgrades[i].name)
)
mult *= 2;
}
for (const i in me.synergies) {
if (SimHas(me.synergies[i].name)) {
const syn = me.synergies[i];
if (syn.buildingTie1.name === me.name)
mult *= 1 + 0.05 * syn.buildingTie2.amount;
else if (syn.buildingTie2.name === me.name)
mult *= 1 + 0.001 * syn.buildingTie1.amount;
}
}
if (me.fortune && SimHas(me.fortune.name)) mult *= 1.07;
if (me.grandma && SimHas(me.grandma.name))
mult *= 1 + SimObjects.Grandma.amount * 0.01 * (1 / (me.id - 1));
if (typeof me.tieredUpgrades.misfortune === 'object') {
if (me.vanilla === 1 && SimHas(me.tieredUpgrades.misfortune.name)) {
switch (Game.elderWrath) {
default:
mult *= 1;
break;
case 1:
mult *= 1.02;
break;
case 2:
mult *= 1.04;
break;
case 3:
mult *= 1.06;
break;
}
}
}
return mult;
}

View File

@@ -4,7 +4,11 @@ import { SimUpgrades } from '../VariablesAndData';
* This functions creates functions similarly to Game.Has but checks Sim Data instead of Game Data
*/
export default function SimHas(what) {
const it = SimUpgrades[what];
if (Game.ascensionMode === 1 && (it.pool === 'prestige' || it.tier === 'fortune')) return 0;
return (it ? it.bought : 0);
const it = SimUpgrades[what];
if (
Game.ascensionMode === 1 &&
(it.pool === 'prestige' || it.tier === 'fortune')
)
return 0;
return it ? it.bought : 0;
}

View File

@@ -4,5 +4,5 @@ import { SimAchievements } from '../VariablesAndData';
* This functions creates functions similarly to Game.HasAchiev but checks Sim Data instead of Game Data
*/
export default function SimHasAchiev(what) {
return (SimAchievements[what] ? SimAchievements[what].won : 0);
return SimAchievements[what] ? SimAchievements[what].won : 0;
}

View File

@@ -4,8 +4,11 @@ import { SimDragonAura, SimDragonAura2 } from '../VariablesAndData';
* This functions creates functions similarly to Game.hasAura but checks Sim Data instead of Game Data
*/
export default function SimHasAura(what) {
if (Game.dragonAuras[SimDragonAura].name === what || Game.dragonAuras[SimDragonAura2].name === what) {
return true;
}
return false;
if (
Game.dragonAuras[SimDragonAura].name === what ||
Game.dragonAuras[SimDragonAura2].name === what
) {
return true;
}
return false;
}

View File

@@ -6,16 +6,16 @@ import { SimObjects } from '../VariablesAndData';
* @param {string} what Name of the achievement
*/
export default function SimHasGod(what) {
if (Game.hasGod) {
if (SimObjects.Temple.minigame === undefined) {
SimObjects.Temple.minigame = Game.Objects.Temple.minigame;
}
const god = SimObjects.Temple.minigame.gods[what];
for (let i = 0; i < 3; i++) {
if (SimObjects.Temple.minigame.slot[i] === god.id) {
return i + 1;
}
}
}
return false;
if (Game.hasGod) {
if (SimObjects.Temple.minigame === undefined) {
SimObjects.Temple.minigame = Game.Objects.Temple.minigame;
}
const god = SimObjects.Temple.minigame.gods[what];
for (let i = 0; i < 3; i++) {
if (SimObjects.Temple.minigame.slot[i] === god.id) {
return i + 1;
}
}
}
return false;
}

View File

@@ -11,23 +11,23 @@ import SimHasGod from './SimHasGod';
* @returns {number} price The modified building price
*/
export default function SimModifyBuildingPrice(building, price) {
if (SimHas('Season savings')) price *= 0.99;
if (SimHas('Santa\'s dominion')) price *= 0.99;
if (SimHas('Faberge egg')) price *= 0.99;
if (SimHas('Divine discount')) price *= 0.99;
if (SimHas('Fortune #100')) price *= 0.99;
// if (SimHasAura('Fierce Hoarder')) price *= 0.98;
price *= 1 - SimAuraMult('Fierce Hoarder') * 0.02;
if (Game.hasBuff('Everything must go')) price *= 0.95;
if (Game.hasBuff('Crafty pixies')) price *= 0.98;
if (Game.hasBuff('Nasty goblins')) price *= 1.02;
if (building.fortune && SimHas(building.fortune.name)) price *= 0.93;
price *= SimEff('buildingCost');
if (SimObjects.Temple.minigameLoaded) {
const godLvl = SimHasGod('creation');
if (godLvl === 1) price *= 0.93;
else if (godLvl === 2) price *= 0.95;
else if (godLvl === 3) price *= 0.98;
}
return price;
if (SimHas('Season savings')) price *= 0.99;
if (SimHas("Santa's dominion")) price *= 0.99;
if (SimHas('Faberge egg')) price *= 0.99;
if (SimHas('Divine discount')) price *= 0.99;
if (SimHas('Fortune #100')) price *= 0.99;
// if (SimHasAura('Fierce Hoarder')) price *= 0.98;
price *= 1 - SimAuraMult('Fierce Hoarder') * 0.02;
if (Game.hasBuff('Everything must go')) price *= 0.95;
if (Game.hasBuff('Crafty pixies')) price *= 0.98;
if (Game.hasBuff('Nasty goblins')) price *= 1.02;
if (building.fortune && SimHas(building.fortune.name)) price *= 0.93;
price *= SimEff('buildingCost');
if (SimObjects.Temple.minigameLoaded) {
const godLvl = SimHasGod('creation');
if (godLvl === 1) price *= 0.93;
else if (godLvl === 2) price *= 0.95;
else if (godLvl === 3) price *= 0.98;
}
return price;
}

View File

@@ -1,12 +1,24 @@
/* eslint-disable no-unused-vars */
import CacheDragonAuras from '../../Cache/Dragon/CacheDragonAuras';
import { CacheDragonAura, CacheDragonAura2 } from '../../Cache/VariablesAndData';
import {
CacheDragonAura,
CacheDragonAura2,
} from '../../Cache/VariablesAndData';
import { CreateBotBarBuildingColumn } from '../../Disp/InfoBars/CreateDOMElements';
import InitAchievement from '../InitializeData/InitAchievement';
import InitialBuildingData from '../InitializeData/InitialBuildingData';
import InitUpgrade from '../InitializeData/InitUpgrade';
import {
SimAchievements, SimAchievementsOwned, SimDragonAura, SimDragonAura2, SimHeavenlyPower, SimObjects, SimPledges, SimPrestige, SimUpgrades, SimUpgradesOwned,
SimAchievements,
SimAchievementsOwned,
SimDragonAura,
SimDragonAura2,
SimHeavenlyPower,
SimObjects,
SimPledges,
SimPrestige,
SimUpgrades,
SimUpgradesOwned,
} from '../VariablesAndData';
/**
@@ -14,60 +26,61 @@ import {
* It is called at the start of any function that simulates certain behaviour or actions
*/
export default function CopyData() {
// Other variables
SimUpgradesOwned = Game.UpgradesOwned;
SimPledges = Game.pledges;
SimAchievementsOwned = Game.AchievementsOwned;
SimHeavenlyPower = Game.heavenlyPower;
SimPrestige = Game.prestige;
// Other variables
SimUpgradesOwned = Game.UpgradesOwned;
SimPledges = Game.pledges;
SimAchievementsOwned = Game.AchievementsOwned;
SimHeavenlyPower = Game.heavenlyPower;
SimPrestige = Game.prestige;
// Buildings
for (const i of Object.keys(Game.Objects)) {
const me = Game.Objects[i];
let you = SimObjects[i];
if (you === undefined) { // New building!
SimObjects[i] = InitialBuildingData(i);
you = SimObjects[i];
CreateBotBarBuildingColumn(i); // Add new building to the bottom bar
}
you.amount = me.amount;
you.level = me.level;
you.totalCookies = me.totalCookies;
you.basePrice = me.basePrice;
you.free = me.free;
if (me.minigameLoaded) {
you.minigameLoaded = me.minigameLoaded;
you.minigame = me.minigame;
}
SimObjects[i] = you;
}
// Buildings
for (const i of Object.keys(Game.Objects)) {
const me = Game.Objects[i];
let you = SimObjects[i];
if (you === undefined) {
// New building!
SimObjects[i] = InitialBuildingData(i);
you = SimObjects[i];
CreateBotBarBuildingColumn(i); // Add new building to the bottom bar
}
you.amount = me.amount;
you.level = me.level;
you.totalCookies = me.totalCookies;
you.basePrice = me.basePrice;
you.free = me.free;
if (me.minigameLoaded) {
you.minigameLoaded = me.minigameLoaded;
you.minigame = me.minigame;
}
SimObjects[i] = you;
}
// Upgrades
for (const i of Object.keys(Game.Upgrades)) {
const me = Game.Upgrades[i];
let you = SimUpgrades[i];
if (you === undefined) {
SimUpgrades[i] = InitUpgrade(i);
you = SimUpgrades[i];
}
you.bought = me.bought;
SimUpgrades[i] = you;
}
// Upgrades
for (const i of Object.keys(Game.Upgrades)) {
const me = Game.Upgrades[i];
let you = SimUpgrades[i];
if (you === undefined) {
SimUpgrades[i] = InitUpgrade(i);
you = SimUpgrades[i];
}
you.bought = me.bought;
SimUpgrades[i] = you;
}
// Achievements
for (const i of Object.keys(Game.Achievements)) {
const me = Game.Achievements[i];
let you = SimAchievements[i];
if (you === undefined) {
SimAchievements[i] = InitAchievement(i);
you = SimAchievements[i];
}
you.won = me.won;
SimAchievements[i] = you;
}
// Achievements
for (const i of Object.keys(Game.Achievements)) {
const me = Game.Achievements[i];
let you = SimAchievements[i];
if (you === undefined) {
SimAchievements[i] = InitAchievement(i);
you = SimAchievements[i];
}
you.won = me.won;
SimAchievements[i] = you;
}
// Auras
CacheDragonAuras();
SimDragonAura = CacheDragonAura;
SimDragonAura2 = CacheDragonAura2;
// Auras
CacheDragonAuras();
SimDragonAura = CacheDragonAura;
SimDragonAura2 = CacheDragonAura2;
}

View File

@@ -8,10 +8,10 @@ import { SimAchievements, SimAchievementsOwned } from '../VariablesAndData';
* @param {string} what Name of the achievement
*/
export default function SimWin(what) {
if (SimAchievements[what]) {
if (SimAchievements[what].won === 0) {
SimAchievements[what].won = 1;
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned++;
}
}
if (SimAchievements[what]) {
if (SimAchievements[what].won === 0) {
SimAchievements[what].won = 1;
if (Game.Achievements[what].pool !== 'shadow') SimAchievementsOwned++;
}
}
}

View File

@@ -1,10 +1,18 @@
/* eslint-disable no-unused-vars */
import { CacheDragonAura, CacheDragonAura2 } from '../../Cache/VariablesAndData';
import {
CacheDragonAura,
CacheDragonAura2,
} from '../../Cache/VariablesAndData';
import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import CopyData from '../SimulationData/CopyData';
import {
SimAchievementsOwned, SimBuildingsOwned, SimCookiesPs, SimDragonAura, SimDragonAura2, SimObjects,
SimAchievementsOwned,
SimBuildingsOwned,
SimCookiesPs,
SimDragonAura,
SimDragonAura2,
SimObjects,
} from '../VariablesAndData';
/**
@@ -14,35 +22,48 @@ import {
* @returns {[number, number]} [CM.Sim.cookiesPs - Game.cookiesPs, price] The bonus cps and the price of the change
*/
export default function CalculateChangeAura(aura) {
CopyData();
CopyData();
// Check if aura being changed is first or second aura
const auraToBeChanged = l('promptContent').children[0].innerHTML.includes('secondary');
if (auraToBeChanged) SimDragonAura2 = aura;
else SimDragonAura = aura;
// Check if aura being changed is first or second aura
const auraToBeChanged = l('promptContent').children[0].innerHTML.includes(
'secondary',
);
if (auraToBeChanged) SimDragonAura2 = aura;
else SimDragonAura = aura;
// Sell highest building but only if aura is different
let price = 0;
if (SimDragonAura !== CacheDragonAura || SimDragonAura2 !== CacheDragonAura2) {
for (let i = Game.ObjectsById.length - 1; i > -1; --i) {
if (Game.ObjectsById[i - 1].amount > 0) {
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1;
price = SimObjects[highestBuilding].basePrice * Game.priceIncrease ** Math.max(0, SimObjects[highestBuilding].amount - 1 - SimObjects[highestBuilding].free);
price = Game.modifyBuildingPrice(SimObjects[highestBuilding], price);
price = Math.ceil(price);
break;
}
}
}
// Sell highest building but only if aura is different
let price = 0;
if (
SimDragonAura !== CacheDragonAura ||
SimDragonAura2 !== CacheDragonAura2
) {
for (let i = Game.ObjectsById.length - 1; i > -1; --i) {
if (Game.ObjectsById[i - 1].amount > 0) {
const highestBuilding = SimObjects[Game.ObjectsById[i].name].name;
SimObjects[highestBuilding].amount -= 1;
SimBuildingsOwned -= 1;
price =
SimObjects[highestBuilding].basePrice *
Game.priceIncrease **
Math.max(
0,
SimObjects[highestBuilding].amount -
1 -
SimObjects[highestBuilding].free,
);
price = Game.modifyBuildingPrice(SimObjects[highestBuilding], price);
price = Math.ceil(price);
break;
}
}
}
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
return [SimCookiesPs - Game.cookiesPs, price];
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
return [SimCookiesPs - Game.cookiesPs, price];
}

View File

@@ -9,14 +9,20 @@
* @param {number} increase Increase of building
* @returns {number} moni Total price
*/
export default function BuildingGetPrice(build, basePrice, start, free, increase) {
let moni = 0;
for (let i = 0; i < increase; i++) {
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free);
price = Game.modifyBuildingPrice(build, price);
price = Math.ceil(price);
moni += price;
start++;
}
return moni;
export default function BuildingGetPrice(
build,
basePrice,
start,
free,
increase,
) {
let moni = 0;
for (let i = 0; i < increase; i++) {
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free);
price = Game.modifyBuildingPrice(build, price);
price = Math.ceil(price);
moni += price;
start++;
}
return moni;
}

View File

@@ -2,7 +2,11 @@ import CalculateGains from '../Calculations/CalculateGains';
import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import CopyData from '../SimulationData/CopyData';
import SimWin from '../SimulationData/SimWin';
import { SimAchievementsOwned, SimCookiesPs, SimObjects } from '../VariablesAndData';
import {
SimAchievementsOwned,
SimCookiesPs,
SimObjects,
} from '../VariablesAndData';
/**
* This function calculates the bonus income of buying a building
@@ -12,39 +16,42 @@ import { SimAchievementsOwned, SimCookiesPs, SimObjects } from '../VariablesAndD
* @returns {number} The bonus income of the building
*/
export default function BuyBuildingsBonusIncome(building, amount) {
CopyData();
SimObjects[building].amount += amount;
const me = SimObjects[building];
CopyData();
SimObjects[building].amount += amount;
const me = SimObjects[building];
if (building === 'Cursor') {
if (me.amount >= 1) SimWin('Click');
if (me.amount >= 2) SimWin('Double-click');
if (me.amount >= 50) SimWin('Mouse wheel');
if (me.amount >= 100) SimWin('Of Mice and Men');
if (me.amount >= 200) SimWin('The Digital');
if (me.amount >= 300) SimWin('Extreme polydactyly');
if (me.amount >= 400) SimWin('Dr. T');
if (me.amount >= 500) SimWin('Thumbs, phalanges, metacarpals');
if (me.amount >= 600) SimWin('With her finger and her thumb');
if (me.amount >= 700) SimWin('Gotta hand it to you');
if (me.amount >= 800) SimWin('The devil\'s workshop');
} else {
for (const j in Game.Objects[me.name].tieredAchievs) {
if (me.amount >= Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock) {
SimWin(Game.Objects[me.name].tieredAchievs[j].name);
}
}
}
if (building === 'Cursor') {
if (me.amount >= 1) SimWin('Click');
if (me.amount >= 2) SimWin('Double-click');
if (me.amount >= 50) SimWin('Mouse wheel');
if (me.amount >= 100) SimWin('Of Mice and Men');
if (me.amount >= 200) SimWin('The Digital');
if (me.amount >= 300) SimWin('Extreme polydactyly');
if (me.amount >= 400) SimWin('Dr. T');
if (me.amount >= 500) SimWin('Thumbs, phalanges, metacarpals');
if (me.amount >= 600) SimWin('With her finger and her thumb');
if (me.amount >= 700) SimWin('Gotta hand it to you');
if (me.amount >= 800) SimWin("The devil's workshop");
} else {
for (const j in Game.Objects[me.name].tieredAchievs) {
if (
me.amount >=
Game.Tiers[Game.Objects[me.name].tieredAchievs[j].tier].achievUnlock
) {
SimWin(Game.Objects[me.name].tieredAchievs[j].name);
}
}
}
const lastAchievementsOwned = SimAchievementsOwned;
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
CalculateGains();
CheckOtherAchiev();
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
return SimCookiesPs - Game.cookiesPs;
return SimCookiesPs - Game.cookiesPs;
}

View File

@@ -8,7 +8,12 @@ import SimHasGod from '../ReplacedGameFunctions/SimHasGod';
import CopyData from '../SimulationData/CopyData';
import SimWin from '../SimulationData/SimWin';
import {
SimAchievementsOwned, SimCookiesPs, SimObjects, SimPledges, SimUpgrades, SimUpgradesOwned,
SimAchievementsOwned,
SimCookiesPs,
SimObjects,
SimPledges,
SimUpgrades,
SimUpgradesOwned,
} from '../VariablesAndData';
/**
@@ -17,74 +22,91 @@ import {
* @returns {number} out The clicking power
*/
function MouseCps() {
let add = 0;
if (SimHas('Thousand fingers')) add += 0.1;
if (SimHas('Million fingers')) add *= 5;
if (SimHas('Billion fingers')) add *= 10;
if (SimHas('Trillion fingers')) add *= 20;
if (SimHas('Quadrillion fingers')) add *= 20;
if (SimHas('Quintillion fingers')) add *= 20;
if (SimHas('Sextillion fingers')) add *= 20;
if (SimHas('Septillion fingers')) add *= 20;
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
let num = 0;
for (const i of Object.keys(SimObjects)) { num += SimObjects[i].amount; }
num -= SimObjects.Cursor.amount;
add *= num;
let add = 0;
if (SimHas('Thousand fingers')) add += 0.1;
if (SimHas('Million fingers')) add *= 5;
if (SimHas('Billion fingers')) add *= 10;
if (SimHas('Trillion fingers')) add *= 20;
if (SimHas('Quadrillion fingers')) add *= 20;
if (SimHas('Quintillion fingers')) add *= 20;
if (SimHas('Sextillion fingers')) add *= 20;
if (SimHas('Septillion fingers')) add *= 20;
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
let num = 0;
for (const i of Object.keys(SimObjects)) {
num += SimObjects[i].amount;
}
num -= SimObjects.Cursor.amount;
add *= num;
// Can use SimCookiesPs as function is always called after CM.Sim.CalculateGains()
if (SimHas('Plastic mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Iron mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Titanium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Adamantium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Unobtainium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Eludium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Wishalloy mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Fantasteel mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Nevercrack mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Armythril mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Technobsidian mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Plasmarble mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Miraculite mouse')) add += SimCookiesPs * 0.01;
// Can use SimCookiesPs as function is always called after CM.Sim.CalculateGains()
if (SimHas('Plastic mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Iron mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Titanium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Adamantium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Unobtainium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Eludium mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Wishalloy mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Fantasteel mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Nevercrack mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Armythril mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Technobsidian mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Plasmarble mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Miraculite mouse')) add += SimCookiesPs * 0.01;
if (SimHas('Fortune #104')) add += SimCookiesPs * 0.01;
if (SimHas('Fortune #104')) add += SimCookiesPs * 0.01;
let mult = 1;
if (SimHas('Santa\'s helpers')) mult *= 1.1;
if (SimHas('Cookie egg')) mult *= 1.1;
if (SimHas('Halo gloves')) mult *= 1.1;
if (SimHas('Dragon claw')) mult *= 1.03;
let mult = 1;
if (SimHas("Santa's helpers")) mult *= 1.1;
if (SimHas('Cookie egg')) mult *= 1.1;
if (SimHas('Halo gloves')) mult *= 1.1;
if (SimHas('Dragon claw')) mult *= 1.03;
if (SimHas('Aura gloves')) {
mult *= 1 + 0.05 * Math.min(Game.Objects.Cursor.level, SimHas('Luminous gloves') ? 20 : 10);
}
if (SimHas('Aura gloves')) {
mult *=
1 +
0.05 *
Math.min(
Game.Objects.Cursor.level,
SimHas('Luminous gloves') ? 20 : 10,
);
}
mult *= SimEff('click');
if (SimObjects.Temple.minigameLoaded) {
if (SimHasGod) {
const godLvl = SimHasGod('labor');
if (godLvl === 1) mult *= 1.15;
else if (godLvl === 2) mult *= 1.1;
else if (godLvl === 3) mult *= 1.05;
}
}
mult *= SimEff('click');
if (SimObjects.Temple.minigameLoaded) {
if (SimHasGod) {
const godLvl = SimHasGod('labor');
if (godLvl === 1) mult *= 1.15;
else if (godLvl === 2) mult *= 1.1;
else if (godLvl === 3) mult *= 1.05;
}
}
for (const i of Object.keys(Game.buffs)) {
if (typeof Game.buffs[i].multClick !== 'undefined') mult *= Game.buffs[i].multClick;
}
for (const i of Object.keys(Game.buffs)) {
if (typeof Game.buffs[i].multClick !== 'undefined')
mult *= Game.buffs[i].multClick;
}
// if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05;
mult *= 1 + SimAuraMult('Dragon Cursor') * 0.05;
// if (CM.Sim.auraMult('Dragon Cursor')) mult*=1.05;
mult *= 1 + SimAuraMult('Dragon Cursor') * 0.05;
// No need to make this function a CM function
let out = mult * Game.ComputeCps(1, SimHas('Reinforced index finger') + SimHas('Carpal tunnel prevention cream') + SimHas('Ambidextrous'), add);
// No need to make this function a CM function
let out =
mult *
Game.ComputeCps(
1,
SimHas('Reinforced index finger') +
SimHas('Carpal tunnel prevention cream') +
SimHas('Ambidextrous'),
add,
);
out = Game.runModHookOnValue('cookiesPerClick', out);
out = Game.runModHookOnValue('cookiesPerClick', out);
if (Game.hasBuff('Cursed finger')) out = Game.buffs['Cursed finger'].power;
if (Game.hasBuff('Cursed finger')) out = Game.buffs['Cursed finger'].power;
return out;
return out;
}
/**
@@ -94,45 +116,51 @@ function MouseCps() {
* @returns {[{number, number}]} The bonus income of the upgrade and the difference in MouseCPS
*/
export default function BuyUpgradesBonusIncome(upgrade) {
if (Game.Upgrades[upgrade].pool === 'toggle' || (Game.Upgrades[upgrade].bought === 0 && Game.Upgrades[upgrade].unlocked && Game.Upgrades[upgrade].pool !== 'prestige')) {
CopyData();
if (SimUpgrades[upgrade].name === 'Shimmering veil [on]') {
SimUpgrades['Shimmering veil [off]'].bought = 0;
} else if (SimUpgrades[upgrade].name === 'Golden switch [on]') {
SimUpgrades['Golden switch [off]'].bought = 0;
} else {
SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2;
}
const me = SimUpgrades[upgrade];
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool)) SimUpgradesOwned++;
if (
Game.Upgrades[upgrade].pool === 'toggle' ||
(Game.Upgrades[upgrade].bought === 0 &&
Game.Upgrades[upgrade].unlocked &&
Game.Upgrades[upgrade].pool !== 'prestige')
) {
CopyData();
if (SimUpgrades[upgrade].name === 'Shimmering veil [on]') {
SimUpgrades['Shimmering veil [off]'].bought = 0;
} else if (SimUpgrades[upgrade].name === 'Golden switch [on]') {
SimUpgrades['Golden switch [off]'].bought = 0;
} else {
SimUpgrades[upgrade].bought = (SimUpgrades[upgrade].bought + 1) % 2;
}
const me = SimUpgrades[upgrade];
if (Game.CountsAsUpgradeOwned(Game.Upgrades[upgrade].pool))
SimUpgradesOwned++;
if (upgrade === 'Elder Pledge') {
SimPledges++;
if (SimPledges > 0) SimWin('Elder nap');
if (SimPledges >= 5) SimWin('Elder slumber');
} else if (upgrade === 'Elder Covenant') {
SimWin('Elder calm');
} else if (upgrade === 'Prism heart biscuits') {
SimWin('Lovely cookies');
} else if (upgrade === 'Heavenly key') {
SimWin('Wholesome');
}
if (upgrade === 'Elder Pledge') {
SimPledges++;
if (SimPledges > 0) SimWin('Elder nap');
if (SimPledges >= 5) SimWin('Elder slumber');
} else if (upgrade === 'Elder Covenant') {
SimWin('Elder calm');
} else if (upgrade === 'Prism heart biscuits') {
SimWin('Lovely cookies');
} else if (upgrade === 'Heavenly key') {
SimWin('Wholesome');
}
const lastAchievementsOwned = SimAchievementsOwned;
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
CalculateGains();
CheckOtherAchiev();
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
const diffMouseCPS = MouseCps() - Game.computedMouseCps;
if (diffMouseCPS) {
return [SimCookiesPs - Game.cookiesPs, diffMouseCPS];
}
return [SimCookiesPs - Game.cookiesPs];
}
return [];
const diffMouseCPS = MouseCps() - Game.computedMouseCps;
if (diffMouseCPS) {
return [SimCookiesPs - Game.cookiesPs, diffMouseCPS];
}
return [SimCookiesPs - Game.cookiesPs];
}
return [];
}

View File

@@ -5,7 +5,10 @@ import CheckOtherAchiev from '../Calculations/CheckOtherAchiev';
import CopyData from '../SimulationData/CopyData';
import SimWin from '../SimulationData/SimWin';
import {
SimAchievementsOwned, SimCookiesPs, SimPrestige, SimUpgrades,
SimAchievementsOwned,
SimCookiesPs,
SimPrestige,
SimUpgrades,
} from '../VariablesAndData';
/**
@@ -15,65 +18,85 @@ import {
* @returns {number} ResetCPS The CPS difference after reset
*/
export default function ResetBonus(newHeavenlyChips) {
// Calculate CPS with all Heavenly upgrades
let curCPS = Game.cookiesPs;
// Calculate CPS with all Heavenly upgrades
let curCPS = Game.cookiesPs;
CopyData();
CopyData();
if (SimUpgrades['Heavenly key'].bought === 0) {
SimUpgrades['Heavenly chip secret'].bought = 1;
SimUpgrades['Heavenly cookie stand'].bought = 1;
SimUpgrades['Heavenly bakery'].bought = 1;
SimUpgrades['Heavenly confectionery'].bought = 1;
SimUpgrades['Heavenly key'].bought = 1;
if (SimUpgrades['Heavenly key'].bought === 0) {
SimUpgrades['Heavenly chip secret'].bought = 1;
SimUpgrades['Heavenly cookie stand'].bought = 1;
SimUpgrades['Heavenly bakery'].bought = 1;
SimUpgrades['Heavenly confectionery'].bought = 1;
SimUpgrades['Heavenly key'].bought = 1;
CalculateGains();
CalculateGains();
curCPS = SimCookiesPs;
curCPS = SimCookiesPs;
CopyData();
}
CopyData();
}
if (CacheRealCookiesEarned >= 1000000) SimWin('Sacrifice');
if (CacheRealCookiesEarned >= 1000000000) SimWin('Oblivion');
if (CacheRealCookiesEarned >= 1000000000000) SimWin('From scratch');
if (CacheRealCookiesEarned >= 1000000000000000) SimWin('Nihilism');
if (CacheRealCookiesEarned >= 1000000000000000000) SimWin('Dematerialize');
if (CacheRealCookiesEarned >= 1000000000000000000000) SimWin('Nil zero zilch');
if (CacheRealCookiesEarned >= 1000000000000000000000000) SimWin('Transcendence');
if (CacheRealCookiesEarned >= 1000000000000000000000000000) SimWin('Obliterate');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000) SimWin('Negative void');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000) SimWin('To crumbs, you say?');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000) SimWin('You get nothing');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000) SimWin('Humble rebeginnings');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000) SimWin('The end of the world');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000) SimWin('Oh, you\'re back');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000) SimWin('Lazarus');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000000) SimWin('Smurf account');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000000000) SimWin('If at first you don\'t succeed');
if (CacheRealCookiesEarned >= 1000000) SimWin('Sacrifice');
if (CacheRealCookiesEarned >= 1000000000) SimWin('Oblivion');
if (CacheRealCookiesEarned >= 1000000000000) SimWin('From scratch');
if (CacheRealCookiesEarned >= 1000000000000000) SimWin('Nihilism');
if (CacheRealCookiesEarned >= 1000000000000000000) SimWin('Dematerialize');
if (CacheRealCookiesEarned >= 1000000000000000000000)
SimWin('Nil zero zilch');
if (CacheRealCookiesEarned >= 1000000000000000000000000)
SimWin('Transcendence');
if (CacheRealCookiesEarned >= 1000000000000000000000000000)
SimWin('Obliterate');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000)
SimWin('Negative void');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000)
SimWin('To crumbs, you say?');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000)
SimWin('You get nothing');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000)
SimWin('Humble rebeginnings');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000)
SimWin('The end of the world');
if (CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000)
SimWin("Oh, you're back");
if (
CacheRealCookiesEarned >= 1000000000000000000000000000000000000000000000000
)
SimWin('Lazarus');
if (
CacheRealCookiesEarned >=
1000000000000000000000000000000000000000000000000000
)
SimWin('Smurf account');
if (
CacheRealCookiesEarned >=
1000000000000000000000000000000000000000000000000000000
)
SimWin("If at first you don't succeed");
SimUpgrades['Heavenly chip secret'].bought = 1;
SimUpgrades['Heavenly cookie stand'].bought = 1;
SimUpgrades['Heavenly bakery'].bought = 1;
SimUpgrades['Heavenly confectionery'].bought = 1;
SimUpgrades['Heavenly key'].bought = 1;
SimUpgrades['Heavenly chip secret'].bought = 1;
SimUpgrades['Heavenly cookie stand'].bought = 1;
SimUpgrades['Heavenly bakery'].bought = 1;
SimUpgrades['Heavenly confectionery'].bought = 1;
SimUpgrades['Heavenly key'].bought = 1;
SimPrestige = newHeavenlyChips;
SimPrestige = newHeavenlyChips;
const lastAchievementsOwned = SimAchievementsOwned;
const lastAchievementsOwned = SimAchievementsOwned;
CalculateGains();
CalculateGains();
CheckOtherAchiev();
CheckOtherAchiev();
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
if (lastAchievementsOwned !== SimAchievementsOwned) {
CalculateGains();
}
const ResetCPS = SimCookiesPs - curCPS;
const ResetCPS = SimCookiesPs - curCPS;
// Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local
SimPrestige = Game.prestige;
// Reset Pretige level after calculation as it is used in CM.Sim.CalculateGains() so can't be local
SimPrestige = Game.prestige;
return ResetCPS;
return ResetCPS;
}

View File

@@ -12,23 +12,32 @@ import SimModifyBuildingPrice from '../ReplacedGameFunctions/SimModifyBuidlingPr
* @param {number} noSim 1 of 0 depending on if function is called from CM.Sim
* @returns {number} moni Total price gained
*/
export default function BuildingSell(build, basePrice, start, free, amount, noSim) {
// Calculate money gains from selling buildings
// If noSim is set, use Game methods to compute price instead of Sim ones.
noSim = typeof noSim === 'undefined' ? 0 : noSim;
let moni = 0;
if (amount === -1) amount = start;
if (!amount) amount = Game.buyBulk;
for (let i = 0; i < amount; i++) {
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free);
price = noSim ? Game.modifyBuildingPrice(build, price) : SimModifyBuildingPrice(build, price);
price = Math.ceil(price);
const giveBack = noSim ? build.getSellMultiplier() : SimGetSellMultiplier();
price = Math.floor(price * giveBack);
if (start > 0) {
moni += price;
start--;
}
}
return moni;
export default function BuildingSell(
build,
basePrice,
start,
free,
amount,
noSim,
) {
// Calculate money gains from selling buildings
// If noSim is set, use Game methods to compute price instead of Sim ones.
noSim = typeof noSim === 'undefined' ? 0 : noSim;
let moni = 0;
if (amount === -1) amount = start;
if (!amount) amount = Game.buyBulk;
for (let i = 0; i < amount; i++) {
let price = basePrice * Game.priceIncrease ** Math.max(0, start - free);
price = noSim
? Game.modifyBuildingPrice(build, price)
: SimModifyBuildingPrice(build, price);
price = Math.ceil(price);
const giveBack = noSim ? build.getSellMultiplier() : SimGetSellMultiplier();
price = Math.floor(price * giveBack);
if (start > 0) {
moni += price;
start--;
}
}
return moni;
}

View File

@@ -1,7 +1,10 @@
/* eslint-disable no-unused-vars */
import CopyData from '../SimulationData/CopyData';
import {
SimBuildingsOwned, SimDragonAura, SimDragonAura2, SimObjects,
SimBuildingsOwned,
SimDragonAura,
SimDragonAura2,
SimObjects,
} from '../VariablesAndData';
import BuildingSell from './SellBuilding';
@@ -11,38 +14,44 @@ import BuildingSell from './SellBuilding';
* @returns {number} sellTotal The maximum cookies to be earned
*/
export default function SellBuildingsForChoEgg() {
let sellTotal = 0;
let sellTotal = 0;
CopyData();
CopyData();
// Change auras to Earth Shatterer + Reality bending to optimize money made by selling
let buildingsToSacrifice = 2;
if (SimDragonAura === 5 || SimDragonAura === 18) {
--buildingsToSacrifice;
}
if (SimDragonAura2 === 5 || SimDragonAura2 === 18) {
--buildingsToSacrifice;
}
SimDragonAura = 5;
SimDragonAura2 = 18;
// Change auras to Earth Shatterer + Reality bending to optimize money made by selling
let buildingsToSacrifice = 2;
if (SimDragonAura === 5 || SimDragonAura === 18) {
--buildingsToSacrifice;
}
if (SimDragonAura2 === 5 || SimDragonAura2 === 18) {
--buildingsToSacrifice;
}
SimDragonAura = 5;
SimDragonAura2 = 18;
// Sacrifice highest buildings for the aura switch
for (let i = 0; i < buildingsToSacrifice; ++i) {
let highestBuilding = 'Cursor';
for (const j in SimObjects) {
if (SimObjects[j].amount > 0) {
highestBuilding = j;
}
}
SimObjects[highestBuilding].amount--;
SimBuildingsOwned--;
}
// Sacrifice highest buildings for the aura switch
for (let i = 0; i < buildingsToSacrifice; ++i) {
let highestBuilding = 'Cursor';
for (const j in SimObjects) {
if (SimObjects[j].amount > 0) {
highestBuilding = j;
}
}
SimObjects[highestBuilding].amount--;
SimBuildingsOwned--;
}
// Get money made by selling all remaining buildings
for (const i of Object.keys(SimObjects)) {
const me = SimObjects[i];
sellTotal += BuildingSell(Game.Objects[me.name], Game.Objects[i].basePrice, me.amount, Game.Objects[i].free, me.amount);
}
// Get money made by selling all remaining buildings
for (const i of Object.keys(SimObjects)) {
const me = SimObjects[i];
sellTotal += BuildingSell(
Game.Objects[me.name],
Game.Objects[i].basePrice,
me.amount,
Game.Objects[i].free,
me.amount,
);
}
return sellTotal;
return sellTotal;
}