diff --git a/game.js b/game.js index d777932..97f019d 100644 --- a/game.js +++ b/game.js @@ -1125,13 +1125,16 @@ function updateRates() { G.userRate += 5 * timmyCount * (timmyMult - 1); } - // Bilbo randomness: 10% chance of massive creative burst - if (G.buildings.bilbo > 0 && Math.random() < CONFIG.BILBO_BURST_CHANCE) { - G.creativityRate += 50 * G.buildings.bilbo; - } - // Bilbo vanishing: 5% chance of zero creativity this tick - if (G.buildings.bilbo > 0 && Math.random() < CONFIG.BILBO_VANISH_CHANCE) { - G.creativityRate = 0; + // Bilbo randomness: flags are set per-tick in tick(), not here + // updateRates() is called from many non-tick contexts (buy, resolve, sprint) + // and would cause rate flickering if random rolls happened here + if (G.buildings.bilbo > 0) { + if (G.bilboBurstActive) { + G.creativityRate += 50 * G.buildings.bilbo; + } + if (G.bilboVanishActive) { + G.creativityRate = 0; + } } // Allegro requires trust @@ -1228,6 +1231,17 @@ function tick() { G.tick += dt; G.playTime += dt; + // Bilbo randomness: roll once per tick, store as flags for updateRates() + // Previously this was inside updateRates() which caused flickering + // since updateRates() is called from many non-tick contexts + if (G.buildings.bilbo > 0) { + G.bilboBurstActive = Math.random() < CONFIG.BILBO_BURST_CHANCE; + G.bilboVanishActive = Math.random() < CONFIG.BILBO_VANISH_CHANCE; + } else { + G.bilboBurstActive = false; + G.bilboVanishActive = false; + } + // Sprint ability tickSprint(dt);