Skip to content

Commit 7af576d

Browse files
committed
bugs
1 parent e50e033 commit 7af576d

5 files changed

Lines changed: 34 additions & 31 deletions

File tree

KTL/actionData.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -845,22 +845,17 @@ let actionData = {
845845
},
846846
updateMults: function() {
847847
let actionObj = data.actions.hearAboutTheLich;
848-
actionObj.progressGain = actionObj.generatorSpeed * (actionObj.efficiency / 100);
849-
actionObj.actionPower = actionObj.actionPowerBase *
850-
actionObj.actionPowerMult * (actionObj.efficiency/100);
851-
data.actions.hearAboutTheLich.resourceToAdd = actionData.hearAboutTheLich.calcFearGain();
852-
data.actions.hearAboutTheLich.resourceIncrease = data.actions.hearAboutTheLich.resourceToAdd *
848+
849+
actionObj.resourceToAdd = actionData.hearAboutTheLich.calcFearGain();
850+
actionObj.resourceIncrease = actionObj.resourceToAdd *
853851
data.actions.overclock.progressGain / data.actions.overclock.progressMax;
854852
},
855853
completeFromOverclock: function() {
856854
let actionObj = data.actions.hearAboutTheLich;
857-
if (data.actions.hearAboutTheLich.unlocked) {
858-
actionObj.progressGain = actionObj.generatorSpeed * (actionObj.efficiency / 100);
859-
actionObj.actionPower = actionObj.actionPowerBase *
860-
actionObj.actionPowerMult * (actionObj.efficiency/100);
861-
data.actions.hearAboutTheLich.actionPower = actionData.hearAboutTheLich.calcFearGain();
862-
data.actions.hearAboutTheLich.resourceToAdd = data.actions.hearAboutTheLich.actionPower;
863-
data.actions.hearAboutTheLich.resource += data.actions.hearAboutTheLich.resourceToAdd;
855+
if (actionObj.unlocked) {
856+
actionObj.actionPower = actionData.hearAboutTheLich.calcFearGain();
857+
actionObj.resourceToAdd = actionObj.actionPower;
858+
actionObj.resource += actionObj.resourceToAdd;
864859
}
865860
},
866861
calcFearGain: function() {

KTL/data/globalsAndInitial.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ data.focusLoopMax = 2.5;
5252
data.options = {};
5353
data.options.updateRate = 20;
5454
data.options.autosaveRate = 10;
55-
data.options.bonusRate = 1;
55+
data.options.bonusRate = 3;
5656
let chartData = []; // Stores { time: number, value: number }
5757
let chartScale = 'linear'; // 'linear' or 'logarithmic'
5858

@@ -99,7 +99,7 @@ function debug() {
9999
return;
100100
}
101101

102-
data.gameSettings.bonusSpeed = 1;
102+
// data.gameSettings.bonusSpeed = 1;
103103
data.currentGameState.KTLBonusTimer = 0;
104104
data.ancientCoin = 5000;
105105

@@ -117,9 +117,12 @@ function debug() {
117117
// data.doneAmulet = true;
118118
// data.displayJob = true;
119119
// buyUpgrade("buyNicerStuff", 0);
120-
// buyUpgrade("stopLettingOpportunityWait", 0);
121-
// buyUpgrade("stopLettingOpportunityWait", 1);
122-
// buyUpgrade("stopLettingOpportunityWait", 2);
120+
buyUpgrade("stopLettingOpportunityWait");
121+
buyUpgrade("stopLettingOpportunityWait");
122+
buyUpgrade("knowWhenToMoveOn");
123+
buyUpgrade("startALittleQuicker");
124+
buyUpgrade("startALittleQuicker");
125+
buyUpgrade("startALittleQuicker");
123126
// setSliderUI("overclock", "reflect", 100);
124127
// unveilAction('makeMoney');
125128

KTL/helpers/interval2.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// WEB WORKER (engine.js)
33
// =================================================================
44
// This script runs in the background and handles all game logic calculations.
5-
6-
75
function loop() {
86
if (timerId !== null) {
97
clearTimeout(timerId);
@@ -14,14 +12,23 @@ function loop() {
1412

1513
const tickInterval = 1000 / data.gameSettings.ticksPerSecond;
1614
let elapsed = now - lastTickTime;
17-
let ticksToProcess = Math.floor(elapsed / tickInterval);
15+
let ticksAvailable = Math.floor(elapsed / tickInterval);
1816
let didSomething = false;
1917

20-
if (ticksToProcess > 0) {
21-
lastTickTime += ticksToProcess * tickInterval;
18+
const maxTicksPerLoop = 10;
19+
let ticksProcessed = ticksAvailable;
20+
21+
if (ticksAvailable > maxTicksPerLoop) {
22+
ticksProcessed = maxTicksPerLoop;
23+
const extraTicks = ticksAvailable - maxTicksPerLoop;
24+
data.currentGameState.bonusTime += extraTicks * tickInterval;
25+
}
26+
27+
if (ticksProcessed > 0) {
28+
lastTickTime += ticksProcessed * tickInterval;
2229

2330
const effectiveSpeed = data.gameSettings.gameSpeed * data.gameSettings.bonusSpeed;
24-
const totalTicksToRun = ticksToProcess * effectiveSpeed;
31+
const totalTicksToRun = ticksProcessed * effectiveSpeed;
2532

2633
if (!data.gameSettings.stop) {
2734
for (let i = 0; i < totalTicksToRun; i++) {
@@ -33,24 +40,22 @@ function loop() {
3340
}
3441
}
3542
if (data.gameSettings.bonusSpeed > 1) {
36-
const processedElapsed = ticksToProcess * tickInterval;
43+
const processedElapsed = ticksProcessed * tickInterval;
3744
const bonusTimeConsumed = processedElapsed * data.gameSettings.gameSpeed * (data.gameSettings.bonusSpeed - 1);
38-
3945
data.currentGameState.bonusTime -= bonusTimeConsumed;
4046
}
4147
} else {
42-
data.currentGameState.bonusTime += tickInterval * ticksToProcess;
48+
data.currentGameState.bonusTime += tickInterval * ticksProcessed;
4349
}
4450

45-
postMessage({
46-
type: 'update',
47-
});
51+
postMessage({ type: 'update' });
4852
}
4953

5054
timerId = setTimeout(loop, 1000 / data.gameSettings.ticksPerSecond);
5155
}
5256

5357

58+
5459
// Listen for updates from the worker
5560
onmessage = function(e) {
5661
const { type } = e.data;

KTL/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
Bonus Speed:
8686
<label><input type="radio" onchange="changeBonusSpeed(3)" name="bonusSpeed" value="3x" checked> 3x</label>
8787
<label><input type="radio" onchange="changeBonusSpeed(10)" name="bonusSpeed" value="10x"> 10x</label>
88-
<!-- <label><input type="radio" onchange="changeBonusSpeed(50)" name="bonusSpeed" value="50x"> 50x</label>-->
88+
<label><input type="radio" onchange="changeBonusSpeed(50)" name="bonusSpeed" value="50x"> 50x</label>
8989
<br>
9090
</div>
9191

KTL/saving.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ function load() {
418418
//these are in the skiplist because if, between saves, an action has changed the atts it has, the links need to be reset instead of saved.
419419
mergeExistingOnly(data, toLoad, "atts", ["linkedActionExpAtts", "linkedActionEfficiencyAtts", "linkedActionOnLevelAtts"]);
420420
mergeExistingOnly(data, toLoad, "options");
421-
data.options.bonusRate = 1
421+
data.options.bonusRate = 3;
422422
mergeExistingOnly(data, toLoad, "gameSettings");
423423

424424

0 commit comments

Comments
 (0)