Merge pull request #656 from DanielNoord/fix/hotfix

Push hot fixes to dev branch
This commit is contained in:
Daniël van Noord
2021-03-14 18:07:25 +01:00
committed by GitHub
10 changed files with 121 additions and 18 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

@@ -33,7 +33,6 @@ export let CacheWrinklersTotal = 0;
export let CacheWrinklersNormal = 0;
export let CacheWrinklersFattest = [0, null];
export let CacheAvgCps = 0;
export let CacheCurrWrinklerCPSMult = 0;
export let CacheCurrWrinklerCount = 0;

View File

@@ -1,5 +1,5 @@
import {
CacheAvgCps, CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult, CacheWrinklersFattest,
CacheAverageCPS, CacheCurrWrinklerCount, CacheCurrWrinklerCPSMult, CacheWrinklersFattest,
} from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
@@ -9,7 +9,7 @@ import { CMOptions } from '../../Config/VariablesAndData';
*/
export default function GetCPS() {
if (CMOptions.CPSMode) {
return CacheAvgCps;
return CacheAverageCPS;
} if (CMOptions.CalcWrink === 0) {
return (Game.cookiesPs * (1 - Game.cpsSucked));
} if (CMOptions.CalcWrink === 1) {

View File

@@ -32,6 +32,9 @@ export function CreateTimerBar() {
'Next Reindeer',
[{ id: 'CMTimerBarRenMinBar', color: ColorGray }, { id: 'CMTimerBarRenBar', color: ColorOrange }]);
TimerBar.appendChild(CMTimerBarRen);
const TimerBarBuffTimers = document.createElement('div');
TimerBarBuffTimers.id = 'CMTimerBarBuffTimers';
TimerBar.appendChild(TimerBarBuffTimers);
l('wrapper').appendChild(TimerBar);
}
@@ -84,6 +87,7 @@ export function UpdateTimerBar() {
// On every frame all buff-timers are deleted and re-created
const BuffTimerBars = {};
l('CMTimerBarBuffTimers').innerHTML = '';
for (const i of Object.keys(Game.buffs)) {
if (Game.buffs[i]) {
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [{ id: `${Game.buffs[i].name}Bar` }]);
@@ -104,7 +108,7 @@ export function UpdateTimerBar() {
}
}
for (const i of Object.keys(BuffTimerBars)) {
l('CMTimerBar').appendChild(BuffTimerBars[i]);
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
}
if (numberOfTimers !== 0) {

View File

@@ -0,0 +1,28 @@
import { CacheHCPerSecond, CacheTimeTillNextPrestige } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { Beautify } from '../BeautifyAndFormatting/BeautifyFormatting';
/**
* This function creates a header object for tooltips.
* @param {string} text Title of header
* @returns {object} div An object containing the stylized header
*/
export default function ReplaceAscendTooltip() {
const ascendNowToGet = Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) - Math.floor(Game.HowMuchPrestige(Game.cookiesReset));
const cookiesToNext = Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) + 1) - (Game.cookiesEarned + Game.cookiesReset);
const startDate = Game.sayTime(((Date.now() - Game.startDate) / 1000) * Game.fps, -1);
let str = '';
str += `You've been on this run for <b>${startDate === '' ? 'not very long' : (startDate)}</b>.<br>`;
str += '<div class="line"></div>';
if (Game.prestige > 0) {
str += `Your prestige level is currently <b>${Beautify(Game.prestige)}</b>.<br>(CpS +${Beautify(Game.prestige)}%)`;
str += '<div class="line"></div>';
}
if (ascendNowToGet < 1) str += 'Ascending now would grant you no prestige.';
else if (ascendNowToGet < 2) str += 'Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.';
else str += `Ascending now would grant you<br><b>${Beautify(ascendNowToGet)} prestige levels</b> (+${Beautify(ascendNowToGet)}% CpS)<br>and <b>${Beautify(ascendNowToGet)} heavenly chips</b> to spend.`;
str += '<div class="line"></div>';
str += `You need <b>${Beautify(cookiesToNext)} more cookies</b> for the next level.<br>`;
str += `${CMOptions.TooltipAscendButton ? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you are making ${Beautify(CacheHCPerSecond, 2)} chips on average in the last 5 seconds.<br>` : ''}`;
l('ascendTooltip').innerHTML = str;
}

View File

@@ -1,11 +1,11 @@
/* eslint-disable no-unused-vars */
import jscolor from '@eastdesire/jscolor';
import { CacheHCPerSecond, CacheTimeTillNextPrestige } from '../../Cache/VariablesAndData';
import { CMOptions } from '../../Config/VariablesAndData';
import { Beautify as CMBeautify, FormatTime } from '../../Disp/BeautifyAndFormatting/BeautifyFormatting';
import { AddAuraInfo, AddDragonLevelUpTooltip } from '../../Disp/Dragon/Dragon';
import AddMenu from '../../Disp/MenuSections/AddMenus';
import UpdateTitle from '../../Disp/TabTitle/TabTitle';
import ReplaceAscendTooltip from '../../Disp/Tooltips/AscendButton';
import UpdateTooltipLocation from '../../Disp/Tooltips/PositionLocation';
import { CMSayTime, Title } from '../../Disp/VariablesAndData';
import { SimDateAges, SimDateCentury, SimDoSims } from '../../Sim/VariablesAndData';
@@ -121,6 +121,6 @@ export default function ReplaceNative() {
UpdateTitle();
// Since the Ascend Tooltip is not actually a tooltip we need to add our additional info here...
l('ascendTooltip').innerHTML += `${CMOptions.TooltipAscendButton ? `<div class='line'></div>It takes ${CacheTimeTillNextPrestige} to reach the next level and you are making ${CMBeautify(CacheHCPerSecond, 2)} chips on average in the last 5 seconds.<br>` : ''}`;
ReplaceAscendTooltip();
};
}

View File

@@ -1,5 +1,6 @@
import SimHas from '../ReplacedGameFunctions/SimHas';
import SimHasGod from '../ReplacedGameFunctions/SimHasGod';
import { SimObjects } from '../VariablesAndData';
/**
* This function constructs an object with the static properties of an upgrade
@@ -12,6 +13,15 @@ export default function InitUpgrade(upgradeName) {
// Some upgrades have a function for .power (notably the valentine cookies)
you.power = me.power;
if (typeof (me.power) === 'function') {
if (me.name === 'Sugar crystal cookies') {
me.power = function () {
let n = 5;
for (const i in SimObjects) {
if (SimObjects[i].level >= 10) n += 1;
}
return n;
};
}
me.power = function () {
let pow = 2;
if (SimHas('Starlove')) pow = 3;

View File

@@ -1,4 +1,8 @@
import SimAuraMult from '../ReplacedGameFunctions/SimAuraMult';
import SimEff from '../ReplacedGameFunctions/SimEff';
import SimGetTieredCpsMult from '../ReplacedGameFunctions/SimGetTieredCpsMult';
import SimHas from '../ReplacedGameFunctions/SimHas';
import { SimObjects } from '../VariablesAndData';
/**
* This function constructs an object with the static properties of a building,
@@ -10,15 +14,73 @@ import SimGetTieredCpsMult from '../ReplacedGameFunctions/SimGetTieredCpsMult';
export default function InitialBuildingData(buildingName) {
const me = Game.Objects[buildingName];
const you = {};
you.cps = function (it) {
let mult = 1;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS(it.name);
if (typeof it.baseCps === 'function') {
return it.baseCps(it) * mult;
}
return it.baseCPS * mult;
};
if (me.name === 'Cursor') {
you.cps = function (it) {
let add = 0;
if (SimHas('Thousand fingers')) add += 0.1;
if (SimHas('Million fingers')) add *= 5;
if (SimHas('Billion fingers')) add *= 10;
if (SimHas('Trillion fingers')) add *= 20;
if (SimHas('Quadrillion fingers')) add *= 20;
if (SimHas('Quintillion fingers')) add *= 20;
if (SimHas('Sextillion fingers')) add *= 20;
if (SimHas('Septillion fingers')) add *= 20;
if (SimHas('Octillion fingers')) add *= 20;
if (SimHas('Nonillion fingers')) add *= 20;
let mult = 1;
let num = 0;
for (const i in SimObjects) { if (SimObjects[i].name !== 'Cursor') num += SimObjects[i].amount; }
add *= num;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS('Cursor');
mult *= SimEff('cursorCps');
return Game.ComputeCps(0.1, SimHas('Reinforced index finger') + SimHas('Carpal tunnel prevention cream') + SimHas('Ambidextrous'), add) * mult;
};
} else if (me.name === 'Grandma') {
you.cps = function (it) {
let mult = 1;
for (const i in Game.GrandmaSynergies) {
if (SimHas(Game.GrandmaSynergies[i])) mult *= 2;
}
if (SimHas('Bingo center/Research facility')) mult *= 4;
if (SimHas('Ritual rolling pins')) mult *= 2;
if (SimHas('Naughty list')) mult *= 2;
if (SimHas('Elderwort biscuits')) mult *= 1.02;
mult *= SimEff('grandmaCps');
if (SimHas('Cat ladies')) {
for (let i = 0; i < Game.UpgradesByPool.kitten.length; i++) {
if (SimHas(Game.UpgradesByPool.kitten[i].name)) mult *= 1.29;
}
}
mult *= SimGetTieredCpsMult(it);
let add = 0;
if (SimHas('One mind')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Communal brainsweep')) add += SimObjects.Grandma.amount * 0.02;
if (SimHas('Elder Pact')) add += SimObjects.Portal.amount * 0.05;
let num = 0;
for (const i in SimObjects) { if (SimObjects[i].name !== 'Grandma') num += SimObjects[i].amount; }
// if (Game.hasAura('Elder Battalion')) mult*=1+0.01*num;
mult *= 1 + SimAuraMult('Elder Battalion') * 0.01 * num;
mult *= Game.magicCpS(me.name);
return (me.baseCps + add) * mult;
};
} else {
you.cps = function (it) {
let mult = 1;
mult *= SimGetTieredCpsMult(it);
mult *= Game.magicCpS(it.name);
return it.baseCPS * mult;
};
}
// Below is needed for above eval, specifically for the GetTieredCpsMult function
you.baseCps = me.baseCps;
you.name = me.name;