BlueGit

projects-timfalken-com meteors

Merge feature/t1200-combo-display: +x% shows only the combo bonus (t1200)

timfa Grok Bot · pushed by timfa

Authored 2026-11-15 · 2 days ago

Hash
f451dfc49c8fe3708a7d0a00796629599cfb3327
Pipeline
Passed
7 files changed +58 −21
README.md +3 −2
@@ -101,8 +101,9 @@ stapeling additief (t1120). Daarbovenop telt een **combo** (t1197/t1198): elke
101 101 eerdere match in de lopende combo geeft +1 % sprong (1e match +0 %, 2e
102 102 +1 %, 3e +2 %, …), tot maximaal +30 %; maak je 5 s geen match, dan
103 103 begint de combo opnieuw.
104 Combo en landingsketting tellen op; boven het veld staat het totaal als
105 gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.
104 Combo en landingsketting tellen op voor de sprong; boven het veld staat
105 als gele “+x%” met oranje rand **alleen de combobonus**
106 (`0,01 × min(combo, 30)`, t1200), zichtbaar zolang die groter dan 0 is. Zie `docs/ASSUMPTIONS.md`.
106 107
107 108 **Menu tijdens het spel (t1193).** In **Spelen** en **Offline Strijd**
108 109 staat rechtsboven een kleine menuknop (☰). Die pauzeert het spel en
@@ -101,8 +101,9 @@ stapeling additief (t1120). Daarbovenop telt een **combo** (t1197/t1198): elke
101eerdere match in de lopende combo geeft +1 % sprong (1e match +0 %, 2e
101eerdere match in de lopende combo geeft +1 % sprong (1e match +0 %, 2e
102+1 %, 3e +2 %, …), tot maximaal +30 %; maak je 5 s geen match, dan
102+1 %, 3e +2 %, …), tot maximaal +30 %; maak je 5 s geen match, dan
103begint de combo opnieuw.
103begint de combo opnieuw.
104Combo en landingsketting tellen op; boven het veld staat het totaal als
104Combo en landingsketting tellen op voor de sprong; boven het veld staat
105gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.
105als gele “+x%” met oranje rand **alleen de combobonus**
106(`0,01 × min(combo, 30)`, t1200), zichtbaar zolang die groter dan 0 is. Zie `docs/ASSUMPTIONS.md`.
106
107
107**Menu tijdens het spel (t1193).** In **Spelen** en **Offline Strijd**
108**Menu tijdens het spel (t1193).** In **Spelen** en **Offline Strijd**
108staat rechtsboven een kleine menuknop (☰). Die pauzeert het spel en
109staat rechtsboven een kleine menuknop (☰). Die pauzeert het spel en
build/game.js +10 −9
@@ -8394,7 +8394,10 @@ GameCore.prototype.updateChainIndicator = function (launched)
8394 8394 { this.lastChainIndicator = null; }
8395 8395 };
8396 8396
8397 /** Bonus (percent) the next match would get from the combo alone (t1197). */
8397 /**
8398 * Combo bonus in percent, 0.01·min(combo, 30)·100: what the next match gets
8399 * from the combo alone. This is the only number the HUD "+x%" shows (t1200).
8400 */
8398 8401 GameCore.prototype.comboBonusPct = function ()
8399 8402 {
8400 8403 return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
@@ -14954,19 +14957,17 @@ function refreshChainIndicator ()
14954 14957 var el = document.getElementById('chain-indicator');
14955 14958 if (!el)
14956 14959 { return; }
14957 var info = app.core && app.core.lastChainIndicator;
14958 var active = app.core && app.core.hasActiveLandingChain
14959 && app.core.hasActiveLandingChain();
14960 var comboOn = app.core && app.core.combo > 0;
14961 // t1197: just "+x%" (landing chain + combo bonus of the last launch),
14962 // while a boosted cluster flies or the combo is still alive.
14963 if (!info || !(info.bonusPct > 0) || app.mode !== 'playing' || !(active || comboOn))
14960 // t1200: the yellow "+x%" shows ONLY the combo bonus
14961 // (0.01·min(combo, 30)); the landing-chain bonus still boosts the jump
14962 // but is not part of this number. Visible while that bonus is > 0.
14963 var pct = (app.core && app.core.comboBonusPct) ? app.core.comboBonusPct() : 0;
14964 if (!(pct > 0) || app.mode !== 'playing')
14964 14965 {
14965 14966 el.hidden = true;
14966 14967 return;
14967 14968 }
14968 14969 el.hidden = false;
14969 el.textContent = '+' + info.bonusPct + '%';
14970 el.textContent = '+' + pct + '%';
14970 14971 }
14971 14972
14972 14973 function hideChainIndicator ()
@@ -8394,7 +8394,10 @@ GameCore.prototype.updateChainIndicator = function (launched)
8394 { this.lastChainIndicator = null; }
8394 { this.lastChainIndicator = null; }
8395};
8395};
8396
8396
8397/** Bonus (percent) the next match would get from the combo alone (t1197). */
8397/**
8398 * Combo bonus in percent, 0.01·min(combo, 30)·100: what the next match gets
8399 * from the combo alone. This is the only number the HUD "+x%" shows (t1200).
8400 */
8398GameCore.prototype.comboBonusPct = function ()
8401GameCore.prototype.comboBonusPct = function ()
8399{
8402{
8400 return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
8403 return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
@@ -14954,19 +14957,17 @@ function refreshChainIndicator ()
14954 var el = document.getElementById('chain-indicator');
14957 var el = document.getElementById('chain-indicator');
14955 if (!el)
14958 if (!el)
14956 { return; }
14959 { return; }
14957 var info = app.core && app.core.lastChainIndicator;
14960 // t1200: the yellow "+x%" shows ONLY the combo bonus
14958 var active = app.core && app.core.hasActiveLandingChain
14961 // (0.01·min(combo, 30)); the landing-chain bonus still boosts the jump
14959 && app.core.hasActiveLandingChain();
14962 // but is not part of this number. Visible while that bonus is > 0.
14960 var comboOn = app.core && app.core.combo > 0;
14963 var pct = (app.core && app.core.comboBonusPct) ? app.core.comboBonusPct() : 0;
14961 // t1197: just "+x%" (landing chain + combo bonus of the last launch),
14964 if (!(pct > 0) || app.mode !== 'playing')
14962 // while a boosted cluster flies or the combo is still alive.
14963 if (!info || !(info.bonusPct > 0) || app.mode !== 'playing' || !(active || comboOn))
14964 {
14965 {
14965 el.hidden = true;
14966 el.hidden = true;
14966 return;
14967 return;
14967 }
14968 }
14968 el.hidden = false;
14969 el.hidden = false;
14969 el.textContent = '+' + info.bonusPct + '%';
14970 el.textContent = '+' + pct + '%';
14970}
14971}
14971
14972
14972function hideChainIndicator ()
14973function hideChainIndicator ()
docs/ASSUMPTIONS.md +11 −0
@@ -1284,3 +1284,14 @@ zonder dat er iets aan hun spel veranderde; dat vond ik minder logisch.
1284 1284 Aurel blijft de makkelijkste en Cinder de moeilijkste planeet.
1285 1285 Spronghoogte bij 2,0: 1,5 × 13 / 2 = 9,75 tegels (op de oude 1,0 was
1286 1286 dat 19,5); één sprong vanaf de bodem haalt het veld dus niet meer.
1287
1288 ## t1200 — “+x%” toont alleen de combo
1289
1290 De gele “+x%” boven het veld toont nu **alleen de combobonus**:
1291 `0,01 × min(combo, 30)` als percentage (`GameCore.comboBonusPct()`), dus
1292 wat de volgende match van de combo krijgt (na 1 match +1 %, na 3 matches
1293 +3 %, maximaal +30 %). De landingsketting (+25 % per stap) telt nog
1294 gewoon mee in de spronghoogte, maar niet meer in dit getal. De tekst is
1295 alleen zichtbaar zolang die combobonus > 0 is; na 5 s zonder match
1296 (combo terug naar 0) verdwijnt hij. Dit vervangt de weergave-regel uit
1297 t1197 (“totaal van de laatste lancering”).
@@ -1284,3 +1284,14 @@ zonder dat er iets aan hun spel veranderde; dat vond ik minder logisch.
1284Aurel blijft de makkelijkste en Cinder de moeilijkste planeet.
1284Aurel blijft de makkelijkste en Cinder de moeilijkste planeet.
1285Spronghoogte bij 2,0: 1,5 × 13 / 2 = 9,75 tegels (op de oude 1,0 was
1285Spronghoogte bij 2,0: 1,5 × 13 / 2 = 9,75 tegels (op de oude 1,0 was
1286dat 19,5); één sprong vanaf de bodem haalt het veld dus niet meer.
1286dat 19,5); één sprong vanaf de bodem haalt het veld dus niet meer.
1287
1288## t1200 — “+x%” toont alleen de combo
1289
1290De gele “+x%” boven het veld toont nu **alleen de combobonus**:
1291`0,01 × min(combo, 30)` als percentage (`GameCore.comboBonusPct()`), dus
1292wat de volgende match van de combo krijgt (na 1 match +1 %, na 3 matches
1293+3 %, maximaal +30 %). De landingsketting (+25 % per stap) telt nog
1294gewoon mee in de spronghoogte, maar niet meer in dit getal. De tekst is
1295alleen zichtbaar zolang die combobonus > 0 is; na 5 s zonder match
1296(combo terug naar 0) verdwijnt hij. Dit vervangt de weergave-regel uit
1297t1197 (“totaal van de laatste lancering”).
src/gameCore.js +4 −1
@@ -3208,7 +3208,10 @@ GameCore.prototype.updateChainIndicator = function (launched)
3208 3208 { this.lastChainIndicator = null; }
3209 3209 };
3210 3210
3211 /** Bonus (percent) the next match would get from the combo alone (t1197). */
3211 /**
3212 * Combo bonus in percent, 0.01·min(combo, 30)·100: what the next match gets
3213 * from the combo alone. This is the only number the HUD "+x%" shows (t1200).
3214 */
3212 3215 GameCore.prototype.comboBonusPct = function ()
3213 3216 {
3214 3217 return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
@@ -3208,7 +3208,10 @@ GameCore.prototype.updateChainIndicator = function (launched)
3208 { this.lastChainIndicator = null; }
3208 { this.lastChainIndicator = null; }
3209};
3209};
3210
3210
3211/** Bonus (percent) the next match would get from the combo alone (t1197). */
3211/**
3212 * Combo bonus in percent, 0.01·min(combo, 30)·100: what the next match gets
3213 * from the combo alone. This is the only number the HUD "+x%" shows (t1200).
3214 */
3212GameCore.prototype.comboBonusPct = function ()
3215GameCore.prototype.comboBonusPct = function ()
3213{
3216{
3214 return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
3217 return Math.round(GameCore.COMBO_STEP * Math.min(this.combo, GameCore.COMBO_MAX_STEPS) * 100);
src/main.js +6 −8
@@ -1645,19 +1645,17 @@ function refreshChainIndicator ()
1645 1645 var el = document.getElementById('chain-indicator');
1646 1646 if (!el)
1647 1647 { return; }
1648 var info = app.core && app.core.lastChainIndicator;
1649 var active = app.core && app.core.hasActiveLandingChain
1650 && app.core.hasActiveLandingChain();
1651 var comboOn = app.core && app.core.combo > 0;
1652 // t1197: just "+x%" (landing chain + combo bonus of the last launch),
1653 // while a boosted cluster flies or the combo is still alive.
1654 if (!info || !(info.bonusPct > 0) || app.mode !== 'playing' || !(active || comboOn))
1648 // t1200: the yellow "+x%" shows ONLY the combo bonus
1649 // (0.01·min(combo, 30)); the landing-chain bonus still boosts the jump
1650 // but is not part of this number. Visible while that bonus is > 0.
1651 var pct = (app.core && app.core.comboBonusPct) ? app.core.comboBonusPct() : 0;
1652 if (!(pct > 0) || app.mode !== 'playing')
1655 1653 {
1656 1654 el.hidden = true;
1657 1655 return;
1658 1656 }
1659 1657 el.hidden = false;
1660 el.textContent = '+' + info.bonusPct + '%';
1658 el.textContent = '+' + pct + '%';
1661 1659 }
1662 1660
1663 1661 function hideChainIndicator ()
@@ -1645,19 +1645,17 @@ function refreshChainIndicator ()
1645 var el = document.getElementById('chain-indicator');
1645 var el = document.getElementById('chain-indicator');
1646 if (!el)
1646 if (!el)
1647 { return; }
1647 { return; }
1648 var info = app.core && app.core.lastChainIndicator;
1648 // t1200: the yellow "+x%" shows ONLY the combo bonus
1649 var active = app.core && app.core.hasActiveLandingChain
1649 // (0.01·min(combo, 30)); the landing-chain bonus still boosts the jump
1650 && app.core.hasActiveLandingChain();
1650 // but is not part of this number. Visible while that bonus is > 0.
1651 var comboOn = app.core && app.core.combo > 0;
1651 var pct = (app.core && app.core.comboBonusPct) ? app.core.comboBonusPct() : 0;
1652 // t1197: just "+x%" (landing chain + combo bonus of the last launch),
1652 if (!(pct > 0) || app.mode !== 'playing')
1653 // while a boosted cluster flies or the combo is still alive.
1654 if (!info || !(info.bonusPct > 0) || app.mode !== 'playing' || !(active || comboOn))
1655 {
1653 {
1656 el.hidden = true;
1654 el.hidden = true;
1657 return;
1655 return;
1658 }
1656 }
1659 el.hidden = false;
1657 el.hidden = false;
1660 el.textContent = '+' + info.bonusPct + '%';
1658 el.textContent = '+' + pct + '%';
1661}
1659}
1662
1660
1663function hideChainIndicator ()
1661function hideChainIndicator ()
test/combo.test.js +23 −0
@@ -100,6 +100,29 @@ describe('Match combo (t1197)', () =>
100 100 assert.ok(almost(l.chainBonus, 1.55, 1e-12));
101 101 });
102 102
103 it('HUD number (t1200) is only the combo part: 0.01 * min(combo, 30), landing chain excluded', () =>
104 {
105 const g = makeGame({ noSpawn: true });
106 assert.equal(g.comboBonusPct(), 0, 'nothing to show before a match');
107 freshMatch(g, 1);
108 assert.equal(g.comboBonusPct(), 1);
109 g.combo = 2;
110 g.place(0, 0, 2);
111 g.place(1, 0, 2);
112 const cluster = { id: g.nextClusterId++, jumpHeight: 3, vy: 0, decel: 0, phase: 'down', landingChain: 0 };
113 g.clusters[cluster.id] = cluster;
114 const b = g.createBlock(2, 0, 2, 'flying');
115 b.clusterId = cluster.id;
116 g.landCluster(cluster, [b]);
117 const l = g.resolveMatches()[0];
118 assert.ok(almost(l.chainBonus, 1.27, 1e-12), 'jump still gets chain + combo');
119 assert.equal(g.comboBonusPct(), 3, 'HUD shows only the combo (3 matches), not +27%');
120 g.combo = 45;
121 assert.equal(g.comboBonusPct(), 30, 'capped');
122 for (let t = 0; t < 5.1; t += 0.05) g.tick(0.05);
123 assert.equal(g.comboBonusPct(), 0, 'hidden again after the combo resets');
124 });
125
103 126 it('resets after 5 s without a match, not before', () =>
104 127 {
105 128 const g = makeGame({ noSpawn: true });
@@ -100,6 +100,29 @@ describe('Match combo (t1197)', () =>
100 assert.ok(almost(l.chainBonus, 1.55, 1e-12));
100 assert.ok(almost(l.chainBonus, 1.55, 1e-12));
101 });
101 });
102
102
103 it('HUD number (t1200) is only the combo part: 0.01 * min(combo, 30), landing chain excluded', () =>
104 {
105 const g = makeGame({ noSpawn: true });
106 assert.equal(g.comboBonusPct(), 0, 'nothing to show before a match');
107 freshMatch(g, 1);
108 assert.equal(g.comboBonusPct(), 1);
109 g.combo = 2;
110 g.place(0, 0, 2);
111 g.place(1, 0, 2);
112 const cluster = { id: g.nextClusterId++, jumpHeight: 3, vy: 0, decel: 0, phase: 'down', landingChain: 0 };
113 g.clusters[cluster.id] = cluster;
114 const b = g.createBlock(2, 0, 2, 'flying');
115 b.clusterId = cluster.id;
116 g.landCluster(cluster, [b]);
117 const l = g.resolveMatches()[0];
118 assert.ok(almost(l.chainBonus, 1.27, 1e-12), 'jump still gets chain + combo');
119 assert.equal(g.comboBonusPct(), 3, 'HUD shows only the combo (3 matches), not +27%');
120 g.combo = 45;
121 assert.equal(g.comboBonusPct(), 30, 'capped');
122 for (let t = 0; t < 5.1; t += 0.05) g.tick(0.05);
123 assert.equal(g.comboBonusPct(), 0, 'hidden again after the combo resets');
124 });
125
103 it('resets after 5 s without a match, not before', () =>
126 it('resets after 5 s without a match, not before', () =>
104 {
127 {
105 const g = makeGame({ noSpawn: true });
128 const g = makeGame({ noSpawn: true });
test/t1196-t1198-playwright.py +1 −1
@@ -55,7 +55,7 @@ with sync_playwright() as p:
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 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}")
58 check(txt == "+3%", 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")
@@ -55,7 +55,7 @@ with sync_playwright() as p:
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, 1, 2], 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 == "+2%", f"indicator text {txt!r}")
58 check(txt == "+3%", 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")