[Automated] Merge dev into gh-pages

This commit is contained in:
github-actions[bot]
2025-02-26 20:42:31 +00:00
committed by GitHub
6 changed files with 28 additions and 38 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

File diff suppressed because one or more lines are too long

View File

@@ -10,12 +10,7 @@ import {
LastNumberOfTimers, LastNumberOfTimers,
} from '../VariablesAndData.js'; } from '../VariablesAndData.js';
import { CreateTimer } from './CreateDOMElements.js'; import { CreateTimer } from './CreateDOMElements.js';
import { import { updateChanceTotal, updateChanceTotalDeer } from '../../Main/CheckStates/Probability.js';
updateChanceTotal,
getChanceFinalDeer,
getChanceFinal,
updateChanceTotalDeer,
} from '../../Main/CheckStates/Probability.js';
/** /**
* This function creates the TimerBar and appends it to l('wrapper') * This function creates the TimerBar and appends it to l('wrapper')
@@ -130,12 +125,18 @@ export function UpdateTimerBar() {
(Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) / (Game.shimmerTypes.golden.time - Game.shimmerTypes.golden.minTime) /
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime), (Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime),
) ** 5; ) ** 5;
updateChanceTotal(chanceToSpawn); const finalChance = updateChanceTotal(chanceToSpawn);
l('CMTimerBarGCTime').textContent = `${Math.ceil( l('CMTimerBarGCTime').textContent = `${Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps, (Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
)} ${getChanceFinal() < 0.01 ? '<' : ''}${getChanceFinal().toLocaleString('en', { )} `;
style: 'percent', if (finalChance < 0.01) {
})}`; l('CMTimerBarGCTime').textContent +=
`<${(0.01).toLocaleString('en', { style: 'percent' })}`;
} else {
l('CMTimerBarGCTime').textContent += finalChance.toLocaleString('en', {
style: 'percent',
});
}
numberOfTimers += 1; numberOfTimers += 1;
} else l('CMTimerBarGC').style.display = 'none'; } else l('CMTimerBarGC').style.display = 'none';
@@ -174,12 +175,18 @@ export function UpdateTimerBar() {
(Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) / (Game.shimmerTypes.reindeer.time - Game.shimmerTypes.reindeer.minTime) /
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime), (Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime),
) ** 5; ) ** 5;
updateChanceTotalDeer(chanceToSpawn); const deerFinalChance = updateChanceTotalDeer(chanceToSpawn);
l('CMTimerBarRenTime').textContent = `${Math.ceil( l('CMTimerBarRenTime').textContent = `${Math.ceil(
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps, (Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps,
)} ${getChanceFinalDeer() < 0.01 ? '<' : ''}${getChanceFinalDeer().toLocaleString('en', { )} `;
style: 'percent', if (deerFinalChance < 0.01) {
})}`; l('CMTimerBarRenTime').textContent +=
`<${(0.01).toLocaleString('en', { style: 'percent' })}`;
} else {
l('CMTimerBarRenTime').textContent += deerFinalChance.toLocaleString('en', {
style: 'percent',
});
}
numberOfTimers += 1; numberOfTimers += 1;
} else { } else {
l('CMTimerBarRen').style.display = 'none'; l('CMTimerBarRen').style.display = 'none';

View File

@@ -12,39 +12,22 @@ export function resetChanceTotalDeer() {
chanceTotalDeer = 1.0; chanceTotalDeer = 1.0;
} }
export function getChanceTotal() {
return chanceTotal;
}
export function getChanceTotalDeer() {
return chanceTotalDeer;
}
/** /**
* Update the probability that a cookie has not spawned * Update the probability that a cookie has not spawned
* @param {number} chanceToSpawn The probablity that a GC appears * @param {number} chanceToSpawn The probablity that a GC appears
* @returns the cumulative probability that a GC has appeared from beginning to now
*/ */
export function updateChanceTotal(chanceToSpawn) { export function updateChanceTotal(chanceToSpawn) {
chanceTotal *= 1 - chanceToSpawn; chanceTotal *= 1 - chanceToSpawn;
return 1 - chanceTotal;
} }
/** /**
* Update the probability that a reindeer has not spawned * Update the probability that a reindeer has not spawned
* @param {number} chanceToSpawn The probablity that a reindeer appears * @param {number} chanceToSpawn The probablity that a reindeer appears
* @returns the cumulative probability that a reindeer has appeared from beginning to now
*/ */
export function updateChanceTotalDeer(chanceToSpawn) { export function updateChanceTotalDeer(chanceToSpawn) {
chanceTotalDeer *= 1 - chanceToSpawn; chanceTotalDeer *= 1 - chanceToSpawn;
}
/**
*
* @returns the cummulative probability that a GC has appeared from beginning to now
*/
export function getChanceFinal() {
return 1 - chanceTotal;
}
/**
*
* @returns the cummulative probability that a reindeer has appeared from beginning to now
*/
export function getChanceFinalDeer() {
return 1 - chanceTotalDeer; return 1 - chanceTotalDeer;
} }