Minor refactor to remove unused probability functions and combine functions that were only used in one spot.

This commit is contained in:
Kevin Radloff
2025-02-26 07:48:56 -05:00
committed by Daniël van Noord
parent 270190feae
commit 4e6c828f8b
6 changed files with 14 additions and 36 deletions

View File

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