Merge pull request #691 from DanielNoord/randomchance

Last functions for 2.031.6
This commit is contained in:
Daniël van Noord
2021-03-18 09:29:34 +01:00
committed by GitHub
8 changed files with 273 additions and 148 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

@@ -1,6 +1,6 @@
{
"name": "cookiemonster-mod",
"version": "2.031.5",
"version": "2.031.6",
"description": "Cookie Monster is an add-on that you can load into Cookie Clicker which offers a wide range of tools and statistics to enhance the game. It is not a cheat interface although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want. This is a helper and everything is an option.",
"main": "CookieMonster.js",
"keywords": [

View File

@@ -1,7 +1,7 @@
/** Data related directly to Cookie Monster */
export const VersionMajor = '2.031';
export const VersionMinor = '5';
export const VersionMinor = '6';
/** Information about Cookie Monster to be displayed in the info section */
export const ModDescription = `<div class="listing">
@@ -15,15 +15,27 @@ export const ModDescription = `<div class="listing">
/** Latest releasenotes of Cookie Monster to be displayed in the info section */
export const LatestReleaseNotes = `<div class="listing">
The latest update (v 2.031.5) sees a total rehaul of the backend of the mod. It does not introduce any new functions, this is planned for the next release.</br>
We believe we have fixed all bugs related to this new code, but if you find any bugs, please report them on the GitHub!</br>
The latest update (v 2.031.6) has revamped the way PP is colourcoded. In the previous versions this was not always correct and we had some settings that made it even more incorrect. With this update Cookie Monster compares the PP of a building to all other possibilities (also buying 10 or 100) of a building and colors the PP accordingly.</br>
This means that if it is better to buy 10 of a building immediately rather than to buy in increments of 1 Cookie Monster will now show this! In this case the buy 1 option will be yellow, while the buy 10 option will be green.</br>
This also means that you will see some more diverse colors. Rather than coloring according to arbitrary "middle values" Cookie Monster now uses a top 10, 20 and 30. While this might take some getting used to we believe the new system is much better in conveying useful information to the user while also being more correct!</br>
</br>
<b>Besides, this update fixes the following bugs:</b></br>
- Fixed some upgrade tooltips which did not display the full effect of buying the upgrades</br>
- Fixed not always being able to sell when "blocking bulk buy"</br>
- Fixed heavenly chips per second display</br>
- Fixed small display bug when pressing shift and hovering over garden plots</br>
- Fixed some bugs with the display of numbers and formatting of them</br>
This update also implements the following functions:</br>
- Added a tooltip displaying the reward to the extra pop wrinkler buttons</br>
- Added tooltips to the Gods in the Pantheon</br>
- The tooltip for Elder Pledge now displays correctly, although it takes some time to load after Cookie Monster has been loaded</br>
- You can now test the volume and sound of notifications in the settings screen</br>
- The bottom bar will now flicker less and each column has received a bit of padding</br>
- Introduced new colour scheme for PP, see the explanation of colors in the Readme or the settings</br>
- Added option to show buttons that can hide the upgrade and building section</br>
- Added option to display PP as a time unit, note that these are only approximations. PP does not translate directly into time (the name is deceptive, we know...)</br>
- Statistics page now shows chance for random drops when they have not been achieved</br>
</br>
This update fixes the following bugs:</br>
- Incorrect amount for "required for max plant reward" in statistics page</br>
- Fixed the tooltips of the '?' buttons in the statistics page not showing</br>
- Fixed some unclear settings descriptions </br>
</br>
Please submit any bug reports or feature requests to the <a href="https://github.com/Aktanusa/CookieMonster">GitHub page!</a>
</br>
</div>
`;

View File

@@ -687,7 +687,7 @@ const Config = {
'bool',
'Notation',
['1 decimals', '2 decimals', '3 decimals'],
'Set the number of decimals used when applicable',
`Set the number of decimals used when applicable. This only works with Cookie Monster scales and not with "Game's Setting Scale"`,
false,
function () {
RefreshScale();

View File

@@ -8,9 +8,6 @@ import { CMOptions } from '../../Config/VariablesAndData';
import {
CacheAverageClicks,
CacheCentEgg,
CacheLastChoEgg,
CacheSeaSpec,
CacheWrinklersFattest,
CacheWrinklersNormal,
CacheWrinklersTotal,
@@ -110,136 +107,7 @@ export default function AddMenuStats(title) {
}
}
let specDisp = false;
const missingHalloweenCookies = [];
Object.keys(GameData.HalloCookies).forEach((i) => {
if (!Game.Has(GameData.HalloCookies[i])) {
missingHalloweenCookies.push(GameData.HalloCookies[i]);
specDisp = true;
}
});
const missingChristmasCookies = [];
Object.keys(GameData.ChristCookies).forEach((i) => {
if (!Game.Has(GameData.ChristCookies[i])) {
missingChristmasCookies.push(GameData.ChristCookies[i]);
specDisp = true;
}
});
const missingValentineCookies = [];
Object.keys(GameData.ValCookies).forEach((i) => {
if (!Game.Has(GameData.ValCookies[i])) {
missingValentineCookies.push(GameData.ValCookies[i]);
specDisp = true;
}
});
const missingNormalEggs = [];
Object.keys(Game.eggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.eggDrops[i])) {
missingNormalEggs.push(Game.eggDrops[i]);
specDisp = true;
}
});
const missingRareEggs = [];
Object.keys(Game.rareEggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
missingRareEggs.push(Game.rareEggDrops[i]);
specDisp = true;
}
});
const missingPlantDrops = [];
Object.keys(GameData.PlantDrops).forEach((i) => {
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
missingPlantDrops.push(GameData.PlantDrops[i]);
specDisp = true;
}
});
const choEgg =
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const centEgg = Game.Has('Century egg');
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
stats.appendChild(CreateElements.StatsHeader('Season Specials', 'Sea'));
if (CMOptions.Header.Sea) {
if (missingHalloweenCookies.length !== 0)
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Halloween Cookies Left to Buy',
CreateElements.StatsMissDisp(missingHalloweenCookies),
),
);
if (missingChristmasCookies.length !== 0)
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Christmas Cookies Left to Buy',
CreateElements.StatsMissDisp(missingChristmasCookies),
),
);
if (missingValentineCookies.length !== 0)
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Valentine Cookies Left to Buy',
CreateElements.StatsMissDisp(missingValentineCookies),
),
);
if (missingNormalEggs.length !== 0)
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Normal Easter Eggs Left to Unlock',
CreateElements.StatsMissDisp(missingNormalEggs),
),
);
if (missingRareEggs.length !== 0)
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Rare Easter Eggs Left to Unlock',
CreateElements.StatsMissDisp(missingRareEggs),
),
);
if (missingPlantDrops.length !== 0)
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Rare Plant Drops Left to Unlock',
CreateElements.StatsMissDisp(missingPlantDrops),
),
);
if (Game.season === 'christmas')
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Reindeer Reward',
document.createTextNode(Beautify(CacheSeaSpec)),
),
);
if (choEgg) {
stats.appendChild(
CreateElements.StatsListing(
'withTooltip',
'Chocolate Egg Cookies',
document.createTextNode(Beautify(CacheLastChoEgg)),
'ChoEggTooltipPlaceholder',
),
);
}
if (centEgg) {
stats.appendChild(
CreateElements.StatsListing(
'basic',
'Century Egg Multiplier',
document.createTextNode(
`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`,
),
),
);
}
}
}
stats.appendChild(CreateSections.SeasonSection());
stats.appendChild(CreateElements.StatsHeader('Miscellaneous', 'Misc'));
if (CMOptions.Header.Misc) {

View File

@@ -1,8 +1,10 @@
/** Functions to create the individual sections of the Statistics page */
import * as GameData from '../../Data/Gamedata';
import { MaxChainCookieReward } from '../../Cache/Stats/ChainCookies';
import {
CacheAvgCPSWithChoEgg,
CacheCentEgg,
CacheChainFrenzyMaxReward,
CacheChainFrenzyRequired,
CacheChainFrenzyRequiredNext,
@@ -30,6 +32,7 @@ import {
CacheLuckyWrathRewardFrenzy,
CacheNoGoldSwitchCookiesPS,
CacheRealCookiesEarned,
CacheSeaSpec,
CacheWrathCookiesMult,
CacheWrinklersTotal,
} from '../../Cache/VariablesAndData';
@@ -43,7 +46,7 @@ import {
import GetCPS from '../HelperFunctions/GetCPS';
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
import { ColorGreen, ColorRed, ColorTextPre } from '../VariablesAndData';
import { StatsListing } from './CreateDOMElements';
import { StatsListing, StatsHeader, StatsMissDisp } from './CreateDOMElements';
/**
* This function creates the "Lucky" section of the stats page
@@ -741,3 +744,245 @@ export function PrestigeSection() {
return section;
}
/**
* This function creates the "Season Specials" section of the stats page
* @returns {object} section The object contating the Season Specials section
*/
export function SeasonSection() {
const section = document.createElement('div');
section.className = 'CMStatsSeasonSection';
let specDisp = false;
const missingHalloweenCookies = [];
Object.keys(GameData.HalloCookies).forEach((i) => {
if (!Game.Has(GameData.HalloCookies[i])) {
missingHalloweenCookies.push(GameData.HalloCookies[i]);
specDisp = true;
}
});
const missingChristmasCookies = [];
Object.keys(GameData.ChristCookies).forEach((i) => {
if (!Game.Has(GameData.ChristCookies[i])) {
missingChristmasCookies.push(GameData.ChristCookies[i]);
specDisp = true;
}
});
const missingValentineCookies = [];
Object.keys(GameData.ValCookies).forEach((i) => {
if (!Game.Has(GameData.ValCookies[i])) {
missingValentineCookies.push(GameData.ValCookies[i]);
specDisp = true;
}
});
const missingNormalEggs = [];
Object.keys(Game.eggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.eggDrops[i])) {
missingNormalEggs.push(Game.eggDrops[i]);
specDisp = true;
}
});
const missingRareEggs = [];
Object.keys(Game.rareEggDrops).forEach((i) => {
if (!Game.HasUnlocked(Game.rareEggDrops[i])) {
missingRareEggs.push(Game.rareEggDrops[i]);
specDisp = true;
}
});
const missingPlantDrops = [];
Object.keys(GameData.PlantDrops).forEach((i) => {
if (!Game.HasUnlocked(GameData.PlantDrops[i])) {
missingPlantDrops.push(GameData.PlantDrops[i]);
specDisp = true;
}
});
const choEgg =
Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
const centEgg = Game.Has('Century egg');
if (Game.season === 'christmas' || specDisp || choEgg || centEgg) {
section.appendChild(StatsHeader('Season Specials', 'Sea'));
if (CMOptions.Header.Sea) {
if (missingHalloweenCookies.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Halloween cookies left to buy',
StatsMissDisp(missingHalloweenCookies),
),
);
let failRateHalloween = 0.95;
if (Game.HasAchiev('Spooky cookies')) failRateHalloween = 0.8;
if (Game.Has('Starterror')) failRateHalloween *= 0.9;
failRateHalloween *= 1 / Game.dropRateMult();
if (Game.hasGod) {
const godLvl = Game.hasGod('seasons');
if (godLvl === 1) failRateHalloween *= 0.9;
else if (godLvl === 2) failRateHalloween *= 0.95;
else if (godLvl === 3) failRateHalloween *= 0.97;
}
section.appendChild(
StatsListing(
'basic',
'Chance of receiving a cookie from wrinkler/shiny wrinkler',
document.createTextNode(
`${Beautify((1 - failRateHalloween) * 100)}% / ${Beautify(
(1 - failRateHalloween * 0.9) * 100,
)}%`,
),
),
);
}
if (missingChristmasCookies.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Christmas cookies left to buy',
StatsMissDisp(missingChristmasCookies),
),
);
let failRateChristmas = 0.8;
if (Game.HasAchiev('Let it snow')) failRateChristmas = 0.6;
failRateChristmas *= 1 / Game.dropRateMult();
if (Game.Has('Starsnow')) failRateChristmas *= 0.95;
if (Game.hasGod) {
const godLvl = Game.hasGod('seasons');
if (godLvl === 1) failRateChristmas *= 0.9;
else if (godLvl === 2) failRateChristmas *= 0.95;
else if (godLvl === 3) failRateChristmas *= 0.97;
}
section.appendChild(
StatsListing(
'basic',
'Chance of receiving a cookie from reindeer',
document.createTextNode(
`${Beautify((1 - failRateChristmas) * 100)}%`,
),
),
);
}
if (missingValentineCookies.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Valentine cookies left to buy',
StatsMissDisp(missingValentineCookies),
),
);
}
const dropRateEgg = function (StartingFailRate) {
let failRateEgg = StartingFailRate * (1 / Game.dropRateMult());
if (Game.HasAchiev('Hide & seek champion')) failRateEgg *= 0.7;
if (Game.Has('Omelette')) failRateEgg *= 0.9;
if (Game.Has('Starspawn')) failRateEgg *= 0.9;
if (Game.hasGod) {
const godLvl = Game.hasGod('seasons');
if (godLvl === 1) failRateEgg *= 0.9;
else if (godLvl === 2) failRateEgg *= 0.95;
else if (godLvl === 3) failRateEgg *= 0.97;
}
// Calculations courtesy of @svschouw, at https://github.com/Aktanusa/CookieMonster/issues/25
const succesRateEgg = 1 - failRateEgg;
const obtainedEggs = Game.eggDrops.length - missingNormalEggs.length;
const obtainedRareEggs =
Game.rareEggDrops.length - missingRareEggs.length;
const pNormal1 =
succesRateEgg * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pRare1 =
succesRateEgg *
0.1 *
(1 - obtainedRareEggs / Game.rareEggDrops.length);
const pRedropNormal =
succesRateEgg * 0.9 * (obtainedEggs / Game.eggDrops.length);
const pRedropRare =
succesRateEgg * 0.1 * (obtainedRareEggs / Game.rareEggDrops.length);
const pRedrop = pRedropNormal + pRedropRare;
const pNormal2 =
pRedrop * 0.9 * (1 - obtainedEggs / Game.eggDrops.length);
const pRare2 =
pRedrop * 0.1 * (1 - obtainedRareEggs / Game.rareEggDrops.length);
return [pNormal1 + pNormal2, pRare1 + pRare2];
};
if (missingNormalEggs.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Normal easter eggs left to unlock',
StatsMissDisp(missingNormalEggs),
),
);
section.appendChild(
StatsListing(
'basic',
'Chance of receiving an egg from wrinkler/golden cookie',
document.createTextNode(
`${Beautify(dropRateEgg(0.98)[0] * 100)}% / ${Beautify(
dropRateEgg(0.9)[0] * 100,
)}%`,
),
),
);
}
if (missingRareEggs.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Rare easter eggs left to unlock',
StatsMissDisp(missingRareEggs),
),
);
section.appendChild(
StatsListing(
'basic',
'Chance of receiving a rare egg from wrinkler/golden cookie',
document.createTextNode(
`${Beautify(dropRateEgg(0.98)[1] * 100)}% / ${Beautify(
dropRateEgg(0.9)[1] * 100,
)}%`,
),
),
);
}
if (missingPlantDrops.length !== 0) {
section.appendChild(
StatsListing(
'basic',
'Rare plant drops left to unlock',
StatsMissDisp(missingPlantDrops),
),
);
}
if (Game.season === 'christmas')
section.appendChild(
StatsListing(
'basic',
'Reindeer reward',
document.createTextNode(Beautify(CacheSeaSpec)),
),
);
if (choEgg) {
section.appendChild(
StatsListing(
'withTooltip',
'Chocolate egg cookies',
document.createTextNode(Beautify(CacheLastChoEgg)),
'ChoEggTooltipPlaceholder',
),
);
}
if (centEgg) {
section.appendChild(
StatsListing(
'basic',
'Century egg multiplier',
document.createTextNode(
`${Math.round((CacheCentEgg - 1) * 10000) / 100}%`,
),
),
);
}
}
}
return section;
}