Skip to content

Commit

Permalink
Fixed to work with Version 2.016 of Cookie Clicker (Issue #224 & #225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aktanusa committed Oct 28, 2018
1 parent cd3061f commit 4a8c59a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 40 deletions.
36 changes: 16 additions & 20 deletions CookieMonster.js
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,7 @@ CM.Disp.Tooltip = function(type, name) {
}
else if (type == 'u') {
if (!Game.UpgradesInStore[name]) return '';
l('tooltip').innerHTML = Game.crate(Game.UpgradesInStore[name], 'store', undefined, undefined, 1)();
l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store');
}
else { // Grimoire
l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)();
Expand Down Expand Up @@ -2906,9 +2906,7 @@ CM.Sim.hasAura = function(what) {
return false;
}

eval('CM.Sim.GetTieredCpsMult = ' + Game.GetTieredCpsMult.toString().split('Game.Has').join('CM.Sim.Has').split('me.tieredUpgrades').join('Game.Objects[me.name].tieredUpgrades').split('me.synergies').join('Game.Objects[me.name].synergies').split('syn.buildingTie1.amount').join('CM.Sim.Objects[syn.buildingTie1.name].amount').split('syn.buildingTie2.amount').join('CM.Sim.Objects[syn.buildingTie2.name].amount'));

eval('CM.Sim.getGrandmaSynergyUpgradeMultiplier = ' + Game.getGrandmaSynergyUpgradeMultiplier.toString().split('Game.Objects[\'Grandma\']').join('CM.Sim.Objects[\'Grandma\']'));
eval('CM.Sim.GetTieredCpsMult = ' + Game.GetTieredCpsMult.toString().split('Game.Has').join('CM.Sim.Has').split('me.tieredUpgrades').join('Game.Objects[me.name].tieredUpgrades').split('me.synergies').join('Game.Objects[me.name].synergies').split('syn.buildingTie1.amount').join('CM.Sim.Objects[syn.buildingTie1.name].amount').split('syn.buildingTie2.amount').join('CM.Sim.Objects[syn.buildingTie2.name].amount').split('me.grandma').join('Game.Objects[me.name].grandma').split('me.id').join('Game.Objects[me.name].id').split('Game.Objects[\'Grandma\']').join('CM.Sim.Objects[\'Grandma\']'));

CM.Sim.getCPSBuffMult = function() {
var mult = 1;
Expand All @@ -2925,7 +2923,7 @@ CM.Sim.InitData = function() {
CM.Sim.Objects[i] = {};
var me = Game.Objects[i];
var you = CM.Sim.Objects[i];
eval('you.cps = ' + me.cps.toString().split('Game.Has').join('CM.Sim.Has').split('Game.hasAura').join('CM.Sim.hasAura').split('Game.Objects').join('CM.Sim.Objects').split('Game.GetTieredCpsMult').join('CM.Sim.GetTieredCpsMult').split('Game.getGrandmaSynergyUpgradeMultiplier').join('CM.Sim.getGrandmaSynergyUpgradeMultiplier'));
eval('you.cps = ' + me.cps.toString().split('Game.Has').join('CM.Sim.Has').split('Game.hasAura').join('CM.Sim.hasAura').split('Game.Objects').join('CM.Sim.Objects').split('Game.GetTieredCpsMult').join('CM.Sim.GetTieredCpsMult'));
// Below is needed for above eval!
you.baseCps = me.baseCps;
you.name = me.name;
Expand Down Expand Up @@ -2981,11 +2979,13 @@ CM.Sim.CopyData = function() {
CM.Sim.CalculateGains = function() {
CM.Sim.cookiesPs = 0;
var mult = 1;

if (Game.ascensionMode != 1) mult += parseFloat(CM.Sim.prestige) * 0.01 * CM.Sim.heavenlyPower * CM.Sim.GetHeavenlyMultiplier();

// TODO Store minigame buffs?
mult *= Game.eff('cps');

if (CM.Sim.Has('Heralds') && Game.ascensionMode != 1) mult *= 1 + 0.01 * Game.heralds;

var cookieMult = 0;
for (var i in Game.cookieUpgrades) {
Expand Down Expand Up @@ -3129,13 +3129,17 @@ CM.Sim.CalculateGains = function() {
if (CM.Sim.Has('Golden switch [off]')) {
var goldenSwitchMult = 1.5;
if (CM.Sim.Has('Residual luck')) {
var upgrades = ['Get lucky', 'Lucky day', 'Serendipity', 'Heavenly luck', 'Lasting fortune', 'Decisive fate', 'Lucky digit', 'Lucky number', 'Lucky payout'];
var upgrades = Game.goldenCookieUpgrades;
for (var i in upgrades) {
if (CM.Sim.Has(upgrades[i])) goldenSwitchMult += 0.1;
}
}
mult *= goldenSwitchMult;
}
if (CM.Sim.Has('Shimmering veil [off]')) mult *= 1.5;

This comment has been minimized.

Copy link
@tonyvanriet

tonyvanriet Oct 28, 2018

@Aktanusa
should this be Shimmering veil [on]?

This comment has been minimized.

Copy link
@Aktanusa

Aktanusa Oct 29, 2018

Author Collaborator

Hmm, I thought I copied from the source. I checked the source and that's what it says. I think the thought is, if you have "Shimmering veil [off]" upgrade available, it means Shimmering veil is on, while if you have "Shimmering veil [on]" upgrade available, it means Shimmering veil is off.

This comment has been minimized.

Copy link
@rosenbergj

rosenbergj Oct 29, 2018

If so, that's opposite how the Golden Switch works.

This comment has been minimized.

Copy link
@Aktanusa

Aktanusa Oct 29, 2018

Author Collaborator

Not at all, this is what is done in CC:

if (Game.Has('Golden switch [off]')) ...

Edit: Heck, if you look above, CM does the same (since it is basically a copy of CC anyway...)

// Removed debug upgrades

// Removed buffs

CM.Sim.cookiesPs *= mult;

Expand All @@ -3145,20 +3149,11 @@ CM.Sim.CalculateGains = function() {

CM.Sim.CheckOtherAchiev = function() {
var grandmas = 0;
if (CM.Sim.Has('Farmer grandmas')) grandmas++;
if (CM.Sim.Has('Worker grandmas')) grandmas++;
if (CM.Sim.Has('Miner grandmas')) grandmas++;
if (CM.Sim.Has('Cosmic grandmas')) grandmas++;
if (CM.Sim.Has('Transmuted grandmas')) grandmas++;
if (CM.Sim.Has('Altered grandmas')) grandmas++;
if (CM.Sim.Has('Grandmas\' grandmas')) grandmas++;
if (CM.Sim.Has('Antigrandmas')) grandmas++;
if (CM.Sim.Has('Rainbow grandmas')) grandmas++;
if (CM.Sim.Has('Banker grandmas')) grandmas++;
if (CM.Sim.Has('Priestess grandmas')) grandmas++;
if (CM.Sim.Has('Witch grandmas')) grandmas++;
if (CM.Sim.Has('Lucky grandmas')) grandmas++;
for (var i in Game.GrandmaSynergies) {
if (CM.Sim.Has(Game.GrandmaSynergies[i])) grandmas++;
}
if (!CM.Sim.HasAchiev('Elder') && grandmas >= 7) CM.Sim.Win('Elder');
if (!CM.Sim.HasAchiev('Veteran') && grandmas >= 14) CM.Sim.Win('Veteran');

var buildingsOwned = 0;
var mathematician = 1;
Expand Down Expand Up @@ -3198,6 +3193,7 @@ CM.Sim.CheckOtherAchiev = function() {
if (CM.Sim.UpgradesOwned >= 200) CM.Sim.Win('Lord of Progress');

if (buildingsOwned >= 3000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath');
if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker');

if (CM.Sim.Objects['Cursor'].amount + CM.Sim.Objects['Grandma'].amount >= 777) CM.Sim.Win('The elder scrolls');

Expand Down
2 changes: 1 addition & 1 deletion src/Disp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ CM.Disp.Tooltip = function(type, name) {
}
else if (type == 'u') {
if (!Game.UpgradesInStore[name]) return '';
l('tooltip').innerHTML = Game.crate(Game.UpgradesInStore[name], 'store', undefined, undefined, 1)();
l('tooltip').innerHTML = Game.crateTooltip(Game.UpgradesInStore[name], 'store');
}
else { // Grimoire
l('tooltip').innerHTML = Game.Objects['Wizard tower'].minigame.spellTooltip(name)();
Expand Down
34 changes: 15 additions & 19 deletions src/Sim.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ CM.Sim.hasAura = function(what) {
return false;
}

eval('CM.Sim.GetTieredCpsMult = ' + Game.GetTieredCpsMult.toString().split('Game.Has').join('CM.Sim.Has').split('me.tieredUpgrades').join('Game.Objects[me.name].tieredUpgrades').split('me.synergies').join('Game.Objects[me.name].synergies').split('syn.buildingTie1.amount').join('CM.Sim.Objects[syn.buildingTie1.name].amount').split('syn.buildingTie2.amount').join('CM.Sim.Objects[syn.buildingTie2.name].amount'));

eval('CM.Sim.getGrandmaSynergyUpgradeMultiplier = ' + Game.getGrandmaSynergyUpgradeMultiplier.toString().split('Game.Objects[\'Grandma\']').join('CM.Sim.Objects[\'Grandma\']'));
eval('CM.Sim.GetTieredCpsMult = ' + Game.GetTieredCpsMult.toString().split('Game.Has').join('CM.Sim.Has').split('me.tieredUpgrades').join('Game.Objects[me.name].tieredUpgrades').split('me.synergies').join('Game.Objects[me.name].synergies').split('syn.buildingTie1.amount').join('CM.Sim.Objects[syn.buildingTie1.name].amount').split('syn.buildingTie2.amount').join('CM.Sim.Objects[syn.buildingTie2.name].amount').split('me.grandma').join('Game.Objects[me.name].grandma').split('me.id').join('Game.Objects[me.name].id').split('Game.Objects[\'Grandma\']').join('CM.Sim.Objects[\'Grandma\']'));

CM.Sim.getCPSBuffMult = function() {
var mult = 1;
Expand All @@ -104,7 +102,7 @@ CM.Sim.InitData = function() {
CM.Sim.Objects[i] = {};
var me = Game.Objects[i];
var you = CM.Sim.Objects[i];
eval('you.cps = ' + me.cps.toString().split('Game.Has').join('CM.Sim.Has').split('Game.hasAura').join('CM.Sim.hasAura').split('Game.Objects').join('CM.Sim.Objects').split('Game.GetTieredCpsMult').join('CM.Sim.GetTieredCpsMult').split('Game.getGrandmaSynergyUpgradeMultiplier').join('CM.Sim.getGrandmaSynergyUpgradeMultiplier'));
eval('you.cps = ' + me.cps.toString().split('Game.Has').join('CM.Sim.Has').split('Game.hasAura').join('CM.Sim.hasAura').split('Game.Objects').join('CM.Sim.Objects').split('Game.GetTieredCpsMult').join('CM.Sim.GetTieredCpsMult'));
// Below is needed for above eval!
you.baseCps = me.baseCps;
you.name = me.name;
Expand Down Expand Up @@ -160,11 +158,13 @@ CM.Sim.CopyData = function() {
CM.Sim.CalculateGains = function() {
CM.Sim.cookiesPs = 0;
var mult = 1;

if (Game.ascensionMode != 1) mult += parseFloat(CM.Sim.prestige) * 0.01 * CM.Sim.heavenlyPower * CM.Sim.GetHeavenlyMultiplier();

// TODO Store minigame buffs?
mult *= Game.eff('cps');

if (CM.Sim.Has('Heralds') && Game.ascensionMode != 1) mult *= 1 + 0.01 * Game.heralds;

var cookieMult = 0;
for (var i in Game.cookieUpgrades) {
Expand Down Expand Up @@ -308,13 +308,17 @@ CM.Sim.CalculateGains = function() {
if (CM.Sim.Has('Golden switch [off]')) {
var goldenSwitchMult = 1.5;
if (CM.Sim.Has('Residual luck')) {
var upgrades = ['Get lucky', 'Lucky day', 'Serendipity', 'Heavenly luck', 'Lasting fortune', 'Decisive fate', 'Lucky digit', 'Lucky number', 'Lucky payout'];
var upgrades = Game.goldenCookieUpgrades;
for (var i in upgrades) {
if (CM.Sim.Has(upgrades[i])) goldenSwitchMult += 0.1;
}
}
mult *= goldenSwitchMult;
}
if (CM.Sim.Has('Shimmering veil [off]')) mult *= 1.5;
// Removed debug upgrades

// Removed buffs

CM.Sim.cookiesPs *= mult;

Expand All @@ -324,20 +328,11 @@ CM.Sim.CalculateGains = function() {

CM.Sim.CheckOtherAchiev = function() {
var grandmas = 0;
if (CM.Sim.Has('Farmer grandmas')) grandmas++;
if (CM.Sim.Has('Worker grandmas')) grandmas++;
if (CM.Sim.Has('Miner grandmas')) grandmas++;
if (CM.Sim.Has('Cosmic grandmas')) grandmas++;
if (CM.Sim.Has('Transmuted grandmas')) grandmas++;
if (CM.Sim.Has('Altered grandmas')) grandmas++;
if (CM.Sim.Has('Grandmas\' grandmas')) grandmas++;
if (CM.Sim.Has('Antigrandmas')) grandmas++;
if (CM.Sim.Has('Rainbow grandmas')) grandmas++;
if (CM.Sim.Has('Banker grandmas')) grandmas++;
if (CM.Sim.Has('Priestess grandmas')) grandmas++;
if (CM.Sim.Has('Witch grandmas')) grandmas++;
if (CM.Sim.Has('Lucky grandmas')) grandmas++;
for (var i in Game.GrandmaSynergies) {
if (CM.Sim.Has(Game.GrandmaSynergies[i])) grandmas++;
}
if (!CM.Sim.HasAchiev('Elder') && grandmas >= 7) CM.Sim.Win('Elder');
if (!CM.Sim.HasAchiev('Veteran') && grandmas >= 14) CM.Sim.Win('Veteran');

var buildingsOwned = 0;
var mathematician = 1;
Expand Down Expand Up @@ -377,6 +372,7 @@ CM.Sim.CheckOtherAchiev = function() {
if (CM.Sim.UpgradesOwned >= 200) CM.Sim.Win('Lord of Progress');

if (buildingsOwned >= 3000 && CM.Sim.UpgradesOwned >= 300) CM.Sim.Win('Polymath');
if (buildingsOwned >= 4000 && CM.Sim.UpgradesOwned >= 400) CM.Sim.Win('Renaissance baker');

if (CM.Sim.Objects['Cursor'].amount + CM.Sim.Objects['Grandma'].amount >= 777) CM.Sim.Win('The elder scrolls');

Expand Down

0 comments on commit 4a8c59a

Please sign in to comment.