BlueGit

projects-timfalken-com meteors

Merge feature/t1193-menu-login: in-game menu, login redirect, reward tempo, text removals, last planet, combo, defeated count (t1193-t1198)

timfa Grok Bot · pushed by timfa

Authored 2026-11-15 · 2 days ago

Hash
42c6fb992f0e855cb2e5dfdb9c3b8e6c4f8ba05c
Pipeline
Passed
23 files changed +1565 −364
README.md +28 −5
@@ -93,7 +93,25 @@ 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). Zie `docs/ASSUMPTIONS.md`.
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.
99 Combo en landingsketting tellen op; boven het veld staat het totaal als
100 gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.
101
102 **Menu tijdens het spel (t1193).** In **Spelen** en **Offline Strijd**
103 staat rechtsboven een kleine menuknop (☰). Die pauzeert het spel en
104 biedt **Verder** en **Terug naar hoofdmenu**. Terug naar het menu beëindigt
105 de wedstrijd: ingelogd zie je eerst het puntenscherm (titel “Spel
106 beëindigd”) zodat de punten tot dan toe via `play_finish` bij je profiel
107 komen; uitgelogd ga je direct naar het menu. In Offline Strijd volgt dan
108 geen volgende ronde. De server-limieten op punten blijven gelden.
109
110 **Laatste planeet (t1196).** De laatst gekozen planeet (standaard of
111 eigen) staat bij elk planeetkeuzescherm (Spelen, Offline Strijd, Online)
112 alvast geselecteerd. Ingelogd staat die in je profiel op de server
113 (`set_last_planet`), uitgelogd in `localStorage`. Is een eigen planeet
114 verwijderd, dan valt de keuze terug op Terra.
97 115
98 116
99 117 ## Planeten (stage 3)
@@ -150,8 +168,10 @@ schuift die tekst naar boven en vliegen blokjes van jouw planeet (ook
150 168 eigen planeten) in boogjes naar het getal onderaan: je profieltotaal.
151 169 Elk blokje is één nieuw verdiend punt, dus het getal loopt van het
152 170 totaal vóór de ronde naar het nieuwe totaal dat de server bevestigt.
153 Het tempo begint op 15 blokjes per seconde en wordt elke seconde 10
154 blokjes/s sneller (253 punten ≈ 5,8 s, 800 ≈ 11,2 s, 2000 ≈ 18,6 s). Daarna ga je, net als voorheen,
171 Het tempo begint op 3 blokjes per seconde en versnelt per beloning
172 precies zo veel dat het laatste blokje altijd na ~4 s vertrekt, hoeveel
173 punten het ook zijn (t1194; bij weinig punten een vast tempo, zie
174 `docs/ASSUMPTIONS.md`). Daarna nog de vlucht van het laatste blokje. Daarna ga je, net als voorheen,
155 175 naar het menu, de volgende ronde, het resultaatscherm of de lobby.
156 176 Uitgelogd verandert er niets. Zie `docs/ASSUMPTIONS.md` (t1173).
157 177
@@ -175,14 +195,17 @@ Op het menu kies je **Offline Strijd**, daarna een planeet. Je speelt
175 195 tegen lokale bots alsof het multiplayer is (schoten, miss-kans,
176 196 miniatuurvelden), helemaal in de browser. Eerst 1 tegenstander, daarna
177 197 2, en verder N tegenstanders voor N−1 rondes, met stijgende skill
178 (5 % + 1 % per ronde). Als je verliest zie je de bereikte ronde.
198 (5 % + 1 % per ronde). Als je verliest zie je de bereikte ronde en
199 hoeveel tegenstanders je in totaal (over alle rondes) hebt verslagen
200 (t1198). De HUD toont alleen “Ronde N”.
179 201 Zie `docs/ASSUMPTIONS.md` (t1119).
180 202
181 203 ## Online spelen (stage 2)
182 204
183 205 Solo blijft werken, ook als online nog niet is ingesteld. Op het menu kies je
184 206 **Online spelen**. Na inloggen via [auth.timfalken.com](https://auth.timfalken.com)
185 maak je een lobby (of val je in met een code). Onbeperkt aantal spelers, praktisch
207 (gestart vanuit Online kom je terug in het online-paneel; gestart vanaf
208 het hoofdmenu kom je terug op het hoofdmenu, t1193) maak je een lobby (of val je in met een code). Onbeperkt aantal spelers, praktisch
186 209 maximum 32. Iedereen drukt op Gereed; de host start als er minstens twee spelers
187 210 zijn en iedereen gereed is.
188 211
@@ -93,7 +93,25 @@ vastgehouden blokje krijgt dezelfde schaal-tween als Tim's KWin Click
93Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).
93Tween (150 ms easeOutBack naar 80 %, 720 ms easeOutElastic terug).
94Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).
94Wissels (speler en bot) animeren visueel in 100 ms easeOutCubic (t1121).
95Landt een cluster meteen in een match, dan is die sprong 25 % sterker,
95Landt een cluster meteen in een match, dan is die sprong 25 % sterker,
96stapeling additief (t1120). Zie `docs/ASSUMPTIONS.md`.
96stapeling additief (t1120). Daarbovenop telt een **combo** (t1197): elke
97eerdere 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.
99Combo en landingsketting tellen op; boven het veld staat het totaal als
100gele “+x%” met oranje rand. Zie `docs/ASSUMPTIONS.md`.
101
102**Menu tijdens het spel (t1193).** In **Spelen** en **Offline Strijd**
103staat rechtsboven een kleine menuknop (☰). Die pauzeert het spel en
104biedt **Verder** en **Terug naar hoofdmenu**. Terug naar het menu beëindigt
105de wedstrijd: ingelogd zie je eerst het puntenscherm (titel “Spel
106beëindigd”) zodat de punten tot dan toe via `play_finish` bij je profiel
107komen; uitgelogd ga je direct naar het menu. In Offline Strijd volgt dan
108geen volgende ronde. De server-limieten op punten blijven gelden.
109
110**Laatste planeet (t1196).** De laatst gekozen planeet (standaard of
111eigen) staat bij elk planeetkeuzescherm (Spelen, Offline Strijd, Online)
112alvast geselecteerd. Ingelogd staat die in je profiel op de server
113(`set_last_planet`), uitgelogd in `localStorage`. Is een eigen planeet
114verwijderd, dan valt de keuze terug op Terra.
97
115
98
116
99## Planeten (stage 3)
117## Planeten (stage 3)
@@ -150,8 +168,10 @@ schuift die tekst naar boven en vliegen blokjes van jouw planeet (ook
150eigen planeten) in boogjes naar het getal onderaan: je profieltotaal.
168eigen planeten) in boogjes naar het getal onderaan: je profieltotaal.
151Elk blokje is één nieuw verdiend punt, dus het getal loopt van het
169Elk blokje is één nieuw verdiend punt, dus het getal loopt van het
152totaal vóór de ronde naar het nieuwe totaal dat de server bevestigt.
170totaal vóór de ronde naar het nieuwe totaal dat de server bevestigt.
153Het tempo begint op 15 blokjes per seconde en wordt elke seconde 10
171Het tempo begint op 3 blokjes per seconde en versnelt per beloning
154blokjes/s sneller (253 punten ≈ 5,8 s, 800 ≈ 11,2 s, 2000 ≈ 18,6 s). Daarna ga je, net als voorheen,
172precies zo veel dat het laatste blokje altijd na ~4 s vertrekt, hoeveel
173punten het ook zijn (t1194; bij weinig punten een vast tempo, zie
174`docs/ASSUMPTIONS.md`). Daarna nog de vlucht van het laatste blokje. Daarna ga je, net als voorheen,
155naar het menu, de volgende ronde, het resultaatscherm of de lobby.
175naar het menu, de volgende ronde, het resultaatscherm of de lobby.
156Uitgelogd verandert er niets. Zie `docs/ASSUMPTIONS.md` (t1173).
176Uitgelogd verandert er niets. Zie `docs/ASSUMPTIONS.md` (t1173).
157
177
@@ -175,14 +195,17 @@ Op het menu kies je **Offline Strijd**, daarna een planeet. Je speelt
175tegen lokale bots alsof het multiplayer is (schoten, miss-kans,
195tegen lokale bots alsof het multiplayer is (schoten, miss-kans,
176miniatuurvelden), helemaal in de browser. Eerst 1 tegenstander, daarna
196miniatuurvelden), helemaal in de browser. Eerst 1 tegenstander, daarna
1772, en verder N tegenstanders voor N−1 rondes, met stijgende skill
1972, en verder N tegenstanders voor N−1 rondes, met stijgende skill
178(5 % + 1 % per ronde). Als je verliest zie je de bereikte ronde.
198(5 % + 1 % per ronde). Als je verliest zie je de bereikte ronde en
199hoeveel tegenstanders je in totaal (over alle rondes) hebt verslagen
200(t1198). De HUD toont alleen “Ronde N”.
179Zie `docs/ASSUMPTIONS.md` (t1119).
201Zie `docs/ASSUMPTIONS.md` (t1119).
180
202
181## Online spelen (stage 2)
203## Online spelen (stage 2)
182
204
183Solo blijft werken, ook als online nog niet is ingesteld. Op het menu kies je
205Solo blijft werken, ook als online nog niet is ingesteld. Op het menu kies je
184**Online spelen**. Na inloggen via [auth.timfalken.com](https://auth.timfalken.com)
206**Online spelen**. Na inloggen via [auth.timfalken.com](https://auth.timfalken.com)
185maak je een lobby (of val je in met een code). Onbeperkt aantal spelers, praktisch
207(gestart vanuit Online kom je terug in het online-paneel; gestart vanaf
208het hoofdmenu kom je terug op het hoofdmenu, t1193) maak je een lobby (of val je in met een code). Onbeperkt aantal spelers, praktisch
186maximum 32. Iedereen drukt op Gereed; de host start als er minstens twee spelers
209maximum 32. Iedereen drukt op Gereed; de host start als er minstens twee spelers
187zijn en iedereen gereed is.
210zijn en iedereen gereed is.
188
211
build/game.js +391 −154
@@ -1023,7 +1023,6 @@ var BLOCK_REGISTRY = {
1023 1023 var I18N_CATALOG = {
1024 1024 "locales": {
1025 1025 "en": {
1026 "menu.tagline": "Three in a row, and your blocks get rocket boosters.",
1027 1026 "menu.play": "Play",
1028 1027 "menu.offline": "Offline Battle",
1029 1028 "menu.online": "Play online",
@@ -1038,7 +1037,6 @@ var I18N_CATALOG = {
1038 1037 "menu.logout": "Log out",
1039 1038 "menu.player": "player",
1040 1039 "planet.title": "Choose a field",
1041 "planet.tagline": "Each field is a planet, with its own people, gravity, air and mass.",
1042 1040 "planet.back": "Back",
1043 1041 "planet.customBadge": "Yours",
1044 1042 "stats.powerLabel": "Power",
@@ -1073,7 +1071,7 @@ var I18N_CATALOG = {
1073 1071 "online.you": "you",
1074 1072 "designer.title": "Planet Designer",
1075 1073 "designer.taglineBefore": "Total:",
1076 "designer.taglineAfter": "points. You unlock blocks by earning points — you do not spend them.",
1074 "designer.taglineAfter": "points.",
1077 1075 "designer.empty": "You don’t have any planets of your own yet. Create one.",
1078 1076 "designer.new": "New planet",
1079 1077 "designer.editTitle": "Edit planet",
@@ -1104,19 +1102,16 @@ var I18N_CATALOG = {
1104 1102 "designer.defaultPeople": "People",
1105 1103 "hud.points": "Points",
1106 1104 "hud.round": "Round {n}",
1107 "hud.skill": "Skill {n}%",
1108 1105 "hud.out": "Out",
1109 1106 "hud.miniPoints": "Points {n}",
1110 1107 "hud.opponent.one": "opponent",
1111 1108 "hud.opponent.few": "opponents",
1112 1109 "hud.opponent.many": "opponents",
1113 1110 "hud.opponent.other": "opponents",
1114 "hud.opponentsLine": "{n} {word}",
1115 1111 "offline.resultTitle": "Offline Battle",
1116 1112 "offline.reachedBefore": "You reached round",
1117 1113 "offline.reachedAfter": ".",
1118 1114 "offline.reached": "You reached round {n}.",
1119 "offline.detail": "You played against {n} {opponents} at skill {skill}%.",
1120 1115 "offline.backMenu": "Back to the menu",
1121 1116 "gameover.title": "You lost",
1122 1117 "gameover.detail": "Every column is locked.",
@@ -1305,10 +1300,18 @@ var I18N_CATALOG = {
1305 1300 "reward.won": "You won!",
1306 1301 "reward.lost": "You lost...",
1307 1302 "reward.total": "Total points",
1308 "reward.continue": "Tap to continue"
1303 "reward.continue": "Tap to continue",
1304 "game.menu": "Menu",
1305 "game.paused": "Paused",
1306 "game.resume": "Resume",
1307 "game.backToMenu": "Back to main menu",
1308 "reward.ended": "Game ended",
1309 "offline.defeated.one": "{n} opponent defeated",
1310 "offline.defeated.few": "{n} opponents defeated",
1311 "offline.defeated.many": "{n} opponents defeated",
1312 "offline.defeated.other": "{n} opponents defeated"
1309 1313 },
1310 1314 "nl": {
1311 "menu.tagline": "Drie op een rij, en je blokjes krijgen raketmotoren.",
1312 1315 "menu.play": "Spelen",
1313 1316 "menu.offline": "Offline Strijd",
1314 1317 "menu.online": "Online spelen",
@@ -1323,7 +1326,6 @@ var I18N_CATALOG = {
1323 1326 "menu.logout": "Uitloggen",
1324 1327 "menu.player": "speler",
1325 1328 "planet.title": "Kies een veld",
1326 "planet.tagline": "Elk veld is een planeet, met een eigen volk, zwaartekracht, lucht en massa.",
1327 1329 "planet.back": "Terug",
1328 1330 "planet.customBadge": "Eigen",
1329 1331 "stats.powerLabel": "Power",
@@ -1358,7 +1360,7 @@ var I18N_CATALOG = {
1358 1360 "online.you": "jij",
1359 1361 "designer.title": "Planeetontwerper",
1360 1362 "designer.taglineBefore": "Totaal:",
1361 "designer.taglineAfter": "punten. Blokjes ontgrendel je door punten te verdienen — je geeft ze niet uit.",
1363 "designer.taglineAfter": "punten.",
1362 1364 "designer.empty": "Je hebt nog geen eigen planeten. Maak er een aan.",
1363 1365 "designer.new": "Nieuwe planeet",
1364 1366 "designer.editTitle": "Planeet bewerken",
@@ -1389,19 +1391,16 @@ var I18N_CATALOG = {
1389 1391 "designer.defaultPeople": "Volk",
1390 1392 "hud.points": "Punten",
1391 1393 "hud.round": "Ronde {n}",
1392 "hud.skill": "Skill {n}%",
1393 1394 "hud.out": "Uit",
1394 1395 "hud.miniPoints": "Punten {n}",
1395 1396 "hud.opponent.one": "tegenstander",
1396 1397 "hud.opponent.few": "tegenstanders",
1397 1398 "hud.opponent.many": "tegenstanders",
1398 1399 "hud.opponent.other": "tegenstanders",
1399 "hud.opponentsLine": "{n} {word}",
1400 1400 "offline.resultTitle": "Offline Strijd",
1401 1401 "offline.reachedBefore": "Je hebt ronde",
1402 1402 "offline.reachedAfter": " bereikt.",
1403 1403 "offline.reached": "Je hebt ronde {n} bereikt.",
1404 "offline.detail": "Je speelde tegen {n} {opponents} met skill {skill}%.",
1405 1404 "offline.backMenu": "Terug naar het menu",
1406 1405 "gameover.title": "Je hebt verloren",
1407 1406 "gameover.detail": "Alle kolommen zitten vast.",
@@ -1590,10 +1589,18 @@ var I18N_CATALOG = {
1590 1589 "reward.won": "Gewonnen!",
1591 1590 "reward.lost": "Verloren...",
1592 1591 "reward.total": "Totaal punten",
1593 "reward.continue": "Tik om verder te gaan"
1592 "reward.continue": "Tik om verder te gaan",
1593 "game.menu": "Menu",
1594 "game.paused": "Gepauzeerd",
1595 "game.resume": "Verder spelen",
1596 "game.backToMenu": "Terug naar hoofdmenu",
1597 "reward.ended": "Spel gestopt",
1598 "offline.defeated.one": "{n} tegenstander verslagen",
1599 "offline.defeated.few": "{n} tegenstanders verslagen",
1600 "offline.defeated.many": "{n} tegenstanders verslagen",
1601 "offline.defeated.other": "{n} tegenstanders verslagen"
1594 1602 },
1595 1603 "de": {
1596 "menu.tagline": "Drei in einer Reihe — und deine Blöcke bekommen Raketenantrieb.",
1597 1604 "menu.play": "Spielen",
1598 1605 "menu.offline": "Offline-Kampf",
1599 1606 "menu.online": "Online spielen",
@@ -1608,7 +1615,6 @@ var I18N_CATALOG = {
1608 1615 "menu.logout": "Abmelden",
1609 1616 "menu.player": "Spieler",
1610 1617 "planet.title": "Wähle ein Feld",
1611 "planet.tagline": "Jedes Feld ist ein Planet mit eigenem Volk, eigener Schwerkraft, Luft und Masse.",
1612 1618 "planet.back": "Zurück",
1613 1619 "planet.customBadge": "Eigene",
1614 1620 "stats.powerLabel": "Power",
@@ -1643,7 +1649,7 @@ var I18N_CATALOG = {
1643 1649 "online.you": "du",
1644 1650 "designer.title": "Planeten-Designer",
1645 1651 "designer.taglineBefore": "Gesamt:",
1646 "designer.taglineAfter": "Punkte. Blöcke schaltest du frei, indem du Punkte verdienst — du gibst sie nicht aus.",
1652 "designer.taglineAfter": "Punkte.",
1647 1653 "designer.empty": "Du hast noch keine eigenen Planeten. Erstelle einen.",
1648 1654 "designer.new": "Neuer Planet",
1649 1655 "designer.editTitle": "Planet bearbeiten",
@@ -1674,19 +1680,16 @@ var I18N_CATALOG = {
1674 1680 "designer.defaultPeople": "Volk",
1675 1681 "hud.points": "Punkte",
1676 1682 "hud.round": "Runde {n}",
1677 "hud.skill": "Können {n} %",
1678 1683 "hud.out": "Raus",
1679 1684 "hud.miniPoints": "Punkte {n}",
1680 1685 "hud.opponent.one": "Gegner",
1681 1686 "hud.opponent.few": "Gegner",
1682 1687 "hud.opponent.many": "Gegner",
1683 1688 "hud.opponent.other": "Gegner",
1684 "hud.opponentsLine": "{n} {word}",
1685 1689 "offline.resultTitle": "Offline-Kampf",
1686 1690 "offline.reachedBefore": "Du hast Runde",
1687 1691 "offline.reachedAfter": " erreicht.",
1688 1692 "offline.reached": "Du hast Runde {n} erreicht.",
1689 "offline.detail": "Du hast gegen {n} {opponents} mit Können {skill} % gespielt.",
1690 1693 "offline.backMenu": "Zurück zum Menü",
1691 1694 "gameover.title": "Du hast verloren",
1692 1695 "gameover.detail": "Alle Spalten sind festgesetzt.",
@@ -1875,10 +1878,18 @@ var I18N_CATALOG = {
1875 1878 "reward.won": "Gewonnen!",
1876 1879 "reward.lost": "Verloren...",
1877 1880 "reward.total": "Punkte gesamt",
1878 "reward.continue": "Tippen zum Fortfahren"
1881 "reward.continue": "Tippen zum Fortfahren",
1882 "game.menu": "Menü",
1883 "game.paused": "Pausiert",
1884 "game.resume": "Weiterspielen",
1885 "game.backToMenu": "Zurück zum Hauptmenü",
1886 "reward.ended": "Spiel beendet",
1887 "offline.defeated.one": "{n} Gegner besiegt",
1888 "offline.defeated.few": "{n} Gegner besiegt",
1889 "offline.defeated.many": "{n} Gegner besiegt",
1890 "offline.defeated.other": "{n} Gegner besiegt"
1879 1891 },
1880 1892 "fr": {
1881 "menu.tagline": "Trois d’affilée, et tes blocs s’équipent de propulseurs.",
1882 1893 "menu.play": "Jouer",
1883 1894 "menu.offline": "Combat hors ligne",
1884 1895 "menu.online": "Jouer en ligne",
@@ -1893,7 +1904,6 @@ var I18N_CATALOG = {
1893 1904 "menu.logout": "Déconnexion",
1894 1905 "menu.player": "joueur",
1895 1906 "planet.title": "Choisis un terrain",
1896 "planet.tagline": "Chaque terrain est une planète, avec son peuple, sa gravité, son air et sa masse.",
1897 1907 "planet.back": "Retour",
1898 1908 "planet.customBadge": "Perso",
1899 1909 "stats.powerLabel": "Puissance",
@@ -1928,7 +1938,7 @@ var I18N_CATALOG = {
1928 1938 "online.you": "toi",
1929 1939 "designer.title": "Concepteur de planètes",
1930 1940 "designer.taglineBefore": "Total :",
1931 "designer.taglineAfter": "points. Tu débloques des blocs en gagnant des points — tu ne les dépenses pas.",
1941 "designer.taglineAfter": "points.",
1932 1942 "designer.empty": "Tu n’as pas encore de planète à toi. Crées-en une.",
1933 1943 "designer.new": "Nouvelle planète",
1934 1944 "designer.editTitle": "Modifier la planète",
@@ -1959,19 +1969,16 @@ var I18N_CATALOG = {
1959 1969 "designer.defaultPeople": "Peuple",
1960 1970 "hud.points": "Points",
1961 1971 "hud.round": "Manche {n}",
1962 "hud.skill": "Niveau {n} %",
1963 1972 "hud.out": "Éliminé",
1964 1973 "hud.miniPoints": "Points {n}",
1965 1974 "hud.opponent.one": "adversaire",
1966 1975 "hud.opponent.few": "adversaires",
1967 1976 "hud.opponent.many": "adversaires",
1968 1977 "hud.opponent.other": "adversaires",
1969 "hud.opponentsLine": "{n} {word}",
1970 1978 "offline.resultTitle": "Combat hors ligne",
1971 1979 "offline.reachedBefore": "Tu as atteint la manche",
1972 1980 "offline.reachedAfter": ".",
1973 1981 "offline.reached": "Tu as atteint la manche {n}.",
1974 "offline.detail": "Tu as joué contre {n} {opponents} au niveau {skill} %.",
1975 1982 "offline.backMenu": "Retour au menu",
1976 1983 "gameover.title": "Tu as perdu",
1977 1984 "gameover.detail": "Toutes les colonnes sont bloquées.",
@@ -2160,10 +2167,18 @@ var I18N_CATALOG = {
2160 2167 "reward.won": "Victoire !",
2161 2168 "reward.lost": "Perdu...",
2162 2169 "reward.total": "Total des points",
2163 "reward.continue": "Touchez pour continuer"
2170 "reward.continue": "Touchez pour continuer",
2171 "game.menu": "Menu",
2172 "game.paused": "En pause",
2173 "game.resume": "Reprendre",
2174 "game.backToMenu": "Retour au menu principal",
2175 "reward.ended": "Partie terminée",
2176 "offline.defeated.one": "{n} adversaire vaincu",
2177 "offline.defeated.few": "{n} adversaires vaincus",
2178 "offline.defeated.many": "{n} adversaires vaincus",
2179 "offline.defeated.other": "{n} adversaires vaincus"
2164 2180 },
2165 2181 "ja": {
2166 "menu.tagline": "三つ揃えると、ブロックにロケットが点火します。",
2167 2182 "menu.play": "プレイ",
2168 2183 "menu.offline": "オフライン対戦",
2169 2184 "menu.online": "オンラインで遊ぶ",
@@ -2178,7 +2193,6 @@ var I18N_CATALOG = {
2178 2193 "menu.logout": "ログアウト",
2179 2194 "menu.player": "プレイヤー",
2180 2195 "planet.title": "フィールドを選ぶ",
2181 "planet.tagline": "各フィールドは惑星です。固有の民、重力、大気、質量を持ちます。",
2182 2196 "planet.back": "戻る",
2183 2197 "planet.customBadge": "自作",
2184 2198 "stats.powerLabel": "パワー",
@@ -2213,7 +2227,7 @@ var I18N_CATALOG = {
2213 2227 "online.you": "あなた",
2214 2228 "designer.title": "惑星デザイナー",
2215 2229 "designer.taglineBefore": "合計:",
2216 "designer.taglineAfter": "ポイント。ポイントを獲得するとブロックが解放されます。消費はしません。",
2230 "designer.taglineAfter": "ポイント。",
2217 2231 "designer.empty": "まだ自分の惑星がありません。新しく作ってみましょう。",
2218 2232 "designer.new": "新しい惑星",
2219 2233 "designer.editTitle": "惑星を編集",
@@ -2244,19 +2258,16 @@ var I18N_CATALOG = {
2244 2258 "designer.defaultPeople": "民",
2245 2259 "hud.points": "ポイント",
2246 2260 "hud.round": "ラウンド {n}",
2247 "hud.skill": "スキル {n}%",
2248 2261 "hud.out": "脱落",
2249 2262 "hud.miniPoints": "ポイント {n}",
2250 2263 "hud.opponent.one": "相手",
2251 2264 "hud.opponent.few": "相手",
2252 2265 "hud.opponent.many": "相手",
2253 2266 "hud.opponent.other": "相手",
2254 "hud.opponentsLine": "{word} {n} 人",
2255 2267 "offline.resultTitle": "オフライン対戦",
2256 2268 "offline.reachedBefore": "到達ラウンド:",
2257 2269 "offline.reachedAfter": "。",
2258 2270 "offline.reached": "ラウンド {n} まで到達しました。",
2259 "offline.detail": "スキル {skill}% の{opponents}{n}人と対戦しました。",
2260 2271 "offline.backMenu": "メニューに戻る",
2261 2272 "gameover.title": "負けました",
2262 2273 "gameover.detail": "すべての列がロックされました。",
@@ -2445,10 +2456,18 @@ var I18N_CATALOG = {
2445 2456 "reward.won": "勝利!",
2446 2457 "reward.lost": "敗北...",
2447 2458 "reward.total": "合計ポイント",
2448 "reward.continue": "タップして続ける"
2459 "reward.continue": "タップして続ける",
2460 "game.menu": "メニュー",
2461 "game.paused": "一時停止中",
2462 "game.resume": "再開",
2463 "game.backToMenu": "メインメニューに戻る",
2464 "reward.ended": "ゲーム終了",
2465 "offline.defeated.one": "{n}人の相手を倒した",
2466 "offline.defeated.few": "{n}人の相手を倒した",
2467 "offline.defeated.many": "{n}人の相手を倒した",
2468 "offline.defeated.other": "{n}人の相手を倒した"
2449 2469 },
2450 2470 "zh": {
2451 "menu.tagline": "三个一排,你的方块就会装上火箭。",
2452 2471 "menu.play": "开始游戏",
2453 2472 "menu.offline": "离线对战",
2454 2473 "menu.online": "在线游戏",
@@ -2463,7 +2482,6 @@ var I18N_CATALOG = {
2463 2482 "menu.logout": "退出",
2464 2483 "menu.player": "玩家",
2465 2484 "planet.title": "选择场地",
2466 "planet.tagline": "每块场地都是一颗星球,有自己的居民、重力、空气和质量。",
2467 2485 "planet.back": "返回",
2468 2486 "planet.customBadge": "自制",
2469 2487 "stats.powerLabel": "力量",
@@ -2498,7 +2516,7 @@ var I18N_CATALOG = {
2498 2516 "online.you": "你",
2499 2517 "designer.title": "星球设计器",
2500 2518 "designer.taglineBefore": "总分:",
2501 "designer.taglineAfter": "分。通过得分解锁方块——分数不会被消耗。",
2519 "designer.taglineAfter": "分。",
2502 2520 "designer.empty": "你还没有自己的星球。来创建一个吧。",
2503 2521 "designer.new": "新星球",
2504 2522 "designer.editTitle": "编辑星球",
@@ -2529,19 +2547,16 @@ var I18N_CATALOG = {
2529 2547 "designer.defaultPeople": "居民",
2530 2548 "hud.points": "分数",
2531 2549 "hud.round": "第 {n} 轮",
2532 "hud.skill": "水平 {n}%",
2533 2550 "hud.out": "出局",
2534 2551 "hud.miniPoints": "分数 {n}",
2535 2552 "hud.opponent.one": "对手",
2536 2553 "hud.opponent.few": "对手",
2537 2554 "hud.opponent.many": "对手",
2538 2555 "hud.opponent.other": "对手",
2539 "hud.opponentsLine": "{n} 名{word}",
2540 2556 "offline.resultTitle": "离线对战",
2541 2557 "offline.reachedBefore": "你到达了第",
2542 2558 "offline.reachedAfter": " 轮。",
2543 2559 "offline.reached": "你到达了第 {n} 轮。",
2544 "offline.detail": "你以 {skill}% 的水平对战了 {n} 名{opponents}。",
2545 2560 "offline.backMenu": "返回菜单",
2546 2561 "gameover.title": "你输了",
2547 2562 "gameover.detail": "所有列都已锁定。",
@@ -2730,10 +2745,18 @@ var I18N_CATALOG = {
2730 2745 "reward.won": "你赢了!",
2731 2746 "reward.lost": "你输了...",
2732 2747 "reward.total": "总积分",
2733 "reward.continue": "点击继续"
2748 "reward.continue": "点击继续",
2749 "game.menu": "菜单",
2750 "game.paused": "已暂停",
2751 "game.resume": "继续游戏",
2752 "game.backToMenu": "返回主菜单",
2753 "reward.ended": "游戏结束",
2754 "offline.defeated.one": "击败了 {n} 名对手",
2755 "offline.defeated.few": "击败了 {n} 名对手",
2756 "offline.defeated.many": "击败了 {n} 名对手",
2757 "offline.defeated.other": "击败了 {n} 名对手"
2734 2758 },
2735 2759 "ko": {
2736 "menu.tagline": "세 개를 나란히 맞추면 블록에 로켓이 점화됩니다.",
2737 2760 "menu.play": "플레이",
2738 2761 "menu.offline": "오프라인 대결",
2739 2762 "menu.online": "온라인 플레이",
@@ -2748,7 +2771,6 @@ var I18N_CATALOG = {
2748 2771 "menu.logout": "로그아웃",
2749 2772 "menu.player": "플레이어",
2750 2773 "planet.title": "필드 선택",
2751 "planet.tagline": "각 필드는 행성입니다. 고유한 주민, 중력, 공기, 질량을 가집니다.",
2752 2774 "planet.back": "뒤로",
2753 2775 "planet.customBadge": "내 것",
2754 2776 "stats.powerLabel": "파워",
@@ -2783,7 +2805,7 @@ var I18N_CATALOG = {
2783 2805 "online.you": "나",
2784 2806 "designer.title": "행성 디자이너",
2785 2807 "designer.taglineBefore": "합계:",
2786 "designer.taglineAfter": "점. 점수를 모으면 블록이 해금됩니다. 점수를 쓰지는 않습니다.",
2808 "designer.taglineAfter": "점.",
2787 2809 "designer.empty": "아직 내 행성이 없습니다. 하나 만들어 보세요.",
2788 2810 "designer.new": "새 행성",
2789 2811 "designer.editTitle": "행성 편집",
@@ -2814,19 +2836,16 @@ var I18N_CATALOG = {
2814 2836 "designer.defaultPeople": "주민",
2815 2837 "hud.points": "점수",
2816 2838 "hud.round": "{n}라운드",
2817 "hud.skill": "숙련도 {n}%",
2818 2839 "hud.out": "탈락",
2819 2840 "hud.miniPoints": "점수 {n}",
2820 2841 "hud.opponent.one": "상대",
2821 2842 "hud.opponent.few": "상대",
2822 2843 "hud.opponent.many": "상대",
2823 2844 "hud.opponent.other": "상대",
2824 "hud.opponentsLine": "{word} {n}명",
2825 2845 "offline.resultTitle": "오프라인 대결",
2826 2846 "offline.reachedBefore": "도달한 라운드:",
2827 2847 "offline.reachedAfter": ".",
2828 2848 "offline.reached": "{n}라운드까지 도달했습니다.",
2829 "offline.detail": "숙련도 {skill}%의 {opponents} {n}명과 대결했습니다.",
2830 2849 "offline.backMenu": "메뉴로 돌아가기",
2831 2850 "gameover.title": "패배했습니다",
2832 2851 "gameover.detail": "모든 열이 잠겼습니다.",
@@ -3015,10 +3034,18 @@ var I18N_CATALOG = {
3015 3034 "reward.won": "승리!",
3016 3035 "reward.lost": "패배...",
3017 3036 "reward.total": "총 포인트",
3018 "reward.continue": "탭하여 계속"
3037 "reward.continue": "탭하여 계속",
3038 "game.menu": "메뉴",
3039 "game.paused": "일시정지",
3040 "game.resume": "계속하기",
3041 "game.backToMenu": "메인 메뉴로 돌아가기",
3042 "reward.ended": "게임 종료",
3043 "offline.defeated.one": "상대 {n}명 격파",
3044 "offline.defeated.few": "상대 {n}명 격파",
3045 "offline.defeated.many": "상대 {n}명 격파",
3046 "offline.defeated.other": "상대 {n}명 격파"
3019 3047 },
3020 3048 "pl": {
3021 "menu.tagline": "Trzy w rzędzie, a twoje klocki dostają napęd rakietowy.",
3022 3049 "menu.play": "Graj",
3023 3050 "menu.offline": "Walka offline",
3024 3051 "menu.online": "Graj online",
@@ -3033,7 +3060,6 @@ var I18N_CATALOG = {
3033 3060 "menu.logout": "Wyloguj się",
3034 3061 "menu.player": "gracz",
3035 3062 "planet.title": "Wybierz pole",
3036 "planet.tagline": "Każde pole to planeta, z własnym ludem, grawitacją, powietrzem i masą.",
3037 3063 "planet.back": "Wstecz",
3038 3064 "planet.customBadge": "Twoja",
3039 3065 "stats.powerLabel": "Moc",
@@ -3068,7 +3094,7 @@ var I18N_CATALOG = {
3068 3094 "online.you": "ty",
3069 3095 "designer.title": "Kreator planet",
3070 3096 "designer.taglineBefore": "Suma:",
3071 "designer.taglineAfter": "pkt. Odblokowujesz klocki, zdobywając punkty — nie wydajesz ich.",
3097 "designer.taglineAfter": "pkt.",
3072 3098 "designer.empty": "Nie masz jeszcze własnych planet. Utwórz jedną.",
3073 3099 "designer.new": "Nowa planeta",
3074 3100 "designer.editTitle": "Edytuj planetę",
@@ -3099,19 +3125,16 @@ var I18N_CATALOG = {
3099 3125 "designer.defaultPeople": "Lud",
3100 3126 "hud.points": "Punkty",
3101 3127 "hud.round": "Runda {n}",
3102 "hud.skill": "Umiejętność {n}%",
3103 3128 "hud.out": "Poza",
3104 3129 "hud.miniPoints": "Punkty {n}",
3105 3130 "hud.opponent.one": "przeciwnik",
3106 3131 "hud.opponent.few": "przeciwników",
3107 3132 "hud.opponent.many": "przeciwników",
3108 3133 "hud.opponent.other": "przeciwników",
3109 "hud.opponentsLine": "{n} {word}",
3110 3134 "offline.resultTitle": "Walka offline",
3111 3135 "offline.reachedBefore": "Dotarłeś do rundy",
3112 3136 "offline.reachedAfter": ".",
3113 3137 "offline.reached": "Dotarłeś do rundy {n}.",
3114 "offline.detail": "Grałeś przeciwko {n} {opponents} przy umiejętności {skill}%.",
3115 3138 "offline.backMenu": "Powrót do menu",
3116 3139 "gameover.title": "Przegrałeś",
3117 3140 "gameover.detail": "Wszystkie kolumny są zablokowane.",
@@ -3300,10 +3323,18 @@ var I18N_CATALOG = {
3300 3323 "reward.won": "Wygrana!",
3301 3324 "reward.lost": "Przegrana...",
3302 3325 "reward.total": "Suma punktów",
3303 "reward.continue": "Dotknij, aby kontynuować"
3326 "reward.continue": "Dotknij, aby kontynuować",
3327 "game.menu": "Menu",
3328 "game.paused": "Pauza",
3329 "game.resume": "Wznów",
3330 "game.backToMenu": "Powrót do menu głównego",
3331 "reward.ended": "Gra zakończona",
3332 "offline.defeated.one": "{n} pokonany przeciwnik",
3333 "offline.defeated.few": "{n} pokonanych przeciwników",
3334 "offline.defeated.many": "{n} pokonanych przeciwników",
3335 "offline.defeated.other": "{n} pokonanych przeciwników"
3304 3336 },
3305 3337 "ru": {
3306 "menu.tagline": "Три в ряд — и твои блоки получают ракетные двигатели.",
3307 3338 "menu.play": "Играть",
3308 3339 "menu.offline": "Офлайн-бой",
3309 3340 "menu.online": "Играть онлайн",
@@ -3318,7 +3349,6 @@ var I18N_CATALOG = {
3318 3349 "menu.logout": "Выйти",
3319 3350 "menu.player": "игрок",
3320 3351 "planet.title": "Выбери поле",
3321 "planet.tagline": "Каждое поле — это планета со своим народом, гравитацией, воздухом и массой.",
3322 3352 "planet.back": "Назад",
3323 3353 "planet.customBadge": "Своя",
3324 3354 "stats.powerLabel": "Мощность",
@@ -3353,7 +3383,7 @@ var I18N_CATALOG = {
3353 3383 "online.you": "ты",
3354 3384 "designer.title": "Конструктор планет",
3355 3385 "designer.taglineBefore": "Всего:",
3356 "designer.taglineAfter": "очков. Блоки открываются за заработанные очки — тратить их не нужно.",
3386 "designer.taglineAfter": "очков.",
3357 3387 "designer.empty": "У тебя ещё нет своих планет. Создай одну.",
3358 3388 "designer.new": "Новая планета",
3359 3389 "designer.editTitle": "Изменить планету",
@@ -3384,19 +3414,16 @@ var I18N_CATALOG = {
3384 3414 "designer.defaultPeople": "Народ",
3385 3415 "hud.points": "Очки",
3386 3416 "hud.round": "Раунд {n}",
3387 "hud.skill": "Мастерство {n} %",
3388 3417 "hud.out": "Вне",
3389 3418 "hud.miniPoints": "Очки {n}",
3390 3419 "hud.opponent.one": "противник",
3391 3420 "hud.opponent.few": "противника",
3392 3421 "hud.opponent.many": "противников",
3393 3422 "hud.opponent.other": "противников",
3394 "hud.opponentsLine": "{n} {word}",
3395 3423 "offline.resultTitle": "Офлайн-бой",
3396 3424 "offline.reachedBefore": "Ты дошёл до раунда",
3397 3425 "offline.reachedAfter": ".",
3398 3426 "offline.reached": "Ты дошёл до раунда {n}.",
3399 "offline.detail": "Ты играл против {n} {opponents} с мастерством {skill} %.",
3400 3427 "offline.backMenu": "Вернуться в меню",
3401 3428 "gameover.title": "Ты проиграл",
3402 3429 "gameover.detail": "Все столбцы заблокированы.",
@@ -3585,10 +3612,18 @@ var I18N_CATALOG = {
3585 3612 "reward.won": "Победа!",
3586 3613 "reward.lost": "Поражение...",
3587 3614 "reward.total": "Всего очков",
3588 "reward.continue": "Нажмите, чтобы продолжить"
3615 "reward.continue": "Нажмите, чтобы продолжить",
3616 "game.menu": "Меню",
3617 "game.paused": "Пауза",
3618 "game.resume": "Продолжить",
3619 "game.backToMenu": "В главное меню",
3620 "reward.ended": "Игра окончена",
3621 "offline.defeated.one": "{n} противник побеждён",
3622 "offline.defeated.few": "{n} противника побеждено",
3623 "offline.defeated.many": "{n} противников побеждено",
3624 "offline.defeated.other": "{n} противников побеждено"
3589 3625 },
3590 3626 "es": {
3591 "menu.tagline": "Tres en raya, y tus bloques ganan motores cohete.",
3592 3627 "menu.play": "Jugar",
3593 3628 "menu.offline": "Combate sin conexión",
3594 3629 "menu.online": "Jugar en línea",
@@ -3603,7 +3638,6 @@ var I18N_CATALOG = {
3603 3638 "menu.logout": "Cerrar sesión",
3604 3639 "menu.player": "jugador",
3605 3640 "planet.title": "Elige un campo",
3606 "planet.tagline": "Cada campo es un planeta, con su pueblo, gravedad, aire y masa.",
3607 3641 "planet.back": "Volver",
3608 3642 "planet.customBadge": "Tuya",
3609 3643 "stats.powerLabel": "Potencia",
@@ -3638,7 +3672,7 @@ var I18N_CATALOG = {
3638 3672 "online.you": "tú",
3639 3673 "designer.title": "Diseñador de planetas",
3640 3674 "designer.taglineBefore": "Total:",
3641 "designer.taglineAfter": "puntos. Desbloqueas bloques al ganar puntos; no los gastas.",
3675 "designer.taglineAfter": "puntos.",
3642 3676 "designer.empty": "Aún no tienes planetas propios. Crea uno.",
3643 3677 "designer.new": "Nuevo planeta",
3644 3678 "designer.editTitle": "Editar planeta",
@@ -3669,19 +3703,16 @@ var I18N_CATALOG = {
3669 3703 "designer.defaultPeople": "Pueblo",
3670 3704 "hud.points": "Puntos",
3671 3705 "hud.round": "Ronda {n}",
3672 "hud.skill": "Nivel {n} %",
3673 3706 "hud.out": "Fuera",
3674 3707 "hud.miniPoints": "Puntos {n}",
3675 3708 "hud.opponent.one": "rival",
3676 3709 "hud.opponent.few": "rivales",
3677 3710 "hud.opponent.many": "rivales",
3678 3711 "hud.opponent.other": "rivales",
3679 "hud.opponentsLine": "{n} {word}",
3680 3712 "offline.resultTitle": "Combate sin conexión",
3681 3713 "offline.reachedBefore": "Has llegado a la ronda",
3682 3714 "offline.reachedAfter": ".",
3683 3715 "offline.reached": "Has llegado a la ronda {n}.",
3684 "offline.detail": "Jugaste contra {n} {opponents} con un nivel del {skill} %.",
3685 3716 "offline.backMenu": "Volver al menú",
3686 3717 "gameover.title": "Has perdido",
3687 3718 "gameover.detail": "Todas las columnas están bloqueadas.",
@@ -3870,7 +3901,16 @@ var I18N_CATALOG = {
3870 3901 "reward.won": "¡Has ganado!",
3871 3902 "reward.lost": "Has perdido...",
3872 3903 "reward.total": "Puntos totales",
3873 "reward.continue": "Toca para continuar"
3904 "reward.continue": "Toca para continuar",
3905 "game.menu": "Menú",
3906 "game.paused": "En pausa",
3907 "game.resume": "Continuar",
3908 "game.backToMenu": "Volver al menú principal",
3909 "reward.ended": "Partida terminada",
3910 "offline.defeated.one": "{n} rival derrotado",
3911 "offline.defeated.few": "{n} rivales derrotados",
3912 "offline.defeated.many": "{n} rivales derrotados",
3913 "offline.defeated.other": "{n} rivales derrotados"
3874 3914 }
3875 3915 },
3876 3916 "errors": {
@@ -5173,6 +5213,9 @@ function GameCore (planet, rng)
5173 5213 this.spawnInterval = PlanetMod.SPAWN_INTERVAL;
5174 5214 /** Seconds of actual play in this match / round (t1189). */
5175 5215 this.playTime = 0;
5216 /** t1197: matches in the current combo and seconds since the last one. */
5217 this.combo = 0;
5218 this.comboAge = 0;
5176 5219 this.settleTime = PlanetMod.SETTLE_TIME;
5177 5220 this.score = 0;
5178 5221 this.state = 'playing';
@@ -5211,6 +5254,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;
5211 5254 GameCore.SNAP_Y = SNAP_Y;
5212 5255 GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
5213 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;
5259 /** t1197: the combo resets when no match is made for this long (s). */
5260 GameCore.COMBO_RESET_S = 5;
5214 5261 GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
5215 5262 GameCore.DEFAULT_MISS_CHANCE = 0.30;
5216 5263 GameCore.STATE_STILL = STATE_STILL;
@@ -5688,6 +5735,14 @@ GameCore.prototype.tick = function (dt)
5688 5735 // t1192: waiting received blocks drop first, as soon as there is room.
5689 5736 if (this.garbageQueue.length)
5690 5737 { this.drainGarbageQueue(); }
5738 // t1197: combo expires after COMBO_RESET_S without a match.
5739 this.comboAge += dt;
5740 if (this.combo > 0 && this.comboAge >= GameCore.COMBO_RESET_S)
5741 {
5742 this.combo = 0;
5743 if (!this.hasActiveLandingChain())
5744 { this.lastChainIndicator = null; }
5745 }
5691 5746 this.spawnTimer += dt;
5692 5747 var iv = this.currentSpawnInterval();
5693 5748 while (this.spawnTimer >= iv)
@@ -7723,15 +7778,21 @@ GameCore.prototype.resolveMatches = function ()
7723 7778 }
7724 7779 }
7725 7780 var chain = this.landingChainFor(group);
7726 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain;
7781 // t1197: combo bonus = COMBO_STEP per earlier match in this combo,
7782 // added to the landing-chain bonus (one shown "+x%").
7783 var comboBonus = GameCore.COMBO_STEP * this.combo;
7784 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;
7727 7785 height *= bonusMul;
7728 7786 this.launchCluster(group, height, { landingChain: chain });
7729 7787 launched.push({
7730 7788 blocks: group,
7731 7789 jumpHeight: height,
7732 7790 landingChain: chain,
7791 comboBonus: comboBonus,
7733 7792 chainBonus: bonusMul
7734 7793 });
7794 this.combo += 1;
7795 this.comboAge = 0;
7735 7796 }
7736 7797 this.finishLandingChains(launched);
7737 7798 this.updateChainIndicator(launched);
@@ -8253,24 +8314,35 @@ GameCore.prototype.finishLandingChains = function (launched)
8253 8314 GameCore.prototype.updateChainIndicator = function (launched)
8254 8315 {
8255 8316 var maxChain = 0;
8317 var maxPct = 0;
8256 8318 for (var i = 0; i < launched.length; i++)
8257 8319 {
8258 8320 var ch = launched[i].landingChain || 0;
8259 8321 if (ch > maxChain)
8260 8322 { maxChain = ch; }
8323 var pct = Math.round(((launched[i].chainBonus || 1) - 1) * 100);
8324 if (pct > maxPct)
8325 { maxPct = pct; }
8261 8326 }
8262 if (maxChain >= 1)
8327 if (maxPct > 0)
8263 8328 {
8264 8329 this.lastChainIndicator = {
8265 8330 chain: maxChain,
8266 bonusPct: Math.round(maxChain * LANDING_CHAIN_BONUS * 100)
8331 combo: this.combo,
8332 bonusPct: maxPct
8267 8333 };
8268 8334 return;
8269 8335 }
8270 if (!this.hasActiveLandingChain())
8336 if (!this.hasActiveLandingChain() && !(launched.length && this.combo > 0))
8271 8337 { this.lastChainIndicator = null; }
8272 8338 };
8273 8339
8340 /** Bonus (percent) the next match would get from the combo alone (t1197). */
8341 GameCore.prototype.comboBonusPct = function ()
8342 {
8343 return Math.round(GameCore.COMBO_STEP * this.combo * 100);
8344 };
8345
8274 8346 GameCore.prototype.hasActiveLandingChain = function ()
8275 8347 {
8276 8348 var ids = Object.keys(this.clusters);
@@ -9214,6 +9286,8 @@ Online._apply = function (data)
9214 9286 { this.lifetimePoints = data.lifetime_points; }
9215 9287 if (data.locale !== undefined)
9216 9288 { this.locale = data.locale; }
9289 if (data.last_planet !== undefined)
9290 { this.lastPlanet = data.last_planet; }
9217 9291 if (data.blocks)
9218 9292 { this.blocks = data.blocks; }
9219 9293 if (data.planets)
@@ -9321,6 +9395,13 @@ Online.deletePlanet = function (id)
9321 9395 return this.request('planet_delete', { id: id });
9322 9396 };
9323 9397
9398 /** Remember the last chosen planet on the profile (t1196). */
9399 Online.setLastPlanet = function (planetId)
9400 {
9401 this.lastPlanet = planetId;
9402 return this.request('set_last_planet', { planet_id: planetId });
9403 };
9404
9324 9405 Online.setLocale = function (locale)
9325 9406 {
9326 9407 return this.request('set_locale', { locale: locale });
@@ -9499,9 +9580,10 @@ Online.stopPolling = function ()
9499 9580 }
9500 9581 };
9501 9582
9583 /** Login from the Online screen: come back to online play (t1193). */
9502 9584 Online.loginUrl = function ()
9503 9585 {
9504 return 'auth.php';
9586 return 'auth.php?return=online';
9505 9587 };
9506 9588
9507 9589 Online.logoutUrl = function ()
@@ -11795,9 +11877,21 @@ function OfflineBattle (opts)
11795 11877 this.shotLocals = [];
11796 11878 this.bots = [];
11797 11879 this.playerId = 'player';
11880 /** Opponents knocked out over all rounds of this battle (t1198). */
11881 this.defeated = 0;
11798 11882 this._initBots();
11799 11883 }
11800 11884
11885 /** Mark a bot as out once; counts towards `defeated` (t1198). */
11886 OfflineBattle.prototype._eliminate = function (bot)
11887 {
11888 if (bot.eliminated)
11889 { return; }
11890 bot.eliminated = true;
11891 bot.score = bot.core ? bot.core.score : bot.score;
11892 this.defeated += 1;
11893 };
11894
11801 11895 OfflineBattle.prototype._initBots = function ()
11802 11896 {
11803 11897 var P = PlanetMod();
@@ -11955,8 +12049,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
11955 12049 { continue; }
11956 12050 if (bot.core.state === 'gameover')
11957 12051 {
11958 bot.eliminated = true;
11959 bot.score = bot.core.score;
12052 this._eliminate(bot);
11960 12053 continue;
11961 12054 }
11962 12055 bot.core.tick(dt);
@@ -11983,10 +12076,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
11983 12076 for (var i = 0; i < this.bots.length; i++)
11984 12077 {
11985 12078 if (this.bots[i].core && this.bots[i].core.state === 'gameover')
11986 {
11987 this.bots[i].eliminated = true;
11988 this.bots[i].score = this.bots[i].core.score;
11989 }
12079 { this._eliminate(this.bots[i]); }
11990 12080 }
11991 12081
11992 12082 if (playerCore && playerCore.state === 'gameover')
@@ -12077,10 +12167,15 @@ if (typeof module !== 'undefined' && module.exports && typeof Offline !== 'undef
12077 12167 * planet arc from the top of the screen into a counter at the bottom
12078 12168 * centre, one block per newly earned point. Each arrival adds 1.
12079 12169 *
12080 * Spawn rate accelerates: rate(t) = RATE0 + ACCEL·t blocks/s, so the
12081 * number spawned after t seconds is N(t) = RATE0·t + ACCEL·t²/2, and
12082 * block i (0-based) leaves at T(i) = the t where N(t) = i.
12083 * t1178: RATE0 = 15, ACCEL = 10 → 253 points ≈ 5.8 s, 800 ≈ 11.2 s, 2000 ≈ 18.6 s.
12170 * Spawn rate (t1194): starts at RATE0 = 3 blocks/s and accelerates
12171 * linearly, rate(t) = RATE0 + a·t, with `a` chosen per reward so the last
12172 * block always leaves at SPAWN_END = 4 s, whatever the point count.
12173 * Blocks spawned after t seconds: N(t) = RATE0·t + a·t²/2; block i
12174 * (0-based) leaves at T(i) = the t where N(t) = i. The last block is
12175 * i = n − 1, so N(4) = n − 1 → a = 2·((n − 1) − RATE0·T) / T².
12176 * If n − 1 ≤ RATE0·T (n ≤ 13) a would be ≤ 0: then a constant rate
12177 * (n − 1) / T is used (a = 0), so it still ends at 4 s (1 point: one
12178 * block at t = 0).
12084 12179 *
12085 12180 * The pure timing / sequencing part (Reward.spawnTime, Reward.createSequence)
12086 12181 * has no DOM and is unit-tested. Reward.play wires it to an overlay.
@@ -12089,10 +12184,10 @@ if (typeof module !== 'undefined' && module.exports && typeof Offline !== 'undef
12089 12184 {
12090 12185 'use strict';
12091 12186
12092 /** Blocks per second at t = 0 (t1177: 10, t1178: 15). */
12093 var RATE0 = 15;
12094 /** Rate increase in blocks/s per second (t1175: 3, t1177: 5, t1178: 10). */
12095 var ACCEL = 10;
12187 /** Blocks per second at t = 0 (t1177: 10, t1178: 15, t1194: 3). */
12188 var RATE0 = 3;
12189 /** Seconds after the first block when the last block leaves (t1194). */
12190 var SPAWN_END = 4;
12096 12191 var INTRO = 1.0; // centred title before it rises
12097 12192 var RISE = 0.6; // title tween to the top
12098 12193 var FLIGHT = 0.7; // one block's arc duration
@@ -12100,14 +12195,28 @@ var HOLD = 1.5; // final total shown before continuing
12100 12195 var HOLD_ZERO = 1.5; // earned 0: show the number briefly
12101 12196 var WAIT_MAX = 8; // give up waiting for the server after this
12102 12197
12103 /** Seconds after the start of counting when block i (0-based) leaves. */
12104 function spawnTime (i)
12198 /**
12199 * Spawn parameters for a reward of n blocks (t1194): { r0, a } with
12200 * rate(t) = r0 + a·t and the last block (i = n − 1) leaving at SPAWN_END.
12201 */
12202 function spawnParams (n)
12203 {
12204 var T = SPAWN_END;
12205 var last = Math.max(0, (n | 0) - 1);
12206 if (last <= RATE0 * T)
12207 { return { r0: last / T, a: 0 }; }
12208 return { r0: RATE0, a: 2 * (last - RATE0 * T) / (T * T) };
12209 }
12210
12211 /** Seconds after the start of counting when block i (0-based) of n leaves. */
12212 function spawnTime (i, n)
12105 12213 {
12106 12214 if (!(i > 0))
12107 12215 { return 0; }
12108 if (ACCEL === 0)
12109 { return i / RATE0; }
12110 return (-RATE0 + Math.sqrt(RATE0 * RATE0 + 2 * ACCEL * i)) / ACCEL;
12216 var p = spawnParams(n == null ? i + 1 : n);
12217 if (p.a === 0)
12218 { return p.r0 > 0 ? i / p.r0 : 0; }
12219 return (-p.r0 + Math.sqrt(p.r0 * p.r0 + 2 * p.a * i)) / p.a;
12111 12220 }
12112 12221
12113 12222 /** Blocks spawned (left the top) by time t, capped at n. */
@@ -12115,8 +12224,9 @@ function spawnedBy (t, n)
12115 12224 {
12116 12225 if (!(t >= 0) || !(n > 0))
12117 12226 { return 0; }
12227 var p = spawnParams(n);
12118 12228 // Block i has left when T(i) <= t, i.e. i <= N(t).
12119 var k = Math.floor(RATE0 * t + ACCEL * t * t / 2 + 1e-9) + 1;
12229 var k = Math.floor(p.r0 * t + p.a * t * t / 2 + 1e-9) + 1;
12120 12230 return Math.min(n, Math.max(0, k));
12121 12231 }
12122 12232
@@ -12133,7 +12243,7 @@ function countDuration (n, flight)
12133 12243 flight = flight == null ? FLIGHT : flight;
12134 12244 if (!(n > 0))
12135 12245 { return 0; }
12136 return spawnTime(n - 1) + flight;
12246 return spawnTime(n - 1, n) + flight;
12137 12247 }
12138 12248
12139 12249 /**
@@ -12365,8 +12475,9 @@ function play (opts)
12365 12475 var W = 0;
12366 12476 var H = 0;
12367 12477
12368 title.textContent = opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...');
12369 title.className = 'reward-title' + (opts.won ? ' won' : ' lost');
12478 // t1193: quitting via the in-game menu shows a neutral title.
12479 title.textContent = opts.title ? String(opts.title) : (opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...'));
12480 title.className = 'reward-title' + (opts.title ? ' ended' : (opts.won ? ' won' : ' lost'));
12370 12481 if (label)
12371 12482 { label.textContent = tr('reward.total', 'Total points'); }
12372 12483 counter.textContent = '';
@@ -12552,7 +12663,8 @@ function play (opts)
12552 12663
12553 12664 var Reward = {
12554 12665 RATE0: RATE0,
12555 ACCEL: ACCEL,
12666 SPAWN_END: SPAWN_END,
12667 spawnParams: spawnParams,
12556 12668 INTRO: INTRO,
12557 12669 RISE: RISE,
12558 12670 FLIGHT: FLIGHT,
@@ -13236,6 +13348,7 @@ window.onload = function ()
13236 13348 app.debugPhysics = isPhysicsDebugEnabled();
13237 13349 var play = document.getElementById('btn-play');
13238 13350 play.addEventListener('click', onPlay);
13351 bindGameMenu();
13239 13352 play.addEventListener('pointerup', function (e)
13240 13353 {
13241 13354 // A touch-friendly path: some mobile browsers swallow the click
@@ -13366,6 +13479,7 @@ function startPlay (opts)
13366 13479 { bindPointer(app.scene.canvas); }
13367 13480 refreshHud();
13368 13481 showEl('hud');
13482 setGameMenuButton(!app.online && !app.spectating);
13369 13483 }
13370 13484 catch (err)
13371 13485 {
@@ -13465,6 +13579,10 @@ function teardownPlay ()
13465 13579 app.columnWarn = [];
13466 13580 app.pointerId = null;
13467 13581 app.gameOverShown = false;
13582 app.paused = false;
13583 app.quitting = false;
13584 hideEl('game-menu');
13585 setGameMenuButton(false);
13468 13586 hideEl('hud');
13469 13587 hideEl('game-over');
13470 13588 hideEl('spectator');
@@ -14032,6 +14150,14 @@ function tickView (dt)
14032 14150 placeTile(app.cells[i], col, row);
14033 14151 }
14034 14152
14153 // t1193: in-game menu open (Spelen / Offline Strijd) or quitting:
14154 // the field, bots and timers stand still; only the view is kept.
14155 if (app.paused)
14156 {
14157 syncSprites(0);
14158 return;
14159 }
14160
14035 14161 app.core.tick(dt);
14036 14162 if (app.offline && app.battle)
14037 14163 { tickOffline(dt); }
@@ -14233,7 +14359,16 @@ function fieldFromEvent (e)
14233 14359
14234 14360 function playingForDrag ()
14235 14361 {
14236 return app.core && app.core.state === 'playing';
14362 return app.core && app.core.state === 'playing' && !app.paused;
14363 }
14364
14365 /** Touches on HUD buttons / menus are UI taps, not field drags (t1193). */
14366 function isUiTouchTarget (e)
14367 {
14368 var el = e && e.target;
14369 if (!el || !el.closest)
14370 { return false; }
14371 return !!el.closest('button, a, input, select, #game-menu, #reward');
14237 14372 }
14238 14373
14239 14374 function startDragFromEvent (e)
@@ -14383,6 +14518,8 @@ function onTouchStart (e)
14383 14518 {
14384 14519 if (!playingForDrag())
14385 14520 { return; }
14521 if (app.activeTouchId == null && isUiTouchTarget(e))
14522 { return; }
14386 14523 if (app.activeTouchId != null)
14387 14524 {
14388 14525 if (e.preventDefault)
@@ -14708,31 +14845,20 @@ function showOfflineResult ()
14708 14845 app.offlineResultShown = true;
14709 14846 var battle = app.battle;
14710 14847 var reached = document.getElementById('offline-reached');
14711 var sch = battle.schedule;
14712 var n = sch.opponents;
14713 var skill = Math.round(sch.skill * 100);
14714 14848 var line = document.getElementById('offline-reached-line');
14715 14849 if (line && typeof I18n !== 'undefined')
14716 14850 { line.textContent = I18n.t('offline.reached', { n: battle.round }); }
14717 14851 else if (reached)
14718 14852 { reached.textContent = String(battle.round); }
14853 // t1198: "X opponents defeated" over all rounds (replaces the
14854 // opponents / skill line).
14719 14855 var detail = document.getElementById('offline-result-detail');
14720 14856 if (detail)
14721 14857 {
14722 if (typeof I18n !== 'undefined')
14723 {
14724 detail.textContent = I18n.t('offline.detail', {
14725 n: n,
14726 opponents: I18n.plural('hud.opponent', n),
14727 skill: skill
14728 });
14729 }
14730 else
14731 {
14732 var noun = n === 1 ? 'opponent' : 'opponents';
14733 detail.textContent = 'You played against ' + n + ' ' + noun
14734 + ' at skill ' + skill + '%.';
14735 }
14858 var beaten = battle.defeated || 0;
14859 detail.textContent = (typeof I18n !== 'undefined')
14860 ? I18n.plural('offline.defeated', beaten, { n: beaten })
14861 : beaten + (beaten === 1 ? ' opponent defeated' : ' opponents defeated');
14736 14862 }
14737 14863 hideEl('game-over');
14738 14864 showEl('offline-result');
@@ -14750,34 +14876,11 @@ function refreshOfflineHud ()
14750 14876 return;
14751 14877 }
14752 14878 el.hidden = false;
14879 // t1195: the Offline Strijd HUD shows only "Round N".
14753 14880 var sch = app.battle.schedule;
14754 var n = sch.opponents;
14755 14881 var r = document.getElementById('offline-round');
14756 var o = document.getElementById('offline-opponents');
14757 var s = document.getElementById('offline-skill');
14758 if (typeof I18n !== 'undefined')
14759 {
14760 if (r)
14761 { r.textContent = I18n.t('hud.round', { n: sch.round }); }
14762 if (o)
14763 {
14764 o.textContent = I18n.t('hud.opponentsLine', {
14765 n: n, word: I18n.plural('hud.opponent', n)
14766 });
14767 }
14768 if (s)
14769 { s.textContent = I18n.t('hud.skill', { n: Math.round(sch.skill * 100) }); }
14770 }
14771 else
14772 {
14773 var noun = n === 1 ? 'opponent' : 'opponents';
14774 if (r)
14775 { r.textContent = 'Round ' + sch.round; }
14776 if (o)
14777 { o.textContent = n + ' ' + noun; }
14778 if (s)
14779 { s.textContent = 'Skill ' + Math.round(sch.skill * 100) + '%'; }
14780 }
14882 if (r)
14883 { r.textContent = (typeof I18n !== 'undefined') ? I18n.t('hud.round', { n: sch.round }) : 'Round ' + sch.round; }
14781 14884 }
14782 14885
14783 14886 function hideOfflineHud ()
@@ -14795,14 +14898,16 @@ function refreshChainIndicator ()
14795 14898 var info = app.core && app.core.lastChainIndicator;
14796 14899 var active = app.core && app.core.hasActiveLandingChain
14797 14900 && app.core.hasActiveLandingChain();
14798 // Show only while a chained cluster is still in the air.
14799 if (!info || info.chain < 1 || app.mode !== 'playing' || !active)
14901 var comboOn = app.core && app.core.combo > 0;
14902 // t1197: just "+x%" (landing chain + combo bonus of the last launch),
14903 // while a boosted cluster flies or the combo is still alive.
14904 if (!info || !(info.bonusPct > 0) || app.mode !== 'playing' || !(active || comboOn))
14800 14905 {
14801 14906 el.hidden = true;
14802 14907 return;
14803 14908 }
14804 14909 el.hidden = false;
14805 el.textContent = 'x' + info.chain + ' +' + info.bonusPct + '%';
14910 el.textContent = '+' + info.bonusPct + '%';
14806 14911 }
14807 14912
14808 14913 function hideChainIndicator ()
@@ -15281,7 +15386,17 @@ function bindOnlineUi ()
15281 15386
15282 15387 var params = new URLSearchParams(window.location.search);
15283 15388 if (params.get('online') === '1' || params.get('auth') === 'unconfigured')
15284 { openOnlinePanel(); }
15389 {
15390 openOnlinePanel();
15391 // t1193: one-shot; a reload must not jump to online play again.
15392 try
15393 {
15394 params.delete('online');
15395 var rest = params.toString();
15396 window.history.replaceState(null, '', window.location.pathname + (rest ? '?' + rest : '') + window.location.hash);
15397 }
15398 catch (e) { /* ignore */ }
15399 }
15285 15400 }
15286 15401
15287 15402 function openOnlinePanel ()
@@ -15447,13 +15562,32 @@ function selectedPlanetId ()
15447 15562 return 'terra';
15448 15563 }
15449 15564
15565 /**
15566 * Pre-select the last chosen planet (t1196): logged in the profile value
15567 * (server), otherwise / as fallback localStorage, otherwise Terra. A
15568 * deleted custom planet falls back to the default (setSelectedPlanet).
15569 */
15450 15570 function restoreSelectedPlanet ()
15451 15571 {
15452 var id = 'terra';
15453 try
15454 { id = localStorage.getItem('meteors-planet') || 'terra'; }
15455 catch (e) {}
15456 setSelectedPlanet(id, true);
15572 var id = null;
15573 if (typeof Online !== 'undefined' && Online.me && Online.lastPlanet)
15574 { id = Online.lastPlanet; }
15575 if (!id)
15576 {
15577 try
15578 { id = localStorage.getItem('meteors-planet'); }
15579 catch (e) {}
15580 }
15581 setSelectedPlanet(id || 'terra', true);
15582 }
15583
15584 function rememberPlanetChoice (id)
15585 {
15586 if (typeof Online === 'undefined' || !Online.me || !Online.setLastPlanet)
15587 { return; }
15588 if (Online.lastPlanet === id)
15589 { return; }
15590 Promise.resolve(Online.setLastPlanet(id)).then(null, function () {});
15457 15591 }
15458 15592
15459 15593 function setSelectedPlanet (id, silent)
@@ -15473,6 +15607,7 @@ function setSelectedPlanet (id, silent)
15473 15607 catch (e) {}
15474 15608 if (!silent)
15475 15609 {
15610 rememberPlanetChoice(found.id);
15476 15611 var grid = document.getElementById('planet-grid');
15477 15612 if (grid && !grid.hidden && grid.children.length)
15478 15613 { renderPlanetGrid('planet-grid', false); }
@@ -15633,6 +15768,102 @@ function refreshMenuAccount ()
15633 15768 { localLogin.hidden = !(typeof Online !== 'undefined' && Online.local); }
15634 15769 }
15635 15770
15771 /* ---------- t1193 in-game menu (Spelen / Offline Strijd) ----------- */
15772
15773 function setGameMenuButton (show)
15774 {
15775 var btn = document.getElementById('btn-game-menu');
15776 if (btn)
15777 { btn.hidden = !show; }
15778 }
15779
15780 /** The menu can open during a running solo / offline field only. */
15781 function canOpenGameMenu ()
15782 {
15783 return app.mode === 'playing' && !!app.core && !app.online && !app.spectating
15784 && app.core.state === 'playing' && !app.rewardActive && !app.quitting
15785 && !(app.offline && app.battle && app.battle.state !== 'playing');
15786 }
15787
15788 function openGameMenu ()
15789 {
15790 if (!canOpenGameMenu())
15791 { return false; }
15792 if (app.core.drag)
15793 { finishDrag({ noLaunch: true }); }
15794 app.paused = true;
15795 showEl('game-menu');
15796 var resume = document.getElementById('btn-game-resume');
15797 if (resume && resume.focus)
15798 { resume.focus(); }
15799 return true;
15800 }
15801
15802 function resumeFromGameMenu ()
15803 {
15804 hideEl('game-menu');
15805 if (!app.quitting)
15806 { app.paused = false; }
15807 }
15808
15809 /**
15810 * "Back to main menu": ends the match now. Logged in, the points so far
15811 * go through the normal play_finish + reward screen first (the server
15812 * still applies its caps); logged out, straight to the menu. Offline
15813 * Strijd ends the whole battle (no next round).
15814 */
15815 function quitToMainMenu ()
15816 {
15817 if (!app.core || app.quitting)
15818 { return; }
15819 hideEl('game-menu');
15820 app.paused = true;
15821 app.quitting = true;
15822 app.gameOverShown = true;
15823 app.lastScore = app.core.score || 0;
15824 setGameMenuButton(false);
15825 var score = app.lastScore;
15826 var done = function ()
15827 {
15828 app.quitting = false;
15829 app.paused = false;
15830 returnToMenu();
15831 };
15832 if (rewardEnabled())
15833 {
15834 var title = (typeof I18n !== 'undefined') ? I18n.t('reward.ended') : 'Game ended';
15835 showReward(false, finishPlaySession(score), done, title);
15836 }
15837 else
15838 {
15839 finishPlaySession(score);
15840 done();
15841 }
15842 }
15843
15844 function bindGameMenu ()
15845 {
15846 var btn = document.getElementById('btn-game-menu');
15847 if (btn)
15848 { btn.addEventListener('click', function () { openGameMenu(); }); }
15849 var resume = document.getElementById('btn-game-resume');
15850 if (resume)
15851 { resume.addEventListener('click', resumeFromGameMenu); }
15852 var quit = document.getElementById('btn-game-quit');
15853 if (quit)
15854 { quit.addEventListener('click', quitToMainMenu); }
15855 document.addEventListener('keydown', function (e)
15856 {
15857 if (e.key !== 'Escape')
15858 { return; }
15859 var menu = document.getElementById('game-menu');
15860 if (menu && !menu.hidden)
15861 { resumeFromGameMenu(); }
15862 else
15863 { openGameMenu(); }
15864 });
15865 }
15866
15636 15867 function beginPlaySession (mode)
15637 15868 {
15638 15869 if (app.playToken)
@@ -15688,7 +15919,7 @@ function rewardEnabled ()
15688 15919 * next() — the same destination the mode used before (menu, next
15689 15920 * offline round, offline result, or the online lobby/podium).
15690 15921 */
15691 function showReward (won, resultPromise, next)
15922 function showReward (won, resultPromise, next, title)
15692 15923 {
15693 15924 app.rewardActive = true;
15694 15925 hideEl('game-over');
@@ -15696,6 +15927,7 @@ function showReward (won, resultPromise, next)
15696 15927 hideEl('podium');
15697 15928 var handle = Reward.play({
15698 15929 won: won,
15930 title: title || null,
15699 15931 planet: app.planet,
15700 15932 result: resultPromise,
15701 15933 onDone: function ()
@@ -15706,7 +15938,12 @@ function showReward (won, resultPromise, next)
15706 15938 }
15707 15939 });
15708 15940 if (!handle)
15709 { app.rewardActive = false; }
15941 {
15942 app.rewardActive = false;
15943 // No reward overlay (e.g. missing DOM): still continue (t1193).
15944 if (title && next)
15945 { next(); }
15946 }
15710 15947 }
15711 15948
15712 15949 function myOnlinePlace (lobby)
@@ -1023,7 +1023,6 @@ var BLOCK_REGISTRY = {
1023var I18N_CATALOG = {
1023var I18N_CATALOG = {
1024 "locales": {
1024 "locales": {
1025 "en": {
1025 "en": {
1026 "menu.tagline": "Three in a row, and your blocks get rocket boosters.",
1027 "menu.play": "Play",
1026 "menu.play": "Play",
1028 "menu.offline": "Offline Battle",
1027 "menu.offline": "Offline Battle",
1029 "menu.online": "Play online",
1028 "menu.online": "Play online",
@@ -1038,7 +1037,6 @@ var I18N_CATALOG = {
1038 "menu.logout": "Log out",
1037 "menu.logout": "Log out",
1039 "menu.player": "player",
1038 "menu.player": "player",
1040 "planet.title": "Choose a field",
1039 "planet.title": "Choose a field",
1041 "planet.tagline": "Each field is a planet, with its own people, gravity, air and mass.",
1042 "planet.back": "Back",
1040 "planet.back": "Back",
1043 "planet.customBadge": "Yours",
1041 "planet.customBadge": "Yours",
1044 "stats.powerLabel": "Power",
1042 "stats.powerLabel": "Power",
@@ -1073,7 +1071,7 @@ var I18N_CATALOG = {
1073 "online.you": "you",
1071 "online.you": "you",
1074 "designer.title": "Planet Designer",
1072 "designer.title": "Planet Designer",
1075 "designer.taglineBefore": "Total:",
1073 "designer.taglineBefore": "Total:",
1076 "designer.taglineAfter": "points. You unlock blocks by earning points — you do not spend them.",
1074 "designer.taglineAfter": "points.",
1077 "designer.empty": "You don’t have any planets of your own yet. Create one.",
1075 "designer.empty": "You don’t have any planets of your own yet. Create one.",
1078 "designer.new": "New planet",
1076 "designer.new": "New planet",
1079 "designer.editTitle": "Edit planet",
1077 "designer.editTitle": "Edit planet",
@@ -1104,19 +1102,16 @@ var I18N_CATALOG = {
1104 "designer.defaultPeople": "People",
1102 "designer.defaultPeople": "People",
1105 "hud.points": "Points",
1103 "hud.points": "Points",
1106 "hud.round": "Round {n}",
1104 "hud.round": "Round {n}",
1107 "hud.skill": "Skill {n}%",
1108 "hud.out": "Out",
1105 "hud.out": "Out",
1109 "hud.miniPoints": "Points {n}",
1106 "hud.miniPoints": "Points {n}",
1110 "hud.opponent.one": "opponent",
1107 "hud.opponent.one": "opponent",
1111 "hud.opponent.few": "opponents",
1108 "hud.opponent.few": "opponents",
1112 "hud.opponent.many": "opponents",
1109 "hud.opponent.many": "opponents",
1113 "hud.opponent.other": "opponents",
1110 "hud.opponent.other": "opponents",
1114 "hud.opponentsLine": "{n} {word}",
1115 "offline.resultTitle": "Offline Battle",
1111 "offline.resultTitle": "Offline Battle",
1116 "offline.reachedBefore": "You reached round",
1112 "offline.reachedBefore": "You reached round",
1117 "offline.reachedAfter": ".",
1113 "offline.reachedAfter": ".",
1118 "offline.reached": "You reached round {n}.",
1114 "offline.reached": "You reached round {n}.",
1119 "offline.detail": "You played against {n} {opponents} at skill {skill}%.",
1120 "offline.backMenu": "Back to the menu",
1115 "offline.backMenu": "Back to the menu",
1121 "gameover.title": "You lost",
1116 "gameover.title": "You lost",
1122 "gameover.detail": "Every column is locked.",
1117 "gameover.detail": "Every column is locked.",
@@ -1305,10 +1300,18 @@ var I18N_CATALOG = {
1305 "reward.won": "You won!",
1300 "reward.won": "You won!",
1306 "reward.lost": "You lost...",
1301 "reward.lost": "You lost...",
1307 "reward.total": "Total points",
1302 "reward.total": "Total points",
1308 "reward.continue": "Tap to continue"
1303 "reward.continue": "Tap to continue",
1304 "game.menu": "Menu",
1305 "game.paused": "Paused",
1306 "game.resume": "Resume",
1307 "game.backToMenu": "Back to main menu",
1308 "reward.ended": "Game ended",
1309 "offline.defeated.one": "{n} opponent defeated",
1310 "offline.defeated.few": "{n} opponents defeated",
1311 "offline.defeated.many": "{n} opponents defeated",
1312 "offline.defeated.other": "{n} opponents defeated"
1309 },
1313 },
1310 "nl": {
1314 "nl": {
1311 "menu.tagline": "Drie op een rij, en je blokjes krijgen raketmotoren.",
1312 "menu.play": "Spelen",
1315 "menu.play": "Spelen",
1313 "menu.offline": "Offline Strijd",
1316 "menu.offline": "Offline Strijd",
1314 "menu.online": "Online spelen",
1317 "menu.online": "Online spelen",
@@ -1323,7 +1326,6 @@ var I18N_CATALOG = {
1323 "menu.logout": "Uitloggen",
1326 "menu.logout": "Uitloggen",
1324 "menu.player": "speler",
1327 "menu.player": "speler",
1325 "planet.title": "Kies een veld",
1328 "planet.title": "Kies een veld",
1326 "planet.tagline": "Elk veld is een planeet, met een eigen volk, zwaartekracht, lucht en massa.",
1327 "planet.back": "Terug",
1329 "planet.back": "Terug",
1328 "planet.customBadge": "Eigen",
1330 "planet.customBadge": "Eigen",
1329 "stats.powerLabel": "Power",
1331 "stats.powerLabel": "Power",
@@ -1358,7 +1360,7 @@ var I18N_CATALOG = {
1358 "online.you": "jij",
1360 "online.you": "jij",
1359 "designer.title": "Planeetontwerper",
1361 "designer.title": "Planeetontwerper",
1360 "designer.taglineBefore": "Totaal:",
1362 "designer.taglineBefore": "Totaal:",
1361 "designer.taglineAfter": "punten. Blokjes ontgrendel je door punten te verdienen — je geeft ze niet uit.",
1363 "designer.taglineAfter": "punten.",
1362 "designer.empty": "Je hebt nog geen eigen planeten. Maak er een aan.",
1364 "designer.empty": "Je hebt nog geen eigen planeten. Maak er een aan.",
1363 "designer.new": "Nieuwe planeet",
1365 "designer.new": "Nieuwe planeet",
1364 "designer.editTitle": "Planeet bewerken",
1366 "designer.editTitle": "Planeet bewerken",
@@ -1389,19 +1391,16 @@ var I18N_CATALOG = {
1389 "designer.defaultPeople": "Volk",
1391 "designer.defaultPeople": "Volk",
1390 "hud.points": "Punten",
1392 "hud.points": "Punten",
1391 "hud.round": "Ronde {n}",
1393 "hud.round": "Ronde {n}",
1392 "hud.skill": "Skill {n}%",
1393 "hud.out": "Uit",
1394 "hud.out": "Uit",
1394 "hud.miniPoints": "Punten {n}",
1395 "hud.miniPoints": "Punten {n}",
1395 "hud.opponent.one": "tegenstander",
1396 "hud.opponent.one": "tegenstander",
1396 "hud.opponent.few": "tegenstanders",
1397 "hud.opponent.few": "tegenstanders",
1397 "hud.opponent.many": "tegenstanders",
1398 "hud.opponent.many": "tegenstanders",
1398 "hud.opponent.other": "tegenstanders",
1399 "hud.opponent.other": "tegenstanders",
1399 "hud.opponentsLine": "{n} {word}",
1400 "offline.resultTitle": "Offline Strijd",
1400 "offline.resultTitle": "Offline Strijd",
1401 "offline.reachedBefore": "Je hebt ronde",
1401 "offline.reachedBefore": "Je hebt ronde",
1402 "offline.reachedAfter": " bereikt.",
1402 "offline.reachedAfter": " bereikt.",
1403 "offline.reached": "Je hebt ronde {n} bereikt.",
1403 "offline.reached": "Je hebt ronde {n} bereikt.",
1404 "offline.detail": "Je speelde tegen {n} {opponents} met skill {skill}%.",
1405 "offline.backMenu": "Terug naar het menu",
1404 "offline.backMenu": "Terug naar het menu",
1406 "gameover.title": "Je hebt verloren",
1405 "gameover.title": "Je hebt verloren",
1407 "gameover.detail": "Alle kolommen zitten vast.",
1406 "gameover.detail": "Alle kolommen zitten vast.",
@@ -1590,10 +1589,18 @@ var I18N_CATALOG = {
1590 "reward.won": "Gewonnen!",
1589 "reward.won": "Gewonnen!",
1591 "reward.lost": "Verloren...",
1590 "reward.lost": "Verloren...",
1592 "reward.total": "Totaal punten",
1591 "reward.total": "Totaal punten",
1593 "reward.continue": "Tik om verder te gaan"
1592 "reward.continue": "Tik om verder te gaan",
1593 "game.menu": "Menu",
1594 "game.paused": "Gepauzeerd",
1595 "game.resume": "Verder spelen",
1596 "game.backToMenu": "Terug naar hoofdmenu",
1597 "reward.ended": "Spel gestopt",
1598 "offline.defeated.one": "{n} tegenstander verslagen",
1599 "offline.defeated.few": "{n} tegenstanders verslagen",
1600 "offline.defeated.many": "{n} tegenstanders verslagen",
1601 "offline.defeated.other": "{n} tegenstanders verslagen"
1594 },
1602 },
1595 "de": {
1603 "de": {
1596 "menu.tagline": "Drei in einer Reihe — und deine Blöcke bekommen Raketenantrieb.",
1597 "menu.play": "Spielen",
1604 "menu.play": "Spielen",
1598 "menu.offline": "Offline-Kampf",
1605 "menu.offline": "Offline-Kampf",
1599 "menu.online": "Online spielen",
1606 "menu.online": "Online spielen",
@@ -1608,7 +1615,6 @@ var I18N_CATALOG = {
1608 "menu.logout": "Abmelden",
1615 "menu.logout": "Abmelden",
1609 "menu.player": "Spieler",
1616 "menu.player": "Spieler",
1610 "planet.title": "Wähle ein Feld",
1617 "planet.title": "Wähle ein Feld",
1611 "planet.tagline": "Jedes Feld ist ein Planet mit eigenem Volk, eigener Schwerkraft, Luft und Masse.",
1612 "planet.back": "Zurück",
1618 "planet.back": "Zurück",
1613 "planet.customBadge": "Eigene",
1619 "planet.customBadge": "Eigene",
1614 "stats.powerLabel": "Power",
1620 "stats.powerLabel": "Power",
@@ -1643,7 +1649,7 @@ var I18N_CATALOG = {
1643 "online.you": "du",
1649 "online.you": "du",
1644 "designer.title": "Planeten-Designer",
1650 "designer.title": "Planeten-Designer",
1645 "designer.taglineBefore": "Gesamt:",
1651 "designer.taglineBefore": "Gesamt:",
1646 "designer.taglineAfter": "Punkte. Blöcke schaltest du frei, indem du Punkte verdienst — du gibst sie nicht aus.",
1652 "designer.taglineAfter": "Punkte.",
1647 "designer.empty": "Du hast noch keine eigenen Planeten. Erstelle einen.",
1653 "designer.empty": "Du hast noch keine eigenen Planeten. Erstelle einen.",
1648 "designer.new": "Neuer Planet",
1654 "designer.new": "Neuer Planet",
1649 "designer.editTitle": "Planet bearbeiten",
1655 "designer.editTitle": "Planet bearbeiten",
@@ -1674,19 +1680,16 @@ var I18N_CATALOG = {
1674 "designer.defaultPeople": "Volk",
1680 "designer.defaultPeople": "Volk",
1675 "hud.points": "Punkte",
1681 "hud.points": "Punkte",
1676 "hud.round": "Runde {n}",
1682 "hud.round": "Runde {n}",
1677 "hud.skill": "Können {n} %",
1678 "hud.out": "Raus",
1683 "hud.out": "Raus",
1679 "hud.miniPoints": "Punkte {n}",
1684 "hud.miniPoints": "Punkte {n}",
1680 "hud.opponent.one": "Gegner",
1685 "hud.opponent.one": "Gegner",
1681 "hud.opponent.few": "Gegner",
1686 "hud.opponent.few": "Gegner",
1682 "hud.opponent.many": "Gegner",
1687 "hud.opponent.many": "Gegner",
1683 "hud.opponent.other": "Gegner",
1688 "hud.opponent.other": "Gegner",
1684 "hud.opponentsLine": "{n} {word}",
1685 "offline.resultTitle": "Offline-Kampf",
1689 "offline.resultTitle": "Offline-Kampf",
1686 "offline.reachedBefore": "Du hast Runde",
1690 "offline.reachedBefore": "Du hast Runde",
1687 "offline.reachedAfter": " erreicht.",
1691 "offline.reachedAfter": " erreicht.",
1688 "offline.reached": "Du hast Runde {n} erreicht.",
1692 "offline.reached": "Du hast Runde {n} erreicht.",
1689 "offline.detail": "Du hast gegen {n} {opponents} mit Können {skill} % gespielt.",
1690 "offline.backMenu": "Zurück zum Menü",
1693 "offline.backMenu": "Zurück zum Menü",
1691 "gameover.title": "Du hast verloren",
1694 "gameover.title": "Du hast verloren",
1692 "gameover.detail": "Alle Spalten sind festgesetzt.",
1695 "gameover.detail": "Alle Spalten sind festgesetzt.",
@@ -1875,10 +1878,18 @@ var I18N_CATALOG = {
1875 "reward.won": "Gewonnen!",
1878 "reward.won": "Gewonnen!",
1876 "reward.lost": "Verloren...",
1879 "reward.lost": "Verloren...",
1877 "reward.total": "Punkte gesamt",
1880 "reward.total": "Punkte gesamt",
1878 "reward.continue": "Tippen zum Fortfahren"
1881 "reward.continue": "Tippen zum Fortfahren",
1882 "game.menu": "Menü",
1883 "game.paused": "Pausiert",
1884 "game.resume": "Weiterspielen",
1885 "game.backToMenu": "Zurück zum Hauptmenü",
1886 "reward.ended": "Spiel beendet",
1887 "offline.defeated.one": "{n} Gegner besiegt",
1888 "offline.defeated.few": "{n} Gegner besiegt",
1889 "offline.defeated.many": "{n} Gegner besiegt",
1890 "offline.defeated.other": "{n} Gegner besiegt"
1879 },
1891 },
1880 "fr": {
1892 "fr": {
1881 "menu.tagline": "Trois d’affilée, et tes blocs s’équipent de propulseurs.",
1882 "menu.play": "Jouer",
1893 "menu.play": "Jouer",
1883 "menu.offline": "Combat hors ligne",
1894 "menu.offline": "Combat hors ligne",
1884 "menu.online": "Jouer en ligne",
1895 "menu.online": "Jouer en ligne",
@@ -1893,7 +1904,6 @@ var I18N_CATALOG = {
1893 "menu.logout": "Déconnexion",
1904 "menu.logout": "Déconnexion",
1894 "menu.player": "joueur",
1905 "menu.player": "joueur",
1895 "planet.title": "Choisis un terrain",
1906 "planet.title": "Choisis un terrain",
1896 "planet.tagline": "Chaque terrain est une planète, avec son peuple, sa gravité, son air et sa masse.",
1897 "planet.back": "Retour",
1907 "planet.back": "Retour",
1898 "planet.customBadge": "Perso",
1908 "planet.customBadge": "Perso",
1899 "stats.powerLabel": "Puissance",
1909 "stats.powerLabel": "Puissance",
@@ -1928,7 +1938,7 @@ var I18N_CATALOG = {
1928 "online.you": "toi",
1938 "online.you": "toi",
1929 "designer.title": "Concepteur de planètes",
1939 "designer.title": "Concepteur de planètes",
1930 "designer.taglineBefore": "Total :",
1940 "designer.taglineBefore": "Total :",
1931 "designer.taglineAfter": "points. Tu débloques des blocs en gagnant des points — tu ne les dépenses pas.",
1941 "designer.taglineAfter": "points.",
1932 "designer.empty": "Tu n’as pas encore de planète à toi. Crées-en une.",
1942 "designer.empty": "Tu n’as pas encore de planète à toi. Crées-en une.",
1933 "designer.new": "Nouvelle planète",
1943 "designer.new": "Nouvelle planète",
1934 "designer.editTitle": "Modifier la planète",
1944 "designer.editTitle": "Modifier la planète",
@@ -1959,19 +1969,16 @@ var I18N_CATALOG = {
1959 "designer.defaultPeople": "Peuple",
1969 "designer.defaultPeople": "Peuple",
1960 "hud.points": "Points",
1970 "hud.points": "Points",
1961 "hud.round": "Manche {n}",
1971 "hud.round": "Manche {n}",
1962 "hud.skill": "Niveau {n} %",
1963 "hud.out": "Éliminé",
1972 "hud.out": "Éliminé",
1964 "hud.miniPoints": "Points {n}",
1973 "hud.miniPoints": "Points {n}",
1965 "hud.opponent.one": "adversaire",
1974 "hud.opponent.one": "adversaire",
1966 "hud.opponent.few": "adversaires",
1975 "hud.opponent.few": "adversaires",
1967 "hud.opponent.many": "adversaires",
1976 "hud.opponent.many": "adversaires",
1968 "hud.opponent.other": "adversaires",
1977 "hud.opponent.other": "adversaires",
1969 "hud.opponentsLine": "{n} {word}",
1970 "offline.resultTitle": "Combat hors ligne",
1978 "offline.resultTitle": "Combat hors ligne",
1971 "offline.reachedBefore": "Tu as atteint la manche",
1979 "offline.reachedBefore": "Tu as atteint la manche",
1972 "offline.reachedAfter": ".",
1980 "offline.reachedAfter": ".",
1973 "offline.reached": "Tu as atteint la manche {n}.",
1981 "offline.reached": "Tu as atteint la manche {n}.",
1974 "offline.detail": "Tu as joué contre {n} {opponents} au niveau {skill} %.",
1975 "offline.backMenu": "Retour au menu",
1982 "offline.backMenu": "Retour au menu",
1976 "gameover.title": "Tu as perdu",
1983 "gameover.title": "Tu as perdu",
1977 "gameover.detail": "Toutes les colonnes sont bloquées.",
1984 "gameover.detail": "Toutes les colonnes sont bloquées.",
@@ -2160,10 +2167,18 @@ var I18N_CATALOG = {
2160 "reward.won": "Victoire !",
2167 "reward.won": "Victoire !",
2161 "reward.lost": "Perdu...",
2168 "reward.lost": "Perdu...",
2162 "reward.total": "Total des points",
2169 "reward.total": "Total des points",
2163 "reward.continue": "Touchez pour continuer"
2170 "reward.continue": "Touchez pour continuer",
2171 "game.menu": "Menu",
2172 "game.paused": "En pause",
2173 "game.resume": "Reprendre",
2174 "game.backToMenu": "Retour au menu principal",
2175 "reward.ended": "Partie terminée",
2176 "offline.defeated.one": "{n} adversaire vaincu",
2177 "offline.defeated.few": "{n} adversaires vaincus",
2178 "offline.defeated.many": "{n} adversaires vaincus",
2179 "offline.defeated.other": "{n} adversaires vaincus"
2164 },
2180 },
2165 "ja": {
2181 "ja": {
2166 "menu.tagline": "三つ揃えると、ブロックにロケットが点火します。",
2167 "menu.play": "プレイ",
2182 "menu.play": "プレイ",
2168 "menu.offline": "オフライン対戦",
2183 "menu.offline": "オフライン対戦",
2169 "menu.online": "オンラインで遊ぶ",
2184 "menu.online": "オンラインで遊ぶ",
@@ -2178,7 +2193,6 @@ var I18N_CATALOG = {
2178 "menu.logout": "ログアウト",
2193 "menu.logout": "ログアウト",
2179 "menu.player": "プレイヤー",
2194 "menu.player": "プレイヤー",
2180 "planet.title": "フィールドを選ぶ",
2195 "planet.title": "フィールドを選ぶ",
2181 "planet.tagline": "各フィールドは惑星です。固有の民、重力、大気、質量を持ちます。",
2182 "planet.back": "戻る",
2196 "planet.back": "戻る",
2183 "planet.customBadge": "自作",
2197 "planet.customBadge": "自作",
2184 "stats.powerLabel": "パワー",
2198 "stats.powerLabel": "パワー",
@@ -2213,7 +2227,7 @@ var I18N_CATALOG = {
2213 "online.you": "あなた",
2227 "online.you": "あなた",
2214 "designer.title": "惑星デザイナー",
2228 "designer.title": "惑星デザイナー",
2215 "designer.taglineBefore": "合計:",
2229 "designer.taglineBefore": "合計:",
2216 "designer.taglineAfter": "ポイント。ポイントを獲得するとブロックが解放されます。消費はしません。",
2230 "designer.taglineAfter": "ポイント。",
2217 "designer.empty": "まだ自分の惑星がありません。新しく作ってみましょう。",
2231 "designer.empty": "まだ自分の惑星がありません。新しく作ってみましょう。",
2218 "designer.new": "新しい惑星",
2232 "designer.new": "新しい惑星",
2219 "designer.editTitle": "惑星を編集",
2233 "designer.editTitle": "惑星を編集",
@@ -2244,19 +2258,16 @@ var I18N_CATALOG = {
2244 "designer.defaultPeople": "民",
2258 "designer.defaultPeople": "民",
2245 "hud.points": "ポイント",
2259 "hud.points": "ポイント",
2246 "hud.round": "ラウンド {n}",
2260 "hud.round": "ラウンド {n}",
2247 "hud.skill": "スキル {n}%",
2248 "hud.out": "脱落",
2261 "hud.out": "脱落",
2249 "hud.miniPoints": "ポイント {n}",
2262 "hud.miniPoints": "ポイント {n}",
2250 "hud.opponent.one": "相手",
2263 "hud.opponent.one": "相手",
2251 "hud.opponent.few": "相手",
2264 "hud.opponent.few": "相手",
2252 "hud.opponent.many": "相手",
2265 "hud.opponent.many": "相手",
2253 "hud.opponent.other": "相手",
2266 "hud.opponent.other": "相手",
2254 "hud.opponentsLine": "{word} {n} 人",
2255 "offline.resultTitle": "オフライン対戦",
2267 "offline.resultTitle": "オフライン対戦",
2256 "offline.reachedBefore": "到達ラウンド:",
2268 "offline.reachedBefore": "到達ラウンド:",
2257 "offline.reachedAfter": "。",
2269 "offline.reachedAfter": "。",
2258 "offline.reached": "ラウンド {n} まで到達しました。",
2270 "offline.reached": "ラウンド {n} まで到達しました。",
2259 "offline.detail": "スキル {skill}% の{opponents}{n}人と対戦しました。",
2260 "offline.backMenu": "メニューに戻る",
2271 "offline.backMenu": "メニューに戻る",
2261 "gameover.title": "負けました",
2272 "gameover.title": "負けました",
2262 "gameover.detail": "すべての列がロックされました。",
2273 "gameover.detail": "すべての列がロックされました。",
@@ -2445,10 +2456,18 @@ var I18N_CATALOG = {
2445 "reward.won": "勝利!",
2456 "reward.won": "勝利!",
2446 "reward.lost": "敗北...",
2457 "reward.lost": "敗北...",
2447 "reward.total": "合計ポイント",
2458 "reward.total": "合計ポイント",
2448 "reward.continue": "タップして続ける"
2459 "reward.continue": "タップして続ける",
2460 "game.menu": "メニュー",
2461 "game.paused": "一時停止中",
2462 "game.resume": "再開",
2463 "game.backToMenu": "メインメニューに戻る",
2464 "reward.ended": "ゲーム終了",
2465 "offline.defeated.one": "{n}人の相手を倒した",
2466 "offline.defeated.few": "{n}人の相手を倒した",
2467 "offline.defeated.many": "{n}人の相手を倒した",
2468 "offline.defeated.other": "{n}人の相手を倒した"
2449 },
2469 },
2450 "zh": {
2470 "zh": {
2451 "menu.tagline": "三个一排,你的方块就会装上火箭。",
2452 "menu.play": "开始游戏",
2471 "menu.play": "开始游戏",
2453 "menu.offline": "离线对战",
2472 "menu.offline": "离线对战",
2454 "menu.online": "在线游戏",
2473 "menu.online": "在线游戏",
@@ -2463,7 +2482,6 @@ var I18N_CATALOG = {
2463 "menu.logout": "退出",
2482 "menu.logout": "退出",
2464 "menu.player": "玩家",
2483 "menu.player": "玩家",
2465 "planet.title": "选择场地",
2484 "planet.title": "选择场地",
2466 "planet.tagline": "每块场地都是一颗星球,有自己的居民、重力、空气和质量。",
2467 "planet.back": "返回",
2485 "planet.back": "返回",
2468 "planet.customBadge": "自制",
2486 "planet.customBadge": "自制",
2469 "stats.powerLabel": "力量",
2487 "stats.powerLabel": "力量",
@@ -2498,7 +2516,7 @@ var I18N_CATALOG = {
2498 "online.you": "你",
2516 "online.you": "你",
2499 "designer.title": "星球设计器",
2517 "designer.title": "星球设计器",
2500 "designer.taglineBefore": "总分:",
2518 "designer.taglineBefore": "总分:",
2501 "designer.taglineAfter": "分。通过得分解锁方块——分数不会被消耗。",
2519 "designer.taglineAfter": "分。",
2502 "designer.empty": "你还没有自己的星球。来创建一个吧。",
2520 "designer.empty": "你还没有自己的星球。来创建一个吧。",
2503 "designer.new": "新星球",
2521 "designer.new": "新星球",
2504 "designer.editTitle": "编辑星球",
2522 "designer.editTitle": "编辑星球",
@@ -2529,19 +2547,16 @@ var I18N_CATALOG = {
2529 "designer.defaultPeople": "居民",
2547 "designer.defaultPeople": "居民",
2530 "hud.points": "分数",
2548 "hud.points": "分数",
2531 "hud.round": "第 {n} 轮",
2549 "hud.round": "第 {n} 轮",
2532 "hud.skill": "水平 {n}%",
2533 "hud.out": "出局",
2550 "hud.out": "出局",
2534 "hud.miniPoints": "分数 {n}",
2551 "hud.miniPoints": "分数 {n}",
2535 "hud.opponent.one": "对手",
2552 "hud.opponent.one": "对手",
2536 "hud.opponent.few": "对手",
2553 "hud.opponent.few": "对手",
2537 "hud.opponent.many": "对手",
2554 "hud.opponent.many": "对手",
2538 "hud.opponent.other": "对手",
2555 "hud.opponent.other": "对手",
2539 "hud.opponentsLine": "{n} 名{word}",
2540 "offline.resultTitle": "离线对战",
2556 "offline.resultTitle": "离线对战",
2541 "offline.reachedBefore": "你到达了第",
2557 "offline.reachedBefore": "你到达了第",
2542 "offline.reachedAfter": " 轮。",
2558 "offline.reachedAfter": " 轮。",
2543 "offline.reached": "你到达了第 {n} 轮。",
2559 "offline.reached": "你到达了第 {n} 轮。",
2544 "offline.detail": "你以 {skill}% 的水平对战了 {n} 名{opponents}。",
2545 "offline.backMenu": "返回菜单",
2560 "offline.backMenu": "返回菜单",
2546 "gameover.title": "你输了",
2561 "gameover.title": "你输了",
2547 "gameover.detail": "所有列都已锁定。",
2562 "gameover.detail": "所有列都已锁定。",
@@ -2730,10 +2745,18 @@ var I18N_CATALOG = {
2730 "reward.won": "你赢了!",
2745 "reward.won": "你赢了!",
2731 "reward.lost": "你输了...",
2746 "reward.lost": "你输了...",
2732 "reward.total": "总积分",
2747 "reward.total": "总积分",
2733 "reward.continue": "点击继续"
2748 "reward.continue": "点击继续",
2749 "game.menu": "菜单",
2750 "game.paused": "已暂停",
2751 "game.resume": "继续游戏",
2752 "game.backToMenu": "返回主菜单",
2753 "reward.ended": "游戏结束",
2754 "offline.defeated.one": "击败了 {n} 名对手",
2755 "offline.defeated.few": "击败了 {n} 名对手",
2756 "offline.defeated.many": "击败了 {n} 名对手",
2757 "offline.defeated.other": "击败了 {n} 名对手"
2734 },
2758 },
2735 "ko": {
2759 "ko": {
2736 "menu.tagline": "세 개를 나란히 맞추면 블록에 로켓이 점화됩니다.",
2737 "menu.play": "플레이",
2760 "menu.play": "플레이",
2738 "menu.offline": "오프라인 대결",
2761 "menu.offline": "오프라인 대결",
2739 "menu.online": "온라인 플레이",
2762 "menu.online": "온라인 플레이",
@@ -2748,7 +2771,6 @@ var I18N_CATALOG = {
2748 "menu.logout": "로그아웃",
2771 "menu.logout": "로그아웃",
2749 "menu.player": "플레이어",
2772 "menu.player": "플레이어",
2750 "planet.title": "필드 선택",
2773 "planet.title": "필드 선택",
2751 "planet.tagline": "각 필드는 행성입니다. 고유한 주민, 중력, 공기, 질량을 가집니다.",
2752 "planet.back": "뒤로",
2774 "planet.back": "뒤로",
2753 "planet.customBadge": "내 것",
2775 "planet.customBadge": "내 것",
2754 "stats.powerLabel": "파워",
2776 "stats.powerLabel": "파워",
@@ -2783,7 +2805,7 @@ var I18N_CATALOG = {
2783 "online.you": "나",
2805 "online.you": "나",
2784 "designer.title": "행성 디자이너",
2806 "designer.title": "행성 디자이너",
2785 "designer.taglineBefore": "합계:",
2807 "designer.taglineBefore": "합계:",
2786 "designer.taglineAfter": "점. 점수를 모으면 블록이 해금됩니다. 점수를 쓰지는 않습니다.",
2808 "designer.taglineAfter": "점.",
2787 "designer.empty": "아직 내 행성이 없습니다. 하나 만들어 보세요.",
2809 "designer.empty": "아직 내 행성이 없습니다. 하나 만들어 보세요.",
2788 "designer.new": "새 행성",
2810 "designer.new": "새 행성",
2789 "designer.editTitle": "행성 편집",
2811 "designer.editTitle": "행성 편집",
@@ -2814,19 +2836,16 @@ var I18N_CATALOG = {
2814 "designer.defaultPeople": "주민",
2836 "designer.defaultPeople": "주민",
2815 "hud.points": "점수",
2837 "hud.points": "점수",
2816 "hud.round": "{n}라운드",
2838 "hud.round": "{n}라운드",
2817 "hud.skill": "숙련도 {n}%",
2818 "hud.out": "탈락",
2839 "hud.out": "탈락",
2819 "hud.miniPoints": "점수 {n}",
2840 "hud.miniPoints": "점수 {n}",
2820 "hud.opponent.one": "상대",
2841 "hud.opponent.one": "상대",
2821 "hud.opponent.few": "상대",
2842 "hud.opponent.few": "상대",
2822 "hud.opponent.many": "상대",
2843 "hud.opponent.many": "상대",
2823 "hud.opponent.other": "상대",
2844 "hud.opponent.other": "상대",
2824 "hud.opponentsLine": "{word} {n}명",
2825 "offline.resultTitle": "오프라인 대결",
2845 "offline.resultTitle": "오프라인 대결",
2826 "offline.reachedBefore": "도달한 라운드:",
2846 "offline.reachedBefore": "도달한 라운드:",
2827 "offline.reachedAfter": ".",
2847 "offline.reachedAfter": ".",
2828 "offline.reached": "{n}라운드까지 도달했습니다.",
2848 "offline.reached": "{n}라운드까지 도달했습니다.",
2829 "offline.detail": "숙련도 {skill}%의 {opponents} {n}명과 대결했습니다.",
2830 "offline.backMenu": "메뉴로 돌아가기",
2849 "offline.backMenu": "메뉴로 돌아가기",
2831 "gameover.title": "패배했습니다",
2850 "gameover.title": "패배했습니다",
2832 "gameover.detail": "모든 열이 잠겼습니다.",
2851 "gameover.detail": "모든 열이 잠겼습니다.",
@@ -3015,10 +3034,18 @@ var I18N_CATALOG = {
3015 "reward.won": "승리!",
3034 "reward.won": "승리!",
3016 "reward.lost": "패배...",
3035 "reward.lost": "패배...",
3017 "reward.total": "총 포인트",
3036 "reward.total": "총 포인트",
3018 "reward.continue": "탭하여 계속"
3037 "reward.continue": "탭하여 계속",
3038 "game.menu": "메뉴",
3039 "game.paused": "일시정지",
3040 "game.resume": "계속하기",
3041 "game.backToMenu": "메인 메뉴로 돌아가기",
3042 "reward.ended": "게임 종료",
3043 "offline.defeated.one": "상대 {n}명 격파",
3044 "offline.defeated.few": "상대 {n}명 격파",
3045 "offline.defeated.many": "상대 {n}명 격파",
3046 "offline.defeated.other": "상대 {n}명 격파"
3019 },
3047 },
3020 "pl": {
3048 "pl": {
3021 "menu.tagline": "Trzy w rzędzie, a twoje klocki dostają napęd rakietowy.",
3022 "menu.play": "Graj",
3049 "menu.play": "Graj",
3023 "menu.offline": "Walka offline",
3050 "menu.offline": "Walka offline",
3024 "menu.online": "Graj online",
3051 "menu.online": "Graj online",
@@ -3033,7 +3060,6 @@ var I18N_CATALOG = {
3033 "menu.logout": "Wyloguj się",
3060 "menu.logout": "Wyloguj się",
3034 "menu.player": "gracz",
3061 "menu.player": "gracz",
3035 "planet.title": "Wybierz pole",
3062 "planet.title": "Wybierz pole",
3036 "planet.tagline": "Każde pole to planeta, z własnym ludem, grawitacją, powietrzem i masą.",
3037 "planet.back": "Wstecz",
3063 "planet.back": "Wstecz",
3038 "planet.customBadge": "Twoja",
3064 "planet.customBadge": "Twoja",
3039 "stats.powerLabel": "Moc",
3065 "stats.powerLabel": "Moc",
@@ -3068,7 +3094,7 @@ var I18N_CATALOG = {
3068 "online.you": "ty",
3094 "online.you": "ty",
3069 "designer.title": "Kreator planet",
3095 "designer.title": "Kreator planet",
3070 "designer.taglineBefore": "Suma:",
3096 "designer.taglineBefore": "Suma:",
3071 "designer.taglineAfter": "pkt. Odblokowujesz klocki, zdobywając punkty — nie wydajesz ich.",
3097 "designer.taglineAfter": "pkt.",
3072 "designer.empty": "Nie masz jeszcze własnych planet. Utwórz jedną.",
3098 "designer.empty": "Nie masz jeszcze własnych planet. Utwórz jedną.",
3073 "designer.new": "Nowa planeta",
3099 "designer.new": "Nowa planeta",
3074 "designer.editTitle": "Edytuj planetę",
3100 "designer.editTitle": "Edytuj planetę",
@@ -3099,19 +3125,16 @@ var I18N_CATALOG = {
3099 "designer.defaultPeople": "Lud",
3125 "designer.defaultPeople": "Lud",
3100 "hud.points": "Punkty",
3126 "hud.points": "Punkty",
3101 "hud.round": "Runda {n}",
3127 "hud.round": "Runda {n}",
3102 "hud.skill": "Umiejętność {n}%",
3103 "hud.out": "Poza",
3128 "hud.out": "Poza",
3104 "hud.miniPoints": "Punkty {n}",
3129 "hud.miniPoints": "Punkty {n}",
3105 "hud.opponent.one": "przeciwnik",
3130 "hud.opponent.one": "przeciwnik",
3106 "hud.opponent.few": "przeciwników",
3131 "hud.opponent.few": "przeciwników",
3107 "hud.opponent.many": "przeciwników",
3132 "hud.opponent.many": "przeciwników",
3108 "hud.opponent.other": "przeciwników",
3133 "hud.opponent.other": "przeciwników",
3109 "hud.opponentsLine": "{n} {word}",
3110 "offline.resultTitle": "Walka offline",
3134 "offline.resultTitle": "Walka offline",
3111 "offline.reachedBefore": "Dotarłeś do rundy",
3135 "offline.reachedBefore": "Dotarłeś do rundy",
3112 "offline.reachedAfter": ".",
3136 "offline.reachedAfter": ".",
3113 "offline.reached": "Dotarłeś do rundy {n}.",
3137 "offline.reached": "Dotarłeś do rundy {n}.",
3114 "offline.detail": "Grałeś przeciwko {n} {opponents} przy umiejętności {skill}%.",
3115 "offline.backMenu": "Powrót do menu",
3138 "offline.backMenu": "Powrót do menu",
3116 "gameover.title": "Przegrałeś",
3139 "gameover.title": "Przegrałeś",
3117 "gameover.detail": "Wszystkie kolumny są zablokowane.",
3140 "gameover.detail": "Wszystkie kolumny są zablokowane.",
@@ -3300,10 +3323,18 @@ var I18N_CATALOG = {
3300 "reward.won": "Wygrana!",
3323 "reward.won": "Wygrana!",
3301 "reward.lost": "Przegrana...",
3324 "reward.lost": "Przegrana...",
3302 "reward.total": "Suma punktów",
3325 "reward.total": "Suma punktów",
3303 "reward.continue": "Dotknij, aby kontynuować"
3326 "reward.continue": "Dotknij, aby kontynuować",
3327 "game.menu": "Menu",
3328 "game.paused": "Pauza",
3329 "game.resume": "Wznów",
3330 "game.backToMenu": "Powrót do menu głównego",
3331 "reward.ended": "Gra zakończona",
3332 "offline.defeated.one": "{n} pokonany przeciwnik",
3333 "offline.defeated.few": "{n} pokonanych przeciwników",
3334 "offline.defeated.many": "{n} pokonanych przeciwników",
3335 "offline.defeated.other": "{n} pokonanych przeciwników"
3304 },
3336 },
3305 "ru": {
3337 "ru": {
3306 "menu.tagline": "Три в ряд — и твои блоки получают ракетные двигатели.",
3307 "menu.play": "Играть",
3338 "menu.play": "Играть",
3308 "menu.offline": "Офлайн-бой",
3339 "menu.offline": "Офлайн-бой",
3309 "menu.online": "Играть онлайн",
3340 "menu.online": "Играть онлайн",
@@ -3318,7 +3349,6 @@ var I18N_CATALOG = {
3318 "menu.logout": "Выйти",
3349 "menu.logout": "Выйти",
3319 "menu.player": "игрок",
3350 "menu.player": "игрок",
3320 "planet.title": "Выбери поле",
3351 "planet.title": "Выбери поле",
3321 "planet.tagline": "Каждое поле — это планета со своим народом, гравитацией, воздухом и массой.",
3322 "planet.back": "Назад",
3352 "planet.back": "Назад",
3323 "planet.customBadge": "Своя",
3353 "planet.customBadge": "Своя",
3324 "stats.powerLabel": "Мощность",
3354 "stats.powerLabel": "Мощность",
@@ -3353,7 +3383,7 @@ var I18N_CATALOG = {
3353 "online.you": "ты",
3383 "online.you": "ты",
3354 "designer.title": "Конструктор планет",
3384 "designer.title": "Конструктор планет",
3355 "designer.taglineBefore": "Всего:",
3385 "designer.taglineBefore": "Всего:",
3356 "designer.taglineAfter": "очков. Блоки открываются за заработанные очки — тратить их не нужно.",
3386 "designer.taglineAfter": "очков.",
3357 "designer.empty": "У тебя ещё нет своих планет. Создай одну.",
3387 "designer.empty": "У тебя ещё нет своих планет. Создай одну.",
3358 "designer.new": "Новая планета",
3388 "designer.new": "Новая планета",
3359 "designer.editTitle": "Изменить планету",
3389 "designer.editTitle": "Изменить планету",
@@ -3384,19 +3414,16 @@ var I18N_CATALOG = {
3384 "designer.defaultPeople": "Народ",
3414 "designer.defaultPeople": "Народ",
3385 "hud.points": "Очки",
3415 "hud.points": "Очки",
3386 "hud.round": "Раунд {n}",
3416 "hud.round": "Раунд {n}",
3387 "hud.skill": "Мастерство {n} %",
3388 "hud.out": "Вне",
3417 "hud.out": "Вне",
3389 "hud.miniPoints": "Очки {n}",
3418 "hud.miniPoints": "Очки {n}",
3390 "hud.opponent.one": "противник",
3419 "hud.opponent.one": "противник",
3391 "hud.opponent.few": "противника",
3420 "hud.opponent.few": "противника",
3392 "hud.opponent.many": "противников",
3421 "hud.opponent.many": "противников",
3393 "hud.opponent.other": "противников",
3422 "hud.opponent.other": "противников",
3394 "hud.opponentsLine": "{n} {word}",
3395 "offline.resultTitle": "Офлайн-бой",
3423 "offline.resultTitle": "Офлайн-бой",
3396 "offline.reachedBefore": "Ты дошёл до раунда",
3424 "offline.reachedBefore": "Ты дошёл до раунда",
3397 "offline.reachedAfter": ".",
3425 "offline.reachedAfter": ".",
3398 "offline.reached": "Ты дошёл до раунда {n}.",
3426 "offline.reached": "Ты дошёл до раунда {n}.",
3399 "offline.detail": "Ты играл против {n} {opponents} с мастерством {skill} %.",
3400 "offline.backMenu": "Вернуться в меню",
3427 "offline.backMenu": "Вернуться в меню",
3401 "gameover.title": "Ты проиграл",
3428 "gameover.title": "Ты проиграл",
3402 "gameover.detail": "Все столбцы заблокированы.",
3429 "gameover.detail": "Все столбцы заблокированы.",
@@ -3585,10 +3612,18 @@ var I18N_CATALOG = {
3585 "reward.won": "Победа!",
3612 "reward.won": "Победа!",
3586 "reward.lost": "Поражение...",
3613 "reward.lost": "Поражение...",
3587 "reward.total": "Всего очков",
3614 "reward.total": "Всего очков",
3588 "reward.continue": "Нажмите, чтобы продолжить"
3615 "reward.continue": "Нажмите, чтобы продолжить",
3616 "game.menu": "Меню",
3617 "game.paused": "Пауза",
3618 "game.resume": "Продолжить",
3619 "game.backToMenu": "В главное меню",
3620 "reward.ended": "Игра окончена",
3621 "offline.defeated.one": "{n} противник побеждён",
3622 "offline.defeated.few": "{n} противника побеждено",
3623 "offline.defeated.many": "{n} противников побеждено",
3624 "offline.defeated.other": "{n} противников побеждено"
3589 },
3625 },
3590 "es": {
3626 "es": {
3591 "menu.tagline": "Tres en raya, y tus bloques ganan motores cohete.",
3592 "menu.play": "Jugar",
3627 "menu.play": "Jugar",
3593 "menu.offline": "Combate sin conexión",
3628 "menu.offline": "Combate sin conexión",
3594 "menu.online": "Jugar en línea",
3629 "menu.online": "Jugar en línea",
@@ -3603,7 +3638,6 @@ var I18N_CATALOG = {
3603 "menu.logout": "Cerrar sesión",
3638 "menu.logout": "Cerrar sesión",
3604 "menu.player": "jugador",
3639 "menu.player": "jugador",
3605 "planet.title": "Elige un campo",
3640 "planet.title": "Elige un campo",
3606 "planet.tagline": "Cada campo es un planeta, con su pueblo, gravedad, aire y masa.",
3607 "planet.back": "Volver",
3641 "planet.back": "Volver",
3608 "planet.customBadge": "Tuya",
3642 "planet.customBadge": "Tuya",
3609 "stats.powerLabel": "Potencia",
3643 "stats.powerLabel": "Potencia",
@@ -3638,7 +3672,7 @@ var I18N_CATALOG = {
3638 "online.you": "tú",
3672 "online.you": "tú",
3639 "designer.title": "Diseñador de planetas",
3673 "designer.title": "Diseñador de planetas",
3640 "designer.taglineBefore": "Total:",
3674 "designer.taglineBefore": "Total:",
3641 "designer.taglineAfter": "puntos. Desbloqueas bloques al ganar puntos; no los gastas.",
3675 "designer.taglineAfter": "puntos.",
3642 "designer.empty": "Aún no tienes planetas propios. Crea uno.",
3676 "designer.empty": "Aún no tienes planetas propios. Crea uno.",
3643 "designer.new": "Nuevo planeta",
3677 "designer.new": "Nuevo planeta",
3644 "designer.editTitle": "Editar planeta",
3678 "designer.editTitle": "Editar planeta",
@@ -3669,19 +3703,16 @@ var I18N_CATALOG = {
3669 "designer.defaultPeople": "Pueblo",
3703 "designer.defaultPeople": "Pueblo",
3670 "hud.points": "Puntos",
3704 "hud.points": "Puntos",
3671 "hud.round": "Ronda {n}",
3705 "hud.round": "Ronda {n}",
3672 "hud.skill": "Nivel {n} %",
3673 "hud.out": "Fuera",
3706 "hud.out": "Fuera",
3674 "hud.miniPoints": "Puntos {n}",
3707 "hud.miniPoints": "Puntos {n}",
3675 "hud.opponent.one": "rival",
3708 "hud.opponent.one": "rival",
3676 "hud.opponent.few": "rivales",
3709 "hud.opponent.few": "rivales",
3677 "hud.opponent.many": "rivales",
3710 "hud.opponent.many": "rivales",
3678 "hud.opponent.other": "rivales",
3711 "hud.opponent.other": "rivales",
3679 "hud.opponentsLine": "{n} {word}",
3680 "offline.resultTitle": "Combate sin conexión",
3712 "offline.resultTitle": "Combate sin conexión",
3681 "offline.reachedBefore": "Has llegado a la ronda",
3713 "offline.reachedBefore": "Has llegado a la ronda",
3682 "offline.reachedAfter": ".",
3714 "offline.reachedAfter": ".",
3683 "offline.reached": "Has llegado a la ronda {n}.",
3715 "offline.reached": "Has llegado a la ronda {n}.",
3684 "offline.detail": "Jugaste contra {n} {opponents} con un nivel del {skill} %.",
3685 "offline.backMenu": "Volver al menú",
3716 "offline.backMenu": "Volver al menú",
3686 "gameover.title": "Has perdido",
3717 "gameover.title": "Has perdido",
3687 "gameover.detail": "Todas las columnas están bloqueadas.",
3718 "gameover.detail": "Todas las columnas están bloqueadas.",
@@ -3870,7 +3901,16 @@ var I18N_CATALOG = {
3870 "reward.won": "¡Has ganado!",
3901 "reward.won": "¡Has ganado!",
3871 "reward.lost": "Has perdido...",
3902 "reward.lost": "Has perdido...",
3872 "reward.total": "Puntos totales",
3903 "reward.total": "Puntos totales",
3873 "reward.continue": "Toca para continuar"
3904 "reward.continue": "Toca para continuar",
3905 "game.menu": "Menú",
3906 "game.paused": "En pausa",
3907 "game.resume": "Continuar",
3908 "game.backToMenu": "Volver al menú principal",
3909 "reward.ended": "Partida terminada",
3910 "offline.defeated.one": "{n} rival derrotado",
3911 "offline.defeated.few": "{n} rivales derrotados",
3912 "offline.defeated.many": "{n} rivales derrotados",
3913 "offline.defeated.other": "{n} rivales derrotados"
3874 }
3914 }
3875 },
3915 },
3876 "errors": {
3916 "errors": {
@@ -5173,6 +5213,9 @@ function GameCore (planet, rng)
5173 this.spawnInterval = PlanetMod.SPAWN_INTERVAL;
5213 this.spawnInterval = PlanetMod.SPAWN_INTERVAL;
5174 /** Seconds of actual play in this match / round (t1189). */
5214 /** Seconds of actual play in this match / round (t1189). */
5175 this.playTime = 0;
5215 this.playTime = 0;
5216 /** t1197: matches in the current combo and seconds since the last one. */
5217 this.combo = 0;
5218 this.comboAge = 0;
5176 this.settleTime = PlanetMod.SETTLE_TIME;
5219 this.settleTime = PlanetMod.SETTLE_TIME;
5177 this.score = 0;
5220 this.score = 0;
5178 this.state = 'playing';
5221 this.state = 'playing';
@@ -5211,6 +5254,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;
5211GameCore.SNAP_Y = SNAP_Y;
5254GameCore.SNAP_Y = SNAP_Y;
5212GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
5255GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
5213GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;
5256GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;
5257/** t1197: each match in a combo adds this much jump height (additive). */
5258GameCore.COMBO_STEP = 0.05;
5259/** t1197: the combo resets when no match is made for this long (s). */
5260GameCore.COMBO_RESET_S = 5;
5214GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
5261GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
5215GameCore.DEFAULT_MISS_CHANCE = 0.30;
5262GameCore.DEFAULT_MISS_CHANCE = 0.30;
5216GameCore.STATE_STILL = STATE_STILL;
5263GameCore.STATE_STILL = STATE_STILL;
@@ -5688,6 +5735,14 @@ GameCore.prototype.tick = function (dt)
5688 // t1192: waiting received blocks drop first, as soon as there is room.
5735 // t1192: waiting received blocks drop first, as soon as there is room.
5689 if (this.garbageQueue.length)
5736 if (this.garbageQueue.length)
5690 { this.drainGarbageQueue(); }
5737 { this.drainGarbageQueue(); }
5738 // t1197: combo expires after COMBO_RESET_S without a match.
5739 this.comboAge += dt;
5740 if (this.combo > 0 && this.comboAge >= GameCore.COMBO_RESET_S)
5741 {
5742 this.combo = 0;
5743 if (!this.hasActiveLandingChain())
5744 { this.lastChainIndicator = null; }
5745 }
5691 this.spawnTimer += dt;
5746 this.spawnTimer += dt;
5692 var iv = this.currentSpawnInterval();
5747 var iv = this.currentSpawnInterval();
5693 while (this.spawnTimer >= iv)
5748 while (this.spawnTimer >= iv)
@@ -7723,15 +7778,21 @@ GameCore.prototype.resolveMatches = function ()
7723 }
7778 }
7724 }
7779 }
7725 var chain = this.landingChainFor(group);
7780 var chain = this.landingChainFor(group);
7726 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain;
7781 // t1197: combo bonus = COMBO_STEP per earlier match in this combo,
7782 // added to the landing-chain bonus (one shown "+x%").
7783 var comboBonus = GameCore.COMBO_STEP * this.combo;
7784 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;
7727 height *= bonusMul;
7785 height *= bonusMul;
7728 this.launchCluster(group, height, { landingChain: chain });
7786 this.launchCluster(group, height, { landingChain: chain });
7729 launched.push({
7787 launched.push({
7730 blocks: group,
7788 blocks: group,
7731 jumpHeight: height,
7789 jumpHeight: height,
7732 landingChain: chain,
7790 landingChain: chain,
7791 comboBonus: comboBonus,
7733 chainBonus: bonusMul
7792 chainBonus: bonusMul
7734 });
7793 });
7794 this.combo += 1;
7795 this.comboAge = 0;
7735 }
7796 }
7736 this.finishLandingChains(launched);
7797 this.finishLandingChains(launched);
7737 this.updateChainIndicator(launched);
7798 this.updateChainIndicator(launched);
@@ -8253,24 +8314,35 @@ GameCore.prototype.finishLandingChains = function (launched)
8253GameCore.prototype.updateChainIndicator = function (launched)
8314GameCore.prototype.updateChainIndicator = function (launched)
8254{
8315{
8255 var maxChain = 0;
8316 var maxChain = 0;
8317 var maxPct = 0;
8256 for (var i = 0; i < launched.length; i++)
8318 for (var i = 0; i < launched.length; i++)
8257 {
8319 {
8258 var ch = launched[i].landingChain || 0;
8320 var ch = launched[i].landingChain || 0;
8259 if (ch > maxChain)
8321 if (ch > maxChain)
8260 { maxChain = ch; }
8322 { maxChain = ch; }
8323 var pct = Math.round(((launched[i].chainBonus || 1) - 1) * 100);
8324 if (pct > maxPct)
8325 { maxPct = pct; }
8261 }
8326 }
8262 if (maxChain >= 1)
8327 if (maxPct > 0)
8263 {
8328 {
8264 this.lastChainIndicator = {
8329 this.lastChainIndicator = {
8265 chain: maxChain,
8330 chain: maxChain,
8266 bonusPct: Math.round(maxChain * LANDING_CHAIN_BONUS * 100)
8331 combo: this.combo,
8332 bonusPct: maxPct
8267 };
8333 };
8268 return;
8334 return;
8269 }
8335 }
8270 if (!this.hasActiveLandingChain())
8336 if (!this.hasActiveLandingChain() && !(launched.length && this.combo > 0))
8271 { this.lastChainIndicator = null; }
8337 { this.lastChainIndicator = null; }
8272};
8338};
8273
8339
8340/** Bonus (percent) the next match would get from the combo alone (t1197). */
8341GameCore.prototype.comboBonusPct = function ()
8342{
8343 return Math.round(GameCore.COMBO_STEP * this.combo * 100);
8344};
8345
8274GameCore.prototype.hasActiveLandingChain = function ()
8346GameCore.prototype.hasActiveLandingChain = function ()
8275{
8347{
8276 var ids = Object.keys(this.clusters);
8348 var ids = Object.keys(this.clusters);
@@ -9214,6 +9286,8 @@ Online._apply = function (data)
9214 { this.lifetimePoints = data.lifetime_points; }
9286 { this.lifetimePoints = data.lifetime_points; }
9215 if (data.locale !== undefined)
9287 if (data.locale !== undefined)
9216 { this.locale = data.locale; }
9288 { this.locale = data.locale; }
9289 if (data.last_planet !== undefined)
9290 { this.lastPlanet = data.last_planet; }
9217 if (data.blocks)
9291 if (data.blocks)
9218 { this.blocks = data.blocks; }
9292 { this.blocks = data.blocks; }
9219 if (data.planets)
9293 if (data.planets)
@@ -9321,6 +9395,13 @@ Online.deletePlanet = function (id)
9321 return this.request('planet_delete', { id: id });
9395 return this.request('planet_delete', { id: id });
9322};
9396};
9323
9397
9398/** Remember the last chosen planet on the profile (t1196). */
9399Online.setLastPlanet = function (planetId)
9400{
9401 this.lastPlanet = planetId;
9402 return this.request('set_last_planet', { planet_id: planetId });
9403};
9404
9324Online.setLocale = function (locale)
9405Online.setLocale = function (locale)
9325{
9406{
9326 return this.request('set_locale', { locale: locale });
9407 return this.request('set_locale', { locale: locale });
@@ -9499,9 +9580,10 @@ Online.stopPolling = function ()
9499 }
9580 }
9500};
9581};
9501
9582
9583/** Login from the Online screen: come back to online play (t1193). */
9502Online.loginUrl = function ()
9584Online.loginUrl = function ()
9503{
9585{
9504 return 'auth.php';
9586 return 'auth.php?return=online';
9505};
9587};
9506
9588
9507Online.logoutUrl = function ()
9589Online.logoutUrl = function ()
@@ -11795,9 +11877,21 @@ function OfflineBattle (opts)
11795 this.shotLocals = [];
11877 this.shotLocals = [];
11796 this.bots = [];
11878 this.bots = [];
11797 this.playerId = 'player';
11879 this.playerId = 'player';
11880 /** Opponents knocked out over all rounds of this battle (t1198). */
11881 this.defeated = 0;
11798 this._initBots();
11882 this._initBots();
11799}
11883}
11800
11884
11885/** Mark a bot as out once; counts towards `defeated` (t1198). */
11886OfflineBattle.prototype._eliminate = function (bot)
11887{
11888 if (bot.eliminated)
11889 { return; }
11890 bot.eliminated = true;
11891 bot.score = bot.core ? bot.core.score : bot.score;
11892 this.defeated += 1;
11893};
11894
11801OfflineBattle.prototype._initBots = function ()
11895OfflineBattle.prototype._initBots = function ()
11802{
11896{
11803 var P = PlanetMod();
11897 var P = PlanetMod();
@@ -11955,8 +12049,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
11955 { continue; }
12049 { continue; }
11956 if (bot.core.state === 'gameover')
12050 if (bot.core.state === 'gameover')
11957 {
12051 {
11958 bot.eliminated = true;
12052 this._eliminate(bot);
11959 bot.score = bot.core.score;
11960 continue;
12053 continue;
11961 }
12054 }
11962 bot.core.tick(dt);
12055 bot.core.tick(dt);
@@ -11983,10 +12076,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
11983 for (var i = 0; i < this.bots.length; i++)
12076 for (var i = 0; i < this.bots.length; i++)
11984 {
12077 {
11985 if (this.bots[i].core && this.bots[i].core.state === 'gameover')
12078 if (this.bots[i].core && this.bots[i].core.state === 'gameover')
11986 {
12079 { this._eliminate(this.bots[i]); }
11987 this.bots[i].eliminated = true;
11988 this.bots[i].score = this.bots[i].core.score;
11989 }
11990 }
12080 }
11991
12081
11992 if (playerCore && playerCore.state === 'gameover')
12082 if (playerCore && playerCore.state === 'gameover')
@@ -12077,10 +12167,15 @@ if (typeof module !== 'undefined' && module.exports && typeof Offline !== 'undef
12077 * planet arc from the top of the screen into a counter at the bottom
12167 * planet arc from the top of the screen into a counter at the bottom
12078 * centre, one block per newly earned point. Each arrival adds 1.
12168 * centre, one block per newly earned point. Each arrival adds 1.
12079 *
12169 *
12080 * Spawn rate accelerates: rate(t) = RATE0 + ACCEL·t blocks/s, so the
12170 * Spawn rate (t1194): starts at RATE0 = 3 blocks/s and accelerates
12081 * number spawned after t seconds is N(t) = RATE0·t + ACCEL·t²/2, and
12171 * linearly, rate(t) = RATE0 + a·t, with `a` chosen per reward so the last
12082 * block i (0-based) leaves at T(i) = the t where N(t) = i.
12172 * block always leaves at SPAWN_END = 4 s, whatever the point count.
12083 * t1178: RATE0 = 15, ACCEL = 10 → 253 points ≈ 5.8 s, 800 ≈ 11.2 s, 2000 ≈ 18.6 s.
12173 * Blocks spawned after t seconds: N(t) = RATE0·t + a·t²/2; block i
12174 * (0-based) leaves at T(i) = the t where N(t) = i. The last block is
12175 * i = n − 1, so N(4) = n − 1 → a = 2·((n − 1) − RATE0·T) / T².
12176 * If n − 1 ≤ RATE0·T (n ≤ 13) a would be ≤ 0: then a constant rate
12177 * (n − 1) / T is used (a = 0), so it still ends at 4 s (1 point: one
12178 * block at t = 0).
12084 *
12179 *
12085 * The pure timing / sequencing part (Reward.spawnTime, Reward.createSequence)
12180 * The pure timing / sequencing part (Reward.spawnTime, Reward.createSequence)
12086 * has no DOM and is unit-tested. Reward.play wires it to an overlay.
12181 * has no DOM and is unit-tested. Reward.play wires it to an overlay.
@@ -12089,10 +12184,10 @@ if (typeof module !== 'undefined' && module.exports && typeof Offline !== 'undef
12089{
12184{
12090'use strict';
12185'use strict';
12091
12186
12092/** Blocks per second at t = 0 (t1177: 10, t1178: 15). */
12187/** Blocks per second at t = 0 (t1177: 10, t1178: 15, t1194: 3). */
12093var RATE0 = 15;
12188var RATE0 = 3;
12094/** Rate increase in blocks/s per second (t1175: 3, t1177: 5, t1178: 10). */
12189/** Seconds after the first block when the last block leaves (t1194). */
12095var ACCEL = 10;
12190var SPAWN_END = 4;
12096var INTRO = 1.0; // centred title before it rises
12191var INTRO = 1.0; // centred title before it rises
12097var RISE = 0.6; // title tween to the top
12192var RISE = 0.6; // title tween to the top
12098var FLIGHT = 0.7; // one block's arc duration
12193var FLIGHT = 0.7; // one block's arc duration
@@ -12100,14 +12195,28 @@ var HOLD = 1.5; // final total shown before continuing
12100var HOLD_ZERO = 1.5; // earned 0: show the number briefly
12195var HOLD_ZERO = 1.5; // earned 0: show the number briefly
12101var WAIT_MAX = 8; // give up waiting for the server after this
12196var WAIT_MAX = 8; // give up waiting for the server after this
12102
12197
12103/** Seconds after the start of counting when block i (0-based) leaves. */
12198/**
12104function spawnTime (i)
12199 * Spawn parameters for a reward of n blocks (t1194): { r0, a } with
12200 * rate(t) = r0 + a·t and the last block (i = n − 1) leaving at SPAWN_END.
12201 */
12202function spawnParams (n)
12203{
12204 var T = SPAWN_END;
12205 var last = Math.max(0, (n | 0) - 1);
12206 if (last <= RATE0 * T)
12207 { return { r0: last / T, a: 0 }; }
12208 return { r0: RATE0, a: 2 * (last - RATE0 * T) / (T * T) };
12209}
12210
12211/** Seconds after the start of counting when block i (0-based) of n leaves. */
12212function spawnTime (i, n)
12105{
12213{
12106 if (!(i > 0))
12214 if (!(i > 0))
12107 { return 0; }
12215 { return 0; }
12108 if (ACCEL === 0)
12216 var p = spawnParams(n == null ? i + 1 : n);
12109 { return i / RATE0; }
12217 if (p.a === 0)
12110 return (-RATE0 + Math.sqrt(RATE0 * RATE0 + 2 * ACCEL * i)) / ACCEL;
12218 { return p.r0 > 0 ? i / p.r0 : 0; }
12219 return (-p.r0 + Math.sqrt(p.r0 * p.r0 + 2 * p.a * i)) / p.a;
12111}
12220}
12112
12221
12113/** Blocks spawned (left the top) by time t, capped at n. */
12222/** Blocks spawned (left the top) by time t, capped at n. */
@@ -12115,8 +12224,9 @@ function spawnedBy (t, n)
12115{
12224{
12116 if (!(t >= 0) || !(n > 0))
12225 if (!(t >= 0) || !(n > 0))
12117 { return 0; }
12226 { return 0; }
12227 var p = spawnParams(n);
12118 // Block i has left when T(i) <= t, i.e. i <= N(t).
12228 // Block i has left when T(i) <= t, i.e. i <= N(t).
12119 var k = Math.floor(RATE0 * t + ACCEL * t * t / 2 + 1e-9) + 1;
12229 var k = Math.floor(p.r0 * t + p.a * t * t / 2 + 1e-9) + 1;
12120 return Math.min(n, Math.max(0, k));
12230 return Math.min(n, Math.max(0, k));
12121}
12231}
12122
12232
@@ -12133,7 +12243,7 @@ function countDuration (n, flight)
12133 flight = flight == null ? FLIGHT : flight;
12243 flight = flight == null ? FLIGHT : flight;
12134 if (!(n > 0))
12244 if (!(n > 0))
12135 { return 0; }
12245 { return 0; }
12136 return spawnTime(n - 1) + flight;
12246 return spawnTime(n - 1, n) + flight;
12137}
12247}
12138
12248
12139/**
12249/**
@@ -12365,8 +12475,9 @@ function play (opts)
12365 var W = 0;
12475 var W = 0;
12366 var H = 0;
12476 var H = 0;
12367
12477
12368 title.textContent = opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...');
12478 // t1193: quitting via the in-game menu shows a neutral title.
12369 title.className = 'reward-title' + (opts.won ? ' won' : ' lost');
12479 title.textContent = opts.title ? String(opts.title) : (opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...'));
12480 title.className = 'reward-title' + (opts.title ? ' ended' : (opts.won ? ' won' : ' lost'));
12370 if (label)
12481 if (label)
12371 { label.textContent = tr('reward.total', 'Total points'); }
12482 { label.textContent = tr('reward.total', 'Total points'); }
12372 counter.textContent = '';
12483 counter.textContent = '';
@@ -12552,7 +12663,8 @@ function play (opts)
12552
12663
12553var Reward = {
12664var Reward = {
12554 RATE0: RATE0,
12665 RATE0: RATE0,
12555 ACCEL: ACCEL,
12666 SPAWN_END: SPAWN_END,
12667 spawnParams: spawnParams,
12556 INTRO: INTRO,
12668 INTRO: INTRO,
12557 RISE: RISE,
12669 RISE: RISE,
12558 FLIGHT: FLIGHT,
12670 FLIGHT: FLIGHT,
@@ -13236,6 +13348,7 @@ window.onload = function ()
13236 app.debugPhysics = isPhysicsDebugEnabled();
13348 app.debugPhysics = isPhysicsDebugEnabled();
13237 var play = document.getElementById('btn-play');
13349 var play = document.getElementById('btn-play');
13238 play.addEventListener('click', onPlay);
13350 play.addEventListener('click', onPlay);
13351 bindGameMenu();
13239 play.addEventListener('pointerup', function (e)
13352 play.addEventListener('pointerup', function (e)
13240 {
13353 {
13241 // A touch-friendly path: some mobile browsers swallow the click
13354 // A touch-friendly path: some mobile browsers swallow the click
@@ -13366,6 +13479,7 @@ function startPlay (opts)
13366 { bindPointer(app.scene.canvas); }
13479 { bindPointer(app.scene.canvas); }
13367 refreshHud();
13480 refreshHud();
13368 showEl('hud');
13481 showEl('hud');
13482 setGameMenuButton(!app.online && !app.spectating);
13369 }
13483 }
13370 catch (err)
13484 catch (err)
13371 {
13485 {
@@ -13465,6 +13579,10 @@ function teardownPlay ()
13465 app.columnWarn = [];
13579 app.columnWarn = [];
13466 app.pointerId = null;
13580 app.pointerId = null;
13467 app.gameOverShown = false;
13581 app.gameOverShown = false;
13582 app.paused = false;
13583 app.quitting = false;
13584 hideEl('game-menu');
13585 setGameMenuButton(false);
13468 hideEl('hud');
13586 hideEl('hud');
13469 hideEl('game-over');
13587 hideEl('game-over');
13470 hideEl('spectator');
13588 hideEl('spectator');
@@ -14032,6 +14150,14 @@ function tickView (dt)
14032 placeTile(app.cells[i], col, row);
14150 placeTile(app.cells[i], col, row);
14033 }
14151 }
14034
14152
14153 // t1193: in-game menu open (Spelen / Offline Strijd) or quitting:
14154 // the field, bots and timers stand still; only the view is kept.
14155 if (app.paused)
14156 {
14157 syncSprites(0);
14158 return;
14159 }
14160
14035 app.core.tick(dt);
14161 app.core.tick(dt);
14036 if (app.offline && app.battle)
14162 if (app.offline && app.battle)
14037 { tickOffline(dt); }
14163 { tickOffline(dt); }
@@ -14233,7 +14359,16 @@ function fieldFromEvent (e)
14233
14359
14234function playingForDrag ()
14360function playingForDrag ()
14235{
14361{
14236 return app.core && app.core.state === 'playing';
14362 return app.core && app.core.state === 'playing' && !app.paused;
14363}
14364
14365/** Touches on HUD buttons / menus are UI taps, not field drags (t1193). */
14366function isUiTouchTarget (e)
14367{
14368 var el = e && e.target;
14369 if (!el || !el.closest)
14370 { return false; }
14371 return !!el.closest('button, a, input, select, #game-menu, #reward');
14237}
14372}
14238
14373
14239function startDragFromEvent (e)
14374function startDragFromEvent (e)
@@ -14383,6 +14518,8 @@ function onTouchStart (e)
14383{
14518{
14384 if (!playingForDrag())
14519 if (!playingForDrag())
14385 { return; }
14520 { return; }
14521 if (app.activeTouchId == null && isUiTouchTarget(e))
14522 { return; }
14386 if (app.activeTouchId != null)
14523 if (app.activeTouchId != null)
14387 {
14524 {
14388 if (e.preventDefault)
14525 if (e.preventDefault)
@@ -14708,31 +14845,20 @@ function showOfflineResult ()
14708 app.offlineResultShown = true;
14845 app.offlineResultShown = true;
14709 var battle = app.battle;
14846 var battle = app.battle;
14710 var reached = document.getElementById('offline-reached');
14847 var reached = document.getElementById('offline-reached');
14711 var sch = battle.schedule;
14712 var n = sch.opponents;
14713 var skill = Math.round(sch.skill * 100);
14714 var line = document.getElementById('offline-reached-line');
14848 var line = document.getElementById('offline-reached-line');
14715 if (line && typeof I18n !== 'undefined')
14849 if (line && typeof I18n !== 'undefined')
14716 { line.textContent = I18n.t('offline.reached', { n: battle.round }); }
14850 { line.textContent = I18n.t('offline.reached', { n: battle.round }); }
14717 else if (reached)
14851 else if (reached)
14718 { reached.textContent = String(battle.round); }
14852 { reached.textContent = String(battle.round); }
14853 // t1198: "X opponents defeated" over all rounds (replaces the
14854 // opponents / skill line).
14719 var detail = document.getElementById('offline-result-detail');
14855 var detail = document.getElementById('offline-result-detail');
14720 if (detail)
14856 if (detail)
14721 {
14857 {
14722 if (typeof I18n !== 'undefined')
14858 var beaten = battle.defeated || 0;
14723 {
14859 detail.textContent = (typeof I18n !== 'undefined')
14724 detail.textContent = I18n.t('offline.detail', {
14860 ? I18n.plural('offline.defeated', beaten, { n: beaten })
14725 n: n,
14861 : beaten + (beaten === 1 ? ' opponent defeated' : ' opponents defeated');
14726 opponents: I18n.plural('hud.opponent', n),
14727 skill: skill
14728 });
14729 }
14730 else
14731 {
14732 var noun = n === 1 ? 'opponent' : 'opponents';
14733 detail.textContent = 'You played against ' + n + ' ' + noun
14734 + ' at skill ' + skill + '%.';
14735 }
14736 }
14862 }
14737 hideEl('game-over');
14863 hideEl('game-over');
14738 showEl('offline-result');
14864 showEl('offline-result');
@@ -14750,34 +14876,11 @@ function refreshOfflineHud ()
14750 return;
14876 return;
14751 }
14877 }
14752 el.hidden = false;
14878 el.hidden = false;
14879 // t1195: the Offline Strijd HUD shows only "Round N".
14753 var sch = app.battle.schedule;
14880 var sch = app.battle.schedule;
14754 var n = sch.opponents;
14755 var r = document.getElementById('offline-round');
14881 var r = document.getElementById('offline-round');
14756 var o = document.getElementById('offline-opponents');
14882 if (r)
14757 var s = document.getElementById('offline-skill');
14883 { r.textContent = (typeof I18n !== 'undefined') ? I18n.t('hud.round', { n: sch.round }) : 'Round ' + sch.round; }
14758 if (typeof I18n !== 'undefined')
14759 {
14760 if (r)
14761 { r.textContent = I18n.t('hud.round', { n: sch.round }); }
14762 if (o)
14763 {
14764 o.textContent = I18n.t('hud.opponentsLine', {
14765 n: n, word: I18n.plural('hud.opponent', n)
14766 });
14767 }
14768 if (s)
14769 { s.textContent = I18n.t('hud.skill', { n: Math.round(sch.skill * 100) }); }
14770 }
14771 else
14772 {
14773 var noun = n === 1 ? 'opponent' : 'opponents';
14774 if (r)
14775 { r.textContent = 'Round ' + sch.round; }
14776 if (o)
14777 { o.textContent = n + ' ' + noun; }
14778 if (s)
14779 { s.textContent = 'Skill ' + Math.round(sch.skill * 100) + '%'; }
14780 }
14781}
14884}
14782
14885
14783function hideOfflineHud ()
14886function hideOfflineHud ()
@@ -14795,14 +14898,16 @@ function refreshChainIndicator ()
14795 var info = app.core && app.core.lastChainIndicator;
14898 var info = app.core && app.core.lastChainIndicator;
14796 var active = app.core && app.core.hasActiveLandingChain
14899 var active = app.core && app.core.hasActiveLandingChain
14797 && app.core.hasActiveLandingChain();
14900 && app.core.hasActiveLandingChain();
14798 // Show only while a chained cluster is still in the air.
14901 var comboOn = app.core && app.core.combo > 0;
14799 if (!info || info.chain < 1 || app.mode !== 'playing' || !active)
14902 // t1197: just "+x%" (landing chain + combo bonus of the last launch),
14903 // while a boosted cluster flies or the combo is still alive.
14904 if (!info || !(info.bonusPct > 0) || app.mode !== 'playing' || !(active || comboOn))
14800 {
14905 {
14801 el.hidden = true;
14906 el.hidden = true;
14802 return;
14907 return;
14803 }
14908 }
14804 el.hidden = false;
14909 el.hidden = false;
14805 el.textContent = 'x' + info.chain + ' +' + info.bonusPct + '%';
14910 el.textContent = '+' + info.bonusPct + '%';
14806}
14911}
14807
14912
14808function hideChainIndicator ()
14913function hideChainIndicator ()
@@ -15281,7 +15386,17 @@ function bindOnlineUi ()
15281
15386
15282 var params = new URLSearchParams(window.location.search);
15387 var params = new URLSearchParams(window.location.search);
15283 if (params.get('online') === '1' || params.get('auth') === 'unconfigured')
15388 if (params.get('online') === '1' || params.get('auth') === 'unconfigured')
15284 { openOnlinePanel(); }
15389 {
15390 openOnlinePanel();
15391 // t1193: one-shot; a reload must not jump to online play again.
15392 try
15393 {
15394 params.delete('online');
15395 var rest = params.toString();
15396 window.history.replaceState(null, '', window.location.pathname + (rest ? '?' + rest : '') + window.location.hash);
15397 }
15398 catch (e) { /* ignore */ }
15399 }
15285}
15400}
15286
15401
15287function openOnlinePanel ()
15402function openOnlinePanel ()
@@ -15447,13 +15562,32 @@ function selectedPlanetId ()
15447 return 'terra';
15562 return 'terra';
15448}
15563}
15449
15564
15565/**
15566 * Pre-select the last chosen planet (t1196): logged in the profile value
15567 * (server), otherwise / as fallback localStorage, otherwise Terra. A
15568 * deleted custom planet falls back to the default (setSelectedPlanet).
15569 */
15450function restoreSelectedPlanet ()
15570function restoreSelectedPlanet ()
15451{
15571{
15452 var id = 'terra';
15572 var id = null;
15453 try
15573 if (typeof Online !== 'undefined' && Online.me && Online.lastPlanet)
15454 { id = localStorage.getItem('meteors-planet') || 'terra'; }
15574 { id = Online.lastPlanet; }
15455 catch (e) {}
15575 if (!id)
15456 setSelectedPlanet(id, true);
15576 {
15577 try
15578 { id = localStorage.getItem('meteors-planet'); }
15579 catch (e) {}
15580 }
15581 setSelectedPlanet(id || 'terra', true);
15582}
15583
15584function rememberPlanetChoice (id)
15585{
15586 if (typeof Online === 'undefined' || !Online.me || !Online.setLastPlanet)
15587 { return; }
15588 if (Online.lastPlanet === id)
15589 { return; }
15590 Promise.resolve(Online.setLastPlanet(id)).then(null, function () {});
15457}
15591}
15458
15592
15459function setSelectedPlanet (id, silent)
15593function setSelectedPlanet (id, silent)
@@ -15473,6 +15607,7 @@ function setSelectedPlanet (id, silent)
15473 catch (e) {}
15607 catch (e) {}
15474 if (!silent)
15608 if (!silent)
15475 {
15609 {
15610 rememberPlanetChoice(found.id);
15476 var grid = document.getElementById('planet-grid');
15611 var grid = document.getElementById('planet-grid');
15477 if (grid && !grid.hidden && grid.children.length)
15612 if (grid && !grid.hidden && grid.children.length)
15478 { renderPlanetGrid('planet-grid', false); }
15613 { renderPlanetGrid('planet-grid', false); }
@@ -15633,6 +15768,102 @@ function refreshMenuAccount ()
15633 { localLogin.hidden = !(typeof Online !== 'undefined' && Online.local); }
15768 { localLogin.hidden = !(typeof Online !== 'undefined' && Online.local); }
15634}
15769}
15635
15770
15771/* ---------- t1193 in-game menu (Spelen / Offline Strijd) ----------- */
15772
15773function setGameMenuButton (show)
15774{
15775 var btn = document.getElementById('btn-game-menu');
15776 if (btn)
15777 { btn.hidden = !show; }
15778}
15779
15780/** The menu can open during a running solo / offline field only. */
15781function canOpenGameMenu ()
15782{
15783 return app.mode === 'playing' && !!app.core && !app.online && !app.spectating
15784 && app.core.state === 'playing' && !app.rewardActive && !app.quitting
15785 && !(app.offline && app.battle && app.battle.state !== 'playing');
15786}
15787
15788function openGameMenu ()
15789{
15790 if (!canOpenGameMenu())
15791 { return false; }
15792 if (app.core.drag)
15793 { finishDrag({ noLaunch: true }); }
15794 app.paused = true;
15795 showEl('game-menu');
15796 var resume = document.getElementById('btn-game-resume');
15797 if (resume && resume.focus)
15798 { resume.focus(); }
15799 return true;
15800}
15801
15802function resumeFromGameMenu ()
15803{
15804 hideEl('game-menu');
15805 if (!app.quitting)
15806 { app.paused = false; }
15807}
15808
15809/**
15810 * "Back to main menu": ends the match now. Logged in, the points so far
15811 * go through the normal play_finish + reward screen first (the server
15812 * still applies its caps); logged out, straight to the menu. Offline
15813 * Strijd ends the whole battle (no next round).
15814 */
15815function quitToMainMenu ()
15816{
15817 if (!app.core || app.quitting)
15818 { return; }
15819 hideEl('game-menu');
15820 app.paused = true;
15821 app.quitting = true;
15822 app.gameOverShown = true;
15823 app.lastScore = app.core.score || 0;
15824 setGameMenuButton(false);
15825 var score = app.lastScore;
15826 var done = function ()
15827 {
15828 app.quitting = false;
15829 app.paused = false;
15830 returnToMenu();
15831 };
15832 if (rewardEnabled())
15833 {
15834 var title = (typeof I18n !== 'undefined') ? I18n.t('reward.ended') : 'Game ended';
15835 showReward(false, finishPlaySession(score), done, title);
15836 }
15837 else
15838 {
15839 finishPlaySession(score);
15840 done();
15841 }
15842}
15843
15844function bindGameMenu ()
15845{
15846 var btn = document.getElementById('btn-game-menu');
15847 if (btn)
15848 { btn.addEventListener('click', function () { openGameMenu(); }); }
15849 var resume = document.getElementById('btn-game-resume');
15850 if (resume)
15851 { resume.addEventListener('click', resumeFromGameMenu); }
15852 var quit = document.getElementById('btn-game-quit');
15853 if (quit)
15854 { quit.addEventListener('click', quitToMainMenu); }
15855 document.addEventListener('keydown', function (e)
15856 {
15857 if (e.key !== 'Escape')
15858 { return; }
15859 var menu = document.getElementById('game-menu');
15860 if (menu && !menu.hidden)
15861 { resumeFromGameMenu(); }
15862 else
15863 { openGameMenu(); }
15864 });
15865}
15866
15636function beginPlaySession (mode)
15867function beginPlaySession (mode)
15637{
15868{
15638 if (app.playToken)
15869 if (app.playToken)
@@ -15688,7 +15919,7 @@ function rewardEnabled ()
15688 * next() — the same destination the mode used before (menu, next
15919 * next() — the same destination the mode used before (menu, next
15689 * offline round, offline result, or the online lobby/podium).
15920 * offline round, offline result, or the online lobby/podium).
15690 */
15921 */
15691function showReward (won, resultPromise, next)
15922function showReward (won, resultPromise, next, title)
15692{
15923{
15693 app.rewardActive = true;
15924 app.rewardActive = true;
15694 hideEl('game-over');
15925 hideEl('game-over');
@@ -15696,6 +15927,7 @@ function showReward (won, resultPromise, next)
15696 hideEl('podium');
15927 hideEl('podium');
15697 var handle = Reward.play({
15928 var handle = Reward.play({
15698 won: won,
15929 won: won,
15930 title: title || null,
15699 planet: app.planet,
15931 planet: app.planet,
15700 result: resultPromise,
15932 result: resultPromise,
15701 onDone: function ()
15933 onDone: function ()
@@ -15706,7 +15938,12 @@ function showReward (won, resultPromise, next)
15706 }
15938 }
15707 });
15939 });
15708 if (!handle)
15940 if (!handle)
15709 { app.rewardActive = false; }
15941 {
15942 app.rewardActive = false;
15943 // No reward overlay (e.g. missing DOM): still continue (t1193).
15944 if (title && next)
15945 { next(); }
15946 }
15710}
15947}
15711
15948
15712function myOnlinePlace (lobby)
15949function myOnlinePlace (lobby)
build/index.html +18 −13
@@ -17,7 +17,6 @@
17 17
18 18 <div id="menu" class="screen">
19 19 <h1>Meteors</h1>
20 <p class="tagline" data-i18n="menu.tagline">Three in a row, and your blocks get rocket boosters.</p>
21 20 <button type="button" id="btn-play" data-i18n="menu.play">Play</button>
22 21 <button type="button" id="btn-offline" class="btn-secondary" data-i18n="menu.offline">Offline Battle</button>
23 22 <button type="button" id="btn-online" class="btn-secondary" data-i18n="menu.online">Play online</button>
@@ -50,7 +49,6 @@
50 49
51 50 <div id="planet-select" class="screen" hidden>
52 51 <h1 data-i18n="planet.title">Choose a field</h1>
53 <p class="tagline" data-i18n="planet.tagline">Each field is a planet, with its own people, gravity, air and mass.</p>
54 52 <div id="planet-grid" class="planet-grid" role="list"></div>
55 53 <div class="planet-actions">
56 54 <button type="button" id="btn-planet-go" data-i18n="menu.play">Play</button>
@@ -71,12 +69,12 @@
71 69
72 70 <div id="online-login" hidden>
73 71 <p data-i18n="online.loginPrompt">To play online, log in with your account on auth.timfalken.com.</p>
74 <a id="btn-login" class="button" href="auth.php" data-i18n="menu.login">Log in</a>
72 <a id="btn-login" class="button" href="auth.php?return=online" data-i18n="menu.login">Log in</a>
75 73 <button type="button" class="btn-secondary" data-back-menu data-i18n="planet.back">Back</button>
76 74 <p id="local-login" class="hint" hidden>
77 75 <span data-i18n="online.localTest">Local test:</span>
78 <a href="auth.php?test=1">test_user_1</a> ·
79 <a href="auth.php?test=2">test_user_2</a>
76 <a href="auth.php?test=1&amp;next=index.html%3Fonline%3D1">test_user_1</a> ·
77 <a href="auth.php?test=2&amp;next=index.html%3Fonline%3D1">test_user_2</a>
80 78 </p>
81 79 </div>
82 80
@@ -110,7 +108,7 @@
110 108
111 109 <div id="designer" class="screen" hidden>
112 110 <h1 data-i18n="designer.title">Planet Designer</h1>
113 <p class="tagline"><span data-i18n="designer.taglineBefore">Total:</span> <strong id="designer-points">0</strong> <span data-i18n="designer.taglineAfter">points. You unlock blocks by earning points — you do not spend them.</span></p>
111 <p class="tagline"><span data-i18n="designer.taglineBefore">Total:</span> <strong id="designer-points">0</strong> <span data-i18n="designer.taglineAfter">points.</span></p>
114 112 <div id="designer-list" class="planet-grid" role="list"></div>
115 113 <div class="planet-actions">
116 114 <button type="button" id="btn-designer-new" data-i18n="designer.new">New planet</button>
@@ -172,20 +170,27 @@
172 170 <div class="hud-label" data-i18n="hud.points">Points</div>
173 171 <div id="score">0</div>
174 172 </div>
175 <div class="hud-right">
176 <div id="planet-name">Terra</div>
177 <div id="planet-stats"></div>
173 <div class="hud-right-wrap">
174 <div class="hud-right">
175 <div id="planet-name">Terra</div>
176 <div id="planet-stats"></div>
177 </div>
178 <button type="button" id="btn-game-menu" class="btn-game-menu" hidden aria-haspopup="dialog" aria-controls="game-menu" data-i18n-aria="game.menu" aria-label="Menu" title="Menu"><span aria-hidden="true">&#9776;</span></button>
178 179 </div>
179 180 <div id="offline-hud" class="hud-offline" hidden>
180 181 <span id="offline-round">Round 1</span>
181 <span class="hud-sep">·</span>
182 <span id="offline-opponents">1 opponent</span>
183 <span class="hud-sep">·</span>
184 <span id="offline-skill">Skill 5%</span>
185 182 </div>
186 183 <div id="chain-indicator" hidden></div>
187 184 </div>
188 185
186 <div id="game-menu" class="screen overlay" role="dialog" aria-modal="true" aria-labelledby="game-menu-title" hidden>
187 <h2 id="game-menu-title" data-i18n="game.paused">Paused</h2>
188 <div class="game-menu-buttons">
189 <button type="button" id="btn-game-resume" class="btn-secondary btn-primary-ish" data-i18n="game.resume">Resume</button>
190 <button type="button" id="btn-game-quit" class="btn-secondary" data-i18n="game.backToMenu">Back to main menu</button>
191 </div>
192 </div>
193
189 194 <div id="offline-result" class="screen overlay" hidden>
190 195 <h2 data-i18n="offline.resultTitle">Offline Battle</h2>
191 196 <p id="offline-reached-line">You reached round <strong id="offline-reached">1</strong>.</p>
@@ -17,7 +17,6 @@
17
17
18 <div id="menu" class="screen">
18 <div id="menu" class="screen">
19 <h1>Meteors</h1>
19 <h1>Meteors</h1>
20 <p class="tagline" data-i18n="menu.tagline">Three in a row, and your blocks get rocket boosters.</p>
21 <button type="button" id="btn-play" data-i18n="menu.play">Play</button>
20 <button type="button" id="btn-play" data-i18n="menu.play">Play</button>
22 <button type="button" id="btn-offline" class="btn-secondary" data-i18n="menu.offline">Offline Battle</button>
21 <button type="button" id="btn-offline" class="btn-secondary" data-i18n="menu.offline">Offline Battle</button>
23 <button type="button" id="btn-online" class="btn-secondary" data-i18n="menu.online">Play online</button>
22 <button type="button" id="btn-online" class="btn-secondary" data-i18n="menu.online">Play online</button>
@@ -50,7 +49,6 @@
50
49
51 <div id="planet-select" class="screen" hidden>
50 <div id="planet-select" class="screen" hidden>
52 <h1 data-i18n="planet.title">Choose a field</h1>
51 <h1 data-i18n="planet.title">Choose a field</h1>
53 <p class="tagline" data-i18n="planet.tagline">Each field is a planet, with its own people, gravity, air and mass.</p>
54 <div id="planet-grid" class="planet-grid" role="list"></div>
52 <div id="planet-grid" class="planet-grid" role="list"></div>
55 <div class="planet-actions">
53 <div class="planet-actions">
56 <button type="button" id="btn-planet-go" data-i18n="menu.play">Play</button>
54 <button type="button" id="btn-planet-go" data-i18n="menu.play">Play</button>
@@ -71,12 +69,12 @@
71
69
72 <div id="online-login" hidden>
70 <div id="online-login" hidden>
73 <p data-i18n="online.loginPrompt">To play online, log in with your account on auth.timfalken.com.</p>
71 <p data-i18n="online.loginPrompt">To play online, log in with your account on auth.timfalken.com.</p>
74 <a id="btn-login" class="button" href="auth.php" data-i18n="menu.login">Log in</a>
72 <a id="btn-login" class="button" href="auth.php?return=online" data-i18n="menu.login">Log in</a>
75 <button type="button" class="btn-secondary" data-back-menu data-i18n="planet.back">Back</button>
73 <button type="button" class="btn-secondary" data-back-menu data-i18n="planet.back">Back</button>
76 <p id="local-login" class="hint" hidden>
74 <p id="local-login" class="hint" hidden>
77 <span data-i18n="online.localTest">Local test:</span>
75 <span data-i18n="online.localTest">Local test:</span>
78 <a href="auth.php?test=1">test_user_1</a> ·
76 <a href="auth.php?test=1&amp;next=index.html%3Fonline%3D1">test_user_1</a> ·
79 <a href="auth.php?test=2">test_user_2</a>
77 <a href="auth.php?test=2&amp;next=index.html%3Fonline%3D1">test_user_2</a>
80 </p>
78 </p>
81 </div>
79 </div>
82
80
@@ -110,7 +108,7 @@
110
108
111 <div id="designer" class="screen" hidden>
109 <div id="designer" class="screen" hidden>
112 <h1 data-i18n="designer.title">Planet Designer</h1>
110 <h1 data-i18n="designer.title">Planet Designer</h1>
113 <p class="tagline"><span data-i18n="designer.taglineBefore">Total:</span> <strong id="designer-points">0</strong> <span data-i18n="designer.taglineAfter">points. You unlock blocks by earning points — you do not spend them.</span></p>
111 <p class="tagline"><span data-i18n="designer.taglineBefore">Total:</span> <strong id="designer-points">0</strong> <span data-i18n="designer.taglineAfter">points.</span></p>
114 <div id="designer-list" class="planet-grid" role="list"></div>
112 <div id="designer-list" class="planet-grid" role="list"></div>
115 <div class="planet-actions">
113 <div class="planet-actions">
116 <button type="button" id="btn-designer-new" data-i18n="designer.new">New planet</button>
114 <button type="button" id="btn-designer-new" data-i18n="designer.new">New planet</button>
@@ -172,20 +170,27 @@
172 <div class="hud-label" data-i18n="hud.points">Points</div>
170 <div class="hud-label" data-i18n="hud.points">Points</div>
173 <div id="score">0</div>
171 <div id="score">0</div>
174 </div>
172 </div>
175 <div class="hud-right">
173 <div class="hud-right-wrap">
176 <div id="planet-name">Terra</div>
174 <div class="hud-right">
177 <div id="planet-stats"></div>
175 <div id="planet-name">Terra</div>
176 <div id="planet-stats"></div>
177 </div>
178 <button type="button" id="btn-game-menu" class="btn-game-menu" hidden aria-haspopup="dialog" aria-controls="game-menu" data-i18n-aria="game.menu" aria-label="Menu" title="Menu"><span aria-hidden="true">&#9776;</span></button>
178 </div>
179 </div>
179 <div id="offline-hud" class="hud-offline" hidden>
180 <div id="offline-hud" class="hud-offline" hidden>
180 <span id="offline-round">Round 1</span>
181 <span id="offline-round">Round 1</span>
181 <span class="hud-sep">·</span>
182 <span id="offline-opponents">1 opponent</span>
183 <span class="hud-sep">·</span>
184 <span id="offline-skill">Skill 5%</span>
185 </div>
182 </div>
186 <div id="chain-indicator" hidden></div>
183 <div id="chain-indicator" hidden></div>
187 </div>
184 </div>
188
185
186 <div id="game-menu" class="screen overlay" role="dialog" aria-modal="true" aria-labelledby="game-menu-title" hidden>
187 <h2 id="game-menu-title" data-i18n="game.paused">Paused</h2>
188 <div class="game-menu-buttons">
189 <button type="button" id="btn-game-resume" class="btn-secondary btn-primary-ish" data-i18n="game.resume">Resume</button>
190 <button type="button" id="btn-game-quit" class="btn-secondary" data-i18n="game.backToMenu">Back to main menu</button>
191 </div>
192 </div>
193
189 <div id="offline-result" class="screen overlay" hidden>
194 <div id="offline-result" class="screen overlay" hidden>
190 <h2 data-i18n="offline.resultTitle">Offline Battle</h2>
195 <h2 data-i18n="offline.resultTitle">Offline Battle</h2>
191 <p id="offline-reached-line">You reached round <strong id="offline-reached">1</strong>.</p>
196 <p id="offline-reached-line">You reached round <strong id="offline-reached">1</strong>.</p>
build/style.css +62 −5
@@ -46,7 +46,7 @@ html, body {
46 46 text-align: center;
47 47 }
48 48
49 .screen[hidden], #hud[hidden], #game-over[hidden], #online-panel[hidden], #minis[hidden], #spectator[hidden], #podium[hidden], #flights[hidden], #flights-back[hidden], #planet-select[hidden], #offline-result[hidden], #offline-hud[hidden], #chain-indicator[hidden], #designer[hidden], #designer-edit[hidden], #reward[hidden] { display: none !important; }
49 .screen[hidden], #hud[hidden], #game-over[hidden], #online-panel[hidden], #minis[hidden], #spectator[hidden], #podium[hidden], #flights[hidden], #flights-back[hidden], #planet-select[hidden], #offline-result[hidden], #game-menu[hidden], #btn-game-menu[hidden], #offline-hud[hidden], #chain-indicator[hidden], #designer[hidden], #designer-edit[hidden], #reward[hidden] { display: none !important; }
50 50
51 51 h1 {
52 52 font-size: clamp(48px, 14vw, 96px);
@@ -608,10 +608,15 @@ a.button:is(:hover, :focus-visible) {
608 608 transform: translateX(-50%);
609 609 top: 100%;
610 610 margin-top: 4px;
611 color: #ffe27a;
612 font-weight: 700;
613 font-size: 14px;
614 text-shadow: 0 1px 4px #000;
611 /* t1197: plain "+x%", yellow with an orange stroke. */
612 color: #ffe600;
613 font-weight: 900;
614 font-size: 20px;
615 line-height: 1;
616 -webkit-text-stroke: 3px #ff7a00;
617 paint-order: stroke fill;
618 text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
619 white-space: nowrap;
615 620 pointer-events: none;
616 621 z-index: 5;
617 622 }
@@ -1063,3 +1068,55 @@ html[lang="ja"], html[lang="zh-Hans"], html[lang="ko"] {
1063 1068 color: #8f96b2;
1064 1069 z-index: 3;
1065 1070 }
1071
1072 /* —— t1193 in-game menu (Spelen / Offline Strijd) —— */
1073 .hud-right-wrap {
1074 display: flex;
1075 align-items: flex-start;
1076 gap: 10px;
1077 min-width: 0;
1078 }
1079 .btn-game-menu {
1080 pointer-events: auto;
1081 flex: 0 0 auto;
1082 width: 40px;
1083 height: 40px;
1084 padding: 0;
1085 border: 1px solid #6a7394;
1086 border-radius: 10px;
1087 background: rgba(27, 32, 56, 0.85);
1088 color: #e8eaf2;
1089 font-size: 20px;
1090 line-height: 38px;
1091 cursor: pointer;
1092 touch-action: manipulation;
1093 -webkit-tap-highlight-color: transparent;
1094 }
1095 .btn-game-menu:is(:hover, :focus-visible) {
1096 border-color: #ffe27a;
1097 color: #fff6c8;
1098 }
1099 #game-menu {
1100 z-index: 60;
1101 }
1102 #game-menu h2 {
1103 color: #ffe27a;
1104 }
1105 .game-menu-buttons {
1106 display: flex;
1107 flex-direction: column;
1108 align-items: center;
1109 gap: 4px;
1110 margin-top: 8px;
1111 }
1112 .game-menu-buttons .btn-secondary {
1113 min-width: min(80vw, 300px);
1114 }
1115 .btn-primary-ish {
1116 border-color: #ffe27a !important;
1117 color: #fff6c8 !important;
1118 }
1119 @media (max-width: 520px) {
1120 .hud-right-wrap { gap: 6px; }
1121 .btn-game-menu { width: 36px; height: 36px; line-height: 34px; font-size: 18px; }
1122 }
@@ -46,7 +46,7 @@ html, body {
46 text-align: center;
46 text-align: center;
47}
47}
48
48
49.screen[hidden], #hud[hidden], #game-over[hidden], #online-panel[hidden], #minis[hidden], #spectator[hidden], #podium[hidden], #flights[hidden], #flights-back[hidden], #planet-select[hidden], #offline-result[hidden], #offline-hud[hidden], #chain-indicator[hidden], #designer[hidden], #designer-edit[hidden], #reward[hidden] { display: none !important; }
49.screen[hidden], #hud[hidden], #game-over[hidden], #online-panel[hidden], #minis[hidden], #spectator[hidden], #podium[hidden], #flights[hidden], #flights-back[hidden], #planet-select[hidden], #offline-result[hidden], #game-menu[hidden], #btn-game-menu[hidden], #offline-hud[hidden], #chain-indicator[hidden], #designer[hidden], #designer-edit[hidden], #reward[hidden] { display: none !important; }
50
50
51h1 {
51h1 {
52 font-size: clamp(48px, 14vw, 96px);
52 font-size: clamp(48px, 14vw, 96px);
@@ -608,10 +608,15 @@ a.button:is(:hover, :focus-visible) {
608 transform: translateX(-50%);
608 transform: translateX(-50%);
609 top: 100%;
609 top: 100%;
610 margin-top: 4px;
610 margin-top: 4px;
611 color: #ffe27a;
611 /* t1197: plain "+x%", yellow with an orange stroke. */
612 font-weight: 700;
612 color: #ffe600;
613 font-size: 14px;
613 font-weight: 900;
614 text-shadow: 0 1px 4px #000;
614 font-size: 20px;
615 line-height: 1;
616 -webkit-text-stroke: 3px #ff7a00;
617 paint-order: stroke fill;
618 text-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
619 white-space: nowrap;
615 pointer-events: none;
620 pointer-events: none;
616 z-index: 5;
621 z-index: 5;
617}
622}
@@ -1063,3 +1068,55 @@ html[lang="ja"], html[lang="zh-Hans"], html[lang="ko"] {
1063 color: #8f96b2;
1068 color: #8f96b2;
1064 z-index: 3;
1069 z-index: 3;
1065}
1070}
1071
1072/* —— t1193 in-game menu (Spelen / Offline Strijd) —— */
1073.hud-right-wrap {
1074 display: flex;
1075 align-items: flex-start;
1076 gap: 10px;
1077 min-width: 0;
1078}
1079.btn-game-menu {
1080 pointer-events: auto;
1081 flex: 0 0 auto;
1082 width: 40px;
1083 height: 40px;
1084 padding: 0;
1085 border: 1px solid #6a7394;
1086 border-radius: 10px;
1087 background: rgba(27, 32, 56, 0.85);
1088 color: #e8eaf2;
1089 font-size: 20px;
1090 line-height: 38px;
1091 cursor: pointer;
1092 touch-action: manipulation;
1093 -webkit-tap-highlight-color: transparent;
1094}
1095.btn-game-menu:is(:hover, :focus-visible) {
1096 border-color: #ffe27a;
1097 color: #fff6c8;
1098}
1099#game-menu {
1100 z-index: 60;
1101}
1102#game-menu h2 {
1103 color: #ffe27a;
1104}
1105.game-menu-buttons {
1106 display: flex;
1107 flex-direction: column;
1108 align-items: center;
1109 gap: 4px;
1110 margin-top: 8px;
1111}
1112.game-menu-buttons .btn-secondary {
1113 min-width: min(80vw, 300px);
1114}
1115.btn-primary-ish {
1116 border-color: #ffe27a !important;
1117 color: #fff6c8 !important;
1118}
1119@media (max-width: 520px) {
1120 .hud-right-wrap { gap: 6px; }
1121 .btn-game-menu { width: 36px; height: 36px; line-height: 34px; font-size: 18px; }
1122}
docs/ASSUMPTIONS.md +84 −0
@@ -1155,3 +1155,87 @@ Tests: `test/garbage-queue.test.js` (o.a. exact scenario: 5 tegelijk, 2
1155 1155 open kolommen → alle 5 landen; ook via offline bots);
1156 1156 `test/t1192-garbage-queue-playwright.py ROOT TAG` (twee browsers lokaal).
1157 1157
1158
1159 ## t1193 — Menu tijdens het spel en login-redirect
1160
1161 **Login-redirect (oorzaak).** `callback.php` stuurde na elke geslaagde
1162 login hard naar `index.html?online=1`, en `main.js` opende bij
1163 `?online=1` altijd het online-paneel. Daardoor belandde je ook na
1164 inloggen vanaf het hoofdmenu in online spelen. **Oplossing:** `auth.php`
1165 onthoudt `?return=` (alleen de whitelist-waarde `online`, via
1166 `loginReturnTarget`) in de sessie; `callback.php` stuurt alleen dan naar
1167 `index.html?online=1`, anders naar `index.html` (hoofdmenu, ingelogd).
1168 De inlogknop in het online-paneel gebruikt `auth.php?return=online`,
1169 de menuknop gewoon `auth.php`. `main.js` haalt `?online=1` na gebruik
1170 uit de URL (`history.replaceState`), zodat herladen niet opnieuw naar
1171 online springt. Aan auth.timfalken.com is niets veranderd.
1172
1173 **Menuknop.** Alleen in Spelen en Offline Strijd (niet online/toeschouwen),
1174 rechtsboven naast de HUD (eigen flex-container, overlapt niet; ook op
1175 mobiel getest). Aanname: **het spel pauzeert** zolang het menu open is
1176 (`app.paused`: geen `GameCore`-tick, geen bots, geen vluchten) — dat is
1177 offline eerlijk en verwacht. Online is er geen knop (pauzeren kan daar niet).
1178
1179 **Stoppen.** “Terug naar hoofdmenu” beëindigt de wedstrijd. Ingelogd:
1180 eerst het puntenscherm met neutrale titel “Spel beëindigd” via de
1181 bestaande `play_finish`/reward-flow, daarna het hoofdmenu (in Offline
1182 Strijd dus **geen** volgende ronde of resultaatscherm). Uitgelogd: direct
1183 naar het hoofdmenu (de laatste score staat daar, zoals na game over).
1184 Misbruik: stoppen gaat door dezelfde server-check als een normaal einde
1185 (punten begrensd op speelduur sinds `play_start`, één finish per sessie),
1186 dus snel stoppen levert niets extra op.
1187
1188 ## t1194 — Tempo van het puntenscherm
1189
1190 Blokje *i* (0-gebaseerd) van *n* vertrekt op het moment *t* waarop
1191 `3t + a·t²/2 = i`, met tempo r(t) = 3 + a·t blokjes/s en T = 4 s.
1192 De versnelling volgt uit “het laatste blokje (i = n−1) vertrekt op T”:
1193 `a = 2·((n−1) − 3T) / T²`. Aanname: is `n − 1 ≤ 3T` (≤ 13 punten), dan
1194 zou *a* ≤ 0 worden; dan gebruiken we een **vast tempo** `(n−1)/T`
1195 (a = 0), zodat ook dan het laatste blokje op ~4 s vertrekt. Bij 1 punt
1196 vertrekt het ene blokje meteen. Vluchtduur, de tik-regel van de laatste
1197 1,5 s, 0 punten en het foutpad zijn ongewijzigd.
1198
1199 ## t1195 — Weggehaalde teksten
1200
1201 Verwijderd in alle talen (sleutels weg): de tagline onder “Meteors”,
1202 de uitleg na het totaal in de Planeetontwerper (alleen “Totaal: N
1203 punten.” blijft), de ondertitel van de planeetkeuze, en in de HUD van
1204 Offline Strijd “· N tegenstander(s) · Skill X%” (alleen “Ronde N”).
1205
1206 ## t1196 — Laatst gekozen planeet
1207
1208 De planeet die je in een planeetkeuzescherm bevestigt (of in de lobby
1209 kiest) wordt onthouden. Ingelogd: kolom `last_planet` in `profiles`,
1210 via `api.php?action=set_last_planet`, terug in `me`/`poll` (zoals de
1211 taal). De server accepteert alleen bekende standaardplaneten of een
1212 eigen planeet van díe gebruiker. Uitgelogd (en als terugval):
1213 `localStorage` (`meteors-planet`). Bij elk planeetkeuzescherm (Spelen,
1214 Offline Strijd, Online) staat die planeet vooraan geselecteerd. Is een
1215 eigen planeet intussen verwijderd, dan geeft de server `null` en kiest
1216 de client Terra (geen fout).
1217
1218 ## t1197 — Combo en “+x%”
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 %, …
1223 Aanname: de eerste match zelf krijgt nog niets — de combo beloont
1224 doorgaan.
1225 - Geen match gedurende 5 s (`GameCore.COMBO_RESET_S`, speeltijd; telt
1226 niet door tijdens pauze) → combo terug naar 0.
1227 - Combinatie met de landingsketting (t1120, +25 % per stap): **additief**,
1228 `factor = 1 + 0,25·ketting + 0,05·combo`. De HUD toont het totaal van
1229 de laatste lancering als simpel “+x%” (geel, oranje rand), zolang de
1230 geboosterde cluster vliegt of de combo nog loopt.
1231 - Zit in de gedeelde `GameCore`, dus spelers en bots (offline, online)
1232 doen precies hetzelfde. Tests: `test/combo.test.js`.
1233
1234 ## t1198 — Resultaatscherm Offline Strijd
1235
1236 “Je speelde tegen N tegenstander(s) met skill X%.” is vervangen door
1237 “X tegenstander(s) verslagen” (enkelvoud/meervoud per taal, incl. pl/ru
1238 few/many). X = alle bots die over alle gespeelde rondes uitgeschakeld
1239 zijn (`OfflineBattle.defeated`, één keer per bot). Aanname: in de
1240 verloren ronde tellen bots die al vóór jou uit waren mee; de rest niet.
1241 “Je hebt ronde N bereikt.” blijft.
@@ -1155,3 +1155,87 @@ Tests: `test/garbage-queue.test.js` (o.a. exact scenario: 5 tegelijk, 2
1155open kolommen → alle 5 landen; ook via offline bots);
1155open kolommen → alle 5 landen; ook via offline bots);
1156`test/t1192-garbage-queue-playwright.py ROOT TAG` (twee browsers lokaal).
1156`test/t1192-garbage-queue-playwright.py ROOT TAG` (twee browsers lokaal).
1157
1157
1158
1159## t1193 — Menu tijdens het spel en login-redirect
1160
1161**Login-redirect (oorzaak).** `callback.php` stuurde na elke geslaagde
1162login hard naar `index.html?online=1`, en `main.js` opende bij
1163`?online=1` altijd het online-paneel. Daardoor belandde je ook na
1164inloggen vanaf het hoofdmenu in online spelen. **Oplossing:** `auth.php`
1165onthoudt `?return=` (alleen de whitelist-waarde `online`, via
1166`loginReturnTarget`) in de sessie; `callback.php` stuurt alleen dan naar
1167`index.html?online=1`, anders naar `index.html` (hoofdmenu, ingelogd).
1168De inlogknop in het online-paneel gebruikt `auth.php?return=online`,
1169de menuknop gewoon `auth.php`. `main.js` haalt `?online=1` na gebruik
1170uit de URL (`history.replaceState`), zodat herladen niet opnieuw naar
1171online springt. Aan auth.timfalken.com is niets veranderd.
1172
1173**Menuknop.** Alleen in Spelen en Offline Strijd (niet online/toeschouwen),
1174rechtsboven naast de HUD (eigen flex-container, overlapt niet; ook op
1175mobiel getest). Aanname: **het spel pauzeert** zolang het menu open is
1176(`app.paused`: geen `GameCore`-tick, geen bots, geen vluchten) — dat is
1177offline eerlijk en verwacht. Online is er geen knop (pauzeren kan daar niet).
1178
1179**Stoppen.** “Terug naar hoofdmenu” beëindigt de wedstrijd. Ingelogd:
1180eerst het puntenscherm met neutrale titel “Spel beëindigd” via de
1181bestaande `play_finish`/reward-flow, daarna het hoofdmenu (in Offline
1182Strijd dus **geen** volgende ronde of resultaatscherm). Uitgelogd: direct
1183naar het hoofdmenu (de laatste score staat daar, zoals na game over).
1184Misbruik: stoppen gaat door dezelfde server-check als een normaal einde
1185(punten begrensd op speelduur sinds `play_start`, één finish per sessie),
1186dus snel stoppen levert niets extra op.
1187
1188## t1194 — Tempo van het puntenscherm
1189
1190Blokje *i* (0-gebaseerd) van *n* vertrekt op het moment *t* waarop
1191`3t + a·t²/2 = i`, met tempo r(t) = 3 + a·t blokjes/s en T = 4 s.
1192De versnelling volgt uit “het laatste blokje (i = n−1) vertrekt op T”:
1193`a = 2·((n−1) − 3T) / T²`. Aanname: is `n − 1 ≤ 3T` (≤ 13 punten), dan
1194zou *a* ≤ 0 worden; dan gebruiken we een **vast tempo** `(n−1)/T`
1195(a = 0), zodat ook dan het laatste blokje op ~4 s vertrekt. Bij 1 punt
1196vertrekt het ene blokje meteen. Vluchtduur, de tik-regel van de laatste
11971,5 s, 0 punten en het foutpad zijn ongewijzigd.
1198
1199## t1195 — Weggehaalde teksten
1200
1201Verwijderd in alle talen (sleutels weg): de tagline onder “Meteors”,
1202de uitleg na het totaal in de Planeetontwerper (alleen “Totaal: N
1203punten.” blijft), de ondertitel van de planeetkeuze, en in de HUD van
1204Offline Strijd “· N tegenstander(s) · Skill X%” (alleen “Ronde N”).
1205
1206## t1196 — Laatst gekozen planeet
1207
1208De planeet die je in een planeetkeuzescherm bevestigt (of in de lobby
1209kiest) wordt onthouden. Ingelogd: kolom `last_planet` in `profiles`,
1210via `api.php?action=set_last_planet`, terug in `me`/`poll` (zoals de
1211taal). De server accepteert alleen bekende standaardplaneten of een
1212eigen planeet van díe gebruiker. Uitgelogd (en als terugval):
1213`localStorage` (`meteors-planet`). Bij elk planeetkeuzescherm (Spelen,
1214Offline Strijd, Online) staat die planeet vooraan geselecteerd. Is een
1215eigen planeet intussen verwijderd, dan geeft de server `null` en kiest
1216de client Terra (geen fout).
1217
1218## t1197 — Combo en “+x%”
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 %, …
1223 Aanname: de eerste match zelf krijgt nog niets — de combo beloont
1224 doorgaan.
1225- Geen match gedurende 5 s (`GameCore.COMBO_RESET_S`, speeltijd; telt
1226 niet door tijdens pauze) → combo terug naar 0.
1227- Combinatie met de landingsketting (t1120, +25 % per stap): **additief**,
1228 `factor = 1 + 0,25·ketting + 0,05·combo`. De HUD toont het totaal van
1229 de laatste lancering als simpel “+x%” (geel, oranje rand), zolang de
1230 geboosterde cluster vliegt of de combo nog loopt.
1231- Zit in de gedeelde `GameCore`, dus spelers en bots (offline, online)
1232 doen precies hetzelfde. Tests: `test/combo.test.js`.
1233
1234## t1198 — Resultaatscherm Offline Strijd
1235
1236“Je speelde tegen N tegenstander(s) met skill X%.” is vervangen door
1237“X tegenstander(s) verslagen” (enkelvoud/meervoud per taal, incl. pl/ru
1238few/many). X = alle bots die over alle gespeelde rondes uitgeschakeld
1239zijn (`OfflineBattle.defeated`, één keer per bot). Aanname: in de
1240verloren ronde tellen bots die al vóór jou uit waren mee; de rest niet.
1241“Je hebt ronde N bereikt.” blijft.
server/api.php +7 −0
@@ -21,6 +21,7 @@ try {
21 21 $profile = [
22 22 'lifetime_points' => 0,
23 23 'locale' => null,
24 'last_planet' => null,
24 25 'blocks' => [],
25 26 'planets' => [],
26 27 ];
@@ -45,6 +46,7 @@ try {
45 46 'logout_url' => 'logout.php',
46 47 'lifetime_points' => $profile['lifetime_points'],
47 48 'locale' => $profile['locale'],
49 'last_planet' => $profile['last_planet'],
48 50 'blocks' => $profile['blocks'],
49 51 'planets' => $profile['planets'],
50 52 ]);
@@ -120,6 +122,7 @@ try {
120 122 'shot_flights' => $view['shot_flights'] ?? [],
121 123 'lifetime_points' => $profile['lifetime_points'],
122 124 'locale' => $profile['locale'],
125 'last_planet' => $profile['last_planet'],
123 126 'blocks' => $profile['blocks'],
124 127 'planets' => $profile['planets'],
125 128 ]);
@@ -159,6 +162,10 @@ try {
159 162 'planets' => $store->listCustomPlanets($userId),
160 163 ]);
161 164
165 case 'set_last_planet':
166 $pid = $store->setLastPlanet($userId, (string) ($body['planet_id'] ?? ''));
167 jsonOut(['ok' => true, 'csrf' => csrfToken(), 'last_planet' => $pid]);
168
162 169 case 'set_locale':
163 170 $locale = $store->setLocale($userId, (string) ($body['locale'] ?? ''));
164 171 jsonOut(['ok' => true, 'csrf' => csrfToken(), 'locale' => $locale]);
@@ -21,6 +21,7 @@ try {
21 $profile = [
21 $profile = [
22 'lifetime_points' => 0,
22 'lifetime_points' => 0,
23 'locale' => null,
23 'locale' => null,
24 'last_planet' => null,
24 'blocks' => [],
25 'blocks' => [],
25 'planets' => [],
26 'planets' => [],
26 ];
27 ];
@@ -45,6 +46,7 @@ try {
45 'logout_url' => 'logout.php',
46 'logout_url' => 'logout.php',
46 'lifetime_points' => $profile['lifetime_points'],
47 'lifetime_points' => $profile['lifetime_points'],
47 'locale' => $profile['locale'],
48 'locale' => $profile['locale'],
49 'last_planet' => $profile['last_planet'],
48 'blocks' => $profile['blocks'],
50 'blocks' => $profile['blocks'],
49 'planets' => $profile['planets'],
51 'planets' => $profile['planets'],
50 ]);
52 ]);
@@ -120,6 +122,7 @@ try {
120 'shot_flights' => $view['shot_flights'] ?? [],
122 'shot_flights' => $view['shot_flights'] ?? [],
121 'lifetime_points' => $profile['lifetime_points'],
123 'lifetime_points' => $profile['lifetime_points'],
122 'locale' => $profile['locale'],
124 'locale' => $profile['locale'],
125 'last_planet' => $profile['last_planet'],
123 'blocks' => $profile['blocks'],
126 'blocks' => $profile['blocks'],
124 'planets' => $profile['planets'],
127 'planets' => $profile['planets'],
125 ]);
128 ]);
@@ -159,6 +162,10 @@ try {
159 'planets' => $store->listCustomPlanets($userId),
162 'planets' => $store->listCustomPlanets($userId),
160 ]);
163 ]);
161
164
165 case 'set_last_planet':
166 $pid = $store->setLastPlanet($userId, (string) ($body['planet_id'] ?? ''));
167 jsonOut(['ok' => true, 'csrf' => csrfToken(), 'last_planet' => $pid]);
168
162 case 'set_locale':
169 case 'set_locale':
163 $locale = $store->setLocale($userId, (string) ($body['locale'] ?? ''));
170 $locale = $store->setLocale($userId, (string) ($body['locale'] ?? ''));
164 jsonOut(['ok' => true, 'csrf' => csrfToken(), 'locale' => $locale]);
171 jsonOut(['ok' => true, 'csrf' => csrfToken(), 'locale' => $locale]);
server/auth.php +2 −0
@@ -16,6 +16,8 @@ try {
16 16 exit;
17 17 }
18 18 $cfg = config();
19 // t1193: remember where the login started (menu vs. Online screen).
20 $_SESSION['login_return'] = loginReturnTarget($_GET['return'] ?? null);
19 21 $_SESSION['oauth_state'] = bin2hex(random_bytes(32));
20 22 $_SESSION['oauth_started'] = time();
21 23 header('Location: ' . authUrl() . '/oauth/authorize?' . http_build_query([
@@ -16,6 +16,8 @@ try {
16 exit;
16 exit;
17 }
17 }
18 $cfg = config();
18 $cfg = config();
19 // t1193: remember where the login started (menu vs. Online screen).
20 $_SESSION['login_return'] = loginReturnTarget($_GET['return'] ?? null);
19 $_SESSION['oauth_state'] = bin2hex(random_bytes(32));
21 $_SESSION['oauth_state'] = bin2hex(random_bytes(32));
20 $_SESSION['oauth_started'] = time();
22 $_SESSION['oauth_started'] = time();
21 header('Location: ' . authUrl() . '/oauth/authorize?' . http_build_query([
23 header('Location: ' . authUrl() . '/oauth/authorize?' . http_build_query([
server/callback.php +4 −2
@@ -10,7 +10,8 @@ try {
10 10 || time() - (int) ($_SESSION['oauth_started'] ?? 0) > 600) {
11 11 throw new RuntimeException('Ongeldige of verlopen login.');
12 12 }
13 unset($_SESSION['oauth_state'], $_SESSION['oauth_started']);
13 $loginReturn = loginReturnTarget($_SESSION['login_return'] ?? null);
14 unset($_SESSION['oauth_state'], $_SESSION['oauth_started'], $_SESSION['login_return']);
14 15 $code = $_GET['code'] ?? null;
15 16 if (!is_string($code) || $code === '') {
16 17 throw new RuntimeException('De login is niet afgerond.');
@@ -34,7 +35,8 @@ try {
34 35 loginUser($id, $name);
35 36 $_SESSION['token'] = $token['access_token'];
36 37 $_SESSION['expires'] = time() + (int) $token['expires_in'];
37 header('Location: ' . baseUrl() . '/index.html?online=1');
38 // t1193: back to the main menu unless the login started from Online.
39 header('Location: ' . baseUrl() . '/' . loginReturnPath($loginReturn));
38 40 } catch (Throwable $e) {
39 41 http_response_code(401);
40 42 header('Content-Type: text/html; charset=utf-8');
@@ -10,7 +10,8 @@ try {
10 || time() - (int) ($_SESSION['oauth_started'] ?? 0) > 600) {
10 || time() - (int) ($_SESSION['oauth_started'] ?? 0) > 600) {
11 throw new RuntimeException('Ongeldige of verlopen login.');
11 throw new RuntimeException('Ongeldige of verlopen login.');
12 }
12 }
13 unset($_SESSION['oauth_state'], $_SESSION['oauth_started']);
13 $loginReturn = loginReturnTarget($_SESSION['login_return'] ?? null);
14 unset($_SESSION['oauth_state'], $_SESSION['oauth_started'], $_SESSION['login_return']);
14 $code = $_GET['code'] ?? null;
15 $code = $_GET['code'] ?? null;
15 if (!is_string($code) || $code === '') {
16 if (!is_string($code) || $code === '') {
16 throw new RuntimeException('De login is niet afgerond.');
17 throw new RuntimeException('De login is niet afgerond.');
@@ -34,7 +35,8 @@ try {
34 loginUser($id, $name);
35 loginUser($id, $name);
35 $_SESSION['token'] = $token['access_token'];
36 $_SESSION['token'] = $token['access_token'];
36 $_SESSION['expires'] = time() + (int) $token['expires_in'];
37 $_SESSION['expires'] = time() + (int) $token['expires_in'];
37 header('Location: ' . baseUrl() . '/index.html?online=1');
38 // t1193: back to the main menu unless the login started from Online.
39 header('Location: ' . baseUrl() . '/' . loginReturnPath($loginReturn));
38} catch (Throwable $e) {
40} catch (Throwable $e) {
39 http_response_code(401);
41 http_response_code(401);
40 header('Content-Type: text/html; charset=utf-8');
42 header('Content-Type: text/html; charset=utf-8');
server/lib/Store.php +32 −0
@@ -115,6 +115,7 @@ CREATE TABLE IF NOT EXISTS custom_planets (
115 115 );
116 116 CREATE INDEX IF NOT EXISTS custom_planets_user ON custom_planets (user_id);
117 117 SQL);
118 $this->ensureColumn('profiles', 'last_planet', 'TEXT');
118 119 }
119 120
120 121 private function ensureColumn(string $table, string $column, string $ddl): void
@@ -864,6 +865,36 @@ SQL);
864 865 return $locale;
865 866 }
866 867
868 /**
869 * Last chosen planet (t1196): a standard planet id or one of the
870 * user's own custom planets. Returns null when nothing is stored or the
871 * stored custom planet no longer exists (graceful fallback).
872 */
873 public function lastPlanet(string $userId): ?string
874 {
875 $v = $this->ensureProfile($userId)['last_planet'] ?? null;
876 if (!is_string($v) || $v === '') {
877 return null;
878 }
879 if (Planets::known($v) || $this->ownedCustom($userId, $v)) {
880 return $v;
881 }
882 return null;
883 }
884
885 public function setLastPlanet(string $userId, string $planetId): string
886 {
887 $planetId = trim($planetId);
888 if ($planetId === '' || strlen($planetId) > 64
889 || !(Planets::known($planetId) || $this->ownedCustom($userId, $planetId))) {
890 throw new RuntimeException('Onbekende planeet.');
891 }
892 $this->ensureProfile($userId);
893 $this->pdo->prepare('UPDATE profiles SET last_planet = ?, updated = ? WHERE user_id = ?')
894 ->execute([$planetId, $this->now(), $userId]);
895 return $planetId;
896 }
897
867 898 /**
868 899 * Add points once for a unique award_key. Returns the new lifetime total.
869 900 * $points is clamped to [0, MAX_GAME_POINTS]. A repeat key is a no-op.
@@ -1107,6 +1138,7 @@ SQL);
1107 1138 return [
1108 1139 'lifetime_points' => $points,
1109 1140 'locale' => $this->locale($userId),
1141 'last_planet' => $this->lastPlanet($userId),
1110 1142 'blocks' => Blocks::present($points),
1111 1143 'planets' => $this->listCustomPlanets($userId),
1112 1144 ];
@@ -115,6 +115,7 @@ CREATE TABLE IF NOT EXISTS custom_planets (
115);
115);
116CREATE INDEX IF NOT EXISTS custom_planets_user ON custom_planets (user_id);
116CREATE INDEX IF NOT EXISTS custom_planets_user ON custom_planets (user_id);
117SQL);
117SQL);
118 $this->ensureColumn('profiles', 'last_planet', 'TEXT');
118 }
119 }
119
120
120 private function ensureColumn(string $table, string $column, string $ddl): void
121 private function ensureColumn(string $table, string $column, string $ddl): void
@@ -864,6 +865,36 @@ SQL);
864 return $locale;
865 return $locale;
865 }
866 }
866
867
868 /**
869 * Last chosen planet (t1196): a standard planet id or one of the
870 * user's own custom planets. Returns null when nothing is stored or the
871 * stored custom planet no longer exists (graceful fallback).
872 */
873 public function lastPlanet(string $userId): ?string
874 {
875 $v = $this->ensureProfile($userId)['last_planet'] ?? null;
876 if (!is_string($v) || $v === '') {
877 return null;
878 }
879 if (Planets::known($v) || $this->ownedCustom($userId, $v)) {
880 return $v;
881 }
882 return null;
883 }
884
885 public function setLastPlanet(string $userId, string $planetId): string
886 {
887 $planetId = trim($planetId);
888 if ($planetId === '' || strlen($planetId) > 64
889 || !(Planets::known($planetId) || $this->ownedCustom($userId, $planetId))) {
890 throw new RuntimeException('Onbekende planeet.');
891 }
892 $this->ensureProfile($userId);
893 $this->pdo->prepare('UPDATE profiles SET last_planet = ?, updated = ? WHERE user_id = ?')
894 ->execute([$planetId, $this->now(), $userId]);
895 return $planetId;
896 }
897
867 /**
898 /**
868 * Add points once for a unique award_key. Returns the new lifetime total.
899 * Add points once for a unique award_key. Returns the new lifetime total.
869 * $points is clamped to [0, MAX_GAME_POINTS]. A repeat key is a no-op.
900 * $points is clamped to [0, MAX_GAME_POINTS]. A repeat key is a no-op.
@@ -1107,6 +1138,7 @@ SQL);
1107 return [
1138 return [
1108 'lifetime_points' => $points,
1139 'lifetime_points' => $points,
1109 'locale' => $this->locale($userId),
1140 'locale' => $this->locale($userId),
1141 'last_planet' => $this->lastPlanet($userId),
1110 'blocks' => Blocks::present($points),
1142 'blocks' => Blocks::present($points),
1111 'planets' => $this->listCustomPlanets($userId),
1143 'planets' => $this->listCustomPlanets($userId),
1112 ];
1144 ];
server/lib/bootstrap.php +16 −0
@@ -179,6 +179,22 @@ function authIdentity(array $profile): array
179 179 return ['auth:' . (int) $raw, $profile['username']];
180 180 }
181 181
182 /**
183 * Where to go after a login (t1193). Only an explicit 'online' (login
184 * started from the Online screen) returns to online play; everything else
185 * (menu login, missing or unknown value) returns to the main menu.
186 */
187 function loginReturnTarget($param): string
188 {
189 return $param === 'online' ? 'online' : 'menu';
190 }
191
192 /** Relative page to land on after a login for a loginReturnTarget() value. */
193 function loginReturnPath(?string $target): string
194 {
195 return $target === 'online' ? 'index.html?online=1' : 'index.html';
196 }
197
182 198 function loginUser(string $id, string $name): void
183 199 {
184 200 if (!preg_match('/^(?:local:test_user_[12]|auth:[1-9][0-9]{0,17})$/', $id)) {
@@ -179,6 +179,22 @@ function authIdentity(array $profile): array
179 return ['auth:' . (int) $raw, $profile['username']];
179 return ['auth:' . (int) $raw, $profile['username']];
180}
180}
181
181
182/**
183 * Where to go after a login (t1193). Only an explicit 'online' (login
184 * started from the Online screen) returns to online play; everything else
185 * (menu login, missing or unknown value) returns to the main menu.
186 */
187function loginReturnTarget($param): string
188{
189 return $param === 'online' ? 'online' : 'menu';
190}
191
192/** Relative page to land on after a login for a loginReturnTarget() value. */
193function loginReturnPath(?string $target): string
194{
195 return $target === 'online' ? 'index.html?online=1' : 'index.html';
196}
197
182function loginUser(string $id, string $name): void
198function loginUser(string $id, string $name): void
183{
199{
184 if (!preg_match('/^(?:local:test_user_[12]|auth:[1-9][0-9]{0,17})$/', $id)) {
200 if (!preg_match('/^(?:local:test_user_[12]|auth:[1-9][0-9]{0,17})$/', $id)) {
server/lib/i18n.json +110 −70
@@ -1,7 +1,6 @@
1 1 {
2 2 "locales": {
3 3 "en": {
4 "menu.tagline": "Three in a row, and your blocks get rocket boosters.",
5 4 "menu.play": "Play",
6 5 "menu.offline": "Offline Battle",
7 6 "menu.online": "Play online",
@@ -16,7 +15,6 @@
16 15 "menu.logout": "Log out",
17 16 "menu.player": "player",
18 17 "planet.title": "Choose a field",
19 "planet.tagline": "Each field is a planet, with its own people, gravity, air and mass.",
20 18 "planet.back": "Back",
21 19 "planet.customBadge": "Yours",
22 20 "stats.powerLabel": "Power",
@@ -51,7 +49,7 @@
51 49 "online.you": "you",
52 50 "designer.title": "Planet Designer",
53 51 "designer.taglineBefore": "Total:",
54 "designer.taglineAfter": "points. You unlock blocks by earning points — you do not spend them.",
52 "designer.taglineAfter": "points.",
55 53 "designer.empty": "You don’t have any planets of your own yet. Create one.",
56 54 "designer.new": "New planet",
57 55 "designer.editTitle": "Edit planet",
@@ -82,19 +80,16 @@
82 80 "designer.defaultPeople": "People",
83 81 "hud.points": "Points",
84 82 "hud.round": "Round {n}",
85 "hud.skill": "Skill {n}%",
86 83 "hud.out": "Out",
87 84 "hud.miniPoints": "Points {n}",
88 85 "hud.opponent.one": "opponent",
89 86 "hud.opponent.few": "opponents",
90 87 "hud.opponent.many": "opponents",
91 88 "hud.opponent.other": "opponents",
92 "hud.opponentsLine": "{n} {word}",
93 89 "offline.resultTitle": "Offline Battle",
94 90 "offline.reachedBefore": "You reached round",
95 91 "offline.reachedAfter": ".",
96 92 "offline.reached": "You reached round {n}.",
97 "offline.detail": "You played against {n} {opponents} at skill {skill}%.",
98 93 "offline.backMenu": "Back to the menu",
99 94 "gameover.title": "You lost",
100 95 "gameover.detail": "Every column is locked.",
@@ -283,10 +278,18 @@
283 278 "reward.won": "You won!",
284 279 "reward.lost": "You lost...",
285 280 "reward.total": "Total points",
286 "reward.continue": "Tap to continue"
281 "reward.continue": "Tap to continue",
282 "game.menu": "Menu",
283 "game.paused": "Paused",
284 "game.resume": "Resume",
285 "game.backToMenu": "Back to main menu",
286 "reward.ended": "Game ended",
287 "offline.defeated.one": "{n} opponent defeated",
288 "offline.defeated.few": "{n} opponents defeated",
289 "offline.defeated.many": "{n} opponents defeated",
290 "offline.defeated.other": "{n} opponents defeated"
287 291 },
288 292 "nl": {
289 "menu.tagline": "Drie op een rij, en je blokjes krijgen raketmotoren.",
290 293 "menu.play": "Spelen",
291 294 "menu.offline": "Offline Strijd",
292 295 "menu.online": "Online spelen",
@@ -301,7 +304,6 @@
301 304 "menu.logout": "Uitloggen",
302 305 "menu.player": "speler",
303 306 "planet.title": "Kies een veld",
304 "planet.tagline": "Elk veld is een planeet, met een eigen volk, zwaartekracht, lucht en massa.",
305 307 "planet.back": "Terug",
306 308 "planet.customBadge": "Eigen",
307 309 "stats.powerLabel": "Power",
@@ -336,7 +338,7 @@
336 338 "online.you": "jij",
337 339 "designer.title": "Planeetontwerper",
338 340 "designer.taglineBefore": "Totaal:",
339 "designer.taglineAfter": "punten. Blokjes ontgrendel je door punten te verdienen — je geeft ze niet uit.",
341 "designer.taglineAfter": "punten.",
340 342 "designer.empty": "Je hebt nog geen eigen planeten. Maak er een aan.",
341 343 "designer.new": "Nieuwe planeet",
342 344 "designer.editTitle": "Planeet bewerken",
@@ -367,19 +369,16 @@
367 369 "designer.defaultPeople": "Volk",
368 370 "hud.points": "Punten",
369 371 "hud.round": "Ronde {n}",
370 "hud.skill": "Skill {n}%",
371 372 "hud.out": "Uit",
372 373 "hud.miniPoints": "Punten {n}",
373 374 "hud.opponent.one": "tegenstander",
374 375 "hud.opponent.few": "tegenstanders",
375 376 "hud.opponent.many": "tegenstanders",
376 377 "hud.opponent.other": "tegenstanders",
377 "hud.opponentsLine": "{n} {word}",
378 378 "offline.resultTitle": "Offline Strijd",
379 379 "offline.reachedBefore": "Je hebt ronde",
380 380 "offline.reachedAfter": " bereikt.",
381 381 "offline.reached": "Je hebt ronde {n} bereikt.",
382 "offline.detail": "Je speelde tegen {n} {opponents} met skill {skill}%.",
383 382 "offline.backMenu": "Terug naar het menu",
384 383 "gameover.title": "Je hebt verloren",
385 384 "gameover.detail": "Alle kolommen zitten vast.",
@@ -568,10 +567,18 @@
568 567 "reward.won": "Gewonnen!",
569 568 "reward.lost": "Verloren...",
570 569 "reward.total": "Totaal punten",
571 "reward.continue": "Tik om verder te gaan"
570 "reward.continue": "Tik om verder te gaan",
571 "game.menu": "Menu",
572 "game.paused": "Gepauzeerd",
573 "game.resume": "Verder spelen",
574 "game.backToMenu": "Terug naar hoofdmenu",
575 "reward.ended": "Spel gestopt",
576 "offline.defeated.one": "{n} tegenstander verslagen",
577 "offline.defeated.few": "{n} tegenstanders verslagen",
578 "offline.defeated.many": "{n} tegenstanders verslagen",
579 "offline.defeated.other": "{n} tegenstanders verslagen"
572 580 },
573 581 "de": {
574 "menu.tagline": "Drei in einer Reihe — und deine Blöcke bekommen Raketenantrieb.",
575 582 "menu.play": "Spielen",
576 583 "menu.offline": "Offline-Kampf",
577 584 "menu.online": "Online spielen",
@@ -586,7 +593,6 @@
586 593 "menu.logout": "Abmelden",
587 594 "menu.player": "Spieler",
588 595 "planet.title": "Wähle ein Feld",
589 "planet.tagline": "Jedes Feld ist ein Planet mit eigenem Volk, eigener Schwerkraft, Luft und Masse.",
590 596 "planet.back": "Zurück",
591 597 "planet.customBadge": "Eigene",
592 598 "stats.powerLabel": "Power",
@@ -621,7 +627,7 @@
621 627 "online.you": "du",
622 628 "designer.title": "Planeten-Designer",
623 629 "designer.taglineBefore": "Gesamt:",
624 "designer.taglineAfter": "Punkte. Blöcke schaltest du frei, indem du Punkte verdienst — du gibst sie nicht aus.",
630 "designer.taglineAfter": "Punkte.",
625 631 "designer.empty": "Du hast noch keine eigenen Planeten. Erstelle einen.",
626 632 "designer.new": "Neuer Planet",
627 633 "designer.editTitle": "Planet bearbeiten",
@@ -652,19 +658,16 @@
652 658 "designer.defaultPeople": "Volk",
653 659 "hud.points": "Punkte",
654 660 "hud.round": "Runde {n}",
655 "hud.skill": "Können {n} %",
656 661 "hud.out": "Raus",
657 662 "hud.miniPoints": "Punkte {n}",
658 663 "hud.opponent.one": "Gegner",
659 664 "hud.opponent.few": "Gegner",
660 665 "hud.opponent.many": "Gegner",
661 666 "hud.opponent.other": "Gegner",
662 "hud.opponentsLine": "{n} {word}",
663 667 "offline.resultTitle": "Offline-Kampf",
664 668 "offline.reachedBefore": "Du hast Runde",
665 669 "offline.reachedAfter": " erreicht.",
666 670 "offline.reached": "Du hast Runde {n} erreicht.",
667 "offline.detail": "Du hast gegen {n} {opponents} mit Können {skill} % gespielt.",
668 671 "offline.backMenu": "Zurück zum Menü",
669 672 "gameover.title": "Du hast verloren",
670 673 "gameover.detail": "Alle Spalten sind festgesetzt.",
@@ -853,10 +856,18 @@
853 856 "reward.won": "Gewonnen!",
854 857 "reward.lost": "Verloren...",
855 858 "reward.total": "Punkte gesamt",
856 "reward.continue": "Tippen zum Fortfahren"
859 "reward.continue": "Tippen zum Fortfahren",
860 "game.menu": "Menü",
861 "game.paused": "Pausiert",
862 "game.resume": "Weiterspielen",
863 "game.backToMenu": "Zurück zum Hauptmenü",
864 "reward.ended": "Spiel beendet",
865 "offline.defeated.one": "{n} Gegner besiegt",
866 "offline.defeated.few": "{n} Gegner besiegt",
867 "offline.defeated.many": "{n} Gegner besiegt",
868 "offline.defeated.other": "{n} Gegner besiegt"
857 869 },
858 870 "fr": {
859 "menu.tagline": "Trois d’affilée, et tes blocs s’équipent de propulseurs.",
860 871 "menu.play": "Jouer",
861 872 "menu.offline": "Combat hors ligne",
862 873 "menu.online": "Jouer en ligne",
@@ -871,7 +882,6 @@
871 882 "menu.logout": "Déconnexion",
872 883 "menu.player": "joueur",
873 884 "planet.title": "Choisis un terrain",
874 "planet.tagline": "Chaque terrain est une planète, avec son peuple, sa gravité, son air et sa masse.",
875 885 "planet.back": "Retour",
876 886 "planet.customBadge": "Perso",
877 887 "stats.powerLabel": "Puissance",
@@ -906,7 +916,7 @@
906 916 "online.you": "toi",
907 917 "designer.title": "Concepteur de planètes",
908 918 "designer.taglineBefore": "Total :",
909 "designer.taglineAfter": "points. Tu débloques des blocs en gagnant des points — tu ne les dépenses pas.",
919 "designer.taglineAfter": "points.",
910 920 "designer.empty": "Tu n’as pas encore de planète à toi. Crées-en une.",
911 921 "designer.new": "Nouvelle planète",
912 922 "designer.editTitle": "Modifier la planète",
@@ -937,19 +947,16 @@
937 947 "designer.defaultPeople": "Peuple",
938 948 "hud.points": "Points",
939 949 "hud.round": "Manche {n}",
940 "hud.skill": "Niveau {n} %",
941 950 "hud.out": "Éliminé",
942 951 "hud.miniPoints": "Points {n}",
943 952 "hud.opponent.one": "adversaire",
944 953 "hud.opponent.few": "adversaires",
945 954 "hud.opponent.many": "adversaires",
946 955 "hud.opponent.other": "adversaires",
947 "hud.opponentsLine": "{n} {word}",
948 956 "offline.resultTitle": "Combat hors ligne",
949 957 "offline.reachedBefore": "Tu as atteint la manche",
950 958 "offline.reachedAfter": ".",
951 959 "offline.reached": "Tu as atteint la manche {n}.",
952 "offline.detail": "Tu as joué contre {n} {opponents} au niveau {skill} %.",
953 960 "offline.backMenu": "Retour au menu",
954 961 "gameover.title": "Tu as perdu",
955 962 "gameover.detail": "Toutes les colonnes sont bloquées.",
@@ -1138,10 +1145,18 @@
1138 1145 "reward.won": "Victoire !",
1139 1146 "reward.lost": "Perdu...",
1140 1147 "reward.total": "Total des points",
1141 "reward.continue": "Touchez pour continuer"
1148 "reward.continue": "Touchez pour continuer",
1149 "game.menu": "Menu",
1150 "game.paused": "En pause",
1151 "game.resume": "Reprendre",
1152 "game.backToMenu": "Retour au menu principal",
1153 "reward.ended": "Partie terminée",
1154 "offline.defeated.one": "{n} adversaire vaincu",
1155 "offline.defeated.few": "{n} adversaires vaincus",
1156 "offline.defeated.many": "{n} adversaires vaincus",
1157 "offline.defeated.other": "{n} adversaires vaincus"
1142 1158 },
1143 1159 "ja": {
1144 "menu.tagline": "三つ揃えると、ブロックにロケットが点火します。",
1145 1160 "menu.play": "プレイ",
1146 1161 "menu.offline": "オフライン対戦",
1147 1162 "menu.online": "オンラインで遊ぶ",
@@ -1156,7 +1171,6 @@
1156 1171 "menu.logout": "ログアウト",
1157 1172 "menu.player": "プレイヤー",
1158 1173 "planet.title": "フィールドを選ぶ",
1159 "planet.tagline": "各フィールドは惑星です。固有の民、重力、大気、質量を持ちます。",
1160 1174 "planet.back": "戻る",
1161 1175 "planet.customBadge": "自作",
1162 1176 "stats.powerLabel": "パワー",
@@ -1191,7 +1205,7 @@
1191 1205 "online.you": "あなた",
1192 1206 "designer.title": "惑星デザイナー",
1193 1207 "designer.taglineBefore": "合計:",
1194 "designer.taglineAfter": "ポイント。ポイントを獲得するとブロックが解放されます。消費はしません。",
1208 "designer.taglineAfter": "ポイント。",
1195 1209 "designer.empty": "まだ自分の惑星がありません。新しく作ってみましょう。",
1196 1210 "designer.new": "新しい惑星",
1197 1211 "designer.editTitle": "惑星を編集",
@@ -1222,19 +1236,16 @@
1222 1236 "designer.defaultPeople": "民",
1223 1237 "hud.points": "ポイント",
1224 1238 "hud.round": "ラウンド {n}",
1225 "hud.skill": "スキル {n}%",
1226 1239 "hud.out": "脱落",
1227 1240 "hud.miniPoints": "ポイント {n}",
1228 1241 "hud.opponent.one": "相手",
1229 1242 "hud.opponent.few": "相手",
1230 1243 "hud.opponent.many": "相手",
1231 1244 "hud.opponent.other": "相手",
1232 "hud.opponentsLine": "{word} {n} 人",
1233 1245 "offline.resultTitle": "オフライン対戦",
1234 1246 "offline.reachedBefore": "到達ラウンド:",
1235 1247 "offline.reachedAfter": "。",
1236 1248 "offline.reached": "ラウンド {n} まで到達しました。",
1237 "offline.detail": "スキル {skill}% の{opponents}{n}人と対戦しました。",
1238 1249 "offline.backMenu": "メニューに戻る",
1239 1250 "gameover.title": "負けました",
1240 1251 "gameover.detail": "すべての列がロックされました。",
@@ -1423,10 +1434,18 @@
1423 1434 "reward.won": "勝利!",
1424 1435 "reward.lost": "敗北...",
1425 1436 "reward.total": "合計ポイント",
1426 "reward.continue": "タップして続ける"
1437 "reward.continue": "タップして続ける",
1438 "game.menu": "メニュー",
1439 "game.paused": "一時停止中",
1440 "game.resume": "再開",
1441 "game.backToMenu": "メインメニューに戻る",
1442 "reward.ended": "ゲーム終了",
1443 "offline.defeated.one": "{n}人の相手を倒した",
1444 "offline.defeated.few": "{n}人の相手を倒した",
1445 "offline.defeated.many": "{n}人の相手を倒した",
1446 "offline.defeated.other": "{n}人の相手を倒した"
1427 1447 },
1428 1448 "zh": {
1429 "menu.tagline": "三个一排,你的方块就会装上火箭。",
1430 1449 "menu.play": "开始游戏",
1431 1450 "menu.offline": "离线对战",
1432 1451 "menu.online": "在线游戏",
@@ -1441,7 +1460,6 @@
1441 1460 "menu.logout": "退出",
1442 1461 "menu.player": "玩家",
1443 1462 "planet.title": "选择场地",
1444 "planet.tagline": "每块场地都是一颗星球,有自己的居民、重力、空气和质量。",
1445 1463 "planet.back": "返回",
1446 1464 "planet.customBadge": "自制",
1447 1465 "stats.powerLabel": "力量",
@@ -1476,7 +1494,7 @@
1476 1494 "online.you": "你",
1477 1495 "designer.title": "星球设计器",
1478 1496 "designer.taglineBefore": "总分:",
1479 "designer.taglineAfter": "分。通过得分解锁方块——分数不会被消耗。",
1497 "designer.taglineAfter": "分。",
1480 1498 "designer.empty": "你还没有自己的星球。来创建一个吧。",
1481 1499 "designer.new": "新星球",
1482 1500 "designer.editTitle": "编辑星球",
@@ -1507,19 +1525,16 @@
1507 1525 "designer.defaultPeople": "居民",
1508 1526 "hud.points": "分数",
1509 1527 "hud.round": "第 {n} 轮",
1510 "hud.skill": "水平 {n}%",
1511 1528 "hud.out": "出局",
1512 1529 "hud.miniPoints": "分数 {n}",
1513 1530 "hud.opponent.one": "对手",
1514 1531 "hud.opponent.few": "对手",
1515 1532 "hud.opponent.many": "对手",
1516 1533 "hud.opponent.other": "对手",
1517 "hud.opponentsLine": "{n} 名{word}",
1518 1534 "offline.resultTitle": "离线对战",
1519 1535 "offline.reachedBefore": "你到达了第",
1520 1536 "offline.reachedAfter": " 轮。",
1521 1537 "offline.reached": "你到达了第 {n} 轮。",
1522 "offline.detail": "你以 {skill}% 的水平对战了 {n} 名{opponents}。",
1523 1538 "offline.backMenu": "返回菜单",
1524 1539 "gameover.title": "你输了",
1525 1540 "gameover.detail": "所有列都已锁定。",
@@ -1708,10 +1723,18 @@
1708 1723 "reward.won": "你赢了!",
1709 1724 "reward.lost": "你输了...",
1710 1725 "reward.total": "总积分",
1711 "reward.continue": "点击继续"
1726 "reward.continue": "点击继续",
1727 "game.menu": "菜单",
1728 "game.paused": "已暂停",
1729 "game.resume": "继续游戏",
1730 "game.backToMenu": "返回主菜单",
1731 "reward.ended": "游戏结束",
1732 "offline.defeated.one": "击败了 {n} 名对手",
1733 "offline.defeated.few": "击败了 {n} 名对手",
1734 "offline.defeated.many": "击败了 {n} 名对手",
1735 "offline.defeated.other": "击败了 {n} 名对手"
1712 1736 },
1713 1737 "ko": {
1714 "menu.tagline": "세 개를 나란히 맞추면 블록에 로켓이 점화됩니다.",
1715 1738 "menu.play": "플레이",
1716 1739 "menu.offline": "오프라인 대결",
1717 1740 "menu.online": "온라인 플레이",
@@ -1726,7 +1749,6 @@
1726 1749 "menu.logout": "로그아웃",
1727 1750 "menu.player": "플레이어",
1728 1751 "planet.title": "필드 선택",
1729 "planet.tagline": "각 필드는 행성입니다. 고유한 주민, 중력, 공기, 질량을 가집니다.",
1730 1752 "planet.back": "뒤로",
1731 1753 "planet.customBadge": "내 것",
1732 1754 "stats.powerLabel": "파워",
@@ -1761,7 +1783,7 @@
1761 1783 "online.you": "나",
1762 1784 "designer.title": "행성 디자이너",
1763 1785 "designer.taglineBefore": "합계:",
1764 "designer.taglineAfter": "점. 점수를 모으면 블록이 해금됩니다. 점수를 쓰지는 않습니다.",
1786 "designer.taglineAfter": "점.",
1765 1787 "designer.empty": "아직 내 행성이 없습니다. 하나 만들어 보세요.",
1766 1788 "designer.new": "새 행성",
1767 1789 "designer.editTitle": "행성 편집",
@@ -1792,19 +1814,16 @@
1792 1814 "designer.defaultPeople": "주민",
1793 1815 "hud.points": "점수",
1794 1816 "hud.round": "{n}라운드",
1795 "hud.skill": "숙련도 {n}%",
1796 1817 "hud.out": "탈락",
1797 1818 "hud.miniPoints": "점수 {n}",
1798 1819 "hud.opponent.one": "상대",
1799 1820 "hud.opponent.few": "상대",
1800 1821 "hud.opponent.many": "상대",
1801 1822 "hud.opponent.other": "상대",
1802 "hud.opponentsLine": "{word} {n}명",
1803 1823 "offline.resultTitle": "오프라인 대결",
1804 1824 "offline.reachedBefore": "도달한 라운드:",
1805 1825 "offline.reachedAfter": ".",
1806 1826 "offline.reached": "{n}라운드까지 도달했습니다.",
1807 "offline.detail": "숙련도 {skill}%의 {opponents} {n}명과 대결했습니다.",
1808 1827 "offline.backMenu": "메뉴로 돌아가기",
1809 1828 "gameover.title": "패배했습니다",
1810 1829 "gameover.detail": "모든 열이 잠겼습니다.",
@@ -1993,10 +2012,18 @@
1993 2012 "reward.won": "승리!",
1994 2013 "reward.lost": "패배...",
1995 2014 "reward.total": "총 포인트",
1996 "reward.continue": "탭하여 계속"
2015 "reward.continue": "탭하여 계속",
2016 "game.menu": "메뉴",
2017 "game.paused": "일시정지",
2018 "game.resume": "계속하기",
2019 "game.backToMenu": "메인 메뉴로 돌아가기",
2020 "reward.ended": "게임 종료",
2021 "offline.defeated.one": "상대 {n}명 격파",
2022 "offline.defeated.few": "상대 {n}명 격파",
2023 "offline.defeated.many": "상대 {n}명 격파",
2024 "offline.defeated.other": "상대 {n}명 격파"
1997 2025 },
1998 2026 "pl": {
1999 "menu.tagline": "Trzy w rzędzie, a twoje klocki dostają napęd rakietowy.",
2000 2027 "menu.play": "Graj",
2001 2028 "menu.offline": "Walka offline",
2002 2029 "menu.online": "Graj online",
@@ -2011,7 +2038,6 @@
2011 2038 "menu.logout": "Wyloguj się",
2012 2039 "menu.player": "gracz",
2013 2040 "planet.title": "Wybierz pole",
2014 "planet.tagline": "Każde pole to planeta, z własnym ludem, grawitacją, powietrzem i masą.",
2015 2041 "planet.back": "Wstecz",
2016 2042 "planet.customBadge": "Twoja",
2017 2043 "stats.powerLabel": "Moc",
@@ -2046,7 +2072,7 @@
2046 2072 "online.you": "ty",
2047 2073 "designer.title": "Kreator planet",
2048 2074 "designer.taglineBefore": "Suma:",
2049 "designer.taglineAfter": "pkt. Odblokowujesz klocki, zdobywając punkty — nie wydajesz ich.",
2075 "designer.taglineAfter": "pkt.",
2050 2076 "designer.empty": "Nie masz jeszcze własnych planet. Utwórz jedną.",
2051 2077 "designer.new": "Nowa planeta",
2052 2078 "designer.editTitle": "Edytuj planetę",
@@ -2077,19 +2103,16 @@
2077 2103 "designer.defaultPeople": "Lud",
2078 2104 "hud.points": "Punkty",
2079 2105 "hud.round": "Runda {n}",
2080 "hud.skill": "Umiejętność {n}%",
2081 2106 "hud.out": "Poza",
2082 2107 "hud.miniPoints": "Punkty {n}",
2083 2108 "hud.opponent.one": "przeciwnik",
2084 2109 "hud.opponent.few": "przeciwników",
2085 2110 "hud.opponent.many": "przeciwników",
2086 2111 "hud.opponent.other": "przeciwników",
2087 "hud.opponentsLine": "{n} {word}",
2088 2112 "offline.resultTitle": "Walka offline",
2089 2113 "offline.reachedBefore": "Dotarłeś do rundy",
2090 2114 "offline.reachedAfter": ".",
2091 2115 "offline.reached": "Dotarłeś do rundy {n}.",
2092 "offline.detail": "Grałeś przeciwko {n} {opponents} przy umiejętności {skill}%.",
2093 2116 "offline.backMenu": "Powrót do menu",
2094 2117 "gameover.title": "Przegrałeś",
2095 2118 "gameover.detail": "Wszystkie kolumny są zablokowane.",
@@ -2278,10 +2301,18 @@
2278 2301 "reward.won": "Wygrana!",
2279 2302 "reward.lost": "Przegrana...",
2280 2303 "reward.total": "Suma punktów",
2281 "reward.continue": "Dotknij, aby kontynuować"
2304 "reward.continue": "Dotknij, aby kontynuować",
2305 "game.menu": "Menu",
2306 "game.paused": "Pauza",
2307 "game.resume": "Wznów",
2308 "game.backToMenu": "Powrót do menu głównego",
2309 "reward.ended": "Gra zakończona",
2310 "offline.defeated.one": "{n} pokonany przeciwnik",
2311 "offline.defeated.few": "{n} pokonanych przeciwników",
2312 "offline.defeated.many": "{n} pokonanych przeciwników",
2313 "offline.defeated.other": "{n} pokonanych przeciwników"
2282 2314 },
2283 2315 "ru": {
2284 "menu.tagline": "Три в ряд — и твои блоки получают ракетные двигатели.",
2285 2316 "menu.play": "Играть",
2286 2317 "menu.offline": "Офлайн-бой",
2287 2318 "menu.online": "Играть онлайн",
@@ -2296,7 +2327,6 @@
2296 2327 "menu.logout": "Выйти",
2297 2328 "menu.player": "игрок",
2298 2329 "planet.title": "Выбери поле",
2299 "planet.tagline": "Каждое поле — это планета со своим народом, гравитацией, воздухом и массой.",
2300 2330 "planet.back": "Назад",
2301 2331 "planet.customBadge": "Своя",
2302 2332 "stats.powerLabel": "Мощность",
@@ -2331,7 +2361,7 @@
2331 2361 "online.you": "ты",
2332 2362 "designer.title": "Конструктор планет",
2333 2363 "designer.taglineBefore": "Всего:",
2334 "designer.taglineAfter": "очков. Блоки открываются за заработанные очки — тратить их не нужно.",
2364 "designer.taglineAfter": "очков.",
2335 2365 "designer.empty": "У тебя ещё нет своих планет. Создай одну.",
2336 2366 "designer.new": "Новая планета",
2337 2367 "designer.editTitle": "Изменить планету",
@@ -2362,19 +2392,16 @@
2362 2392 "designer.defaultPeople": "Народ",
2363 2393 "hud.points": "Очки",
2364 2394 "hud.round": "Раунд {n}",
2365 "hud.skill": "Мастерство {n} %",
2366 2395 "hud.out": "Вне",
2367 2396 "hud.miniPoints": "Очки {n}",
2368 2397 "hud.opponent.one": "противник",
2369 2398 "hud.opponent.few": "противника",
2370 2399 "hud.opponent.many": "противников",
2371 2400 "hud.opponent.other": "противников",
2372 "hud.opponentsLine": "{n} {word}",
2373 2401 "offline.resultTitle": "Офлайн-бой",
2374 2402 "offline.reachedBefore": "Ты дошёл до раунда",
2375 2403 "offline.reachedAfter": ".",
2376 2404 "offline.reached": "Ты дошёл до раунда {n}.",
2377 "offline.detail": "Ты играл против {n} {opponents} с мастерством {skill} %.",
2378 2405 "offline.backMenu": "Вернуться в меню",
2379 2406 "gameover.title": "Ты проиграл",
2380 2407 "gameover.detail": "Все столбцы заблокированы.",
@@ -2563,10 +2590,18 @@
2563 2590 "reward.won": "Победа!",
2564 2591 "reward.lost": "Поражение...",
2565 2592 "reward.total": "Всего очков",
2566 "reward.continue": "Нажмите, чтобы продолжить"
2593 "reward.continue": "Нажмите, чтобы продолжить",
2594 "game.menu": "Меню",
2595 "game.paused": "Пауза",
2596 "game.resume": "Продолжить",
2597 "game.backToMenu": "В главное меню",
2598 "reward.ended": "Игра окончена",
2599 "offline.defeated.one": "{n} противник побеждён",
2600 "offline.defeated.few": "{n} противника побеждено",
2601 "offline.defeated.many": "{n} противников побеждено",
2602 "offline.defeated.other": "{n} противников побеждено"
2567 2603 },
2568 2604 "es": {
2569 "menu.tagline": "Tres en raya, y tus bloques ganan motores cohete.",
2570 2605 "menu.play": "Jugar",
2571 2606 "menu.offline": "Combate sin conexión",
2572 2607 "menu.online": "Jugar en línea",
@@ -2581,7 +2616,6 @@
2581 2616 "menu.logout": "Cerrar sesión",
2582 2617 "menu.player": "jugador",
2583 2618 "planet.title": "Elige un campo",
2584 "planet.tagline": "Cada campo es un planeta, con su pueblo, gravedad, aire y masa.",
2585 2619 "planet.back": "Volver",
2586 2620 "planet.customBadge": "Tuya",
2587 2621 "stats.powerLabel": "Potencia",
@@ -2616,7 +2650,7 @@
2616 2650 "online.you": "tú",
2617 2651 "designer.title": "Diseñador de planetas",
2618 2652 "designer.taglineBefore": "Total:",
2619 "designer.taglineAfter": "puntos. Desbloqueas bloques al ganar puntos; no los gastas.",
2653 "designer.taglineAfter": "puntos.",
2620 2654 "designer.empty": "Aún no tienes planetas propios. Crea uno.",
2621 2655 "designer.new": "Nuevo planeta",
2622 2656 "designer.editTitle": "Editar planeta",
@@ -2647,19 +2681,16 @@
2647 2681 "designer.defaultPeople": "Pueblo",
2648 2682 "hud.points": "Puntos",
2649 2683 "hud.round": "Ronda {n}",
2650 "hud.skill": "Nivel {n} %",
2651 2684 "hud.out": "Fuera",
2652 2685 "hud.miniPoints": "Puntos {n}",
2653 2686 "hud.opponent.one": "rival",
2654 2687 "hud.opponent.few": "rivales",
2655 2688 "hud.opponent.many": "rivales",
2656 2689 "hud.opponent.other": "rivales",
2657 "hud.opponentsLine": "{n} {word}",
2658 2690 "offline.resultTitle": "Combate sin conexión",
2659 2691 "offline.reachedBefore": "Has llegado a la ronda",
2660 2692 "offline.reachedAfter": ".",
2661 2693 "offline.reached": "Has llegado a la ronda {n}.",
2662 "offline.detail": "Jugaste contra {n} {opponents} con un nivel del {skill} %.",
2663 2694 "offline.backMenu": "Volver al menú",
2664 2695 "gameover.title": "Has perdido",
2665 2696 "gameover.detail": "Todas las columnas están bloqueadas.",
@@ -2848,7 +2879,16 @@
2848 2879 "reward.won": "¡Has ganado!",
2849 2880 "reward.lost": "Has perdido...",
2850 2881 "reward.total": "Puntos totales",
2851 "reward.continue": "Toca para continuar"
2882 "reward.continue": "Toca para continuar",
2883 "game.menu": "Menú",
2884 "game.paused": "En pausa",
2885 "game.resume": "Continuar",
2886 "game.backToMenu": "Volver al menú principal",
2887 "reward.ended": "Partida terminada",
2888 "offline.defeated.one": "{n} rival derrotado",
2889 "offline.defeated.few": "{n} rivales derrotados",
2890 "offline.defeated.many": "{n} rivales derrotados",
2891 "offline.defeated.other": "{n} rivales derrotados"
2852 2892 }
2853 2893 },
2854 2894 "errors": {
@@ -1,7 +1,6 @@
1{
1{
2 "locales": {
2 "locales": {
3 "en": {
3 "en": {
4 "menu.tagline": "Three in a row, and your blocks get rocket boosters.",
5 "menu.play": "Play",
4 "menu.play": "Play",
6 "menu.offline": "Offline Battle",
5 "menu.offline": "Offline Battle",
7 "menu.online": "Play online",
6 "menu.online": "Play online",
@@ -16,7 +15,6 @@
16 "menu.logout": "Log out",
15 "menu.logout": "Log out",
17 "menu.player": "player",
16 "menu.player": "player",
18 "planet.title": "Choose a field",
17 "planet.title": "Choose a field",
19 "planet.tagline": "Each field is a planet, with its own people, gravity, air and mass.",
20 "planet.back": "Back",
18 "planet.back": "Back",
21 "planet.customBadge": "Yours",
19 "planet.customBadge": "Yours",
22 "stats.powerLabel": "Power",
20 "stats.powerLabel": "Power",
@@ -51,7 +49,7 @@
51 "online.you": "you",
49 "online.you": "you",
52 "designer.title": "Planet Designer",
50 "designer.title": "Planet Designer",
53 "designer.taglineBefore": "Total:",
51 "designer.taglineBefore": "Total:",
54 "designer.taglineAfter": "points. You unlock blocks by earning points — you do not spend them.",
52 "designer.taglineAfter": "points.",
55 "designer.empty": "You don’t have any planets of your own yet. Create one.",
53 "designer.empty": "You don’t have any planets of your own yet. Create one.",
56 "designer.new": "New planet",
54 "designer.new": "New planet",
57 "designer.editTitle": "Edit planet",
55 "designer.editTitle": "Edit planet",
@@ -82,19 +80,16 @@
82 "designer.defaultPeople": "People",
80 "designer.defaultPeople": "People",
83 "hud.points": "Points",
81 "hud.points": "Points",
84 "hud.round": "Round {n}",
82 "hud.round": "Round {n}",
85 "hud.skill": "Skill {n}%",
86 "hud.out": "Out",
83 "hud.out": "Out",
87 "hud.miniPoints": "Points {n}",
84 "hud.miniPoints": "Points {n}",
88 "hud.opponent.one": "opponent",
85 "hud.opponent.one": "opponent",
89 "hud.opponent.few": "opponents",
86 "hud.opponent.few": "opponents",
90 "hud.opponent.many": "opponents",
87 "hud.opponent.many": "opponents",
91 "hud.opponent.other": "opponents",
88 "hud.opponent.other": "opponents",
92 "hud.opponentsLine": "{n} {word}",
93 "offline.resultTitle": "Offline Battle",
89 "offline.resultTitle": "Offline Battle",
94 "offline.reachedBefore": "You reached round",
90 "offline.reachedBefore": "You reached round",
95 "offline.reachedAfter": ".",
91 "offline.reachedAfter": ".",
96 "offline.reached": "You reached round {n}.",
92 "offline.reached": "You reached round {n}.",
97 "offline.detail": "You played against {n} {opponents} at skill {skill}%.",
98 "offline.backMenu": "Back to the menu",
93 "offline.backMenu": "Back to the menu",
99 "gameover.title": "You lost",
94 "gameover.title": "You lost",
100 "gameover.detail": "Every column is locked.",
95 "gameover.detail": "Every column is locked.",
@@ -283,10 +278,18 @@
283 "reward.won": "You won!",
278 "reward.won": "You won!",
284 "reward.lost": "You lost...",
279 "reward.lost": "You lost...",
285 "reward.total": "Total points",
280 "reward.total": "Total points",
286 "reward.continue": "Tap to continue"
281 "reward.continue": "Tap to continue",
282 "game.menu": "Menu",
283 "game.paused": "Paused",
284 "game.resume": "Resume",
285 "game.backToMenu": "Back to main menu",
286 "reward.ended": "Game ended",
287 "offline.defeated.one": "{n} opponent defeated",
288 "offline.defeated.few": "{n} opponents defeated",
289 "offline.defeated.many": "{n} opponents defeated",
290 "offline.defeated.other": "{n} opponents defeated"
287 },
291 },
288 "nl": {
292 "nl": {
289 "menu.tagline": "Drie op een rij, en je blokjes krijgen raketmotoren.",
290 "menu.play": "Spelen",
293 "menu.play": "Spelen",
291 "menu.offline": "Offline Strijd",
294 "menu.offline": "Offline Strijd",
292 "menu.online": "Online spelen",
295 "menu.online": "Online spelen",
@@ -301,7 +304,6 @@
301 "menu.logout": "Uitloggen",
304 "menu.logout": "Uitloggen",
302 "menu.player": "speler",
305 "menu.player": "speler",
303 "planet.title": "Kies een veld",
306 "planet.title": "Kies een veld",
304 "planet.tagline": "Elk veld is een planeet, met een eigen volk, zwaartekracht, lucht en massa.",
305 "planet.back": "Terug",
307 "planet.back": "Terug",
306 "planet.customBadge": "Eigen",
308 "planet.customBadge": "Eigen",
307 "stats.powerLabel": "Power",
309 "stats.powerLabel": "Power",
@@ -336,7 +338,7 @@
336 "online.you": "jij",
338 "online.you": "jij",
337 "designer.title": "Planeetontwerper",
339 "designer.title": "Planeetontwerper",
338 "designer.taglineBefore": "Totaal:",
340 "designer.taglineBefore": "Totaal:",
339 "designer.taglineAfter": "punten. Blokjes ontgrendel je door punten te verdienen — je geeft ze niet uit.",
341 "designer.taglineAfter": "punten.",
340 "designer.empty": "Je hebt nog geen eigen planeten. Maak er een aan.",
342 "designer.empty": "Je hebt nog geen eigen planeten. Maak er een aan.",
341 "designer.new": "Nieuwe planeet",
343 "designer.new": "Nieuwe planeet",
342 "designer.editTitle": "Planeet bewerken",
344 "designer.editTitle": "Planeet bewerken",
@@ -367,19 +369,16 @@
367 "designer.defaultPeople": "Volk",
369 "designer.defaultPeople": "Volk",
368 "hud.points": "Punten",
370 "hud.points": "Punten",
369 "hud.round": "Ronde {n}",
371 "hud.round": "Ronde {n}",
370 "hud.skill": "Skill {n}%",
371 "hud.out": "Uit",
372 "hud.out": "Uit",
372 "hud.miniPoints": "Punten {n}",
373 "hud.miniPoints": "Punten {n}",
373 "hud.opponent.one": "tegenstander",
374 "hud.opponent.one": "tegenstander",
374 "hud.opponent.few": "tegenstanders",
375 "hud.opponent.few": "tegenstanders",
375 "hud.opponent.many": "tegenstanders",
376 "hud.opponent.many": "tegenstanders",
376 "hud.opponent.other": "tegenstanders",
377 "hud.opponent.other": "tegenstanders",
377 "hud.opponentsLine": "{n} {word}",
378 "offline.resultTitle": "Offline Strijd",
378 "offline.resultTitle": "Offline Strijd",
379 "offline.reachedBefore": "Je hebt ronde",
379 "offline.reachedBefore": "Je hebt ronde",
380 "offline.reachedAfter": " bereikt.",
380 "offline.reachedAfter": " bereikt.",
381 "offline.reached": "Je hebt ronde {n} bereikt.",
381 "offline.reached": "Je hebt ronde {n} bereikt.",
382 "offline.detail": "Je speelde tegen {n} {opponents} met skill {skill}%.",
383 "offline.backMenu": "Terug naar het menu",
382 "offline.backMenu": "Terug naar het menu",
384 "gameover.title": "Je hebt verloren",
383 "gameover.title": "Je hebt verloren",
385 "gameover.detail": "Alle kolommen zitten vast.",
384 "gameover.detail": "Alle kolommen zitten vast.",
@@ -568,10 +567,18 @@
568 "reward.won": "Gewonnen!",
567 "reward.won": "Gewonnen!",
569 "reward.lost": "Verloren...",
568 "reward.lost": "Verloren...",
570 "reward.total": "Totaal punten",
569 "reward.total": "Totaal punten",
571 "reward.continue": "Tik om verder te gaan"
570 "reward.continue": "Tik om verder te gaan",
571 "game.menu": "Menu",
572 "game.paused": "Gepauzeerd",
573 "game.resume": "Verder spelen",
574 "game.backToMenu": "Terug naar hoofdmenu",
575 "reward.ended": "Spel gestopt",
576 "offline.defeated.one": "{n} tegenstander verslagen",
577 "offline.defeated.few": "{n} tegenstanders verslagen",
578 "offline.defeated.many": "{n} tegenstanders verslagen",
579 "offline.defeated.other": "{n} tegenstanders verslagen"
572 },
580 },
573 "de": {
581 "de": {
574 "menu.tagline": "Drei in einer Reihe — und deine Blöcke bekommen Raketenantrieb.",
575 "menu.play": "Spielen",
582 "menu.play": "Spielen",
576 "menu.offline": "Offline-Kampf",
583 "menu.offline": "Offline-Kampf",
577 "menu.online": "Online spielen",
584 "menu.online": "Online spielen",
@@ -586,7 +593,6 @@
586 "menu.logout": "Abmelden",
593 "menu.logout": "Abmelden",
587 "menu.player": "Spieler",
594 "menu.player": "Spieler",
588 "planet.title": "Wähle ein Feld",
595 "planet.title": "Wähle ein Feld",
589 "planet.tagline": "Jedes Feld ist ein Planet mit eigenem Volk, eigener Schwerkraft, Luft und Masse.",
590 "planet.back": "Zurück",
596 "planet.back": "Zurück",
591 "planet.customBadge": "Eigene",
597 "planet.customBadge": "Eigene",
592 "stats.powerLabel": "Power",
598 "stats.powerLabel": "Power",
@@ -621,7 +627,7 @@
621 "online.you": "du",
627 "online.you": "du",
622 "designer.title": "Planeten-Designer",
628 "designer.title": "Planeten-Designer",
623 "designer.taglineBefore": "Gesamt:",
629 "designer.taglineBefore": "Gesamt:",
624 "designer.taglineAfter": "Punkte. Blöcke schaltest du frei, indem du Punkte verdienst — du gibst sie nicht aus.",
630 "designer.taglineAfter": "Punkte.",
625 "designer.empty": "Du hast noch keine eigenen Planeten. Erstelle einen.",
631 "designer.empty": "Du hast noch keine eigenen Planeten. Erstelle einen.",
626 "designer.new": "Neuer Planet",
632 "designer.new": "Neuer Planet",
627 "designer.editTitle": "Planet bearbeiten",
633 "designer.editTitle": "Planet bearbeiten",
@@ -652,19 +658,16 @@
652 "designer.defaultPeople": "Volk",
658 "designer.defaultPeople": "Volk",
653 "hud.points": "Punkte",
659 "hud.points": "Punkte",
654 "hud.round": "Runde {n}",
660 "hud.round": "Runde {n}",
655 "hud.skill": "Können {n} %",
656 "hud.out": "Raus",
661 "hud.out": "Raus",
657 "hud.miniPoints": "Punkte {n}",
662 "hud.miniPoints": "Punkte {n}",
658 "hud.opponent.one": "Gegner",
663 "hud.opponent.one": "Gegner",
659 "hud.opponent.few": "Gegner",
664 "hud.opponent.few": "Gegner",
660 "hud.opponent.many": "Gegner",
665 "hud.opponent.many": "Gegner",
661 "hud.opponent.other": "Gegner",
666 "hud.opponent.other": "Gegner",
662 "hud.opponentsLine": "{n} {word}",
663 "offline.resultTitle": "Offline-Kampf",
667 "offline.resultTitle": "Offline-Kampf",
664 "offline.reachedBefore": "Du hast Runde",
668 "offline.reachedBefore": "Du hast Runde",
665 "offline.reachedAfter": " erreicht.",
669 "offline.reachedAfter": " erreicht.",
666 "offline.reached": "Du hast Runde {n} erreicht.",
670 "offline.reached": "Du hast Runde {n} erreicht.",
667 "offline.detail": "Du hast gegen {n} {opponents} mit Können {skill} % gespielt.",
668 "offline.backMenu": "Zurück zum Menü",
671 "offline.backMenu": "Zurück zum Menü",
669 "gameover.title": "Du hast verloren",
672 "gameover.title": "Du hast verloren",
670 "gameover.detail": "Alle Spalten sind festgesetzt.",
673 "gameover.detail": "Alle Spalten sind festgesetzt.",
@@ -853,10 +856,18 @@
853 "reward.won": "Gewonnen!",
856 "reward.won": "Gewonnen!",
854 "reward.lost": "Verloren...",
857 "reward.lost": "Verloren...",
855 "reward.total": "Punkte gesamt",
858 "reward.total": "Punkte gesamt",
856 "reward.continue": "Tippen zum Fortfahren"
859 "reward.continue": "Tippen zum Fortfahren",
860 "game.menu": "Menü",
861 "game.paused": "Pausiert",
862 "game.resume": "Weiterspielen",
863 "game.backToMenu": "Zurück zum Hauptmenü",
864 "reward.ended": "Spiel beendet",
865 "offline.defeated.one": "{n} Gegner besiegt",
866 "offline.defeated.few": "{n} Gegner besiegt",
867 "offline.defeated.many": "{n} Gegner besiegt",
868 "offline.defeated.other": "{n} Gegner besiegt"
857 },
869 },
858 "fr": {
870 "fr": {
859 "menu.tagline": "Trois d’affilée, et tes blocs s’équipent de propulseurs.",
860 "menu.play": "Jouer",
871 "menu.play": "Jouer",
861 "menu.offline": "Combat hors ligne",
872 "menu.offline": "Combat hors ligne",
862 "menu.online": "Jouer en ligne",
873 "menu.online": "Jouer en ligne",
@@ -871,7 +882,6 @@
871 "menu.logout": "Déconnexion",
882 "menu.logout": "Déconnexion",
872 "menu.player": "joueur",
883 "menu.player": "joueur",
873 "planet.title": "Choisis un terrain",
884 "planet.title": "Choisis un terrain",
874 "planet.tagline": "Chaque terrain est une planète, avec son peuple, sa gravité, son air et sa masse.",
875 "planet.back": "Retour",
885 "planet.back": "Retour",
876 "planet.customBadge": "Perso",
886 "planet.customBadge": "Perso",
877 "stats.powerLabel": "Puissance",
887 "stats.powerLabel": "Puissance",
@@ -906,7 +916,7 @@
906 "online.you": "toi",
916 "online.you": "toi",
907 "designer.title": "Concepteur de planètes",
917 "designer.title": "Concepteur de planètes",
908 "designer.taglineBefore": "Total :",
918 "designer.taglineBefore": "Total :",
909 "designer.taglineAfter": "points. Tu débloques des blocs en gagnant des points — tu ne les dépenses pas.",
919 "designer.taglineAfter": "points.",
910 "designer.empty": "Tu n’as pas encore de planète à toi. Crées-en une.",
920 "designer.empty": "Tu n’as pas encore de planète à toi. Crées-en une.",
911 "designer.new": "Nouvelle planète",
921 "designer.new": "Nouvelle planète",
912 "designer.editTitle": "Modifier la planète",
922 "designer.editTitle": "Modifier la planète",
@@ -937,19 +947,16 @@
937 "designer.defaultPeople": "Peuple",
947 "designer.defaultPeople": "Peuple",
938 "hud.points": "Points",
948 "hud.points": "Points",
939 "hud.round": "Manche {n}",
949 "hud.round": "Manche {n}",
940 "hud.skill": "Niveau {n} %",
941 "hud.out": "Éliminé",
950 "hud.out": "Éliminé",
942 "hud.miniPoints": "Points {n}",
951 "hud.miniPoints": "Points {n}",
943 "hud.opponent.one": "adversaire",
952 "hud.opponent.one": "adversaire",
944 "hud.opponent.few": "adversaires",
953 "hud.opponent.few": "adversaires",
945 "hud.opponent.many": "adversaires",
954 "hud.opponent.many": "adversaires",
946 "hud.opponent.other": "adversaires",
955 "hud.opponent.other": "adversaires",
947 "hud.opponentsLine": "{n} {word}",
948 "offline.resultTitle": "Combat hors ligne",
956 "offline.resultTitle": "Combat hors ligne",
949 "offline.reachedBefore": "Tu as atteint la manche",
957 "offline.reachedBefore": "Tu as atteint la manche",
950 "offline.reachedAfter": ".",
958 "offline.reachedAfter": ".",
951 "offline.reached": "Tu as atteint la manche {n}.",
959 "offline.reached": "Tu as atteint la manche {n}.",
952 "offline.detail": "Tu as joué contre {n} {opponents} au niveau {skill} %.",
953 "offline.backMenu": "Retour au menu",
960 "offline.backMenu": "Retour au menu",
954 "gameover.title": "Tu as perdu",
961 "gameover.title": "Tu as perdu",
955 "gameover.detail": "Toutes les colonnes sont bloquées.",
962 "gameover.detail": "Toutes les colonnes sont bloquées.",
@@ -1138,10 +1145,18 @@
1138 "reward.won": "Victoire !",
1145 "reward.won": "Victoire !",
1139 "reward.lost": "Perdu...",
1146 "reward.lost": "Perdu...",
1140 "reward.total": "Total des points",
1147 "reward.total": "Total des points",
1141 "reward.continue": "Touchez pour continuer"
1148 "reward.continue": "Touchez pour continuer",
1149 "game.menu": "Menu",
1150 "game.paused": "En pause",
1151 "game.resume": "Reprendre",
1152 "game.backToMenu": "Retour au menu principal",
1153 "reward.ended": "Partie terminée",
1154 "offline.defeated.one": "{n} adversaire vaincu",
1155 "offline.defeated.few": "{n} adversaires vaincus",
1156 "offline.defeated.many": "{n} adversaires vaincus",
1157 "offline.defeated.other": "{n} adversaires vaincus"
1142 },
1158 },
1143 "ja": {
1159 "ja": {
1144 "menu.tagline": "三つ揃えると、ブロックにロケットが点火します。",
1145 "menu.play": "プレイ",
1160 "menu.play": "プレイ",
1146 "menu.offline": "オフライン対戦",
1161 "menu.offline": "オフライン対戦",
1147 "menu.online": "オンラインで遊ぶ",
1162 "menu.online": "オンラインで遊ぶ",
@@ -1156,7 +1171,6 @@
1156 "menu.logout": "ログアウト",
1171 "menu.logout": "ログアウト",
1157 "menu.player": "プレイヤー",
1172 "menu.player": "プレイヤー",
1158 "planet.title": "フィールドを選ぶ",
1173 "planet.title": "フィールドを選ぶ",
1159 "planet.tagline": "各フィールドは惑星です。固有の民、重力、大気、質量を持ちます。",
1160 "planet.back": "戻る",
1174 "planet.back": "戻る",
1161 "planet.customBadge": "自作",
1175 "planet.customBadge": "自作",
1162 "stats.powerLabel": "パワー",
1176 "stats.powerLabel": "パワー",
@@ -1191,7 +1205,7 @@
1191 "online.you": "あなた",
1205 "online.you": "あなた",
1192 "designer.title": "惑星デザイナー",
1206 "designer.title": "惑星デザイナー",
1193 "designer.taglineBefore": "合計:",
1207 "designer.taglineBefore": "合計:",
1194 "designer.taglineAfter": "ポイント。ポイントを獲得するとブロックが解放されます。消費はしません。",
1208 "designer.taglineAfter": "ポイント。",
1195 "designer.empty": "まだ自分の惑星がありません。新しく作ってみましょう。",
1209 "designer.empty": "まだ自分の惑星がありません。新しく作ってみましょう。",
1196 "designer.new": "新しい惑星",
1210 "designer.new": "新しい惑星",
1197 "designer.editTitle": "惑星を編集",
1211 "designer.editTitle": "惑星を編集",
@@ -1222,19 +1236,16 @@
1222 "designer.defaultPeople": "民",
1236 "designer.defaultPeople": "民",
1223 "hud.points": "ポイント",
1237 "hud.points": "ポイント",
1224 "hud.round": "ラウンド {n}",
1238 "hud.round": "ラウンド {n}",
1225 "hud.skill": "スキル {n}%",
1226 "hud.out": "脱落",
1239 "hud.out": "脱落",
1227 "hud.miniPoints": "ポイント {n}",
1240 "hud.miniPoints": "ポイント {n}",
1228 "hud.opponent.one": "相手",
1241 "hud.opponent.one": "相手",
1229 "hud.opponent.few": "相手",
1242 "hud.opponent.few": "相手",
1230 "hud.opponent.many": "相手",
1243 "hud.opponent.many": "相手",
1231 "hud.opponent.other": "相手",
1244 "hud.opponent.other": "相手",
1232 "hud.opponentsLine": "{word} {n} 人",
1233 "offline.resultTitle": "オフライン対戦",
1245 "offline.resultTitle": "オフライン対戦",
1234 "offline.reachedBefore": "到達ラウンド:",
1246 "offline.reachedBefore": "到達ラウンド:",
1235 "offline.reachedAfter": "。",
1247 "offline.reachedAfter": "。",
1236 "offline.reached": "ラウンド {n} まで到達しました。",
1248 "offline.reached": "ラウンド {n} まで到達しました。",
1237 "offline.detail": "スキル {skill}% の{opponents}{n}人と対戦しました。",
1238 "offline.backMenu": "メニューに戻る",
1249 "offline.backMenu": "メニューに戻る",
1239 "gameover.title": "負けました",
1250 "gameover.title": "負けました",
1240 "gameover.detail": "すべての列がロックされました。",
1251 "gameover.detail": "すべての列がロックされました。",
@@ -1423,10 +1434,18 @@
1423 "reward.won": "勝利!",
1434 "reward.won": "勝利!",
1424 "reward.lost": "敗北...",
1435 "reward.lost": "敗北...",
1425 "reward.total": "合計ポイント",
1436 "reward.total": "合計ポイント",
1426 "reward.continue": "タップして続ける"
1437 "reward.continue": "タップして続ける",
1438 "game.menu": "メニュー",
1439 "game.paused": "一時停止中",
1440 "game.resume": "再開",
1441 "game.backToMenu": "メインメニューに戻る",
1442 "reward.ended": "ゲーム終了",
1443 "offline.defeated.one": "{n}人の相手を倒した",
1444 "offline.defeated.few": "{n}人の相手を倒した",
1445 "offline.defeated.many": "{n}人の相手を倒した",
1446 "offline.defeated.other": "{n}人の相手を倒した"
1427 },
1447 },
1428 "zh": {
1448 "zh": {
1429 "menu.tagline": "三个一排,你的方块就会装上火箭。",
1430 "menu.play": "开始游戏",
1449 "menu.play": "开始游戏",
1431 "menu.offline": "离线对战",
1450 "menu.offline": "离线对战",
1432 "menu.online": "在线游戏",
1451 "menu.online": "在线游戏",
@@ -1441,7 +1460,6 @@
1441 "menu.logout": "退出",
1460 "menu.logout": "退出",
1442 "menu.player": "玩家",
1461 "menu.player": "玩家",
1443 "planet.title": "选择场地",
1462 "planet.title": "选择场地",
1444 "planet.tagline": "每块场地都是一颗星球,有自己的居民、重力、空气和质量。",
1445 "planet.back": "返回",
1463 "planet.back": "返回",
1446 "planet.customBadge": "自制",
1464 "planet.customBadge": "自制",
1447 "stats.powerLabel": "力量",
1465 "stats.powerLabel": "力量",
@@ -1476,7 +1494,7 @@
1476 "online.you": "你",
1494 "online.you": "你",
1477 "designer.title": "星球设计器",
1495 "designer.title": "星球设计器",
1478 "designer.taglineBefore": "总分:",
1496 "designer.taglineBefore": "总分:",
1479 "designer.taglineAfter": "分。通过得分解锁方块——分数不会被消耗。",
1497 "designer.taglineAfter": "分。",
1480 "designer.empty": "你还没有自己的星球。来创建一个吧。",
1498 "designer.empty": "你还没有自己的星球。来创建一个吧。",
1481 "designer.new": "新星球",
1499 "designer.new": "新星球",
1482 "designer.editTitle": "编辑星球",
1500 "designer.editTitle": "编辑星球",
@@ -1507,19 +1525,16 @@
1507 "designer.defaultPeople": "居民",
1525 "designer.defaultPeople": "居民",
1508 "hud.points": "分数",
1526 "hud.points": "分数",
1509 "hud.round": "第 {n} 轮",
1527 "hud.round": "第 {n} 轮",
1510 "hud.skill": "水平 {n}%",
1511 "hud.out": "出局",
1528 "hud.out": "出局",
1512 "hud.miniPoints": "分数 {n}",
1529 "hud.miniPoints": "分数 {n}",
1513 "hud.opponent.one": "对手",
1530 "hud.opponent.one": "对手",
1514 "hud.opponent.few": "对手",
1531 "hud.opponent.few": "对手",
1515 "hud.opponent.many": "对手",
1532 "hud.opponent.many": "对手",
1516 "hud.opponent.other": "对手",
1533 "hud.opponent.other": "对手",
1517 "hud.opponentsLine": "{n} 名{word}",
1518 "offline.resultTitle": "离线对战",
1534 "offline.resultTitle": "离线对战",
1519 "offline.reachedBefore": "你到达了第",
1535 "offline.reachedBefore": "你到达了第",
1520 "offline.reachedAfter": " 轮。",
1536 "offline.reachedAfter": " 轮。",
1521 "offline.reached": "你到达了第 {n} 轮。",
1537 "offline.reached": "你到达了第 {n} 轮。",
1522 "offline.detail": "你以 {skill}% 的水平对战了 {n} 名{opponents}。",
1523 "offline.backMenu": "返回菜单",
1538 "offline.backMenu": "返回菜单",
1524 "gameover.title": "你输了",
1539 "gameover.title": "你输了",
1525 "gameover.detail": "所有列都已锁定。",
1540 "gameover.detail": "所有列都已锁定。",
@@ -1708,10 +1723,18 @@
1708 "reward.won": "你赢了!",
1723 "reward.won": "你赢了!",
1709 "reward.lost": "你输了...",
1724 "reward.lost": "你输了...",
1710 "reward.total": "总积分",
1725 "reward.total": "总积分",
1711 "reward.continue": "点击继续"
1726 "reward.continue": "点击继续",
1727 "game.menu": "菜单",
1728 "game.paused": "已暂停",
1729 "game.resume": "继续游戏",
1730 "game.backToMenu": "返回主菜单",
1731 "reward.ended": "游戏结束",
1732 "offline.defeated.one": "击败了 {n} 名对手",
1733 "offline.defeated.few": "击败了 {n} 名对手",
1734 "offline.defeated.many": "击败了 {n} 名对手",
1735 "offline.defeated.other": "击败了 {n} 名对手"
1712 },
1736 },
1713 "ko": {
1737 "ko": {
1714 "menu.tagline": "세 개를 나란히 맞추면 블록에 로켓이 점화됩니다.",
1715 "menu.play": "플레이",
1738 "menu.play": "플레이",
1716 "menu.offline": "오프라인 대결",
1739 "menu.offline": "오프라인 대결",
1717 "menu.online": "온라인 플레이",
1740 "menu.online": "온라인 플레이",
@@ -1726,7 +1749,6 @@
1726 "menu.logout": "로그아웃",
1749 "menu.logout": "로그아웃",
1727 "menu.player": "플레이어",
1750 "menu.player": "플레이어",
1728 "planet.title": "필드 선택",
1751 "planet.title": "필드 선택",
1729 "planet.tagline": "각 필드는 행성입니다. 고유한 주민, 중력, 공기, 질량을 가집니다.",
1730 "planet.back": "뒤로",
1752 "planet.back": "뒤로",
1731 "planet.customBadge": "내 것",
1753 "planet.customBadge": "내 것",
1732 "stats.powerLabel": "파워",
1754 "stats.powerLabel": "파워",
@@ -1761,7 +1783,7 @@
1761 "online.you": "나",
1783 "online.you": "나",
1762 "designer.title": "행성 디자이너",
1784 "designer.title": "행성 디자이너",
1763 "designer.taglineBefore": "합계:",
1785 "designer.taglineBefore": "합계:",
1764 "designer.taglineAfter": "점. 점수를 모으면 블록이 해금됩니다. 점수를 쓰지는 않습니다.",
1786 "designer.taglineAfter": "점.",
1765 "designer.empty": "아직 내 행성이 없습니다. 하나 만들어 보세요.",
1787 "designer.empty": "아직 내 행성이 없습니다. 하나 만들어 보세요.",
1766 "designer.new": "새 행성",
1788 "designer.new": "새 행성",
1767 "designer.editTitle": "행성 편집",
1789 "designer.editTitle": "행성 편집",
@@ -1792,19 +1814,16 @@
1792 "designer.defaultPeople": "주민",
1814 "designer.defaultPeople": "주민",
1793 "hud.points": "점수",
1815 "hud.points": "점수",
1794 "hud.round": "{n}라운드",
1816 "hud.round": "{n}라운드",
1795 "hud.skill": "숙련도 {n}%",
1796 "hud.out": "탈락",
1817 "hud.out": "탈락",
1797 "hud.miniPoints": "점수 {n}",
1818 "hud.miniPoints": "점수 {n}",
1798 "hud.opponent.one": "상대",
1819 "hud.opponent.one": "상대",
1799 "hud.opponent.few": "상대",
1820 "hud.opponent.few": "상대",
1800 "hud.opponent.many": "상대",
1821 "hud.opponent.many": "상대",
1801 "hud.opponent.other": "상대",
1822 "hud.opponent.other": "상대",
1802 "hud.opponentsLine": "{word} {n}명",
1803 "offline.resultTitle": "오프라인 대결",
1823 "offline.resultTitle": "오프라인 대결",
1804 "offline.reachedBefore": "도달한 라운드:",
1824 "offline.reachedBefore": "도달한 라운드:",
1805 "offline.reachedAfter": ".",
1825 "offline.reachedAfter": ".",
1806 "offline.reached": "{n}라운드까지 도달했습니다.",
1826 "offline.reached": "{n}라운드까지 도달했습니다.",
1807 "offline.detail": "숙련도 {skill}%의 {opponents} {n}명과 대결했습니다.",
1808 "offline.backMenu": "메뉴로 돌아가기",
1827 "offline.backMenu": "메뉴로 돌아가기",
1809 "gameover.title": "패배했습니다",
1828 "gameover.title": "패배했습니다",
1810 "gameover.detail": "모든 열이 잠겼습니다.",
1829 "gameover.detail": "모든 열이 잠겼습니다.",
@@ -1993,10 +2012,18 @@
1993 "reward.won": "승리!",
2012 "reward.won": "승리!",
1994 "reward.lost": "패배...",
2013 "reward.lost": "패배...",
1995 "reward.total": "총 포인트",
2014 "reward.total": "총 포인트",
1996 "reward.continue": "탭하여 계속"
2015 "reward.continue": "탭하여 계속",
2016 "game.menu": "메뉴",
2017 "game.paused": "일시정지",
2018 "game.resume": "계속하기",
2019 "game.backToMenu": "메인 메뉴로 돌아가기",
2020 "reward.ended": "게임 종료",
2021 "offline.defeated.one": "상대 {n}명 격파",
2022 "offline.defeated.few": "상대 {n}명 격파",
2023 "offline.defeated.many": "상대 {n}명 격파",
2024 "offline.defeated.other": "상대 {n}명 격파"
1997 },
2025 },
1998 "pl": {
2026 "pl": {
1999 "menu.tagline": "Trzy w rzędzie, a twoje klocki dostają napęd rakietowy.",
2000 "menu.play": "Graj",
2027 "menu.play": "Graj",
2001 "menu.offline": "Walka offline",
2028 "menu.offline": "Walka offline",
2002 "menu.online": "Graj online",
2029 "menu.online": "Graj online",
@@ -2011,7 +2038,6 @@
2011 "menu.logout": "Wyloguj się",
2038 "menu.logout": "Wyloguj się",
2012 "menu.player": "gracz",
2039 "menu.player": "gracz",
2013 "planet.title": "Wybierz pole",
2040 "planet.title": "Wybierz pole",
2014 "planet.tagline": "Każde pole to planeta, z własnym ludem, grawitacją, powietrzem i masą.",
2015 "planet.back": "Wstecz",
2041 "planet.back": "Wstecz",
2016 "planet.customBadge": "Twoja",
2042 "planet.customBadge": "Twoja",
2017 "stats.powerLabel": "Moc",
2043 "stats.powerLabel": "Moc",
@@ -2046,7 +2072,7 @@
2046 "online.you": "ty",
2072 "online.you": "ty",
2047 "designer.title": "Kreator planet",
2073 "designer.title": "Kreator planet",
2048 "designer.taglineBefore": "Suma:",
2074 "designer.taglineBefore": "Suma:",
2049 "designer.taglineAfter": "pkt. Odblokowujesz klocki, zdobywając punkty — nie wydajesz ich.",
2075 "designer.taglineAfter": "pkt.",
2050 "designer.empty": "Nie masz jeszcze własnych planet. Utwórz jedną.",
2076 "designer.empty": "Nie masz jeszcze własnych planet. Utwórz jedną.",
2051 "designer.new": "Nowa planeta",
2077 "designer.new": "Nowa planeta",
2052 "designer.editTitle": "Edytuj planetę",
2078 "designer.editTitle": "Edytuj planetę",
@@ -2077,19 +2103,16 @@
2077 "designer.defaultPeople": "Lud",
2103 "designer.defaultPeople": "Lud",
2078 "hud.points": "Punkty",
2104 "hud.points": "Punkty",
2079 "hud.round": "Runda {n}",
2105 "hud.round": "Runda {n}",
2080 "hud.skill": "Umiejętność {n}%",
2081 "hud.out": "Poza",
2106 "hud.out": "Poza",
2082 "hud.miniPoints": "Punkty {n}",
2107 "hud.miniPoints": "Punkty {n}",
2083 "hud.opponent.one": "przeciwnik",
2108 "hud.opponent.one": "przeciwnik",
2084 "hud.opponent.few": "przeciwników",
2109 "hud.opponent.few": "przeciwników",
2085 "hud.opponent.many": "przeciwników",
2110 "hud.opponent.many": "przeciwników",
2086 "hud.opponent.other": "przeciwników",
2111 "hud.opponent.other": "przeciwników",
2087 "hud.opponentsLine": "{n} {word}",
2088 "offline.resultTitle": "Walka offline",
2112 "offline.resultTitle": "Walka offline",
2089 "offline.reachedBefore": "Dotarłeś do rundy",
2113 "offline.reachedBefore": "Dotarłeś do rundy",
2090 "offline.reachedAfter": ".",
2114 "offline.reachedAfter": ".",
2091 "offline.reached": "Dotarłeś do rundy {n}.",
2115 "offline.reached": "Dotarłeś do rundy {n}.",
2092 "offline.detail": "Grałeś przeciwko {n} {opponents} przy umiejętności {skill}%.",
2093 "offline.backMenu": "Powrót do menu",
2116 "offline.backMenu": "Powrót do menu",
2094 "gameover.title": "Przegrałeś",
2117 "gameover.title": "Przegrałeś",
2095 "gameover.detail": "Wszystkie kolumny są zablokowane.",
2118 "gameover.detail": "Wszystkie kolumny są zablokowane.",
@@ -2278,10 +2301,18 @@
2278 "reward.won": "Wygrana!",
2301 "reward.won": "Wygrana!",
2279 "reward.lost": "Przegrana...",
2302 "reward.lost": "Przegrana...",
2280 "reward.total": "Suma punktów",
2303 "reward.total": "Suma punktów",
2281 "reward.continue": "Dotknij, aby kontynuować"
2304 "reward.continue": "Dotknij, aby kontynuować",
2305 "game.menu": "Menu",
2306 "game.paused": "Pauza",
2307 "game.resume": "Wznów",
2308 "game.backToMenu": "Powrót do menu głównego",
2309 "reward.ended": "Gra zakończona",
2310 "offline.defeated.one": "{n} pokonany przeciwnik",
2311 "offline.defeated.few": "{n} pokonanych przeciwników",
2312 "offline.defeated.many": "{n} pokonanych przeciwników",
2313 "offline.defeated.other": "{n} pokonanych przeciwników"
2282 },
2314 },
2283 "ru": {
2315 "ru": {
2284 "menu.tagline": "Три в ряд — и твои блоки получают ракетные двигатели.",
2285 "menu.play": "Играть",
2316 "menu.play": "Играть",
2286 "menu.offline": "Офлайн-бой",
2317 "menu.offline": "Офлайн-бой",
2287 "menu.online": "Играть онлайн",
2318 "menu.online": "Играть онлайн",
@@ -2296,7 +2327,6 @@
2296 "menu.logout": "Выйти",
2327 "menu.logout": "Выйти",
2297 "menu.player": "игрок",
2328 "menu.player": "игрок",
2298 "planet.title": "Выбери поле",
2329 "planet.title": "Выбери поле",
2299 "planet.tagline": "Каждое поле — это планета со своим народом, гравитацией, воздухом и массой.",
2300 "planet.back": "Назад",
2330 "planet.back": "Назад",
2301 "planet.customBadge": "Своя",
2331 "planet.customBadge": "Своя",
2302 "stats.powerLabel": "Мощность",
2332 "stats.powerLabel": "Мощность",
@@ -2331,7 +2361,7 @@
2331 "online.you": "ты",
2361 "online.you": "ты",
2332 "designer.title": "Конструктор планет",
2362 "designer.title": "Конструктор планет",
2333 "designer.taglineBefore": "Всего:",
2363 "designer.taglineBefore": "Всего:",
2334 "designer.taglineAfter": "очков. Блоки открываются за заработанные очки — тратить их не нужно.",
2364 "designer.taglineAfter": "очков.",
2335 "designer.empty": "У тебя ещё нет своих планет. Создай одну.",
2365 "designer.empty": "У тебя ещё нет своих планет. Создай одну.",
2336 "designer.new": "Новая планета",
2366 "designer.new": "Новая планета",
2337 "designer.editTitle": "Изменить планету",
2367 "designer.editTitle": "Изменить планету",
@@ -2362,19 +2392,16 @@
2362 "designer.defaultPeople": "Народ",
2392 "designer.defaultPeople": "Народ",
2363 "hud.points": "Очки",
2393 "hud.points": "Очки",
2364 "hud.round": "Раунд {n}",
2394 "hud.round": "Раунд {n}",
2365 "hud.skill": "Мастерство {n} %",
2366 "hud.out": "Вне",
2395 "hud.out": "Вне",
2367 "hud.miniPoints": "Очки {n}",
2396 "hud.miniPoints": "Очки {n}",
2368 "hud.opponent.one": "противник",
2397 "hud.opponent.one": "противник",
2369 "hud.opponent.few": "противника",
2398 "hud.opponent.few": "противника",
2370 "hud.opponent.many": "противников",
2399 "hud.opponent.many": "противников",
2371 "hud.opponent.other": "противников",
2400 "hud.opponent.other": "противников",
2372 "hud.opponentsLine": "{n} {word}",
2373 "offline.resultTitle": "Офлайн-бой",
2401 "offline.resultTitle": "Офлайн-бой",
2374 "offline.reachedBefore": "Ты дошёл до раунда",
2402 "offline.reachedBefore": "Ты дошёл до раунда",
2375 "offline.reachedAfter": ".",
2403 "offline.reachedAfter": ".",
2376 "offline.reached": "Ты дошёл до раунда {n}.",
2404 "offline.reached": "Ты дошёл до раунда {n}.",
2377 "offline.detail": "Ты играл против {n} {opponents} с мастерством {skill} %.",
2378 "offline.backMenu": "Вернуться в меню",
2405 "offline.backMenu": "Вернуться в меню",
2379 "gameover.title": "Ты проиграл",
2406 "gameover.title": "Ты проиграл",
2380 "gameover.detail": "Все столбцы заблокированы.",
2407 "gameover.detail": "Все столбцы заблокированы.",
@@ -2563,10 +2590,18 @@
2563 "reward.won": "Победа!",
2590 "reward.won": "Победа!",
2564 "reward.lost": "Поражение...",
2591 "reward.lost": "Поражение...",
2565 "reward.total": "Всего очков",
2592 "reward.total": "Всего очков",
2566 "reward.continue": "Нажмите, чтобы продолжить"
2593 "reward.continue": "Нажмите, чтобы продолжить",
2594 "game.menu": "Меню",
2595 "game.paused": "Пауза",
2596 "game.resume": "Продолжить",
2597 "game.backToMenu": "В главное меню",
2598 "reward.ended": "Игра окончена",
2599 "offline.defeated.one": "{n} противник побеждён",
2600 "offline.defeated.few": "{n} противника побеждено",
2601 "offline.defeated.many": "{n} противников побеждено",
2602 "offline.defeated.other": "{n} противников побеждено"
2567 },
2603 },
2568 "es": {
2604 "es": {
2569 "menu.tagline": "Tres en raya, y tus bloques ganan motores cohete.",
2570 "menu.play": "Jugar",
2605 "menu.play": "Jugar",
2571 "menu.offline": "Combate sin conexión",
2606 "menu.offline": "Combate sin conexión",
2572 "menu.online": "Jugar en línea",
2607 "menu.online": "Jugar en línea",
@@ -2581,7 +2616,6 @@
2581 "menu.logout": "Cerrar sesión",
2616 "menu.logout": "Cerrar sesión",
2582 "menu.player": "jugador",
2617 "menu.player": "jugador",
2583 "planet.title": "Elige un campo",
2618 "planet.title": "Elige un campo",
2584 "planet.tagline": "Cada campo es un planeta, con su pueblo, gravedad, aire y masa.",
2585 "planet.back": "Volver",
2619 "planet.back": "Volver",
2586 "planet.customBadge": "Tuya",
2620 "planet.customBadge": "Tuya",
2587 "stats.powerLabel": "Potencia",
2621 "stats.powerLabel": "Potencia",
@@ -2616,7 +2650,7 @@
2616 "online.you": "tú",
2650 "online.you": "tú",
2617 "designer.title": "Diseñador de planetas",
2651 "designer.title": "Diseñador de planetas",
2618 "designer.taglineBefore": "Total:",
2652 "designer.taglineBefore": "Total:",
2619 "designer.taglineAfter": "puntos. Desbloqueas bloques al ganar puntos; no los gastas.",
2653 "designer.taglineAfter": "puntos.",
2620 "designer.empty": "Aún no tienes planetas propios. Crea uno.",
2654 "designer.empty": "Aún no tienes planetas propios. Crea uno.",
2621 "designer.new": "Nuevo planeta",
2655 "designer.new": "Nuevo planeta",
2622 "designer.editTitle": "Editar planeta",
2656 "designer.editTitle": "Editar planeta",
@@ -2647,19 +2681,16 @@
2647 "designer.defaultPeople": "Pueblo",
2681 "designer.defaultPeople": "Pueblo",
2648 "hud.points": "Puntos",
2682 "hud.points": "Puntos",
2649 "hud.round": "Ronda {n}",
2683 "hud.round": "Ronda {n}",
2650 "hud.skill": "Nivel {n} %",
2651 "hud.out": "Fuera",
2684 "hud.out": "Fuera",
2652 "hud.miniPoints": "Puntos {n}",
2685 "hud.miniPoints": "Puntos {n}",
2653 "hud.opponent.one": "rival",
2686 "hud.opponent.one": "rival",
2654 "hud.opponent.few": "rivales",
2687 "hud.opponent.few": "rivales",
2655 "hud.opponent.many": "rivales",
2688 "hud.opponent.many": "rivales",
2656 "hud.opponent.other": "rivales",
2689 "hud.opponent.other": "rivales",
2657 "hud.opponentsLine": "{n} {word}",
2658 "offline.resultTitle": "Combate sin conexión",
2690 "offline.resultTitle": "Combate sin conexión",
2659 "offline.reachedBefore": "Has llegado a la ronda",
2691 "offline.reachedBefore": "Has llegado a la ronda",
2660 "offline.reachedAfter": ".",
2692 "offline.reachedAfter": ".",
2661 "offline.reached": "Has llegado a la ronda {n}.",
2693 "offline.reached": "Has llegado a la ronda {n}.",
2662 "offline.detail": "Jugaste contra {n} {opponents} con un nivel del {skill} %.",
2663 "offline.backMenu": "Volver al menú",
2694 "offline.backMenu": "Volver al menú",
2664 "gameover.title": "Has perdido",
2695 "gameover.title": "Has perdido",
2665 "gameover.detail": "Todas las columnas están bloqueadas.",
2696 "gameover.detail": "Todas las columnas están bloqueadas.",
@@ -2848,7 +2879,16 @@
2848 "reward.won": "¡Has ganado!",
2879 "reward.won": "¡Has ganado!",
2849 "reward.lost": "Has perdido...",
2880 "reward.lost": "Has perdido...",
2850 "reward.total": "Puntos totales",
2881 "reward.total": "Puntos totales",
2851 "reward.continue": "Toca para continuar"
2882 "reward.continue": "Toca para continuar",
2883 "game.menu": "Menú",
2884 "game.paused": "En pausa",
2885 "game.resume": "Continuar",
2886 "game.backToMenu": "Volver al menú principal",
2887 "reward.ended": "Partida terminada",
2888 "offline.defeated.one": "{n} rival derrotado",
2889 "offline.defeated.few": "{n} rivales derrotados",
2890 "offline.defeated.many": "{n} rivales derrotados",
2891 "offline.defeated.other": "{n} rivales derrotados"
2852 }
2892 }
2853 },
2893 },
2854 "errors": {
2894 "errors": {
server/tests/run.php +32 −0
@@ -29,6 +29,21 @@ $tmp = sys_get_temp_dir() . '/meteors-test-' . bin2hex(random_bytes(6));
29 29 mkdir($tmp, 0775, true);
30 30 putenv('METEORS_DATA_DIR=' . $tmp);
31 31
32 echo "Login return target (t1193)\n";
33 expect(loginReturnTarget(null) === 'menu', 'no return param → main menu');
34 expect(loginReturnTarget('') === 'menu', 'empty return → main menu');
35 expect(loginReturnTarget('online') === 'online', 'return=online → online play');
36 expect(loginReturnTarget('https://evil.example/') === 'menu', 'unknown/URL value → main menu (no open redirect)');
37 expect(loginReturnTarget(['online']) === 'menu', 'array value → main menu');
38 expect(loginReturnPath('menu') === 'index.html', 'menu path has no online flag');
39 expect(loginReturnPath(null) === 'index.html', 'missing session value → menu');
40 expect(loginReturnPath('online') === 'index.html?online=1', 'online path opens the online panel');
41 $cbSrc = (string) file_get_contents(dirname(__DIR__) . '/callback.php');
42 expect(strpos($cbSrc, "index.html?online=1'") === false, 'callback no longer hard-codes ?online=1');
43 expect(strpos($cbSrc, 'loginReturnPath(') !== false, 'callback uses loginReturnPath');
44 $authSrc = (string) file_get_contents(dirname(__DIR__) . '/auth.php');
45 expect(strpos($authSrc, "loginReturnTarget(\$_GET['return']") !== false, 'auth.php stores the return target');
46
32 47 echo "Store: lobby and game\n";
33 48 $store = Store::open($tmp);
34 49
@@ -418,6 +433,22 @@ expect($snap['owner_id'] === $u, 'owner_id set');
418 433
419 434 $listed = $ptsStore->listCustomPlanets($u);
420 435 expect(count($listed) === 1, 'owner lists the planet');
436
437 echo "Last chosen planet (t1196)\n";
438 expect($ptsStore->lastPlanet($u) === null, 'no last planet stored yet');
439 expect($ptsStore->profilePayload($u)['last_planet'] === null, 'payload last_planet null');
440 expect($ptsStore->setLastPlanet($u, 'terra') === 'terra', 'standard planet saved');
441 expect($ptsStore->lastPlanet($u) === 'terra', 'standard planet read back');
442 $ptsStore->setLastPlanet($u, $snap['id']);
443 expect($ptsStore->profilePayload($u)['last_planet'] === $snap['id'], 'own custom planet saved and in payload');
444 foreach (['', 'nope', str_repeat('x', 80)] as $bad) {
445 try { $ptsStore->setLastPlanet($u, $bad); expect(false, 'bad planet accepted: ' . $bad); }
446 catch (RuntimeException $e) { expect(true, 'bad planet refused: ' . substr($bad, 0, 8)); }
447 }
448 try { $ptsStore->setLastPlanet($v, $snap['id']); expect(false, 'other user may not pick my custom planet'); }
449 catch (RuntimeException $e) { expect(true, "someone else's custom planet refused"); }
450 expect($ptsStore->lastPlanet($u) === $snap['id'], 'refused writes keep the old value');
451
421 452 expect($ptsStore->listCustomPlanets($v) === [], 'other user has no planets');
422 453
423 454 try {
@@ -454,6 +485,7 @@ try {
454 485 $ptsStore->leaveLobby($u);
455 486 $ptsStore->leaveLobby($v);
456 487 $ptsStore->deleteCustomPlanet($u, $snap['id']);
488 expect($ptsStore->lastPlanet($u) === null, "deleted custom planet → last_planet falls back to null (t1196)");
457 489 expect($ptsStore->listCustomPlanets($u) === [], 'deleted planet is gone');
458 490
459 491 // Snapshot survives mid-match edits: create, join, start, then edit/delete, opponent still sees original.
@@ -29,6 +29,21 @@ $tmp = sys_get_temp_dir() . '/meteors-test-' . bin2hex(random_bytes(6));
29mkdir($tmp, 0775, true);
29mkdir($tmp, 0775, true);
30putenv('METEORS_DATA_DIR=' . $tmp);
30putenv('METEORS_DATA_DIR=' . $tmp);
31
31
32echo "Login return target (t1193)\n";
33expect(loginReturnTarget(null) === 'menu', 'no return param → main menu');
34expect(loginReturnTarget('') === 'menu', 'empty return → main menu');
35expect(loginReturnTarget('online') === 'online', 'return=online → online play');
36expect(loginReturnTarget('https://evil.example/') === 'menu', 'unknown/URL value → main menu (no open redirect)');
37expect(loginReturnTarget(['online']) === 'menu', 'array value → main menu');
38expect(loginReturnPath('menu') === 'index.html', 'menu path has no online flag');
39expect(loginReturnPath(null) === 'index.html', 'missing session value → menu');
40expect(loginReturnPath('online') === 'index.html?online=1', 'online path opens the online panel');
41$cbSrc = (string) file_get_contents(dirname(__DIR__) . '/callback.php');
42expect(strpos($cbSrc, "index.html?online=1'") === false, 'callback no longer hard-codes ?online=1');
43expect(strpos($cbSrc, 'loginReturnPath(') !== false, 'callback uses loginReturnPath');
44$authSrc = (string) file_get_contents(dirname(__DIR__) . '/auth.php');
45expect(strpos($authSrc, "loginReturnTarget(\$_GET['return']") !== false, 'auth.php stores the return target');
46
32echo "Store: lobby and game\n";
47echo "Store: lobby and game\n";
33$store = Store::open($tmp);
48$store = Store::open($tmp);
34
49
@@ -418,6 +433,22 @@ expect($snap['owner_id'] === $u, 'owner_id set');
418
433
419$listed = $ptsStore->listCustomPlanets($u);
434$listed = $ptsStore->listCustomPlanets($u);
420expect(count($listed) === 1, 'owner lists the planet');
435expect(count($listed) === 1, 'owner lists the planet');
436
437echo "Last chosen planet (t1196)\n";
438expect($ptsStore->lastPlanet($u) === null, 'no last planet stored yet');
439expect($ptsStore->profilePayload($u)['last_planet'] === null, 'payload last_planet null');
440expect($ptsStore->setLastPlanet($u, 'terra') === 'terra', 'standard planet saved');
441expect($ptsStore->lastPlanet($u) === 'terra', 'standard planet read back');
442$ptsStore->setLastPlanet($u, $snap['id']);
443expect($ptsStore->profilePayload($u)['last_planet'] === $snap['id'], 'own custom planet saved and in payload');
444foreach (['', 'nope', str_repeat('x', 80)] as $bad) {
445 try { $ptsStore->setLastPlanet($u, $bad); expect(false, 'bad planet accepted: ' . $bad); }
446 catch (RuntimeException $e) { expect(true, 'bad planet refused: ' . substr($bad, 0, 8)); }
447}
448try { $ptsStore->setLastPlanet($v, $snap['id']); expect(false, 'other user may not pick my custom planet'); }
449catch (RuntimeException $e) { expect(true, "someone else's custom planet refused"); }
450expect($ptsStore->lastPlanet($u) === $snap['id'], 'refused writes keep the old value');
451
421expect($ptsStore->listCustomPlanets($v) === [], 'other user has no planets');
452expect($ptsStore->listCustomPlanets($v) === [], 'other user has no planets');
422
453
423try {
454try {
@@ -454,6 +485,7 @@ try {
454$ptsStore->leaveLobby($u);
485$ptsStore->leaveLobby($u);
455$ptsStore->leaveLobby($v);
486$ptsStore->leaveLobby($v);
456$ptsStore->deleteCustomPlanet($u, $snap['id']);
487$ptsStore->deleteCustomPlanet($u, $snap['id']);
488expect($ptsStore->lastPlanet($u) === null, "deleted custom planet → last_planet falls back to null (t1196)");
457expect($ptsStore->listCustomPlanets($u) === [], 'deleted planet is gone');
489expect($ptsStore->listCustomPlanets($u) === [], 'deleted planet is gone');
458
490
459// Snapshot survives mid-match edits: create, join, start, then edit/delete, opponent still sees original.
491// Snapshot survives mid-match edits: create, join, start, then edit/delete, opponent still sees original.
src/gameCore.js +36 −4
@@ -81,6 +81,9 @@ function GameCore (planet, rng)
81 81 this.spawnInterval = PlanetMod.SPAWN_INTERVAL;
82 82 /** Seconds of actual play in this match / round (t1189). */
83 83 this.playTime = 0;
84 /** t1197: matches in the current combo and seconds since the last one. */
85 this.combo = 0;
86 this.comboAge = 0;
84 87 this.settleTime = PlanetMod.SETTLE_TIME;
85 88 this.score = 0;
86 89 this.state = 'playing';
@@ -119,6 +122,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;
119 122 GameCore.SNAP_Y = SNAP_Y;
120 123 GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
121 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;
127 /** t1197: the combo resets when no match is made for this long (s). */
128 GameCore.COMBO_RESET_S = 5;
122 129 GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
123 130 GameCore.DEFAULT_MISS_CHANCE = 0.30;
124 131 GameCore.STATE_STILL = STATE_STILL;
@@ -596,6 +603,14 @@ GameCore.prototype.tick = function (dt)
596 603 // t1192: waiting received blocks drop first, as soon as there is room.
597 604 if (this.garbageQueue.length)
598 605 { this.drainGarbageQueue(); }
606 // t1197: combo expires after COMBO_RESET_S without a match.
607 this.comboAge += dt;
608 if (this.combo > 0 && this.comboAge >= GameCore.COMBO_RESET_S)
609 {
610 this.combo = 0;
611 if (!this.hasActiveLandingChain())
612 { this.lastChainIndicator = null; }
613 }
599 614 this.spawnTimer += dt;
600 615 var iv = this.currentSpawnInterval();
601 616 while (this.spawnTimer >= iv)
@@ -2631,15 +2646,21 @@ GameCore.prototype.resolveMatches = function ()
2631 2646 }
2632 2647 }
2633 2648 var chain = this.landingChainFor(group);
2634 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain;
2649 // t1197: combo bonus = COMBO_STEP per earlier match in this combo,
2650 // added to the landing-chain bonus (one shown "+x%").
2651 var comboBonus = GameCore.COMBO_STEP * this.combo;
2652 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;
2635 2653 height *= bonusMul;
2636 2654 this.launchCluster(group, height, { landingChain: chain });
2637 2655 launched.push({
2638 2656 blocks: group,
2639 2657 jumpHeight: height,
2640 2658 landingChain: chain,
2659 comboBonus: comboBonus,
2641 2660 chainBonus: bonusMul
2642 2661 });
2662 this.combo += 1;
2663 this.comboAge = 0;
2643 2664 }
2644 2665 this.finishLandingChains(launched);
2645 2666 this.updateChainIndicator(launched);
@@ -3161,24 +3182,35 @@ GameCore.prototype.finishLandingChains = function (launched)
3161 3182 GameCore.prototype.updateChainIndicator = function (launched)
3162 3183 {
3163 3184 var maxChain = 0;
3185 var maxPct = 0;
3164 3186 for (var i = 0; i < launched.length; i++)
3165 3187 {
3166 3188 var ch = launched[i].landingChain || 0;
3167 3189 if (ch > maxChain)
3168 3190 { maxChain = ch; }
3191 var pct = Math.round(((launched[i].chainBonus || 1) - 1) * 100);
3192 if (pct > maxPct)
3193 { maxPct = pct; }
3169 3194 }
3170 if (maxChain >= 1)
3195 if (maxPct > 0)
3171 3196 {
3172 3197 this.lastChainIndicator = {
3173 3198 chain: maxChain,
3174 bonusPct: Math.round(maxChain * LANDING_CHAIN_BONUS * 100)
3199 combo: this.combo,
3200 bonusPct: maxPct
3175 3201 };
3176 3202 return;
3177 3203 }
3178 if (!this.hasActiveLandingChain())
3204 if (!this.hasActiveLandingChain() && !(launched.length && this.combo > 0))
3179 3205 { this.lastChainIndicator = null; }
3180 3206 };
3181 3207
3208 /** Bonus (percent) the next match would get from the combo alone (t1197). */
3209 GameCore.prototype.comboBonusPct = function ()
3210 {
3211 return Math.round(GameCore.COMBO_STEP * this.combo * 100);
3212 };
3213
3182 3214 GameCore.prototype.hasActiveLandingChain = function ()
3183 3215 {
3184 3216 var ids = Object.keys(this.clusters);
@@ -81,6 +81,9 @@ function GameCore (planet, rng)
81 this.spawnInterval = PlanetMod.SPAWN_INTERVAL;
81 this.spawnInterval = PlanetMod.SPAWN_INTERVAL;
82 /** Seconds of actual play in this match / round (t1189). */
82 /** Seconds of actual play in this match / round (t1189). */
83 this.playTime = 0;
83 this.playTime = 0;
84 /** t1197: matches in the current combo and seconds since the last one. */
85 this.combo = 0;
86 this.comboAge = 0;
84 this.settleTime = PlanetMod.SETTLE_TIME;
87 this.settleTime = PlanetMod.SETTLE_TIME;
85 this.score = 0;
88 this.score = 0;
86 this.state = 'playing';
89 this.state = 'playing';
@@ -119,6 +122,10 @@ GameCore.SWAP_DISTANCE = SWAP_DISTANCE;
119GameCore.SNAP_Y = SNAP_Y;
122GameCore.SNAP_Y = SNAP_Y;
120GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
123GameCore.HORIZONTAL_SLOP = HORIZONTAL_SLOP;
121GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;
124GameCore.LANDING_CHAIN_BONUS = LANDING_CHAIN_BONUS;
125/** t1197: each match in a combo adds this much jump height (additive). */
126GameCore.COMBO_STEP = 0.05;
127/** t1197: the combo resets when no match is made for this long (s). */
128GameCore.COMBO_RESET_S = 5;
122GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
129GameCore.COLUMN_WARN_ROWS = COLUMN_WARN_ROWS;
123GameCore.DEFAULT_MISS_CHANCE = 0.30;
130GameCore.DEFAULT_MISS_CHANCE = 0.30;
124GameCore.STATE_STILL = STATE_STILL;
131GameCore.STATE_STILL = STATE_STILL;
@@ -596,6 +603,14 @@ GameCore.prototype.tick = function (dt)
596 // t1192: waiting received blocks drop first, as soon as there is room.
603 // t1192: waiting received blocks drop first, as soon as there is room.
597 if (this.garbageQueue.length)
604 if (this.garbageQueue.length)
598 { this.drainGarbageQueue(); }
605 { this.drainGarbageQueue(); }
606 // t1197: combo expires after COMBO_RESET_S without a match.
607 this.comboAge += dt;
608 if (this.combo > 0 && this.comboAge >= GameCore.COMBO_RESET_S)
609 {
610 this.combo = 0;
611 if (!this.hasActiveLandingChain())
612 { this.lastChainIndicator = null; }
613 }
599 this.spawnTimer += dt;
614 this.spawnTimer += dt;
600 var iv = this.currentSpawnInterval();
615 var iv = this.currentSpawnInterval();
601 while (this.spawnTimer >= iv)
616 while (this.spawnTimer >= iv)
@@ -2631,15 +2646,21 @@ GameCore.prototype.resolveMatches = function ()
2631 }
2646 }
2632 }
2647 }
2633 var chain = this.landingChainFor(group);
2648 var chain = this.landingChainFor(group);
2634 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain;
2649 // t1197: combo bonus = COMBO_STEP per earlier match in this combo,
2650 // added to the landing-chain bonus (one shown "+x%").
2651 var comboBonus = GameCore.COMBO_STEP * this.combo;
2652 var bonusMul = 1 + LANDING_CHAIN_BONUS * chain + comboBonus;
2635 height *= bonusMul;
2653 height *= bonusMul;
2636 this.launchCluster(group, height, { landingChain: chain });
2654 this.launchCluster(group, height, { landingChain: chain });
2637 launched.push({
2655 launched.push({
2638 blocks: group,
2656 blocks: group,
2639 jumpHeight: height,
2657 jumpHeight: height,
2640 landingChain: chain,
2658 landingChain: chain,
2659 comboBonus: comboBonus,
2641 chainBonus: bonusMul
2660 chainBonus: bonusMul
2642 });
2661 });
2662 this.combo += 1;
2663 this.comboAge = 0;
2643 }
2664 }
2644 this.finishLandingChains(launched);
2665 this.finishLandingChains(launched);
2645 this.updateChainIndicator(launched);
2666 this.updateChainIndicator(launched);
@@ -3161,24 +3182,35 @@ GameCore.prototype.finishLandingChains = function (launched)
3161GameCore.prototype.updateChainIndicator = function (launched)
3182GameCore.prototype.updateChainIndicator = function (launched)
3162{
3183{
3163 var maxChain = 0;
3184 var maxChain = 0;
3185 var maxPct = 0;
3164 for (var i = 0; i < launched.length; i++)
3186 for (var i = 0; i < launched.length; i++)
3165 {
3187 {
3166 var ch = launched[i].landingChain || 0;
3188 var ch = launched[i].landingChain || 0;
3167 if (ch > maxChain)
3189 if (ch > maxChain)
3168 { maxChain = ch; }
3190 { maxChain = ch; }
3191 var pct = Math.round(((launched[i].chainBonus || 1) - 1) * 100);
3192 if (pct > maxPct)
3193 { maxPct = pct; }
3169 }
3194 }
3170 if (maxChain >= 1)
3195 if (maxPct > 0)
3171 {
3196 {
3172 this.lastChainIndicator = {
3197 this.lastChainIndicator = {
3173 chain: maxChain,
3198 chain: maxChain,
3174 bonusPct: Math.round(maxChain * LANDING_CHAIN_BONUS * 100)
3199 combo: this.combo,
3200 bonusPct: maxPct
3175 };
3201 };
3176 return;
3202 return;
3177 }
3203 }
3178 if (!this.hasActiveLandingChain())
3204 if (!this.hasActiveLandingChain() && !(launched.length && this.combo > 0))
3179 { this.lastChainIndicator = null; }
3205 { this.lastChainIndicator = null; }
3180};
3206};
3181
3207
3208/** Bonus (percent) the next match would get from the combo alone (t1197). */
3209GameCore.prototype.comboBonusPct = function ()
3210{
3211 return Math.round(GameCore.COMBO_STEP * this.combo * 100);
3212};
3213
3182GameCore.prototype.hasActiveLandingChain = function ()
3214GameCore.prototype.hasActiveLandingChain = function ()
3183{
3215{
3184 var ids = Object.keys(this.clusters);
3216 var ids = Object.keys(this.clusters);
src/main.js +180 −55
@@ -98,6 +98,7 @@ window.onload = function ()
98 98 app.debugPhysics = isPhysicsDebugEnabled();
99 99 var play = document.getElementById('btn-play');
100 100 play.addEventListener('click', onPlay);
101 bindGameMenu();
101 102 play.addEventListener('pointerup', function (e)
102 103 {
103 104 // A touch-friendly path: some mobile browsers swallow the click
@@ -228,6 +229,7 @@ function startPlay (opts)
228 229 { bindPointer(app.scene.canvas); }
229 230 refreshHud();
230 231 showEl('hud');
232 setGameMenuButton(!app.online && !app.spectating);
231 233 }
232 234 catch (err)
233 235 {
@@ -327,6 +329,10 @@ function teardownPlay ()
327 329 app.columnWarn = [];
328 330 app.pointerId = null;
329 331 app.gameOverShown = false;
332 app.paused = false;
333 app.quitting = false;
334 hideEl('game-menu');
335 setGameMenuButton(false);
330 336 hideEl('hud');
331 337 hideEl('game-over');
332 338 hideEl('spectator');
@@ -894,6 +900,14 @@ function tickView (dt)
894 900 placeTile(app.cells[i], col, row);
895 901 }
896 902
903 // t1193: in-game menu open (Spelen / Offline Strijd) or quitting:
904 // the field, bots and timers stand still; only the view is kept.
905 if (app.paused)
906 {
907 syncSprites(0);
908 return;
909 }
910
897 911 app.core.tick(dt);
898 912 if (app.offline && app.battle)
899 913 { tickOffline(dt); }
@@ -1095,7 +1109,16 @@ function fieldFromEvent (e)
1095 1109
1096 1110 function playingForDrag ()
1097 1111 {
1098 return app.core && app.core.state === 'playing';
1112 return app.core && app.core.state === 'playing' && !app.paused;
1113 }
1114
1115 /** Touches on HUD buttons / menus are UI taps, not field drags (t1193). */
1116 function isUiTouchTarget (e)
1117 {
1118 var el = e && e.target;
1119 if (!el || !el.closest)
1120 { return false; }
1121 return !!el.closest('button, a, input, select, #game-menu, #reward');
1099 1122 }
1100 1123
1101 1124 function startDragFromEvent (e)
@@ -1245,6 +1268,8 @@ function onTouchStart (e)
1245 1268 {
1246 1269 if (!playingForDrag())
1247 1270 { return; }
1271 if (app.activeTouchId == null && isUiTouchTarget(e))
1272 { return; }
1248 1273 if (app.activeTouchId != null)
1249 1274 {
1250 1275 if (e.preventDefault)
@@ -1570,31 +1595,20 @@ function showOfflineResult ()
1570 1595 app.offlineResultShown = true;
1571 1596 var battle = app.battle;
1572 1597 var reached = document.getElementById('offline-reached');
1573 var sch = battle.schedule;
1574 var n = sch.opponents;
1575 var skill = Math.round(sch.skill * 100);
1576 1598 var line = document.getElementById('offline-reached-line');
1577 1599 if (line && typeof I18n !== 'undefined')
1578 1600 { line.textContent = I18n.t('offline.reached', { n: battle.round }); }
1579 1601 else if (reached)
1580 1602 { reached.textContent = String(battle.round); }
1603 // t1198: "X opponents defeated" over all rounds (replaces the
1604 // opponents / skill line).
1581 1605 var detail = document.getElementById('offline-result-detail');
1582 1606 if (detail)
1583 1607 {
1584 if (typeof I18n !== 'undefined')
1585 {
1586 detail.textContent = I18n.t('offline.detail', {
1587 n: n,
1588 opponents: I18n.plural('hud.opponent', n),
1589 skill: skill
1590 });
1591 }
1592 else
1593 {
1594 var noun = n === 1 ? 'opponent' : 'opponents';
1595 detail.textContent = 'You played against ' + n + ' ' + noun
1596 + ' at skill ' + skill + '%.';
1597 }
1608 var beaten = battle.defeated || 0;
1609 detail.textContent = (typeof I18n !== 'undefined')
1610 ? I18n.plural('offline.defeated', beaten, { n: beaten })
1611 : beaten + (beaten === 1 ? ' opponent defeated' : ' opponents defeated');
1598 1612 }
1599 1613 hideEl('game-over');
1600 1614 showEl('offline-result');
@@ -1612,34 +1626,11 @@ function refreshOfflineHud ()
1612 1626 return;
1613 1627 }
1614 1628 el.hidden = false;
1629 // t1195: the Offline Strijd HUD shows only "Round N".
1615 1630 var sch = app.battle.schedule;
1616 var n = sch.opponents;
1617 1631 var r = document.getElementById('offline-round');
1618 var o = document.getElementById('offline-opponents');
1619 var s = document.getElementById('offline-skill');
1620 if (typeof I18n !== 'undefined')
1621 {
1622 if (r)
1623 { r.textContent = I18n.t('hud.round', { n: sch.round }); }
1624 if (o)
1625 {
1626 o.textContent = I18n.t('hud.opponentsLine', {
1627 n: n, word: I18n.plural('hud.opponent', n)
1628 });
1629 }
1630 if (s)
1631 { s.textContent = I18n.t('hud.skill', { n: Math.round(sch.skill * 100) }); }
1632 }
1633 else
1634 {
1635 var noun = n === 1 ? 'opponent' : 'opponents';
1636 if (r)
1637 { r.textContent = 'Round ' + sch.round; }
1638 if (o)
1639 { o.textContent = n + ' ' + noun; }
1640 if (s)
1641 { s.textContent = 'Skill ' + Math.round(sch.skill * 100) + '%'; }
1642 }
1632 if (r)
1633 { r.textContent = (typeof I18n !== 'undefined') ? I18n.t('hud.round', { n: sch.round }) : 'Round ' + sch.round; }
1643 1634 }
1644 1635
1645 1636 function hideOfflineHud ()
@@ -1657,14 +1648,16 @@ function refreshChainIndicator ()
1657 1648 var info = app.core && app.core.lastChainIndicator;
1658 1649 var active = app.core && app.core.hasActiveLandingChain
1659 1650 && app.core.hasActiveLandingChain();
1660 // Show only while a chained cluster is still in the air.
1661 if (!info || info.chain < 1 || app.mode !== 'playing' || !active)
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))
1662 1655 {
1663 1656 el.hidden = true;
1664 1657 return;
1665 1658 }
1666 1659 el.hidden = false;
1667 el.textContent = 'x' + info.chain + ' +' + info.bonusPct + '%';
1660 el.textContent = '+' + info.bonusPct + '%';
1668 1661 }
1669 1662
1670 1663 function hideChainIndicator ()
@@ -2143,7 +2136,17 @@ function bindOnlineUi ()
2143 2136
2144 2137 var params = new URLSearchParams(window.location.search);
2145 2138 if (params.get('online') === '1' || params.get('auth') === 'unconfigured')
2146 { openOnlinePanel(); }
2139 {
2140 openOnlinePanel();
2141 // t1193: one-shot; a reload must not jump to online play again.
2142 try
2143 {
2144 params.delete('online');
2145 var rest = params.toString();
2146 window.history.replaceState(null, '', window.location.pathname + (rest ? '?' + rest : '') + window.location.hash);
2147 }
2148 catch (e) { /* ignore */ }
2149 }
2147 2150 }
2148 2151
2149 2152 function openOnlinePanel ()
@@ -2309,13 +2312,32 @@ function selectedPlanetId ()
2309 2312 return 'terra';
2310 2313 }
2311 2314
2315 /**
2316 * Pre-select the last chosen planet (t1196): logged in the profile value
2317 * (server), otherwise / as fallback localStorage, otherwise Terra. A
2318 * deleted custom planet falls back to the default (setSelectedPlanet).
2319 */
2312 2320 function restoreSelectedPlanet ()
2313 2321 {
2314 var id = 'terra';
2315 try
2316 { id = localStorage.getItem('meteors-planet') || 'terra'; }
2317 catch (e) {}
2318 setSelectedPlanet(id, true);
2322 var id = null;
2323 if (typeof Online !== 'undefined' && Online.me && Online.lastPlanet)
2324 { id = Online.lastPlanet; }
2325 if (!id)
2326 {
2327 try
2328 { id = localStorage.getItem('meteors-planet'); }
2329 catch (e) {}
2330 }
2331 setSelectedPlanet(id || 'terra', true);
2332 }
2333
2334 function rememberPlanetChoice (id)
2335 {
2336 if (typeof Online === 'undefined' || !Online.me || !Online.setLastPlanet)
2337 { return; }
2338 if (Online.lastPlanet === id)
2339 { return; }
2340 Promise.resolve(Online.setLastPlanet(id)).then(null, function () {});
2319 2341 }
2320 2342
2321 2343 function setSelectedPlanet (id, silent)
@@ -2335,6 +2357,7 @@ function setSelectedPlanet (id, silent)
2335 2357 catch (e) {}
2336 2358 if (!silent)
2337 2359 {
2360 rememberPlanetChoice(found.id);
2338 2361 var grid = document.getElementById('planet-grid');
2339 2362 if (grid && !grid.hidden && grid.children.length)
2340 2363 { renderPlanetGrid('planet-grid', false); }
@@ -2495,6 +2518,102 @@ function refreshMenuAccount ()
2495 2518 { localLogin.hidden = !(typeof Online !== 'undefined' && Online.local); }
2496 2519 }
2497 2520
2521 /* ---------- t1193 in-game menu (Spelen / Offline Strijd) ----------- */
2522
2523 function setGameMenuButton (show)
2524 {
2525 var btn = document.getElementById('btn-game-menu');
2526 if (btn)
2527 { btn.hidden = !show; }
2528 }
2529
2530 /** The menu can open during a running solo / offline field only. */
2531 function canOpenGameMenu ()
2532 {
2533 return app.mode === 'playing' && !!app.core && !app.online && !app.spectating
2534 && app.core.state === 'playing' && !app.rewardActive && !app.quitting
2535 && !(app.offline && app.battle && app.battle.state !== 'playing');
2536 }
2537
2538 function openGameMenu ()
2539 {
2540 if (!canOpenGameMenu())
2541 { return false; }
2542 if (app.core.drag)
2543 { finishDrag({ noLaunch: true }); }
2544 app.paused = true;
2545 showEl('game-menu');
2546 var resume = document.getElementById('btn-game-resume');
2547 if (resume && resume.focus)
2548 { resume.focus(); }
2549 return true;
2550 }
2551
2552 function resumeFromGameMenu ()
2553 {
2554 hideEl('game-menu');
2555 if (!app.quitting)
2556 { app.paused = false; }
2557 }
2558
2559 /**
2560 * "Back to main menu": ends the match now. Logged in, the points so far
2561 * go through the normal play_finish + reward screen first (the server
2562 * still applies its caps); logged out, straight to the menu. Offline
2563 * Strijd ends the whole battle (no next round).
2564 */
2565 function quitToMainMenu ()
2566 {
2567 if (!app.core || app.quitting)
2568 { return; }
2569 hideEl('game-menu');
2570 app.paused = true;
2571 app.quitting = true;
2572 app.gameOverShown = true;
2573 app.lastScore = app.core.score || 0;
2574 setGameMenuButton(false);
2575 var score = app.lastScore;
2576 var done = function ()
2577 {
2578 app.quitting = false;
2579 app.paused = false;
2580 returnToMenu();
2581 };
2582 if (rewardEnabled())
2583 {
2584 var title = (typeof I18n !== 'undefined') ? I18n.t('reward.ended') : 'Game ended';
2585 showReward(false, finishPlaySession(score), done, title);
2586 }
2587 else
2588 {
2589 finishPlaySession(score);
2590 done();
2591 }
2592 }
2593
2594 function bindGameMenu ()
2595 {
2596 var btn = document.getElementById('btn-game-menu');
2597 if (btn)
2598 { btn.addEventListener('click', function () { openGameMenu(); }); }
2599 var resume = document.getElementById('btn-game-resume');
2600 if (resume)
2601 { resume.addEventListener('click', resumeFromGameMenu); }
2602 var quit = document.getElementById('btn-game-quit');
2603 if (quit)
2604 { quit.addEventListener('click', quitToMainMenu); }
2605 document.addEventListener('keydown', function (e)
2606 {
2607 if (e.key !== 'Escape')
2608 { return; }
2609 var menu = document.getElementById('game-menu');
2610 if (menu && !menu.hidden)
2611 { resumeFromGameMenu(); }
2612 else
2613 { openGameMenu(); }
2614 });
2615 }
2616
2498 2617 function beginPlaySession (mode)
2499 2618 {
2500 2619 if (app.playToken)
@@ -2550,7 +2669,7 @@ function rewardEnabled ()
2550 2669 * next() — the same destination the mode used before (menu, next
2551 2670 * offline round, offline result, or the online lobby/podium).
2552 2671 */
2553 function showReward (won, resultPromise, next)
2672 function showReward (won, resultPromise, next, title)
2554 2673 {
2555 2674 app.rewardActive = true;
2556 2675 hideEl('game-over');
@@ -2558,6 +2677,7 @@ function showReward (won, resultPromise, next)
2558 2677 hideEl('podium');
2559 2678 var handle = Reward.play({
2560 2679 won: won,
2680 title: title || null,
2561 2681 planet: app.planet,
2562 2682 result: resultPromise,
2563 2683 onDone: function ()
@@ -2568,7 +2688,12 @@ function showReward (won, resultPromise, next)
2568 2688 }
2569 2689 });
2570 2690 if (!handle)
2571 { app.rewardActive = false; }
2691 {
2692 app.rewardActive = false;
2693 // No reward overlay (e.g. missing DOM): still continue (t1193).
2694 if (title && next)
2695 { next(); }
2696 }
2572 2697 }
2573 2698
2574 2699 function myOnlinePlace (lobby)
@@ -98,6 +98,7 @@ window.onload = function ()
98 app.debugPhysics = isPhysicsDebugEnabled();
98 app.debugPhysics = isPhysicsDebugEnabled();
99 var play = document.getElementById('btn-play');
99 var play = document.getElementById('btn-play');
100 play.addEventListener('click', onPlay);
100 play.addEventListener('click', onPlay);
101 bindGameMenu();
101 play.addEventListener('pointerup', function (e)
102 play.addEventListener('pointerup', function (e)
102 {
103 {
103 // A touch-friendly path: some mobile browsers swallow the click
104 // A touch-friendly path: some mobile browsers swallow the click
@@ -228,6 +229,7 @@ function startPlay (opts)
228 { bindPointer(app.scene.canvas); }
229 { bindPointer(app.scene.canvas); }
229 refreshHud();
230 refreshHud();
230 showEl('hud');
231 showEl('hud');
232 setGameMenuButton(!app.online && !app.spectating);
231 }
233 }
232 catch (err)
234 catch (err)
233 {
235 {
@@ -327,6 +329,10 @@ function teardownPlay ()
327 app.columnWarn = [];
329 app.columnWarn = [];
328 app.pointerId = null;
330 app.pointerId = null;
329 app.gameOverShown = false;
331 app.gameOverShown = false;
332 app.paused = false;
333 app.quitting = false;
334 hideEl('game-menu');
335 setGameMenuButton(false);
330 hideEl('hud');
336 hideEl('hud');
331 hideEl('game-over');
337 hideEl('game-over');
332 hideEl('spectator');
338 hideEl('spectator');
@@ -894,6 +900,14 @@ function tickView (dt)
894 placeTile(app.cells[i], col, row);
900 placeTile(app.cells[i], col, row);
895 }
901 }
896
902
903 // t1193: in-game menu open (Spelen / Offline Strijd) or quitting:
904 // the field, bots and timers stand still; only the view is kept.
905 if (app.paused)
906 {
907 syncSprites(0);
908 return;
909 }
910
897 app.core.tick(dt);
911 app.core.tick(dt);
898 if (app.offline && app.battle)
912 if (app.offline && app.battle)
899 { tickOffline(dt); }
913 { tickOffline(dt); }
@@ -1095,7 +1109,16 @@ function fieldFromEvent (e)
1095
1109
1096function playingForDrag ()
1110function playingForDrag ()
1097{
1111{
1098 return app.core && app.core.state === 'playing';
1112 return app.core && app.core.state === 'playing' && !app.paused;
1113}
1114
1115/** Touches on HUD buttons / menus are UI taps, not field drags (t1193). */
1116function isUiTouchTarget (e)
1117{
1118 var el = e && e.target;
1119 if (!el || !el.closest)
1120 { return false; }
1121 return !!el.closest('button, a, input, select, #game-menu, #reward');
1099}
1122}
1100
1123
1101function startDragFromEvent (e)
1124function startDragFromEvent (e)
@@ -1245,6 +1268,8 @@ function onTouchStart (e)
1245{
1268{
1246 if (!playingForDrag())
1269 if (!playingForDrag())
1247 { return; }
1270 { return; }
1271 if (app.activeTouchId == null && isUiTouchTarget(e))
1272 { return; }
1248 if (app.activeTouchId != null)
1273 if (app.activeTouchId != null)
1249 {
1274 {
1250 if (e.preventDefault)
1275 if (e.preventDefault)
@@ -1570,31 +1595,20 @@ function showOfflineResult ()
1570 app.offlineResultShown = true;
1595 app.offlineResultShown = true;
1571 var battle = app.battle;
1596 var battle = app.battle;
1572 var reached = document.getElementById('offline-reached');
1597 var reached = document.getElementById('offline-reached');
1573 var sch = battle.schedule;
1574 var n = sch.opponents;
1575 var skill = Math.round(sch.skill * 100);
1576 var line = document.getElementById('offline-reached-line');
1598 var line = document.getElementById('offline-reached-line');
1577 if (line && typeof I18n !== 'undefined')
1599 if (line && typeof I18n !== 'undefined')
1578 { line.textContent = I18n.t('offline.reached', { n: battle.round }); }
1600 { line.textContent = I18n.t('offline.reached', { n: battle.round }); }
1579 else if (reached)
1601 else if (reached)
1580 { reached.textContent = String(battle.round); }
1602 { reached.textContent = String(battle.round); }
1603 // t1198: "X opponents defeated" over all rounds (replaces the
1604 // opponents / skill line).
1581 var detail = document.getElementById('offline-result-detail');
1605 var detail = document.getElementById('offline-result-detail');
1582 if (detail)
1606 if (detail)
1583 {
1607 {
1584 if (typeof I18n !== 'undefined')
1608 var beaten = battle.defeated || 0;
1585 {
1609 detail.textContent = (typeof I18n !== 'undefined')
1586 detail.textContent = I18n.t('offline.detail', {
1610 ? I18n.plural('offline.defeated', beaten, { n: beaten })
1587 n: n,
1611 : beaten + (beaten === 1 ? ' opponent defeated' : ' opponents defeated');
1588 opponents: I18n.plural('hud.opponent', n),
1589 skill: skill
1590 });
1591 }
1592 else
1593 {
1594 var noun = n === 1 ? 'opponent' : 'opponents';
1595 detail.textContent = 'You played against ' + n + ' ' + noun
1596 + ' at skill ' + skill + '%.';
1597 }
1598 }
1612 }
1599 hideEl('game-over');
1613 hideEl('game-over');
1600 showEl('offline-result');
1614 showEl('offline-result');
@@ -1612,34 +1626,11 @@ function refreshOfflineHud ()
1612 return;
1626 return;
1613 }
1627 }
1614 el.hidden = false;
1628 el.hidden = false;
1629 // t1195: the Offline Strijd HUD shows only "Round N".
1615 var sch = app.battle.schedule;
1630 var sch = app.battle.schedule;
1616 var n = sch.opponents;
1617 var r = document.getElementById('offline-round');
1631 var r = document.getElementById('offline-round');
1618 var o = document.getElementById('offline-opponents');
1632 if (r)
1619 var s = document.getElementById('offline-skill');
1633 { r.textContent = (typeof I18n !== 'undefined') ? I18n.t('hud.round', { n: sch.round }) : 'Round ' + sch.round; }
1620 if (typeof I18n !== 'undefined')
1621 {
1622 if (r)
1623 { r.textContent = I18n.t('hud.round', { n: sch.round }); }
1624 if (o)
1625 {
1626 o.textContent = I18n.t('hud.opponentsLine', {
1627 n: n, word: I18n.plural('hud.opponent', n)
1628 });
1629 }
1630 if (s)
1631 { s.textContent = I18n.t('hud.skill', { n: Math.round(sch.skill * 100) }); }
1632 }
1633 else
1634 {
1635 var noun = n === 1 ? 'opponent' : 'opponents';
1636 if (r)
1637 { r.textContent = 'Round ' + sch.round; }
1638 if (o)
1639 { o.textContent = n + ' ' + noun; }
1640 if (s)
1641 { s.textContent = 'Skill ' + Math.round(sch.skill * 100) + '%'; }
1642 }
1643}
1634}
1644
1635
1645function hideOfflineHud ()
1636function hideOfflineHud ()
@@ -1657,14 +1648,16 @@ function refreshChainIndicator ()
1657 var info = app.core && app.core.lastChainIndicator;
1648 var info = app.core && app.core.lastChainIndicator;
1658 var active = app.core && app.core.hasActiveLandingChain
1649 var active = app.core && app.core.hasActiveLandingChain
1659 && app.core.hasActiveLandingChain();
1650 && app.core.hasActiveLandingChain();
1660 // Show only while a chained cluster is still in the air.
1651 var comboOn = app.core && app.core.combo > 0;
1661 if (!info || info.chain < 1 || app.mode !== 'playing' || !active)
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))
1662 {
1655 {
1663 el.hidden = true;
1656 el.hidden = true;
1664 return;
1657 return;
1665 }
1658 }
1666 el.hidden = false;
1659 el.hidden = false;
1667 el.textContent = 'x' + info.chain + ' +' + info.bonusPct + '%';
1660 el.textContent = '+' + info.bonusPct + '%';
1668}
1661}
1669
1662
1670function hideChainIndicator ()
1663function hideChainIndicator ()
@@ -2143,7 +2136,17 @@ function bindOnlineUi ()
2143
2136
2144 var params = new URLSearchParams(window.location.search);
2137 var params = new URLSearchParams(window.location.search);
2145 if (params.get('online') === '1' || params.get('auth') === 'unconfigured')
2138 if (params.get('online') === '1' || params.get('auth') === 'unconfigured')
2146 { openOnlinePanel(); }
2139 {
2140 openOnlinePanel();
2141 // t1193: one-shot; a reload must not jump to online play again.
2142 try
2143 {
2144 params.delete('online');
2145 var rest = params.toString();
2146 window.history.replaceState(null, '', window.location.pathname + (rest ? '?' + rest : '') + window.location.hash);
2147 }
2148 catch (e) { /* ignore */ }
2149 }
2147}
2150}
2148
2151
2149function openOnlinePanel ()
2152function openOnlinePanel ()
@@ -2309,13 +2312,32 @@ function selectedPlanetId ()
2309 return 'terra';
2312 return 'terra';
2310}
2313}
2311
2314
2315/**
2316 * Pre-select the last chosen planet (t1196): logged in the profile value
2317 * (server), otherwise / as fallback localStorage, otherwise Terra. A
2318 * deleted custom planet falls back to the default (setSelectedPlanet).
2319 */
2312function restoreSelectedPlanet ()
2320function restoreSelectedPlanet ()
2313{
2321{
2314 var id = 'terra';
2322 var id = null;
2315 try
2323 if (typeof Online !== 'undefined' && Online.me && Online.lastPlanet)
2316 { id = localStorage.getItem('meteors-planet') || 'terra'; }
2324 { id = Online.lastPlanet; }
2317 catch (e) {}
2325 if (!id)
2318 setSelectedPlanet(id, true);
2326 {
2327 try
2328 { id = localStorage.getItem('meteors-planet'); }
2329 catch (e) {}
2330 }
2331 setSelectedPlanet(id || 'terra', true);
2332}
2333
2334function rememberPlanetChoice (id)
2335{
2336 if (typeof Online === 'undefined' || !Online.me || !Online.setLastPlanet)
2337 { return; }
2338 if (Online.lastPlanet === id)
2339 { return; }
2340 Promise.resolve(Online.setLastPlanet(id)).then(null, function () {});
2319}
2341}
2320
2342
2321function setSelectedPlanet (id, silent)
2343function setSelectedPlanet (id, silent)
@@ -2335,6 +2357,7 @@ function setSelectedPlanet (id, silent)
2335 catch (e) {}
2357 catch (e) {}
2336 if (!silent)
2358 if (!silent)
2337 {
2359 {
2360 rememberPlanetChoice(found.id);
2338 var grid = document.getElementById('planet-grid');
2361 var grid = document.getElementById('planet-grid');
2339 if (grid && !grid.hidden && grid.children.length)
2362 if (grid && !grid.hidden && grid.children.length)
2340 { renderPlanetGrid('planet-grid', false); }
2363 { renderPlanetGrid('planet-grid', false); }
@@ -2495,6 +2518,102 @@ function refreshMenuAccount ()
2495 { localLogin.hidden = !(typeof Online !== 'undefined' && Online.local); }
2518 { localLogin.hidden = !(typeof Online !== 'undefined' && Online.local); }
2496}
2519}
2497
2520
2521/* ---------- t1193 in-game menu (Spelen / Offline Strijd) ----------- */
2522
2523function setGameMenuButton (show)
2524{
2525 var btn = document.getElementById('btn-game-menu');
2526 if (btn)
2527 { btn.hidden = !show; }
2528}
2529
2530/** The menu can open during a running solo / offline field only. */
2531function canOpenGameMenu ()
2532{
2533 return app.mode === 'playing' && !!app.core && !app.online && !app.spectating
2534 && app.core.state === 'playing' && !app.rewardActive && !app.quitting
2535 && !(app.offline && app.battle && app.battle.state !== 'playing');
2536}
2537
2538function openGameMenu ()
2539{
2540 if (!canOpenGameMenu())
2541 { return false; }
2542 if (app.core.drag)
2543 { finishDrag({ noLaunch: true }); }
2544 app.paused = true;
2545 showEl('game-menu');
2546 var resume = document.getElementById('btn-game-resume');
2547 if (resume && resume.focus)
2548 { resume.focus(); }
2549 return true;
2550}
2551
2552function resumeFromGameMenu ()
2553{
2554 hideEl('game-menu');
2555 if (!app.quitting)
2556 { app.paused = false; }
2557}
2558
2559/**
2560 * "Back to main menu": ends the match now. Logged in, the points so far
2561 * go through the normal play_finish + reward screen first (the server
2562 * still applies its caps); logged out, straight to the menu. Offline
2563 * Strijd ends the whole battle (no next round).
2564 */
2565function quitToMainMenu ()
2566{
2567 if (!app.core || app.quitting)
2568 { return; }
2569 hideEl('game-menu');
2570 app.paused = true;
2571 app.quitting = true;
2572 app.gameOverShown = true;
2573 app.lastScore = app.core.score || 0;
2574 setGameMenuButton(false);
2575 var score = app.lastScore;
2576 var done = function ()
2577 {
2578 app.quitting = false;
2579 app.paused = false;
2580 returnToMenu();
2581 };
2582 if (rewardEnabled())
2583 {
2584 var title = (typeof I18n !== 'undefined') ? I18n.t('reward.ended') : 'Game ended';
2585 showReward(false, finishPlaySession(score), done, title);
2586 }
2587 else
2588 {
2589 finishPlaySession(score);
2590 done();
2591 }
2592}
2593
2594function bindGameMenu ()
2595{
2596 var btn = document.getElementById('btn-game-menu');
2597 if (btn)
2598 { btn.addEventListener('click', function () { openGameMenu(); }); }
2599 var resume = document.getElementById('btn-game-resume');
2600 if (resume)
2601 { resume.addEventListener('click', resumeFromGameMenu); }
2602 var quit = document.getElementById('btn-game-quit');
2603 if (quit)
2604 { quit.addEventListener('click', quitToMainMenu); }
2605 document.addEventListener('keydown', function (e)
2606 {
2607 if (e.key !== 'Escape')
2608 { return; }
2609 var menu = document.getElementById('game-menu');
2610 if (menu && !menu.hidden)
2611 { resumeFromGameMenu(); }
2612 else
2613 { openGameMenu(); }
2614 });
2615}
2616
2498function beginPlaySession (mode)
2617function beginPlaySession (mode)
2499{
2618{
2500 if (app.playToken)
2619 if (app.playToken)
@@ -2550,7 +2669,7 @@ function rewardEnabled ()
2550 * next() — the same destination the mode used before (menu, next
2669 * next() — the same destination the mode used before (menu, next
2551 * offline round, offline result, or the online lobby/podium).
2670 * offline round, offline result, or the online lobby/podium).
2552 */
2671 */
2553function showReward (won, resultPromise, next)
2672function showReward (won, resultPromise, next, title)
2554{
2673{
2555 app.rewardActive = true;
2674 app.rewardActive = true;
2556 hideEl('game-over');
2675 hideEl('game-over');
@@ -2558,6 +2677,7 @@ function showReward (won, resultPromise, next)
2558 hideEl('podium');
2677 hideEl('podium');
2559 var handle = Reward.play({
2678 var handle = Reward.play({
2560 won: won,
2679 won: won,
2680 title: title || null,
2561 planet: app.planet,
2681 planet: app.planet,
2562 result: resultPromise,
2682 result: resultPromise,
2563 onDone: function ()
2683 onDone: function ()
@@ -2568,7 +2688,12 @@ function showReward (won, resultPromise, next)
2568 }
2688 }
2569 });
2689 });
2570 if (!handle)
2690 if (!handle)
2571 { app.rewardActive = false; }
2691 {
2692 app.rewardActive = false;
2693 // No reward overlay (e.g. missing DOM): still continue (t1193).
2694 if (title && next)
2695 { next(); }
2696 }
2572}
2697}
2573
2698
2574function myOnlinePlace (lobby)
2699function myOnlinePlace (lobby)
src/offline.js +14 −6
@@ -666,9 +666,21 @@ function OfflineBattle (opts)
666 666 this.shotLocals = [];
667 667 this.bots = [];
668 668 this.playerId = 'player';
669 /** Opponents knocked out over all rounds of this battle (t1198). */
670 this.defeated = 0;
669 671 this._initBots();
670 672 }
671 673
674 /** Mark a bot as out once; counts towards `defeated` (t1198). */
675 OfflineBattle.prototype._eliminate = function (bot)
676 {
677 if (bot.eliminated)
678 { return; }
679 bot.eliminated = true;
680 bot.score = bot.core ? bot.core.score : bot.score;
681 this.defeated += 1;
682 };
683
672 684 OfflineBattle.prototype._initBots = function ()
673 685 {
674 686 var P = PlanetMod();
@@ -826,8 +838,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
826 838 { continue; }
827 839 if (bot.core.state === 'gameover')
828 840 {
829 bot.eliminated = true;
830 bot.score = bot.core.score;
841 this._eliminate(bot);
831 842 continue;
832 843 }
833 844 bot.core.tick(dt);
@@ -854,10 +865,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
854 865 for (var i = 0; i < this.bots.length; i++)
855 866 {
856 867 if (this.bots[i].core && this.bots[i].core.state === 'gameover')
857 {
858 this.bots[i].eliminated = true;
859 this.bots[i].score = this.bots[i].core.score;
860 }
868 { this._eliminate(this.bots[i]); }
861 869 }
862 870
863 871 if (playerCore && playerCore.state === 'gameover')
@@ -666,9 +666,21 @@ function OfflineBattle (opts)
666 this.shotLocals = [];
666 this.shotLocals = [];
667 this.bots = [];
667 this.bots = [];
668 this.playerId = 'player';
668 this.playerId = 'player';
669 /** Opponents knocked out over all rounds of this battle (t1198). */
670 this.defeated = 0;
669 this._initBots();
671 this._initBots();
670}
672}
671
673
674/** Mark a bot as out once; counts towards `defeated` (t1198). */
675OfflineBattle.prototype._eliminate = function (bot)
676{
677 if (bot.eliminated)
678 { return; }
679 bot.eliminated = true;
680 bot.score = bot.core ? bot.core.score : bot.score;
681 this.defeated += 1;
682};
683
672OfflineBattle.prototype._initBots = function ()
684OfflineBattle.prototype._initBots = function ()
673{
685{
674 var P = PlanetMod();
686 var P = PlanetMod();
@@ -826,8 +838,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
826 { continue; }
838 { continue; }
827 if (bot.core.state === 'gameover')
839 if (bot.core.state === 'gameover')
828 {
840 {
829 bot.eliminated = true;
841 this._eliminate(bot);
830 bot.score = bot.core.score;
831 continue;
842 continue;
832 }
843 }
833 bot.core.tick(dt);
844 bot.core.tick(dt);
@@ -854,10 +865,7 @@ OfflineBattle.prototype.tick = function (dt, playerCore)
854 for (var i = 0; i < this.bots.length; i++)
865 for (var i = 0; i < this.bots.length; i++)
855 {
866 {
856 if (this.bots[i].core && this.bots[i].core.state === 'gameover')
867 if (this.bots[i].core && this.bots[i].core.state === 'gameover')
857 {
868 { this._eliminate(this.bots[i]); }
858 this.bots[i].eliminated = true;
859 this.bots[i].score = this.bots[i].core.score;
860 }
861 }
869 }
862
870
863 if (playerCore && playerCore.state === 'gameover')
871 if (playerCore && playerCore.state === 'gameover')
src/online.js +11 −1
@@ -77,6 +77,8 @@ Online._apply = function (data)
77 77 { this.lifetimePoints = data.lifetime_points; }
78 78 if (data.locale !== undefined)
79 79 { this.locale = data.locale; }
80 if (data.last_planet !== undefined)
81 { this.lastPlanet = data.last_planet; }
80 82 if (data.blocks)
81 83 { this.blocks = data.blocks; }
82 84 if (data.planets)
@@ -184,6 +186,13 @@ Online.deletePlanet = function (id)
184 186 return this.request('planet_delete', { id: id });
185 187 };
186 188
189 /** Remember the last chosen planet on the profile (t1196). */
190 Online.setLastPlanet = function (planetId)
191 {
192 this.lastPlanet = planetId;
193 return this.request('set_last_planet', { planet_id: planetId });
194 };
195
187 196 Online.setLocale = function (locale)
188 197 {
189 198 return this.request('set_locale', { locale: locale });
@@ -362,9 +371,10 @@ Online.stopPolling = function ()
362 371 }
363 372 };
364 373
374 /** Login from the Online screen: come back to online play (t1193). */
365 375 Online.loginUrl = function ()
366 376 {
367 return 'auth.php';
377 return 'auth.php?return=online';
368 378 };
369 379
370 380 Online.logoutUrl = function ()
@@ -77,6 +77,8 @@ Online._apply = function (data)
77 { this.lifetimePoints = data.lifetime_points; }
77 { this.lifetimePoints = data.lifetime_points; }
78 if (data.locale !== undefined)
78 if (data.locale !== undefined)
79 { this.locale = data.locale; }
79 { this.locale = data.locale; }
80 if (data.last_planet !== undefined)
81 { this.lastPlanet = data.last_planet; }
80 if (data.blocks)
82 if (data.blocks)
81 { this.blocks = data.blocks; }
83 { this.blocks = data.blocks; }
82 if (data.planets)
84 if (data.planets)
@@ -184,6 +186,13 @@ Online.deletePlanet = function (id)
184 return this.request('planet_delete', { id: id });
186 return this.request('planet_delete', { id: id });
185};
187};
186
188
189/** Remember the last chosen planet on the profile (t1196). */
190Online.setLastPlanet = function (planetId)
191{
192 this.lastPlanet = planetId;
193 return this.request('set_last_planet', { planet_id: planetId });
194};
195
187Online.setLocale = function (locale)
196Online.setLocale = function (locale)
188{
197{
189 return this.request('set_locale', { locale: locale });
198 return this.request('set_locale', { locale: locale });
@@ -362,9 +371,10 @@ Online.stopPolling = function ()
362 }
371 }
363};
372};
364
373
374/** Login from the Online screen: come back to online play (t1193). */
365Online.loginUrl = function ()
375Online.loginUrl = function ()
366{
376{
367 return 'auth.php';
377 return 'auth.php?return=online';
368};
378};
369
379
370Online.logoutUrl = function ()
380Online.logoutUrl = function ()
src/reward.js +40 −18
@@ -7,10 +7,15 @@
7 7 * planet arc from the top of the screen into a counter at the bottom
8 8 * centre, one block per newly earned point. Each arrival adds 1.
9 9 *
10 * Spawn rate accelerates: rate(t) = RATE0 + ACCEL·t blocks/s, so the
11 * number spawned after t seconds is N(t) = RATE0·t + ACCEL·t²/2, and
12 * block i (0-based) leaves at T(i) = the t where N(t) = i.
13 * t1178: RATE0 = 15, ACCEL = 10 → 253 points ≈ 5.8 s, 800 ≈ 11.2 s, 2000 ≈ 18.6 s.
10 * Spawn rate (t1194): starts at RATE0 = 3 blocks/s and accelerates
11 * linearly, rate(t) = RATE0 + a·t, with `a` chosen per reward so the last
12 * block always leaves at SPAWN_END = 4 s, whatever the point count.
13 * Blocks spawned after t seconds: N(t) = RATE0·t + a·t²/2; block i
14 * (0-based) leaves at T(i) = the t where N(t) = i. The last block is
15 * i = n − 1, so N(4) = n − 1 → a = 2·((n − 1) − RATE0·T) / T².
16 * If n − 1 ≤ RATE0·T (n ≤ 13) a would be ≤ 0: then a constant rate
17 * (n − 1) / T is used (a = 0), so it still ends at 4 s (1 point: one
18 * block at t = 0).
14 19 *
15 20 * The pure timing / sequencing part (Reward.spawnTime, Reward.createSequence)
16 21 * has no DOM and is unit-tested. Reward.play wires it to an overlay.
@@ -19,10 +24,10 @@
19 24 {
20 25 'use strict';
21 26
22 /** Blocks per second at t = 0 (t1177: 10, t1178: 15). */
23 var RATE0 = 15;
24 /** Rate increase in blocks/s per second (t1175: 3, t1177: 5, t1178: 10). */
25 var ACCEL = 10;
27 /** Blocks per second at t = 0 (t1177: 10, t1178: 15, t1194: 3). */
28 var RATE0 = 3;
29 /** Seconds after the first block when the last block leaves (t1194). */
30 var SPAWN_END = 4;
26 31 var INTRO = 1.0; // centred title before it rises
27 32 var RISE = 0.6; // title tween to the top
28 33 var FLIGHT = 0.7; // one block's arc duration
@@ -30,14 +35,28 @@ var HOLD = 1.5; // final total shown before continuing
30 35 var HOLD_ZERO = 1.5; // earned 0: show the number briefly
31 36 var WAIT_MAX = 8; // give up waiting for the server after this
32 37
33 /** Seconds after the start of counting when block i (0-based) leaves. */
34 function spawnTime (i)
38 /**
39 * Spawn parameters for a reward of n blocks (t1194): { r0, a } with
40 * rate(t) = r0 + a·t and the last block (i = n − 1) leaving at SPAWN_END.
41 */
42 function spawnParams (n)
43 {
44 var T = SPAWN_END;
45 var last = Math.max(0, (n | 0) - 1);
46 if (last <= RATE0 * T)
47 { return { r0: last / T, a: 0 }; }
48 return { r0: RATE0, a: 2 * (last - RATE0 * T) / (T * T) };
49 }
50
51 /** Seconds after the start of counting when block i (0-based) of n leaves. */
52 function spawnTime (i, n)
35 53 {
36 54 if (!(i > 0))
37 55 { return 0; }
38 if (ACCEL === 0)
39 { return i / RATE0; }
40 return (-RATE0 + Math.sqrt(RATE0 * RATE0 + 2 * ACCEL * i)) / ACCEL;
56 var p = spawnParams(n == null ? i + 1 : n);
57 if (p.a === 0)
58 { return p.r0 > 0 ? i / p.r0 : 0; }
59 return (-p.r0 + Math.sqrt(p.r0 * p.r0 + 2 * p.a * i)) / p.a;
41 60 }
42 61
43 62 /** Blocks spawned (left the top) by time t, capped at n. */
@@ -45,8 +64,9 @@ function spawnedBy (t, n)
45 64 {
46 65 if (!(t >= 0) || !(n > 0))
47 66 { return 0; }
67 var p = spawnParams(n);
48 68 // Block i has left when T(i) <= t, i.e. i <= N(t).
49 var k = Math.floor(RATE0 * t + ACCEL * t * t / 2 + 1e-9) + 1;
69 var k = Math.floor(p.r0 * t + p.a * t * t / 2 + 1e-9) + 1;
50 70 return Math.min(n, Math.max(0, k));
51 71 }
52 72
@@ -63,7 +83,7 @@ function countDuration (n, flight)
63 83 flight = flight == null ? FLIGHT : flight;
64 84 if (!(n > 0))
65 85 { return 0; }
66 return spawnTime(n - 1) + flight;
86 return spawnTime(n - 1, n) + flight;
67 87 }
68 88
69 89 /**
@@ -295,8 +315,9 @@ function play (opts)
295 315 var W = 0;
296 316 var H = 0;
297 317
298 title.textContent = opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...');
299 title.className = 'reward-title' + (opts.won ? ' won' : ' lost');
318 // t1193: quitting via the in-game menu shows a neutral title.
319 title.textContent = opts.title ? String(opts.title) : (opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...'));
320 title.className = 'reward-title' + (opts.title ? ' ended' : (opts.won ? ' won' : ' lost'));
300 321 if (label)
301 322 { label.textContent = tr('reward.total', 'Total points'); }
302 323 counter.textContent = '';
@@ -482,7 +503,8 @@ function play (opts)
482 503
483 504 var Reward = {
484 505 RATE0: RATE0,
485 ACCEL: ACCEL,
506 SPAWN_END: SPAWN_END,
507 spawnParams: spawnParams,
486 508 INTRO: INTRO,
487 509 RISE: RISE,
488 510 FLIGHT: FLIGHT,
@@ -7,10 +7,15 @@
7 * planet arc from the top of the screen into a counter at the bottom
7 * planet arc from the top of the screen into a counter at the bottom
8 * centre, one block per newly earned point. Each arrival adds 1.
8 * centre, one block per newly earned point. Each arrival adds 1.
9 *
9 *
10 * Spawn rate accelerates: rate(t) = RATE0 + ACCEL·t blocks/s, so the
10 * Spawn rate (t1194): starts at RATE0 = 3 blocks/s and accelerates
11 * number spawned after t seconds is N(t) = RATE0·t + ACCEL·t²/2, and
11 * linearly, rate(t) = RATE0 + a·t, with `a` chosen per reward so the last
12 * block i (0-based) leaves at T(i) = the t where N(t) = i.
12 * block always leaves at SPAWN_END = 4 s, whatever the point count.
13 * t1178: RATE0 = 15, ACCEL = 10 → 253 points ≈ 5.8 s, 800 ≈ 11.2 s, 2000 ≈ 18.6 s.
13 * Blocks spawned after t seconds: N(t) = RATE0·t + a·t²/2; block i
14 * (0-based) leaves at T(i) = the t where N(t) = i. The last block is
15 * i = n − 1, so N(4) = n − 1 → a = 2·((n − 1) − RATE0·T) / T².
16 * If n − 1 ≤ RATE0·T (n ≤ 13) a would be ≤ 0: then a constant rate
17 * (n − 1) / T is used (a = 0), so it still ends at 4 s (1 point: one
18 * block at t = 0).
14 *
19 *
15 * The pure timing / sequencing part (Reward.spawnTime, Reward.createSequence)
20 * The pure timing / sequencing part (Reward.spawnTime, Reward.createSequence)
16 * has no DOM and is unit-tested. Reward.play wires it to an overlay.
21 * has no DOM and is unit-tested. Reward.play wires it to an overlay.
@@ -19,10 +24,10 @@
19{
24{
20'use strict';
25'use strict';
21
26
22/** Blocks per second at t = 0 (t1177: 10, t1178: 15). */
27/** Blocks per second at t = 0 (t1177: 10, t1178: 15, t1194: 3). */
23var RATE0 = 15;
28var RATE0 = 3;
24/** Rate increase in blocks/s per second (t1175: 3, t1177: 5, t1178: 10). */
29/** Seconds after the first block when the last block leaves (t1194). */
25var ACCEL = 10;
30var SPAWN_END = 4;
26var INTRO = 1.0; // centred title before it rises
31var INTRO = 1.0; // centred title before it rises
27var RISE = 0.6; // title tween to the top
32var RISE = 0.6; // title tween to the top
28var FLIGHT = 0.7; // one block's arc duration
33var FLIGHT = 0.7; // one block's arc duration
@@ -30,14 +35,28 @@ var HOLD = 1.5; // final total shown before continuing
30var HOLD_ZERO = 1.5; // earned 0: show the number briefly
35var HOLD_ZERO = 1.5; // earned 0: show the number briefly
31var WAIT_MAX = 8; // give up waiting for the server after this
36var WAIT_MAX = 8; // give up waiting for the server after this
32
37
33/** Seconds after the start of counting when block i (0-based) leaves. */
38/**
34function spawnTime (i)
39 * Spawn parameters for a reward of n blocks (t1194): { r0, a } with
40 * rate(t) = r0 + a·t and the last block (i = n − 1) leaving at SPAWN_END.
41 */
42function spawnParams (n)
43{
44 var T = SPAWN_END;
45 var last = Math.max(0, (n | 0) - 1);
46 if (last <= RATE0 * T)
47 { return { r0: last / T, a: 0 }; }
48 return { r0: RATE0, a: 2 * (last - RATE0 * T) / (T * T) };
49}
50
51/** Seconds after the start of counting when block i (0-based) of n leaves. */
52function spawnTime (i, n)
35{
53{
36 if (!(i > 0))
54 if (!(i > 0))
37 { return 0; }
55 { return 0; }
38 if (ACCEL === 0)
56 var p = spawnParams(n == null ? i + 1 : n);
39 { return i / RATE0; }
57 if (p.a === 0)
40 return (-RATE0 + Math.sqrt(RATE0 * RATE0 + 2 * ACCEL * i)) / ACCEL;
58 { return p.r0 > 0 ? i / p.r0 : 0; }
59 return (-p.r0 + Math.sqrt(p.r0 * p.r0 + 2 * p.a * i)) / p.a;
41}
60}
42
61
43/** Blocks spawned (left the top) by time t, capped at n. */
62/** Blocks spawned (left the top) by time t, capped at n. */
@@ -45,8 +64,9 @@ function spawnedBy (t, n)
45{
64{
46 if (!(t >= 0) || !(n > 0))
65 if (!(t >= 0) || !(n > 0))
47 { return 0; }
66 { return 0; }
67 var p = spawnParams(n);
48 // Block i has left when T(i) <= t, i.e. i <= N(t).
68 // Block i has left when T(i) <= t, i.e. i <= N(t).
49 var k = Math.floor(RATE0 * t + ACCEL * t * t / 2 + 1e-9) + 1;
69 var k = Math.floor(p.r0 * t + p.a * t * t / 2 + 1e-9) + 1;
50 return Math.min(n, Math.max(0, k));
70 return Math.min(n, Math.max(0, k));
51}
71}
52
72
@@ -63,7 +83,7 @@ function countDuration (n, flight)
63 flight = flight == null ? FLIGHT : flight;
83 flight = flight == null ? FLIGHT : flight;
64 if (!(n > 0))
84 if (!(n > 0))
65 { return 0; }
85 { return 0; }
66 return spawnTime(n - 1) + flight;
86 return spawnTime(n - 1, n) + flight;
67}
87}
68
88
69/**
89/**
@@ -295,8 +315,9 @@ function play (opts)
295 var W = 0;
315 var W = 0;
296 var H = 0;
316 var H = 0;
297
317
298 title.textContent = opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...');
318 // t1193: quitting via the in-game menu shows a neutral title.
299 title.className = 'reward-title' + (opts.won ? ' won' : ' lost');
319 title.textContent = opts.title ? String(opts.title) : (opts.won ? tr('reward.won', 'You won!') : tr('reward.lost', 'You lost...'));
320 title.className = 'reward-title' + (opts.title ? ' ended' : (opts.won ? ' won' : ' lost'));
300 if (label)
321 if (label)
301 { label.textContent = tr('reward.total', 'Total points'); }
322 { label.textContent = tr('reward.total', 'Total points'); }
302 counter.textContent = '';
323 counter.textContent = '';
@@ -482,7 +503,8 @@ function play (opts)
482
503
483var Reward = {
504var Reward = {
484 RATE0: RATE0,
505 RATE0: RATE0,
485 ACCEL: ACCEL,
506 SPAWN_END: SPAWN_END,
507 spawnParams: spawnParams,
486 INTRO: INTRO,
508 INTRO: INTRO,
487 RISE: RISE,
509 RISE: RISE,
488 FLIGHT: FLIGHT,
510 FLIGHT: FLIGHT,
test/combo.test.js added +97 −0
@@ -0,0 +1,97 @@
1 'use strict';
2
3 // t1197: combo — each match adds +5% jump height (additive with the
4 // landing-chain bonus); resets after 5 s without a match.
5
6 const { describe, it } = require('node:test');
7 const assert = require('node:assert/strict');
8 const { makeGame, almost, GameCore, Planet } = require('./helpers.js');
9
10
11 function run (g, secs)
12 {
13 for (let t = 0; t < secs - 1e-9; t += 0.05) g.tick(0.05);
14 }
15
16 function freshMatch (g, color)
17 {
18 const h = makeGame({ noSpawn: true });
19 h.combo = g.combo;
20 h.comboAge = g.comboAge;
21 h.place(0, 0, color);
22 h.place(1, 0, color);
23 h.place(2, 0, color);
24 const l = h.resolveMatches();
25 g.combo = h.combo;
26 g.comboAge = h.comboAge;
27 g.lastChainIndicator = h.lastChainIndicator;
28 return l[0];
29 }
30
31 describe('Match combo (t1197)', () =>
32 {
33 const base = () => Planet.jumpHeight(makeGame({ noSpawn: true }).planet, 3, false);
34
35 it('constants', () =>
36 {
37 assert.equal(GameCore.COMBO_STEP, 0.05);
38 assert.equal(GameCore.COMBO_RESET_S, 5);
39 });
40
41 it('first match +0%, then +5%, +10%, ... per earlier match in the combo', () =>
42 {
43 const g = makeGame({ noSpawn: true });
44 for (let k = 0; k < 4; k++)
45 {
46 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));
49 assert.equal(g.combo, k + 1);
50 }
51 assert.equal(g.lastChainIndicator.bonusPct, 15);
52 assert.equal(g.comboBonusPct(), 20);
53 });
54
55 it('adds to the landing-chain bonus (chain 1 + 2 combo matches = +35%)', () =>
56 {
57 const g = makeGame({ noSpawn: true });
58 g.combo = 2;
59 g.place(0, 0, 2);
60 g.place(1, 0, 2);
61 const cluster = { id: g.nextClusterId++, jumpHeight: 3, vy: 0, decel: 0, phase: 'down', landingChain: 0 };
62 g.clusters[cluster.id] = cluster;
63 const b = g.createBlock(2, 0, 2, 'flying');
64 b.clusterId = cluster.id;
65 g.landCluster(cluster, [b]);
66 const l = g.resolveMatches()[0];
67 assert.ok(almost(l.chainBonus, 1.35, 1e-12));
68 assert.equal(g.lastChainIndicator.bonusPct, 35);
69 });
70
71 it('resets after 5 s without a match, not before', () =>
72 {
73 const g = makeGame({ noSpawn: true });
74 freshMatch(g, 1);
75 freshMatch(g, 2);
76 assert.equal(g.combo, 2);
77 run(g, 4.9);
78 assert.equal(g.combo, 2, 'still alive at 4.9 s');
79 freshMatch(g, 3); // a match restarts the 5 s window
80 assert.equal(g.combo, 3);
81 run(g, 4.0);
82 assert.equal(g.combo, 3);
83 run(g, 1.1);
84 assert.equal(g.combo, 0, 'gone after 5 s without a match');
85 const l = freshMatch(g, 1);
86 assert.equal(l.comboBonus, 0);
87 });
88
89 it('bots share it: an offline bot core is a GameCore with the same combo', () =>
90 {
91 const Offline = require('../src/offline.js');
92 const battle = Offline.createBattle({ playerPlanet: Planet.defaultPlanet(), rng: () => 0.5 });
93 const bot = battle.bots[0].core;
94 assert.equal(bot.combo, 0);
95 assert.equal(typeof bot.comboBonusPct, 'function');
96 });
97 });
@@ -0,0 +1,97 @@
1'use strict';
2
3// t1197: combo — each match adds +5% jump height (additive with the
4// landing-chain bonus); resets after 5 s without a match.
5
6const { describe, it } = require('node:test');
7const assert = require('node:assert/strict');
8const { makeGame, almost, GameCore, Planet } = require('./helpers.js');
9
10
11function run (g, secs)
12{
13 for (let t = 0; t < secs - 1e-9; t += 0.05) g.tick(0.05);
14}
15
16function freshMatch (g, color)
17{
18 const h = makeGame({ noSpawn: true });
19 h.combo = g.combo;
20 h.comboAge = g.comboAge;
21 h.place(0, 0, color);
22 h.place(1, 0, color);
23 h.place(2, 0, color);
24 const l = h.resolveMatches();
25 g.combo = h.combo;
26 g.comboAge = h.comboAge;
27 g.lastChainIndicator = h.lastChainIndicator;
28 return l[0];
29}
30
31describe('Match combo (t1197)', () =>
32{
33 const base = () => Planet.jumpHeight(makeGame({ noSpawn: true }).planet, 3, false);
34
35 it('constants', () =>
36 {
37 assert.equal(GameCore.COMBO_STEP, 0.05);
38 assert.equal(GameCore.COMBO_RESET_S, 5);
39 });
40
41 it('first match +0%, then +5%, +10%, ... per earlier match in the combo', () =>
42 {
43 const g = makeGame({ noSpawn: true });
44 for (let k = 0; k < 4; k++)
45 {
46 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));
49 assert.equal(g.combo, k + 1);
50 }
51 assert.equal(g.lastChainIndicator.bonusPct, 15);
52 assert.equal(g.comboBonusPct(), 20);
53 });
54
55 it('adds to the landing-chain bonus (chain 1 + 2 combo matches = +35%)', () =>
56 {
57 const g = makeGame({ noSpawn: true });
58 g.combo = 2;
59 g.place(0, 0, 2);
60 g.place(1, 0, 2);
61 const cluster = { id: g.nextClusterId++, jumpHeight: 3, vy: 0, decel: 0, phase: 'down', landingChain: 0 };
62 g.clusters[cluster.id] = cluster;
63 const b = g.createBlock(2, 0, 2, 'flying');
64 b.clusterId = cluster.id;
65 g.landCluster(cluster, [b]);
66 const l = g.resolveMatches()[0];
67 assert.ok(almost(l.chainBonus, 1.35, 1e-12));
68 assert.equal(g.lastChainIndicator.bonusPct, 35);
69 });
70
71 it('resets after 5 s without a match, not before', () =>
72 {
73 const g = makeGame({ noSpawn: true });
74 freshMatch(g, 1);
75 freshMatch(g, 2);
76 assert.equal(g.combo, 2);
77 run(g, 4.9);
78 assert.equal(g.combo, 2, 'still alive at 4.9 s');
79 freshMatch(g, 3); // a match restarts the 5 s window
80 assert.equal(g.combo, 3);
81 run(g, 4.0);
82 assert.equal(g.combo, 3);
83 run(g, 1.1);
84 assert.equal(g.combo, 0, 'gone after 5 s without a match');
85 const l = freshMatch(g, 1);
86 assert.equal(l.comboBonus, 0);
87 });
88
89 it('bots share it: an offline bot core is a GameCore with the same combo', () =>
90 {
91 const Offline = require('../src/offline.js');
92 const battle = Offline.createBattle({ playerPlanet: Planet.defaultPlanet(), rng: () => 0.5 });
93 const bot = battle.bots[0].core;
94 assert.equal(bot.combo, 0);
95 assert.equal(typeof bot.comboBonusPct, 'function');
96 });
97});
test/offline-defeated.test.js added +57 −0
@@ -0,0 +1,57 @@
1 'use strict';
2
3 // t1198: Offline Strijd result shows "X opponents defeated" over all rounds.
4
5 const { describe, it } = require('node:test');
6 const assert = require('node:assert/strict');
7 const { makeGame, Planet, Rng } = require('./helpers.js');
8 const Offline = require('../src/offline.js');
9 const I18n = require('../src/i18n.js');
10
11 function knockOutAll (battle, player)
12 {
13 for (const b of battle.bots) b.core.state = 'gameover';
14 battle.tick(0.016, player);
15 }
16
17 describe('Offline defeated counter (t1198)', () =>
18 {
19 it('counts every opponent knocked out, across rounds, once each', () =>
20 {
21 const battle = Offline.createBattle({ playerPlanet: Planet.defaultPlanet(), rng: Rng.create(3), round: 1 });
22 const player = makeGame({ noSpawn: true });
23 assert.equal(battle.defeated, 0);
24 knockOutAll(battle, player); // round 1: 1 bot
25 assert.equal(battle.state, 'round_won');
26 assert.equal(battle.defeated, 1);
27 battle.tick(0.016, player); // no double count
28 assert.equal(battle.defeated, 1);
29 battle.advanceRound(); // round 2: 2 bots
30 const n2 = battle.bots.length;
31 battle.bots[0].core.state = 'gameover';
32 battle.tick(0.016, player);
33 assert.equal(battle.defeated, 2, 'one of round 2 out');
34 player.state = 'gameover'; // player loses round 2
35 battle.tick(0.016, player);
36 assert.equal(battle.state, 'lost');
37 assert.equal(battle.defeated, 2, 'remaining bots of the lost round are not counted');
38 assert.ok(n2 >= 2);
39 });
40
41 it('i18n: singular / plural in every language, no skill line left', () =>
42 {
43 const cat = require('../server/lib/i18n.json');
44 for (const loc of cat.localeIds)
45 {
46 I18n.setLocale ? I18n.setLocale(loc) : (I18n.locale = loc);
47 const one = I18n.plural('offline.defeated', 1, { n: 1 });
48 const many = I18n.plural('offline.defeated', 7, { n: 7 });
49 assert.ok(one.includes('1') && many.includes('7'), loc + ': ' + one + ' / ' + many);
50 assert.equal(cat.locales[loc]['offline.detail'], undefined, loc + ' old detail removed');
51 }
52 I18n.setLocale ? I18n.setLocale('nl') : (I18n.locale = 'nl');
53 assert.equal(I18n.plural('offline.defeated', 1, { n: 1 }), '1 tegenstander verslagen');
54 assert.equal(I18n.plural('offline.defeated', 3, { n: 3 }), '3 tegenstanders verslagen');
55 I18n.setLocale ? I18n.setLocale('en') : (I18n.locale = 'en');
56 });
57 });
@@ -0,0 +1,57 @@
1'use strict';
2
3// t1198: Offline Strijd result shows "X opponents defeated" over all rounds.
4
5const { describe, it } = require('node:test');
6const assert = require('node:assert/strict');
7const { makeGame, Planet, Rng } = require('./helpers.js');
8const Offline = require('../src/offline.js');
9const I18n = require('../src/i18n.js');
10
11function knockOutAll (battle, player)
12{
13 for (const b of battle.bots) b.core.state = 'gameover';
14 battle.tick(0.016, player);
15}
16
17describe('Offline defeated counter (t1198)', () =>
18{
19 it('counts every opponent knocked out, across rounds, once each', () =>
20 {
21 const battle = Offline.createBattle({ playerPlanet: Planet.defaultPlanet(), rng: Rng.create(3), round: 1 });
22 const player = makeGame({ noSpawn: true });
23 assert.equal(battle.defeated, 0);
24 knockOutAll(battle, player); // round 1: 1 bot
25 assert.equal(battle.state, 'round_won');
26 assert.equal(battle.defeated, 1);
27 battle.tick(0.016, player); // no double count
28 assert.equal(battle.defeated, 1);
29 battle.advanceRound(); // round 2: 2 bots
30 const n2 = battle.bots.length;
31 battle.bots[0].core.state = 'gameover';
32 battle.tick(0.016, player);
33 assert.equal(battle.defeated, 2, 'one of round 2 out');
34 player.state = 'gameover'; // player loses round 2
35 battle.tick(0.016, player);
36 assert.equal(battle.state, 'lost');
37 assert.equal(battle.defeated, 2, 'remaining bots of the lost round are not counted');
38 assert.ok(n2 >= 2);
39 });
40
41 it('i18n: singular / plural in every language, no skill line left', () =>
42 {
43 const cat = require('../server/lib/i18n.json');
44 for (const loc of cat.localeIds)
45 {
46 I18n.setLocale ? I18n.setLocale(loc) : (I18n.locale = loc);
47 const one = I18n.plural('offline.defeated', 1, { n: 1 });
48 const many = I18n.plural('offline.defeated', 7, { n: 7 });
49 assert.ok(one.includes('1') && many.includes('7'), loc + ': ' + one + ' / ' + many);
50 assert.equal(cat.locales[loc]['offline.detail'], undefined, loc + ' old detail removed');
51 }
52 I18n.setLocale ? I18n.setLocale('nl') : (I18n.locale = 'nl');
53 assert.equal(I18n.plural('offline.defeated', 1, { n: 1 }), '1 tegenstander verslagen');
54 assert.equal(I18n.plural('offline.defeated', 3, { n: 3 }), '3 tegenstanders verslagen');
55 I18n.setLocale ? I18n.setLocale('en') : (I18n.locale = 'en');
56 });
57});
test/reward.test.js +67 −30
@@ -28,49 +28,60 @@ function runToEnd (seq, dt, maxT)
28 28 return { events, t, spawned, arrived, monotonic, last: events[events.length - 1] };
29 29 }
30 30
31 describe('Reward spawn schedule (t1178: 15 + 10t blocks/s)', () =>
31 describe('Reward spawn schedule (t1194: 3 blocks/s, last block at 4 s)', () =>
32 32 {
33 it('block i leaves when 15t + 10t²/2 = i', () =>
33 it('constants and per-reward acceleration a = 2((n−1) − 3·4) / 4²', () =>
34 34 {
35 assert.equal(Reward.RATE0, 15);
36 assert.equal(Reward.ACCEL, 10);
37 assert.equal(Reward.spawnTime(0), 0);
38 for (const i of [1, 5, 10, 50, 100, 252, 1000])
35 assert.equal(Reward.RATE0, 3);
36 assert.equal(Reward.SPAWN_END, 4);
37 assert.deepEqual(Reward.spawnParams(253), { r0: 3, a: 2 * (252 - 12) / 16 });
38 assert.deepEqual(Reward.spawnParams(13), { r0: 3, a: 0 });
39 assert.deepEqual(Reward.spawnParams(5), { r0: 1, a: 0 }, 'n ≤ 13: constant (n−1)/4');
40 assert.deepEqual(Reward.spawnParams(1), { r0: 0, a: 0 });
41 });
42
43 it('the last block always leaves at 4 s, whatever the point count', () =>
44 {
45 for (const n of [2, 5, 12, 13, 14, 50, 253, 800, 2000, 10000])
46 {
47 const last = Reward.spawnTime(n - 1, n);
48 assert.ok(Math.abs(last - 4) < 1e-9, 'n=' + n + ' last=' + last);
49 assert.ok(Reward.spawnedBy(4 - 1e-3, n) < n, 'n=' + n + ' not all out just before 4 s');
50 assert.equal(Reward.spawnedBy(4 + 1e-6, n), n, 'n=' + n + ' at 4 s');
51 assert.ok(Math.abs(Reward.countDuration(n) - (4 + Reward.FLIGHT)) < 1e-9);
52 }
53 assert.equal(Reward.spawnTime(0, 1), 0);
54 assert.equal(Reward.countDuration(1), Reward.FLIGHT);
55 });
56
57 it('block i leaves when 3t + a·t²/2 = i; starts at 3/s and accelerates', () =>
58 {
59 const n = 253;
60 const { r0, a } = Reward.spawnParams(n);
61 for (const i of [1, 5, 10, 50, 100, 252])
39 62 {
40 const t = Reward.spawnTime(i);
41 assert.ok(Math.abs(15 * t + 10 * t * t / 2 - i) < 1e-9, 'i=' + i + ' t=' + t);
63 const t = Reward.spawnTime(i, n);
64 assert.ok(Math.abs(r0 * t + a * t * t / 2 - i) < 1e-9, 'i=' + i + ' t=' + t);
42 65 }
43 // spawn times strictly increase, gaps shrink (accelerating)
66 // First gap ≈ 1/3 s at the start rate (slightly less: it accelerates).
67 const g1 = Reward.spawnTime(1, n);
68 assert.ok(g1 < 1 / 3 && g1 > 0.1, 'first gap ' + g1);
44 69 let prevGap = Infinity;
45 for (let i = 1; i < 300; i++)
70 for (let i = 1; i < n; i++)
46 71 {
47 const gap = Reward.spawnTime(i) - Reward.spawnTime(i - 1);
72 const gap = Reward.spawnTime(i, n) - Reward.spawnTime(i - 1, n);
48 73 assert.ok(gap > 0);
49 74 assert.ok(gap <= prevGap + 1e-12, 'gap grew at ' + i);
50 75 prevGap = gap;
51 76 }
52 77 });
53 78
54 it('starts at 15/s; 253 ≈ 5.8 s, 800 ≈ 11.2 s, 2000 ≈ 18.6 s (Tim\'s examples)', () =>
55 {
56 // 1/5 s between the first two blocks.
57 assert.ok(Math.abs(Reward.spawnTime(1) - (-15 + Math.sqrt(245)) / 10) < 1e-12);
58 assert.ok(Reward.spawnTime(1) > 0.06 && Reward.spawnTime(1) < 0.067);
59 const last = (-15 + Math.sqrt(225 + 20 * 252)) / 10;
60 assert.ok(Math.abs(Reward.spawnTime(252) - last) < 1e-9);
61 assert.ok(last > 5.7 && last < 5.85, 'last=' + last);
62 assert.ok(Math.abs(Reward.spawnTime(799) - 11.2) < 0.05, '800: ' + Reward.spawnTime(799));
63 assert.ok(Math.abs(Reward.spawnTime(1999) - 18.6) < 0.1, '2000: ' + Reward.spawnTime(1999));
64 assert.equal(Reward.spawnedBy(last + 1e-6, 253), 253);
65 assert.equal(Reward.spawnedBy(last - 0.01, 253), 252);
66 assert.ok(Math.abs(Reward.countDuration(253) - (last + Reward.FLIGHT)) < 1e-9);
67 });
68
69 it('spawnedBy matches floor(15t + 10t²/2) + 1, capped by n', () =>
79 it('spawnedBy matches floor(r0·t + a·t²/2) + 1, capped by n', () =>
70 80 {
71 for (let t = 0; t <= 20; t += 0.37)
81 const { r0, a } = Reward.spawnParams(253);
82 for (let t = 0; t <= 6; t += 0.137)
72 83 {
73 const expect = Math.min(253, Math.floor(15 * t + 10 * t * t / 2 + 1e-9) + 1);
84 const expect = Math.min(253, Math.floor(r0 * t + a * t * t / 2 + 1e-9) + 1);
74 85 assert.equal(Reward.spawnedBy(t, 253), expect, 't=' + t);
75 86 }
76 87 assert.equal(Reward.spawnedBy(-1, 10), 0);
@@ -79,11 +90,37 @@ describe('Reward spawn schedule (t1178: 15 + 10t blocks/s)', () =>
79 90 assert.equal(Reward.arrivedBy(Reward.FLIGHT - 0.01, 10), 0);
80 91 assert.equal(Reward.arrivedBy(Reward.FLIGHT, 10), 1);
81 92 });
93
94 it('measured end times through the real sequence (60 fps): ~4 s for 5…2000 points', () =>
95 {
96 for (const n of [5, 50, 253, 800, 2000])
97 {
98 const seq = Reward.createSequence({ won: true });
99 seq.setResult({ before: 100, after: 100 + n });
100 let t = 0, firstSpawn = null, lastSpawn = null, lastArrive = null, prev = 0;
101 for (let k = 0; k < 60 * 30; k++)
102 {
103 const out = seq.tick(1 / 60);
104 t += 1 / 60;
105 if (out.spawn.length)
106 {
107 if (firstSpawn == null) firstSpawn = t;
108 lastSpawn = t;
109 }
110 if (seq.arrived === n && lastArrive == null && prev < n) lastArrive = t;
111 prev = seq.arrived;
112 if (out.done) break;
113 }
114 const spawnSpan = lastSpawn - firstSpawn;
115 assert.ok(Math.abs(spawnSpan - 4) < 0.05, 'n=' + n + ' last spawn after ' + spawnSpan.toFixed(3) + ' s');
116 assert.equal(seq.counter, 100 + n);
117 }
118 });
82 119 });
83 120
84 121 describe('Reward sequence (t1173)', () =>
85 122 {
86 it('500 + 253 → counts every point from 500 up to 753 in ~6.5 s of counting', () =>
123 it('500 + 253 → counts every point from 500 up to 753 (last block at 4 s)', () =>
87 124 {
88 125 const seq = Reward.createSequence({ won: true });
89 126 seq.setResult({ before: 500, after: 753 });
@@ -28,49 +28,60 @@ function runToEnd (seq, dt, maxT)
28 return { events, t, spawned, arrived, monotonic, last: events[events.length - 1] };
28 return { events, t, spawned, arrived, monotonic, last: events[events.length - 1] };
29}
29}
30
30
31describe('Reward spawn schedule (t1178: 15 + 10t blocks/s)', () =>
31describe('Reward spawn schedule (t1194: 3 blocks/s, last block at 4 s)', () =>
32{
32{
33 it('block i leaves when 15t + 10t²/2 = i', () =>
33 it('constants and per-reward acceleration a = 2((n−1) − 3·4) / 4²', () =>
34 {
34 {
35 assert.equal(Reward.RATE0, 15);
35 assert.equal(Reward.RATE0, 3);
36 assert.equal(Reward.ACCEL, 10);
36 assert.equal(Reward.SPAWN_END, 4);
37 assert.equal(Reward.spawnTime(0), 0);
37 assert.deepEqual(Reward.spawnParams(253), { r0: 3, a: 2 * (252 - 12) / 16 });
38 for (const i of [1, 5, 10, 50, 100, 252, 1000])
38 assert.deepEqual(Reward.spawnParams(13), { r0: 3, a: 0 });
39 assert.deepEqual(Reward.spawnParams(5), { r0: 1, a: 0 }, 'n ≤ 13: constant (n−1)/4');
40 assert.deepEqual(Reward.spawnParams(1), { r0: 0, a: 0 });
41 });
42
43 it('the last block always leaves at 4 s, whatever the point count', () =>
44 {
45 for (const n of [2, 5, 12, 13, 14, 50, 253, 800, 2000, 10000])
46 {
47 const last = Reward.spawnTime(n - 1, n);
48 assert.ok(Math.abs(last - 4) < 1e-9, 'n=' + n + ' last=' + last);
49 assert.ok(Reward.spawnedBy(4 - 1e-3, n) < n, 'n=' + n + ' not all out just before 4 s');
50 assert.equal(Reward.spawnedBy(4 + 1e-6, n), n, 'n=' + n + ' at 4 s');
51 assert.ok(Math.abs(Reward.countDuration(n) - (4 + Reward.FLIGHT)) < 1e-9);
52 }
53 assert.equal(Reward.spawnTime(0, 1), 0);
54 assert.equal(Reward.countDuration(1), Reward.FLIGHT);
55 });
56
57 it('block i leaves when 3t + a·t²/2 = i; starts at 3/s and accelerates', () =>
58 {
59 const n = 253;
60 const { r0, a } = Reward.spawnParams(n);
61 for (const i of [1, 5, 10, 50, 100, 252])
39 {
62 {
40 const t = Reward.spawnTime(i);
63 const t = Reward.spawnTime(i, n);
41 assert.ok(Math.abs(15 * t + 10 * t * t / 2 - i) < 1e-9, 'i=' + i + ' t=' + t);
64 assert.ok(Math.abs(r0 * t + a * t * t / 2 - i) < 1e-9, 'i=' + i + ' t=' + t);
42 }
65 }
43 // spawn times strictly increase, gaps shrink (accelerating)
66 // First gap ≈ 1/3 s at the start rate (slightly less: it accelerates).
67 const g1 = Reward.spawnTime(1, n);
68 assert.ok(g1 < 1 / 3 && g1 > 0.1, 'first gap ' + g1);
44 let prevGap = Infinity;
69 let prevGap = Infinity;
45 for (let i = 1; i < 300; i++)
70 for (let i = 1; i < n; i++)
46 {
71 {
47 const gap = Reward.spawnTime(i) - Reward.spawnTime(i - 1);
72 const gap = Reward.spawnTime(i, n) - Reward.spawnTime(i - 1, n);
48 assert.ok(gap > 0);
73 assert.ok(gap > 0);
49 assert.ok(gap <= prevGap + 1e-12, 'gap grew at ' + i);
74 assert.ok(gap <= prevGap + 1e-12, 'gap grew at ' + i);
50 prevGap = gap;
75 prevGap = gap;
51 }
76 }
52 });
77 });
53
78
54 it('starts at 15/s; 253 ≈ 5.8 s, 800 ≈ 11.2 s, 2000 ≈ 18.6 s (Tim\'s examples)', () =>
79 it('spawnedBy matches floor(r0·t + a·t²/2) + 1, capped by n', () =>
55 {
56 // 1/5 s between the first two blocks.
57 assert.ok(Math.abs(Reward.spawnTime(1) - (-15 + Math.sqrt(245)) / 10) < 1e-12);
58 assert.ok(Reward.spawnTime(1) > 0.06 && Reward.spawnTime(1) < 0.067);
59 const last = (-15 + Math.sqrt(225 + 20 * 252)) / 10;
60 assert.ok(Math.abs(Reward.spawnTime(252) - last) < 1e-9);
61 assert.ok(last > 5.7 && last < 5.85, 'last=' + last);
62 assert.ok(Math.abs(Reward.spawnTime(799) - 11.2) < 0.05, '800: ' + Reward.spawnTime(799));
63 assert.ok(Math.abs(Reward.spawnTime(1999) - 18.6) < 0.1, '2000: ' + Reward.spawnTime(1999));
64 assert.equal(Reward.spawnedBy(last + 1e-6, 253), 253);
65 assert.equal(Reward.spawnedBy(last - 0.01, 253), 252);
66 assert.ok(Math.abs(Reward.countDuration(253) - (last + Reward.FLIGHT)) < 1e-9);
67 });
68
69 it('spawnedBy matches floor(15t + 10t²/2) + 1, capped by n', () =>
70 {
80 {
71 for (let t = 0; t <= 20; t += 0.37)
81 const { r0, a } = Reward.spawnParams(253);
82 for (let t = 0; t <= 6; t += 0.137)
72 {
83 {
73 const expect = Math.min(253, Math.floor(15 * t + 10 * t * t / 2 + 1e-9) + 1);
84 const expect = Math.min(253, Math.floor(r0 * t + a * t * t / 2 + 1e-9) + 1);
74 assert.equal(Reward.spawnedBy(t, 253), expect, 't=' + t);
85 assert.equal(Reward.spawnedBy(t, 253), expect, 't=' + t);
75 }
86 }
76 assert.equal(Reward.spawnedBy(-1, 10), 0);
87 assert.equal(Reward.spawnedBy(-1, 10), 0);
@@ -79,11 +90,37 @@ describe('Reward spawn schedule (t1178: 15 + 10t blocks/s)', () =>
79 assert.equal(Reward.arrivedBy(Reward.FLIGHT - 0.01, 10), 0);
90 assert.equal(Reward.arrivedBy(Reward.FLIGHT - 0.01, 10), 0);
80 assert.equal(Reward.arrivedBy(Reward.FLIGHT, 10), 1);
91 assert.equal(Reward.arrivedBy(Reward.FLIGHT, 10), 1);
81 });
92 });
93
94 it('measured end times through the real sequence (60 fps): ~4 s for 5…2000 points', () =>
95 {
96 for (const n of [5, 50, 253, 800, 2000])
97 {
98 const seq = Reward.createSequence({ won: true });
99 seq.setResult({ before: 100, after: 100 + n });
100 let t = 0, firstSpawn = null, lastSpawn = null, lastArrive = null, prev = 0;
101 for (let k = 0; k < 60 * 30; k++)
102 {
103 const out = seq.tick(1 / 60);
104 t += 1 / 60;
105 if (out.spawn.length)
106 {
107 if (firstSpawn == null) firstSpawn = t;
108 lastSpawn = t;
109 }
110 if (seq.arrived === n && lastArrive == null && prev < n) lastArrive = t;
111 prev = seq.arrived;
112 if (out.done) break;
113 }
114 const spawnSpan = lastSpawn - firstSpawn;
115 assert.ok(Math.abs(spawnSpan - 4) < 0.05, 'n=' + n + ' last spawn after ' + spawnSpan.toFixed(3) + ' s');
116 assert.equal(seq.counter, 100 + n);
117 }
118 });
82});
119});
83
120
84describe('Reward sequence (t1173)', () =>
121describe('Reward sequence (t1173)', () =>
85{
122{
86 it('500 + 253 → counts every point from 500 up to 753 in ~6.5 s of counting', () =>
123 it('500 + 253 → counts every point from 500 up to 753 (last block at 4 s)', () =>
87 {
124 {
88 const seq = Reward.createSequence({ won: true });
125 const seq = Reward.createSequence({ won: true });
89 seq.setResult({ before: 500, after: 753 });
126 seq.setResult({ before: 500, after: 753 });
test/t1173-playwright.py +1 −1
@@ -125,7 +125,7 @@ def watch_reward(page, prefix, expect_title, expect_earned):
125 125 check(st["titleTop"] < st["vh"] * 0.15, f"{prefix}: title rose to the top ({st['titleTop']:.0f})")
126 126 if expect_earned > 0:
127 127 page.wait_for_function(
128 "() => Reward.debugState() && Reward.debugState().phase === 'count' && Reward.debugState().flying >= 2",
128 "() => Reward.debugState() && Reward.debugState().phase === 'count' && Reward.debugState().flying >= 1",
129 129 timeout=6000,
130 130 )
131 131 page.wait_for_timeout(250)
@@ -125,7 +125,7 @@ def watch_reward(page, prefix, expect_title, expect_earned):
125 check(st["titleTop"] < st["vh"] * 0.15, f"{prefix}: title rose to the top ({st['titleTop']:.0f})")
125 check(st["titleTop"] < st["vh"] * 0.15, f"{prefix}: title rose to the top ({st['titleTop']:.0f})")
126 if expect_earned > 0:
126 if expect_earned > 0:
127 page.wait_for_function(
127 page.wait_for_function(
128 "() => Reward.debugState() && Reward.debugState().phase === 'count' && Reward.debugState().flying >= 2",
128 "() => Reward.debugState() && Reward.debugState().phase === 'count' && Reward.debugState().flying >= 1",
129 timeout=6000,
129 timeout=6000,
130 )
130 )
131 page.wait_for_timeout(250)
131 page.wait_for_timeout(250)
test/t1193-menu-playwright.py added +159 −0
@@ -0,0 +1,159 @@
1 #!/usr/bin/env python3
2 """t1193: in-game menu (pause / resume / back to main menu) and login return.
3
4 Usage: python3 test/t1193-menu-playwright.py URL TAG
5 Logged-out checks run anywhere (live too). With a local dev server
6 (?test= logins) the logged-in reward flow for solo and Offline Strijd and
7 the online-panel login link are checked as well.
8 """
9 import json, sys
10 from pathlib import Path
11 from playwright.sync_api import sync_playwright
12
13 URL = sys.argv[1] if len(sys.argv) > 1 else "https://projects.timfalken.com/meteors/"
14 if not URL.endswith("/"): URL += "/"
15 TAG = sys.argv[2] if len(sys.argv) > 2 else "live"
16 LOCAL = "127.0.0.1" in URL or "localhost" in URL
17 SHOTS = Path("/workspace/meteors-shots")
18 fails = []
19
20 def check(c, m):
21 print(("OK " if c else "FAIL ") + m)
22 if not c: fails.append(m)
23
24 def shot(page, name):
25 page.screenshot(path=str(SHOTS / f"t1193-{TAG}-{name}.png"))
26
27 def start(page, button="#btn-play"):
28 page.locator(button).click()
29 page.wait_for_selector("#planet-select:not([hidden])", timeout=8000)
30 page.wait_for_timeout(200)
31 page.locator("#btn-planet-go").click()
32 page.wait_for_function("() => window.app && app.mode === 'playing' && app.core", timeout=10000)
33 page.wait_for_timeout(600)
34
35 def rect(page, sel):
36 return page.evaluate("(s) => { const r = document.querySelector(s).getBoundingClientRect(); return [r.left, r.top, r.right, r.bottom]; }", sel)
37
38 def overlap(a, b):
39 return not (a[2] <= b[0] or b[2] <= a[0] or a[3] <= b[1] or b[3] <= a[1])
40
41 def press(page, sel, mobile):
42 if mobile: page.locator(sel).tap()
43 else: page.locator(sel).click()
44
45 def layout_and_pause(page, name, mobile, mode):
46 btn = rect(page, "#btn-game-menu")
47 check(page.evaluate("() => !document.getElementById('btn-game-menu').hidden"), f"{name}/{mode}: menu button visible")
48 vw = page.evaluate("() => innerWidth")
49 check(btn[2] <= vw and btn[2] > vw - 70 and btn[1] < 60, f"{name}/{mode}: button at the top right {btn}")
50 for sel in ("#planet-name", "#planet-stats", "#score", "#offline-hud"):
51 vis = page.evaluate("(s) => { const e = document.querySelector(s); return !!e && !e.closest('[hidden]') && e.getBoundingClientRect().width > 0; }", sel)
52 if vis:
53 check(not overlap(btn, rect(page, sel)), f"{name}/{mode}: button does not overlap {sel}")
54 check(btn[2] - btn[0] >= 36 and btn[3] - btn[1] >= 36, f"{name}/{mode}: touch target ≥ 36 px")
55 shot(page, f"{name}-{mode}-hud")
56 press(page, "#btn-game-menu", mobile)
57 page.wait_for_selector("#game-menu:not([hidden])", timeout=3000)
58 t0 = page.evaluate("() => [app.core.playTime, app.core.blocks.map(b => b.y).join(',')]")
59 page.wait_for_timeout(1200)
60 t1 = page.evaluate("() => [app.core.playTime, app.core.blocks.map(b => b.y).join(','), app.paused]")
61 check(t0[0] == t1[0] and t0[1] == t1[1] and t1[2], f"{name}/{mode}: game paused while the menu is open (playTime {t0[0]:.2f})")
62 texts = page.evaluate("() => [...document.querySelectorAll('#game-menu button')].map(b => b.textContent.trim())")
63 check(len(texts) == 2 and texts[1], f"{name}/{mode}: menu buttons {texts}")
64 shot(page, f"{name}-{mode}-menu")
65 press(page, "#btn-game-resume", mobile)
66 page.wait_for_timeout(700)
67 t2 = page.evaluate("() => [app.core.playTime, app.paused, document.getElementById('game-menu').hidden]")
68 check(t2[0] > t1[0] and not t2[1] and t2[2], f"{name}/{mode}: resume continues ({t1[0]:.2f} → {t2[0]:.2f})")
69
70 def logged_out(br, name, vp, mobile):
71 ctx = br.new_context(viewport=vp, is_mobile=mobile, has_touch=mobile, device_scale_factor=3 if mobile else 1)
72 page = ctx.new_page(); errs = []
73 page.on("pageerror", lambda e: errs.append(str(e)))
74 page.goto(URL + "index.html?t1193=" + TAG, wait_until="networkidle")
75 check(page.locator("#menu-login").get_attribute("href") == "auth.php", f"{name}: menu login → auth.php (returns to the main menu)")
76 check(page.locator("#btn-login").get_attribute("href") == "auth.php?return=online", f"{name}: Online-screen login → auth.php?return=online")
77 # Solo
78 start(page)
79 layout_and_pause(page, name, mobile, "solo")
80 page.evaluate("() => { app.core.score = 7; }")
81 press(page, "#btn-game-menu", mobile)
82 page.wait_for_selector("#game-menu:not([hidden])")
83 press(page, "#btn-game-quit", mobile)
84 page.wait_for_function("() => !document.getElementById('menu').hidden && app.mode === 'menu'", timeout=5000)
85 last = page.locator("#last-score strong").inner_text()
86 check(last == "7", f"{name}/solo: logged out → straight to the main menu (last score {last})")
87 check(page.evaluate("() => document.getElementById('reward').hidden"), f"{name}/solo: no reward screen when logged out")
88 shot(page, f"{name}-solo-quit-menu")
89 # Offline Strijd
90 start(page, "#btn-offline")
91 layout_and_pause(page, name, mobile, "offline")
92 press(page, "#btn-game-menu", mobile)
93 page.wait_for_selector("#game-menu:not([hidden])")
94 press(page, "#btn-game-quit", mobile)
95 page.wait_for_function("() => !document.getElementById('menu').hidden && app.mode === 'menu'", timeout=5000)
96 st = page.evaluate("() => ({ battle: app.battle, offline: app.offline, result: !document.getElementById('offline-result').hidden })")
97 check(st["battle"] is None and not st["offline"] and not st["result"], f"{name}/offline: battle ended, back in the main menu (no next round) {st}")
98 check(not errs, f"{name}: no page errors {errs[:2]}")
99 # ?online=1 is one-shot
100 page.goto(URL + "index.html?online=1", wait_until="networkidle")
101 page.wait_for_timeout(400)
102 check("online=1" not in page.url, f"{name}: ?online=1 removed from the address after use ({page.url})")
103 ctx.close()
104
105 def logged_in(br, name, vp, mobile):
106 ctx = br.new_context(viewport=vp, is_mobile=mobile, has_touch=mobile, device_scale_factor=3 if mobile else 1)
107 page = ctx.new_page(); errs = []
108 page.on("pageerror", lambda e: errs.append(str(e)))
109 page.goto(URL + "auth.php?test=1&next=index.html", wait_until="domcontentloaded")
110 page.goto(URL + "index.html", wait_until="networkidle")
111 page.wait_for_function("() => typeof Online !== 'undefined' && Online.me", timeout=15000)
112 check(page.evaluate("() => !document.getElementById('menu').hidden && app.mode !== 'online'"), f"{name}: after login → main menu, logged in")
113 before = int(page.locator("#menu-points").inner_text().strip() or 0)
114 for mode, button in (("solo", "#btn-play"), ("offline", "#btn-offline")):
115 start(page, button)
116 page.wait_for_function("() => app.playToken", timeout=8000)
117 page.wait_for_timeout(3600)
118 page.evaluate("() => { app.core.score = 9; }")
119 press(page, "#btn-game-menu", mobile)
120 page.wait_for_selector("#game-menu:not([hidden])")
121 press(page, "#btn-game-quit", mobile)
122 page.wait_for_function("() => !document.getElementById('reward').hidden", timeout=5000)
123 page.wait_for_timeout(400)
124 title = page.locator("#reward-title").inner_text().strip()
125 check(title == "Game ended", f"{name}/{mode}: reward screen first, title {title!r}")
126 page.wait_for_function("() => Reward.debugState() && Reward.debugState().phase === 'hold'", timeout=30000)
127 d = page.evaluate("() => Reward.debugState()")
128 shot(page, f"{name}-{mode}-loggedin-reward")
129 check(d["after"] - d["before"] == 9, f"{name}/{mode}: 9 points added via play_finish ({d['before']} → {d['after']})")
130 page.wait_for_function("() => !document.getElementById('menu').hidden && app.mode === 'menu'", timeout=8000)
131 pts = int(page.locator("#menu-points").inner_text().strip())
132 check(pts == before + 9, f"{name}/{mode}: main menu shows {pts} == {before + 9}")
133 if mode == "offline":
134 check(page.evaluate("() => app.battle === null"), f"{name}/offline: no next round after quitting")
135 before = pts
136 # Quitting right away (< 3 s): server cap gives 0, cannot farm points.
137 start(page)
138 page.wait_for_function("() => app.playToken", timeout=8000)
139 page.evaluate("() => { app.core.score = 500; }")
140 press(page, "#btn-game-menu", mobile)
141 page.wait_for_selector("#game-menu:not([hidden])")
142 press(page, "#btn-game-quit", mobile)
143 page.wait_for_function("() => Reward.debugState() && Reward.debugState().phase === 'hold'", timeout=30000)
144 d = page.evaluate("() => Reward.debugState()")
145 check(d["after"] - d["before"] == 0, f"{name}: quick quit with a faked score of 500 → 0 points (server cap)")
146 page.wait_for_function("() => !document.getElementById('menu').hidden", timeout=8000)
147 shot(page, f"{name}-loggedin-menu")
148 check(not errs, f"{name}: logged-in no page errors {errs[:2]}")
149 ctx.close()
150
151 with sync_playwright() as pw:
152 br = pw.chromium.launch(args=["--use-gl=angle", "--use-angle=swiftshader"])
153 for name, vp, mobile in (("desktop", {"width": 1280, "height": 800}, False), ("mobile", {"width": 390, "height": 844}, True)):
154 logged_out(br, name, vp, mobile)
155 if LOCAL:
156 logged_in(br, name, vp, mobile)
157 br.close()
158 print("ALL OK" if not fails else f"{len(fails)} FAIL")
159 sys.exit(1 if fails else 0)
@@ -0,0 +1,159 @@
1#!/usr/bin/env python3
2"""t1193: in-game menu (pause / resume / back to main menu) and login return.
3
4Usage: python3 test/t1193-menu-playwright.py URL TAG
5Logged-out checks run anywhere (live too). With a local dev server
6(?test= logins) the logged-in reward flow for solo and Offline Strijd and
7the online-panel login link are checked as well.
8"""
9import json, sys
10from pathlib import Path
11from playwright.sync_api import sync_playwright
12
13URL = sys.argv[1] if len(sys.argv) > 1 else "https://projects.timfalken.com/meteors/"
14if not URL.endswith("/"): URL += "/"
15TAG = sys.argv[2] if len(sys.argv) > 2 else "live"
16LOCAL = "127.0.0.1" in URL or "localhost" in URL
17SHOTS = Path("/workspace/meteors-shots")
18fails = []
19
20def check(c, m):
21 print(("OK " if c else "FAIL ") + m)
22 if not c: fails.append(m)
23
24def shot(page, name):
25 page.screenshot(path=str(SHOTS / f"t1193-{TAG}-{name}.png"))
26
27def start(page, button="#btn-play"):
28 page.locator(button).click()
29 page.wait_for_selector("#planet-select:not([hidden])", timeout=8000)
30 page.wait_for_timeout(200)
31 page.locator("#btn-planet-go").click()
32 page.wait_for_function("() => window.app && app.mode === 'playing' && app.core", timeout=10000)
33 page.wait_for_timeout(600)
34
35def rect(page, sel):
36 return page.evaluate("(s) => { const r = document.querySelector(s).getBoundingClientRect(); return [r.left, r.top, r.right, r.bottom]; }", sel)
37
38def overlap(a, b):
39 return not (a[2] <= b[0] or b[2] <= a[0] or a[3] <= b[1] or b[3] <= a[1])
40
41def press(page, sel, mobile):
42 if mobile: page.locator(sel).tap()
43 else: page.locator(sel).click()
44
45def layout_and_pause(page, name, mobile, mode):
46 btn = rect(page, "#btn-game-menu")
47 check(page.evaluate("() => !document.getElementById('btn-game-menu').hidden"), f"{name}/{mode}: menu button visible")
48 vw = page.evaluate("() => innerWidth")
49 check(btn[2] <= vw and btn[2] > vw - 70 and btn[1] < 60, f"{name}/{mode}: button at the top right {btn}")
50 for sel in ("#planet-name", "#planet-stats", "#score", "#offline-hud"):
51 vis = page.evaluate("(s) => { const e = document.querySelector(s); return !!e && !e.closest('[hidden]') && e.getBoundingClientRect().width > 0; }", sel)
52 if vis:
53 check(not overlap(btn, rect(page, sel)), f"{name}/{mode}: button does not overlap {sel}")
54 check(btn[2] - btn[0] >= 36 and btn[3] - btn[1] >= 36, f"{name}/{mode}: touch target ≥ 36 px")
55 shot(page, f"{name}-{mode}-hud")
56 press(page, "#btn-game-menu", mobile)
57 page.wait_for_selector("#game-menu:not([hidden])", timeout=3000)
58 t0 = page.evaluate("() => [app.core.playTime, app.core.blocks.map(b => b.y).join(',')]")
59 page.wait_for_timeout(1200)
60 t1 = page.evaluate("() => [app.core.playTime, app.core.blocks.map(b => b.y).join(','), app.paused]")
61 check(t0[0] == t1[0] and t0[1] == t1[1] and t1[2], f"{name}/{mode}: game paused while the menu is open (playTime {t0[0]:.2f})")
62 texts = page.evaluate("() => [...document.querySelectorAll('#game-menu button')].map(b => b.textContent.trim())")
63 check(len(texts) == 2 and texts[1], f"{name}/{mode}: menu buttons {texts}")
64 shot(page, f"{name}-{mode}-menu")
65 press(page, "#btn-game-resume", mobile)
66 page.wait_for_timeout(700)
67 t2 = page.evaluate("() => [app.core.playTime, app.paused, document.getElementById('game-menu').hidden]")
68 check(t2[0] > t1[0] and not t2[1] and t2[2], f"{name}/{mode}: resume continues ({t1[0]:.2f} → {t2[0]:.2f})")
69
70def logged_out(br, name, vp, mobile):
71 ctx = br.new_context(viewport=vp, is_mobile=mobile, has_touch=mobile, device_scale_factor=3 if mobile else 1)
72 page = ctx.new_page(); errs = []
73 page.on("pageerror", lambda e: errs.append(str(e)))
74 page.goto(URL + "index.html?t1193=" + TAG, wait_until="networkidle")
75 check(page.locator("#menu-login").get_attribute("href") == "auth.php", f"{name}: menu login → auth.php (returns to the main menu)")
76 check(page.locator("#btn-login").get_attribute("href") == "auth.php?return=online", f"{name}: Online-screen login → auth.php?return=online")
77 # Solo
78 start(page)
79 layout_and_pause(page, name, mobile, "solo")
80 page.evaluate("() => { app.core.score = 7; }")
81 press(page, "#btn-game-menu", mobile)
82 page.wait_for_selector("#game-menu:not([hidden])")
83 press(page, "#btn-game-quit", mobile)
84 page.wait_for_function("() => !document.getElementById('menu').hidden && app.mode === 'menu'", timeout=5000)
85 last = page.locator("#last-score strong").inner_text()
86 check(last == "7", f"{name}/solo: logged out → straight to the main menu (last score {last})")
87 check(page.evaluate("() => document.getElementById('reward').hidden"), f"{name}/solo: no reward screen when logged out")
88 shot(page, f"{name}-solo-quit-menu")
89 # Offline Strijd
90 start(page, "#btn-offline")
91 layout_and_pause(page, name, mobile, "offline")
92 press(page, "#btn-game-menu", mobile)
93 page.wait_for_selector("#game-menu:not([hidden])")
94 press(page, "#btn-game-quit", mobile)
95 page.wait_for_function("() => !document.getElementById('menu').hidden && app.mode === 'menu'", timeout=5000)
96 st = page.evaluate("() => ({ battle: app.battle, offline: app.offline, result: !document.getElementById('offline-result').hidden })")
97 check(st["battle"] is None and not st["offline"] and not st["result"], f"{name}/offline: battle ended, back in the main menu (no next round) {st}")
98 check(not errs, f"{name}: no page errors {errs[:2]}")
99 # ?online=1 is one-shot
100 page.goto(URL + "index.html?online=1", wait_until="networkidle")
101 page.wait_for_timeout(400)
102 check("online=1" not in page.url, f"{name}: ?online=1 removed from the address after use ({page.url})")
103 ctx.close()
104
105def logged_in(br, name, vp, mobile):
106 ctx = br.new_context(viewport=vp, is_mobile=mobile, has_touch=mobile, device_scale_factor=3 if mobile else 1)
107 page = ctx.new_page(); errs = []
108 page.on("pageerror", lambda e: errs.append(str(e)))
109 page.goto(URL + "auth.php?test=1&next=index.html", wait_until="domcontentloaded")
110 page.goto(URL + "index.html", wait_until="networkidle")
111 page.wait_for_function("() => typeof Online !== 'undefined' && Online.me", timeout=15000)
112 check(page.evaluate("() => !document.getElementById('menu').hidden && app.mode !== 'online'"), f"{name}: after login → main menu, logged in")
113 before = int(page.locator("#menu-points").inner_text().strip() or 0)
114 for mode, button in (("solo", "#btn-play"), ("offline", "#btn-offline")):
115 start(page, button)
116 page.wait_for_function("() => app.playToken", timeout=8000)
117 page.wait_for_timeout(3600)
118 page.evaluate("() => { app.core.score = 9; }")
119 press(page, "#btn-game-menu", mobile)
120 page.wait_for_selector("#game-menu:not([hidden])")
121 press(page, "#btn-game-quit", mobile)
122 page.wait_for_function("() => !document.getElementById('reward').hidden", timeout=5000)
123 page.wait_for_timeout(400)
124 title = page.locator("#reward-title").inner_text().strip()
125 check(title == "Game ended", f"{name}/{mode}: reward screen first, title {title!r}")
126 page.wait_for_function("() => Reward.debugState() && Reward.debugState().phase === 'hold'", timeout=30000)
127 d = page.evaluate("() => Reward.debugState()")
128 shot(page, f"{name}-{mode}-loggedin-reward")
129 check(d["after"] - d["before"] == 9, f"{name}/{mode}: 9 points added via play_finish ({d['before']} → {d['after']})")
130 page.wait_for_function("() => !document.getElementById('menu').hidden && app.mode === 'menu'", timeout=8000)
131 pts = int(page.locator("#menu-points").inner_text().strip())
132 check(pts == before + 9, f"{name}/{mode}: main menu shows {pts} == {before + 9}")
133 if mode == "offline":
134 check(page.evaluate("() => app.battle === null"), f"{name}/offline: no next round after quitting")
135 before = pts
136 # Quitting right away (< 3 s): server cap gives 0, cannot farm points.
137 start(page)
138 page.wait_for_function("() => app.playToken", timeout=8000)
139 page.evaluate("() => { app.core.score = 500; }")
140 press(page, "#btn-game-menu", mobile)
141 page.wait_for_selector("#game-menu:not([hidden])")
142 press(page, "#btn-game-quit", mobile)
143 page.wait_for_function("() => Reward.debugState() && Reward.debugState().phase === 'hold'", timeout=30000)
144 d = page.evaluate("() => Reward.debugState()")
145 check(d["after"] - d["before"] == 0, f"{name}: quick quit with a faked score of 500 → 0 points (server cap)")
146 page.wait_for_function("() => !document.getElementById('menu').hidden", timeout=8000)
147 shot(page, f"{name}-loggedin-menu")
148 check(not errs, f"{name}: logged-in no page errors {errs[:2]}")
149 ctx.close()
150
151with sync_playwright() as pw:
152 br = pw.chromium.launch(args=["--use-gl=angle", "--use-angle=swiftshader"])
153 for name, vp, mobile in (("desktop", {"width": 1280, "height": 800}, False), ("mobile", {"width": 390, "height": 844}, True)):
154 logged_out(br, name, vp, mobile)
155 if LOCAL:
156 logged_in(br, name, vp, mobile)
157 br.close()
158print("ALL OK" if not fails else f"{len(fails)} FAIL")
159sys.exit(1 if fails else 0)
test/t1196-t1198-playwright.py added +117 −0
@@ -0,0 +1,117 @@
1 """t1196 (last planet), t1197 (+x% combo), t1198 (defeated count) checks.
2 Usage: python3 test/t1196-t1198-playwright.py ROOT_URL [local]"""
3 import sys
4 from playwright.sync_api import sync_playwright
5
6 URL = sys.argv[1].rstrip("/") + "/"
7 LOCAL = len(sys.argv) > 2 and sys.argv[2] == "local"
8 SHOTS = "/workspace/meteors-shots/t1196-"
9 fails = []
10 def check(ok, msg):
11 print(("OK " if ok else "FAIL ") + msg)
12 if not ok: fails.append(msg)
13
14 def pick(page, pid):
15 page.click("#btn-play"); page.wait_for_selector("#planet-select:not([hidden])")
16 page.click(f'#planet-grid [data-planet="{pid}"]')
17
18 def selected(page):
19 return page.evaluate("() => app.selectedPlanetId")
20
21 with sync_playwright() as p:
22 br = p.chromium.launch()
23 # ---- logged out: localStorage
24 ctx = br.new_context(viewport={"width": 1280, "height": 800}); page = ctx.new_page()
25 errs = []; page.on("pageerror", lambda e: errs.append(str(e)))
26 page.goto(URL + "index.html", wait_until="networkidle")
27 ids = page.evaluate("() => Planet.allPlanets().map(p => p.id)")
28 other = [i for i in ids if i != "terra"][0]
29 pick(page, other); page.click("#btn-planet-go"); page.wait_for_timeout(300)
30 page.goto(URL + "index.html", wait_until="networkidle")
31 check(selected(page) == other, f"logged out: {other} remembered via localStorage after reload ({selected(page)})")
32 for btn, ctxname in (("#btn-play", "Spelen"), ("#btn-offline", "Offline Strijd")):
33 page.click(btn); page.wait_for_selector("#planet-select:not([hidden])")
34 sel = page.evaluate("() => (document.querySelector('#planet-grid .selected, #planet-grid [aria-pressed=\"true\"], #planet-grid [aria-selected=\"true\"]')||{}).dataset")
35 check(bool(sel) and sel.get("planet") == other, f"logged out: {ctxname} planet select pre-selects {other} ({sel})")
36 page.screenshot(path=SHOTS + f"preselect-{ctxname.split()[0].lower()}.png")
37 page.click("#btn-planet-back")
38
39 # ---- t1197 indicator + combo (offline, real core)
40 page.click("#btn-play"); page.wait_for_selector("#planet-select:not([hidden])"); page.click("#btn-planet-go")
41 page.wait_for_function("() => app.mode === 'playing' && app.core")
42 res = page.evaluate("""() => {
43 const g = app.core; g.noSpawn = true;
44 for (const b of Object.values(g.blocks || {})) {}
45 const out = [];
46 for (let k = 0; k < 3; k++) {
47 for (let c = 0; c < 10; c++) for (let y = 0; y < 13; y++) { const b = g.at ? g.at(c, y) : null; if (b) g.removeBlock && g.removeBlock(b); }
48 g.place(0, 0, 1 + k); g.place(1, 0, 1 + k); g.place(2, 0, 1 + k);
49 const l = g.resolveMatches();
50 out.push(l.length ? Math.round((l[0].chainBonus - 1) * 100) : null);
51 }
52 return { out, combo: g.combo, ind: g.lastChainIndicator };
53 }""")
54 page.wait_for_timeout(150)
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]; }")
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}")
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")
61 el = page.locator("#chain-indicator")
62 if el.is_visible(): el.screenshot(path=SHOTS.replace("t1196", "t1197") + "plus-pct-crop.png")
63 page.evaluate("() => { for (let i = 0; i < 120; i++) app.core.tick(0.05); }")
64 check(page.evaluate("() => app.core.combo") == 0, "combo reset after 6 s without a match")
65 page.evaluate("() => teardownPlay && teardownPlay()") if False else None
66 ctx.close()
67
68 # ---- t1198 offline result text
69 ctx = br.new_context(viewport={"width": 1280, "height": 800}); page = ctx.new_page()
70 page.goto(URL + "index.html", wait_until="networkidle")
71 page.click("#btn-offline"); page.wait_for_selector("#planet-select:not([hidden])"); page.click("#btn-planet-go")
72 page.wait_for_function("() => app.battle && app.mode === 'playing'")
73 page.evaluate("() => { for (const b of app.battle.bots) b.core.state = 'gameover'; }")
74 page.wait_for_function("() => app.battle && app.battle.round === 2 && app.mode === 'playing'", timeout=15000)
75 page.evaluate("() => { app.battle.bots[0].core.state = 'gameover'; }")
76 page.wait_for_timeout(300)
77 page.evaluate("() => { app.core.state = 'gameover'; }")
78 page.wait_for_selector("#offline-result:not([hidden])", timeout=15000)
79 reached = page.inner_text("#offline-reached-line"); detail = page.inner_text("#offline-result-detail")
80 check(detail.strip() == "2 opponents defeated", f"en result: {reached!r} / {detail!r}")
81 page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-en.png")
82 page.evaluate("() => I18n.setLocale('nl'); ") if True else None
83 page.evaluate("() => { if (typeof showOfflineResult === 'function') { app.offlineResultShown = false; showOfflineResult(); } }")
84 page.wait_for_timeout(200)
85 detail_nl = page.inner_text("#offline-result-detail"); reached_nl = page.inner_text("#offline-reached-line")
86 check(detail_nl.strip() == "2 tegenstanders verslagen" and "bereikt" in reached_nl, f"nl result: {reached_nl!r} / {detail_nl!r}")
87 page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-nl.png")
88 ctx.close()
89
90 # ---- logged in: server profile (local test login only)
91 if LOCAL:
92 ctx = br.new_context(viewport={"width": 1280, "height": 800}); page = ctx.new_page()
93 page.goto(URL + "auth.php?test=2&next=index.html", wait_until="domcontentloaded")
94 page.goto(URL + "index.html", wait_until="networkidle")
95 page.wait_for_function("() => Online.me")
96 pid = page.evaluate("""async () => {
97 const cols = ['terra-ember','terra-aqua','terra-leaf','terra-sun','terra-orchid'];
98 const r = await Online.request('planet_save', { planet: { name: 'Proef', people: 'Proevers', jumpsToClear: 2.5, fallTime: 2, riseTime: 1, colors: cols } });
99 await Online.refresh(); return r.planet.id; }""")
100 pick(page, pid); page.click("#btn-planet-go"); page.wait_for_timeout(600)
101 ctx2 = br.new_context(viewport={"width": 1280, "height": 800}); p2 = ctx2.new_page()
102 p2.goto(URL + "auth.php?test=2&next=index.html", wait_until="domcontentloaded")
103 p2.goto(URL + "index.html", wait_until="networkidle"); p2.wait_for_function("() => Online.me")
104 p2.wait_for_timeout(400)
105 check(p2.evaluate("() => Online.lastPlanet") == pid and selected(p2) == pid, f"logged in: custom planet {pid} restored from the profile in a fresh browser ({selected(p2)})")
106 p2.click("#btn-online"); p2.wait_for_timeout(500)
107 p2.screenshot(path=SHOTS + "loggedin-online.png")
108 page.evaluate(f"async () => {{ await Online.request('planet_delete', {{ id: '{pid}' }}); }}")
109 ctx3 = br.new_context(viewport={"width": 1280, "height": 800}); p3 = ctx3.new_page()
110 p3.goto(URL + "auth.php?test=2&next=index.html", wait_until="domcontentloaded")
111 p3.goto(URL + "index.html", wait_until="networkidle"); p3.wait_for_function("() => Online.me"); p3.wait_for_timeout(400)
112 check(p3.evaluate("() => Online.lastPlanet") is None and selected(p3) == "terra", f"deleted custom planet → falls back to Terra ({selected(p3)})")
113 ctx.close(); ctx2.close(); ctx3.close()
114 check(not errs, f"no page errors {errs}")
115 br.close()
116 print("ALL OK" if not fails else f"{len(fails)} FAILED")
117 sys.exit(1 if fails else 0)
@@ -0,0 +1,117 @@
1"""t1196 (last planet), t1197 (+x% combo), t1198 (defeated count) checks.
2Usage: python3 test/t1196-t1198-playwright.py ROOT_URL [local]"""
3import sys
4from playwright.sync_api import sync_playwright
5
6URL = sys.argv[1].rstrip("/") + "/"
7LOCAL = len(sys.argv) > 2 and sys.argv[2] == "local"
8SHOTS = "/workspace/meteors-shots/t1196-"
9fails = []
10def check(ok, msg):
11 print(("OK " if ok else "FAIL ") + msg)
12 if not ok: fails.append(msg)
13
14def pick(page, pid):
15 page.click("#btn-play"); page.wait_for_selector("#planet-select:not([hidden])")
16 page.click(f'#planet-grid [data-planet="{pid}"]')
17
18def selected(page):
19 return page.evaluate("() => app.selectedPlanetId")
20
21with sync_playwright() as p:
22 br = p.chromium.launch()
23 # ---- logged out: localStorage
24 ctx = br.new_context(viewport={"width": 1280, "height": 800}); page = ctx.new_page()
25 errs = []; page.on("pageerror", lambda e: errs.append(str(e)))
26 page.goto(URL + "index.html", wait_until="networkidle")
27 ids = page.evaluate("() => Planet.allPlanets().map(p => p.id)")
28 other = [i for i in ids if i != "terra"][0]
29 pick(page, other); page.click("#btn-planet-go"); page.wait_for_timeout(300)
30 page.goto(URL + "index.html", wait_until="networkidle")
31 check(selected(page) == other, f"logged out: {other} remembered via localStorage after reload ({selected(page)})")
32 for btn, ctxname in (("#btn-play", "Spelen"), ("#btn-offline", "Offline Strijd")):
33 page.click(btn); page.wait_for_selector("#planet-select:not([hidden])")
34 sel = page.evaluate("() => (document.querySelector('#planet-grid .selected, #planet-grid [aria-pressed=\"true\"], #planet-grid [aria-selected=\"true\"]')||{}).dataset")
35 check(bool(sel) and sel.get("planet") == other, f"logged out: {ctxname} planet select pre-selects {other} ({sel})")
36 page.screenshot(path=SHOTS + f"preselect-{ctxname.split()[0].lower()}.png")
37 page.click("#btn-planet-back")
38
39 # ---- t1197 indicator + combo (offline, real core)
40 page.click("#btn-play"); page.wait_for_selector("#planet-select:not([hidden])"); page.click("#btn-planet-go")
41 page.wait_for_function("() => app.mode === 'playing' && app.core")
42 res = page.evaluate("""() => {
43 const g = app.core; g.noSpawn = true;
44 for (const b of Object.values(g.blocks || {})) {}
45 const out = [];
46 for (let k = 0; k < 3; k++) {
47 for (let c = 0; c < 10; c++) for (let y = 0; y < 13; y++) { const b = g.at ? g.at(c, y) : null; if (b) g.removeBlock && g.removeBlock(b); }
48 g.place(0, 0, 1 + k); g.place(1, 0, 1 + k); g.place(2, 0, 1 + k);
49 const l = g.resolveMatches();
50 out.push(l.length ? Math.round((l[0].chainBonus - 1) * 100) : null);
51 }
52 return { out, combo: g.combo, ind: g.lastChainIndicator };
53 }""")
54 page.wait_for_timeout(150)
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]; }")
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}")
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")
61 el = page.locator("#chain-indicator")
62 if el.is_visible(): el.screenshot(path=SHOTS.replace("t1196", "t1197") + "plus-pct-crop.png")
63 page.evaluate("() => { for (let i = 0; i < 120; i++) app.core.tick(0.05); }")
64 check(page.evaluate("() => app.core.combo") == 0, "combo reset after 6 s without a match")
65 page.evaluate("() => teardownPlay && teardownPlay()") if False else None
66 ctx.close()
67
68 # ---- t1198 offline result text
69 ctx = br.new_context(viewport={"width": 1280, "height": 800}); page = ctx.new_page()
70 page.goto(URL + "index.html", wait_until="networkidle")
71 page.click("#btn-offline"); page.wait_for_selector("#planet-select:not([hidden])"); page.click("#btn-planet-go")
72 page.wait_for_function("() => app.battle && app.mode === 'playing'")
73 page.evaluate("() => { for (const b of app.battle.bots) b.core.state = 'gameover'; }")
74 page.wait_for_function("() => app.battle && app.battle.round === 2 && app.mode === 'playing'", timeout=15000)
75 page.evaluate("() => { app.battle.bots[0].core.state = 'gameover'; }")
76 page.wait_for_timeout(300)
77 page.evaluate("() => { app.core.state = 'gameover'; }")
78 page.wait_for_selector("#offline-result:not([hidden])", timeout=15000)
79 reached = page.inner_text("#offline-reached-line"); detail = page.inner_text("#offline-result-detail")
80 check(detail.strip() == "2 opponents defeated", f"en result: {reached!r} / {detail!r}")
81 page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-en.png")
82 page.evaluate("() => I18n.setLocale('nl'); ") if True else None
83 page.evaluate("() => { if (typeof showOfflineResult === 'function') { app.offlineResultShown = false; showOfflineResult(); } }")
84 page.wait_for_timeout(200)
85 detail_nl = page.inner_text("#offline-result-detail"); reached_nl = page.inner_text("#offline-reached-line")
86 check(detail_nl.strip() == "2 tegenstanders verslagen" and "bereikt" in reached_nl, f"nl result: {reached_nl!r} / {detail_nl!r}")
87 page.screenshot(path=SHOTS.replace("t1196", "t1198") + "result-nl.png")
88 ctx.close()
89
90 # ---- logged in: server profile (local test login only)
91 if LOCAL:
92 ctx = br.new_context(viewport={"width": 1280, "height": 800}); page = ctx.new_page()
93 page.goto(URL + "auth.php?test=2&next=index.html", wait_until="domcontentloaded")
94 page.goto(URL + "index.html", wait_until="networkidle")
95 page.wait_for_function("() => Online.me")
96 pid = page.evaluate("""async () => {
97 const cols = ['terra-ember','terra-aqua','terra-leaf','terra-sun','terra-orchid'];
98 const r = await Online.request('planet_save', { planet: { name: 'Proef', people: 'Proevers', jumpsToClear: 2.5, fallTime: 2, riseTime: 1, colors: cols } });
99 await Online.refresh(); return r.planet.id; }""")
100 pick(page, pid); page.click("#btn-planet-go"); page.wait_for_timeout(600)
101 ctx2 = br.new_context(viewport={"width": 1280, "height": 800}); p2 = ctx2.new_page()
102 p2.goto(URL + "auth.php?test=2&next=index.html", wait_until="domcontentloaded")
103 p2.goto(URL + "index.html", wait_until="networkidle"); p2.wait_for_function("() => Online.me")
104 p2.wait_for_timeout(400)
105 check(p2.evaluate("() => Online.lastPlanet") == pid and selected(p2) == pid, f"logged in: custom planet {pid} restored from the profile in a fresh browser ({selected(p2)})")
106 p2.click("#btn-online"); p2.wait_for_timeout(500)
107 p2.screenshot(path=SHOTS + "loggedin-online.png")
108 page.evaluate(f"async () => {{ await Online.request('planet_delete', {{ id: '{pid}' }}); }}")
109 ctx3 = br.new_context(viewport={"width": 1280, "height": 800}); p3 = ctx3.new_page()
110 p3.goto(URL + "auth.php?test=2&next=index.html", wait_until="domcontentloaded")
111 p3.goto(URL + "index.html", wait_until="networkidle"); p3.wait_for_function("() => Online.me"); p3.wait_for_timeout(400)
112 check(p3.evaluate("() => Online.lastPlanet") is None and selected(p3) == "terra", f"deleted custom planet → falls back to Terra ({selected(p3)})")
113 ctx.close(); ctx2.close(); ctx3.close()
114 check(not errs, f"no page errors {errs}")
115 br.close()
116print("ALL OK" if not fails else f"{len(fails)} FAILED")
117sys.exit(1 if fails else 0)