Merge pull request #671 from DanielNoord/fix/hotfix

Apply hotfixes
This commit is contained in:
Daniël van Noord
2021-03-15 09:02:32 +01:00
committed by GitHub
8 changed files with 52 additions and 36 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

@@ -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

@@ -591,18 +591,20 @@ export function PrestigeSection() {
), ),
); );
const neededCook = const neededCook = Math.max(
0,
Game.HowManyCookiesReset(possiblePresMax + 1) - Game.HowManyCookiesReset(possiblePresMax + 1) -
(CacheRealCookiesEarned + (CacheRealCookiesEarned +
Game.cookiesReset + Game.cookiesReset +
CacheWrinklersTotal + CacheWrinklersTotal +
(( ((
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg') Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg')
? CacheLastChoEgg
: 0
)
? CacheLastChoEgg ? CacheLastChoEgg
: 0 : 0)),
) );
? CacheLastChoEgg
: 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

@@ -12,27 +12,28 @@ 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 {
you.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;
};
} }
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.pool = me.pool;
you.name = me.name; you.name = me.name;