Merge pull request #672 from Aktanusa/master

Push hotfixes to dev
This commit is contained in:
Daniël van Noord
2021-03-15 12:51:49 +01:00
committed by GitHub
11 changed files with 60 additions and 40 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -11,8 +11,9 @@
"Orteil" "Orteil"
], ],
"scripts": { "scripts": {
"copy-file": "cp dist/CookieMonster.js CookieMonster.js",
"eslint_src": "eslint src", "eslint_src": "eslint src",
"build": "run-s eslint_src pack_prod remove_comment", "build": "run-s eslint_src pack_prod remove_comment copy-file",
"build_test": "run-s pack_dev", "build_test": "run-s pack_dev",
"pack_prod": "webpack --env production", "pack_prod": "webpack --env production",
"pack_dev": "webpack", "pack_dev": "webpack",

View File

@@ -16,6 +16,9 @@ import {
* @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler * @global {[{number}, {number}]} CM.Cache.WrinklersFattest A list containing the cookies and the id of the fattest non-shiny wrinkler
*/ */
export default function CacheWrinklers() { export default function CacheWrinklers() {
CacheWrinklersTotal = 0;
CacheWrinklersNormal = 0;
CacheWrinklersFattest = [0, null];
for (let i = 0; i < Game.wrinklers.length; i++) { for (let i = 0; i < Game.wrinklers.length; i++) {
let sucked = Game.wrinklers[i].sucked; let sucked = Game.wrinklers[i].sucked;
let toSuck = 1.1; let toSuck = 1.1;

View File

@@ -74,13 +74,15 @@ export function Beautify(num, floats, forced) {
} }
} }
if (answer === '') { if (answer === '') {
console.log(`Could not beautify number with CM.Disp.Beautify: ${num}`); console.log(
`Could not beautify number with Cookie Monster Beautify: ${num}`,
);
answer = BackupFunctions.Beautify(num, floats); answer = BackupFunctions.Beautify(num, floats);
} }
if (CMOptions.ScaleSeparator) answer = answer.replace('.', ','); if (CMOptions.ScaleSeparator) answer = answer.replace('.', ',');
return answer; return answer;
} }
console.log(`Could not beautify number with CM.Disp.Beautify: ${num}`); console.log(`Could not beautify number with Cookie Monster Beautify: ${num}`);
return BackupFunctions.Beautify(num, floats); return BackupFunctions.Beautify(num, floats);
} }

View File

@@ -591,7 +591,8 @@ export function PrestigeSection() {
), ),
); );
const neededCook = const neededCook = Math.max(
0,
Game.HowManyCookiesReset(possiblePresMax + 1) - Game.HowManyCookiesReset(possiblePresMax + 1) -
(CacheRealCookiesEarned + (CacheRealCookiesEarned +
Game.cookiesReset + Game.cookiesReset +
@@ -602,7 +603,8 @@ export function PrestigeSection() {
: 0 : 0
) )
? CacheLastChoEgg ? CacheLastChoEgg
: 0)); : 0)),
);
const cookiesNextFrag = document.createDocumentFragment(); const cookiesNextFrag = document.createDocumentFragment();
cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook))); cookiesNextFrag.appendChild(document.createTextNode(Beautify(neededCook)));
const cookiesNextSmall = document.createElement('small'); const cookiesNextSmall = document.createElement('small');

View File

