t1198: combo bonus 1% per step, capped at +30% (COMBO_STEP, COMBO_MAX_STEPS)
@@ -93,9 +93,10 @@ vastgehouden blokje krijgt dezelfde schaal-tween als Tim's KWin Click
93
93
Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).
94
94
Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).
95
95
Landt een cluster meteen in een match, dan is die sprong 25 % sterker,
96
stapeling additief (t1120). Daarbovenop telt een **combo** (t1197): elke
97
eerdere match in de lopende combo geeft +5 % sprong (1e match +0 %, 2e
98
+5 %, 3e +10 %, …); maak je 5 s geen match, dan begint de combo opnieuw.
96
stapeling additief (t1120). Daarbovenop telt een **combo** (t1197/t1198): elke
97
eerdere match in de lopende combo geeft +1 % sprong (1e match +0 %, 2e
98
+1 %, 3e +2 %, …), tot maximaal +30 %; maak je 5 s geen match, dan
99
begint de combo opnieuw.
99
100
Combo en landingsketting tellen op; boven het veld staat het totaal als
100
101
gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.
101
102
@@ -93,9 +93,10 @@ vastgehouden blokje krijgt dezelfde schaal-tween als Tim's KWin Click93
Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).93
Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).94
Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).94
Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).95
Landt een cluster meteen in een match, dan is die sprong 25 % sterker,95
Landt een cluster meteen in een match, dan is die sprong 25 % sterker,96
stapeling additief (t1120). Daarbovenop telt een **combo** (t1197): elke96
stapeling additief (t1120). Daarbovenop telt een **combo** (t1197/t1198): elke97
eerdere match in de lopende combo geeft +5 % sprong (1e match +0 %, 2e97
eerdere match in de lopende combo geeft +1 % sprong (1e match +0 %, 2e98
+5 %, 3e +10 %, …); maak je 5 s geen match, dan begint de combo opnieuw.98
+1 %, 3e +2 %, …), tot maximaal +30 %; maak je 5 s geen match, dan99
begint de combo opnieuw.99
Combo en landingsketting tellen op; boven het veld staat het totaal als100
Combo en landingsketting tellen op; boven het veld staat het totaal als100
gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.101
gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.101
102
@@ -5254,8 +5254,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;
5254
5254
GameCore.SNAP_Y = SNAP_Y;
5255
5255
GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
5256
5256
GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;
5257
/** t1197: each match in a combo adds this much jump height (additive). */
5258
GameCore.COMBO_STEP = 0.05;
5257
/** t1197/t1198: each earlier match in a combo adds this much jump height (additive). */
5258
GameCore.COMBO_STEP = 0.01;
5259
/** t1198: combo steps that count at most (bonus capped at +30 %). */
5260
GameCore.COMBO_MAX_STEPS = 30;
5259
5261
/** t1197: the combo resets when no match is made for this long (s). */
5260
5262
GameCore.COMBO_RESET_S = 5;
5261
5263
GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
@@ -7778,9 +7780,10 @@ GameCore.prototype.resolveMatches = function ()
7778
7780
}
7779
7781
}
7780
7782
var chain = this.landingChainFor(group);
7781
// t1197: combo bonus = COMBO_STEP per earlier match in this combo,
7783
// t1197/t1198: combo bonus = COMBO_STEP per earlier match in this combo
7784
// (at most COMBO_MAX_STEPS steps),
7782
7785
// added to the landing-chain bonus (one shown "+x%").
7783
var comboBonus = GameCore.COMBO_STEP * this.combo;
7786
var comboBonus = GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS);
7784
7787
var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;
7785
7788
height *= bonusMul;
7786
7789
this.launchCluster(group, height, { landingChain: chain });
@@ -8340,7 +8343,7 @@ GameCore.prototype.updateChainIndicator = function (launched)
8340
8343
/** Bonus (percent) the next match would get from the combo alone (t1197). */
8341
8344
GameCore.prototype.comboBonusPct = function ()
8342
8345
{
8343
return Math.round(GameCore.COMBO_STEP * this.combo * 100);
8346
return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
8344
8347
};
8345
8348
8346
8349
GameCore.prototype.hasActiveLandingChain = function ()
@@ -5254,8 +5254,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;5254
GameCore.SNAP_Y = SNAP_Y;5254
GameCore.SNAP_Y = SNAP_Y;5255
GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;5255
GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;5256
GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;5256
GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;5257
/** t1197: each match in a combo adds this much jump height (additive). */5257
/** t1197/t1198: each earlier match in a combo adds this much jump height (additive). */5258
GameCore.COMBO_STEP = 0.05;5258
GameCore.COMBO_STEP = 0.01;5259
/** t1198: combo steps that count at most (bonus capped at +30 %). */5260
GameCore.COMBO_MAX_STEPS = 30;5259
/** t1197: the combo resets when no match is made for this long (s). */5261
/** t1197: the combo resets when no match is made for this long (s). */5260
GameCore.COMBO_RESET_S = 5;5262
GameCore.COMBO_RESET_S = 5;5261
GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;5263
GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;@@ -7778,9 +7780,10 @@ GameCore.prototype.resolveMatches = function ()7778
}7780
}7779
}7781
}7780
var chain = this.landingChainFor(group);7782
var chain = this.landingChainFor(group);7781
// t1197: combo bonus = COMBO_STEP per earlier match in this combo,7783
// t1197/t1198: combo bonus = COMBO_STEP per earlier match in this combo7784
// (at most COMBO_MAX_STEPS steps),7782
// added to the landing-chain bonus (one shown "+x%").7785
// added to the landing-chain bonus (one shown "+x%").7783
var comboBonus = GameCore.COMBO_STEP * this.combo;7786
var comboBonus = GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS);7784
var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;7787
var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;7785
height *= bonusMul;7788
height *= bonusMul;7786
this.launchCluster(group, height, { landingChain: chain });7789
this.launchCluster(group, height, { landingChain: chain });@@ -8340,7 +8343,7 @@ GameCore.prototype.updateChainIndicator = function (launched)8340
/** Bonus (percent) the next match would get from the combo alone (t1197). */8343
/** Bonus (percent) the next match would get from the combo alone (t1197). */8341
GameCore.prototype.comboBonusPct = function ()8344
GameCore.prototype.comboBonusPct = function ()8342
{8345
{8343
return Math.round(GameCore.COMBO_STEP * this.combo * 100);8346
return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);8344
};8347
};8345
8348
8346
GameCore.prototype.hasActiveLandingChain = function ()8349
GameCore.prototype.hasActiveLandingChain = function ()@@ -1217,15 +1217,19 @@ de client Terra (geen fout).
1217
1217
1218
1218
## t1197 — Combo en “+x%”
1219
1219
1220
- Elke match (elk lanceerd cluster) telt in de lopende combo. De sprong
1221
van een match krijgt **+5 % per eerdere match in de combo**
1222
(`GameCore.COMBO_STEP` = 0,05): 1e +0 %, 2e +5 %, 3e +10 %, …
1220
- Elke match (elk gelanceerd cluster) telt in de lopende combo. De sprong
1221
van een match krijgt **+1 % per eerdere match in de combo**
1222
(`GameCore.COMBO_STEP` = 0,01; was 5 %, verlaagd in t1198): 1e +0 %,
1223
2e +1 %, 3e +2 %, … met een **plafond van +30 %**
1224
(`GameCore.COMBO_MAX_STEPS` = 30): combobonus = `0,01·min(combo, 30)`.
1225
De combo blijft doortellen, maar de bonus stijgt niet verder.
1223
1226
Aanname: de eerste match zelf krijgt nog niets — de combo beloont
1224
1227
doorgaan.
1225
1228
- Geen match gedurende 5 s (`GameCore.COMBO_RESET_S`, speeltijd; telt
1226
1229
niet door tijdens pauze) → combo terug naar 0.
1227
1230
- Combinatie met de landingsketting (t1120, +25 % per stap): **additief**,
1228
`factor = 1 + 0,25·ketting + 0,05·combo`. De HUD toont het totaal van
1231
`factor = 1 + 0,25·ketting + 0,01·min(combo, 30)`; het plafond geldt
1232
alleen voor het combodeel, de landingsketting blijft ongewijzigd. De HUD toont het totaal van
1229
1233
de laatste lancering als simpel “+x%” (geel, oranje rand), zolang de
1230
1234
geboosterde cluster vliegt of de combo nog loopt.
1231
1235
- Zit in de gedeelde `GameCore`, dus spelers en bots (offline, online)
@@ -1217,15 +1217,19 @@ de client Terra (geen fout).1217
1217
1218
## t1197 — Combo en “+x%”1218
## t1197 — Combo en “+x%”1219
1219
1220
- Elke match (elk lanceerd cluster) telt in de lopende combo. De sprong1220
- Elke match (elk gelanceerd cluster) telt in de lopende combo. De sprong1221
van een match krijgt **+5 % per eerdere match in de combo**1221
van een match krijgt **+1 % per eerdere match in de combo**1222
(`GameCore.COMBO_STEP` = 0,05): 1e +0 %, 2e +5 %, 3e +10 %, …1222
(`GameCore.COMBO_STEP` = 0,01; was 5 %, verlaagd in t1198): 1e +0 %,1223
2e +1 %, 3e +2 %, … met een **plafond van +30 %**1224
(`GameCore.COMBO_MAX_STEPS` = 30): combobonus = `0,01·min(combo, 30)`.1225
De combo blijft doortellen, maar de bonus stijgt niet verder.1223
Aanname: de eerste match zelf krijgt nog niets — de combo beloont1226
Aanname: de eerste match zelf krijgt nog niets — de combo beloont1224
doorgaan.1227
doorgaan.1225
- Geen match gedurende 5 s (`GameCore.COMBO_RESET_S`, speeltijd; telt1228
- Geen match gedurende 5 s (`GameCore.COMBO_RESET_S`, speeltijd; telt1226
niet door tijdens pauze) → combo terug naar 0.1229
niet door tijdens pauze) → combo terug naar 0.1227
- Combinatie met de landingsketting (t1120, +25 % per stap): **additief**,1230
- Combinatie met de landingsketting (t1120, +25 % per stap): **additief**,1228
`factor = 1 + 0,25·ketting + 0,05·combo`. De HUD toont het totaal van1231
`factor = 1 + 0,25·ketting + 0,01·min(combo, 30)`; het plafond geldt1232
alleen voor het combodeel, de landingsketting blijft ongewijzigd. De HUD toont het totaal van1229
de laatste lancering als simpel “+x%” (geel, oranje rand), zolang de1233
de laatste lancering als simpel “+x%” (geel, oranje rand), zolang de1230
geboosterde cluster vliegt of de combo nog loopt.1234
geboosterde cluster vliegt of de combo nog loopt.1231
- Zit in de gedeelde `GameCore`, dus spelers en bots (offline, online)1235
- Zit in de gedeelde `GameCore`, dus spelers en bots (offline, online)@@ -122,8 +122,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;
122
122
GameCore.SNAP_Y = SNAP_Y;
123
123
GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
124
124
GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;
125
/** t1197: each match in a combo adds this much jump height (additive). */
126
GameCore.COMBO_STEP = 0.05;
125
/** t1197/t1198: each earlier match in a combo adds this much jump height (additive). */
126
GameCore.COMBO_STEP = 0.01;
127
/** t1198: combo steps that count at most (bonus capped at +30 %). */
128
GameCore.COMBO_MAX_STEPS = 30;
127
129
/** t1197: the combo resets when no match is made for this long (s). */
128
130
GameCore.COMBO_RESET_S = 5;
129
131
GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
@@ -2646,9 +2648,10 @@ GameCore.prototype.resolveMatches = function ()
2646
2648
}
2647
2649
}
2648
2650
var chain = this.landingChainFor(group);
2649
// t1197: combo bonus = COMBO_STEP per earlier match in this combo,
2651
// t1197/t1198: combo bonus = COMBO_STEP per earlier match in this combo
2652
// (at most COMBO_MAX_STEPS steps),
2650
2653
// added to the landing-chain bonus (one shown "+x%").
2651
var comboBonus = GameCore.COMBO_STEP * this.combo;
2654
var comboBonus = GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS);
2652
2655
var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;
2653
2656
height *= bonusMul;
2654
2657
this.launchCluster(group, height, { landingChain: chain });
@@ -3208,7 +3211,7 @@ GameCore.prototype.updateChainIndicator = function (launched)
3208
3211
/** Bonus (percent) the next match would get from the combo alone (t1197). */
3209
3212
GameCore.prototype.comboBonusPct = function ()
3210
3213
{
3211
return Math.round(GameCore.COMBO_STEP * this.combo * 100);
3214
return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
3212
3215
};
3213
3216
3214
3217
GameCore.prototype.hasActiveLandingChain = function ()
@@ -122,8 +122,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;122
GameCore.SNAP_Y = SNAP_Y;122
GameCore.SNAP_Y = SNAP_Y;123
GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;123
GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;124
GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;124
GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;125
/** t1197: each match in a combo adds this much jump height (additive). */125
/** t1197/t1198: each earlier match in a combo adds this much jump height (additive). */126
GameCore.COMBO_STEP = 0.05;126
GameCore.COMBO_STEP = 0.01;127
/** t1198: combo steps that count at most (bonus capped at +30 %). */128
GameCore.COMBO_MAX_STEPS = 30;127
/** t1197: the combo resets when no match is made for this long (s). */129
/** t1197: the combo resets when no match is made for this long (s). */128
GameCore.COMBO_RESET_S = 5;130
GameCore.COMBO_RESET_S = 5;129
GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;131
GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;@@ -2646,9 +2648,10 @@ GameCore.prototype.resolveMatches = function ()2646
}2648
}2647
}2649
}2648
var chain = this.landingChainFor(group);2650
var chain = this.landingChainFor(group);2649
// t1197: combo bonus = COMBO_STEP per earlier match in this combo,2651
// t1197/t1198: combo bonus = COMBO_STEP per earlier match in this combo2652
// (at most COMBO_MAX_STEPS steps),2650
// added to the landing-chain bonus (one shown "+x%").2653
// added to the landing-chain bonus (one shown "+x%").2651
var comboBonus = GameCore.COMBO_STEP * this.combo;2654
var comboBonus = GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS);2652
var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;2655
var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;2653
height *= bonusMul;2656
height *= bonusMul;2654
this.launchCluster(group, height, { landingChain: chain });2657
this.launchCluster(group, height, { landingChain: chain });@@ -3208,7 +3211,7 @@ GameCore.prototype.updateChainIndicator = function (launched)3208
/** Bonus (percent) the next match would get from the combo alone (t1197). */3211
/** Bonus (percent) the next match would get from the combo alone (t1197). */3209
GameCore.prototype.comboBonusPct = function ()3212
GameCore.prototype.comboBonusPct = function ()3210
{3213
{3211
return Math.round(GameCore.COMBO_STEP * this.combo * 100);3214
return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);3212
};3215
};3213
3216
3214
GameCore.prototype.hasActiveLandingChain = function ()3217
GameCore.prototype.hasActiveLandingChain = function ()@@ -1,6 +1,6 @@
1
1
'use strict';
2
2
3
// t1197: combo — each match adds +5% jump height (additive with the
3
// t1197/t1198: combo — each match adds +1% jump height (max +30%) (additive with the
4
4
// landing-chain bonus); resets after 5 s without a match.
5
5
6
6
const { describe, it } = require('node:test');
@@ -34,25 +34,26 @@ describe('Match combo (t1197)', () =>
34
34
35
35
it('constants', () =>
36
36
{
37
assert.equal(GameCore.COMBO_STEP, 0.05);
37
assert.equal(GameCore.COMBO_STEP, 0.01);
38
assert.equal(GameCore.COMBO_MAX_STEPS, 30);
38
39
assert.equal(GameCore.COMBO_RESET_S, 5);
39
40
});
40
41
41
it('first match +0%, then +5%, +10%, ... per earlier match in the combo', () =>
42
it('first match +0%, then +1%, +2%, ... per earlier match in the combo', () =>
42
43
{
43
44
const g = makeGame({ noSpawn: true });
44
45
for (let k = 0; k < 4; k++)
45
46
{
46
47
const l = freshMatch(g, 1 + (k % 3));
47
assert.ok(almost(l.comboBonus, 0.05 * k, 1e-12), 'k=' + k);
48
assert.ok(almost(l.jumpHeight, base() * (1 + 0.05 * k), 1e-9));
48
assert.ok(almost(l.comboBonus, 0.01 * k, 1e-12), 'k=' + k);
49
assert.ok(almost(l.jumpHeight, base() * (1 + 0.01 * k), 1e-9));
49
50
assert.equal(g.combo, k + 1);
50
51
}
51
assert.equal(g.lastChainIndicator.bonusPct, 15);
52
assert.equal(g.comboBonusPct(), 20);
52
assert.equal(g.lastChainIndicator.bonusPct, 3);
53
assert.equal(g.comboBonusPct(), 4);
53
54
});
54
55
55
it('adds to the landing-chain bonus (chain 1 + 2 combo matches = +35%)', () =>
56
it('adds to the landing-chain bonus (chain 1 + 2 combo matches = +27%)', () =>
56
57
{
57
58
const g = makeGame({ noSpawn: true });
58
59
g.combo = 2;
@@ -64,8 +65,39 @@ describe('Match combo (t1197)', () =>
64
65
b.clusterId = cluster.id;
65
66
g.landCluster(cluster, [b]);
66
67
const l = g.resolveMatches()[0];
67
assert.ok(almost(l.chainBonus, 1.35, 1e-12));
68
assert.equal(g.lastChainIndicator.bonusPct, 35);
68
assert.ok(almost(l.chainBonus, 1.27, 1e-12));
69
assert.equal(g.lastChainIndicator.bonusPct, 27);
70
});
71
72
it('combo bonus is capped at +30% (0.01 * min(combo, 30))', () =>
73
{
74
for (const [combo, pct] of [[29, 29], [30, 30], [31, 30], [100, 30]])
75
{
76
const g = makeGame({ noSpawn: true });
77
g.combo = combo;
78
const l = freshMatch(g, 1);
79
assert.ok(almost(l.comboBonus, pct / 100, 1e-12), 'combo ' + combo);
80
assert.ok(almost(l.jumpHeight, base() * (1 + pct / 100), 1e-9));
81
assert.equal(g.lastChainIndicator.bonusPct, pct);
82
}
83
const g = makeGame({ noSpawn: true });
84
g.combo = 50;
85
assert.equal(g.comboBonusPct(), 30);
86
});
87
88
it('the cap does not touch the landing chain (chain 1 + capped combo = +55%)', () =>
89
{
90
const g = makeGame({ noSpawn: true });
91
g.combo = 40;
92
g.place(0, 0, 2);
93
g.place(1, 0, 2);
94
const cluster = { id: g.nextClusterId++, jumpHeight: 3, vy: 0, decel: 0, phase: 'down', landingChain: 0 };
95
g.clusters[cluster.id] = cluster;
96
const b = g.createBlock(2, 0, 2, 'flying');
97
b.clusterId = cluster.id;
98
g.landCluster(cluster, [b]);
99
const l = g.resolveMatches()[0];
100
assert.ok(almost(l.chainBonus, 1.55, 1e-12));
69
101
});
70
102
71
103
it('resets after 5 s without a match, not before', () =>
@@ -1,6 +1,6 @@1
'use strict';1
'use strict';2
2
3
// t1197: combo — each match adds +5% jump height (additive with the3
// t1197/t1198: combo — each match adds +1% jump height (max +30%) (additive with the4
// landing-chain bonus); resets after 5 s without a match.4
// landing-chain bonus); resets after 5 s without a match.5
5
6
const { describe, it } = require('node:test');6
const { describe, it } = require('node:test');@@ -34,25 +34,26 @@ describe('Match combo (t1197)', () =>34
34
35
it('constants', () =>35
it('constants', () =>36
{36
{37
assert.equal(GameCore.COMBO_STEP, 0.05);37
assert.equal(GameCore.COMBO_STEP, 0.01);38
assert.equal(GameCore.COMBO_MAX_STEPS, 30);38
assert.equal(GameCore.COMBO_RESET_S, 5);39
assert.equal(GameCore.COMBO_RESET_S, 5);39
});40
});40
41
41
it('first match +0%, then +5%, +10%, ... per earlier match in the combo', () =>42
it('first match +0%, then +1%, +2%, ... per earlier match in the combo', () =>42
{43
{43
const g = makeGame({ noSpawn: true });44
const g = makeGame({ noSpawn: true });44
for (let k = 0; k < 4; k++)45
for (let k = 0; k < 4; k++)45
{46
{46
const l = freshMatch(g, 1 + (k % 3));47
const l = freshMatch(g, 1 + (k % 3));47
assert.ok(almost(l.comboBonus, 0.05 * k, 1e-12), 'k=' + k);48
assert.ok(almost(l.comboBonus, 0.01 * k, 1e-12), 'k=' + k);48
assert.ok(almost(l.jumpHeight, base() * (1 + 0.05 * k), 1e-9));49
assert.ok(almost(l.jumpHeight, base() * (1 + 0.01 * k), 1e-9));49
assert.equal(g.combo, k + 1);50
assert.equal(g.combo, k + 1);50
}51
}51
assert.equal(g.lastChainIndicator.bonusPct, 15);52
assert.equal(g.lastChainIndicator.bonusPct, 3);52
assert.equal(g.comboBonusPct(), 20);53
assert.equal(g.comboBonusPct(), 4);53
});54
});54
55
55
it('adds to the landing-chain bonus (chain 1 + 2 combo matches = +35%)', () =>56
it('adds to the landing-chain bonus (chain 1 + 2 combo matches = +27%)', () =>56
{57
{57
const g = makeGame({ noSpawn: true });58
const g = makeGame({ noSpawn: true });58
g.combo = 2;59
g.combo = 2;@@ -64,8 +65,39 @@ describe('Match combo (t1197)', () =>64
b.clusterId = cluster.id;65
b.clusterId = cluster.id;65
g.landCluster(cluster, [b]);66
g.landCluster(cluster, [b]);66
const l = g.resolveMatches()[0];67
const l = g.resolveMatches()[0];67
assert.ok(almost(l.chainBonus, 1.35, 1e-12));68
assert.ok(almost(l.chainBonus, 1.27, 1e-12));68
assert.equal(g.lastChainIndicator.bonusPct, 35);69
assert.equal(g.lastChainIndicator.bonusPct, 27);70
});71
72
it('combo bonus is capped at +30% (0.01 * min(combo, 30))', () =>73
{74
for (const [combo, pct] of [[29, 29], [30, 30], [31, 30], [100, 30]])75
{76
const g = makeGame({ noSpawn: true });77
g.combo = combo;78
const l = freshMatch(g, 1);79
assert.ok(almost(l.comboBonus, pct / 100, 1e-12), 'combo ' + combo);80
assert.ok(almost(l.jumpHeight, base() * (1 + pct / 100), 1e-9));81
assert.equal(g.lastChainIndicator.bonusPct, pct);82
}83
const g = makeGame({ noSpawn: true });84
g.combo = 50;85
assert.equal(g.comboBonusPct(), 30);86
});87
88
it('the cap does not touch the landing chain (chain 1 + capped combo = +55%)', () =>89
{90
const g = makeGame({ noSpawn: true });91
g.combo = 40;92
g.place(0, 0, 2);93
g.place(1, 0, 2);94
const cluster = { id: g.nextClusterId++, jumpHeight: 3, vy: 0, decel: 0, phase: 'down', landingChain: 0 };95
g.clusters[cluster.id] = cluster;96
const b = g.createBlock(2, 0, 2, 'flying');97
b.clusterId = cluster.id;98
g.landCluster(cluster, [b]);99
const l = g.resolveMatches()[0];100
assert.ok(almost(l.chainBonus, 1.55, 1e-12));69
});101
});70
102
71
it('resets after 5 s without a match, not before', () =>103
it('resets after 5 s without a match, not before', () =>@@ -54,8 +54,8 @@ with sync_playwright() as p:
54
54
page.wait_for_timeout(150)
55
55
txt = page.evaluate("() => { const e = document.getElementById('chain-indicator'); return e && !e.hidden ? e.textContent : null; }")
56
56
style = page.evaluate("() => { const s = getComputedStyle(document.getElementById('chain-indicator')); return [s.color, s.webkitTextStrokeColor, s.webkitTextStrokeWidth]; }")
57
check(res["out"] == [0, 5, 10], f"combo bonus per match {res['out']} (combo {res['combo']})")
58
check(txt == "+10%", f"indicator text {txt!r}")
57
check(res["out"] == [0, 1, 2], f"combo bonus per match {res['out']} (combo {res['combo']})")
58
check(txt == "+2%", f"indicator text {txt!r}")
59
59
check("255, 230, 0" in style[0] and "255, 122, 0" in style[1], f"yellow fill, orange stroke {style}")
60
60
page.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct.png")
61
61
el = page.locator("#chain-indicator")
@@ -54,8 +54,8 @@ with sync_playwright() as p:54
page.wait_for_timeout(150)54
page.wait_for_timeout(150)55
txt = page.evaluate("() => { const e = document.getElementById('chain-indicator'); return e && !e.hidden ? e.textContent : null; }")55
txt = page.evaluate("() => { const e = document.getElementById('chain-indicator'); return e && !e.hidden ? e.textContent : null; }")56
style = page.evaluate("() => { const s = getComputedStyle(document.getElementById('chain-indicator')); return [s.color, s.webkitTextStrokeColor, s.webkitTextStrokeWidth]; }")56
style = page.evaluate("() => { const s = getComputedStyle(document.getElementById('chain-indicator')); return [s.color, s.webkitTextStrokeColor, s.webkitTextStrokeWidth]; }")57
check(res["out"] == [0, 5, 10], f"combo bonus per match {res['out']} (combo {res['combo']})")57
check(res["out"] == [0, 1, 2], f"combo bonus per match {res['out']} (combo {res['combo']})")58
check(txt == "+10%", f"indicator text {txt!r}")58
check(txt == "+2%", f"indicator text {txt!r}")59
check("255, 230, 0" in style[0] and "255, 122, 0" in style[1], f"yellow fill, orange stroke {style}")59
check("255, 230, 0" in style[0] and "255, 122, 0" in style[1], f"yellow fill, orange stroke {style}")60
page.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct.png")60
page.screenshot(path=SHOTS.replace("t1196-", "t1197-") + "plus-pct.png")61
el = page.locator("#chain-indicator")61
el = page.locator("#chain-indicator")