Skip to content

Commit

Permalink
Chocolate egg stat now includes popping wrinklers (Issue #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aktanusa committed Sep 30, 2014
1 parent cd7376e commit 971f08b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
33 changes: 20 additions & 13 deletions CookieMonster.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,11 @@ CM.Disp.CreateResetTooltip = function() {
CM.Disp.CreateChoEggTooltip = function() {
CM.Disp.ChoEggTooltipPlaceholder = document.createElement('div');
var choEggTitleDesc = document.createElement('div');
choEggTitleDesc.style.minWidth = '290px';
choEggTitleDesc.style.minWidth = '240px';
choEggTitleDesc.style.marginBottom = '4px';
var div = document.createElement('div');
div.style.textAlign = 'left';
div.textContent = 'The amount of cookies you would get from selling all buildings and then buying Chocolate egg';
div.textContent = 'The amount of cookies you would get from selling all buildings, popping all wrinklers, and then buying Chocolate egg';
choEggTitleDesc.appendChild(div);
CM.Disp.ChoEggTooltipPlaceholder.appendChild(choEggTitleDesc);
}
Expand Down Expand Up @@ -1376,24 +1376,28 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(listing(resetTitleFrag, resetFrag));
}

var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below

if (Game.cpsSucked > 0) {
stats.appendChild(header('Wrinklers', 'Wrink'));
if (CM.Config.StatsPref.Wrink) {
if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg)) {
var sucked = 0;
for (var i in Game.wrinklers) {
sucked += Game.wrinklers[i].sucked;
}
sucked *= 1.1;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));

var popAllA = document.createElement('a');
popAllA.textContent = 'Pop All';
popAllA.className = 'option';
popAllA.onclick = function() {Game.CollectWrinklers();};
popAllFrag.appendChild(popAllA);
stats.appendChild(listing('Rewards of Popping', popAllFrag));
if (CM.Config.StatsPref.Wrink) {
var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));
var popAllA = document.createElement('a');
popAllA.textContent = 'Pop All';
popAllA.className = 'option';
popAllA.onclick = function() {Game.CollectWrinklers();};
popAllFrag.appendChild(popAllA);
stats.appendChild(listing('Rewards of Popping', popAllFrag));
}
}
}

Expand Down Expand Up @@ -1433,7 +1437,6 @@ CM.Disp.AddMenuStats = function(title) {
specDisp = true;
}
}
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));

if (Game.season == 'christmas' || specDisp || choEgg) {
stats.appendChild(header('Season Specials', 'Sea'));
Expand Down Expand Up @@ -1502,7 +1505,11 @@ CM.Disp.AddMenuStats = function(title) {
choEggTitleSpan.style.verticalAlign = 'bottom';
choEggTitleSpan.textContent = '?';
choEggTitleFrag.appendChild(choEggTitleSpan);
var choEggTotal = (Game.cookies + CM.Cache.SellAllTotal) * 0.05;
var choEggTotal = Game.cookies + CM.Cache.SellAllTotal;
if (Game.cpsSucked > 0) {
choEggTotal += sucked;
}
choEggTotal *= 0.05;
stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal))));
}
}
Expand Down
33 changes: 20 additions & 13 deletions src/Disp.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,11 @@ CM.Disp.CreateResetTooltip = function() {
CM.Disp.CreateChoEggTooltip = function() {
CM.Disp.ChoEggTooltipPlaceholder = document.createElement('div');
var choEggTitleDesc = document.createElement('div');
choEggTitleDesc.style.minWidth = '290px';
choEggTitleDesc.style.minWidth = '240px';
choEggTitleDesc.style.marginBottom = '4px';
var div = document.createElement('div');
div.style.textAlign = 'left';
div.textContent = 'The amount of cookies you would get from selling all buildings and then buying Chocolate egg';
div.textContent = 'The amount of cookies you would get from selling all buildings, popping all wrinklers, and then buying Chocolate egg';
choEggTitleDesc.appendChild(div);
CM.Disp.ChoEggTooltipPlaceholder.appendChild(choEggTitleDesc);
}
Expand Down Expand Up @@ -1039,24 +1039,28 @@ CM.Disp.AddMenuStats = function(title) {
stats.appendChild(listing(resetTitleFrag, resetFrag));
}

var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below

if (Game.cpsSucked > 0) {
stats.appendChild(header('Wrinklers', 'Wrink'));
if (CM.Config.StatsPref.Wrink) {
if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg)) {
var sucked = 0;
for (var i in Game.wrinklers) {
sucked += Game.wrinklers[i].sucked;
}
sucked *= 1.1;
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));

var popAllA = document.createElement('a');
popAllA.textContent = 'Pop All';
popAllA.className = 'option';
popAllA.onclick = function() {Game.CollectWrinklers();};
popAllFrag.appendChild(popAllA);
stats.appendChild(listing('Rewards of Popping', popAllFrag));
if (CM.Config.StatsPref.Wrink) {
var popAllFrag = document.createDocumentFragment();
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));
var popAllA = document.createElement('a');
popAllA.textContent = 'Pop All';
popAllA.className = 'option';
popAllA.onclick = function() {Game.CollectWrinklers();};
popAllFrag.appendChild(popAllA);
stats.appendChild(listing('Rewards of Popping', popAllFrag));
}
}
}

Expand Down Expand Up @@ -1096,7 +1100,6 @@ CM.Disp.AddMenuStats = function(title) {
specDisp = true;
}
}
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg'));

if (Game.season == 'christmas' || specDisp || choEgg) {
stats.appendChild(header('Season Specials', 'Sea'));
Expand Down Expand Up @@ -1165,7 +1168,11 @@ CM.Disp.AddMenuStats = function(title) {
choEggTitleSpan.style.verticalAlign = 'bottom';
choEggTitleSpan.textContent = '?';
choEggTitleFrag.appendChild(choEggTitleSpan);
var choEggTotal = (Game.cookies + CM.Cache.SellAllTotal) * 0.05;
var choEggTotal = Game.cookies + CM.Cache.SellAllTotal;
if (Game.cpsSucked > 0) {
choEggTotal += sucked;
}
choEggTotal *= 0.05;
stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal))));
}
}
Expand Down

0 comments on commit 971f08b

Please sign in to comment.