@@ -1,5 +1,6 @@
import { import {
CacheHCPerSecond, CacheHCPerSecond,
CacheLastHeavenlyChips,
CacheTimeTillNextPrestige, CacheTimeTillNextPrestige,
} from '../../Cache/VariablesAndData'; } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData'; import { CMOptions } from '../../Config/VariablesAndData';
@@ -11,15 +12,15 @@ import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
* @returns {object} div An object containing the stylized header * @returns {object} div An object containing the stylized header
*/ */
export default function ReplaceAscendTooltip() { export default function ReplaceAscendTooltip() {
const ascendNowToGet = const cookiesToNext = Math.max(
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) - 0,
Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
const cookiesToNext =
Game.HowManyCookiesReset( Game.HowManyCookiesReset(
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) +
1, 1,
) - ) -
(Game.cookiesEarned + Game.cookiesReset); (Game.cookiesEarned + Game.cookiesReset),
);
const startDate = Game.sayTime( const startDate = Game.sayTime(
((Date.now() - Game.startDate) / 1000) * Game.fps, ((Date.now() - Game.startDate) / 1000) * Game.fps,
-1, -1,
@@ -35,17 +36,18 @@ export default function ReplaceAscendTooltip() {
)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`; )}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`;
str += '<div class="line"></div>'; str += '<div class="line"></div>';
} }
if (ascendNowToGet < 1) str += 'Ascending now would grant you no prestige.'; if (CacheLastHeavenlyChips < 1)
else if (ascendNowToGet < 2) str += 'Ascending now would grant you no prestige.';
else if (CacheLastHeavenlyChips < 2)
str += str +=
'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.'; 'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';
else else
str += `Ascending now would grant you<br><b>${Beautify( str += `Ascending now would grant you<br><b>${Beautify(
ascendNowToGet, CacheLastHeavenlyChips,
)} prestige levels</b> (+${Beautify( )} prestige levels</b> (+${Beautify(
ascendNowToGet, CacheLastHeavenlyChips,
)}% CpS)<br>and <b>${Beautify( )}% CpS)<br>and <b>${Beautify(
ascendNowToGet, CacheLastHeavenlyChips,
)} heavenly chips</b> to spend.`; )} heavenly chips</b> to spend.`;
str += '<div class="line"></div>'; str += '<div class="line"></div>';
str += `You need <b>${Beautify( str += `You need <b>${Beautify(

View File

@@ -62,6 +62,10 @@ export function Building() {
); );
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`; l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
} else {
l('CMTooltipIncome').textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
} }
l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color; l('CMTooltipBorder').className = ColorTextPre + target[TooltipName].color;
l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2); l('CMTooltipPP').textContent = Beautify(target[TooltipName].pp, 2);
@@ -134,6 +138,10 @@ export function Upgrade() {
} else { } else {
if (Number.isFinite(increase) && increase !== 0) { if (Number.isFinite(increase) && increase !== 0) {
l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`; l('CMTooltipIncome').textContent += ` (${increase / 100}% of income)`;
} else {
l('CMTooltipIncome').textContent += ` (<0${
CMOptions.ScaleSeparator ? ',' : '.'
}01% of income)`;
} }
l('CMTooltipBorder').className = l('CMTooltipBorder').className =
ColorTextPre + ColorTextPre +

View File

@@ -1,3 +1,4 @@
import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash'; import Flash from '../../Disp/Notifications/Flash';
import Notification from '../../Disp/Notifications/Notification'; import Notification from '../../Disp/Notifications/Notification';
import PlaySound from '../../Disp/Notifications/Sound'; import PlaySound from '../../Disp/Notifications/Sound';
@@ -16,7 +17,7 @@ export default function CheckTickerFortune() {
Game.TickerEffect && Game.TickerEffect.type === 'fortune'; Game.TickerEffect && Game.TickerEffect.type === 'fortune';
if (LastTickerFortuneState) { if (LastTickerFortuneState) {
Flash(3, 'FortuneFlash'); Flash(3, 'FortuneFlash');
PlaySound(CM.Options.FortuneSoundURL, 'FortuneSound', 'FortuneVolume'); PlaySound(CMOptions.FortuneSoundURL, 'FortuneSound', 'FortuneVolume');
Notification( Notification(
'FortuneNotification', 'FortuneNotification',
'Fortune Cookie found', 'Fortune Cookie found',

View File

@@ -12,17 +12,17 @@ export default function InitUpgrade(upgradeName) {
const you = {}; const you = {};
// Some upgrades have a function for .power (notably the valentine cookies) // Some upgrades have a function for .power (notably the valentine cookies)
you.power = me.power; you.power = me.power;
if (typeof me.power === 'function') { if (typeof you.power === 'function') {
if (me.name === 'Sugar crystal cookies') { if (me.name === 'Sugar crystal cookies') {
me.power = function () { you.power = function () {
let n = 5; let n = 5;
for (const i in SimObjects) { for (const i in SimObjects) {
if (SimObjects[i].level >= 10) n += 1; if (SimObjects[i].level >= 10) n += 1;
} }
return n; return n;
}; };
} } else {
me.power = function () { you.power = function () {
let pow = 2; let pow = 2;
if (SimHas('Starlove')) pow = 3; if (SimHas('Starlove')) pow = 3;
if (Game.hasGod) { if (Game.hasGod) {
@@ -34,6 +34,7 @@ export default function InitUpgrade(upgradeName) {
return pow; return pow;
}; };
} }
}
you.pool = me.pool; you.pool = me.pool;
you.name = me.name; you.name = me.name;
return you; return you;