Skip to content

Commit 971f08b

Browse files
committed
Chocolate egg stat now includes popping wrinklers (Issue #27)
1 parent cd7376e commit 971f08b

2 files changed

Lines changed: 40 additions & 26 deletions

File tree

CookieMonster.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,11 +1059,11 @@ CM.Disp.CreateResetTooltip = function() {
10591059
CM.Disp.CreateChoEggTooltip = function() {
10601060
CM.Disp.ChoEggTooltipPlaceholder = document.createElement('div');
10611061
var choEggTitleDesc = document.createElement('div');
1062-
choEggTitleDesc.style.minWidth = '290px';
1062+
choEggTitleDesc.style.minWidth = '240px';
10631063
choEggTitleDesc.style.marginBottom = '4px';
10641064
var div = document.createElement('div');
10651065
div.style.textAlign = 'left';
1066-
div.textContent = 'The amount of cookies you would get from selling all buildings and then buying Chocolate egg';
1066+
div.textContent = 'The amount of cookies you would get from selling all buildings, popping all wrinklers, and then buying Chocolate egg';
10671067
choEggTitleDesc.appendChild(div);
10681068
CM.Disp.ChoEggTooltipPlaceholder.appendChild(choEggTitleDesc);
10691069
}
@@ -1376,24 +1376,28 @@ CM.Disp.AddMenuStats = function(title) {
13761376
stats.appendChild(listing(resetTitleFrag, resetFrag));
13771377
}
13781378

1379+
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below
1380+
13791381
if (Game.cpsSucked > 0) {
13801382
stats.appendChild(header('Wrinklers', 'Wrink'));
1381-
if (CM.Config.StatsPref.Wrink) {
1383+
if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg)) {
13821384
var sucked = 0;
13831385
for (var i in Game.wrinklers) {
13841386
sucked += Game.wrinklers[i].sucked;
13851387
}
13861388
sucked *= 1.1;
13871389
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
1388-
var popAllFrag = document.createDocumentFragment();
1389-
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));
13901390

1391-
var popAllA = document.createElement('a');
1392-
popAllA.textContent = 'Pop All';
1393-
popAllA.className = 'option';
1394-
popAllA.onclick = function() {Game.CollectWrinklers();};
1395-
popAllFrag.appendChild(popAllA);
1396-
stats.appendChild(listing('Rewards of Popping', popAllFrag));
1391+
if (CM.Config.StatsPref.Wrink) {
1392+
var popAllFrag = document.createDocumentFragment();
1393+
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));
1394+
var popAllA = document.createElement('a');
1395+
popAllA.textContent = 'Pop All';
1396+
popAllA.className = 'option';
1397+
popAllA.onclick = function() {Game.CollectWrinklers();};
1398+
popAllFrag.appendChild(popAllA);
1399+
stats.appendChild(listing('Rewards of Popping', popAllFrag));
1400+
}
13971401
}
13981402
}
13991403

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

14381441
if (Game.season == 'christmas' || specDisp || choEgg) {
14391442
stats.appendChild(header('Season Specials', 'Sea'));
@@ -1502,7 +1505,11 @@ CM.Disp.AddMenuStats = function(title) {
15021505
choEggTitleSpan.style.verticalAlign = 'bottom';
15031506
choEggTitleSpan.textContent = '?';
15041507
choEggTitleFrag.appendChild(choEggTitleSpan);
1505-
var choEggTotal = (Game.cookies + CM.Cache.SellAllTotal) * 0.05;
1508+
var choEggTotal = Game.cookies + CM.Cache.SellAllTotal;
1509+
if (Game.cpsSucked > 0) {
1510+
choEggTotal += sucked;
1511+
}
1512+
choEggTotal *= 0.05;
15061513
stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal))));
15071514
}
15081515
}

src/Disp.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,11 @@ CM.Disp.CreateResetTooltip = function() {
722722
CM.Disp.CreateChoEggTooltip = function() {
723723
CM.Disp.ChoEggTooltipPlaceholder = document.createElement('div');
724724
var choEggTitleDesc = document.createElement('div');
725-
choEggTitleDesc.style.minWidth = '290px';
725+
choEggTitleDesc.style.minWidth = '240px';
726726
choEggTitleDesc.style.marginBottom = '4px';
727727
var div = document.createElement('div');
728728
div.style.textAlign = 'left';
729-
div.textContent = 'The amount of cookies you would get from selling all buildings and then buying Chocolate egg';
729+
div.textContent = 'The amount of cookies you would get from selling all buildings, popping all wrinklers, and then buying Chocolate egg';
730730
choEggTitleDesc.appendChild(div);
731731
CM.Disp.ChoEggTooltipPlaceholder.appendChild(choEggTitleDesc);
732732
}
@@ -1039,24 +1039,28 @@ CM.Disp.AddMenuStats = function(title) {
10391039
stats.appendChild(listing(resetTitleFrag, resetFrag));
10401040
}
10411041

1042+
var choEgg = (Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')); // Needs to be done for the checking below
1043+
10421044
if (Game.cpsSucked > 0) {
10431045
stats.appendChild(header('Wrinklers', 'Wrink'));
1044-
if (CM.Config.StatsPref.Wrink) {
1046+
if (CM.Config.StatsPref.Wrink || (CM.Config.StatsPref.Sea && choEgg)) {
10451047
var sucked = 0;
10461048
for (var i in Game.wrinklers) {
10471049
sucked += Game.wrinklers[i].sucked;
10481050
}
10491051
sucked *= 1.1;
10501052
if (Game.Has('Wrinklerspawn')) sucked *= 1.05;
1051-
var popAllFrag = document.createDocumentFragment();
1052-
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));
10531053

1054-
var popAllA = document.createElement('a');
1055-
popAllA.textContent = 'Pop All';
1056-
popAllA.className = 'option';
1057-
popAllA.onclick = function() {Game.CollectWrinklers();};
1058-
popAllFrag.appendChild(popAllA);
1059-
stats.appendChild(listing('Rewards of Popping', popAllFrag));
1054+
if (CM.Config.StatsPref.Wrink) {
1055+
var popAllFrag = document.createDocumentFragment();
1056+
popAllFrag.appendChild(document.createTextNode(Beautify(sucked) + ' '));
1057+
var popAllA = document.createElement('a');
1058+
popAllA.textContent = 'Pop All';
1059+
popAllA.className = 'option';
1060+
popAllA.onclick = function() {Game.CollectWrinklers();};
1061+
popAllFrag.appendChild(popAllA);
1062+
stats.appendChild(listing('Rewards of Popping', popAllFrag));
1063+
}
10601064
}
10611065
}
10621066

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

11011104
if (Game.season == 'christmas' || specDisp || choEgg) {
11021105
stats.appendChild(header('Season Specials', 'Sea'));
@@ -1165,7 +1168,11 @@ CM.Disp.AddMenuStats = function(title) {
11651168
choEggTitleSpan.style.verticalAlign = 'bottom';
11661169
choEggTitleSpan.textContent = '?';
11671170
choEggTitleFrag.appendChild(choEggTitleSpan);
1168-
var choEggTotal = (Game.cookies + CM.Cache.SellAllTotal) * 0.05;
1171+
var choEggTotal = Game.cookies + CM.Cache.SellAllTotal;
1172+
if (Game.cpsSucked > 0) {
1173+
choEggTotal += sucked;
1174+
}
1175+
choEggTotal *= 0.05;
11691176
stats.appendChild(listing(choEggTitleFrag, document.createTextNode(Beautify(choEggTotal))));
11701177
}
11711178
}

0 commit comments

Comments
 (0)