From 5012076039b5a33c62c80515dd015060778e0151 Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Fri, 28 Mar 2025 19:40:59 +0100 Subject: [PATCH] Looping mode --- Readme.md | 32 +- app/build.gradle.kts | 4 +- app/src/main/assets/index.html | 2 +- dist/index.html | 102 +- src/PWA/sw-b71.js | 2 +- src/data/levels.json | 2 +- src/data/version.json | 2 +- src/debuffs.ts | 20 +- src/game.ts | 43 +- src/gameOver.ts | 3 +- src/gameStateMutators.ts | 3236 ++++++++++++++++---------------- src/game_utils.ts | 16 +- src/i18n/b71.babel | 65 + src/i18n/en.json | 4 + src/i18n/fr.json | 4 + src/loadGameData.ts | 2 +- src/newGameState.ts | 16 +- src/premium.ts | 275 ++- src/recording.ts | 4 +- src/render.ts | 1702 +++++++++-------- src/types.d.ts | 12 +- 21 files changed, 2852 insertions(+), 2696 deletions(-) diff --git a/Readme.md b/Readme.md index 4894c8d..4ce8be5 100644 --- a/Readme.md +++ b/Readme.md @@ -14,16 +14,33 @@ Break colourful bricks, catch bouncing coins and select powerful upgrades ! - [HackerNews thread](https://news.ycombinator.com/item?id=43183131) +# Premium: allow looping + +Allow players to loop the game : +- [x] keep your score +- [x] keep 1 perk +- [x] add one hasard +- [x] add one HP to all bricks - as a debuff +- [ ] advertise looping in normal game over screen +- real time stats as the option says. +- [x] Noise of coins against side is annoying. +- Change look of loop, to avoid picking randomly at loop end. +- make red coins scarier, +- add blue coins that only freeze puck. +- Make fullscreen an option and turn it back on when playing +- +1 combo de base par rerolls +- +1 combo de base par vie restantes (pas attrapable) + # Todo +- [jaceys] Counters for coins lost, misses, and boundary bounces, as well as a timer. - people assume unbounded allows for wrap around - coin magnet and viscosity : only one level ~2.5 - Boost Ascetism : give +2 or even +3 combo per brick destroyed - wind : move coins based on puck movement not position - show -N points in red when combo resets -- reach : this is too punishing now, maybe only reset if you hit the lowest populate row of the level, if it's not a full width row +- reach is too punishing now, maybe only reset if you hit the lowest populate row of the level, if it's not a full width row - respawn: N% of bricks respawn after N seconds -- [jaceys] Counters for coins lost, misses, and boundary bounces, as well as a timer. - [jaceys] Move the restart button out of the menu, so that it is more easily accessible - [jaceys] A visual indication of whether a ball has hit a brick this serve - [obigre] Offer to level ups perks separately @@ -31,17 +48,6 @@ Break colourful bricks, catch bouncing coins and select powerful upgrades ! - https://weblate.org/fr/ -# Premium: allow looping - -Allow players to loop the game : -- [x] keep your score -- [x] keep 1 perk -- [x] add one hasard -- [ ] add one HP to all bricks -- [ ] advertise looping in normal game over screen -- [ ] save score at the end of first loop, in addition to the final one ? -- [ ] check that stats like max level are correct - # System requirements diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8ee283f..e8f705f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { applicationId = "me.lecaro.breakout" minSdk = 21 targetSdk = 34 - versionCode = 29050375 - versionName = "29050375" + versionCode = 29053110 + versionName = "29053110" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true diff --git a/app/src/main/assets/index.html b/app/src/main/assets/index.html index 098a69c..de188ae 100644 --- a/app/src/main/assets/index.html +++ b/app/src/main/assets/index.html @@ -1 +1 @@ -Breakout 71
\ No newline at end of file +Breakout 71
\ No newline at end of file diff --git a/dist/index.html b/dist/index.html index af8d2d7..0ab0416 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1335,20 +1335,21 @@ restart(window.location.search.includes("stressTest") && { // // unbounded: 1, // // pierce_color: 1, // pierce: 1, - streak_shots: 1, + // streak_shots: 1, // multiball: 6, - // base_combo: 7, - // telekinesis: 2, - // yoyo: 2, + base_combo: 7, + telekinesis: 2, + yoyo: 2, pierce: 10, // metamorphosis: 1, // implosions: 1, // sturdy_bricks:5 + coin_magnet: 2, extra_life: 3 }, debuffs: { // fragility:3 - negative_coins: 1 + negative_coins: 100 } } || {}); tick(); @@ -1396,7 +1397,7 @@ const upgrades = (0, _upgrades.rawUpgrades).map((u)=>({ })); },{"./data/palette.json":"ktRBU","./data/levels.json":"8JSUc","./data/version.json":"iyP6E","./upgrades":"1u3Dx","./getLevelBackground":"7OIPf","./levelIcon":"6rQoT","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"iyP6E":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("\"29050375\""); +module.exports = JSON.parse("\"29053110\""); },{}],"1u3Dx":[function(require,module,exports,__globalThis) { var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); @@ -2012,10 +2013,10 @@ function getFirstBrowserLanguage() { } },{"./fr.json":"b97sx","./en.json":"uYc9N","../settings":"5blfu","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"b97sx":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse('{"confirmRestart.no":"Annuler ,continuer ma partie en cours","confirmRestart.text":"Vous \xeates sur le point de commencer une nouvelle partie, est-ce vraiment ce que vous vouliez ?","confirmRestart.title":"D\xe9marrer une nouvelle partie ?","confirmRestart.yes":"Commencer une nouvelle partie","debuffs.banned.description":"{{lvl}} am\xe9lioration(s) bannie(s) : {{banned}}.","debuffs.banned.help":"{{perk}} est banni pour cette course.","debuffs.fragility.help":"Les explosions d\xe9truisent {{percent}} pi\xe8ces et r\xe9initialisent le combo.","debuffs.interference.help":"T\xe9l\xe9kin\xe9sie et probl\xe8me de yo-yo pendant {{lvl}}s toutes les 7 s.","debuffs.more_bombs.help":"{{lvl}} briques remplac\xe9es par des bombes.","debuffs.negative_coins.help":"{{lvl}}/10000 pi\xe8ces apparaissent maudites et clignotent en rouge. La partie est termin\xe9e si vous les attrapez.","gameOver.because_cursed_coin":"Jeu termin\xe9","gameOver.because_cursed_coin_intro":"Vous avez crach\xe9 une pi\xe8ce maudite (pi\xe8ces rouge vif) et vous n\'aviez pas de vie suppl\xe9mentaire \xe0 revendre.","gameOver.cumulative_total":"Votre score total cumul\xe9 est pass\xe9 de {{startTs}} \xe0 {{endTs}}.","gameOver.lost.summary":"Vous avez fait tomber la balle apr\xe8s avoir attrap\xe9 {{score}} pi\xe8ces.","gameOver.lost.title":"Balle perdue","gameOver.next_unlock":"Marquez {{points}} points suppl\xe9mentaires pour d\xe9bloquer la prochaine am\xe9lioration ou le prochain niveau.","gameOver.restart":"Nouvelle partie","gameOver.stats.balls_lost":"Balles perdues","gameOver.stats.bricks_broken":"Briques cass\xe9es","gameOver.stats.bricks_per_minute":"Briques cass\xe9es par minute","gameOver.stats.catch_rate":"Pi\xe8ces attrap\xe9es","gameOver.stats.combo_avg":"Combo moyen","gameOver.stats.combo_max":"Combo maximum","gameOver.stats.duration_per_level":"Dur\xe9e par niveau","gameOver.stats.hit_rate":"Pr\xe9cision","gameOver.stats.intro":"Vous trouverez ci-dessous les statistiques de cette partie compar\xe9es \xe0 vos {{count}} meilleures parties.","gameOver.stats.level_reached":"Niveau atteint","gameOver.stats.total_score":"Score total","gameOver.stats.upgrades_applied":"Mises \xe0 jour appliqu\xe9es","gameOver.test_run":"Cette partie de test et son score ne sont pas enregistr\xe9s.","gameOver.unlocked_count":"Vous avez d\xe9bloqu\xe9 {{count}} objet(s) :","gameOver.upgrades_picked":"Am\xe9lioration actives en fin de partie","gameOver.win.summary":"Vous avez nettoy\xe9 tous les niveaux pour cette partie, en attrapant {{score}} pi\xe8ces au total.","gameOver.win.title":"Partie termin\xe9e","level_up.after_buttons":"Vous venez de terminer le niveau {{level}}/{{max}} et vous avez choisi ces am\xe9liorations jusqu\'\xe0 pr\xe9sent :","level_up.before_buttons":"Vous avez attrap\xe9 {{score}} pi\xe8ces {{catchGain}} sur {{levelSpawnedCoins}} en {{time}} secondes {{timeGain}}.\\n\\nVous avez rat\xe9 les briques {{levelMisses}} fois {{missesGain}} et touch\xe9 les bords de la zone de jeu {{levelWallBounces}} fois {{wallHitsGain}}.\\n\\n{{compliment}}","level_up.compliment_advice":"Essayez d\'attraper toutes les pi\xe8ces, de ne jamais rater les briques, de ne pas toucher les murs ou de terminer le niveau en moins de 30 secondes pour obtenir des choix suppl\xe9mentaires et des am\xe9liorations.","level_up.compliment_good":"Bravo !","level_up.compliment_perfect":"Impressionnant, continuez comme \xe7a !","level_up.pick_upgrade_title":"Choisir une am\xe9lioration","level_up.plus_one_choice":"(+1 re-roll)","level_up.plus_one_upgrade":"(+1 am\xe9lioration et +1 re-roll)","level_up.reroll":"Re-roll ({{count}})","level_up.reroll_help":"Nouveaux choix","level_up.unlocked_level":" (Niveau)","level_up.unlocked_perk":" (Am\xe9lioration)","level_up.upgrade_perk_to_level":" niveau {{level}}","loop.instructions":"Tous vos avantages seront supprim\xe9s, sauf un que vous pouvez choisir ci-dessous. Chaque option comporte un danger suppl\xe9mentaire qui appara\xeetra \xe0 tous les niveaux.","loop.title":"Boucle de d\xe9part {{loop}}","main_menu.basic":"Graphismes simplifi\xe9s","main_menu.basic_help":"Meilleures performances.","main_menu.colorful_coins":"Pi\xe8ces color\xe9es","main_menu.colorful_coins_help":"Les pi\xe8ces apparaissent toujours de la couleur de la brique","main_menu.download_save_file":"Sauvegarder mes progr\xe8s","main_menu.download_save_file_help":"Obtenir un fichier de sauvegarde","main_menu.footer_html":"

\\nProgramm\xe9 en France par Renan LE CARO.\\nDonner\\nDiscord\\nF-Droid\\nGoogle Play\\nitch.io\\nGitlab\\nVersion web\\nHackerNews\\nPolitique de confidentialit\xe9 \\nv.{{appVersion}}\\n

","main_menu.fullscreen":"Plein \xe9cran","main_menu.fullscreen_exit":"Quitter le plein \xe9cran","main_menu.fullscreen_exit_help":"Ne fonctionne pas toujours","main_menu.fullscreen_help":"Ne fonctionne pas toujours","main_menu.kid":"Mode enfants","main_menu.kid_help":"Balle plus lente","main_menu.language":"Langue","main_menu.language_help":"Changer la langue d\'affichage","main_menu.load_save_file":"Charger une sauvegarde","main_menu.load_save_file_help":"Depuis un fichier ","main_menu.max_coins":"{{max}} pi\xe8ces affich\xe9es maximum","main_menu.max_coins_help":"Visuel uniquement, pas d\'impact sur le score","main_menu.max_particles":" {{max}} particules maximum","main_menu.max_particles_help":"Limite le nombre de particules affich\xe9es \xe0 l\'\xe9cran pour les effets visuels","main_menu.mobile":"Mode mobile","main_menu.mobile_help":"Laisse un espace sous le palet.","main_menu.normal":"Nouvelle partie","main_menu.normal_help":"Avec un avantage de d\xe9part al\xe9atoire","main_menu.pointer_lock":"Verrouillage du pointeur","main_menu.pointer_lock_help":"Cache aussi le curseur de la souris.","main_menu.record":"Enregistrer des vid\xe9os de jeu","main_menu.record_download":"T\xe9l\xe9charger la vid\xe9o ({{size}} MB)","main_menu.record_help":"Obtenez une vid\xe9o de chaque niveau.","main_menu.reset":"R\xe9initialiser le jeu","main_menu.reset_cancel":"Non","main_menu.reset_confirm":"Oui","main_menu.reset_help":"Effacer les scores, statistiques et licences","main_menu.reset_instruction":"Vous perdrez tous les progr\xe8s que vous avez faits dans le jeu, \xeates-vous s\xfbr ?","main_menu.resume":"Retourner \xe0 la partie","main_menu.resume_help":"Continuer la partie en cours","main_menu.save_file_error":"Erreur lors du chargement du fichier de sauvegarde","main_menu.save_file_loaded":"Sauvegarde charg\xe9e","main_menu.save_file_loaded_help":"L\'appli va red\xe9marrer","main_menu.save_file_loaded_ok":"Ok","main_menu.settings_help":"Adaptez le jeu \xe0 vos besoins","main_menu.settings_title":"Param\xe8tre","main_menu.show_fps":"Compteur de FPS","main_menu.show_fps_help":"Surveiller la perf du jeu","main_menu.show_stats":"Afficher les statistiques en temps r\xe9el","main_menu.show_stats_help":"Pi\xe8ces, temps, rebonds, rat\xe9s","main_menu.sounds":"Sons du jeu","main_menu.sounds_help":"Ralentis certains t\xe9l\xe9phones.","main_menu.title":"Breakout 71","main_menu.unlocks":"Contenu d\xe9bloqu\xe9","main_menu.unlocks_help":"Essayez les \xe9l\xe9ments d\xe9bloqu\xe9s","play.close_modale_window_tooltip":"Fermer","play.current_lvl":"Niveau {{level}}/{{max}}","play.current_lvl_loop":"Niveau {{level}}/{{max}} boucle {{loop}}","play.menu_label":"Menu","play.missed_ball":"rat\xe9","play.mobile_press_to_play":"Gardez le doigt ici pour jouer","premium.back":"Retour","premium.back_help":"Retour au menu principal","premium.buy":"Acheter une cl\xe9 de licence","premium.buy_disabled_help":"\xc0 venir","premium.buy_help":"Vous serez redirig\xe9 vers un formulaire pour payer et recevrez la licence par e-mail. Revenez ensuite pour la saisir ici.","premium.enter":"Entrez la cl\xe9 de licence","premium.enter_help":"Collez la licence dans la fen\xeatre qui s\'ouvre","premium.help":"Achetez une licence pour Breakout 71 pour d\xe9bloquer le bouclage du jeu et soutenir le d\xe9veloppement. Elle co\xfbte 4,99 \u20AC et est illimit\xe9e dans le temps. Vous pouvez l\'utiliser sur plusieurs appareils, mais ne la partagez pas en ligne.","premium.help_google":"Bien que je pr\xe9voie de proposer des licences premium via Google Play, je n\'ai pas encore eu l\'occasion de le faire\xa0; il n\'y a donc pas de lien d\'achat ici. Si vous poss\xe9dez d\xe9j\xe0 une cl\xe9 de licence, vous pouvez la saisir ci-dessous.","premium.per_hours":"Vous avez pass\xe9 {{hours}} heures \xe0 jouer","premium.per_hours_help":"Donnez 4.99\u20AC pour \xeatre premium","premium.thanks":"Vous \xeates premium, merci !","premium.thanks_help":"Copiez votre cl\xe9 de licence","premium.title":"D\xe9bloquez la boucle avec Premium","sandbox.help":"Tester n\'importe quelle combinaison d\'am\xe9liorations","sandbox.instructions":"S\xe9lectionnez les am\xe9lioration ci-dessous et appuyez sur \\"D\xe9marrer la partie de test\\" pour les tester. Les scores et les statistiques ne seront pas enregistr\xe9s.","sandbox.start":"D\xe9marrer la partie de test","sandbox.title":"Mode bac \xe0 sable","sandbox.unlocks_at":"D\xe9verrouill\xe9 \xe0 partir d\'un score total de {{score}}","score_panel.bebuffs_list":"Handicapes : ","score_panel.test_run":"Il s\'agit d\'une partie d\'essai, le score n\'est pas enregistr\xe9.","score_panel.title":"{{score}} points au niveau {{level}}/{{max}} ","score_panel.title_looped":"{{score}} points au niveau {{level}}/{{max}} ","score_panel.upcoming_levels":"Niveaux de la parties : ","score_panel.upgrades_picked":"Am\xe9liorations choisies jusqu\'\xe0 pr\xe9sent :","unlocks.greyed_out_help":"Les \xe9l\xe9ments gris\xe9es peuvent \xeatre d\xe9bloqu\xe9es en augmentant votre score total. Le score total augmente \xe0 chaque fois que vous marquez des points dans le jeu.","unlocks.intro":"Votre score total est de {{ts}}. Vous trouverez ci-dessous toutes les am\xe9liorations et tous les niveaux que le jeu peut offrir.","unlocks.level_description":"Un niveau {{size}}x{{size}} avec {{bricks}} briques","unlocks.title":"Vous avez d\xe9bloqu\xe9 {{percentUnlock}}% du jeu.","unlocks.unlocks_at":"D\xe9verrouill\xe9 au score total {{threshold}}.","upgrades.asceticism.fullHelp":"Il faudra trouver un moyen de stocker les pi\xe8ces pendant que le combo grandis. ","upgrades.asceticism.help":"+1 combo par brique cass\xe9e, RAZ quand une pi\xe8ce est attrap\xe9e","upgrades.asceticism.name":"Asc\xe9tisme","upgrades.ball_attract_ball.fullHelp":"Les balles qui sont \xe9loign\xe9es de plus d\'une demi-largeur d\'\xe9cran commencent \xe0 s\'attirer. La force d\'attraction est plus forte lorsque les balles sont plus \xe9loign\xe9es l\'une de l\'autre. Des particules arc-en-ciel voleront pour symboliser la force d\'attraction. Cet avantage n\'est offert que si vous avez d\xe9j\xe0 plus d\'une balle en jeu.","upgrades.ball_attract_ball.help":"Les balles attirent les balles","upgrades.ball_attract_ball.help_plural":"Force d\'attraction plus forte","upgrades.ball_attract_ball.name":"Gravit\xe9","upgrades.ball_attracts_coins.fullHelp":"Ne me demandez pas pourquoi \xe7a va que dans une sens. ","upgrades.ball_attracts_coins.help":"Les balles attirent les pi\xe8ces","upgrades.ball_attracts_coins.name":"Balles de fortune","upgrades.ball_repulse_ball.fullHelp":"Les balles qui se trouvent \xe0 moins d\'une demi-largeur d\'\xe9cran commencent \xe0 se repousser les unes les autres. La force de r\xe9pulsion est plus forte si elles sont proches l\'une de l\'autre. Des particules seront affich\xe9es pour symboliser l\'application de cette force. Cet avantage n\'est offert que si vous avez d\xe9j\xe0 plus d\'une balle.","upgrades.ball_repulse_ball.help":"Les balles repoussent les balles","upgrades.ball_repulse_ball.help_plural":"Force de r\xe9pulsion plus forte","upgrades.ball_repulse_ball.name":"Vol en formation","upgrades.base_combo.fullHelp":"Votre combo (nombre de pi\xe8ces par brique) commence normalement \xe0 1 au d\xe9but du niveau et revient \xe0 1 lorsque vous rebondissez sans rien toucher. Avec cette caract\xe9ristique, le combo commence 3 points plus haut, ce qui fait que vous obtiendrez toujours au moins 4 pi\xe8ces par brique. Lorsque votre combo est r\xe9initialis\xe9, il revient \xe0 4 et non \xe0 1. Votre balle scintillera un peu pour indiquer que son combo est sup\xe9rieur \xe0 1.","upgrades.base_combo.help":"Le combo commence \xe0 {{coins}}.","upgrades.base_combo.name":"Combo +3","upgrades.bigger_explosions.fullHelp":"L\'explosion par d\xe9faut efface un carr\xe9 de 3x3 briques, avec cette am\xe9lioration un carr\xe9 de 5x5. Le vent soufflant les pi\xe8ces est \xe9galement beaucoup plus fort. L\'\xe9cran clignotera un peu apr\xe8s chaque explosion (sauf en mode graphismes basiques).","upgrades.bigger_explosions.help":"Explosions plus violentes","upgrades.bigger_explosions.name":"Kaboom","upgrades.bigger_puck.fullHelp":"Un grand palet permet de ne jamais rater la balle et d\'attraper plus de pi\xe8ces, ainsi que d\'orienter pr\xe9cis\xe9ment les rebonds (l\'angle de la balle ne d\xe9pend que de l\'endroit o\xf9 elle touche le palet). Cependant, un grand palet est plus difficile \xe0 utiliser sur les c\xf4t\xe9s du niveau.","upgrades.bigger_puck.help":"Attrapez facilement plus de pi\xe8ces.","upgrades.bigger_puck.name":"Palet plus grand","upgrades.clairvoyant.fullHelp":"Vous aide \xe0 choisir les bonnes am\xe9liorations et \xe0 comprendre ce qu\'il se passe avec \\"briques solides\\"","upgrades.clairvoyant.help":"R\xe9v\xe8le les niveaux, PV des briques et direction des balles","upgrades.clairvoyant.name":"Clairvoyant","upgrades.coin_magnet.fullHelp":"Dirige les pi\xe8ces vers le palet. L\'effet est plus fort si la pi\xe8ce est d\xe9j\xe0 proche du palet. Attraper 90 % ou 100 % des pi\xe8ces apporte des bonus sp\xe9ciaux dans le jeu. Une autre fa\xe7on d\'attraper plus de pi\xe8ces est de frapper les briques par le bas. La vitesse et la direction de la balle ont un impact sur la vitesse des pi\xe8ces produites.","upgrades.coin_magnet.help":"Le palet attire les pi\xe8ces","upgrades.coin_magnet.help_plural":"Effet plus marqu\xe9 sur les pi\xe8ces","upgrades.coin_magnet.name":"Aimant pour pi\xe8ces","upgrades.compound_interest.fullHelp":"Votre combo augmentera d\'une unit\xe9 \xe0 chaque fois que vous casserez une brique, g\xe9n\xe9rant de plus en plus de pi\xe8ces \xe0 chaque fois que vous casserez une brique. Veillez cependant \xe0 attraper chacune de ces pi\xe8ces avec votre palet, car toute pi\xe8ce perdue remettra votre combo \xe0 z\xe9ro. \\n \\nSi votre combinaison est sup\xe9rieure au minimum, une ligne rouge s\'affichera au bas de la zone de jeu pour vous le rappeler que les pi\xe8ces ne doivent pas aller \xe0 cet endroit.\\n\\nCet avantage se combine avec d\'autres avantages de combo, le combo augmentera plus rapidement mais se r\xe9initialisera plus souvent.","upgrades.compound_interest.help":"+1 combo par brique cass\xe9e, remise \xe0 z\xe9ro quand une pi\xe8ce est perdu","upgrades.compound_interest.name":"Int\xe9r\xeats","upgrades.concave_puck.fullHelp":" Les balles d\xe9marrent verticalement en d\xe9but de niveau, et rebondi sur le palet de mani\xe8re plus verticale et invers\xe9e.","upgrades.concave_puck.help":"Aide \xe0 \xe9viter les bords.","upgrades.concave_puck.name":"Palet concave","upgrades.corner_shot.fullHelp":"Aide \xe0 viser dans les coins","upgrades.corner_shot.help":"Laisse votre palet sortir de la zone encadr\xe9e","upgrades.corner_shot.name":"Tir en coin","upgrades.etherealcoins.fullHelp":"Il faudrait vous assurer que les pi\xe8ces tomberont bien quand m\xeame \xe0 un moment","upgrades.etherealcoins.help":"Les pi\xe8ces ne subissent plus la gravit\xe9","upgrades.etherealcoins.name":"Monnaie spatiale ","upgrades.extra_levels.fullHelp":"La partie dure normalement 7 niveaux, apr\xe8s quoi le jeu est termin\xe9 et le score que vous avez atteint est votre score de partie.\\n\\nChoisir cette am\xe9lioration vous permet de prolonger la partie d\'un niveau. Les derniers niveaux sont souvent ceux o\xf9 vous faites le plus de points, la diff\xe9rence peut donc \xeatre spectaculaire.","upgrades.extra_levels.help":"Jouer {{count}} niveaux au lieu de 7","upgrades.extra_levels.name":"+1 niveau","upgrades.extra_life.fullHelp":"Normalement, vous n\'avez qu\'une seule balle par manche, et la manche est termin\xe9e d\xe8s que vous la laissez tomber.\\nCette comp\xe9tence ajoute une barre blanche en bas de l\'\xe9cran qui sauvera une balle une fois, et se brisera au cours du processus.\\nVous pouvez prendre plusieurs vies d\'avances, elle seront utilis\xe9es \xe0 chaque fois qu\'une balle est sur le point d\'\xeatre perdue. ","upgrades.extra_life.help":"La balle rebondit une fois avant d\'\xeatre perdue.","upgrades.extra_life.help_plural":"La balle rebondit {{lvl}} fois avant d\'\xeatre perdue.","upgrades.extra_life.name":"+1 vie","upgrades.forgiving.fullHelp":" La premi\xe8re brique rat\xe9e par niveau ne co\xfbte rien, la suivante 10%, 20%, etc.","upgrades.forgiving.help":"Rater les briques fait perdre un portion progressivement plu importante du combo","upgrades.forgiving.name":"L\'erreur est humaine","upgrades.ghost_coins.fullHelp":"Ce n\'est pas une bug, c\'est une fonctionnalit\xe9","upgrades.ghost_coins.help":"Les pi\xe8ces traversent les briques","upgrades.ghost_coins.name":"Pi\xe8ces fant\xf4me","upgrades.helium.fullHelp":"Les pi\xe8ces attendront d\'\xeatre sous le palet pour tomber. ","upgrades.helium.help":"Les pi\xe8ce flottent au lieu de tomber autours du palet","upgrades.helium.name":"Helium","upgrades.hot_start.fullHelp":"Au d\xe9but de chaque niveau, votre combo commencera \xe0 +15 points, mais \xe0 chaque seconde, il sera diminu\xe9 d\'un point. Cela signifie que les 15 premi\xe8res secondes d\'un niveau produiront beaucoup plus de pi\xe8ces que les suivantes.\\nVous devez vous assurer de terminer le niveau rapidement. L\'effet se cumule avec d\'autres avantages li\xe9s au combo, ce qui vous permet d\'augmenter le combo apr\xe8s les 15 secondes, mais il continuera \xe0 diminuer chaque seconde. Chaque fois que vous reprenez la comp\xe9tence, l\'effet est encore plus prononc\xe9.","upgrades.hot_start.help":"Combo \xe0 {{start}}, -{{lvl}} combo par seconde","upgrades.hot_start.name":"D\xe9marrage \xe0 chaud","upgrades.implosions.fullHelp":"La force d\u2019explosion est appliqu\xe9e dans l\u2019autre sens.","upgrades.implosions.help":"Les explosions aspirent les pi\xe8ces au lieu de les faire exploser.","upgrades.implosions.name":"Implosions","upgrades.instant_upgrade.fullHelp":"Choisissez imm\xe9diatement deux am\xe9liorations, afin d\'en obtenir une gratuite et une autre pour rembourser celle utilis\xe9e pour obtenir cet avantage. Chaque fois que vous choisirez des am\xe9liorations dans le menu suivant, vous aurez moins de choix.","upgrades.instant_upgrade.help":"-1 choix jusqu\'\xe0 la fin de la course.","upgrades.instant_upgrade.name":"+2 am\xe9liorations maintenant","upgrades.left_is_lava.fullHelp":"Chaque fois que vous cassez une brique, votre combo augmente d\'une unit\xe9, ce qui vous permet d\'obtenir une pi\xe8ce de plus \xe0 chaque fois que vous cassez une brique.\\n\\nCependant, votre combinaison se r\xe9initialise d\xe8s que votre balle touche le c\xf4t\xe9 gauche.\\n\\nD\xe8s que votre combo augmente, le c\xf4t\xe9 gauche devient rouge pour vous rappeler que vous devez \xe9viter de le frapper.\\n\\nL\'effet se cumule avec d\'autres avantages de combo, le combo augmente plus rapidement avec plus d\'am\xe9liorations, mais il se r\xe9initialise \xe9galement si l\'une ou l\'autre des conditions de r\xe9initialisation est remplie. ","upgrades.left_is_lava.help":"Plus de pi\xe8ces si vous ne touchez pas le c\xf4t\xe9 gauche.","upgrades.left_is_lava.name":"\xc9viter le c\xf4t\xe9 gauche","upgrades.metamorphosis.fullHelp":"Avec cette am\xe9lioration, les pi\xe8ces seront de la couleur de la brique d\'o\xf9 elles proviennent et coloreront la premi\xe8re brique qu\'elles toucheront. \\n\\nLes pi\xe8ces apparaissent \xe0 la vitesse de la balle qui les a cass\xe9es, ce qui signifie que vous pouvez viser un peu dans la direction des briques que vous voulez \\"peindre\\".","upgrades.metamorphosis.help":"Les pi\xe8ces de monnaie tachent les briques qu\'elles touchent","upgrades.metamorphosis.name":"M\xe9tamorphose","upgrades.multiball.fullHelp":"D\xe8s que vous laissez tomber la balle dans Breakout 71, vous perdez. \\n\\nAvec cet avantage, vous obtenez deux balles, et vous pouvez donc vous permettre d\'en perdre une.\\n\\nLes balles perdues reviennent au niveau suivant. \\n\\nLe fait d\'avoir plus d\'une balle permet d\'obtenir d\'autres avantages et, bien s\xfbr, de franchir le niveau plus rapidement.","upgrades.multiball.help":"Chaque niveau commence avec {{count}} balles.","upgrades.multiball.name":"+1 balle","upgrades.nbricks.fullHelp":"Si votre balle rebondis sans casser une brique, \xe7a compte quand m\xeame comme une frappe. Les briques d\xe9truites par des explosions ne comptent pas.","upgrades.nbricks.help":"Frappez exactement {{lvl}} briques par rebond pour +{{lvl}} combo, sinon RAZ","upgrades.nbricks.name":"Pr\xe9l\xe8vement","upgrades.one_more_choice.fullHelp":"Chaque menu d\'am\xe9lioration comportera une option suppl\xe9mentaire. Cela n\'augmente pas le nombre d\'am\xe9liorations que vous pouvez choisir, mais vous aide \xe0 cr\xe9er le profile id\xe9al. ","upgrades.one_more_choice.help":"Les niveaux suivants offriront une option suppl\xe9mentaire dans la liste d\'am\xe9liorations.","upgrades.one_more_choice.name":"+1 choix jusqu\'\xe0 la fin de la course","upgrades.passive_income.fullHelp":"Certaines am\xe9lioration font bouger les balles sans avoir besoin de mettre le palet en mouvement.","upgrades.passive_income.help":"+{{lvl}} combo / brique, sauf si le palet \xe0 boug\xe9 dans les {{time}} derni\xe8res secondes, RAZ dans ce cas","upgrades.passive_income.name":"Revenu passif","upgrades.picky_eater.fullHelp":"Chaque fois que vous cassez une brique de la m\xeame couleur que votre balle, votre combo augmente d\'une unit\xe9.\\n\\nS\'il s\'agit d\'une couleur diff\xe9rente, la balle adopte cette nouvelle couleur, mais la combinaison est r\xe9initialis\xe9e.\\n\\nLes briques de la mauvaise couleur sont entour\xe9es en rouge.\\n\\nSi vous avez plus d\'une balle, elles changent toutes de couleur lorsque l\'une d\'entre elles touche une brique.","upgrades.picky_eater.help":"Plus de pi\xe8ces si vous cassez les briques couleur par couleur.","upgrades.picky_eater.name":"Mangeur par couleur","upgrades.pierce.fullHelp":"Normalement , la balle rebondit d\xe8s qu\'elle touche une brique. Avec cette caract\xe9ristique, elle continuera sa trajectoire jusqu\'\xe0 3 briques cass\xe9es.\\n\\nApr\xe8s cela, elle rebondira sur la quatri\xe8me brique et vous devez toucher le palet pour remettre le compteur \xe0 z\xe9ro.","upgrades.pierce.help":"La balle perce {{count}} briques apr\xe8s chaque rebond sur le palet","upgrades.pierce.name":"Balle per\xe7ante","upgrades.pierce_color.fullHelp":"Chaque fois qu\'une balle touche une brique de la m\xeame couleur, elle la traverse sans encombre.\\nLorsqu\'elle atteint une brique de couleur diff\xe9rente, elle la casse, prend sa couleur et rebondit. \\nSi vous avez des briques solides, le fonctionnement est un peu diff\xe9rent. ","upgrades.pierce_color.help":"+{{lvl}} dommage sur les briques de la couleur de la balle","upgrades.pierce_color.name":"Perceur de couleur","upgrades.puck_repulse_ball.fullHelp":"Lorsqu\'une balle s\'approche du palet, elle commence \xe0 ralentir, voire \xe0 rebondir sans toucher le palet. Beaucoup de choses sont li\xe9es \xe0 un passage par le palet dans le jeu, donc \xe7a pourrait ouvrir des possibilit\xe9s. ","upgrades.puck_repulse_ball.help":"Le palet repousse les balles","upgrades.puck_repulse_ball.help_plural":"La force de r\xe9pulsion est plus grande","upgrades.puck_repulse_ball.name":"Atterrissage en douceur","upgrades.reach.fullHelp":"Essayez de bloquer la balle au dessus des briques pour plus de combo","upgrades.reach.help":"+{{lvl}} combo / brique, la plus basse d\'une colonne RAZ le combo","upgrades.reach.name":"Attaque a\xe9rienne","upgrades.respawn.fullHelp":"Apr\xe8s avoir cass\xe9 deux briques ou plus, lorsque la balle touche le palet, la premi\xe8re brique est remise en place, \xe0 condition que l\'espace soit libre et que la brique ne soit pas une bombe.\\n\\nDes effets de particules vous indiqueront o\xf9 les briques appara\xeetront. \\n\\nEn montant en niveau, vous pouvez faire r\xe9appara\xeetre jusqu\'\xe0 4 briques \xe0 la fois, mais il doit toujours y en avoir au moins une qui reste d\xe9truite.","upgrades.respawn.help":"Certaines briques r\xe9apparaissent apr\xe8s avoir \xe9t\xe9 d\xe9truites.","upgrades.respawn.help_plural":"Plus de briques peuvent r\xe9appara\xeetre","upgrades.respawn.name":"R\xe9apparition ","upgrades.right_is_lava.fullHelp":"Chaque fois que vous cassez une brique, votre combo augmente d\'une unit\xe9, ce qui vous permet d\'obtenir une pi\xe8ce de plus \xe0 chaque fois que vous cassez les briques suivantes.\\n\\nCependant, votre combinaison se r\xe9initialise d\xe8s que votre balle touche le c\xf4t\xe9 droit de la zone de jeu.\\n\\nD\xe8s que votre combo augmente, le c\xf4t\xe9 droit devient rouge pour vous rappeler que vous devez \xe9viter de le frapper.\\n\\nL\'effet se cumule avec d\'autres avantages de combo, le combo augmente plus rapidement avec plus d\'am\xe9liorations, mais il se r\xe9initialise \xe9galement si l\'une des conditions de r\xe9initialisation est remplie.","upgrades.right_is_lava.help":"Plus de pi\xe8ces si vous ne touchez pas le c\xf4t\xe9 droit.","upgrades.right_is_lava.name":"\xc9viter le c\xf4t\xe9 droit","upgrades.sacrifice.fullHelp":"Le combo pourrait monter assez haut ","upgrades.sacrifice.help":"Perdre une vie d\xe9truit toutes les briques","upgrades.sacrifice.name":"Sacrifice","upgrades.sapper.fullHelp":"Au lieu de dispara\xeetre, la premi\xe8re brique cass\xe9e est remplac\xe9e par une bombe. Faire rebondir la balle sur le palet r\xe9arme l\'effet. En montant en niveau, vous pourrez placer plus de bombes. N\'oubliez pas que les bombes ont un impact sur la vitesse des pi\xe8ces \xe0 proximit\xe9. Trop d\'explosions peuvent rendre difficile la r\xe9cup\xe9ration des fruits de votre dur labeur.","upgrades.sapper.help":"La premi\xe8re brique cass\xe9e devient une bombe.","upgrades.sapper.help_plural":"Les premi\xe8res briques {{lvl}} cass\xe9es deviennent des bombes.","upgrades.sapper.name":"Sapeur","upgrades.shocks.fullHelp":"Un peu comme jouer au billard avec des grenades","upgrades.shocks.help":"Collision explosive entre balles","upgrades.shocks.name":"Choc","upgrades.shunt.fullHelp":"D\xe9marrage \xe0 chaud sera simplement ajout\xe9 au combo actuel","upgrades.shunt.help":"Garer {{percent}}% du combo au changement de niveau ","upgrades.shunt.name":"Shunt","upgrades.side_kick.fullHelp":"Lorsqu\'une brique est touch\xe9e, le jeu v\xe9rifie la vitesse de la balle et ajoute +1 au combo si sa vitesse horizontale est sup\xe9rieure \xe0 sa vitesse verticale. Dans le cas contraire, le combo diminuera d\'un point. L\'emplacement de l\'impact sur la brique n\'a aucune importance.","upgrades.side_kick.help":"+{{lvl}} combo par brique cass\xe9 horizontalement, -{{lvl}} sinon","upgrades.side_kick.name":"Un cot\xe9 positif","upgrades.skip_last.fullHelp":"Vous devez casser toutes les briques pour passer au niveau suivant. \\n\\nCependant, il peut \xeatre difficile d\'obtenir les derni\xe8res briques.\\n\\nTerminer un niveau plus t\xf4t permet d\'obtenir des choix suppl\xe9mentaires lors de la mise \xe0 niveau. \\n\\nNe jamais manquer de briques est \xe9galement tr\xe8s avantageux.\\n\\nDonc, si vous avez du mal \xe0 casser les derni\xe8res briques, obtenir cet avantage plusieurs fois peut vous aider.","upgrades.skip_last.help":"La derni\xe8re brique s\'autod\xe9truit.","upgrades.skip_last.help_plural":"Les {{lvl}} derni\xe8res briques restantes s\'autod\xe9truiront","upgrades.skip_last.name":"Nettoyage facile","upgrades.slow_down.fullHelp":"La balle d\xe9marre relativement lentement, mais \xe0 chaque niveau de votre course, elle d\xe9marre un peu plus vite, et elle acc\xe9l\xe8re \xe9galement si vous passez beaucoup de temps dans un niveau.\\n\\nCet avantage rend la balle plus facile \xe0 g\xe9rer. \\n\\nVous pouvez l\'obtenir au d\xe9but de chaque course en activant le mode enfant dans le menu.","upgrades.slow_down.help":"La balle se d\xe9place plus lentement","upgrades.slow_down.name":"Balle lente","upgrades.smaller_puck.fullHelp":"Le palet est donc plus petit, ce qui, en th\xe9orie, facilite certains tirs en coin, mais augmente surtout la difficult\xe9.\\n\\nC\'est pourquoi vous b\xe9n\xe9ficiez \xe9galement d\'un bonus de +5 pi\xe8ces par brique pour toutes les briques que vous casserez apr\xe8s avoir choisi cette option.","upgrades.smaller_puck.help":"Donne aussi +5 combo","upgrades.smaller_puck.help_plural":"Palet encore plus petit et combinaison de base plus \xe9lev\xe9e","upgrades.smaller_puck.name":"Palet plus petit","upgrades.soft_reset.fullHelp":"Limite l\'impact d\'une r\xe9initialisation du combo.","upgrades.soft_reset.help":"La remise \xe0 z\xe9ro du combo conserve {{percent}}% des points","upgrades.soft_reset.name":"R\xe9initialisation progressive","upgrades.streak_shots.fullHelp":"Chaque fois que vous cassez une brique, votre combo (nombre de pi\xe8ces par brique) augmente d\'une unit\xe9. Cependant, d\xe8s que la balle touche votre palet, le combo est remis \xe0 sa valeur par d\xe9faut, et vous n\'obtiendrez qu\'une seule pi\xe8ce par brique.\\n\\nUne fois que votre combinaison d\xe9passe la valeur de base, votre palet devient rouge pour vous rappeler que le fait de le toucher avec la balle d\xe9truira votre combinaison.\\n\\nCela peut se cumuler avec d\'autres avantages li\xe9s au combo, le combo augmentera plus rapidement mais se r\xe9initialisera plus facilement car n\'importe laquelle des conditions suffit \xe0 le r\xe9initialiser.","upgrades.streak_shots.help":"Plus de pi\xe8ces si vous cassez plusieurs briques \xe0 la fois.","upgrades.streak_shots.name":"S\xe9quence de destruction","upgrades.sturdy_bricks.fullHelp":"Avec le niveau 1 de cette comp\xe9tence, la balle a 20 % de chances de rebondir sans casser les briques, mais g\xe9n\xe8re 10% de pi\xe8ces en plus lorsqu\'elle en casse une.\\n\\nCe +10% n\'est pas indiqu\xe9 dans le nombre de combos. Au niveau 4, la balle a 80 % de chances de rebondir et rapporte 40 % de pi\xe8ces en plus.","upgrades.sturdy_bricks.help":"Les briques r\xe9sistent parfois aux coups mais font tomber plus de pi\xe8ces.","upgrades.sturdy_bricks.help_plural":"Les briques r\xe9sistent davantage et font tomber plus de pi\xe8ces","upgrades.sturdy_bricks.name":"Briques solides","upgrades.telekinesis.fullHelp":"D\xe8s que la balle touche votre palet, vous pouvez la diriger vers la gauche ou la droite en d\xe9pla\xe7ant votre palet.\\n\\nL\'effet s\'arr\xeate lorsque la balle touche une brique et se r\xe9initialise la prochaine fois qu\'elle touche le palet. Il ne fait rien non plus lorsque la balle descend apr\xe8s avoir rebondi au sommet.","upgrades.telekinesis.help":"Contr\xf4ler la trajectoire de la balle","upgrades.telekinesis.help_plural":"Effet plus fort sur la balle","upgrades.telekinesis.name":"T\xe9l\xe9kin\xe9sie","upgrades.top_is_lava.fullHelp":"Chaque fois que vous cassez une brique, votre combo augmente d\'une unit\xe9. Cependant, votre combo sera r\xe9initialis\xe9 d\xe8s que votre balle atteindra le haut de l\'\xe9cran.\\n\\nLorsque votre combo est sup\xe9rieur au minimum, une barre rouge appara\xeet en haut de l\'\xe9cran pour vous rappeler que vous devez \xe9viter de la frapper.\\n\\nCet effet s\'ajoute aux autres avantages du combo.","upgrades.top_is_lava.help":"Plus de pi\xe8ces si vous ne touchez pas le haut de la zone de jeu","upgrades.top_is_lava.name":"Icare ","upgrades.trampoline.fullHelp":"Une des rares am\xe9liorations \xe0 ne pas avoir de condition de remise \xe0 z\xe9ro","upgrades.trampoline.help":"+{{lvl}} combo \xe0 chaque rebond d\'une balle sur le palet,-{{lvl}} combo \xe0 chaque rebond au plafond","upgrades.trampoline.name":"Trampoline","upgrades.unbounded.fullHelp":"J\'esp\xe8re que vous avez pr\xe9vu un moyen de r\xe9cup\xe9rer vos balles","upgrades.unbounded.help":"+1 combo par brique, plus de cot\xe9s pour garder la balle en jeu, danger","upgrades.unbounded.name":"Lib\xe9r\xe9e, d\xe9livr\xe9e","upgrades.viscosity.fullHelp":"Les pi\xe8ces acc\xe9l\xe8rent normalement avec la gravit\xe9 et les explosions pour atteindre des vitesses assez \xe9lev\xe9es. \\n\\nCette comp\xe9tence les ralentit constamment, comme si elles se trouvaient dans une sorte de liquide visqueux.\\n\\nCela permet de les attraper plus facilement et se combine bien avec les am\xe9liorations qui influencent le mouvement de la pi\xe8ce.","upgrades.viscosity.help":"Chute plus lente des pi\xe8ces","upgrades.viscosity.name":"Fluide visqueux ","upgrades.wind.fullHelp":"Le vent d\xe9pend de l\'endroit o\xf9 se trouve le palet, s\'il est au centre de l\'\xe9cran, il ne se passe rien, s\'il est \xe0 gauche, il soufflera vers la gauche, s\'il est \xe0 droite de l\'\xe9cran, il soufflera vers la droite.\\n\\nLe vent affecte \xe0 la fois les balles et les pi\xe8ces.","upgrades.wind.help":"La position du palet cr\xe9e du vent","upgrades.wind.help_plural":"Force du vent plus importante","upgrades.wind.name":"Vive le vent","upgrades.yoyo.fullHelp":"C\'est l\'inverse de T\xe9l\xe9kin\xe9sie","upgrades.yoyo.help":"La balle descend vers le palet","upgrades.yoyo.name":"Yo-yo","upgrades.zen.fullHelp":"C\'est quand m\xeame un jeu non violent \xe0 la base","upgrades.zen.help":"+1 combo par brique, jusqu\'\xe0 ce qu\'il y ait une explosion","upgrades.zen.name":"Zen"}'); +module.exports = JSON.parse('{"confirmRestart.no":"Annuler ,continuer ma partie en cours","confirmRestart.text":"Vous \xeates sur le point de commencer une nouvelle partie, est-ce vraiment ce que vous vouliez ?","confirmRestart.title":"D\xe9marrer une nouvelle partie ?","confirmRestart.yes":"Commencer une nouvelle partie","debuffs.banned.description":"{{lvl}} am\xe9lioration(s) bannie(s) : {{banned}}.","debuffs.banned.help":"{{perk}} est banni pour cette course.","debuffs.fragility.help":"Les explosions d\xe9truisent {{percent}} pi\xe8ces et r\xe9initialisent le combo.","debuffs.interference.help":"T\xe9l\xe9kin\xe9sie et probl\xe8me de yo-yo pendant {{lvl}}s toutes les 7 s.","debuffs.more_bombs.help":"{{lvl}} briques remplac\xe9es par des bombes.","debuffs.negative_coins.help":"{{lvl}}/10000 pi\xe8ces apparaissent maudites et clignotent en rouge. La partie est termin\xe9e si vous les attrapez.","debuffs.sturdiness.help":"Toutes les briques r\xe9sistent \xe0 +{{lvl}} chocs","gameOver.because_cursed_coin":"Jeu termin\xe9","gameOver.because_cursed_coin_intro":"Vous avez crach\xe9 une pi\xe8ce maudite (pi\xe8ces rouge vif) et vous n\'aviez pas de vie suppl\xe9mentaire \xe0 revendre.","gameOver.cumulative_total":"Votre score total cumul\xe9 est pass\xe9 de {{startTs}} \xe0 {{endTs}}.","gameOver.lost.summary":"Vous avez fait tomber la balle apr\xe8s avoir attrap\xe9 {{score}} pi\xe8ces.","gameOver.lost.title":"Balle perdue","gameOver.next_unlock":"Marquez {{points}} points suppl\xe9mentaires pour d\xe9bloquer la prochaine am\xe9lioration ou le prochain niveau.","gameOver.restart":"Nouvelle partie","gameOver.stats.balls_lost":"Balles perdues","gameOver.stats.bricks_broken":"Briques cass\xe9es","gameOver.stats.bricks_per_minute":"Briques cass\xe9es par minute","gameOver.stats.catch_rate":"Pi\xe8ces attrap\xe9es","gameOver.stats.combo_avg":"Combo moyen","gameOver.stats.combo_max":"Combo maximum","gameOver.stats.duration_per_level":"Dur\xe9e par niveau","gameOver.stats.hit_rate":"Pr\xe9cision","gameOver.stats.intro":"Vous trouverez ci-dessous les statistiques de cette partie compar\xe9es \xe0 vos {{count}} meilleures parties.","gameOver.stats.level_reached":"Niveau atteint","gameOver.stats.loops":"Boucles","gameOver.stats.total_score":"Score total","gameOver.stats.upgrades_applied":"Mises \xe0 jour appliqu\xe9es","gameOver.test_run":"Cette partie de test et son score ne sont pas enregistr\xe9s.","gameOver.unlocked_count":"Vous avez d\xe9bloqu\xe9 {{count}} objet(s) :","gameOver.upgrades_picked":"Am\xe9lioration actives en fin de partie","gameOver.win.summary":"Vous avez nettoy\xe9 tous les niveaux pour cette partie, en attrapant {{score}} pi\xe8ces au total.","gameOver.win.title":"Partie termin\xe9e","level_up.after_buttons":"Vous venez de terminer le niveau {{level}}/{{max}} et vous avez choisi ces am\xe9liorations jusqu\'\xe0 pr\xe9sent :","level_up.before_buttons":"Vous avez attrap\xe9 {{score}} pi\xe8ces {{catchGain}} sur {{levelSpawnedCoins}} en {{time}} secondes {{timeGain}}.\\n\\nVous avez rat\xe9 les briques {{levelMisses}} fois {{missesGain}} et touch\xe9 les bords de la zone de jeu {{levelWallBounces}} fois {{wallHitsGain}}.\\n\\n{{compliment}}","level_up.compliment_advice":"Essayez d\'attraper toutes les pi\xe8ces, de ne jamais rater les briques, de ne pas toucher les murs ou de terminer le niveau en moins de 30 secondes pour obtenir des choix suppl\xe9mentaires et des am\xe9liorations.","level_up.compliment_good":"Bravo !","level_up.compliment_perfect":"Impressionnant, continuez comme \xe7a !","level_up.pick_upgrade_title":"Choisir une am\xe9lioration","level_up.plus_one_choice":"(+1 re-roll)","level_up.plus_one_upgrade":"(+1 am\xe9lioration et +1 re-roll)","level_up.reroll":"Re-roll ({{count}})","level_up.reroll_help":"Nouveaux choix","level_up.unlocked_level":" (Niveau)","level_up.unlocked_perk":" (Am\xe9lioration)","level_up.upgrade_perk_to_level":" niveau {{level}}","loop.converted_rerolls":"","loop.instructions":"Tous vos avantages seront supprim\xe9s, sauf un que vous pouvez choisir ci-dessous. Chaque option comporte un danger suppl\xe9mentaire qui appara\xeetra \xe0 tous les niveaux.","loop.no_rerolls":"","loop.title":"Boucle de d\xe9part {{loop}}","main_menu.basic":"Graphismes simplifi\xe9s","main_menu.basic_help":"Meilleures performances.","main_menu.colorful_coins":"Pi\xe8ces color\xe9es","main_menu.colorful_coins_help":"Les pi\xe8ces apparaissent toujours de la couleur de la brique","main_menu.download_save_file":"Sauvegarder mes progr\xe8s","main_menu.download_save_file_help":"Obtenir un fichier de sauvegarde","main_menu.footer_html":"

\\nProgramm\xe9 en France par Renan LE CARO.\\nDonner\\nDiscord\\nF-Droid\\nGoogle Play\\nitch.io\\nGitlab\\nVersion web\\nHackerNews\\nPolitique de confidentialit\xe9 \\nv.{{appVersion}}\\n

","main_menu.fullscreen":"Plein \xe9cran","main_menu.fullscreen_exit":"Quitter le plein \xe9cran","main_menu.fullscreen_exit_help":"Ne fonctionne pas toujours","main_menu.fullscreen_help":"Ne fonctionne pas toujours","main_menu.kid":"Mode enfants","main_menu.kid_help":"Balle plus lente","main_menu.language":"Langue","main_menu.language_help":"Changer la langue d\'affichage","main_menu.load_save_file":"Charger une sauvegarde","main_menu.load_save_file_help":"Depuis un fichier ","main_menu.max_coins":"{{max}} pi\xe8ces affich\xe9es maximum","main_menu.max_coins_help":"Visuel uniquement, pas d\'impact sur le score","main_menu.max_particles":" {{max}} particules maximum","main_menu.max_particles_help":"Limite le nombre de particules affich\xe9es \xe0 l\'\xe9cran pour les effets visuels","main_menu.mobile":"Mode mobile","main_menu.mobile_help":"Laisse un espace sous le palet.","main_menu.normal":"Nouvelle partie","main_menu.normal_help":"Avec un avantage de d\xe9part al\xe9atoire","main_menu.pointer_lock":"Verrouillage du pointeur","main_menu.pointer_lock_help":"Cache aussi le curseur de la souris.","main_menu.record":"Enregistrer des vid\xe9os de jeu","main_menu.record_download":"T\xe9l\xe9charger la vid\xe9o ({{size}} MB)","main_menu.record_help":"Obtenez une vid\xe9o de chaque niveau.","main_menu.reset":"R\xe9initialiser le jeu","main_menu.reset_cancel":"Non","main_menu.reset_confirm":"Oui","main_menu.reset_help":"Effacer les scores, statistiques et licences","main_menu.reset_instruction":"Vous perdrez tous les progr\xe8s que vous avez faits dans le jeu, \xeates-vous s\xfbr ?","main_menu.resume":"Retourner \xe0 la partie","main_menu.resume_help":"Continuer la partie en cours","main_menu.save_file_error":"Erreur lors du chargement du fichier de sauvegarde","main_menu.save_file_loaded":"Sauvegarde charg\xe9e","main_menu.save_file_loaded_help":"L\'appli va red\xe9marrer","main_menu.save_file_loaded_ok":"Ok","main_menu.settings_help":"Adaptez le jeu \xe0 vos besoins","main_menu.settings_title":"Param\xe8tre","main_menu.show_fps":"Compteur de FPS","main_menu.show_fps_help":"Surveiller la perf du jeu","main_menu.show_stats":"Afficher les statistiques en temps r\xe9el","main_menu.show_stats_help":"Pi\xe8ces, temps, rebonds, rat\xe9s","main_menu.sounds":"Sons du jeu","main_menu.sounds_help":"Ralentis certains t\xe9l\xe9phones.","main_menu.title":"Breakout 71","main_menu.unlocks":"Contenu d\xe9bloqu\xe9","main_menu.unlocks_help":"Essayez les \xe9l\xe9ments d\xe9bloqu\xe9s","play.close_modale_window_tooltip":"Fermer","play.current_lvl":"Niveau {{level}}/{{max}}","play.current_lvl_loop":"Niveau {{level}}/{{max}} boucle {{loop}}","play.menu_label":"Menu","play.missed_ball":"rat\xe9","play.mobile_press_to_play":"Gardez le doigt ici pour jouer","premium.back":"Retour","premium.back_help":"Retour au menu principal","premium.buy":"Acheter une cl\xe9 de licence","premium.buy_disabled_help":"\xc0 venir","premium.buy_help":"Vous serez redirig\xe9 vers un formulaire pour payer et recevrez la licence par e-mail. Revenez ensuite pour la saisir ici.","premium.enter":"Entrez la cl\xe9 de licence","premium.enter_help":"Collez la licence dans la fen\xeatre qui s\'ouvre","premium.help":"Achetez une licence pour Breakout 71 pour d\xe9bloquer le bouclage du jeu et soutenir le d\xe9veloppement. Elle co\xfbte 4,99 \u20AC et est illimit\xe9e dans le temps. Vous pouvez l\'utiliser sur plusieurs appareils, mais ne la partagez pas en ligne.","premium.help_google":"Bien que je pr\xe9voie de proposer des licences premium via Google Play, je n\'ai pas encore eu l\'occasion de le faire\xa0; il n\'y a donc pas de lien d\'achat ici. Si vous poss\xe9dez d\xe9j\xe0 une cl\xe9 de licence, vous pouvez la saisir ci-dessous.","premium.per_hours":"Vous avez pass\xe9 {{hours}} heures \xe0 jouer","premium.per_hours_help":"Donnez 4.99\u20AC pour \xeatre premium","premium.thanks":"Vous \xeates premium, merci !","premium.thanks_help":"Copiez votre cl\xe9 de licence","premium.title":"D\xe9bloquez la boucle avec Premium","sandbox.help":"Tester n\'importe quelle combinaison d\'am\xe9liorations","sandbox.instructions":"S\xe9lectionnez les am\xe9lioration ci-dessous et appuyez sur \\"D\xe9marrer la partie de test\\" pour les tester. Les scores et les statistiques ne seront pas enregistr\xe9s.","sandbox.start":"D\xe9marrer la partie de test","sandbox.title":"Mode bac \xe0 sable","sandbox.unlocks_at":"D\xe9verrouill\xe9 \xe0 partir d\'un score total de {{score}}","score_panel.bebuffs_list":"Handicapes : ","score_panel.test_run":"Il s\'agit d\'une partie d\'essai, le score n\'est pas enregistr\xe9.","score_panel.title":"{{score}} points au niveau {{level}}/{{max}} ","score_panel.title_looped":"{{score}} points au niveau {{level}}/{{max}} ","score_panel.upcoming_levels":"Niveaux de la parties : ","score_panel.upgrades_picked":"Am\xe9liorations choisies jusqu\'\xe0 pr\xe9sent :","unlocks.greyed_out_help":"Les \xe9l\xe9ments gris\xe9es peuvent \xeatre d\xe9bloqu\xe9es en augmentant votre score total. Le score total augmente \xe0 chaque fois que vous marquez des points dans le jeu.","unlocks.intro":"Votre score total est de {{ts}}. Vous trouverez ci-dessous toutes les am\xe9liorations et tous les niveaux que le jeu peut offrir.","unlocks.level_description":"Un niveau {{size}}x{{size}} avec {{bricks}} briques","unlocks.title":"Vous avez d\xe9bloqu\xe9 {{percentUnlock}}% du jeu.","unlocks.unlocks_at":"D\xe9verrouill\xe9 au score total {{threshold}}.","upgrades.asceticism.fullHelp":"Il faudra trouver un moyen de stocker les pi\xe8ces pendant que le combo grandis. ","upgrades.asceticism.help":"+1 combo par brique cass\xe9e, RAZ quand une pi\xe8ce est attrap\xe9e","upgrades.asceticism.name":"Asc\xe9tisme","upgrades.ball_attract_ball.fullHelp":"Les balles qui sont \xe9loign\xe9es de plus d\'une demi-largeur d\'\xe9cran commencent \xe0 s\'attirer. La force d\'attraction est plus forte lorsque les balles sont plus \xe9loign\xe9es l\'une de l\'autre. Des particules arc-en-ciel voleront pour symboliser la force d\'attraction. Cet avantage n\'est offert que si vous avez d\xe9j\xe0 plus d\'une balle en jeu.","upgrades.ball_attract_ball.help":"Les balles attirent les balles","upgrades.ball_attract_ball.help_plural":"Force d\'attraction plus forte","upgrades.ball_attract_ball.name":"Gravit\xe9","upgrades.ball_attracts_coins.fullHelp":"Ne me demandez pas pourquoi \xe7a va que dans une sens. ","upgrades.ball_attracts_coins.help":"Les balles attirent les pi\xe8ces","upgrades.ball_attracts_coins.name":"Balles de fortune","upgrades.ball_repulse_ball.fullHelp":"Les balles qui se trouvent \xe0 moins d\'une demi-largeur d\'\xe9cran commencent \xe0 se repousser les unes les autres. La force de r\xe9pulsion est plus forte si elles sont proches l\'une de l\'autre. Des particules seront affich\xe9es pour symboliser l\'application de cette force. Cet avantage n\'est offert que si vous avez d\xe9j\xe0 plus d\'une balle.","upgrades.ball_repulse_ball.help":"Les balles repoussent les balles","upgrades.ball_repulse_ball.help_plural":"Force de r\xe9pulsion plus forte","upgrades.ball_repulse_ball.name":"Vol en formation","upgrades.base_combo.fullHelp":"Votre combo (nombre de pi\xe8ces par brique) commence normalement \xe0 1 au d\xe9but du niveau et revient \xe0 1 lorsque vous rebondissez sans rien toucher. Avec cette caract\xe9ristique, le combo commence 3 points plus haut, ce qui fait que vous obtiendrez toujours au moins 4 pi\xe8ces par brique. Lorsque votre combo est r\xe9initialis\xe9, il revient \xe0 4 et non \xe0 1. Votre balle scintillera un peu pour indiquer que son combo est sup\xe9rieur \xe0 1.","upgrades.base_combo.help":"Le combo commence \xe0 {{coins}}.","upgrades.base_combo.name":"Combo +3","upgrades.bigger_explosions.fullHelp":"L\'explosion par d\xe9faut efface un carr\xe9 de 3x3 briques, avec cette am\xe9lioration un carr\xe9 de 5x5. Le vent soufflant les pi\xe8ces est \xe9galement beaucoup plus fort. L\'\xe9cran clignotera un peu apr\xe8s chaque explosion (sauf en mode graphismes basiques).","upgrades.bigger_explosions.help":"Explosions plus violentes","upgrades.bigger_explosions.name":"Kaboom","upgrades.bigger_puck.fullHelp":"Un grand palet permet de ne jamais rater la balle et d\'attraper plus de pi\xe8ces, ainsi que d\'orienter pr\xe9cis\xe9ment les rebonds (l\'angle de la balle ne d\xe9pend que de l\'endroit o\xf9 elle touche le palet). Cependant, un grand palet est plus difficile \xe0 utiliser sur les c\xf4t\xe9s du niveau.","upgrades.bigger_puck.help":"Attrapez facilement plus de pi\xe8ces.","upgrades.bigger_puck.name":"Palet plus grand","upgrades.clairvoyant.fullHelp":"Vous aide \xe0 choisir les bonnes am\xe9liorations et \xe0 comprendre ce qu\'il se passe avec \\"briques solides\\"","upgrades.clairvoyant.help":"R\xe9v\xe8le les niveaux, PV des briques et direction des balles","upgrades.clairvoyant.name":"Clairvoyant","upgrades.coin_magnet.fullHelp":"Dirige les pi\xe8ces vers le palet. L\'effet est plus fort si la pi\xe8ce est d\xe9j\xe0 proche du palet. Attraper 90 % ou 100 % des pi\xe8ces apporte des bonus sp\xe9ciaux dans le jeu. Une autre fa\xe7on d\'attraper plus de pi\xe8ces est de frapper les briques par le bas. La vitesse et la direction de la balle ont un impact sur la vitesse des pi\xe8ces produites.","upgrades.coin_magnet.help":"Le palet attire les pi\xe8ces","upgrades.coin_magnet.help_plural":"Effet plus marqu\xe9 sur les pi\xe8ces","upgrades.coin_magnet.name":"Aimant pour pi\xe8ces","upgrades.compound_interest.fullHelp":"Votre combo augmentera d\'une unit\xe9 \xe0 chaque fois que vous casserez une brique, g\xe9n\xe9rant de plus en plus de pi\xe8ces \xe0 chaque fois que vous casserez une brique. Veillez cependant \xe0 attraper chacune de ces pi\xe8ces avec votre palet, car toute pi\xe8ce perdue remettra votre combo \xe0 z\xe9ro. \\n \\nSi votre combinaison est sup\xe9rieure au minimum, une ligne rouge s\'affichera au bas de la zone de jeu pour vous le rappeler que les pi\xe8ces ne doivent pas aller \xe0 cet endroit.\\n\\nCet avantage se combine avec d\'autres avantages de combo, le combo augmentera plus rapidement mais se r\xe9initialisera plus souvent.","upgrades.compound_interest.help":"+1 combo par brique cass\xe9e, remise \xe0 z\xe9ro quand une pi\xe8ce est perdu","upgrades.compound_interest.name":"Int\xe9r\xeats","upgrades.concave_puck.fullHelp":" Les balles d\xe9marrent verticalement en d\xe9but de niveau, et rebondi sur le palet de mani\xe8re plus verticale et invers\xe9e.","upgrades.concave_puck.help":"Aide \xe0 \xe9viter les bords.","upgrades.concave_puck.name":"Palet concave","upgrades.corner_shot.fullHelp":"Aide \xe0 viser dans les coins","upgrades.corner_shot.help":"Laisse votre palet sortir de la zone encadr\xe9e","upgrades.corner_shot.name":"Tir en coin","upgrades.etherealcoins.fullHelp":"Il faudrait vous assurer que les pi\xe8ces tomberont bien quand m\xeame \xe0 un moment","upgrades.etherealcoins.help":"Les pi\xe8ces ne subissent plus la gravit\xe9","upgrades.etherealcoins.name":"Monnaie spatiale ","upgrades.extra_levels.fullHelp":"La partie dure normalement 7 niveaux, apr\xe8s quoi le jeu est termin\xe9 et le score que vous avez atteint est votre score de partie.\\n\\nChoisir cette am\xe9lioration vous permet de prolonger la partie d\'un niveau. Les derniers niveaux sont souvent ceux o\xf9 vous faites le plus de points, la diff\xe9rence peut donc \xeatre spectaculaire.","upgrades.extra_levels.help":"Jouer {{count}} niveaux au lieu de 7","upgrades.extra_levels.name":"+1 niveau","upgrades.extra_life.fullHelp":"Normalement, vous n\'avez qu\'une seule balle par manche, et la manche est termin\xe9e d\xe8s que vous la laissez tomber.\\nCette comp\xe9tence ajoute une barre blanche en bas de l\'\xe9cran qui sauvera une balle une fois, et se brisera au cours du processus.\\nVous pouvez prendre plusieurs vies d\'avances, elle seront utilis\xe9es \xe0 chaque fois qu\'une balle est sur le point d\'\xeatre perdue. ","upgrades.extra_life.help":"La balle rebondit une fois avant d\'\xeatre perdue.","upgrades.extra_life.help_plural":"La balle rebondit {{lvl}} fois avant d\'\xeatre perdue.","upgrades.extra_life.name":"+1 vie","upgrades.forgiving.fullHelp":" La premi\xe8re brique rat\xe9e par niveau ne co\xfbte rien, la suivante 10%, 20%, etc.","upgrades.forgiving.help":"Rater les briques fait perdre un portion progressivement plu importante du combo","upgrades.forgiving.name":"L\'erreur est humaine","upgrades.ghost_coins.fullHelp":"Ce n\'est pas une bug, c\'est une fonctionnalit\xe9","upgrades.ghost_coins.help":"Les pi\xe8ces traversent les briques","upgrades.ghost_coins.name":"Pi\xe8ces fant\xf4me","upgrades.helium.fullHelp":"Les pi\xe8ces attendront d\'\xeatre sous le palet pour tomber. ","upgrades.helium.help":"Les pi\xe8ce flottent au lieu de tomber autours du palet","upgrades.helium.name":"Helium","upgrades.hot_start.fullHelp":"Au d\xe9but de chaque niveau, votre combo commencera \xe0 +15 points, mais \xe0 chaque seconde, il sera diminu\xe9 d\'un point. Cela signifie que les 15 premi\xe8res secondes d\'un niveau produiront beaucoup plus de pi\xe8ces que les suivantes.\\nVous devez vous assurer de terminer le niveau rapidement. L\'effet se cumule avec d\'autres avantages li\xe9s au combo, ce qui vous permet d\'augmenter le combo apr\xe8s les 15 secondes, mais il continuera \xe0 diminuer chaque seconde. Chaque fois que vous reprenez la comp\xe9tence, l\'effet est encore plus prononc\xe9.","upgrades.hot_start.help":"Combo \xe0 {{start}}, -{{lvl}} combo par seconde","upgrades.hot_start.name":"D\xe9marrage \xe0 chaud","upgrades.implosions.fullHelp":"La force d\u2019explosion est appliqu\xe9e dans l\u2019autre sens.","upgrades.implosions.help":"Les explosions aspirent les pi\xe8ces au lieu de les faire exploser.","upgrades.implosions.name":"Implosions","upgrades.instant_upgrade.fullHelp":"Choisissez imm\xe9diatement deux am\xe9liorations, afin d\'en obtenir une gratuite et une autre pour rembourser celle utilis\xe9e pour obtenir cet avantage. Chaque fois que vous choisirez des am\xe9liorations dans le menu suivant, vous aurez moins de choix.","upgrades.instant_upgrade.help":"-1 choix jusqu\'\xe0 la fin de la course.","upgrades.instant_upgrade.name":"+2 am\xe9liorations maintenant","upgrades.left_is_lava.fullHelp":"Chaque fois que vous cassez une brique, votre combo augmente d\'une unit\xe9, ce qui vous permet d\'obtenir une pi\xe8ce de plus \xe0 chaque fois que vous cassez une brique.\\n\\nCependant, votre combinaison se r\xe9initialise d\xe8s que votre balle touche le c\xf4t\xe9 gauche.\\n\\nD\xe8s que votre combo augmente, le c\xf4t\xe9 gauche devient rouge pour vous rappeler que vous devez \xe9viter de le frapper.\\n\\nL\'effet se cumule avec d\'autres avantages de combo, le combo augmente plus rapidement avec plus d\'am\xe9liorations, mais il se r\xe9initialise \xe9galement si l\'une ou l\'autre des conditions de r\xe9initialisation est remplie. ","upgrades.left_is_lava.help":"Plus de pi\xe8ces si vous ne touchez pas le c\xf4t\xe9 gauche.","upgrades.left_is_lava.name":"\xc9viter le c\xf4t\xe9 gauche","upgrades.metamorphosis.fullHelp":"Avec cette am\xe9lioration, les pi\xe8ces seront de la couleur de la brique d\'o\xf9 elles proviennent et coloreront la premi\xe8re brique qu\'elles toucheront. \\n\\nLes pi\xe8ces apparaissent \xe0 la vitesse de la balle qui les a cass\xe9es, ce qui signifie que vous pouvez viser un peu dans la direction des briques que vous voulez \\"peindre\\".","upgrades.metamorphosis.help":"Les pi\xe8ces de monnaie tachent les briques qu\'elles touchent","upgrades.metamorphosis.name":"M\xe9tamorphose","upgrades.multiball.fullHelp":"D\xe8s que vous laissez tomber la balle dans Breakout 71, vous perdez. \\n\\nAvec cet avantage, vous obtenez deux balles, et vous pouvez donc vous permettre d\'en perdre une.\\n\\nLes balles perdues reviennent au niveau suivant. \\n\\nLe fait d\'avoir plus d\'une balle permet d\'obtenir d\'autres avantages et, bien s\xfbr, de franchir le niveau plus rapidement.","upgrades.multiball.help":"Chaque niveau commence avec {{count}} balles.","upgrades.multiball.name":"+1 balle","upgrades.nbricks.fullHelp":"Si votre balle rebondis sans casser une brique, \xe7a compte quand m\xeame comme une frappe. Les briques d\xe9truites par des explosions ne comptent pas.","upgrades.nbricks.help":"Frappez exactement {{lvl}} briques par rebond pour +{{lvl}} combo, sinon RAZ","upgrades.nbricks.name":"Pr\xe9l\xe8vement","upgrades.one_more_choice.fullHelp":"Chaque menu d\'am\xe9lioration comportera une option suppl\xe9mentaire. Cela n\'augmente pas le nombre d\'am\xe9liorations que vous pouvez choisir, mais vous aide \xe0 cr\xe9er le profile id\xe9al. ","upgrades.one_more_choice.help":"Les niveaux suivants offriront une option suppl\xe9mentaire dans la liste d\'am\xe9liorations.","upgrades.one_more_choice.name":"+1 choix jusqu\'\xe0 la fin de la course","upgrades.passive_income.fullHelp":"Certaines am\xe9lioration font bouger les balles sans avoir besoin de mettre le palet en mouvement.","upgrades.passive_income.help":"+{{lvl}} combo / brique, sauf si le palet \xe0 boug\xe9 dans les {{time}} derni\xe8res secondes, RAZ dans ce cas","upgrades.passive_income.name":"Revenu passif","upgrades.picky_eater.fullHelp":"Chaque fois que vous cassez une brique de la m\xeame couleur que votre balle, votre combo augmente d\'une unit\xe9.\\n\\nS\'il s\'agit d\'une couleur diff\xe9rente, la balle adopte cette nouvelle couleur, mais la combinaison est r\xe9initialis\xe9e.\\n\\nLes briques de la mauvaise couleur sont entour\xe9es en rouge.\\n\\nSi vous avez plus d\'une balle, elles changent toutes de couleur lorsque l\'une d\'entre elles touche une brique.","upgrades.picky_eater.help":"Plus de pi\xe8ces si vous cassez les briques couleur par couleur.","upgrades.picky_eater.name":"Mangeur par couleur","upgrades.pierce.fullHelp":"Normalement , la balle rebondit d\xe8s qu\'elle touche une brique. Avec cette caract\xe9ristique, elle continuera sa trajectoire jusqu\'\xe0 3 briques cass\xe9es.\\n\\nApr\xe8s cela, elle rebondira sur la quatri\xe8me brique et vous devez toucher le palet pour remettre le compteur \xe0 z\xe9ro.","upgrades.pierce.help":"La balle perce {{count}} briques apr\xe8s chaque rebond sur le palet","upgrades.pierce.name":"Balle per\xe7ante","upgrades.pierce_color.fullHelp":"Chaque fois qu\'une balle touche une brique de la m\xeame couleur, elle la traverse sans encombre.\\nLorsqu\'elle atteint une brique de couleur diff\xe9rente, elle la casse, prend sa couleur et rebondit. \\nSi vous avez des briques solides, le fonctionnement est un peu diff\xe9rent. ","upgrades.pierce_color.help":"+{{lvl}} dommage sur les briques de la couleur de la balle","upgrades.pierce_color.name":"Perceur de couleur","upgrades.puck_repulse_ball.fullHelp":"Lorsqu\'une balle s\'approche du palet, elle commence \xe0 ralentir, voire \xe0 rebondir sans toucher le palet. Beaucoup de choses sont li\xe9es \xe0 un passage par le palet dans le jeu, donc \xe7a pourrait ouvrir des possibilit\xe9s. ","upgrades.puck_repulse_ball.help":"Le palet repousse les balles","upgrades.puck_repulse_ball.help_plural":"La force de r\xe9pulsion est plus grande","upgrades.puck_repulse_ball.name":"Atterrissage en douceur","upgrades.reach.fullHelp":"Essayez de bloquer la balle au dessus des briques pour plus de combo","upgrades.reach.help":"+{{lvl}} combo / brique, la plus basse d\'une colonne RAZ le combo","upgrades.reach.name":"Attaque a\xe9rienne","upgrades.respawn.fullHelp":"Apr\xe8s avoir cass\xe9 deux briques ou plus, lorsque la balle touche le palet, la premi\xe8re brique est remise en place, \xe0 condition que l\'espace soit libre et que la brique ne soit pas une bombe.\\n\\nDes effets de particules vous indiqueront o\xf9 les briques appara\xeetront. \\n\\nEn montant en niveau, vous pouvez faire r\xe9appara\xeetre jusqu\'\xe0 4 briques \xe0 la fois, mais il doit toujours y en avoir au moins une qui reste d\xe9truite.","upgrades.respawn.help":"Certaines briques r\xe9apparaissent apr\xe8s avoir \xe9t\xe9 d\xe9truites.","upgrades.respawn.help_plural":"Plus de briques peuvent r\xe9appara\xeetre","upgrades.respawn.name":"R\xe9apparition ","upgrades.right_is_lava.fullHelp":"Chaque fois que vous cassez une brique, votre combo augmente d\'une unit\xe9, ce qui vous permet d\'obtenir une pi\xe8ce de plus \xe0 chaque fois que vous cassez les briques suivantes.\\n\\nCependant, votre combinaison se r\xe9initialise d\xe8s que votre balle touche le c\xf4t\xe9 droit de la zone de jeu.\\n\\nD\xe8s que votre combo augmente, le c\xf4t\xe9 droit devient rouge pour vous rappeler que vous devez \xe9viter de le frapper.\\n\\nL\'effet se cumule avec d\'autres avantages de combo, le combo augmente plus rapidement avec plus d\'am\xe9liorations, mais il se r\xe9initialise \xe9galement si l\'une des conditions de r\xe9initialisation est remplie.","upgrades.right_is_lava.help":"Plus de pi\xe8ces si vous ne touchez pas le c\xf4t\xe9 droit.","upgrades.right_is_lava.name":"\xc9viter le c\xf4t\xe9 droit","upgrades.sacrifice.fullHelp":"Le combo pourrait monter assez haut ","upgrades.sacrifice.help":"Perdre une vie d\xe9truit toutes les briques","upgrades.sacrifice.name":"Sacrifice","upgrades.sapper.fullHelp":"Au lieu de dispara\xeetre, la premi\xe8re brique cass\xe9e est remplac\xe9e par une bombe. Faire rebondir la balle sur le palet r\xe9arme l\'effet. En montant en niveau, vous pourrez placer plus de bombes. N\'oubliez pas que les bombes ont un impact sur la vitesse des pi\xe8ces \xe0 proximit\xe9. Trop d\'explosions peuvent rendre difficile la r\xe9cup\xe9ration des fruits de votre dur labeur.","upgrades.sapper.help":"La premi\xe8re brique cass\xe9e devient une bombe.","upgrades.sapper.help_plural":"Les premi\xe8res briques {{lvl}} cass\xe9es deviennent des bombes.","upgrades.sapper.name":"Sapeur","upgrades.shocks.fullHelp":"Un peu comme jouer au billard avec des grenades","upgrades.shocks.help":"Collision explosive entre balles","upgrades.shocks.name":"Choc","upgrades.shunt.fullHelp":"D\xe9marrage \xe0 chaud sera simplement ajout\xe9 au combo actuel","upgrades.shunt.help":"Garer {{percent}}% du combo au changement de niveau ","upgrades.shunt.name":"Shunt","upgrades.side_kick.fullHelp":"Lorsqu\'une brique est touch\xe9e, le jeu v\xe9rifie la vitesse de la balle et ajoute +1 au combo si sa vitesse horizontale est sup\xe9rieure \xe0 sa vitesse verticale. Dans le cas contraire, le combo diminuera d\'un point. L\'emplacement de l\'impact sur la brique n\'a aucune importance.","upgrades.side_kick.help":"+{{lvl}} combo par brique cass\xe9 horizontalement, -{{lvl}} sinon","upgrades.side_kick.name":"Un cot\xe9 positif","upgrades.skip_last.fullHelp":"Vous devez casser toutes les briques pour passer au niveau suivant. \\n\\nCependant, il peut \xeatre difficile d\'obtenir les derni\xe8res briques.\\n\\nTerminer un niveau plus t\xf4t permet d\'obtenir des choix suppl\xe9mentaires lors de la mise \xe0 niveau. \\n\\nNe jamais manquer de briques est \xe9galement tr\xe8s avantageux.\\n\\nDonc, si vous avez du mal \xe0 casser les derni\xe8res briques, obtenir cet avantage plusieurs fois peut vous aider.","upgrades.skip_last.help":"La derni\xe8re brique s\'autod\xe9truit.","upgrades.skip_last.help_plural":"Les {{lvl}} derni\xe8res briques restantes s\'autod\xe9truiront","upgrades.skip_last.name":"Nettoyage facile","upgrades.slow_down.fullHelp":"La balle d\xe9marre relativement lentement, mais \xe0 chaque niveau de votre course, elle d\xe9marre un peu plus vite, et elle acc\xe9l\xe8re \xe9galement si vous passez beaucoup de temps dans un niveau.\\n\\nCet avantage rend la balle plus facile \xe0 g\xe9rer. \\n\\nVous pouvez l\'obtenir au d\xe9but de chaque course en activant le mode enfant dans le menu.","upgrades.slow_down.help":"La balle se d\xe9place plus lentement","upgrades.slow_down.name":"Balle lente","upgrades.smaller_puck.fullHelp":"Le palet est donc plus petit, ce qui, en th\xe9orie, facilite certains tirs en coin, mais augmente surtout la difficult\xe9.\\n\\nC\'est pourquoi vous b\xe9n\xe9ficiez \xe9galement d\'un bonus de +5 pi\xe8ces par brique pour toutes les briques que vous casserez apr\xe8s avoir choisi cette option.","upgrades.smaller_puck.help":"Donne aussi +5 combo","upgrades.smaller_puck.help_plural":"Palet encore plus petit et combinaison de base plus \xe9lev\xe9e","upgrades.smaller_puck.name":"Palet plus petit","upgrades.soft_reset.fullHelp":"Limite l\'impact d\'une r\xe9initialisation du combo.","upgrades.soft_reset.help":"La remise \xe0 z\xe9ro du combo conserve {{percent}}% des points","upgrades.soft_reset.name":"R\xe9initialisation progressive","upgrades.streak_shots.fullHelp":"Chaque fois que vous cassez une brique, votre combo (nombre de pi\xe8ces par brique) augmente d\'une unit\xe9. Cependant, d\xe8s que la balle touche votre palet, le combo est remis \xe0 sa valeur par d\xe9faut, et vous n\'obtiendrez qu\'une seule pi\xe8ce par brique.\\n\\nUne fois que votre combinaison d\xe9passe la valeur de base, votre palet devient rouge pour vous rappeler que le fait de le toucher avec la balle d\xe9truira votre combinaison.\\n\\nCela peut se cumuler avec d\'autres avantages li\xe9s au combo, le combo augmentera plus rapidement mais se r\xe9initialisera plus facilement car n\'importe laquelle des conditions suffit \xe0 le r\xe9initialiser.","upgrades.streak_shots.help":"Plus de pi\xe8ces si vous cassez plusieurs briques \xe0 la fois.","upgrades.streak_shots.name":"S\xe9quence de destruction","upgrades.sturdy_bricks.fullHelp":"Avec le niveau 1 de cette comp\xe9tence, la balle a 20 % de chances de rebondir sans casser les briques, mais g\xe9n\xe8re 10% de pi\xe8ces en plus lorsqu\'elle en casse une.\\n\\nCe +10% n\'est pas indiqu\xe9 dans le nombre de combos. Au niveau 4, la balle a 80 % de chances de rebondir et rapporte 40 % de pi\xe8ces en plus.","upgrades.sturdy_bricks.help":"Les briques r\xe9sistent parfois aux coups mais font tomber plus de pi\xe8ces.","upgrades.sturdy_bricks.help_plural":"Les briques r\xe9sistent davantage et font tomber plus de pi\xe8ces","upgrades.sturdy_bricks.name":"Briques solides","upgrades.telekinesis.fullHelp":"D\xe8s que la balle touche votre palet, vous pouvez la diriger vers la gauche ou la droite en d\xe9pla\xe7ant votre palet.\\n\\nL\'effet s\'arr\xeate lorsque la balle touche une brique et se r\xe9initialise la prochaine fois qu\'elle touche le palet. Il ne fait rien non plus lorsque la balle descend apr\xe8s avoir rebondi au sommet.","upgrades.telekinesis.help":"Contr\xf4ler la trajectoire de la balle","upgrades.telekinesis.help_plural":"Effet plus fort sur la balle","upgrades.telekinesis.name":"T\xe9l\xe9kin\xe9sie","upgrades.top_is_lava.fullHelp":"Chaque fois que vous cassez une brique, votre combo augmente d\'une unit\xe9. Cependant, votre combo sera r\xe9initialis\xe9 d\xe8s que votre balle atteindra le haut de l\'\xe9cran.\\n\\nLorsque votre combo est sup\xe9rieur au minimum, une barre rouge appara\xeet en haut de l\'\xe9cran pour vous rappeler que vous devez \xe9viter de la frapper.\\n\\nCet effet s\'ajoute aux autres avantages du combo.","upgrades.top_is_lava.help":"Plus de pi\xe8ces si vous ne touchez pas le haut de la zone de jeu","upgrades.top_is_lava.name":"Icare ","upgrades.trampoline.fullHelp":"Une des rares am\xe9liorations \xe0 ne pas avoir de condition de remise \xe0 z\xe9ro","upgrades.trampoline.help":"+{{lvl}} combo \xe0 chaque rebond d\'une balle sur le palet,-{{lvl}} combo \xe0 chaque rebond au plafond","upgrades.trampoline.name":"Trampoline","upgrades.unbounded.fullHelp":"J\'esp\xe8re que vous avez pr\xe9vu un moyen de r\xe9cup\xe9rer vos balles","upgrades.unbounded.help":"+1 combo par brique, plus de cot\xe9s pour garder la balle en jeu, danger","upgrades.unbounded.name":"Lib\xe9r\xe9e, d\xe9livr\xe9e","upgrades.viscosity.fullHelp":"Les pi\xe8ces acc\xe9l\xe8rent normalement avec la gravit\xe9 et les explosions pour atteindre des vitesses assez \xe9lev\xe9es. \\n\\nCette comp\xe9tence les ralentit constamment, comme si elles se trouvaient dans une sorte de liquide visqueux.\\n\\nCela permet de les attraper plus facilement et se combine bien avec les am\xe9liorations qui influencent le mouvement de la pi\xe8ce.","upgrades.viscosity.help":"Chute plus lente des pi\xe8ces","upgrades.viscosity.name":"Fluide visqueux ","upgrades.wind.fullHelp":"Le vent d\xe9pend de l\'endroit o\xf9 se trouve le palet, s\'il est au centre de l\'\xe9cran, il ne se passe rien, s\'il est \xe0 gauche, il soufflera vers la gauche, s\'il est \xe0 droite de l\'\xe9cran, il soufflera vers la droite.\\n\\nLe vent affecte \xe0 la fois les balles et les pi\xe8ces.","upgrades.wind.help":"La position du palet cr\xe9e du vent","upgrades.wind.help_plural":"Force du vent plus importante","upgrades.wind.name":"Vive le vent","upgrades.yoyo.fullHelp":"C\'est l\'inverse de T\xe9l\xe9kin\xe9sie","upgrades.yoyo.help":"La balle descend vers le palet","upgrades.yoyo.name":"Yo-yo","upgrades.zen.fullHelp":"C\'est quand m\xeame un jeu non violent \xe0 la base","upgrades.zen.help":"+1 combo par brique, jusqu\'\xe0 ce qu\'il y ait une explosion","upgrades.zen.name":"Zen"}'); },{}],"uYc9N":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse('{"confirmRestart.no":"Cancel","confirmRestart.text":"You\'re about to start a new run, is that really what you wanted ?","confirmRestart.title":"Start a new run ?","confirmRestart.yes":"Restart game","debuffs.banned.description":"{{lvl}} banned perk(s) : {{banned}}.","debuffs.banned.help":"{{perk}} is banned for this run.","debuffs.fragility.help":"Explosions destroy {{percent}} of coins and reset combo.","debuffs.interference.help":"Telekinesis and yo-yo glitch for {{lvl}}s every 7s.","debuffs.more_bombs.help":"{{lvl}} bricks replaced by bombs.","debuffs.negative_coins.help":"{{lvl}}/10000 of coins spawn cursed, blinking red. Game over if you catch them.","gameOver.because_cursed_coin":"Game over","gameOver.because_cursed_coin_intro":"You cough a cursed coin (bright red coins) and didn\'t have a extra life to spare. ","gameOver.cumulative_total":"Your total cumulative score went from {{startTs}} to {{endTs}}.","gameOver.lost.summary":"You dropped the ball after catching {{score}} coins.","gameOver.lost.title":"Game Over","gameOver.next_unlock":"Score {{points}} more points to reach the next unlock","gameOver.restart":"Start a new run","gameOver.stats.balls_lost":"Balls lost","gameOver.stats.bricks_broken":"Bricks broken","gameOver.stats.bricks_per_minute":"Bricks broken per minute","gameOver.stats.catch_rate":"Catch rate","gameOver.stats.combo_avg":"Average combo","gameOver.stats.combo_max":"Max combo","gameOver.stats.duration_per_level":"Duration per level","gameOver.stats.hit_rate":"Hit rate","gameOver.stats.intro":"Find below your run statistics compared to your {{count}} best runs.","gameOver.stats.level_reached":"Level reached","gameOver.stats.total_score":"Total score","gameOver.stats.upgrades_applied":"Upgrades applied","gameOver.test_run":"This test run and its score are not being recorded","gameOver.unlocked_count":"You unlocked {{count}} item(s) :","gameOver.upgrades_picked":"Upgrades active at the end of the run","gameOver.win.summary":"You cleared all levels for this run, catching {{score}} coins in total.","gameOver.win.title":"Run finished","level_up.after_buttons":"You just finished level {{level}}/{{max}} and picked those upgrades so far :","level_up.before_buttons":"You caught {{score}} coins {{catchGain}} out of {{levelSpawnedCoins}} in {{time}} seconds {{timeGain}}.\\n\\nYou missed {{levelMisses}} times {{missesGain}} and hit the walls or ceiling {{levelWallBounces}} times{{wallHitsGain}}.\\n\\n{{compliment}}","level_up.compliment_advice":"Try to catch all coins, never miss the bricks, never hit the walls/ceiling or clear the level under 30s to gain additional choices and upgrades.","level_up.compliment_good":"Well done !","level_up.compliment_perfect":"Impressive, keep it up !","level_up.pick_upgrade_title":"Pick an upgrade","level_up.plus_one_choice":"(+1 re-roll)","level_up.plus_one_upgrade":"(+1 upgrade and +1 re-roll)","level_up.reroll":"Re-roll ({{count}})","level_up.reroll_help":"Offer new choices","level_up.unlocked_level":" (Level)","level_up.unlocked_perk":" (Perk)","level_up.upgrade_perk_to_level":" lvl {{level}}","loop.instructions":"All your perks will be erased except one that you can pick below. Each option comes with an additional hazard will appear on all levels going forward. ","loop.title":"Starting loop {{loop}}","main_menu.basic":"Basic graphics","main_menu.basic_help":"Better performance.","main_menu.colorful_coins":"Colorful coins","main_menu.colorful_coins_help":"Coins always spawn of the color of the brick","main_menu.download_save_file":"Download score and stats","main_menu.download_save_file_help":"Get a save file","main_menu.footer_html":"

\\nMade in France by Renan LE CARO. \\nDonate\\nDiscord\\nF-Droid\\nGoogle Play\\nitch.io \\nGitlab\\nWeb version\\nHackerNews\\nPrivacy Policy\\nv.{{appVersion}}\\n

\\n","main_menu.fullscreen":"Fullscreen","main_menu.fullscreen_exit":"Exit Fullscreen","main_menu.fullscreen_exit_help":"Might not work on some machines","main_menu.fullscreen_help":"Might not work on some machines","main_menu.kid":"Kids mode","main_menu.kid_help":"Start future runs with \\"slower ball\\".","main_menu.language":"Language","main_menu.language_help":"Choose the game\'s language","main_menu.load_save_file":"Load save file","main_menu.load_save_file_help":"Select a save file on your device","main_menu.max_coins":" {{max}} coins on screen maximum","main_menu.max_coins_help":"Cosmetic only, no effect on score","main_menu.max_particles":" {{max}} particles maximum","main_menu.max_particles_help":"Limits the number of particles show on screen for visual effect. ","main_menu.mobile":"Mobile mode","main_menu.mobile_help":"Leaves space under the puck.","main_menu.normal":"New run","main_menu.normal_help":"Start a quick run with random starting perk","main_menu.pointer_lock":"Mouse pointer lock","main_menu.pointer_lock_help":"Locks and hides the mouse cursor.","main_menu.record":"Record gameplay videos","main_menu.record_download":"Download video ({{size}} MB)","main_menu.record_help":"Get a video of each level.","main_menu.reset":"Reset Game","main_menu.reset_cancel":"No","main_menu.reset_confirm":"Yes","main_menu.reset_help":"Erase high score, license and statistics","main_menu.reset_instruction":"You will loose all progress you made in the game, are you sure ?","main_menu.resume":"Resume","main_menu.resume_help":"Return to your run","main_menu.save_file_error":"Error loading save file","main_menu.save_file_loaded":"Save file loaded","main_menu.save_file_loaded_help":"The app will now reload to apply your save","main_menu.save_file_loaded_ok":"Ok","main_menu.settings_help":"Tailor the game play to your needs and taste","main_menu.settings_title":"Settings","main_menu.show_fps":"FPS counter","main_menu.show_fps_help":"Monitor the app\'s performance","main_menu.show_stats":"Show real time stats","main_menu.show_stats_help":"Coins, time, bounces, misses","main_menu.sounds":"Game sounds","main_menu.sounds_help":"Can slow down some phones.","main_menu.title":"Breakout 71","main_menu.unlocks":"Unlocked content","main_menu.unlocks_help":"Try perks and levels you unlocked","play.close_modale_window_tooltip":"close ","play.current_lvl":"Level {{level}}/{{max}}","play.current_lvl_loop":"Level {{level}}/{{max}} loop {{loop}}","play.menu_label":"menu","play.missed_ball":"miss","play.mobile_press_to_play":"Press and hold here to play","premium.back":"Back","premium.back_help":"Return to main menu","premium.buy":"Buy a license key","premium.buy_disabled_help":"Coming soon","premium.buy_help":"You\'ll be taken to a stripe form to pay and will receive the license by email. Come back to enter it here after.","premium.enter":"Enter license key","premium.enter_help":"Paste the license in the window that opens","premium.help":"Buy a license for Breakout 71 to unlock looping and support development. It costs 4.99\u20AC and lasts forever. You can use it on multiple devices, but please don\'t share it online. ","premium.help_google":"While I do plan to offer premium licenses through google play, I haven\'t gotten around it yet, so there\'s no buy link here. If you already have a license key, you can enter it below. ","premium.per_hours":"You\'ve played for {{hours}} hours","premium.per_hours_help":"Donate 4.99\u20AC to get premium","premium.thanks":"You are premium, thanks ! ","premium.thanks_help":"Copy your license key","premium.title":"Unlock looping with premium ","sandbox.help":"Test any perk combination","sandbox.instructions":"Select perks below and press \\"start run\\" to try them out in a test run. Scores and stats are not recorded.","sandbox.start":"Start test run","sandbox.title":"Sandbox mode","sandbox.unlocks_at":"Unlocks at total score {{score}}","score_panel.bebuffs_list":"De-buffs :","score_panel.test_run":"This is a test run, score is not recorded permanently","score_panel.title":"{{score}} points at level {{level}}/{{max}} ","score_panel.title_looped":"{{score}} points at level {{level}}/{{max}} of loop {{loop}}","score_panel.upcoming_levels":"Upcoming levels :","score_panel.upgrades_picked":"Upgrades picked so far : ","unlocks.greyed_out_help":"The greyed out ones can be unlocked by increasing your total score. The total score increases every time you score in game.","unlocks.intro":"Your total score is {{ts}}. Below are all the upgrades and levels the games has to offer.","unlocks.level_description":"A {{size}}x{{size}} level with {{bricks}} bricks","unlocks.title":"You unlocked {{percentUnlock}}% of the game.","unlocks.unlocks_at":"Unlocks at total score {{threshold}}.","upgrades.asceticism.fullHelp":"You\'ll need to store the coins somewhere while your combo climbs. ","upgrades.asceticism.help":"+1 combo / brick, com resets on coin catch","upgrades.asceticism.name":"Asceticism","upgrades.ball_attract_ball.fullHelp":"Balls that are more than half a screen width away will start attracting each other. \\n\\nThe attraction force is stronger when they are furthest away from each other.\\n\\nRainbow particles will fly to symbolize the attraction force. This perk is only offered if you have more than one ball already.","upgrades.ball_attract_ball.help":"Balls attract balls","upgrades.ball_attract_ball.help_plural":"Stronger attraction force","upgrades.ball_attract_ball.name":"Gravity","upgrades.ball_attracts_coins.fullHelp":"Don\'t ask me how that works","upgrades.ball_attracts_coins.help":"Balls attract coins","upgrades.ball_attracts_coins.name":"Fortunate ball","upgrades.ball_repulse_ball.fullHelp":"Balls that are less than half a screen width away will start repulsing each other. The repulsion force is stronger if they are close to each other. Particles will jet out to symbolize this force being applied. This perk is only offered if you have more than one ball already.","upgrades.ball_repulse_ball.help":"Balls repulse balls","upgrades.ball_repulse_ball.help_plural":"Stronger repulsion force","upgrades.ball_repulse_ball.name":"Personal space","upgrades.base_combo.fullHelp":"Your combo (number of coins per bricks) normally starts at 1 at the beginning of the level, and resets to one when you bounce around without hitting anything. With this perk, the combo starts 3 points higher, so you\'ll always get at least 4 coins per brick. Whenever your combo reset, it will go back to 4 and not 1. Your ball will glitter a bit to indicate that its combo is higher than one.","upgrades.base_combo.help":"Combo starts at {{coins}}.","upgrades.base_combo.name":"+3 base combo","upgrades.bigger_explosions.fullHelp":"The default explosion clears a 3x3 square, with this it becomes a 5x5 square, and the blow on the coins is also significantly stronger. The screen will flash after each explosion (except in basic mode)","upgrades.bigger_explosions.help":"Bigger explosions","upgrades.bigger_explosions.name":"Kaboom","upgrades.bigger_puck.fullHelp":"A bigger puck makes it easier to never miss the ball and to catch more coins, and also to precisely angle the bounces (the ball\'s angle only depends on where it hits the puck). \\n However, a large puck is harder to use around the sides of the level, and will make it sometimes unavoidable to miss (not hit anything) which comes with downsides. ","upgrades.bigger_puck.help":"Easily catch more coins.","upgrades.bigger_puck.name":"Bigger puck","upgrades.clairvoyant.fullHelp":"Helps you pick the right upgrades and understand what\'s going on with sturdy bricks. ","upgrades.clairvoyant.help":"See upcoming levels, bricks HP and ball direction","upgrades.clairvoyant.name":"Clairvoyant","upgrades.coin_magnet.fullHelp":"Directs the coins to the puck. The effect is stronger if the coin is close to it already. Catching 90% or 100% of coins bring special bonuses in the game. \\n\\nAnother way to catch more coins is to hit bricks from the bottom. The ball\'s speed and direction impacts the spawned coin\'s velocity. ","upgrades.coin_magnet.help":"Puck attracts coins","upgrades.coin_magnet.help_plural":"Stronger effect on the coins","upgrades.coin_magnet.name":"Coins magnet","upgrades.compound_interest.fullHelp":"Your combo will grow by one every time you break a brick, spawning more and more coin with every brick you break. \\n\\nBe sure however to catch every one of those coins with your puck, as any lost coin will reset your combo. \\n\\nOnce your combo is above the minimum, the bottom of the play area will have a red line to remind you that coins should not go there.\\n\\nThis perk combines with other combo perks, the combo will rise faster but reset more easily.","upgrades.compound_interest.help":"+1 combo per brick broken, resets on coin lost","upgrades.compound_interest.name":"Compound interest","upgrades.concave_puck.fullHelp":"Balls starts the level going straight up, and bounces with less angle.","upgrades.concave_puck.help":" Helps with aiming straight up","upgrades.concave_puck.name":"Concave puck","upgrades.corner_shot.fullHelp":"Helps with aiming in the corners","upgrades.corner_shot.help":"Lets your puck overlap with the borders of the screen","upgrades.corner_shot.name":"Corner shot","upgrades.etherealcoins.fullHelp":"You\'ll have to make sure that the coins fall down somehow","upgrades.etherealcoins.help":"Coins are no longer affected by gravity","upgrades.etherealcoins.name":"Coins, in Space","upgrades.extra_levels.fullHelp":"The default run can last a max of 7 levels, after which the game is over and whatever score you reached is your run score. \\n\\nEach level of this perk lets you go one level higher. The last levels are often the ones where you make the most score, so the difference can be dramatic.","upgrades.extra_levels.help":"Play {{count}} levels instead of 7","upgrades.extra_levels.name":"+1 level","upgrades.extra_life.fullHelp":"Normally, you have one ball per run, and the run is over as soon as you drop it.\\n\\nThis perk adds a white bar at the bottom of the screen that will save a ball once, and break in the process. \\n\\nYou\'ll loose one level of that perk every time a ball bounces at the bottom of the screen.","upgrades.extra_life.help":"The ball will bounce once on the bottom line before being lost.","upgrades.extra_life.help_plural":"The ball will bounce on the bottom {{lvl}} times before being lost.","upgrades.extra_life.name":"+1 life","upgrades.forgiving.fullHelp":"The first miss per level is free, then 10% of the combo, then 20% .. ","upgrades.forgiving.help":"Missing breaks reduces combo progressively instead of all at once.","upgrades.forgiving.name":"Forgiving","upgrades.ghost_coins.fullHelp":"It\'s not a bug, it\'s a feature ! ","upgrades.ghost_coins.help":"Coins pass through bricks","upgrades.ghost_coins.name":"Ghost coins","upgrades.helium.fullHelp":"This affects the coins and will let the float up until you are ready to pick them up.","upgrades.helium.help":"Gravity reversed left and right of puck","upgrades.helium.name":"Helium","upgrades.hot_start.fullHelp":"At the start of every level, your combo will start at +15 points, but then every second it will be decreased by one.\\n\\nThis means the first 15 seconds in a level will spawn many more coins than the following ones, and you should make sure that you clear the level quickly. \\n\\nThe effect stacks with other combo related perks, so you might be able to raise the combo after the 15s timeout, but it will keep ticking down. \\n\\nEvery time you take the perk again, the effect will be more dramatic.","upgrades.hot_start.help":"Start at combo {{start}}, -{{lvl}} combo per second","upgrades.hot_start.name":"Hot start","upgrades.implosions.fullHelp":"The explosion force is applied the other way. ","upgrades.implosions.help":"Explosions suck coins in instead of blowing them out","upgrades.implosions.name":"Implosions","upgrades.instant_upgrade.fullHelp":"Immediately pick two upgrades, so that you get one free one and one to repay the one used to get this perk. Every further menu to pick upgrades will have fewer options to choose from.","upgrades.instant_upgrade.help":"-1 choice until run end.","upgrades.instant_upgrade.name":"+2 upgrades now","upgrades.left_is_lava.fullHelp":"Whenever you break a brick, your combo will increase by one, so you\'ll get one more coin from all the next bricks you break.\\n\\nHowever, your combo will reset as soon as your ball hits the left side . \\n\\nAs soon as your combo rises, the left side becomes red to remind you that you should avoid hitting them. \\n\\nThe effect stacks with other combo perks, combo rises faster with more upgrades but will also reset if any of the reset conditions are met.","upgrades.left_is_lava.help":"+1 combo per brick broken, resets on left side hit","upgrades.left_is_lava.name":"Avoid left side","upgrades.metamorphosis.fullHelp":"With this perk, coins will be of the color of the brick they come from, and will color the first brick they touch in the same color. Coins spawn with the speed of the ball that broke them, which means you can aim a bit in the direction of the bricks you want to \\"paint\\".","upgrades.metamorphosis.help":"Coins stain the bricks they touch","upgrades.metamorphosis.name":"Metamorphosis","upgrades.multiball.fullHelp":"As soon as you drop the ball in Breakout 71, you loose. \\n\\nWith this perk, you get two balls, and so you can afford to lose one. \\n\\nThe lost balls come back on the next level. \\n\\nHaving more than one balls makes some further perks available, and of course clears the level faster.","upgrades.multiball.help":"Start every levels with {{count}} balls.","upgrades.multiball.name":"+1 ball","upgrades.nbricks.fullHelp":"You don\'t necessarily need to destroy those bricks, but you need to hit them. Bricks destroyed by explosions don\'t count","upgrades.nbricks.help":"Hit exactly {{lvl}} bricks per puck bounce for +{{lvl}} combo, otherwise it resets","upgrades.nbricks.name":"Strict sample size","upgrades.one_more_choice.fullHelp":"Every upgrade menu will have one more option. Doesn\'t increase the number of upgrades you can pick.","upgrades.one_more_choice.help":"Further level ups will offer one more option in the list","upgrades.one_more_choice.name":"+1 choice until run end","upgrades.passive_income.fullHelp":"Some perks can help the balls do what you want without needing to do anything.","upgrades.passive_income.help":"+{{lvl}} combo / brick, unless the puck moved in the last {{time}}s, then it resets instead","upgrades.passive_income.name":"Passive income","upgrades.picky_eater.fullHelp":"Whenever you break a brick the same color as your ball, your combo increases by one. \\nIf it\'s a different color, the ball takes that new color, but the combo resets.\\nThe bricks with the right color will get a white border. \\nOnce you get a combo higher than your minimum, the bricks of the wrong color will get a red halo. \\nIf you have more than one ball, they all change color whenever one of them hits a brick.","upgrades.picky_eater.help":"+1 combo per brick broken, resets on ball color change","upgrades.picky_eater.name":"Picky eater","upgrades.pierce.fullHelp":"The ball normally bounces as soon as it touches something. With this perk, it will continue its trajectory for up to 3 bricks broken. \\nAfter that, it will bounce on the 4th brick, and you\'ll need to touch the puck to reset the counter.","upgrades.pierce.help":"Ball pierces {{count}} bricks after a puck bounce","upgrades.pierce.name":"Piercing","upgrades.pierce_color.fullHelp":"Whenever a ball hits a brick of the same color, it will just go through unimpeded. \\nOnce it reaches a brick of a different color, it will break it, take its color and bounce.\\nIf you have sturdy bricks, the ball might still bounce off a brick of the same color.","upgrades.pierce_color.help":"+{{lvl}} damage to bricks of the ball\'s color","upgrades.pierce_color.name":"Color pierce","upgrades.puck_repulse_ball.fullHelp":"When a ball gets close to the puck, it will start slowing down, and even potentially bouncing without touching the puck.","upgrades.puck_repulse_ball.help":"Puck repulses balls","upgrades.puck_repulse_ball.help_plural":"Stronger repulsion force","upgrades.puck_repulse_ball.name":"Soft landing","upgrades.reach.fullHelp":"Try to lock the ball up to earn more combo","upgrades.reach.help":"+{{lvl}} combo / bricks , lowest brick of a pile resets combo","upgrades.reach.name":"Top down","upgrades.respawn.fullHelp":"After breaking two or more bricks, when the ball hits the puck, the first brick will be put back in place, provided that space is free and the brick wasn\'t a bomb.\\n\\nSome particle effect will let you know where bricks will appear. Leveling this up lets you re-spawn up to 4 bricks at a time, but there should always be at least one destroyed.","upgrades.respawn.help":"The first brick hit of two+ will re-spawn","upgrades.respawn.help_plural":"More bricks can re-spawn","upgrades.respawn.name":"Re-spawn","upgrades.right_is_lava.fullHelp":"Whenever you break a brick, your combo will increase by one, so you\'ll get one more coin from all the next bricks you break.\\n\\nHowever, your combo will reset as soon as your ball hits the right side . \\n\\nAs soon as your combo rises, the right side becomes red to remind you that you should avoid hitting them\\n\\nThe effect stacks with other combo perks, combo rises faster with more upgrades but will also reset if any\\nof the reset conditions are met.","upgrades.right_is_lava.help":"+1 combo per brick broken, resets on right side hit","upgrades.right_is_lava.name":"Avoid right side","upgrades.sacrifice.fullHelp":"This might get the combo pretty high","upgrades.sacrifice.help":"Loosing a life clears all bricks","upgrades.sacrifice.name":"Sacrifice","upgrades.sapper.fullHelp":"Instead of just disappearing, the first brick you break will be replaced by a bomb brick. \\n\\nBouncing the ball on the puck re-arms the effect. \\n\\nLeveling-up this perk will allow you to place more bombs.\\n\\nRemember that bombs impact the velocity of nearby coins, so too many explosions could make it hard to catch the fruits of your hard work.","upgrades.sapper.help":"The first brick broken becomes a bomb.","upgrades.sapper.help_plural":"The first {{lvl}} bricks broken become bombs.","upgrades.sapper.name":"Sapper","upgrades.shocks.fullHelp":"That would spice up the game of pool","upgrades.shocks.help":"Explosive balls collisions","upgrades.shocks.name":"Shocks","upgrades.shunt.fullHelp":"If you also have hot start, the hot start is just added to the current combo","upgrades.shunt.help":"Keep {{percent}}% of your combo between levels","upgrades.shunt.name":"Shunt","upgrades.side_kick.fullHelp":"When a brick get hit, the game checks the ball\'s velocity, and add +1 to the combo if its horizontal velocity is higher than its vertical velocity. The combo will decrease by one otherwise. The location of the impact on the brick is irrelevant. ","upgrades.side_kick.help":"+{{lvl}} combo per brick broken horizontally, -{{lvl}} otherwise","upgrades.side_kick.name":"Side kick","upgrades.skip_last.fullHelp":"You need to break all bricks to go to the next level. However, it can be hard to get the last ones. \\n\\nClearing a level early brings extra choices when upgrading. Never missing the bricks is also very beneficial. \\n\\nSo if you find it difficult to break the last bricks, getting this perk a few time can help.","upgrades.skip_last.help":"The last brick will explode.","upgrades.skip_last.help_plural":"The last {{lvl}} bricks will explode.","upgrades.skip_last.name":"Easy Cleanup","upgrades.slow_down.fullHelp":"The ball starts relatively slow, but every level of your run it will start a bit faster. \\n\\nIt will also accelerate if you spend a lot of time in one level. \\n\\nThis perk makes it more manageable. \\n\\nYou can get it at the start every time by enabling kid mode in the menu.","upgrades.slow_down.help":"Ball moves more slowly","upgrades.slow_down.name":"Slower ball","upgrades.smaller_puck.fullHelp":"This makes the puck smaller, which in theory makes some corner shots easier, but really just raises the difficulty.\\n\\nThat\'s why you also get a nice bonus of +5 coins per brick for all bricks you\'ll break after picking this. ","upgrades.smaller_puck.help":"Also gives +5 base combo","upgrades.smaller_puck.help_plural":"Even smaller puck and higher base combo","upgrades.smaller_puck.name":"Smaller puck","upgrades.soft_reset.fullHelp":"Limit the impact of a combo reset.","upgrades.soft_reset.help":"Combo resets keeps {{percent}}%","upgrades.soft_reset.name":"Soft reset","upgrades.streak_shots.fullHelp":"Every time you break a brick, your combo (number of coins per bricks) increases by one. \\n\\nHowever, as soon as the ball touches your puck, the combo is reset to its default value, and you\'ll just get one coin per brick.\\n\\nOnce your combo rises above the base value, your puck will become red to remind you that it will destroy your combo to touch it with the ball.\\n\\nThis can stack with other combo related perks, the combo will rise faster but reset more easily as any of the conditions is enough to reset it. ","upgrades.streak_shots.help":"More coins if you break many bricks at once.","upgrades.streak_shots.name":"Single puck hit streak","upgrades.sturdy_bricks.fullHelp":"With level one of this perk, the ball has a 20% chance to bounce harmlessly on bricks, \\n but generates 10% more coins when it does break one. \\n This +10% is not shown in the combo number. At level 4 the ball has 80% chance of bouncing and brings 40% more coins.","upgrades.sturdy_bricks.help":"Bricks sometimes resist hits but drop more coins.","upgrades.sturdy_bricks.help_plural":"Bricks resist more and drop more coins","upgrades.sturdy_bricks.name":"Sturdy bricks","upgrades.telekinesis.fullHelp":"Right after the ball hits your puck, you\'ll be able to direct it left and right by moving your puck. \\n\\n\\nThe effect stops when the ball hits a brick and resets the next time it touches the puck. It also does nothing when the ball is going downward after bouncing at the top.","upgrades.telekinesis.help":"Puck controls the ball\'s trajectory","upgrades.telekinesis.help_plural":"Stronger effect on the ball","upgrades.telekinesis.name":"Telekinesis","upgrades.top_is_lava.fullHelp":"Whenever you break a brick, your combo will increase by one. However, your combo will reset as soon as your ball hit the top of the screen. \\n\\nWhen your combo is above the minimum, a red bar will appear at the top to remind you that you should avoid hitting it. \\n\\nThe effect stacks with other combo perks.","upgrades.top_is_lava.help":"More coins if you don\'t touch the top.","upgrades.top_is_lava.name":"Sky is the limit","upgrades.trampoline.fullHelp":"One of the rare combo upgrades that don\'t add a reset condition","upgrades.trampoline.help":"+{{lvl}} combo per puck bounce,-{{lvl}} combo per ceiling bounce","upgrades.trampoline.name":"Trampoline","upgrades.unbounded.fullHelp":"I hope you\'ve found a way to keep your ball on screen","upgrades.unbounded.help":"+1 combo per brick, no more sides to keep the ball in game, danger","upgrades.unbounded.name":"Unbounded","upgrades.viscosity.fullHelp":"Coins normally accelerate with gravity and explosions to pretty high speeds. \\n\\nThis perk constantly makes them slow down, as if they were in some sort of viscous liquid. \\n\\nThis makes catching them easier, and combines nicely with perks that influence the coin\'s movement.","upgrades.viscosity.help":"Slower coin fall","upgrades.viscosity.name":"Viscosity","upgrades.wind.fullHelp":"The wind depends on where your puck is, if it\'s in the center of the screen nothing happens, if it\'s on the left it will blow left-wise, if it\'s on the right of the screen then it will blow right-wise. \\n\\nThe wind affects both the balls and coins.","upgrades.wind.help":"Puck position creates wind","upgrades.wind.help_plural":"Stronger wind force","upgrades.wind.name":"Wind","upgrades.yoyo.fullHelp":"It\'s the opposite of telekinesis","upgrades.yoyo.help":"Ball falls toward puck","upgrades.yoyo.name":"Yo-yo","upgrades.zen.fullHelp":"After all, this is a non-violent game","upgrades.zen.help":"+1 combo per bricks, reset when there\'s an explosion","upgrades.zen.name":"Zen"}'); +module.exports = JSON.parse('{"confirmRestart.no":"Cancel","confirmRestart.text":"You\'re about to start a new run, is that really what you wanted ?","confirmRestart.title":"Start a new run ?","confirmRestart.yes":"Restart game","debuffs.banned.description":"{{lvl}} banned perk(s) : {{banned}}.","debuffs.banned.help":"{{perk}} is banned for this run.","debuffs.fragility.help":"Explosions destroy {{percent}} of coins and reset combo.","debuffs.interference.help":"Telekinesis and yo-yo glitch for {{lvl}}s every 7s.","debuffs.more_bombs.help":"{{lvl}} bricks replaced by bombs.","debuffs.negative_coins.help":"{{lvl}}/10000 of coins spawn cursed, blinking red. Game over if you catch them.","debuffs.sturdiness.help":"All bricks have +{{lvl}} HP","gameOver.because_cursed_coin":"Game over","gameOver.because_cursed_coin_intro":"You cough a cursed coin (bright red coins) and didn\'t have a extra life to spare. ","gameOver.cumulative_total":"Your total cumulative score went from {{startTs}} to {{endTs}}.","gameOver.lost.summary":"You dropped the ball after catching {{score}} coins.","gameOver.lost.title":"Game Over","gameOver.next_unlock":"Score {{points}} more points to reach the next unlock","gameOver.restart":"Start a new run","gameOver.stats.balls_lost":"Balls lost","gameOver.stats.bricks_broken":"Bricks broken","gameOver.stats.bricks_per_minute":"Bricks broken per minute","gameOver.stats.catch_rate":"Catch rate","gameOver.stats.combo_avg":"Average combo","gameOver.stats.combo_max":"Max combo","gameOver.stats.duration_per_level":"Duration per level","gameOver.stats.hit_rate":"Hit rate","gameOver.stats.intro":"Find below your run statistics compared to your {{count}} best runs.","gameOver.stats.level_reached":"Level reached","gameOver.stats.loops":"Loops","gameOver.stats.total_score":"Total score","gameOver.stats.upgrades_applied":"Upgrades applied","gameOver.test_run":"This test run and its score are not being recorded","gameOver.unlocked_count":"You unlocked {{count}} item(s) :","gameOver.upgrades_picked":"Upgrades active at the end of the run","gameOver.win.summary":"You cleared all levels for this run, catching {{score}} coins in total.","gameOver.win.title":"Run finished","level_up.after_buttons":"You just finished level {{level}}/{{max}} and picked those upgrades so far :","level_up.before_buttons":"You caught {{score}} coins {{catchGain}} out of {{levelSpawnedCoins}} in {{time}} seconds {{timeGain}}.\\n\\nYou missed {{levelMisses}} times {{missesGain}} and hit the walls or ceiling {{levelWallBounces}} times{{wallHitsGain}}.\\n\\n{{compliment}}","level_up.compliment_advice":"Try to catch all coins, never miss the bricks, never hit the walls/ceiling or clear the level under 30s to gain additional choices and upgrades.","level_up.compliment_good":"Well done !","level_up.compliment_perfect":"Impressive, keep it up !","level_up.pick_upgrade_title":"Pick an upgrade","level_up.plus_one_choice":"(+1 re-roll)","level_up.plus_one_upgrade":"(+1 upgrade and +1 re-roll)","level_up.reroll":"Re-roll ({{count}})","level_up.reroll_help":"Offer new choices","level_up.unlocked_level":" (Level)","level_up.unlocked_perk":" (Perk)","level_up.upgrade_perk_to_level":" lvl {{level}}","loop.converted_rerolls":"Your {{n}} leftover re-rolls where converted to +{{n}} base combo.","loop.instructions":"All your perks will be erased except one that you can pick below. Each option comes with an additional hazard will appear on all levels going forward. ","loop.no_rerolls":"You didn\'t have any leftover re-rolls, so your base combo stayed the same. ","loop.title":"Starting loop {{loop}}","main_menu.basic":"Basic graphics","main_menu.basic_help":"Better performance.","main_menu.colorful_coins":"Colorful coins","main_menu.colorful_coins_help":"Coins always spawn of the color of the brick","main_menu.download_save_file":"Download score and stats","main_menu.download_save_file_help":"Get a save file","main_menu.footer_html":"

\\nMade in France by Renan LE CARO. \\nDonate\\nDiscord\\nF-Droid\\nGoogle Play\\nitch.io \\nGitlab\\nWeb version\\nHackerNews\\nPrivacy Policy\\nv.{{appVersion}}\\n

\\n","main_menu.fullscreen":"Fullscreen","main_menu.fullscreen_exit":"Exit Fullscreen","main_menu.fullscreen_exit_help":"Might not work on some machines","main_menu.fullscreen_help":"Might not work on some machines","main_menu.kid":"Kids mode","main_menu.kid_help":"Start future runs with \\"slower ball\\".","main_menu.language":"Language","main_menu.language_help":"Choose the game\'s language","main_menu.load_save_file":"Load save file","main_menu.load_save_file_help":"Select a save file on your device","main_menu.max_coins":" {{max}} coins on screen maximum","main_menu.max_coins_help":"Cosmetic only, no effect on score","main_menu.max_particles":" {{max}} particles maximum","main_menu.max_particles_help":"Limits the number of particles show on screen for visual effect. ","main_menu.mobile":"Mobile mode","main_menu.mobile_help":"Leaves space under the puck.","main_menu.normal":"New run","main_menu.normal_help":"Start a quick run with random starting perk","main_menu.pointer_lock":"Mouse pointer lock","main_menu.pointer_lock_help":"Locks and hides the mouse cursor.","main_menu.record":"Record gameplay videos","main_menu.record_download":"Download video ({{size}} MB)","main_menu.record_help":"Get a video of each level.","main_menu.reset":"Reset Game","main_menu.reset_cancel":"No","main_menu.reset_confirm":"Yes","main_menu.reset_help":"Erase high score, license and statistics","main_menu.reset_instruction":"You will loose all progress you made in the game, are you sure ?","main_menu.resume":"Resume","main_menu.resume_help":"Return to your run","main_menu.save_file_error":"Error loading save file","main_menu.save_file_loaded":"Save file loaded","main_menu.save_file_loaded_help":"The app will now reload to apply your save","main_menu.save_file_loaded_ok":"Ok","main_menu.settings_help":"Tailor the game play to your needs and taste","main_menu.settings_title":"Settings","main_menu.show_fps":"FPS counter","main_menu.show_fps_help":"Monitor the app\'s performance","main_menu.show_stats":"Show real time stats","main_menu.show_stats_help":"Coins, time, bounces, misses","main_menu.sounds":"Game sounds","main_menu.sounds_help":"Can slow down some phones.","main_menu.title":"Breakout 71","main_menu.unlocks":"Unlocked content","main_menu.unlocks_help":"Try perks and levels you unlocked","play.close_modale_window_tooltip":"close ","play.current_lvl":"Level {{level}}/{{max}}","play.current_lvl_loop":"Level {{level}}/{{max}} loop {{loop}}","play.menu_label":"menu","play.missed_ball":"miss","play.mobile_press_to_play":"Press and hold here to play","premium.back":"Back","premium.back_help":"Return to main menu","premium.buy":"Buy a license key","premium.buy_disabled_help":"Coming soon","premium.buy_help":"You\'ll be taken to a stripe form to pay and will receive the license by email. Come back to enter it here after.","premium.enter":"Enter license key","premium.enter_help":"Paste the license in the window that opens","premium.help":"Buy a license for Breakout 71 to unlock looping and support development. It costs 4.99\u20AC and lasts forever. You can use it on multiple devices, but please don\'t share it online. ","premium.help_google":"While I do plan to offer premium licenses through google play, I haven\'t gotten around it yet, so there\'s no buy link here. If you already have a license key, you can enter it below. ","premium.per_hours":"You\'ve played for {{hours}} hours","premium.per_hours_help":"Donate 4.99\u20AC to get premium","premium.thanks":"You are premium, thanks ! ","premium.thanks_help":"Copy your license key","premium.title":"Unlock looping with premium ","sandbox.help":"Test any perk combination","sandbox.instructions":"Select perks below and press \\"start run\\" to try them out in a test run. Scores and stats are not recorded.","sandbox.start":"Start test run","sandbox.title":"Sandbox mode","sandbox.unlocks_at":"Unlocks at total score {{score}}","score_panel.bebuffs_list":"De-buffs :","score_panel.test_run":"This is a test run, score is not recorded permanently","score_panel.title":"{{score}} points at level {{level}}/{{max}} ","score_panel.title_looped":"{{score}} points at level {{level}}/{{max}} of loop {{loop}}","score_panel.upcoming_levels":"Upcoming levels :","score_panel.upgrades_picked":"Upgrades picked so far : ","unlocks.greyed_out_help":"The greyed out ones can be unlocked by increasing your total score. The total score increases every time you score in game.","unlocks.intro":"Your total score is {{ts}}. Below are all the upgrades and levels the games has to offer.","unlocks.level_description":"A {{size}}x{{size}} level with {{bricks}} bricks","unlocks.title":"You unlocked {{percentUnlock}}% of the game.","unlocks.unlocks_at":"Unlocks at total score {{threshold}}.","upgrades.asceticism.fullHelp":"You\'ll need to store the coins somewhere while your combo climbs. ","upgrades.asceticism.help":"+1 combo / brick, com resets on coin catch","upgrades.asceticism.name":"Asceticism","upgrades.ball_attract_ball.fullHelp":"Balls that are more than half a screen width away will start attracting each other. \\n\\nThe attraction force is stronger when they are furthest away from each other.\\n\\nRainbow particles will fly to symbolize the attraction force. This perk is only offered if you have more than one ball already.","upgrades.ball_attract_ball.help":"Balls attract balls","upgrades.ball_attract_ball.help_plural":"Stronger attraction force","upgrades.ball_attract_ball.name":"Gravity","upgrades.ball_attracts_coins.fullHelp":"Don\'t ask me how that works","upgrades.ball_attracts_coins.help":"Balls attract coins","upgrades.ball_attracts_coins.name":"Fortunate ball","upgrades.ball_repulse_ball.fullHelp":"Balls that are less than half a screen width away will start repulsing each other. The repulsion force is stronger if they are close to each other. Particles will jet out to symbolize this force being applied. This perk is only offered if you have more than one ball already.","upgrades.ball_repulse_ball.help":"Balls repulse balls","upgrades.ball_repulse_ball.help_plural":"Stronger repulsion force","upgrades.ball_repulse_ball.name":"Personal space","upgrades.base_combo.fullHelp":"Your combo (number of coins per bricks) normally starts at 1 at the beginning of the level, and resets to one when you bounce around without hitting anything. With this perk, the combo starts 3 points higher, so you\'ll always get at least 4 coins per brick. Whenever your combo reset, it will go back to 4 and not 1. Your ball will glitter a bit to indicate that its combo is higher than one.","upgrades.base_combo.help":"Combo starts at {{coins}}.","upgrades.base_combo.name":"+3 base combo","upgrades.bigger_explosions.fullHelp":"The default explosion clears a 3x3 square, with this it becomes a 5x5 square, and the blow on the coins is also significantly stronger. The screen will flash after each explosion (except in basic mode)","upgrades.bigger_explosions.help":"Bigger explosions","upgrades.bigger_explosions.name":"Kaboom","upgrades.bigger_puck.fullHelp":"A bigger puck makes it easier to never miss the ball and to catch more coins, and also to precisely angle the bounces (the ball\'s angle only depends on where it hits the puck). \\n However, a large puck is harder to use around the sides of the level, and will make it sometimes unavoidable to miss (not hit anything) which comes with downsides. ","upgrades.bigger_puck.help":"Easily catch more coins.","upgrades.bigger_puck.name":"Bigger puck","upgrades.clairvoyant.fullHelp":"Helps you pick the right upgrades and understand what\'s going on with sturdy bricks. ","upgrades.clairvoyant.help":"See upcoming levels, bricks HP and ball direction","upgrades.clairvoyant.name":"Clairvoyant","upgrades.coin_magnet.fullHelp":"Directs the coins to the puck. The effect is stronger if the coin is close to it already. Catching 90% or 100% of coins bring special bonuses in the game. \\n\\nAnother way to catch more coins is to hit bricks from the bottom. The ball\'s speed and direction impacts the spawned coin\'s velocity. ","upgrades.coin_magnet.help":"Puck attracts coins","upgrades.coin_magnet.help_plural":"Stronger effect on the coins","upgrades.coin_magnet.name":"Coins magnet","upgrades.compound_interest.fullHelp":"Your combo will grow by one every time you break a brick, spawning more and more coin with every brick you break. \\n\\nBe sure however to catch every one of those coins with your puck, as any lost coin will reset your combo. \\n\\nOnce your combo is above the minimum, the bottom of the play area will have a red line to remind you that coins should not go there.\\n\\nThis perk combines with other combo perks, the combo will rise faster but reset more easily.","upgrades.compound_interest.help":"+1 combo per brick broken, resets on coin lost","upgrades.compound_interest.name":"Compound interest","upgrades.concave_puck.fullHelp":"Balls starts the level going straight up, and bounces with less angle.","upgrades.concave_puck.help":" Helps with aiming straight up","upgrades.concave_puck.name":"Concave puck","upgrades.corner_shot.fullHelp":"Helps with aiming in the corners","upgrades.corner_shot.help":"Lets your puck overlap with the borders of the screen","upgrades.corner_shot.name":"Corner shot","upgrades.etherealcoins.fullHelp":"You\'ll have to make sure that the coins fall down somehow","upgrades.etherealcoins.help":"Coins are no longer affected by gravity","upgrades.etherealcoins.name":"Coins, in Space","upgrades.extra_levels.fullHelp":"The default run can last a max of 7 levels, after which the game is over and whatever score you reached is your run score. \\n\\nEach level of this perk lets you go one level higher. The last levels are often the ones where you make the most score, so the difference can be dramatic.","upgrades.extra_levels.help":"Play {{count}} levels instead of 7","upgrades.extra_levels.name":"+1 level","upgrades.extra_life.fullHelp":"Normally, you have one ball per run, and the run is over as soon as you drop it.\\n\\nThis perk adds a white bar at the bottom of the screen that will save a ball once, and break in the process. \\n\\nYou\'ll loose one level of that perk every time a ball bounces at the bottom of the screen.","upgrades.extra_life.help":"The ball will bounce once on the bottom line before being lost.","upgrades.extra_life.help_plural":"The ball will bounce on the bottom {{lvl}} times before being lost.","upgrades.extra_life.name":"+1 life","upgrades.forgiving.fullHelp":"The first miss per level is free, then 10% of the combo, then 20% .. ","upgrades.forgiving.help":"Missing breaks reduces combo progressively instead of all at once.","upgrades.forgiving.name":"Forgiving","upgrades.ghost_coins.fullHelp":"It\'s not a bug, it\'s a feature ! ","upgrades.ghost_coins.help":"Coins pass through bricks","upgrades.ghost_coins.name":"Ghost coins","upgrades.helium.fullHelp":"This affects the coins and will let the float up until you are ready to pick them up.","upgrades.helium.help":"Gravity reversed left and right of puck","upgrades.helium.name":"Helium","upgrades.hot_start.fullHelp":"At the start of every level, your combo will start at +15 points, but then every second it will be decreased by one.\\n\\nThis means the first 15 seconds in a level will spawn many more coins than the following ones, and you should make sure that you clear the level quickly. \\n\\nThe effect stacks with other combo related perks, so you might be able to raise the combo after the 15s timeout, but it will keep ticking down. \\n\\nEvery time you take the perk again, the effect will be more dramatic.","upgrades.hot_start.help":"Start at combo {{start}}, -{{lvl}} combo per second","upgrades.hot_start.name":"Hot start","upgrades.implosions.fullHelp":"The explosion force is applied the other way. ","upgrades.implosions.help":"Explosions suck coins in instead of blowing them out","upgrades.implosions.name":"Implosions","upgrades.instant_upgrade.fullHelp":"Immediately pick two upgrades, so that you get one free one and one to repay the one used to get this perk. Every further menu to pick upgrades will have fewer options to choose from.","upgrades.instant_upgrade.help":"-1 choice until run end.","upgrades.instant_upgrade.name":"+2 upgrades now","upgrades.left_is_lava.fullHelp":"Whenever you break a brick, your combo will increase by one, so you\'ll get one more coin from all the next bricks you break.\\n\\nHowever, your combo will reset as soon as your ball hits the left side . \\n\\nAs soon as your combo rises, the left side becomes red to remind you that you should avoid hitting them. \\n\\nThe effect stacks with other combo perks, combo rises faster with more upgrades but will also reset if any of the reset conditions are met.","upgrades.left_is_lava.help":"+1 combo per brick broken, resets on left side hit","upgrades.left_is_lava.name":"Avoid left side","upgrades.metamorphosis.fullHelp":"With this perk, coins will be of the color of the brick they come from, and will color the first brick they touch in the same color. Coins spawn with the speed of the ball that broke them, which means you can aim a bit in the direction of the bricks you want to \\"paint\\".","upgrades.metamorphosis.help":"Coins stain the bricks they touch","upgrades.metamorphosis.name":"Metamorphosis","upgrades.multiball.fullHelp":"As soon as you drop the ball in Breakout 71, you loose. \\n\\nWith this perk, you get two balls, and so you can afford to lose one. \\n\\nThe lost balls come back on the next level. \\n\\nHaving more than one balls makes some further perks available, and of course clears the level faster.","upgrades.multiball.help":"Start every levels with {{count}} balls.","upgrades.multiball.name":"+1 ball","upgrades.nbricks.fullHelp":"You don\'t necessarily need to destroy those bricks, but you need to hit them. Bricks destroyed by explosions don\'t count","upgrades.nbricks.help":"Hit exactly {{lvl}} bricks per puck bounce for +{{lvl}} combo, otherwise it resets","upgrades.nbricks.name":"Strict sample size","upgrades.one_more_choice.fullHelp":"Every upgrade menu will have one more option. Doesn\'t increase the number of upgrades you can pick.","upgrades.one_more_choice.help":"Further level ups will offer one more option in the list","upgrades.one_more_choice.name":"+1 choice until run end","upgrades.passive_income.fullHelp":"Some perks can help the balls do what you want without needing to do anything.","upgrades.passive_income.help":"+{{lvl}} combo / brick, unless the puck moved in the last {{time}}s, then it resets instead","upgrades.passive_income.name":"Passive income","upgrades.picky_eater.fullHelp":"Whenever you break a brick the same color as your ball, your combo increases by one. \\nIf it\'s a different color, the ball takes that new color, but the combo resets.\\nThe bricks with the right color will get a white border. \\nOnce you get a combo higher than your minimum, the bricks of the wrong color will get a red halo. \\nIf you have more than one ball, they all change color whenever one of them hits a brick.","upgrades.picky_eater.help":"+1 combo per brick broken, resets on ball color change","upgrades.picky_eater.name":"Picky eater","upgrades.pierce.fullHelp":"The ball normally bounces as soon as it touches something. With this perk, it will continue its trajectory for up to 3 bricks broken. \\nAfter that, it will bounce on the 4th brick, and you\'ll need to touch the puck to reset the counter.","upgrades.pierce.help":"Ball pierces {{count}} bricks after a puck bounce","upgrades.pierce.name":"Piercing","upgrades.pierce_color.fullHelp":"Whenever a ball hits a brick of the same color, it will just go through unimpeded. \\nOnce it reaches a brick of a different color, it will break it, take its color and bounce.\\nIf you have sturdy bricks, the ball might still bounce off a brick of the same color.","upgrades.pierce_color.help":"+{{lvl}} damage to bricks of the ball\'s color","upgrades.pierce_color.name":"Color pierce","upgrades.puck_repulse_ball.fullHelp":"When a ball gets close to the puck, it will start slowing down, and even potentially bouncing without touching the puck.","upgrades.puck_repulse_ball.help":"Puck repulses balls","upgrades.puck_repulse_ball.help_plural":"Stronger repulsion force","upgrades.puck_repulse_ball.name":"Soft landing","upgrades.reach.fullHelp":"Try to lock the ball up to earn more combo","upgrades.reach.help":"+{{lvl}} combo / bricks , lowest brick of a pile resets combo","upgrades.reach.name":"Top down","upgrades.respawn.fullHelp":"After breaking two or more bricks, when the ball hits the puck, the first brick will be put back in place, provided that space is free and the brick wasn\'t a bomb.\\n\\nSome particle effect will let you know where bricks will appear. Leveling this up lets you re-spawn up to 4 bricks at a time, but there should always be at least one destroyed.","upgrades.respawn.help":"The first brick hit of two+ will re-spawn","upgrades.respawn.help_plural":"More bricks can re-spawn","upgrades.respawn.name":"Re-spawn","upgrades.right_is_lava.fullHelp":"Whenever you break a brick, your combo will increase by one, so you\'ll get one more coin from all the next bricks you break.\\n\\nHowever, your combo will reset as soon as your ball hits the right side . \\n\\nAs soon as your combo rises, the right side becomes red to remind you that you should avoid hitting them\\n\\nThe effect stacks with other combo perks, combo rises faster with more upgrades but will also reset if any\\nof the reset conditions are met.","upgrades.right_is_lava.help":"+1 combo per brick broken, resets on right side hit","upgrades.right_is_lava.name":"Avoid right side","upgrades.sacrifice.fullHelp":"This might get the combo pretty high","upgrades.sacrifice.help":"Loosing a life clears all bricks","upgrades.sacrifice.name":"Sacrifice","upgrades.sapper.fullHelp":"Instead of just disappearing, the first brick you break will be replaced by a bomb brick. \\n\\nBouncing the ball on the puck re-arms the effect. \\n\\nLeveling-up this perk will allow you to place more bombs.\\n\\nRemember that bombs impact the velocity of nearby coins, so too many explosions could make it hard to catch the fruits of your hard work.","upgrades.sapper.help":"The first brick broken becomes a bomb.","upgrades.sapper.help_plural":"The first {{lvl}} bricks broken become bombs.","upgrades.sapper.name":"Sapper","upgrades.shocks.fullHelp":"That would spice up the game of pool","upgrades.shocks.help":"Explosive balls collisions","upgrades.shocks.name":"Shocks","upgrades.shunt.fullHelp":"If you also have hot start, the hot start is just added to the current combo","upgrades.shunt.help":"Keep {{percent}}% of your combo between levels","upgrades.shunt.name":"Shunt","upgrades.side_kick.fullHelp":"When a brick get hit, the game checks the ball\'s velocity, and add +1 to the combo if its horizontal velocity is higher than its vertical velocity. The combo will decrease by one otherwise. The location of the impact on the brick is irrelevant. ","upgrades.side_kick.help":"+{{lvl}} combo per brick broken horizontally, -{{lvl}} otherwise","upgrades.side_kick.name":"Side kick","upgrades.skip_last.fullHelp":"You need to break all bricks to go to the next level. However, it can be hard to get the last ones. \\n\\nClearing a level early brings extra choices when upgrading. Never missing the bricks is also very beneficial. \\n\\nSo if you find it difficult to break the last bricks, getting this perk a few time can help.","upgrades.skip_last.help":"The last brick will explode.","upgrades.skip_last.help_plural":"The last {{lvl}} bricks will explode.","upgrades.skip_last.name":"Easy Cleanup","upgrades.slow_down.fullHelp":"The ball starts relatively slow, but every level of your run it will start a bit faster. \\n\\nIt will also accelerate if you spend a lot of time in one level. \\n\\nThis perk makes it more manageable. \\n\\nYou can get it at the start every time by enabling kid mode in the menu.","upgrades.slow_down.help":"Ball moves more slowly","upgrades.slow_down.name":"Slower ball","upgrades.smaller_puck.fullHelp":"This makes the puck smaller, which in theory makes some corner shots easier, but really just raises the difficulty.\\n\\nThat\'s why you also get a nice bonus of +5 coins per brick for all bricks you\'ll break after picking this. ","upgrades.smaller_puck.help":"Also gives +5 base combo","upgrades.smaller_puck.help_plural":"Even smaller puck and higher base combo","upgrades.smaller_puck.name":"Smaller puck","upgrades.soft_reset.fullHelp":"Limit the impact of a combo reset.","upgrades.soft_reset.help":"Combo resets keeps {{percent}}%","upgrades.soft_reset.name":"Soft reset","upgrades.streak_shots.fullHelp":"Every time you break a brick, your combo (number of coins per bricks) increases by one. \\n\\nHowever, as soon as the ball touches your puck, the combo is reset to its default value, and you\'ll just get one coin per brick.\\n\\nOnce your combo rises above the base value, your puck will become red to remind you that it will destroy your combo to touch it with the ball.\\n\\nThis can stack with other combo related perks, the combo will rise faster but reset more easily as any of the conditions is enough to reset it. ","upgrades.streak_shots.help":"More coins if you break many bricks at once.","upgrades.streak_shots.name":"Single puck hit streak","upgrades.sturdy_bricks.fullHelp":"With level one of this perk, the ball has a 20% chance to bounce harmlessly on bricks, \\n but generates 10% more coins when it does break one. \\n This +10% is not shown in the combo number. At level 4 the ball has 80% chance of bouncing and brings 40% more coins.","upgrades.sturdy_bricks.help":"Bricks sometimes resist hits but drop more coins.","upgrades.sturdy_bricks.help_plural":"Bricks resist more and drop more coins","upgrades.sturdy_bricks.name":"Sturdy bricks","upgrades.telekinesis.fullHelp":"Right after the ball hits your puck, you\'ll be able to direct it left and right by moving your puck. \\n\\n\\nThe effect stops when the ball hits a brick and resets the next time it touches the puck. It also does nothing when the ball is going downward after bouncing at the top.","upgrades.telekinesis.help":"Puck controls the ball\'s trajectory","upgrades.telekinesis.help_plural":"Stronger effect on the ball","upgrades.telekinesis.name":"Telekinesis","upgrades.top_is_lava.fullHelp":"Whenever you break a brick, your combo will increase by one. However, your combo will reset as soon as your ball hit the top of the screen. \\n\\nWhen your combo is above the minimum, a red bar will appear at the top to remind you that you should avoid hitting it. \\n\\nThe effect stacks with other combo perks.","upgrades.top_is_lava.help":"More coins if you don\'t touch the top.","upgrades.top_is_lava.name":"Sky is the limit","upgrades.trampoline.fullHelp":"One of the rare combo upgrades that don\'t add a reset condition","upgrades.trampoline.help":"+{{lvl}} combo per puck bounce,-{{lvl}} combo per ceiling bounce","upgrades.trampoline.name":"Trampoline","upgrades.unbounded.fullHelp":"I hope you\'ve found a way to keep your ball on screen","upgrades.unbounded.help":"+1 combo per brick, no more sides to keep the ball in game, danger","upgrades.unbounded.name":"Unbounded","upgrades.viscosity.fullHelp":"Coins normally accelerate with gravity and explosions to pretty high speeds. \\n\\nThis perk constantly makes them slow down, as if they were in some sort of viscous liquid. \\n\\nThis makes catching them easier, and combines nicely with perks that influence the coin\'s movement.","upgrades.viscosity.help":"Slower coin fall","upgrades.viscosity.name":"Viscosity","upgrades.wind.fullHelp":"The wind depends on where your puck is, if it\'s in the center of the screen nothing happens, if it\'s on the left it will blow left-wise, if it\'s on the right of the screen then it will blow right-wise. \\n\\nThe wind affects both the balls and coins.","upgrades.wind.help":"Puck position creates wind","upgrades.wind.help_plural":"Stronger wind force","upgrades.wind.name":"Wind","upgrades.yoyo.fullHelp":"It\'s the opposite of telekinesis","upgrades.yoyo.help":"Ball falls toward puck","upgrades.yoyo.name":"Yo-yo","upgrades.zen.fullHelp":"After all, this is a non-violent game","upgrades.zen.help":"+1 combo per bricks, reset when there\'s an explosion","upgrades.zen.name":"Zen"}'); },{}],"5blfu":[function(require,module,exports,__globalThis) { // Settings @@ -2432,8 +2433,8 @@ function pickedUpgradesHTMl(gameState) { return `

${(0, _i18N.t)("score_panel.upgrades_picked")}

${list}

`; } function debuffsHTMl(gameState) { - const banned = (0, _loadGameData.upgrades).filter((u)=>gameState.bannedPerks[u.id]).map((u)=>u.name).join(', '); - let list = (0, _debuffs.debuffs).filter((d)=>gameState.debuffs[d.id]).map((d)=>d.name(gameState.debuffs[d.id], banned)).join(' '); + const banned = (0, _loadGameData.upgrades).filter((u)=>gameState.bannedPerks[u.id]).map((u)=>u.name).join(", "); + let list = (0, _debuffs.debuffs).filter((d)=>gameState.debuffs[d.id]).map((d)=>d.name(gameState.debuffs[d.id], banned)).join(" "); if (!list) return ""; return `

${(0, _i18N.t)("score_panel.bebuffs_list")} ${list}

`; } @@ -2586,6 +2587,16 @@ const debuffs = [ help: (lvl)=>(0, _i18N.t)("debuffs.fragility.help", { percent: lvl * 20 }) + }, + { + id: "sturdiness", + max: 5, + name: (lvl)=>(0, _i18N.t)("debuffs.sturdiness.help", { + lvl + }), + help: (lvl)=>(0, _i18N.t)("debuffs.sturdiness.help", { + lvl + }) } ]; /* Possible challenges : @@ -2740,7 +2751,7 @@ function normalizeGameState(gameState) { gameState.lastPuckPosition = gameState.puckPosition; } function baseCombo(gameState) { - return 1 + gameState.perks.base_combo * 3 + gameState.perks.smaller_puck * 5; + return gameState.baseCombo + gameState.perks.base_combo * 3 + gameState.perks.smaller_puck * 5; } function resetCombo(gameState, x, y) { const prev = gameState.combo; @@ -2852,7 +2863,7 @@ function explodeBrick(gameState, index, ball, isExplosion) { } coinsToSpawn -= points; const cx = x + (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize), cy = y + (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize); - makeCoin(gameState, cx, cy, ball.previousVX * (0.5 + Math.random()), ball.previousVY * (0.5 + Math.random()), gameState.perks.metamorphosis || (0, _options.isOptionOn)('colorful_coins') ? color : "gold", points); + makeCoin(gameState, cx, cy, ball.previousVX * (0.5 + Math.random()), ball.previousVY * (0.5 + Math.random()), gameState.perks.metamorphosis || (0, _options.isOptionOn)("colorful_coins") ? color : "gold", points); } gameState.combo += gameState.perks.streak_shots + gameState.perks.compound_interest + gameState.perks.left_is_lava + gameState.perks.right_is_lava + gameState.perks.top_is_lava + gameState.perks.picky_eater + gameState.perks.asceticism + gameState.perks.zen + gameState.perks.passive_income + gameState.perks.nbricks + gameState.perks.unbounded; if (gameState.perks.side_kick) { @@ -2932,20 +2943,27 @@ async function gotoNextLoop(gameState) { gameState.runStatistics.loops++; gameState.runLevels = (0, _newGameState.getRunLevels)(gameState.totalScoreAtRunStart, {}); gameState.upgradesOfferedFor = -1; - // Add random debuf - // gameState.debuffs[randomDebuff]++ + let comboText = ''; + if (gameState.rerolls) { + comboText = (0, _i18N.t)('loop.converted_rerolls', { + n: gameState.rerolls + }); + gameState.baseCombo += gameState.rerolls; + gameState.rerolls = 0; + } else comboText = (0, _i18N.t)('loop.no_rerolls'); const userPerks = (0, _loadGameData.upgrades).filter((u)=>gameState.perks[u.id]); const { keep, debuff, targetPerk } = await (0, _asyncAlert.requiredAsyncAlert)({ - title: (0, _i18N.t)('loop.title', { + title: (0, _i18N.t)("loop.title", { loop: gameState.loop }), content: [ - (0, _i18N.t)('loop.instructions'), + (0, _i18N.t)("loop.instructions"), + comboText, ...userPerks.map((u)=>{ const randomDebuff = (0, _gameUtils.sample)((0, _debuffs.debuffs).filter((d)=>gameState.debuffs[d.id] < d.max)) || (0, _gameUtils.sample)((0, _debuffs.debuffs)); const targetPerk = (0, _gameUtils.sample)(userPerks.filter((tp)=>tp.id !== u.id)); return { - text: u.name + (0, _i18N.t)('level_up.upgrade_perk_to_level', { + text: u.name + (0, _i18N.t)("level_up.upgrade_perk_to_level", { level: gameState.perks[u.id] }), help: randomDebuff.help(gameState.debuffs[randomDebuff.id] + 1, targetPerk.name), @@ -2963,7 +2981,7 @@ async function gotoNextLoop(gameState) { [keep]: gameState.perks[keep] }); gameState.debuffs[debuff]++; - if (debuff == 'banned') gameState.bannedPerks[targetPerk]++; + if (debuff == "banned") gameState.bannedPerks[targetPerk]++; await setLevel(gameState, 0); } async function setLevel(gameState, l) { @@ -3025,7 +3043,7 @@ async function setLevel(gameState, l) { } function setBrick(gameState, index, color) { gameState.bricks[index] = color || ""; - gameState.brickHP[index] = color === "black" && 1 || color && 1 + gameState.perks.sturdy_bricks + gameState.loop || 0; + gameState.brickHP[index] = color === "black" && 1 || color && 1 + gameState.perks.sturdy_bricks + gameState.debuffs.sturdiness || 0; } function rainbowColor() { return `hsl(${Math.round((0, _game.gameState).levelTime / 4) * 2 % 360},100%,70%)`; @@ -3171,7 +3189,7 @@ frames = 1) { coin.vx += (ball.x - coin.x) / d2 * 30 * gameState.perks.ball_attracts_coins; coin.vy += (ball.y - coin.y) / d2 * 30 * gameState.perks.ball_attracts_coins; }); - const ratio = 1 - ((coin.color === 'crimson' ? 2 : gameState.perks.viscosity) * 0.03 + 0.005) * frames; + const ratio = 1 - ((coin.color === "crimson" ? 3 : gameState.perks.viscosity) * 0.03 + 0.005) * frames; coin.vy *= ratio; coin.vx *= ratio; if (coin.vx > 7 * gameState.baseSpeed) coin.vx = 7 * gameState.baseSpeed; @@ -3185,13 +3203,17 @@ frames = 1) { coin.vy += frames * coin.weight * 0.8 * (flip ? -1 : 1); if (flip && !(0, _options.isOptionOn)("basic") && Math.random() < 0.1) makeParticle(gameState, coin.x, coin.y, 0, gameState.baseSpeed, coin.color, true, 5, 250); } + if (coin.color === "crimson" && !(0, _options.isOptionOn)('basic')) { + const angle = Math.random() * Math.PI * 2; + makeParticle(gameState, coin.x, coin.y, Math.cos(angle) * gameState.baseSpeed * 2, Math.sin(angle) * gameState.baseSpeed * 2, 'red', true, 5, 250); + } const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10; const hitBorder = bordersHitCheck(gameState, coin, coin.size / 2, frames); if (coin.y > gameState.gameZoneHeight - coinRadius - gameState.puckHeight && coin.y < gameState.gameZoneHeight + gameState.puckHeight + coin.vy && Math.abs(coin.x - gameState.puckPosition) < coinRadius + gameState.puckWidth / 2 + // a bit of margin to be nice , negative in case it's a negative coin gameState.puckHeight * (coin.points ? 1 : -1)) { if (coin.points) addToScore(gameState, coin); else if (gameState.perks.extra_life && gameState.balls.length) justLostALife(gameState, gameState.balls[0], coin.x, coin.y); - else (0, _gameOver.gameOver)((0, _i18N.t)('gameOver.because_cursed_coin'), (0, _i18N.t)('gameOver.because_cursed_coin_intro')); + else (0, _gameOver.gameOver)((0, _i18N.t)("gameOver.because_cursed_coin"), (0, _i18N.t)("gameOver.because_cursed_coin_intro")); destroy(gameState.coins, coinIndex); } else if (coin.y > gameState.canvasHeight + coinRadius) { destroy(gameState.coins, coinIndex); @@ -3211,9 +3233,10 @@ frames = 1) { coin.vx *= 0.8; coin.vy *= 0.8; coin.sa *= 0.9; - if (speed > 20) schedulGameSound(gameState, "coinBounce", coin.x, 0.2); + if (speed > 20 && !coin.collidedLastFrame) schedulGameSound(gameState, "coinBounce", coin.x, 0.2); + coin.collidedLastFrame = true; if (Math.abs(coin.vy) < 3) coin.vy = 0; - } + } else coin.collidedLastFrame = false; }); gameState.balls.forEach((ball)=>ballTick(gameState, ball, frames)); if (gameState.perks.shocks) gameState.balls.forEach((a, ai)=>gameState.balls.forEach((b, bi)=>{ @@ -3416,7 +3439,7 @@ function ballTick(gameState, ball, delta) { ball.sapperUses++; } } else { - schedulGameSound(gameState, 'wallBeep', x, 1); + schedulGameSound(gameState, "wallBeep", x, 1); makeLight(gameState, (0, _gameUtils.brickCenterX)(gameState, hitBrick), (0, _gameUtils.brickCenterY)(gameState, hitBrick), "white", gameState.brickWidth + 2, 50 * gameState.brickHP[hitBrick]); } } @@ -3438,13 +3461,16 @@ function justLostALife(gameState, ball, x, y) { if (!(0, _options.isOptionOn)("basic")) for(let i = 0; i < 10; i++)makeParticle(gameState, x, y, Math.random() * gameState.baseSpeed * 3, gameState.baseSpeed * 3, "red", false, gameState.coinSize / 2, 150); } function makeCoin(gameState, x, y, vx, vy, color = "gold", points = 1) { - if (gameState.debuffs.negative_coins * points > Math.random() * 10000) { + if (y < gameState.gameZoneWidth * 2 / 3 && gameState.debuffs.negative_coins * points > Math.random() * 10000) { points = 0; color = "crimson"; + vx = 0; + vy = 0; } append(gameState.coins, (p)=>{ p.x = x; p.y = y; + p.collidedLastFrame = true; p.size = gameState.coinSize; p.previousX = x; p.previousY = y; @@ -3666,7 +3692,7 @@ function render(gameState) { // Coins ctx.globalAlpha = 1; (0, _gameStateMutators.forEachLiveOne)(gameState.coins, (coin)=>{ - ctx.globalCompositeOperation = 'source-over'; + ctx.globalCompositeOperation = "source-over"; // ctx.globalCompositeOperation = // coin.color === "gold" || level.color ? "source-over" : "screen"; drawCoin(ctx, coin.color, coin.size, coin.x, coin.y, hasCombo && gameState.perks.asceticism && "red" || !coin.points && "red" || level.color || "black", coin.a); @@ -3680,17 +3706,17 @@ function render(gameState) { }); if (gameState.debuffs.negative_coins) { // Render crimson coins very bright - ctx.globalCompositeOperation = 'source-over'; + ctx.globalCompositeOperation = "source-over"; ctx.globalAlpha = 0.8; const red = Math.floor(gameState.levelTime / 100) % 2 > 0; (0, _gameStateMutators.forEachLiveOne)(gameState.coins, (coin)=>{ - if (coin.color !== 'crimson') return; - drawBall(ctx, red ? 'red' : 'black', coin.size * 3, coin.x, coin.y); + if (coin.color !== "crimson") return; + drawBall(ctx, red ? "red" : "black", coin.size * 3, coin.x, coin.y); }); ctx.globalAlpha = 1; (0, _gameStateMutators.forEachLiveOne)(gameState.coins, (coin)=>{ - if (coin.color !== 'crimson') return; - drawCoin(ctx, !red ? 'red' : 'black', coin.size, coin.x, coin.y, 'red', coin.a); + if (coin.color !== "crimson") return; + drawCoin(ctx, !red ? "red" : "black", coin.size, coin.x, coin.y, "red", coin.a); }); } } @@ -3736,7 +3762,7 @@ function render(gameState) { ctx.moveTo(gameState.puckPosition, gameState.gameZoneHeight); if ((0, _gameStateMutators.interferenceFactor)(gameState) == -1) { ctx.lineWidth = 2; - ctx.strokeStyle = 'red'; + ctx.strokeStyle = "red"; ctx.setLineDash(redBorderDash); ctx.lineDashOffset = getDashOffset(gameState); } else ctx.strokeStyle = gameState.puckColor; @@ -4225,6 +4251,7 @@ function getHistograms() { runStats += makeHistogram((0, _i18N.t)("gameOver.stats.balls_lost"), (r)=>r.balls_lost, ""); runStats += makeHistogram((0, _i18N.t)("gameOver.stats.combo_avg"), (r)=>Math.round(r.coins_spawned / r.bricks_broken), ""); runStats += makeHistogram((0, _i18N.t)("gameOver.stats.combo_max"), (r)=>r.max_combo, ""); + runStats += makeHistogram((0, _i18N.t)("gameOver.stats.loops"), (r)=>r.loops, ""); if (runStats) runStats = `

${(0, _i18N.t)("gameOver.stats.intro", { count: runsHistory.length - 1 })}

` + runStats; @@ -4530,14 +4557,14 @@ function premiumMenuEntry(gameState) { text: (0, _i18N.t)("premium.thanks"), help: (0, _i18N.t)("premium.thanks_help"), value: async ()=>{ - navigator.clipboard.writeText((0, _settings.getSettingValue)('license', '')); + navigator.clipboard.writeText((0, _settings.getSettingValue)("license", "")); (0, _game.openMainMenu)(); } }; let text = (0, _i18N.t)("premium.title"); let help = (0, _i18N.t)("premium.buy"); try { - const timePlayed = localStorage.getItem('breakout_71_total_play_time'); + const timePlayed = localStorage.getItem("breakout_71_total_play_time"); if (timePlayed && !isGooglePlayInstall) { const hours = parseFloat(timePlayed) / 1000 / 60 / 60; const pricePerHours = 4.99 / hours; @@ -4581,8 +4608,8 @@ async function openPremiumMenu(text) { text: (0, _i18N.t)("premium.enter"), help: (0, _i18N.t)("premium.enter_help"), async value () { - const value = (prompt("Please paste your license key") || "").replace(/\s+/g, ""); - const problem = await checkKey(value); + const value = (prompt("Please paste your license key") || "")?.replace(/\s+/g, ""); + const problem = await checkKey(value || ""); if (problem) openPremiumMenu(problem).then(); else { (0, _settings.setSettingValue)("license", value); @@ -4720,7 +4747,8 @@ function newGameState(params) { autoCleanUses: 0, ...(0, _gameUtils.defaultSounds)(), rerolls: 0, - loop: 0 + loop: 0, + baseCombo: 1 }; (0, _gameStateMutators.resetBalls)(gameState); if (!(0, _gameUtils.sumOfValues)(gameState.perks)) { diff --git a/src/PWA/sw-b71.js b/src/PWA/sw-b71.js index afeffda..31d2b57 100644 --- a/src/PWA/sw-b71.js +++ b/src/PWA/sw-b71.js @@ -1,5 +1,5 @@ // The version of the cache. -const VERSION = "29050375"; +const VERSION = "29053110"; // The name of the cache const CACHE_NAME = `breakout-71-${VERSION}`; diff --git a/src/data/levels.json b/src/data/levels.json index 7496740..432a524 100644 --- a/src/data/levels.json +++ b/src/data/levels.json @@ -1046,4 +1046,4 @@ "svg": null, "color": "" } -] \ No newline at end of file +] diff --git a/src/data/version.json b/src/data/version.json index 45ac9a8..ec0d0ee 100644 --- a/src/data/version.json +++ b/src/data/version.json @@ -1 +1 @@ -"29050375" +"29053110" diff --git a/src/debuffs.ts b/src/debuffs.ts index 0945936..6e292e2 100644 --- a/src/debuffs.ts +++ b/src/debuffs.ts @@ -1,11 +1,11 @@ import { t } from "./i18n/i18n"; -import {Debuff} from "./types"; +import { Debuff } from "./types"; export const debuffs = [ { id: "negative_coins", max: 20, - name: (lvl: number) => t("debuffs.negative_coins.help",{lvl}), + name: (lvl: number) => t("debuffs.negative_coins.help", { lvl }), help: (lvl: number) => t("debuffs.negative_coins.help", { lvl }), }, { @@ -17,8 +17,10 @@ export const debuffs = [ { id: "banned", max: 50, - name: (lvl: number,banned:string) => t("debuffs.banned.description",{lvl,banned}), - help: (lvl: number,perk:string) => t("debuffs.banned.help", { lvl,perk }), + name: (lvl: number, banned: string) => + t("debuffs.banned.description", { lvl, banned }), + help: (lvl: number, perk: string) => + t("debuffs.banned.help", { lvl, perk }), }, { id: "interference", @@ -30,8 +32,14 @@ export const debuffs = [ { id: "fragility", max: 5, - name: (lvl: number) => t("debuffs.fragility.help", { percent:lvl*20 }), - help: (lvl: number) => t("debuffs.fragility.help", { percent:lvl*20 }), + name: (lvl: number) => t("debuffs.fragility.help", { percent: lvl * 20 }), + help: (lvl: number) => t("debuffs.fragility.help", { percent: lvl * 20 }), + }, + { + id: "sturdiness", + max: 5, + name: (lvl: number) => t("debuffs.sturdiness.help", { lvl }), + help: (lvl: number) => t("debuffs.sturdiness.help", { lvl }), }, ] as const as Debuff[]; diff --git a/src/game.ts b/src/game.ts index 6aff5f5..b711426 100644 --- a/src/game.ts +++ b/src/game.ts @@ -14,7 +14,8 @@ import { import { getAudioContext, playPendingSounds } from "./sounds"; import { bannedUpgradesHTMl, - currentLevelInfo, debuffsHTMl, + currentLevelInfo, + debuffsHTMl, getRowColIndex, levelsListHTMl, max_levels, @@ -447,25 +448,24 @@ document.addEventListener("visibilitychange", () => { async function openScorePanel() { pause(true); const cb = await asyncAlert({ - title: - gameState.loop ? - t("score_panel.title_looped", { - loop:gameState.loop, + title: gameState.loop + ? t("score_panel.title_looped", { + loop: gameState.loop, score: gameState.score, level: gameState.currentLevel + 1, max: max_levels(gameState), - }): - t("score_panel.title", { + }) + : t("score_panel.title", { score: gameState.score, level: gameState.currentLevel + 1, max: max_levels(gameState), }), content: [ - gameState.isCreativeModeRun ? `

${t("score_panel.test_run")}

` : "", - pickedUpgradesHTMl(gameState), - levelsListHTMl(gameState), - debuffsHTMl(gameState), + gameState.isCreativeModeRun ? `

${t("score_panel.test_run")}

` : "", + pickedUpgradesHTMl(gameState), + levelsListHTMl(gameState), + debuffsHTMl(gameState), ], allowClose: true, }); @@ -1013,22 +1013,23 @@ restart( // // unbounded: 1, // // pierce_color: 1, // pierce: 1, -streak_shots:1, + // streak_shots: 1, // multiball: 6, - // base_combo: 7, - // telekinesis: 2, - // yoyo: 2, - pierce:10, + base_combo: 7, + telekinesis: 2, + yoyo: 2, + pierce: 10, // metamorphosis: 1, // implosions: 1, // sturdy_bricks:5 - extra_life:3 + coin_magnet:2, + extra_life: 3, }, - debuffs:{ + debuffs: { // fragility:3 -negative_coins:1 -// interference:20, - } + negative_coins: 100, + // interference:20, + }, }) || {}, ); diff --git a/src/gameOver.ts b/src/gameOver.ts index ccac688..88c3671 100644 --- a/src/gameOver.ts +++ b/src/gameOver.ts @@ -136,7 +136,7 @@ export function gameOver(title: string, intro: string) { ], }).then(() => restart({ - levelToAvoid: currentLevelInfo(gameState).name + levelToAvoid: currentLevelInfo(gameState).name, }), ); } @@ -271,6 +271,7 @@ export function getHistograms() { (r) => r.max_combo, "", ); + runStats += makeHistogram(t("gameOver.stats.loops"), (r) => r.loops, ""); if (runStats) { runStats = diff --git a/src/gameStateMutators.ts b/src/gameStateMutators.ts index ddfec72..5cd867d 100644 --- a/src/gameStateMutators.ts +++ b/src/gameStateMutators.ts @@ -1,14 +1,17 @@ import { - Ball, - BallLike, - Coin, - colorString, Debuff, DebuffId, Debuffs, - GameState, - LightFlash, - ParticleFlash, - PerkId, - ReusableArray, - TextFlash, + Ball, + BallLike, + Coin, + colorString, + Debuff, + DebuffId, + Debuffs, + GameState, + LightFlash, + ParticleFlash, + PerkId, + ReusableArray, + TextFlash, } from "./types"; import { @@ -30,1822 +33,1861 @@ import { sample, shouldPierceByColor, } from "./game_utils"; -import {t} from "./i18n/i18n"; -import {icons, upgrades} from "./loadGameData"; +import { t } from "./i18n/i18n"; +import { icons, upgrades } from "./loadGameData"; -import {addToTotalScore, getCurrentMaxCoins, getCurrentMaxParticles,} from "./settings"; -import {background} from "./render"; -import {gameOver} from "./gameOver"; import { - brickIndex, - fitSize, - gameState, - hasBrick, - hitsSomething, - openShortRunUpgradesPicker, - pause, - play, + addToTotalScore, + getCurrentMaxCoins, + getCurrentMaxParticles, +} from "./settings"; +import { background } from "./render"; +import { gameOver } from "./gameOver"; +import { + brickIndex, + fitSize, + gameState, + hasBrick, + hitsSomething, + openShortRunUpgradesPicker, + pause, + play, } from "./game"; -import {stopRecording} from "./recording"; -import {isOptionOn} from "./options"; -import {isPremium} from "./premium"; -import {getRunLevels} from "./newGameState"; -import {debuffs} from "./debuffs"; -import {requiredAsyncAlert} from "./asyncAlert"; +import { stopRecording } from "./recording"; +import { isOptionOn } from "./options"; +import { isPremium } from "./premium"; +import { getRunLevels } from "./newGameState"; +import { debuffs } from "./debuffs"; +import { requiredAsyncAlert } from "./asyncAlert"; export function setMousePos(gameState: GameState, x: number) { - // Sets the puck position, and updates the ball position if they are supposed to follow it - gameState.puckPosition = x; - gameState.needsRender = true; + // Sets the puck position, and updates the ball position if they are supposed to follow it + gameState.puckPosition = x; + gameState.needsRender = true; } function getBallDefaultVx(gameState: GameState) { - return ( - (gameState.perks.concave_puck ? 0 : 1) * - (Math.random() > 0.5 ? gameState.baseSpeed : -gameState.baseSpeed) - ); + return ( + (gameState.perks.concave_puck ? 0 : 1) * + (Math.random() > 0.5 ? gameState.baseSpeed : -gameState.baseSpeed) + ); } export function resetBalls(gameState: GameState) { - // Always compute speed first - normalizeGameState(gameState); - const count = 1 + (gameState.perks?.multiball || 0); - const perBall = gameState.puckWidth / (count + 1); - gameState.balls = []; - gameState.ballsColor = "#FFF"; - if (gameState.perks.picky_eater || gameState.perks.pierce_color) { - gameState.ballsColor = - getMajorityValue(gameState.bricks.filter((i) => i)) || "#FFF"; - } - for (let i = 0; i < count; i++) { - const x = - gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1); - const vx = getBallDefaultVx(gameState); + // Always compute speed first + normalizeGameState(gameState); + const count = 1 + (gameState.perks?.multiball || 0); + const perBall = gameState.puckWidth / (count + 1); + gameState.balls = []; + gameState.ballsColor = "#FFF"; + if (gameState.perks.picky_eater || gameState.perks.pierce_color) { + gameState.ballsColor = + getMajorityValue(gameState.bricks.filter((i) => i)) || "#FFF"; + } + for (let i = 0; i < count; i++) { + const x = + gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1); + const vx = getBallDefaultVx(gameState); - gameState.balls.push({ - x, - previousX: x, - y: gameState.gameZoneHeight - 1.5 * gameState.ballSize, - previousY: gameState.gameZoneHeight - 1.5 * gameState.ballSize, - vx, - previousVX: vx, - vy: -gameState.baseSpeed, - previousVY: -gameState.baseSpeed, + gameState.balls.push({ + x, + previousX: x, + y: gameState.gameZoneHeight - 1.5 * gameState.ballSize, + previousY: gameState.gameZoneHeight - 1.5 * gameState.ballSize, + vx, + previousVX: vx, + vy: -gameState.baseSpeed, + previousVY: -gameState.baseSpeed, - // sx: 0, - // sy: 0, - piercePoints: gameState.perks.pierce * 3, - hitSinceBounce: 0, - brokenSinceBounce: 0, - hitItem: [], - sapperUses: 0, - }); - } - gameState.ballStickToPuck = true; + // sx: 0, + // sy: 0, + piercePoints: gameState.perks.pierce * 3, + hitSinceBounce: 0, + brokenSinceBounce: 0, + hitItem: [], + sapperUses: 0, + }); + } + gameState.ballStickToPuck = true; } export function putBallsAtPuck(gameState: GameState) { - // This reset could be abused to cheat quite easily - const count = gameState.balls.length; - const perBall = gameState.puckWidth / (count + 1); - // const vx = getBallDefaultVx(gameState); - gameState.balls.forEach((ball, i) => { - const x = - gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1); + // This reset could be abused to cheat quite easily + const count = gameState.balls.length; + const perBall = gameState.puckWidth / (count + 1); + // const vx = getBallDefaultVx(gameState); + gameState.balls.forEach((ball, i) => { + const x = + gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1); - ball.x = x; - ball.previousX = x; - ball.y = gameState.gameZoneHeight - 1.5 * gameState.ballSize; - ball.previousY = ball.y; - // ball.vx = vx; - // ball.previousVX = ball.vx; - // ball.vy = -gameState.baseSpeed; - // ball.previousVY = ball.vy; - // ball.sx = 0; - // ball.sy = 0; - ball.hitItem = []; - ball.hitSinceBounce = 0; - ball.brokenSinceBounce = 0; - ball.piercePoints = gameState.perks.pierce * 3; - }); + ball.x = x; + ball.previousX = x; + ball.y = gameState.gameZoneHeight - 1.5 * gameState.ballSize; + ball.previousY = ball.y; + // ball.vx = vx; + // ball.previousVX = ball.vx; + // ball.vy = -gameState.baseSpeed; + // ball.previousVY = ball.vy; + // ball.sx = 0; + // ball.sy = 0; + ball.hitItem = []; + ball.hitSinceBounce = 0; + ball.brokenSinceBounce = 0; + ball.piercePoints = gameState.perks.pierce * 3; + }); } export function normalizeGameState(gameState: GameState) { - // This function resets most parameters on the state to correct values, and should be used even when the game is paused + // This function resets most parameters on the state to correct values, and should be used even when the game is paused - gameState.baseSpeed = Math.max( - 3, - gameState.gameZoneWidth / 12 / 10 + - gameState.currentLevel / 3 + - gameState.levelTime / (30 * 1000) - - gameState.perks.slow_down * 2, - ); + gameState.baseSpeed = Math.max( + 3, + gameState.gameZoneWidth / 12 / 10 + + gameState.currentLevel / 3 + + gameState.levelTime / (30 * 1000) - + gameState.perks.slow_down * 2, + ); - gameState.puckWidth = - (gameState.gameZoneWidth / 12) * - (3 - gameState.perks.smaller_puck + gameState.perks.bigger_puck); + gameState.puckWidth = + (gameState.gameZoneWidth / 12) * + (3 - gameState.perks.smaller_puck + gameState.perks.bigger_puck); - let minX = - gameState.perks.corner_shot && gameState.levelTime - ? gameState.offsetXRoundedDown - gameState.puckWidth / 2 - : gameState.offsetXRoundedDown + gameState.puckWidth / 2; + let minX = + gameState.perks.corner_shot && gameState.levelTime + ? gameState.offsetXRoundedDown - gameState.puckWidth / 2 + : gameState.offsetXRoundedDown + gameState.puckWidth / 2; - let maxX = - gameState.perks.corner_shot && gameState.levelTime - ? gameState.offsetXRoundedDown + - gameState.gameZoneWidthRoundedUp + - gameState.puckWidth / 2 - : gameState.offsetXRoundedDown + - gameState.gameZoneWidthRoundedUp - - gameState.puckWidth / 2; + let maxX = + gameState.perks.corner_shot && gameState.levelTime + ? gameState.offsetXRoundedDown + + gameState.gameZoneWidthRoundedUp + + gameState.puckWidth / 2 + : gameState.offsetXRoundedDown + + gameState.gameZoneWidthRoundedUp - + gameState.puckWidth / 2; - gameState.puckPosition = clamp(gameState.puckPosition, minX, maxX); + gameState.puckPosition = clamp(gameState.puckPosition, minX, maxX); - if (gameState.ballStickToPuck) { - putBallsAtPuck(gameState); - } + if (gameState.ballStickToPuck) { + putBallsAtPuck(gameState); + } - if ( - Math.abs(gameState.lastPuckPosition - gameState.puckPosition) > 1 && - gameState.running - ) { - gameState.lastPuckMove = gameState.levelTime; - } - gameState.lastPuckPosition = gameState.puckPosition; + if ( + Math.abs(gameState.lastPuckPosition - gameState.puckPosition) > 1 && + gameState.running + ) { + gameState.lastPuckMove = gameState.levelTime; + } + gameState.lastPuckPosition = gameState.puckPosition; } export function baseCombo(gameState: GameState) { - return 1 + gameState.perks.base_combo * 3 + gameState.perks.smaller_puck * 5; + return gameState.baseCombo + gameState.perks.base_combo * 3 + gameState.perks.smaller_puck * 5; } export function resetCombo( - gameState: GameState, - x: number | undefined, - y: number | undefined, + gameState: GameState, + x: number | undefined, + y: number | undefined, ) { - const prev = gameState.combo; - gameState.combo = baseCombo(gameState); + const prev = gameState.combo; + gameState.combo = baseCombo(gameState); - if (prev > gameState.combo && gameState.perks.soft_reset) { - gameState.combo += Math.floor( - ((prev - gameState.combo) * (gameState.perks.soft_reset * 10)) / 100, - ); + if (prev > gameState.combo && gameState.perks.soft_reset) { + gameState.combo += Math.floor( + ((prev - gameState.combo) * (gameState.perks.soft_reset * 10)) / 100, + ); + } + const lost = Math.max(0, prev - gameState.combo); + if (lost) { + for (let i = 0; i < lost && i < 8; i++) { + setTimeout( + () => schedulGameSound(gameState, "comboDecrease", x, 1), + i * 100, + ); } - const lost = Math.max(0, prev - gameState.combo); - if (lost) { - for (let i = 0; i < lost && i < 8; i++) { - setTimeout( - () => schedulGameSound(gameState, "comboDecrease", x, 1), - i * 100, - ); - } - if (typeof x !== "undefined" && typeof y !== "undefined") { - makeText(gameState, x, y, "red", "-" + lost, 20, 150); - } + if (typeof x !== "undefined" && typeof y !== "undefined") { + makeText(gameState, x, y, "red", "-" + lost, 20, 150); } - return lost; + } + return lost; } export function decreaseCombo( - gameState: GameState, - by: number, - x: number, - y: number, + gameState: GameState, + by: number, + x: number, + y: number, ) { - const prev = gameState.combo; - gameState.combo = Math.max(baseCombo(gameState), gameState.combo - by); - const lost = Math.max(0, prev - gameState.combo); + const prev = gameState.combo; + gameState.combo = Math.max(baseCombo(gameState), gameState.combo - by); + const lost = Math.max(0, prev - gameState.combo); - if (lost) { - schedulGameSound(gameState, "comboDecrease", x, 1); - if (typeof x !== "undefined" && typeof y !== "undefined") { - makeText(gameState, x, y, "red", "-" + lost, 20, 300); - } + if (lost) { + schedulGameSound(gameState, "comboDecrease", x, 1); + if (typeof x !== "undefined" && typeof y !== "undefined") { + makeText(gameState, x, y, "red", "-" + lost, 20, 300); } + } } export function spawnExplosion( - gameState: GameState, - count: number, - x: number, - y: number, - color: string, + gameState: GameState, + count: number, + x: number, + y: number, + color: string, ) { - if (!!isOptionOn("basic")) return; + if (!!isOptionOn("basic")) return; - if (liveCount(gameState.particles) > getCurrentMaxParticles()) { - // Avoid freezing when lots of explosion happen at once - count = 1; - } - for (let i = 0; i < count; i++) { - makeParticle( - gameState, + if (liveCount(gameState.particles) > getCurrentMaxParticles()) { + // Avoid freezing when lots of explosion happen at once + count = 1; + } + for (let i = 0; i < count; i++) { + makeParticle( + gameState, - x + ((Math.random() - 0.5) * gameState.brickWidth) / 2, - y + ((Math.random() - 0.5) * gameState.brickWidth) / 2, - (Math.random() - 0.5) * 30, - (Math.random() - 0.5) * 30, - color, - false, - ); - } + x + ((Math.random() - 0.5) * gameState.brickWidth) / 2, + y + ((Math.random() - 0.5) * gameState.brickWidth) / 2, + (Math.random() - 0.5) * 30, + (Math.random() - 0.5) * 30, + color, + false, + ); + } } export function spawnImplosion( - gameState: GameState, - count: number, - x: number, - y: number, - color: string, + gameState: GameState, + count: number, + x: number, + y: number, + color: string, ) { - if (!!isOptionOn("basic")) return; + if (!!isOptionOn("basic")) return; - if (liveCount(gameState.particles) > getCurrentMaxParticles()) { - // Avoid freezing when lots of explosion happen at once - count = 1; - } - for (let i = 0; i < count; i++) { - const dx = ((Math.random() - 0.5) * gameState.brickWidth) / 2; - const dy = ((Math.random() - 0.5) * gameState.brickWidth) / 2; - makeParticle(gameState, x - dx * 10, y - dy * 10, dx, dy, color, false); - } + if (liveCount(gameState.particles) > getCurrentMaxParticles()) { + // Avoid freezing when lots of explosion happen at once + count = 1; + } + for (let i = 0; i < count; i++) { + const dx = ((Math.random() - 0.5) * gameState.brickWidth) / 2; + const dy = ((Math.random() - 0.5) * gameState.brickWidth) / 2; + makeParticle(gameState, x - dx * 10, y - dy * 10, dx, dy, color, false); + } } export function explosionAt( - gameState: GameState, - index: number, - x: number, - y: number, - ball: Ball, + gameState: GameState, + index: number, + x: number, + y: number, + ball: Ball, ) { - const size = 1 + gameState.perks.bigger_explosions; - schedulGameSound(gameState, "explode", ball.x, 1); - if (index !== -1) { - const col = index % gameState.gridSize; - const row = Math.floor(index / gameState.gridSize); - // Break bricks around - for (let dx = -size; dx <= size; dx++) { - for (let dy = -size; dy <= size; dy++) { - const i = getRowColIndex(gameState, row + dy, col + dx); - if (gameState.bricks[i] && i !== -1) { - // Study bricks resist explosions too - gameState.brickHP[i]--; - if (gameState.brickHP[i] <= 0) { - explodeBrick(gameState, i, ball, true); - } - } - } + const size = 1 + gameState.perks.bigger_explosions; + schedulGameSound(gameState, "explode", ball.x, 1); + if (index !== -1) { + const col = index % gameState.gridSize; + const row = Math.floor(index / gameState.gridSize); + // Break bricks around + for (let dx = -size; dx <= size; dx++) { + for (let dy = -size; dy <= size; dy++) { + const i = getRowColIndex(gameState, row + dy, col + dx); + if (gameState.bricks[i] && i !== -1) { + // Study bricks resist explosions too + gameState.brickHP[i]--; + if (gameState.brickHP[i] <= 0) { + explodeBrick(gameState, i, ball, true); + } } + } } + } - const factor = gameState.perks.implosions ? -1 : 1; - // Blow nearby coins - forEachLiveOne(gameState.coins, (c) => { - const dx = c.x - x; - const dy = c.y - y; - const d2 = Math.max(gameState.brickWidth, Math.abs(dx) + Math.abs(dy)); - c.vx += (((dx / d2) * 10 * size) / c.weight) * factor; - c.vy += (((dy / d2) * 10 * size) / c.weight) * factor; + const factor = gameState.perks.implosions ? -1 : 1; + // Blow nearby coins + forEachLiveOne(gameState.coins, (c) => { + const dx = c.x - x; + const dy = c.y - y; + const d2 = Math.max(gameState.brickWidth, Math.abs(dx) + Math.abs(dy)); + c.vx += (((dx / d2) * 10 * size) / c.weight) * factor; + c.vy += (((dy / d2) * 10 * size) / c.weight) * factor; + }); + gameState.lastExplosion = Date.now(); + + // makeLight(gameState, x, y, "white", gameState.brickWidth * 2, 150); + if (gameState.perks.implosions) { + spawnImplosion( + gameState, + 7 * (1 + gameState.perks.bigger_explosions), + x, + y, + "white", + ); + } else { + spawnExplosion( + gameState, + 7 * (1 + gameState.perks.bigger_explosions), + x, + y, + "white", + ); + } + + gameState.runStatistics.bricks_broken++; + + if (gameState.perks.zen) { + resetCombo(gameState, x, y); + } + if (gameState.debuffs.fragility) { + resetCombo(gameState, x, y); + forEachLiveOne(gameState.coins, (coin, index) => { + // Also destroys cursed coins + if (Math.random() < gameState.debuffs.fragility / 5) { + destroy(gameState.coins, index); + } }); - gameState.lastExplosion = Date.now(); - - // makeLight(gameState, x, y, "white", gameState.brickWidth * 2, 150); - if (gameState.perks.implosions) { - spawnImplosion( - gameState, - 7 * (1 + gameState.perks.bigger_explosions), - x, - y, - "white", - ); - } else { - spawnExplosion( - gameState, - 7 * (1 + gameState.perks.bigger_explosions), - x, - y, - "white", - ); - } - - gameState.runStatistics.bricks_broken++; - - if (gameState.perks.zen) { - resetCombo(gameState, x, y); - } - if(gameState.debuffs.fragility){ - resetCombo(gameState, x, y); - forEachLiveOne(gameState.coins, (coin, index)=>{ - // Also destroys cursed coins - if(Math.random() getCurrentMaxCoins() - ? 1 - : Math.floor(maxCoins - liveCount(gameState.coins)) / 3; - - const pointsPerCoin = Math.max(1, Math.ceil(coinsToSpawn / spawnableCoins)); - - while (coinsToSpawn > 0) { - const points = Math.min(pointsPerCoin, coinsToSpawn); - if (points < 0 || isNaN(points)) { - console.error({points}); - debugger; - } - - coinsToSpawn -= points; - - const cx = - x + - (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize), - cy = - y + - (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize); - makeCoin( - gameState, - cx, - cy, - ball.previousVX * (0.5 + Math.random()), - ball.previousVY * (0.5 + Math.random()), - gameState.perks.metamorphosis || isOptionOn('colorful_coins') ? color : "gold", - points, - ); - } - - gameState.combo += - gameState.perks.streak_shots + - gameState.perks.compound_interest + - gameState.perks.left_is_lava + - gameState.perks.right_is_lava + - gameState.perks.top_is_lava + - gameState.perks.picky_eater + - gameState.perks.asceticism + - gameState.perks.zen + - gameState.perks.passive_income + - gameState.perks.nbricks + - gameState.perks.unbounded; - - if (gameState.perks.side_kick) { - if (Math.abs(ball.vx) > Math.abs(ball.vy)) { - gameState.combo += gameState.perks.side_kick; - } else { - decreaseCombo(gameState, gameState.perks.side_kick, ball.x, ball.y); - } - } - - if (gameState.perks.reach) { - if ( - countBricksAbove(gameState, index) && - !countBricksBelow(gameState, index) - ) { - resetCombo(gameState, x, y); - } else { - gameState.combo += gameState.perks.reach; - } - } - - if ( - gameState.lastPuckMove && - gameState.perks.passive_income && - gameState.lastPuckMove > - gameState.levelTime - 250 * gameState.perks.passive_income - ) { - resetCombo(gameState, x, y); - } - - if ( - gameState.perks.nbricks && - ball.brokenSinceBounce > gameState.perks.nbricks - ) { - // We need to reset at each hit, otherwise it's just an OP version of single puck hit streak - resetCombo(gameState, ball.x, ball.y); - } - - if (!isExplosion) { - // color change - if ( - (gameState.perks.picky_eater || gameState.perks.pierce_color) && - color !== gameState.ballsColor && - color - ) { - if (gameState.perks.picky_eater) { - resetCombo(gameState, ball.x, ball.y); - } - schedulGameSound(gameState, "colorChange", ball.x, 0.8); - gameState.lastExplosion = gameState.levelTime; - gameState.ballsColor = color; - if (!isOptionOn("basic")) { - gameState.balls.forEach((ball) => { - spawnExplosion(gameState, 7, ball.previousX, ball.previousY, color); - }); - } - } else { - schedulGameSound(gameState, "comboIncreaseMaybe", ball.x, 1); - } - } - // makeLight(gameState, x, y, color, gameState.brickWidth, 40); - - spawnExplosion(gameState, 5 + Math.min(gameState.combo, 30), x, y, color); + let coinsToSpawn = gameState.combo; + if (gameState.perks.sturdy_bricks) { + // +10% per level + coinsToSpawn += Math.ceil( + ((10 + gameState.perks.sturdy_bricks) / 10) * coinsToSpawn, + ); } - if (!gameState.bricks[index] && color !== "black") { - ball.hitItem?.push({ - index, - color, - }); + gameState.levelSpawnedCoins += coinsToSpawn; + gameState.runStatistics.coins_spawned += coinsToSpawn; + gameState.runStatistics.bricks_broken++; + const maxCoins = getCurrentMaxCoins() * (isOptionOn("basic") ? 0.5 : 1); + const spawnableCoins = + liveCount(gameState.coins) > getCurrentMaxCoins() + ? 1 + : Math.floor(maxCoins - liveCount(gameState.coins)) / 3; + + const pointsPerCoin = Math.max(1, Math.ceil(coinsToSpawn / spawnableCoins)); + + while (coinsToSpawn > 0) { + const points = Math.min(pointsPerCoin, coinsToSpawn); + if (points < 0 || isNaN(points)) { + console.error({ points }); + debugger; + } + + coinsToSpawn -= points; + + const cx = + x + + (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize), + cy = + y + + (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize); + makeCoin( + gameState, + cx, + cy, + ball.previousVX * (0.5 + Math.random()), + ball.previousVY * (0.5 + Math.random()), + gameState.perks.metamorphosis || isOptionOn("colorful_coins") + ? color + : "gold", + points, + ); } + + gameState.combo += + gameState.perks.streak_shots + + gameState.perks.compound_interest + + gameState.perks.left_is_lava + + gameState.perks.right_is_lava + + gameState.perks.top_is_lava + + gameState.perks.picky_eater + + gameState.perks.asceticism + + gameState.perks.zen + + gameState.perks.passive_income + + gameState.perks.nbricks + + gameState.perks.unbounded; + + if (gameState.perks.side_kick) { + if (Math.abs(ball.vx) > Math.abs(ball.vy)) { + gameState.combo += gameState.perks.side_kick; + } else { + decreaseCombo(gameState, gameState.perks.side_kick, ball.x, ball.y); + } + } + + if (gameState.perks.reach) { + if ( + countBricksAbove(gameState, index) && + !countBricksBelow(gameState, index) + ) { + resetCombo(gameState, x, y); + } else { + gameState.combo += gameState.perks.reach; + } + } + + if ( + gameState.lastPuckMove && + gameState.perks.passive_income && + gameState.lastPuckMove > + gameState.levelTime - 250 * gameState.perks.passive_income + ) { + resetCombo(gameState, x, y); + } + + if ( + gameState.perks.nbricks && + ball.brokenSinceBounce > gameState.perks.nbricks + ) { + // We need to reset at each hit, otherwise it's just an OP version of single puck hit streak + resetCombo(gameState, ball.x, ball.y); + } + + if (!isExplosion) { + // color change + if ( + (gameState.perks.picky_eater || gameState.perks.pierce_color) && + color !== gameState.ballsColor && + color + ) { + if (gameState.perks.picky_eater) { + resetCombo(gameState, ball.x, ball.y); + } + schedulGameSound(gameState, "colorChange", ball.x, 0.8); + gameState.lastExplosion = gameState.levelTime; + gameState.ballsColor = color; + if (!isOptionOn("basic")) { + gameState.balls.forEach((ball) => { + spawnExplosion(gameState, 7, ball.previousX, ball.previousY, color); + }); + } + } else { + schedulGameSound(gameState, "comboIncreaseMaybe", ball.x, 1); + } + } + // makeLight(gameState, x, y, color, gameState.brickWidth, 40); + + spawnExplosion(gameState, 5 + Math.min(gameState.combo, 30), x, y, color); + } + + if (!gameState.bricks[index] && color !== "black") { + ball.hitItem?.push({ + index, + color, + }); + } } export function dontOfferTooSoon(gameState: GameState, id: PerkId) { - gameState.lastOffered[id] = Math.round(Date.now() / 1000); + gameState.lastOffered[id] = Math.round(Date.now() / 1000); } export function pickRandomUpgrades(gameState: GameState, count: number) { - let list = getPossibleUpgrades(gameState) - .map((u) => ({ - ...u, - score: Math.random() + (gameState.lastOffered[u.id] || 0), - })) - .sort((a, b) => a.score - b.score) - .filter((u) => gameState.perks[u.id] < u.max) - .filter((u) => !gameState.bannedPerks[u.id]) - .slice(0, count) - .sort((a, b) => (a.id > b.id ? 1 : -1)); + let list = getPossibleUpgrades(gameState) + .map((u) => ({ + ...u, + score: Math.random() + (gameState.lastOffered[u.id] || 0), + })) + .sort((a, b) => a.score - b.score) + .filter((u) => gameState.perks[u.id] < u.max) + .filter((u) => !gameState.bannedPerks[u.id]) + .slice(0, count) + .sort((a, b) => (a.id > b.id ? 1 : -1)); - list.forEach((u) => { - dontOfferTooSoon(gameState, u.id); - }); + list.forEach((u) => { + dontOfferTooSoon(gameState, u.id); + }); - return list.map((u) => ({ - text: - u.name + - (gameState.perks[u.id] - ? t("level_up.upgrade_perk_to_level", { - level: gameState.perks[u.id] + 1, - }) - : ""), - icon: icons["icon:" + u.id], - value: u.id as PerkId, - help: u.help(gameState.perks[u.id] + 1), - })); + return list.map((u) => ({ + text: + u.name + + (gameState.perks[u.id] + ? t("level_up.upgrade_perk_to_level", { + level: gameState.perks[u.id] + 1, + }) + : ""), + icon: icons["icon:" + u.id], + value: u.id as PerkId, + help: u.help(gameState.perks[u.id] + 1), + })); } export function schedulGameSound( - gameState: GameState, - sound: keyof GameState["aboutToPlaySound"], - x: number | void, - vol: number, + gameState: GameState, + sound: keyof GameState["aboutToPlaySound"], + x: number | void, + vol: number, ) { - if (!vol) return; - x ??= gameState.offsetX + gameState.gameZoneWidth / 2; - const ex = gameState.aboutToPlaySound[sound] as { vol: number; x: number }; + if (!vol) return; + x ??= gameState.offsetX + gameState.gameZoneWidth / 2; + const ex = gameState.aboutToPlaySound[sound] as { vol: number; x: number }; - ex.x = (x * vol + ex.x * ex.vol) / (vol + ex.vol); - ex.vol += vol; + ex.x = (x * vol + ex.x * ex.vol) / (vol + ex.vol); + ex.vol += vol; } export function addToScore(gameState: GameState, coin: Coin) { - gameState.score += coin.points; - gameState.lastScoreIncrease = gameState.levelTime; - addToTotalScore(gameState, coin.points); - if ( - gameState.score > gameState.highScore && - !gameState.isCreativeModeRun - ) { - gameState.highScore = gameState.score; - localStorage.setItem("breakout-3-hs", gameState.score.toString()); - } - if (!isOptionOn("basic") ) { - makeParticle( - gameState, - coin.previousX, - coin.previousY, - (gameState.canvasWidth - coin.x) / 100, - -coin.y / 100, - coin.color, - true, - gameState.coinSize / 2, - 100 + Math.random() * 50, - ); - } + gameState.score += coin.points; + gameState.lastScoreIncrease = gameState.levelTime; + addToTotalScore(gameState, coin.points); + if (gameState.score > gameState.highScore && !gameState.isCreativeModeRun) { + gameState.highScore = gameState.score; + localStorage.setItem("breakout-3-hs", gameState.score.toString()); + } + if (!isOptionOn("basic")) { + makeParticle( + gameState, + coin.previousX, + coin.previousY, + (gameState.canvasWidth - coin.x) / 100, + -coin.y / 100, + coin.color, + true, + gameState.coinSize / 2, + 100 + Math.random() * 50, + ); + } - schedulGameSound(gameState, "coinCatch", coin.x, 1); - gameState.runStatistics.score += coin.points; - if (gameState.perks.asceticism) { - resetCombo(gameState, coin.x, coin.y); - } + schedulGameSound(gameState, "coinCatch", coin.x, 1); + gameState.runStatistics.score += coin.points; + if (gameState.perks.asceticism) { + resetCombo(gameState, coin.x, coin.y); + } } export async function gotoNextLoop(gameState: GameState) { - pause(false) - gameState.loop++ - gameState.runStatistics.loops++ - gameState.runLevels = getRunLevels(gameState.totalScoreAtRunStart, {}) - gameState.upgradesOfferedFor = -1 - // Add random debuf + pause(false); + gameState.loop++; + gameState.runStatistics.loops++; + gameState.runLevels = getRunLevels(gameState.totalScoreAtRunStart, {}); + gameState.upgradesOfferedFor = -1; - // gameState.debuffs[randomDebuff]++ - const userPerks=upgrades.filter(u => gameState.perks[u.id]) - const {keep, - debuff, - targetPerk} = await requiredAsyncAlert<{ keep:PerkId, debuff:DebuffId, targetPerk:PerkId }>({ - title: t('loop.title', {loop: gameState.loop}), - content: [ - t('loop.instructions'), - ...userPerks - .map(u => { - const randomDebuff = sample(debuffs.filter(d => gameState.debuffs[d.id] < d.max)) || sample(debuffs); - const targetPerk = sample(userPerks.filter(tp=>tp.id!==u.id)) - return ({ - text: u.name + t('level_up.upgrade_perk_to_level', {level: gameState.perks[u.id]}), - help: randomDebuff.help(gameState.debuffs[randomDebuff.id]+1, targetPerk.name), - icon: u.icon, - value: { - keep: u.id, - debuff: randomDebuff.id, - targetPerk:targetPerk.id - } - }) - }) - ] - }) + let comboText='' + if(gameState.rerolls) { + comboText=t('loop.converted_rerolls',{n:gameState.rerolls}) + gameState.baseCombo += gameState.rerolls + gameState.rerolls=0 + }else{ + comboText=t('loop.no_rerolls') + } - Object.assign(gameState.perks, makeEmptyPerksMap(upgrades), {[keep]: gameState.perks[keep]}) - gameState.debuffs[debuff]++ - if(debuff=='banned'){ - gameState.bannedPerks[targetPerk]++ - } + const userPerks = upgrades.filter((u) => gameState.perks[u.id]); + const { keep, debuff, targetPerk } = await requiredAsyncAlert<{ + keep: PerkId; + debuff: DebuffId; + targetPerk: PerkId; + }>({ + title: t("loop.title", { loop: gameState.loop }), + content: [ + t("loop.instructions"), +comboText, - await setLevel(gameState, 0) + ...userPerks.map((u) => { + const randomDebuff = + sample(debuffs.filter((d) => gameState.debuffs[d.id] < d.max)) || + sample(debuffs); + const targetPerk = sample(userPerks.filter((tp) => tp.id !== u.id)); + return { + text: + u.name + + t("level_up.upgrade_perk_to_level", { + level: gameState.perks[u.id], + }), + help: randomDebuff.help( + gameState.debuffs[randomDebuff.id] + 1, + targetPerk.name, + ), + icon: u.icon, + value: { + keep: u.id, + debuff: randomDebuff.id, + targetPerk: targetPerk.id, + }, + }; + }), + ], + }); + + Object.assign(gameState.perks, makeEmptyPerksMap(upgrades), { + [keep]: gameState.perks[keep], + }); + gameState.debuffs[debuff]++; + if (debuff == "banned") { + gameState.bannedPerks[targetPerk]++; + } + + await setLevel(gameState, 0); } export async function setLevel(gameState: GameState, l: number) { - // Here to alleviate double upgrades issues - if (gameState.upgradesOfferedFor >= l) { - debugger; - return console.warn("Extra upgrade request ignored "); - } - gameState.upgradesOfferedFor = l; - pause(false); - stopRecording(); - if (l > 0) { + // Here to alleviate double upgrades issues + if (gameState.upgradesOfferedFor >= l) { + debugger; + return console.warn("Extra upgrade request ignored "); + } + gameState.upgradesOfferedFor = l; + pause(false); + stopRecording(); + if (l > 0) { + await openShortRunUpgradesPicker(gameState); + } + gameState.currentLevel = l; - await openShortRunUpgradesPicker(gameState); - } - gameState.currentLevel = l; + gameState.level = gameState.runLevels[l]; - gameState.level = gameState.runLevels[l]; + gameState.levelTime = 0; + gameState.winAt = 0; + gameState.levelWallBounces = 0; + gameState.autoCleanUses = 0; + gameState.lastTickDown = gameState.levelTime; + gameState.levelStartScore = gameState.score; + gameState.levelSpawnedCoins = 0; + gameState.levelMisses = 0; + gameState.runStatistics.levelsPlayed++; - gameState.levelTime = 0; - gameState.winAt = 0; - gameState.levelWallBounces = 0; - gameState.autoCleanUses = 0; - gameState.lastTickDown = gameState.levelTime; - gameState.levelStartScore = gameState.score; - gameState.levelSpawnedCoins = 0; - gameState.levelMisses = 0; - gameState.runStatistics.levelsPlayed++; + // Reset combo silently + const finalCombo = gameState.combo; + gameState.combo = baseCombo(gameState); + if (gameState.perks.shunt) { + gameState.combo += Math.round( + Math.max( + 0, + ((finalCombo - gameState.combo) * 20 * gameState.perks.shunt) / 100, + ), + ); + } + gameState.combo += gameState.perks.hot_start * 15; - // Reset combo silently - const finalCombo = gameState.combo; - gameState.combo = baseCombo(gameState); - if (gameState.perks.shunt) { - gameState.combo += Math.round( - Math.max( - 0, - ((finalCombo - gameState.combo) * 20 * gameState.perks.shunt) / 100, - ), - ); - } - gameState.combo += gameState.perks.hot_start * 15; + const lvl = currentLevelInfo(gameState); + if (lvl.size !== gameState.gridSize) { + gameState.gridSize = lvl.size; + fitSize(); + } + empty(gameState.coins); + empty(gameState.particles); + empty(gameState.lights); + empty(gameState.texts); + gameState.bricks = []; + for (let i = 0; i < lvl.size * lvl.size; i++) { + setBrick(gameState, i, lvl.bricks[i]); + } - const lvl = currentLevelInfo(gameState); - if (lvl.size !== gameState.gridSize) { - gameState.gridSize = lvl.size; - fitSize(); + if (gameState.debuffs.more_bombs) { + let attemps = 0; + let changed = 0; + while (attemps < 100 && changed < gameState.debuffs.more_bombs) { + attemps++; + const index = Math.floor(Math.random() * gameState.bricks.length); + if (gameState.bricks[index] && gameState.bricks[index] !== "black") { + gameState.bricks[index] = "black"; + gameState.brickHP[index] = 1; + changed++; + } } - empty(gameState.coins); - empty(gameState.particles); - empty(gameState.lights); - empty(gameState.texts); - gameState.bricks = []; - for (let i = 0; i < lvl.size * lvl.size; i++) { - setBrick(gameState, i, lvl.bricks[i]); - } - - if (gameState.debuffs.more_bombs) { - let attemps = 0; - let changed = 0; - while (attemps < 100 && changed < gameState.debuffs.more_bombs) { - attemps++; - const index = Math.floor(Math.random() * gameState.bricks.length); - if ( - gameState.bricks[index] && - gameState.bricks[index] !== "black" - ) { - gameState.bricks[index] = "black"; - gameState.brickHP[index] = 1; - changed++; - } - } - } - // Balls color will depend on most common brick color sometimes - resetBalls(gameState); - gameState.needsRender = true; - // This caused problems with accented characters like the ô of côte d'ivoire for odd reasons - // background.src = 'data:image/svg+xml;base64,' + btoa(lvl.svg) - background.src = "data:image/svg+xml;UTF8," + lvl.svg; + } + // Balls color will depend on most common brick color sometimes + resetBalls(gameState); + gameState.needsRender = true; + // This caused problems with accented characters like the ô of côte d'ivoire for odd reasons + // background.src = 'data:image/svg+xml;base64,' + btoa(lvl.svg) + background.src = "data:image/svg+xml;UTF8," + lvl.svg; } function setBrick(gameState: GameState, index: number, color: string) { - gameState.bricks[index] = color || ""; - gameState.brickHP[index] = - (color === "black" && 1) || - (color && 1 + gameState.perks.sturdy_bricks+gameState.loop) || - 0; + gameState.bricks[index] = color || ""; + gameState.brickHP[index] = + (color === "black" && 1) || + (color && + 1 + gameState.perks.sturdy_bricks + gameState.debuffs.sturdiness) || + 0; } export function rainbowColor(): colorString { - return `hsl(${(Math.round(gameState.levelTime / 4) * 2) % 360},100%,70%)`; + return `hsl(${(Math.round(gameState.levelTime / 4) * 2) % 360},100%,70%)`; } export function repulse( - gameState: GameState, - a: Ball, - b: BallLike, - power: number, - impactsBToo: boolean, + gameState: GameState, + a: Ball, + b: BallLike, + power: number, + impactsBToo: boolean, ) { - const distance = distanceBetween(a, b); - // Ensure we don't get soft locked - const max = gameState.gameZoneWidth / 4; - if (distance > max) return; - // Unit vector - const dx = (a.x - b.x) / distance; - const dy = (a.y - b.y) / distance; - const fact = - (((-power * (max - distance)) / (max * 1.2) / 3) * - Math.min(500, gameState.levelTime)) / - 500; - if ( - impactsBToo && - typeof b.vx !== "undefined" && - typeof b.vy !== "undefined" - ) { - b.vx += dx * fact; - b.vy += dy * fact; - } - a.vx -= dx * fact; - a.vy -= dy * fact; + const distance = distanceBetween(a, b); + // Ensure we don't get soft locked + const max = gameState.gameZoneWidth / 4; + if (distance > max) return; + // Unit vector + const dx = (a.x - b.x) / distance; + const dy = (a.y - b.y) / distance; + const fact = + (((-power * (max - distance)) / (max * 1.2) / 3) * + Math.min(500, gameState.levelTime)) / + 500; + if ( + impactsBToo && + typeof b.vx !== "undefined" && + typeof b.vy !== "undefined" + ) { + b.vx += dx * fact; + b.vy += dy * fact; + } + a.vx -= dx * fact; + a.vy -= dy * fact; - const speed = 10; - const rand = 2; + const speed = 10; + const rand = 2; + makeParticle( + gameState, + a.x, + a.y, + -dx * speed + a.vx + (Math.random() - 0.5) * rand, + -dy * speed + a.vy + (Math.random() - 0.5) * rand, + rainbowColor(), + true, + gameState.coinSize / 2, + 100, + ); + if ( + impactsBToo && + typeof b.vx !== "undefined" && + typeof b.vy !== "undefined" + ) { makeParticle( - gameState, - a.x, - a.y, - -dx * speed + a.vx + (Math.random() - 0.5) * rand, - -dy * speed + a.vy + (Math.random() - 0.5) * rand, - rainbowColor(), - true, - gameState.coinSize / 2, - 100, + gameState, + b.x, + b.y, + dx * speed + b.vx + (Math.random() - 0.5) * rand, + dy * speed + b.vy + (Math.random() - 0.5) * rand, + rainbowColor(), + true, + gameState.coinSize / 2, + 100, ); - if ( - impactsBToo && - typeof b.vx !== "undefined" && - typeof b.vy !== "undefined" - ) { - makeParticle( - gameState, - b.x, - b.y, - dx * speed + b.vx + (Math.random() - 0.5) * rand, - dy * speed + b.vy + (Math.random() - 0.5) * rand, - rainbowColor(), - true, - gameState.coinSize / 2, - 100, - ); - } + } } export function attract(gameState: GameState, a: Ball, b: Ball, power: number) { - const distance = distanceBetween(a, b); - // Ensure we don't get soft locked - const min = (gameState.gameZoneWidth * 3) / 4; - if (distance < min) return; - // Unit vector - const dx = (a.x - b.x) / distance; - const dy = (a.y - b.y) / distance; + const distance = distanceBetween(a, b); + // Ensure we don't get soft locked + const min = (gameState.gameZoneWidth * 3) / 4; + if (distance < min) return; + // Unit vector + const dx = (a.x - b.x) / distance; + const dy = (a.y - b.y) / distance; - const fact = - (((power * (distance - min)) / min) * Math.min(500, gameState.levelTime)) / - 500; - b.vx += dx * fact; - b.vy += dy * fact; - a.vx -= dx * fact; - a.vy -= dy * fact; + const fact = + (((power * (distance - min)) / min) * Math.min(500, gameState.levelTime)) / + 500; + b.vx += dx * fact; + b.vy += dy * fact; + a.vx -= dx * fact; + a.vy -= dy * fact; - const speed = 10; - const rand = 2; + const speed = 10; + const rand = 2; - makeParticle( - gameState, - a.x, - a.y, - dx * speed + a.vx + (Math.random() - 0.5) * rand, - dy * speed + a.vy + (Math.random() - 0.5) * rand, - rainbowColor(), - true, - gameState.coinSize / 2, - 100, - ); - makeParticle( - gameState, - b.x, - b.y, - -dx * speed + b.vx + (Math.random() - 0.5) * rand, - -dy * speed + b.vy + (Math.random() - 0.5) * rand, - rainbowColor(), - true, - gameState.coinSize / 2, - 100, - ); + makeParticle( + gameState, + a.x, + a.y, + dx * speed + a.vx + (Math.random() - 0.5) * rand, + dy * speed + a.vy + (Math.random() - 0.5) * rand, + rainbowColor(), + true, + gameState.coinSize / 2, + 100, + ); + makeParticle( + gameState, + b.x, + b.y, + -dx * speed + b.vx + (Math.random() - 0.5) * rand, + -dy * speed + b.vy + (Math.random() - 0.5) * rand, + rainbowColor(), + true, + gameState.coinSize / 2, + 100, + ); } export function coinBrickHitCheck(gameState: GameState, coin: Coin) { - // Make ball/coin bonce, and return bricks that were hit - const radius = coin.size / 2; - const {x, y, previousX, previousY} = coin; + // Make ball/coin bonce, and return bricks that were hit + const radius = coin.size / 2; + const { x, y, previousX, previousY } = coin; - const vhit = hitsSomething(previousX, y, radius); - const hhit = hitsSomething(x, previousY, radius); - const chit = - (typeof vhit == "undefined" && - typeof hhit == "undefined" && - hitsSomething(x, y, radius)) || - undefined; - if (!gameState.perks.ghost_coins) { - if (typeof vhit !== "undefined" || typeof chit !== "undefined") { - coin.y = coin.previousY; - coin.vy *= -1; + const vhit = hitsSomething(previousX, y, radius); + const hhit = hitsSomething(x, previousY, radius); + const chit = + (typeof vhit == "undefined" && + typeof hhit == "undefined" && + hitsSomething(x, y, radius)) || + undefined; + if (!gameState.perks.ghost_coins) { + if (typeof vhit !== "undefined" || typeof chit !== "undefined") { + coin.y = coin.previousY; + coin.vy *= -1; - // Roll on corners - const leftHit = gameState.bricks[brickIndex(x - radius, y + radius)]; - const rightHit = gameState.bricks[brickIndex(x + radius, y + radius)]; + // Roll on corners + const leftHit = gameState.bricks[brickIndex(x - radius, y + radius)]; + const rightHit = gameState.bricks[brickIndex(x + radius, y + radius)]; - if (leftHit && !rightHit) { - coin.vx += 1; - coin.sa -= 1; - } - if (!leftHit && rightHit) { - coin.vx -= 1; - coin.sa += 1; - } - } - if (typeof hhit !== "undefined" || typeof chit !== "undefined") { - coin.x = coin.previousX; - coin.vx *= -1; - } + if (leftHit && !rightHit) { + coin.vx += 1; + coin.sa -= 1; + } + if (!leftHit && rightHit) { + coin.vx -= 1; + coin.sa += 1; + } } - return vhit ?? hhit ?? chit; + if (typeof hhit !== "undefined" || typeof chit !== "undefined") { + coin.x = coin.previousX; + coin.vx *= -1; + } + } + return vhit ?? hhit ?? chit; } export function bordersHitCheck( - gameState: GameState, - coin: Coin | Ball, - radius: number, - delta: number, + gameState: GameState, + coin: Coin | Ball, + radius: number, + delta: number, ) { - if (coin.destroyed) return; - coin.previousX = coin.x; - coin.previousY = coin.y; - coin.x += coin.vx * delta; - coin.y += coin.vy * delta; - // coin.sx ||= 0; - // coin.sy ||= 0; - // coin.sx += coin.previousX - coin.x; - // coin.sy += coin.previousY - coin.y; - // coin.sx *= 0.9; - // coin.sy *= 0.9; + if (coin.destroyed) return; + coin.previousX = coin.x; + coin.previousY = coin.y; + coin.x += coin.vx * delta; + coin.y += coin.vy * delta; + // coin.sx ||= 0; + // coin.sy ||= 0; + // coin.sx += coin.previousX - coin.x; + // coin.sy += coin.previousY - coin.y; + // coin.sx *= 0.9; + // coin.sy *= 0.9; - if (gameState.perks.wind) { - coin.vx += - ((gameState.puckPosition - - (gameState.offsetX + gameState.gameZoneWidth / 2)) / - gameState.gameZoneWidth) * - gameState.perks.wind * - 0.5 ; - } + if (gameState.perks.wind) { + coin.vx += + ((gameState.puckPosition - + (gameState.offsetX + gameState.gameZoneWidth / 2)) / + gameState.gameZoneWidth) * + gameState.perks.wind * + 0.5; + } - let vhit = 0, - hhit = 0; + let vhit = 0, + hhit = 0; - if ( - coin.x < gameState.offsetXRoundedDown + radius && - !gameState.perks.unbounded - ) { - coin.x = - gameState.offsetXRoundedDown + - radius + - (gameState.offsetXRoundedDown + radius - coin.x); - coin.vx *= -1; - hhit = 1; - } - if (coin.y < radius) { - coin.y = radius + (radius - coin.y); - coin.vy *= -1; - vhit = 1; - } - if ( - coin.x > gameState.canvasWidth - gameState.offsetXRoundedDown - radius && - !gameState.perks.unbounded - ) { - coin.x = - gameState.canvasWidth - - gameState.offsetXRoundedDown - - radius - - (coin.x - - (gameState.canvasWidth - gameState.offsetXRoundedDown - radius)); - coin.vx *= -1; - hhit = 1; - } + if ( + coin.x < gameState.offsetXRoundedDown + radius && + !gameState.perks.unbounded + ) { + coin.x = + gameState.offsetXRoundedDown + + radius + + (gameState.offsetXRoundedDown + radius - coin.x); + coin.vx *= -1; + hhit = 1; + } + if (coin.y < radius) { + coin.y = radius + (radius - coin.y); + coin.vy *= -1; + vhit = 1; + } + if ( + coin.x > gameState.canvasWidth - gameState.offsetXRoundedDown - radius && + !gameState.perks.unbounded + ) { + coin.x = + gameState.canvasWidth - + gameState.offsetXRoundedDown - + radius - + (coin.x - + (gameState.canvasWidth - gameState.offsetXRoundedDown - radius)); + coin.vx *= -1; + hhit = 1; + } - return hhit + vhit * 2; + return hhit + vhit * 2; } export function gameStateTick( - gameState: GameState, - // How many frames to compute at once, can go above 1 to compensate lag - frames = 1, + gameState: GameState, + // How many frames to compute at once, can go above 1 to compensate lag + frames = 1, ) { - gameState.runStatistics.max_combo = Math.max( - gameState.runStatistics.max_combo, - gameState.combo, + gameState.runStatistics.max_combo = Math.max( + gameState.runStatistics.max_combo, + gameState.combo, + ); + + gameState.balls = gameState.balls.filter((ball) => !ball.destroyed); + + const remainingBricks = gameState.bricks.filter( + (b) => b && b !== "black", + ).length; + + if ( + gameState.levelTime > gameState.lastTickDown + 1000 && + gameState.perks.hot_start + ) { + gameState.lastTickDown = gameState.levelTime; + decreaseCombo( + gameState, + gameState.perks.hot_start, + gameState.puckPosition, + gameState.gameZoneHeight - 2 * gameState.puckHeight, ); + } - gameState.balls = gameState.balls.filter((ball) => !ball.destroyed); + if ( + remainingBricks <= gameState.perks.skip_last && + !gameState.autoCleanUses + ) { + gameState.bricks.forEach((type, index) => { + if (type) { + explodeBrick(gameState, index, gameState.balls[0], true); + } + }); + gameState.autoCleanUses++; + } + const hasPendingBricks = + gameState.perks.respawn && + gameState.balls.find((b) => b.hitItem.length > 1); - const remainingBricks = gameState.bricks.filter( - (b) => b && b !== "black", - ).length; - - if ( - gameState.levelTime > gameState.lastTickDown + 1000 && - gameState.perks.hot_start - ) { - gameState.lastTickDown = gameState.levelTime; - decreaseCombo( - gameState, - gameState.perks.hot_start, - gameState.puckPosition, - gameState.gameZoneHeight - 2 * gameState.puckHeight, - ); + if (gameState.running && !remainingBricks && !hasPendingBricks) { + if (!gameState.winAt) { + gameState.winAt = gameState.levelTime + 5000; } + } else { + gameState.winAt = 0; + } - if ( - remainingBricks <= gameState.perks.skip_last && - !gameState.autoCleanUses - ) { - gameState.bricks.forEach((type, index) => { - if (type) { - explodeBrick(gameState, index, gameState.balls[0], true); - } - }); - gameState.autoCleanUses++; - } - const hasPendingBricks = - gameState.perks.respawn && - gameState.balls.find((b) => b.hitItem.length > 1); - - if (gameState.running && !remainingBricks && !hasPendingBricks) { - if (!gameState.winAt) { - gameState.winAt = gameState.levelTime + 5000; - } + if ( + (gameState.running && + // Delayed win when coins are still flying + gameState.winAt && + gameState.levelTime > gameState.winAt) || + // instant win condition + (gameState.levelTime && !remainingBricks && !liveCount(gameState.coins)) + ) { + if (gameState.currentLevel + 1 < max_levels(gameState)) { + setLevel(gameState, gameState.currentLevel + 1); } else { - gameState.winAt = 0; + if (isPremium()) { + gotoNextLoop(gameState); + } else { + gameOver( + t("gameOver.win.title"), + t("gameOver.win.summary", { score: gameState.score }), + ); + } } + } else if (gameState.running || gameState.levelTime) { + const coinRadius = Math.round(gameState.coinSize / 2); - if ( - gameState.running && - // Delayed win when coins are still flying - (gameState.winAt && gameState.levelTime > gameState.winAt) || - // instant win condition - ( - gameState.levelTime && - !remainingBricks && - !liveCount(gameState.coins)) - ) { + forEachLiveOne(gameState.coins, (coin, coinIndex) => { + if (gameState.perks.coin_magnet) { + const strength = + (100 / + (100 + + Math.pow(coin.y - gameState.gameZoneHeight, 2) + + Math.pow(coin.x - gameState.puckPosition, 2))) * + gameState.perks.coin_magnet; - if ( - gameState.currentLevel + 1 < max_levels(gameState) - ) { - setLevel(gameState, gameState.currentLevel + 1); + const attractionX = + frames * (gameState.puckPosition - coin.x) * strength; + + coin.vx += attractionX; + coin.vy += + (frames * (gameState.gameZoneHeight - coin.y) * strength) / 2; + coin.sa -= attractionX / 10; + } + + if (gameState.perks.ball_attracts_coins) { + gameState.balls.forEach((ball) => { + const d2 = distance2(ball, coin); + coin.vx += + ((ball.x - coin.x) / d2) * 30 * gameState.perks.ball_attracts_coins; + coin.vy += + ((ball.y - coin.y) / d2) * 30 * gameState.perks.ball_attracts_coins; + }); + } + + const ratio = + 1 - + ((coin.color === "crimson" ? 3 : gameState.perks.viscosity) * 0.03 + + 0.005) * + frames; + + coin.vy *= ratio; + coin.vx *= ratio; + if (coin.vx > 7 * gameState.baseSpeed) coin.vx = 7 * gameState.baseSpeed; + if (coin.vx < -7 * gameState.baseSpeed) + coin.vx = -7 * gameState.baseSpeed; + if (coin.vy > 7 * gameState.baseSpeed) coin.vy = 7 * gameState.baseSpeed; + if (coin.vy < -7 * gameState.baseSpeed) + coin.vy = -7 * gameState.baseSpeed; + coin.a += coin.sa; + + // Gravity + if (!gameState.perks.etherealcoins) { + const flip = + gameState.perks.helium > 0 && + Math.abs(coin.x - gameState.puckPosition) * 2 > + gameState.puckWidth + coin.size; + coin.vy += frames * coin.weight * 0.8 * (flip ? -1 : 1); + if (flip && !isOptionOn("basic") && Math.random() < 0.1) { + makeParticle( + gameState, + coin.x, + coin.y, + 0, + gameState.baseSpeed, + coin.color, + true, + 5, + 250, + ); + } + } + + if(coin.color === "crimson" && !isOptionOn('basic')){ + const angle=Math.random()*Math.PI*2 + makeParticle( + gameState, + coin.x, + coin.y, + Math.cos(angle)*gameState.baseSpeed*2, + Math.sin(angle)*gameState.baseSpeed*2, + 'red', + true, + 5, + 250, + ); + } + + const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10; + const hitBorder = bordersHitCheck(gameState, coin, coin.size / 2, frames); + + if ( + coin.y > gameState.gameZoneHeight - coinRadius - gameState.puckHeight && + coin.y < gameState.gameZoneHeight + gameState.puckHeight + coin.vy && + Math.abs(coin.x - gameState.puckPosition) < + coinRadius + + gameState.puckWidth / 2 + + // a bit of margin to be nice , negative in case it's a negative coin + gameState.puckHeight * (coin.points ? 1 : -1) + ) { + if (coin.points) { + addToScore(gameState, coin); + } else if (gameState.perks.extra_life && gameState.balls.length) { + justLostALife(gameState, gameState.balls[0], coin.x, coin.y); } else { - if (isPremium()) { - gotoNextLoop(gameState) - } else { - - gameOver( - t("gameOver.win.title"), - t("gameOver.win.summary", {score: gameState.score}), - ); - } + gameOver( + t("gameOver.because_cursed_coin"), + t("gameOver.because_cursed_coin_intro"), + ); } - } else if (gameState.running || gameState.levelTime) { - const coinRadius = Math.round(gameState.coinSize / 2); - - forEachLiveOne(gameState.coins, (coin, coinIndex) => { - if (gameState.perks.coin_magnet) { - const strength = - (100 / - (100 + - Math.pow(coin.y - gameState.gameZoneHeight, 2) + - Math.pow(coin.x - gameState.puckPosition, 2))) * - gameState.perks.coin_magnet; - - const attractionX = - frames * (gameState.puckPosition - coin.x) * strength; - - coin.vx += attractionX; - coin.vy += - (frames * (gameState.gameZoneHeight - coin.y) * strength) / 2; - coin.sa -= attractionX / 10; - } - - if (gameState.perks.ball_attracts_coins) { - gameState.balls.forEach((ball) => { - const d2 = distance2(ball, coin); - coin.vx += - ((ball.x - coin.x) / d2) * 30 * gameState.perks.ball_attracts_coins; - coin.vy += - ((ball.y - coin.y) / d2) * 30 * gameState.perks.ball_attracts_coins; - }); - } - - const ratio = 1 - ((coin.color==='crimson' ? 2:gameState.perks.viscosity)* 0.03 + 0.005) * frames; - - coin.vy *= ratio; - coin.vx *= ratio; - if (coin.vx > 7 * gameState.baseSpeed) coin.vx = 7 * gameState.baseSpeed; - if (coin.vx < -7 * gameState.baseSpeed) - coin.vx = -7 * gameState.baseSpeed; - if (coin.vy > 7 * gameState.baseSpeed) coin.vy = 7 * gameState.baseSpeed; - if (coin.vy < -7 * gameState.baseSpeed) - coin.vy = -7 * gameState.baseSpeed; - coin.a += coin.sa; - - // Gravity - if (!gameState.perks.etherealcoins) { - const flip = - gameState.perks.helium > 0 && - Math.abs(coin.x - gameState.puckPosition) * 2 > - gameState.puckWidth + coin.size; - coin.vy += frames * coin.weight * 0.8 * (flip ? -1 : 1); - if (flip && !isOptionOn("basic") && Math.random() < 0.1) { - makeParticle( - gameState, - coin.x, - coin.y, - 0, - gameState.baseSpeed, - coin.color, - true, - 5, - 250, - ); - } - } - - const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10; - const hitBorder = bordersHitCheck(gameState, coin, coin.size / 2, frames); - - if ( - coin.y > gameState.gameZoneHeight - coinRadius - gameState.puckHeight && - coin.y < gameState.gameZoneHeight + gameState.puckHeight + coin.vy && - Math.abs(coin.x - gameState.puckPosition) < - coinRadius + - gameState.puckWidth / 2 + - // a bit of margin to be nice , negative in case it's a negative coin - gameState.puckHeight * (coin.points ? 1 : -1) - ) { - if(coin.points) { - addToScore(gameState, coin); - }else if(gameState.perks.extra_life && gameState.balls.length){ - justLostALife(gameState, gameState.balls[0], coin.x,coin.y) - }else{ - gameOver( - t('gameOver.because_cursed_coin'), - t('gameOver.because_cursed_coin_intro') - ) - } - destroy(gameState.coins, coinIndex); - } else if (coin.y > gameState.canvasHeight + coinRadius) { - destroy(gameState.coins, coinIndex); - if (gameState.perks.compound_interest) { - resetCombo(gameState, coin.x, coin.y); - } - } else if ( - gameState.perks.unbounded && - (coin.x < -gameState.gameZoneWidth / 2 || - coin.x > gameState.canvasWidth + gameState.gameZoneWidth / 2) - ) { - // Out of bound on sides - destroy(gameState.coins, coinIndex); - } - - const hitBrick = coinBrickHitCheck(gameState, coin); - if ( - gameState.perks.metamorphosis && - typeof hitBrick !== "undefined" - ) { - if ( - gameState.bricks[hitBrick] && - coin.color !== gameState.bricks[hitBrick] && - gameState.bricks[hitBrick] !== "black" && - !coin.coloredABrick - ) { - // Not using setbrick because we don't want to reset HP - gameState.bricks[hitBrick] = coin.color; - coin.coloredABrick = true; - - schedulGameSound(gameState, "colorChange", coin.x, 0.3); - } - } - - if ( - (!gameState.perks.ghost_coins && typeof hitBrick !== "undefined") || - hitBorder - ) { - coin.vx *= 0.8; - coin.vy *= 0.8; - coin.sa *= 0.9; - if (speed > 20) { - schedulGameSound(gameState, "coinBounce", coin.x, 0.2); - } - - if (Math.abs(coin.vy) < 3) { - coin.vy = 0; - } - } - }); - - gameState.balls.forEach((ball) => ballTick(gameState, ball, frames)); - - - - if (gameState.perks.shocks) { - gameState.balls.forEach((a, ai) => - gameState.balls.forEach((b, bi) => { - if ( - ai < bi && - !a.destroyed && - !b.destroyed && - distance2(a, b) < gameState.ballSize * gameState.ballSize - ) { - let tempVx = a.vx; - let tempVy = a.vy; - a.vx = b.vx; - a.vy = b.vy; - b.vx = tempVx; - b.vy = tempVy; - - let x = (a.x + b.x) / 2; - let y = (a.y + b.y) / 2; - const limit = gameState.baseSpeed; - a.vx += - clamp(a.x - x, -limit, limit) + - ((Math.random() - 0.5) * limit) / 3; - a.vy += - clamp(a.y - y, -limit, limit) + - ((Math.random() - 0.5) * limit) / 3; - b.vx += - clamp(b.x - x, -limit, limit) + - ((Math.random() - 0.5) * limit) / 3; - b.vy += - clamp(b.y - y, -limit, limit) + - ((Math.random() - 0.5) * limit) / 3; - - let index = brickIndex(x, y); - explosionAt(gameState, index, x, y, a); - } - }), - ); - } - - if (gameState.perks.wind) { - const windD = - ((gameState.puckPosition - - (gameState.offsetX + gameState.gameZoneWidth / 2)) / - gameState.gameZoneWidth) * - 2 * - gameState.perks.wind; - for (let i = 0; i < gameState.perks.wind; i++) { - if (Math.random() * Math.abs(windD) > 0.5) { - makeParticle( - gameState, - gameState.offsetXRoundedDown + - Math.random() * gameState.gameZoneWidthRoundedUp, - Math.random() * gameState.gameZoneHeight, - windD * 8, - 0, - rainbowColor(), - true, - gameState.coinSize / 2, - 150, - ); - } - } - } - forEachLiveOne(gameState.particles, (flash, index) => { - flash.x += flash.vx * frames; - flash.y += flash.vy * frames; - if (!flash.ethereal) { - flash.vy += 0.5; - if (hasBrick(brickIndex(flash.x, flash.y))) { - destroy(gameState.particles, index); - } - } - }); - } - - if ( - gameState.combo > baseCombo(gameState) && - !isOptionOn("basic") && - (gameState.combo - baseCombo(gameState)) * Math.random() > 5 - ) { - // The red should still be visible on a white bg - - if (gameState.perks.top_is_lava) { - makeParticle( - gameState, - gameState.offsetXRoundedDown + - Math.random() * gameState.gameZoneWidthRoundedUp, - 0, - (Math.random() - 0.5) * 10, - 5, - "red", - true, - gameState.coinSize / 2, - 100 * (Math.random() + 1), - ); - } - - if (gameState.perks.left_is_lava) { - makeParticle( - gameState, - gameState.offsetXRoundedDown, - Math.random() * gameState.gameZoneHeight, - 5, - (Math.random() - 0.5) * 10, - "red", - true, - gameState.coinSize / 2, - 100 * (Math.random() + 1), - ); - } - - if (gameState.perks.right_is_lava) { - makeParticle( - gameState, - gameState.offsetXRoundedDown + gameState.gameZoneWidthRoundedUp, - Math.random() * gameState.gameZoneHeight, - -5, - (Math.random() - 0.5) * 10, - "red", - true, - gameState.coinSize / 2, - 100 * (Math.random() + 1), - ); - } - + destroy(gameState.coins, coinIndex); + } else if (coin.y > gameState.canvasHeight + coinRadius) { + destroy(gameState.coins, coinIndex); if (gameState.perks.compound_interest) { - let x = gameState.puckPosition, - attemps = 0; - do { - x = - gameState.offsetXRoundedDown + - gameState.gameZoneWidthRoundedUp * Math.random(); - attemps++; - } while ( - Math.abs(x - gameState.puckPosition) < gameState.puckWidth / 2 && - attemps < 10 - ); + resetCombo(gameState, coin.x, coin.y); + } + } else if ( + gameState.perks.unbounded && + (coin.x < -gameState.gameZoneWidth / 2 || + coin.x > gameState.canvasWidth + gameState.gameZoneWidth / 2) + ) { + // Out of bound on sides + destroy(gameState.coins, coinIndex); + } - makeParticle( - gameState, - x, - gameState.gameZoneHeight, - (Math.random() - 0.5) * 10, - -5, - "red", - true, - gameState.coinSize / 2, - 100 * (Math.random() + 1), - ); + const hitBrick = coinBrickHitCheck(gameState, coin); + if (gameState.perks.metamorphosis && typeof hitBrick !== "undefined") { + if ( + gameState.bricks[hitBrick] && + coin.color !== gameState.bricks[hitBrick] && + gameState.bricks[hitBrick] !== "black" && + !coin.coloredABrick + ) { + // Not using setbrick because we don't want to reset HP + gameState.bricks[hitBrick] = coin.color; + coin.coloredABrick = true; + + schedulGameSound(gameState, "colorChange", coin.x, 0.3); } - if (gameState.perks.streak_shots) { - const pos = 0.5 - Math.random(); - makeParticle( - gameState, - gameState.puckPosition + gameState.puckWidth * pos, - gameState.gameZoneHeight - gameState.puckHeight, - pos * 10, - -5, - "red", - true, - gameState.coinSize / 2, - 100 * (Math.random() + 1), - ); + } + + if ( + (!gameState.perks.ghost_coins && typeof hitBrick !== "undefined") || + hitBorder + ) { + coin.vx *= 0.8; + coin.vy *= 0.8; + coin.sa *= 0.9; + if (speed > 20 && !coin.collidedLastFrame) { + schedulGameSound(gameState, "coinBounce", coin.x, 0.2); } + coin.collidedLastFrame = true; + + if (Math.abs(coin.vy) < 3) { + coin.vy = 0; + } + } else { + coin.collidedLastFrame = false; + } + }); + + gameState.balls.forEach((ball) => ballTick(gameState, ball, frames)); + + if (gameState.perks.shocks) { + gameState.balls.forEach((a, ai) => + gameState.balls.forEach((b, bi) => { + if ( + ai < bi && + !a.destroyed && + !b.destroyed && + distance2(a, b) < gameState.ballSize * gameState.ballSize + ) { + let tempVx = a.vx; + let tempVy = a.vy; + a.vx = b.vx; + a.vy = b.vy; + b.vx = tempVx; + b.vy = tempVy; + + let x = (a.x + b.x) / 2; + let y = (a.y + b.y) / 2; + const limit = gameState.baseSpeed; + a.vx += + clamp(a.x - x, -limit, limit) + + ((Math.random() - 0.5) * limit) / 3; + a.vy += + clamp(a.y - y, -limit, limit) + + ((Math.random() - 0.5) * limit) / 3; + b.vx += + clamp(b.x - x, -limit, limit) + + ((Math.random() - 0.5) * limit) / 3; + b.vy += + clamp(b.y - y, -limit, limit) + + ((Math.random() - 0.5) * limit) / 3; + + let index = brickIndex(x, y); + explosionAt(gameState, index, x, y, a); + } + }), + ); } + if (gameState.perks.wind) { + const windD = + ((gameState.puckPosition - + (gameState.offsetX + gameState.gameZoneWidth / 2)) / + gameState.gameZoneWidth) * + 2 * + gameState.perks.wind; + for (let i = 0; i < gameState.perks.wind; i++) { + if (Math.random() * Math.abs(windD) > 0.5) { + makeParticle( + gameState, + gameState.offsetXRoundedDown + + Math.random() * gameState.gameZoneWidthRoundedUp, + Math.random() * gameState.gameZoneHeight, + windD * 8, + 0, + rainbowColor(), + true, + gameState.coinSize / 2, + 150, + ); + } + } + } + forEachLiveOne(gameState.particles, (flash, index) => { + flash.x += flash.vx * frames; + flash.y += flash.vy * frames; + if (!flash.ethereal) { + flash.vy += 0.5; + if (hasBrick(brickIndex(flash.x, flash.y))) { + destroy(gameState.particles, index); + } + } + }); + } - forEachLiveOne(gameState.particles, (p, pi) => { - if (gameState.levelTime > p.time + p.duration) { - destroy(gameState.particles, pi); - } - }); - forEachLiveOne(gameState.texts, (p, pi) => { - if (gameState.levelTime > p.time + p.duration) { - destroy(gameState.texts, pi); - } - }); - forEachLiveOne(gameState.lights, (p, pi) => { - if (gameState.levelTime > p.time + p.duration) { - destroy(gameState.lights, pi); - } - }); + if ( + gameState.combo > baseCombo(gameState) && + !isOptionOn("basic") && + (gameState.combo - baseCombo(gameState)) * Math.random() > 5 + ) { + // The red should still be visible on a white bg + + if (gameState.perks.top_is_lava) { + makeParticle( + gameState, + gameState.offsetXRoundedDown + + Math.random() * gameState.gameZoneWidthRoundedUp, + 0, + (Math.random() - 0.5) * 10, + 5, + "red", + true, + gameState.coinSize / 2, + 100 * (Math.random() + 1), + ); + } + + if (gameState.perks.left_is_lava) { + makeParticle( + gameState, + gameState.offsetXRoundedDown, + Math.random() * gameState.gameZoneHeight, + 5, + (Math.random() - 0.5) * 10, + "red", + true, + gameState.coinSize / 2, + 100 * (Math.random() + 1), + ); + } + + if (gameState.perks.right_is_lava) { + makeParticle( + gameState, + gameState.offsetXRoundedDown + gameState.gameZoneWidthRoundedUp, + Math.random() * gameState.gameZoneHeight, + -5, + (Math.random() - 0.5) * 10, + "red", + true, + gameState.coinSize / 2, + 100 * (Math.random() + 1), + ); + } + + if (gameState.perks.compound_interest) { + let x = gameState.puckPosition, + attemps = 0; + do { + x = + gameState.offsetXRoundedDown + + gameState.gameZoneWidthRoundedUp * Math.random(); + attemps++; + } while ( + Math.abs(x - gameState.puckPosition) < gameState.puckWidth / 2 && + attemps < 10 + ); + + makeParticle( + gameState, + x, + gameState.gameZoneHeight, + (Math.random() - 0.5) * 10, + -5, + "red", + true, + gameState.coinSize / 2, + 100 * (Math.random() + 1), + ); + } + if (gameState.perks.streak_shots) { + const pos = 0.5 - Math.random(); + makeParticle( + gameState, + gameState.puckPosition + gameState.puckWidth * pos, + gameState.gameZoneHeight - gameState.puckHeight, + pos * 10, + -5, + "red", + true, + gameState.coinSize / 2, + 100 * (Math.random() + 1), + ); + } + } + + forEachLiveOne(gameState.particles, (p, pi) => { + if (gameState.levelTime > p.time + p.duration) { + destroy(gameState.particles, pi); + } + }); + forEachLiveOne(gameState.texts, (p, pi) => { + if (gameState.levelTime > p.time + p.duration) { + destroy(gameState.texts, pi); + } + }); + forEachLiveOne(gameState.lights, (p, pi) => { + if (gameState.levelTime > p.time + p.duration) { + destroy(gameState.lights, pi); + } + }); } export function ballTick(gameState: GameState, ball: Ball, delta: number) { - ball.previousVX = ball.vx; - ball.previousVY = ball.vy; + ball.previousVX = ball.vx; + ball.previousVY = ball.vy; - let speedLimitDampener = - 1 + - gameState.perks.telekinesis + - gameState.perks.ball_repulse_ball + - gameState.perks.puck_repulse_ball + - gameState.perks.ball_attract_ball; + let speedLimitDampener = + 1 + + gameState.perks.telekinesis + + gameState.perks.ball_repulse_ball + + gameState.perks.puck_repulse_ball + + gameState.perks.ball_attract_ball; - if (isTelekinesisActive(gameState, ball)) { - speedLimitDampener += 3; - ball.vx += - ((gameState.puckPosition - ball.x) / 1000) * - delta * - gameState.perks.telekinesis - * interferenceFactor(gameState) - ; - } - if (isYoyoActive(gameState, ball)) { - speedLimitDampener += 3; - ball.vx += - ((gameState.puckPosition - ball.x) / 1000) * delta * gameState.perks.yoyo - * interferenceFactor(gameState); - } - if ( - ball.vx * ball.vx + ball.vy * ball.vy < - gameState.baseSpeed * gameState.baseSpeed * 2 - ) { - ball.vx *= 1 + 0.02 / speedLimitDampener; - ball.vy *= 1 + 0.02 / speedLimitDampener; - } else { - ball.vx *= 1 - 0.02 / speedLimitDampener; - ball.vy *= 1 - 0.02 / speedLimitDampener; - } - // Ball could get stuck horizontally because of ball-ball interactions in repulse/attract - if (Math.abs(ball.vy) < 0.2 * gameState.baseSpeed) { - ball.vy += ((ball.vy > 0 ? 1 : -1) * 0.02) / speedLimitDampener; - } + if (isTelekinesisActive(gameState, ball)) { + speedLimitDampener += 3; + ball.vx += + ((gameState.puckPosition - ball.x) / 1000) * + delta * + gameState.perks.telekinesis * + interferenceFactor(gameState); + } + if (isYoyoActive(gameState, ball)) { + speedLimitDampener += 3; + ball.vx += + ((gameState.puckPosition - ball.x) / 1000) * + delta * + gameState.perks.yoyo * + interferenceFactor(gameState); + } + if ( + ball.vx * ball.vx + ball.vy * ball.vy < + gameState.baseSpeed * gameState.baseSpeed * 2 + ) { + ball.vx *= 1 + 0.02 / speedLimitDampener; + ball.vy *= 1 + 0.02 / speedLimitDampener; + } else { + ball.vx *= 1 - 0.02 / speedLimitDampener; + ball.vy *= 1 - 0.02 / speedLimitDampener; + } + // Ball could get stuck horizontally because of ball-ball interactions in repulse/attract + if (Math.abs(ball.vy) < 0.2 * gameState.baseSpeed) { + ball.vy += ((ball.vy > 0 ? 1 : -1) * 0.02) / speedLimitDampener; + } - if (gameState.perks.ball_repulse_ball) { - for (let b2 of gameState.balls) { - // avoid computing this twice, and repulsing itself - if (b2.x >= ball.x) continue; - repulse(gameState, ball, b2, gameState.perks.ball_repulse_ball, true); - } + if (gameState.perks.ball_repulse_ball) { + for (let b2 of gameState.balls) { + // avoid computing this twice, and repulsing itself + if (b2.x >= ball.x) continue; + repulse(gameState, ball, b2, gameState.perks.ball_repulse_ball, true); } - if (gameState.perks.ball_attract_ball) { - for (let b2 of gameState.balls) { - // avoid computing this twice, and repulsing itself - if (b2.x >= ball.x) continue; - attract(gameState, ball, b2, gameState.perks.ball_attract_ball); - } + } + if (gameState.perks.ball_attract_ball) { + for (let b2 of gameState.balls) { + // avoid computing this twice, and repulsing itself + if (b2.x >= ball.x) continue; + attract(gameState, ball, b2, gameState.perks.ball_attract_ball); } - if ( - gameState.perks.puck_repulse_ball && - Math.abs(ball.x - gameState.puckPosition) < - gameState.puckWidth / 2 + + } + if ( + gameState.perks.puck_repulse_ball && + Math.abs(ball.x - gameState.puckPosition) < + gameState.puckWidth / 2 + (gameState.ballSize * (9 + gameState.perks.puck_repulse_ball)) / 10 - ) { - repulse( - gameState, - ball, - { - x: gameState.puckPosition, - y: gameState.gameZoneHeight, - }, - gameState.perks.puck_repulse_ball + 1, - false, - ); - } - - if ( - gameState.perks.respawn && - ball.hitItem?.length > 1 && - !isOptionOn("basic") - ) { - for ( - let i = 0; - i < ball.hitItem?.length - 1 && i < gameState.perks.respawn; - i++ - ) { - const {index, color} = ball.hitItem[i]; - if (gameState.bricks[index] || color === "black") continue; - const vertical = Math.random() > 0.5; - const dx = Math.random() > 0.5 ? 1 : -1; - const dy = Math.random() > 0.5 ? 1 : -1; - - makeParticle( - gameState, - brickCenterX(gameState, index) + (dx * gameState.brickWidth) / 2, - brickCenterY(gameState, index) + (dy * gameState.brickWidth) / 2, - vertical ? 0 : -dx * gameState.baseSpeed, - vertical ? -dy * gameState.baseSpeed : 0, - color, - true, - gameState.coinSize / 2, - 250, - ); - } - } - - const borderHitCode = bordersHitCheck( - gameState, - ball, - gameState.ballSize / 2, - delta, + ) { + repulse( + gameState, + ball, + { + x: gameState.puckPosition, + y: gameState.gameZoneHeight, + }, + gameState.perks.puck_repulse_ball + 1, + false, ); - if (borderHitCode) { - if ( - gameState.perks.left_is_lava && - borderHitCode % 2 && - ball.x < gameState.offsetX + gameState.gameZoneWidth / 2 - ) { - resetCombo(gameState, ball.x, ball.y); - } + } - if ( - gameState.perks.right_is_lava && - borderHitCode % 2 && - ball.x > gameState.offsetX + gameState.gameZoneWidth / 2 - ) { - resetCombo(gameState, ball.x, ball.y); - } - - if (gameState.perks.top_is_lava && borderHitCode >= 2) { - resetCombo(gameState, ball.x, ball.y + gameState.ballSize); - } - if (gameState.perks.trampoline && borderHitCode >= 2) { - decreaseCombo( - gameState, - gameState.perks.trampoline, - ball.x, - ball.y + gameState.ballSize, - ); - } - - schedulGameSound(gameState, "wallBeep", ball.x, 1); - gameState.levelWallBounces++; - gameState.runStatistics.wall_bounces++; - } - - // Puck collision - const ylimit = - gameState.gameZoneHeight - gameState.puckHeight - gameState.ballSize / 2; - const ballIsUnderPuck = - Math.abs(ball.x - gameState.puckPosition) < - gameState.ballSize / 2 + gameState.puckWidth / 2; - if ( - ball.y > ylimit && - ball.vy > 0 && - (ballIsUnderPuck || - (gameState.perks.extra_life && - ball.y > ylimit + gameState.puckHeight / 2)) + if ( + gameState.perks.respawn && + ball.hitItem?.length > 1 && + !isOptionOn("basic") + ) { + for ( + let i = 0; + i < ball.hitItem?.length - 1 && i < gameState.perks.respawn; + i++ ) { - if (ballIsUnderPuck) { - const speed = Math.sqrt(ball.vx * ball.vx + ball.vy * ball.vy); - const angle = Math.atan2( - -gameState.puckWidth / 2, - (ball.x - gameState.puckPosition) * - (gameState.perks.concave_puck ? -0.5 : 1), - ); - ball.vx = speed * Math.cos(angle); - ball.vy = speed * Math.sin(angle); - schedulGameSound(gameState, "wallBeep", ball.x, 1); - } else { - ball.vy *= -1; - justLostALife(gameState, ball, ball.x,ball.y) + const { index, color } = ball.hitItem[i]; + if (gameState.bricks[index] || color === "black") continue; + const vertical = Math.random() > 0.5; + const dx = Math.random() > 0.5 ? 1 : -1; + const dy = Math.random() > 0.5 ? 1 : -1; - } - if (gameState.perks.streak_shots) { - resetCombo(gameState, ball.x, ball.y); - } - if (gameState.perks.trampoline) { - gameState.combo += gameState.perks.trampoline; - } - if ( - gameState.perks.nbricks && - ball.brokenSinceBounce < gameState.perks.nbricks - ) { - resetCombo(gameState, ball.x, ball.y); - } - - if (gameState.perks.respawn) { - ball.hitItem - .slice(0, -1) - .slice(0, gameState.perks.respawn) - .forEach(({index, color}) => { - if (!gameState.bricks[index] && color !== "black") { - // respawns with full hp - setBrick(gameState, index, color); - } - // gameState.bricks[index] = color; - }); - } - ball.hitItem = []; - if (!ball.hitSinceBounce && gameState.bricks.find((i) => i)) { - gameState.runStatistics.misses++; - if (gameState.perks.forgiving) { - const loss = Math.floor( - (gameState.levelMisses / 10) * - (gameState.combo - baseCombo(gameState)), - ); - decreaseCombo(gameState, loss, ball.x, ball.y - gameState.ballSize); - } else { - resetCombo(gameState, ball.x, ball.y); - } - gameState.levelMisses++; - makeText( - gameState, - gameState.puckPosition, - gameState.gameZoneHeight - gameState.puckHeight * 2, - "red", - t("play.missed_ball"), - gameState.puckHeight, - 500, - ); - } - gameState.runStatistics.puck_bounces++; - ball.hitSinceBounce = 0; - ball.brokenSinceBounce = 0; - ball.sapperUses = 0; - ball.piercePoints = gameState.perks.pierce * 3; + makeParticle( + gameState, + brickCenterX(gameState, index) + (dx * gameState.brickWidth) / 2, + brickCenterY(gameState, index) + (dy * gameState.brickWidth) / 2, + vertical ? 0 : -dx * gameState.baseSpeed, + vertical ? -dy * gameState.baseSpeed : 0, + color, + true, + gameState.coinSize / 2, + 250, + ); } + } - const lostOnSides = - (gameState.perks.unbounded && ball.x < -gameState.gameZoneWidth / 2) || - ball.x > gameState.canvasWidth + gameState.gameZoneWidth / 2; + const borderHitCode = bordersHitCheck( + gameState, + ball, + gameState.ballSize / 2, + delta, + ); + if (borderHitCode) { if ( - gameState.running && - (ball.y > gameState.gameZoneHeight + gameState.ballSize / 2 || lostOnSides) + gameState.perks.left_is_lava && + borderHitCode % 2 && + ball.x < gameState.offsetX + gameState.gameZoneWidth / 2 ) { - ball.destroyed = true; - gameState.runStatistics.balls_lost++; - if (!gameState.balls.find((b) => !b.destroyed)) { - gameOver( - t("gameOver.lost.title"), - t("gameOver.lost.summary", {score: gameState.score}), - ); - } + resetCombo(gameState, ball.x, ball.y); } - const radius = gameState.ballSize / 2; - // Make ball/coin bonce, and return bricks that were hit - const {x, y, previousX, previousY} = ball; - const vhit = hitsSomething(previousX, y, radius); - const hhit = hitsSomething(x, previousY, radius); - const chit = - (typeof vhit == "undefined" && - typeof hhit == "undefined" && - hitsSomething(x, y, radius)) || - undefined; + if ( + gameState.perks.right_is_lava && + borderHitCode % 2 && + ball.x > gameState.offsetX + gameState.gameZoneWidth / 2 + ) { + resetCombo(gameState, ball.x, ball.y); + } - const hitBrick = vhit ?? hhit ?? chit; + if (gameState.perks.top_is_lava && borderHitCode >= 2) { + resetCombo(gameState, ball.x, ball.y + gameState.ballSize); + } + if (gameState.perks.trampoline && borderHitCode >= 2) { + decreaseCombo( + gameState, + gameState.perks.trampoline, + ball.x, + ball.y + gameState.ballSize, + ); + } - if (typeof hitBrick !== "undefined") { - ball.hitSinceBounce++; - let pierce = false; - let damage = - 1 + - (shouldPierceByColor(gameState, vhit, hhit, chit) - ? gameState.perks.pierce_color - : 0); + schedulGameSound(gameState, "wallBeep", ball.x, 1); + gameState.levelWallBounces++; + gameState.runStatistics.wall_bounces++; + } - gameState.brickHP[hitBrick] -= damage; + // Puck collision + const ylimit = + gameState.gameZoneHeight - gameState.puckHeight - gameState.ballSize / 2; + const ballIsUnderPuck = + Math.abs(ball.x - gameState.puckPosition) < + gameState.ballSize / 2 + gameState.puckWidth / 2; + if ( + ball.y > ylimit && + ball.vy > 0 && + (ballIsUnderPuck || + (gameState.perks.extra_life && + ball.y > ylimit + gameState.puckHeight / 2)) + ) { + if (ballIsUnderPuck) { + const speed = Math.sqrt(ball.vx * ball.vx + ball.vy * ball.vy); + const angle = Math.atan2( + -gameState.puckWidth / 2, + (ball.x - gameState.puckPosition) * + (gameState.perks.concave_puck ? -0.5 : 1), + ); + ball.vx = speed * Math.cos(angle); + ball.vy = speed * Math.sin(angle); + schedulGameSound(gameState, "wallBeep", ball.x, 1); + } else { + ball.vy *= -1; + justLostALife(gameState, ball, ball.x, ball.y); + } + if (gameState.perks.streak_shots) { + resetCombo(gameState, ball.x, ball.y); + } + if (gameState.perks.trampoline) { + gameState.combo += gameState.perks.trampoline; + } + if ( + gameState.perks.nbricks && + ball.brokenSinceBounce < gameState.perks.nbricks + ) { + resetCombo(gameState, ball.x, ball.y); + } - const used = Math.min( - ball.piercePoints, - Math.max(1, gameState.brickHP[hitBrick]), + if (gameState.perks.respawn) { + ball.hitItem + .slice(0, -1) + .slice(0, gameState.perks.respawn) + .forEach(({ index, color }) => { + if (!gameState.bricks[index] && color !== "black") { + // respawns with full hp + setBrick(gameState, index, color); + } + // gameState.bricks[index] = color; + }); + } + ball.hitItem = []; + if (!ball.hitSinceBounce && gameState.bricks.find((i) => i)) { + gameState.runStatistics.misses++; + if (gameState.perks.forgiving) { + const loss = Math.floor( + (gameState.levelMisses / 10) * + (gameState.combo - baseCombo(gameState)), ); - gameState.brickHP[hitBrick] -= used; - ball.piercePoints -= used; + decreaseCombo(gameState, loss, ball.x, ball.y - gameState.ballSize); + } else { + resetCombo(gameState, ball.x, ball.y); + } + gameState.levelMisses++; + makeText( + gameState, + gameState.puckPosition, + gameState.gameZoneHeight - gameState.puckHeight * 2, + "red", + t("play.missed_ball"), + gameState.puckHeight, + 500, + ); + } + gameState.runStatistics.puck_bounces++; + ball.hitSinceBounce = 0; + ball.brokenSinceBounce = 0; + ball.sapperUses = 0; + ball.piercePoints = gameState.perks.pierce * 3; + } - if (gameState.brickHP[hitBrick] < 0) { - gameState.brickHP[hitBrick] = 0; - pierce = true; - } - if (typeof vhit !== "undefined" || typeof chit !== "undefined") { - if (!pierce) { - ball.y = ball.previousY; - ball.vy *= -1; - } - } - if (typeof hhit !== "undefined" || typeof chit !== "undefined") { - if (!pierce) { - ball.x = ball.previousX; - ball.vx *= -1; - } - } + const lostOnSides = + (gameState.perks.unbounded && ball.x < -gameState.gameZoneWidth / 2) || + ball.x > gameState.canvasWidth + gameState.gameZoneWidth / 2; + if ( + gameState.running && + (ball.y > gameState.gameZoneHeight + gameState.ballSize / 2 || lostOnSides) + ) { + ball.destroyed = true; + gameState.runStatistics.balls_lost++; + if (!gameState.balls.find((b) => !b.destroyed)) { + gameOver( + t("gameOver.lost.title"), + t("gameOver.lost.summary", { score: gameState.score }), + ); + } + } + const radius = gameState.ballSize / 2; + // Make ball/coin bonce, and return bricks that were hit + const { x, y, previousX, previousY } = ball; - if (!gameState.brickHP[hitBrick]) { - const initialBrickColor = gameState.bricks[hitBrick]; - ball.brokenSinceBounce++; + const vhit = hitsSomething(previousX, y, radius); + const hhit = hitsSomething(x, previousY, radius); + const chit = + (typeof vhit == "undefined" && + typeof hhit == "undefined" && + hitsSomething(x, y, radius)) || + undefined; - explodeBrick(gameState, hitBrick, ball, false); - if ( - ball.sapperUses < gameState.perks.sapper && - initialBrickColor !== "black" && // don't replace a brick that bounced with sturdy_bricks - !gameState.bricks[hitBrick] - ) { - setBrick(gameState, hitBrick, "black"); - ball.sapperUses++; - } - }else{ - schedulGameSound(gameState, 'wallBeep',x,1) - makeLight(gameState, brickCenterX(gameState, hitBrick), - brickCenterY(gameState,hitBrick), "white", gameState.brickWidth+2 , - 50*gameState.brickHP[hitBrick]); - } + const hitBrick = vhit ?? hhit ?? chit; + + if (typeof hitBrick !== "undefined") { + ball.hitSinceBounce++; + let pierce = false; + let damage = + 1 + + (shouldPierceByColor(gameState, vhit, hhit, chit) + ? gameState.perks.pierce_color + : 0); + + gameState.brickHP[hitBrick] -= damage; + + const used = Math.min( + ball.piercePoints, + Math.max(1, gameState.brickHP[hitBrick]), + ); + gameState.brickHP[hitBrick] -= used; + ball.piercePoints -= used; + + if (gameState.brickHP[hitBrick] < 0) { + gameState.brickHP[hitBrick] = 0; + pierce = true; + } + if (typeof vhit !== "undefined" || typeof chit !== "undefined") { + if (!pierce) { + ball.y = ball.previousY; + ball.vy *= -1; + } + } + if (typeof hhit !== "undefined" || typeof chit !== "undefined") { + if (!pierce) { + ball.x = ball.previousX; + ball.vx *= -1; + } } - if (!isOptionOn("basic")) { - const remainingPierce = ball.piercePoints; - const remainingSapper = ball.sapperUses < gameState.perks.sapper; - const extraCombo = gameState.combo - 1; - if ( - (extraCombo && Math.random() > 0.1 / (1 + extraCombo)) || - (remainingSapper && Math.random() > 0.1 / (1 + remainingSapper)) || - (extraCombo && Math.random() > 0.1 / (1 + extraCombo)) - ) { - const color = remainingSapper - ? Math.random() > 0.5 - ? "orange" - : "red" - : gameState.ballsColor; + if (!gameState.brickHP[hitBrick]) { + const initialBrickColor = gameState.bricks[hitBrick]; + ball.brokenSinceBounce++; - makeParticle( - gameState, - ball.x, - ball.y, - gameState.perks.pierce_color || remainingPierce - ? -ball.vx + ((Math.random() - 0.5) * gameState.baseSpeed) / 3 - : (Math.random() - 0.5) * gameState.baseSpeed, - gameState.perks.pierce_color || remainingPierce - ? -ball.vy + ((Math.random() - 0.5) * gameState.baseSpeed) / 3 - : (Math.random() - 0.5) * gameState.baseSpeed, - color, - true, - gameState.coinSize / 2, - 100, - ); - } + explodeBrick(gameState, hitBrick, ball, false); + if ( + ball.sapperUses < gameState.perks.sapper && + initialBrickColor !== "black" && // don't replace a brick that bounced with sturdy_bricks + !gameState.bricks[hitBrick] + ) { + setBrick(gameState, hitBrick, "black"); + ball.sapperUses++; + } + } else { + schedulGameSound(gameState, "wallBeep", x, 1); + makeLight( + gameState, + brickCenterX(gameState, hitBrick), + brickCenterY(gameState, hitBrick), + "white", + gameState.brickWidth + 2, + 50 * gameState.brickHP[hitBrick], + ); } + } + + if (!isOptionOn("basic")) { + const remainingPierce = ball.piercePoints; + const remainingSapper = ball.sapperUses < gameState.perks.sapper; + const extraCombo = gameState.combo - 1; + if ( + (extraCombo && Math.random() > 0.1 / (1 + extraCombo)) || + (remainingSapper && Math.random() > 0.1 / (1 + remainingSapper)) || + (extraCombo && Math.random() > 0.1 / (1 + extraCombo)) + ) { + const color = remainingSapper + ? Math.random() > 0.5 + ? "orange" + : "red" + : gameState.ballsColor; + + makeParticle( + gameState, + ball.x, + ball.y, + gameState.perks.pierce_color || remainingPierce + ? -ball.vx + ((Math.random() - 0.5) * gameState.baseSpeed) / 3 + : (Math.random() - 0.5) * gameState.baseSpeed, + gameState.perks.pierce_color || remainingPierce + ? -ball.vy + ((Math.random() - 0.5) * gameState.baseSpeed) / 3 + : (Math.random() - 0.5) * gameState.baseSpeed, + color, + true, + gameState.coinSize / 2, + 100, + ); + } + } } - function justLostALife(gameState:GameState, ball:Ball, x:number,y:number){ - gameState.perks.extra_life -= 1; - if (gameState.perks.extra_life < 0) { - gameState.perks.extra_life = 0; - } else if (gameState.perks.sacrifice) { - gameState.bricks.forEach( - (color, index) => color && explodeBrick(gameState, index, ball, true), - ); - } +function justLostALife(gameState: GameState, ball: Ball, x: number, y: number) { + gameState.perks.extra_life -= 1; + if (gameState.perks.extra_life < 0) { + gameState.perks.extra_life = 0; + } else if (gameState.perks.sacrifice) { + gameState.bricks.forEach( + (color, index) => color && explodeBrick(gameState, index, ball, true), + ); + } - schedulGameSound(gameState, "lifeLost", ball.x, 1); + schedulGameSound(gameState, "lifeLost", ball.x, 1); - if (!isOptionOn("basic")) { - for (let i = 0; i < 10; i++) - makeParticle( - gameState, - x, - y, - Math.random() * gameState.baseSpeed * 3, - gameState.baseSpeed * 3, - "red", - false, - gameState.coinSize / 2, - 150, - ); - } - } + if (!isOptionOn("basic")) { + for (let i = 0; i < 10; i++) + makeParticle( + gameState, + x, + y, + Math.random() * gameState.baseSpeed * 3, + gameState.baseSpeed * 3, + "red", + false, + gameState.coinSize / 2, + 150, + ); + } +} function makeCoin( - gameState: GameState, - x: number, - y: number, - vx: number, - vy: number, - color = "gold", - points = 1, + gameState: GameState, + x: number, + y: number, + vx: number, + vy: number, + color = "gold", + points = 1, ) { - if (gameState.debuffs.negative_coins *points> Math.random() * 10000) { - points = 0; - color = "crimson"; - } - append(gameState.coins, (p: Partial) => { - p.x = x; - p.y = y; - p.size = gameState.coinSize; - p.previousX = x; - p.previousY = y; - p.vx = vx; - p.vy = vy; - // p.sx = 0; - // p.sy = 0; - p.color = color; - p.a = Math.random() * Math.PI * 2; - p.sa = Math.random() - 0.5; - p.weight = 0.8 + Math.random() * 0.2 + Math.min(2, points * 0.01); - p.points = points; - }); + if (y Math.random() * 10000) { + points = 0; + color = "crimson"; + vx=0 + vy=0 + } + append(gameState.coins, (p: Partial) => { + p.x = x; + p.y = y; + p.collidedLastFrame = true; + p.size = gameState.coinSize; + p.previousX = x; + p.previousY = y; + p.vx = vx; + p.vy = vy; + // p.sx = 0; + // p.sy = 0; + p.color = color; + p.a = Math.random() * Math.PI * 2; + p.sa = Math.random() - 0.5; + p.weight = 0.8 + Math.random() * 0.2 + Math.min(2, points * 0.01); + p.points = points; + }); } -export function interferenceFactor(gameState:GameState){ - if(!gameState.debuffs.interference) return 1 - const cycleLength = (7+gameState.debuffs.interference)*1000 - const position = gameState.levelTime % cycleLength - return position>7000 ? -1 :1 +export function interferenceFactor(gameState: GameState) { + if (!gameState.debuffs.interference) return 1; + const cycleLength = (7 + gameState.debuffs.interference) * 1000; + const position = gameState.levelTime % cycleLength; + return position > 7000 ? -1 : 1; } function makeParticle( - gameState: GameState, - x: number, - y: number, - vx: number, - vy: number, - color: colorString, - ethereal = false, - size = 8, - duration = 150, + gameState: GameState, + x: number, + y: number, + vx: number, + vy: number, + color: colorString, + ethereal = false, + size = 8, + duration = 150, ) { - append(gameState.particles, (p: Partial) => { - p.time = gameState.levelTime; - p.x = x; - p.y = y; - p.vx = vx; - p.vy = vy; - p.color = color; - p.size = size; - p.duration = duration; - p.ethereal = ethereal; - }); + append(gameState.particles, (p: Partial) => { + p.time = gameState.levelTime; + p.x = x; + p.y = y; + p.vx = vx; + p.vy = vy; + p.color = color; + p.size = size; + p.duration = duration; + p.ethereal = ethereal; + }); } function makeText( - gameState: GameState, - x: number, - y: number, - color: colorString, - text: string, - size = 20, - duration = 150, + gameState: GameState, + x: number, + y: number, + color: colorString, + text: string, + size = 20, + duration = 150, ) { - append(gameState.texts, (p: Partial) => { - p.time = gameState.levelTime; - p.x = x; - p.y = y; - p.color = color; - p.size = size; - p.duration = duration; - p.text = text; - }); + append(gameState.texts, (p: Partial) => { + p.time = gameState.levelTime; + p.x = x; + p.y = y; + p.color = color; + p.size = size; + p.duration = duration; + p.text = text; + }); } function makeLight( - gameState: GameState, - x: number, - y: number, - color: colorString, - size = 8, - duration = 150, + gameState: GameState, + x: number, + y: number, + color: colorString, + size = 8, + duration = 150, ) { - append(gameState.lights, (p: Partial) => { - p.time = gameState.levelTime; - p.x = x; - p.y = y; - p.color = color; - p.size = size; - p.duration = duration; - }); + append(gameState.lights, (p: Partial) => { + p.time = gameState.levelTime; + p.x = x; + p.y = y; + p.color = color; + p.size = size; + p.duration = duration; + }); } export function append( - where: ReusableArray, - makeItem: (match: Partial) => void, + where: ReusableArray, + makeItem: (match: Partial) => void, ) { - while ( - where.list[where.indexMin] && - !where.list[where.indexMin].destroyed && - where.indexMin < where.list.length - ) { - where.indexMin++; - } - if (where.indexMin < where.list.length) { - where.list[where.indexMin].destroyed = false; - makeItem(where.list[where.indexMin]); - where.indexMin++; - } else { - const p = {destroyed: false}; - makeItem(p); - where.list.push(p); - } - where.total++; + while ( + where.list[where.indexMin] && + !where.list[where.indexMin].destroyed && + where.indexMin < where.list.length + ) { + where.indexMin++; + } + if (where.indexMin < where.list.length) { + where.list[where.indexMin].destroyed = false; + makeItem(where.list[where.indexMin]); + where.indexMin++; + } else { + const p = { destroyed: false }; + makeItem(p); + where.list.push(p); + } + where.total++; } export function destroy(where: ReusableArray, index: number) { - if (where.list[index].destroyed) return; - where.list[index].destroyed = true; - where.indexMin = Math.min(where.indexMin, index); - where.total--; + if (where.list[index].destroyed) return; + where.list[index].destroyed = true; + where.indexMin = Math.min(where.indexMin, index); + where.total--; } export function liveCount(where: ReusableArray) { - return where.total; + return where.total; } export function empty(where: ReusableArray) { - where.total = 0; - where.indexMin = 0; - where.list.forEach((i) => (i.destroyed = true)); + where.total = 0; + where.indexMin = 0; + where.list.forEach((i) => (i.destroyed = true)); } export function forEachLiveOne( - where: ReusableArray, - cb: (t: T, index: number) => void, + where: ReusableArray, + cb: (t: T, index: number) => void, ) { - where.list.forEach((item: T, index: number) => { - if (item && !item.destroyed) { - cb(item, index); - } - }); + where.list.forEach((item: T, index: number) => { + if (item && !item.destroyed) { + cb(item, index); + } + }); } diff --git a/src/game_utils.ts b/src/game_utils.ts index 54187ce..2e5bb3e 100644 --- a/src/game_utils.ts +++ b/src/game_utils.ts @@ -1,7 +1,7 @@ import { Ball, GameState, PerkId, PerksMap } from "./types"; import { icons, upgrades } from "./loadGameData"; import { t } from "./i18n/i18n"; -import {debuffs} from "./debuffs"; +import { debuffs } from "./debuffs"; export function getMajorityValue(arr: string[]): string { const count: { [k: string]: number } = {}; @@ -55,7 +55,6 @@ export function getPossibleUpgrades(gameState: GameState) { } export function max_levels(gameState: GameState) { - return 7 + gameState.perks.extra_levels; } @@ -70,10 +69,15 @@ export function pickedUpgradesHTMl(gameState: GameState) { return `

${t("score_panel.upgrades_picked")}

${list}

`; } - -export function debuffsHTMl(gameState: GameState):string { - const banned = upgrades.filter(u=>gameState.bannedPerks[u.id]).map(u=>u.name).join(', ') - let list = debuffs.filter(d=>gameState.debuffs[d.id]).map(d=>d.name(gameState.debuffs[d.id], banned)).join(' '); +export function debuffsHTMl(gameState: GameState): string { + const banned = upgrades + .filter((u) => gameState.bannedPerks[u.id]) + .map((u) => u.name) + .join(", "); + let list = debuffs + .filter((d) => gameState.debuffs[d.id]) + .map((d) => d.name(gameState.debuffs[d.id], banned)) + .join(" "); if (!list) return ""; return `

${t("score_panel.bebuffs_list")} ${list}

`; diff --git a/src/i18n/b71.babel b/src/i18n/b71.babel index 9a5ee06..a10fce1 100644 --- a/src/i18n/b71.babel +++ b/src/i18n/b71.babel @@ -202,6 +202,26 @@ + + sturdiness + + + help + + + + + en-US + false + + + fr-FR + false + + + + + @@ -470,6 +490,21 @@ + + loops + + + + + en-US + false + + + fr-FR + false + + + total_score @@ -787,6 +822,21 @@ loop + + converted_rerolls + + + + + en-US + false + + + fr-FR + false + + + instructions @@ -802,6 +852,21 @@ + + no_rerolls + + + + + en-US + false + + + fr-FR + false + + + title diff --git a/src/i18n/en.json b/src/i18n/en.json index aff946c..aa3eb0e 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -9,6 +9,7 @@ "debuffs.interference.help": "Telekinesis and yo-yo glitch for {{lvl}}s every 7s.", "debuffs.more_bombs.help": "{{lvl}} bricks replaced by bombs.", "debuffs.negative_coins.help": "{{lvl}}/10000 of coins spawn cursed, blinking red. Game over if you catch them.", + "debuffs.sturdiness.help": "All bricks have +{{lvl}} HP", "gameOver.because_cursed_coin": "Game over", "gameOver.because_cursed_coin_intro": "You cough a cursed coin (bright red coins) and didn't have a extra life to spare. ", "gameOver.cumulative_total": "Your total cumulative score went from {{startTs}} to {{endTs}}.", @@ -26,6 +27,7 @@ "gameOver.stats.hit_rate": "Hit rate", "gameOver.stats.intro": "Find below your run statistics compared to your {{count}} best runs.", "gameOver.stats.level_reached": "Level reached", + "gameOver.stats.loops": "Loops", "gameOver.stats.total_score": "Total score", "gameOver.stats.upgrades_applied": "Upgrades applied", "gameOver.test_run": "This test run and its score are not being recorded", @@ -46,7 +48,9 @@ "level_up.unlocked_level": " (Level)", "level_up.unlocked_perk": " (Perk)", "level_up.upgrade_perk_to_level": " lvl {{level}}", + "loop.converted_rerolls": "Your {{n}} leftover re-rolls where converted to +{{n}} base combo.", "loop.instructions": "All your perks will be erased except one that you can pick below. Each option comes with an additional hazard will appear on all levels going forward. ", + "loop.no_rerolls": "You didn't have any leftover re-rolls, so your base combo stayed the same. ", "loop.title": "Starting loop {{loop}}", "main_menu.basic": "Basic graphics", "main_menu.basic_help": "Better performance.", diff --git a/src/i18n/fr.json b/src/i18n/fr.json index 6944318..64af373 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -9,6 +9,7 @@ "debuffs.interference.help": "Télékinésie et problème de yo-yo pendant {{lvl}}s toutes les 7 s.", "debuffs.more_bombs.help": "{{lvl}} briques remplacées par des bombes.", "debuffs.negative_coins.help": "{{lvl}}/10000 pièces apparaissent maudites et clignotent en rouge. La partie est terminée si vous les attrapez.", + "debuffs.sturdiness.help": "Toutes les briques résistent à +{{lvl}} chocs", "gameOver.because_cursed_coin": "Jeu terminé", "gameOver.because_cursed_coin_intro": "Vous avez craché une pièce maudite (pièces rouge vif) et vous n'aviez pas de vie supplémentaire à revendre.", "gameOver.cumulative_total": "Votre score total cumulé est passé de {{startTs}} à {{endTs}}.", @@ -26,6 +27,7 @@ "gameOver.stats.hit_rate": "Précision", "gameOver.stats.intro": "Vous trouverez ci-dessous les statistiques de cette partie comparées à vos {{count}} meilleures parties.", "gameOver.stats.level_reached": "Niveau atteint", + "gameOver.stats.loops": "Boucles", "gameOver.stats.total_score": "Score total", "gameOver.stats.upgrades_applied": "Mises à jour appliquées", "gameOver.test_run": "Cette partie de test et son score ne sont pas enregistrés.", @@ -46,7 +48,9 @@ "level_up.unlocked_level": " (Niveau)", "level_up.unlocked_perk": " (Amélioration)", "level_up.upgrade_perk_to_level": " niveau {{level}}", + "loop.converted_rerolls": "", "loop.instructions": "Tous vos avantages seront supprimés, sauf un que vous pouvez choisir ci-dessous. Chaque option comporte un danger supplémentaire qui apparaîtra à tous les niveaux.", + "loop.no_rerolls": "", "loop.title": "Boucle de départ {{loop}}", "main_menu.basic": "Graphismes simplifiés", "main_menu.basic_help": "Meilleures performances.", diff --git a/src/loadGameData.ts b/src/loadGameData.ts index a182277..c603d59 100644 --- a/src/loadGameData.ts +++ b/src/loadGameData.ts @@ -45,5 +45,5 @@ export const allLevels = rawLevelsList export const upgrades = rawUpgrades.map((u) => ({ ...u, - icon: icons["icon:" + u.id] + icon: icons["icon:" + u.id], })) as Upgrade[]; diff --git a/src/newGameState.ts b/src/newGameState.ts index e0d836e..6d40ecb 100644 --- a/src/newGameState.ts +++ b/src/newGameState.ts @@ -11,10 +11,9 @@ import { dontOfferTooSoon, resetBalls } from "./gameStateMutators"; import { isOptionOn } from "./options"; import { debuffs } from "./debuffs"; - -export function getRunLevels(totalScoreAtRunStart:number, params: RunParams){ - const firstLevel = - params?.level ? allLevels.filter((l) => l.name === params?.level) +export function getRunLevels(totalScoreAtRunStart: number, params: RunParams) { + const firstLevel = params?.level + ? allLevels.filter((l) => l.name === params?.level) : []; const restInRandomOrder = allLevels @@ -23,7 +22,7 @@ export function getRunLevels(totalScoreAtRunStart:number, params: RunParams){ .filter((l) => l.name !== params?.levelToAvoid) .sort(() => Math.random() - 0.5); -return firstLevel.concat( + return firstLevel.concat( restInRandomOrder.slice(0, 7 + 3).sort((a, b) => a.sortKey - b.sortKey), ); } @@ -31,7 +30,7 @@ return firstLevel.concat( export function newGameState(params: RunParams): GameState { const totalScoreAtRunStart = getTotalScore(); - const runLevels =getRunLevels(totalScoreAtRunStart, params) + const runLevels = getRunLevels(totalScoreAtRunStart, params); const perks = { ...makeEmptyPerksMap(upgrades), ...(params?.perks || {}) }; @@ -41,7 +40,7 @@ export function newGameState(params: RunParams): GameState { currentLevel: 0, upgradesOfferedFor: -1, perks, - bannedPerks:makeEmptyPerksMap(upgrades), + bannedPerks: makeEmptyPerksMap(upgrades), debuffs: { ...emptyDebuffsMap(), ...(params?.debuffs || {}) }, puckWidth: 200, baseSpeed: 12, @@ -110,7 +109,8 @@ export function newGameState(params: RunParams): GameState { autoCleanUses: 0, ...defaultSounds(), rerolls: 0, - loop:0 + loop: 0, + baseCombo: 1, }; resetBalls(gameState); diff --git a/src/premium.ts b/src/premium.ts index b81acf5..15655fb 100644 --- a/src/premium.ts +++ b/src/premium.ts @@ -1,9 +1,9 @@ -import {GameState} from "./types"; -import {icons} from "./loadGameData"; -import {t} from "./i18n/i18n"; -import {getSettingValue, setSettingValue} from "./settings"; -import {asyncAlert} from "./asyncAlert"; -import {openMainMenu} from "./game"; +import { GameState } from "./types"; +import { icons } from "./loadGameData"; +import { t } from "./i18n/i18n"; +import { getSettingValue, setSettingValue } from "./settings"; +import { asyncAlert } from "./asyncAlert"; +import { openMainMenu } from "./game"; const publicKeyString = `-----BEGIN PUBLIC KEY----- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyGQJgs6gxa0Fd86TuZ2q @@ -21,49 +21,49 @@ dZpWPx3O+rZbRQb0gHcvN4+n2Y7fWAeC9mxVZtADqvVr/GTumMbLj7DdhWtt1Ogu -----END PUBLIC KEY-----`; function pemToArrayBuffer(pem: string) { - const b64 = pem - .replace(/-----BEGIN PUBLIC KEY-----/, "") - .replace(/-----END PUBLIC KEY-----/, "") - .replace(/\s+/g, ""); - const binaryDerString = atob(b64); - const binaryDer = new Uint8Array(binaryDerString.length); - for (let i = 0; i < binaryDerString.length; i++) { - binaryDer[i] = binaryDerString.charCodeAt(i); - } - return binaryDer.buffer; + const b64 = pem + .replace(/-----BEGIN PUBLIC KEY-----/, "") + .replace(/-----END PUBLIC KEY-----/, "") + .replace(/\s+/g, ""); + const binaryDerString = atob(b64); + const binaryDer = new Uint8Array(binaryDerString.length); + for (let i = 0; i < binaryDerString.length; i++) { + binaryDer[i] = binaryDerString.charCodeAt(i); + } + return binaryDer.buffer; } async function getPriceId(key: string, pem: string) { - // Split the key into its components - const [priceId, timestamp, signature] = key.split(":"); - const data = `${priceId}:${timestamp}`; + // Split the key into its components + const [priceId, timestamp, signature] = key.split(":"); + const data = `${priceId}:${timestamp}`; - const publicKeyBuffer = pemToArrayBuffer(pem); + const publicKeyBuffer = pemToArrayBuffer(pem); - const publicKey = await crypto.subtle.importKey( - "spki", - publicKeyBuffer, - { - name: "RSA-PSS", - hash: "SHA-256", - }, - true, - ["verify"], - ); + const publicKey = await crypto.subtle.importKey( + "spki", + publicKeyBuffer, + { + name: "RSA-PSS", + hash: "SHA-256", + }, + true, + ["verify"], + ); - // Verify the signature using ECDSA - const isValid = await crypto.subtle.verify( - { - name: "RSA-PSS", - saltLength: 32, - }, - publicKey, - new Uint8Array(Array.from(atob(signature), (c) => c.charCodeAt(0))), - new TextEncoder().encode(data), - ); - if (!isValid) throw new Error("Invalid key signature"); + // Verify the signature using ECDSA + const isValid = await crypto.subtle.verify( + { + name: "RSA-PSS", + saltLength: 32, + }, + publicKey, + new Uint8Array(Array.from(atob(signature), (c) => c.charCodeAt(0))), + new TextEncoder().encode(data), + ); + if (!isValid) throw new Error("Invalid key signature"); - return priceId; + return priceId; } let premium = false; @@ -71,116 +71,113 @@ const gamePriceId = "price_1R6YaEGRf74lr2EkSo2GPvuO"; checkKey(getSettingValue("license", "")).then(); async function checkKey(key: string) { - if (!key) return "No key"; - try { - if (gamePriceId !== (await getPriceId(key, publicKeyString))) { - return "Wrong product"; - } - premium = true; - return ""; - } catch (e) { - return "Could not upgrade : " + e.message; + if (!key) return "No key"; + try { + if (gamePriceId !== (await getPriceId(key, publicKeyString))) { + return "Wrong product"; } + premium = true; + return ""; + } catch (e) { + return "Could not upgrade : " + e.message; + } } export function isPremium() { - return premium; + return premium; } export function premiumMenuEntry(gameState: GameState) { - if (isPremium()) { - return { - icon: icons["icon:premium_active"], - text: t("premium.thanks"), - help: t("premium.thanks_help"), - value: async () => { - navigator.clipboard.writeText(getSettingValue('license', '')) - openMainMenu() - }, - }; - } - - let text = t("premium.title") - let help = t("premium.buy") - try { - const timePlayed = localStorage.getItem('breakout_71_total_play_time') - if (timePlayed && !isGooglePlayInstall) { - const hours = parseFloat(timePlayed) / 1000 / 60 / 60 - const pricePerHours = 4.99 / hours - const args = { - hours: Math.floor(hours), - pricePerHours: pricePerHours.toFixed(2) - } - if (pricePerHours > 0 && pricePerHours < 0.5) { - text = t("premium.per_hours", args) - help = t("premium.per_hours_help", args) - } - - console.log({args}) - } - } catch (e) { - console.warn(e) - } - + if (isPremium()) { return { - icon: icons["icon:premium"], - text, - help, - value: () => openPremiumMenu(""), + icon: icons["icon:premium_active"], + text: t("premium.thanks"), + help: t("premium.thanks_help"), + value: async () => { + navigator.clipboard.writeText(getSettingValue("license", "")); + openMainMenu(); + }, }; + } + + let text = t("premium.title"); + let help = t("premium.buy"); + try { + const timePlayed = localStorage.getItem("breakout_71_total_play_time"); + if (timePlayed && !isGooglePlayInstall) { + const hours = parseFloat(timePlayed) / 1000 / 60 / 60; + const pricePerHours = 4.99 / hours; + const args = { + hours: Math.floor(hours), + pricePerHours: pricePerHours.toFixed(2), + }; + if (pricePerHours > 0 && pricePerHours < 0.5) { + text = t("premium.per_hours", args); + help = t("premium.per_hours_help", args); + } + + console.log({ args }); + } + } catch (e) { + console.warn(e); + } + + return { + icon: icons["icon:premium"], + text, + help, + value: () => openPremiumMenu(""), + }; } const isGooglePlayInstall = - new URLSearchParams(location.search).get("source") === - "com.android.vending"; + new URLSearchParams(location.search).get("source") === "com.android.vending"; async function openPremiumMenu(text) { + const cb = await asyncAlert({ + title: t("premium.title"), + content: [ + text || + (isGooglePlayInstall && t("premium.help_google")) || + t("premium.help"), + { + text: t("premium.buy"), + disabled: isGooglePlayInstall, + help: isGooglePlayInstall + ? t("premium.buy_disabled_help") + : t("premium.buy_help"), + value() { + window.open( + "https://licenses.lecaro.me/buy/price_1R6YaEGRf74lr2EkSo2GPvuO", + "_blank", + ); + }, + }, + { + text: t("premium.enter"), + help: t("premium.enter_help"), + async value() { + const value = ( + prompt("Please paste your license key") || "" + )?.replace(/\s+/g, ""); - - const cb = await asyncAlert({ - title: t("premium.title"), - content: [ - text || - (isGooglePlayInstall && t("premium.help_google")) || - t("premium.help"), - { - text: t("premium.buy"), - disabled: isGooglePlayInstall, - help: isGooglePlayInstall - ? t("premium.buy_disabled_help") - : t("premium.buy_help"), - value() { - window.open( - "https://licenses.lecaro.me/buy/price_1R6YaEGRf74lr2EkSo2GPvuO", - "_blank", - ); - }, - }, - { - text: t("premium.enter"), - help: t("premium.enter_help"), - async value() { - const value = (prompt("Please paste your license key") || "").replace( - /\s+/g, - "", - ); - const problem = await checkKey(value); - if (problem) { - openPremiumMenu(problem).then(); - } else { - setSettingValue("license", value); - openMainMenu().then(); - } - }, - }, - { - text: t("premium.back"), - help: t("premium.back_help"), - value() { - openMainMenu().then(); - }, - }, - ], - }); - if (cb) cb(); + const problem = await checkKey(value || ""); + if (problem) { + openPremiumMenu(problem).then(); + } else { + setSettingValue("license", value); + openMainMenu().then(); + } + }, + }, + { + text: t("premium.back"), + help: t("premium.back_help"), + value() { + openMainMenu().then(); + }, + }, + ], + }); + if (cb) cb(); } diff --git a/src/recording.ts b/src/recording.ts index 8c97927..3ef8a76 100644 --- a/src/recording.ts +++ b/src/recording.ts @@ -52,9 +52,7 @@ export function drawMainCanvasOnSmallCanvas(gameState: GameState) { recordCanvasCtx.textAlign = "left"; recordCanvasCtx.fillText( - "Level " + - (gameState.currentLevel + 1) + - "/" + max_levels(gameState), + "Level " + (gameState.currentLevel + 1) + "/" + max_levels(gameState), 12, 12, ); diff --git a/src/render.ts b/src/render.ts index e060630..143432b 100644 --- a/src/render.ts +++ b/src/render.ts @@ -1,27 +1,32 @@ -import {baseCombo, forEachLiveOne, interferenceFactor, liveCount} from "./gameStateMutators"; import { - brickCenterX, - brickCenterY, - countBricksAbove, - countBricksBelow, - currentLevelInfo, - isTelekinesisActive, - isYoyoActive, - max_levels, + baseCombo, + forEachLiveOne, + interferenceFactor, + liveCount, +} from "./gameStateMutators"; +import { + brickCenterX, + brickCenterY, + countBricksAbove, + countBricksBelow, + currentLevelInfo, + isTelekinesisActive, + isYoyoActive, + max_levels, } from "./game_utils"; -import {colorString, GameState} from "./types"; -import {t} from "./i18n/i18n"; -import {gameState} from "./game"; -import {isOptionOn} from "./options"; +import { colorString, GameState } from "./types"; +import { t } from "./i18n/i18n"; +import { gameState } from "./game"; +import { isOptionOn } from "./options"; export const gameCanvas = document.getElementById("game") as HTMLCanvasElement; export const ctx = gameCanvas.getContext("2d", { - alpha: false, + alpha: false, }) as CanvasRenderingContext2D; export const bombSVG = document.createElement("img"); bombSVG.src = - "data:image/svg+xml;base64," + - btoa(` + "data:image/svg+xml;base64," + + btoa(` `); @@ -29,959 +34,950 @@ export const background = document.createElement("img"); export const backgroundCanvas = document.createElement("canvas"); export function render(gameState: GameState) { - const level = currentLevelInfo(gameState); + const level = currentLevelInfo(gameState); - const hasCombo = gameState.combo > baseCombo(gameState); - const {width, height} = gameCanvas; - if (!width || !height) return; + const hasCombo = gameState.combo > baseCombo(gameState); + const { width, height } = gameCanvas; + if (!width || !height) return; - if (gameState.currentLevel || gameState.levelTime) { - menuLabel.innerText = gameState.loop ? t("play.current_lvl_loop", { - level: gameState.currentLevel + 1, - max: max_levels(gameState), - loop: gameState.loop - }) : t("play.current_lvl", { - level: gameState.currentLevel + 1, - max: max_levels(gameState), + if (gameState.currentLevel || gameState.levelTime) { + menuLabel.innerText = gameState.loop + ? t("play.current_lvl_loop", { + level: gameState.currentLevel + 1, + max: max_levels(gameState), + loop: gameState.loop, + }) + : t("play.current_lvl", { + level: gameState.currentLevel + 1, + max: max_levels(gameState), }); - } else { - menuLabel.innerText = t("play.menu_label"); - } - scoreDisplay.innerText = `$${gameState.score}`; + } else { + menuLabel.innerText = t("play.menu_label"); + } + scoreDisplay.innerText = `$${gameState.score}`; - scoreDisplay.className = - gameState.lastScoreIncrease > gameState.levelTime - 500 ? "active" : ""; + scoreDisplay.className = + gameState.lastScoreIncrease > gameState.levelTime - 500 ? "active" : ""; - // Clear - if (!isOptionOn("basic") && !level.color && level.svg) { - // Without this the light trails everything - ctx.globalCompositeOperation = "source-over"; - ctx.globalAlpha = 1; - ctx.fillStyle = "#000"; - ctx.fillRect(0, 0, width, height); - - ctx.globalCompositeOperation = "screen"; - ctx.globalAlpha = 0.6; - - forEachLiveOne(gameState.coins, (coin) => { - drawFuzzyBall(ctx, coin.color, gameState.coinSize * 2, coin.x, coin.y); - }); - gameState.balls.forEach((ball) => { - drawFuzzyBall( - ctx, - gameState.ballsColor, - gameState.ballSize * 2, - ball.x, - ball.y, - ); - }); - ctx.globalAlpha = 0.5; - gameState.bricks.forEach((color, index) => { - if (!color) return; - const x = brickCenterX(gameState, index), - y = brickCenterY(gameState, index); - drawFuzzyBall( - ctx, - color == "black" ? "#666" : color, - gameState.brickWidth, - x, - y, - ); - }); - ctx.globalAlpha = 1; - - forEachLiveOne(gameState.particles, (flash) => { - const {x, y, time, color, size, duration} = flash; - const elapsed = gameState.levelTime - time; - ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2); - drawFuzzyBall(ctx, color, size * 3, x, y); - }); - - // Decides how brights the bg black parts can get - ctx.globalAlpha = 0.2; - ctx.globalCompositeOperation = "multiply"; - ctx.fillStyle = "black"; - ctx.fillRect(0, 0, width, height); - // Decides how dark the background black parts are when lit (1=black) - ctx.globalAlpha = 0.8; - ctx.globalCompositeOperation = "multiply"; - if (level.svg && background.width && background.complete) { - if (backgroundCanvas.title !== level.name) { - backgroundCanvas.title = level.name; - backgroundCanvas.width = gameState.canvasWidth; - backgroundCanvas.height = gameState.canvasHeight; - const bgctx = backgroundCanvas.getContext( - "2d", - ) as CanvasRenderingContext2D; - bgctx.fillStyle = level.color || "#000"; - bgctx.fillRect(0, 0, gameState.canvasWidth, gameState.canvasHeight); - const pattern = ctx.createPattern(background, "repeat"); - if (pattern) { - bgctx.fillStyle = pattern; - bgctx.fillRect(0, 0, width, height); - } - } - - ctx.drawImage(backgroundCanvas, 0, 0); - } else { - // Background not loaded yes - ctx.fillStyle = "#000"; - ctx.fillRect(0, 0, width, height); - } - } else { - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = "source-over"; - ctx.fillStyle = level.color || "#000"; - ctx.fillRect(0, 0, width, height); - forEachLiveOne(gameState.particles, (flash) => { - const {x, y, time, color, size, duration} = flash; - const elapsed = gameState.levelTime - time; - ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2); - drawBall(ctx, color, size, x, y); - }); - } - - ctx.globalAlpha = 1; + // Clear + if (!isOptionOn("basic") && !level.color && level.svg) { + // Without this the light trails everything ctx.globalCompositeOperation = "source-over"; - const lastExplosionDelay = Date.now() - gameState.lastExplosion + 5; - const shaked = lastExplosionDelay < 200 && !isOptionOn("basic"); - if (shaked) { - const amplitude = - ((gameState.perks.bigger_explosions + 1) * 50) / lastExplosionDelay; - ctx.translate( - Math.sin(Date.now()) * amplitude, - Math.sin(Date.now() + 36) * amplitude, - ); - } - if (gameState.perks.bigger_explosions && !isOptionOn("basic") && shaked) { - gameCanvas.style.filter = - "brightness(" + (1 + 100 / (1 + lastExplosionDelay)) + ")"; - } else { - gameCanvas.style.filter = ""; - } - // Coins ctx.globalAlpha = 1; + ctx.fillStyle = "#000"; + ctx.fillRect(0, 0, width, height); + + ctx.globalCompositeOperation = "screen"; + ctx.globalAlpha = 0.6; + forEachLiveOne(gameState.coins, (coin) => { - ctx.globalCompositeOperation = 'source-over' - // ctx.globalCompositeOperation = - // coin.color === "gold" || level.color ? "source-over" : "screen"; - drawCoin( - ctx, - coin.color, - coin.size, - coin.x, - coin.y, - (hasCombo && gameState.perks.asceticism && "red") || - (!coin.points && "red") || - level.color || - "black", - coin.a, - ); + drawFuzzyBall(ctx, coin.color, gameState.coinSize * 2, coin.x, coin.y); }); - - // Black shadow around balls - if (!isOptionOn("basic")) { - ctx.globalCompositeOperation = "source-over"; - ctx.globalAlpha = Math.min(0.8, liveCount(gameState.coins) / 20); - gameState.balls.forEach((ball) => { - drawBall( - ctx, - level.color || "#000", - gameState.ballSize * 6, - ball.x, - ball.y, - ); - }); - - if (gameState.debuffs.negative_coins) { - // Render crimson coins very bright - ctx.globalCompositeOperation = 'source-over' - ctx.globalAlpha = 0.8 - const red = Math.floor(gameState.levelTime / 100) % 2 > 0 - forEachLiveOne(gameState.coins, (coin) => { - if (coin.color !== 'crimson') return - drawBall( - ctx, - red ? 'red' : 'black', - coin.size * 3, - coin.x, - coin.y - ); - }); - ctx.globalAlpha = 1 - forEachLiveOne(gameState.coins, (coin) => { - if (coin.color !== 'crimson') return - drawCoin( - ctx, - !red ? 'red' : 'black', - coin.size, - coin.x, - coin.y, - 'red', - coin.a - ); - }); - } - - } - - - ctx.globalCompositeOperation = "source-over"; - renderAllBricks(); - - - ctx.globalCompositeOperation = "screen"; - forEachLiveOne(gameState.lights, (flash) => { - const {x, y, time, color, size, duration} = flash; - const elapsed = gameState.levelTime - time; - ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2) * 0.5; - drawBrick(ctx, color, x, y, -1) - }); - - ctx.globalCompositeOperation = "screen"; - forEachLiveOne(gameState.texts, (flash) => { - const {x, y, time, color, size, duration} = flash; - const elapsed = gameState.levelTime - time; - ctx.globalAlpha = Math.max(0, Math.min(1, 2 - (elapsed / duration) * 2)); - ctx.globalCompositeOperation = "source-over"; - drawText(ctx, flash.text, color, size, x, y - elapsed / 10); - }); - - forEachLiveOne(gameState.particles, (particle) => { - const {x, y, time, color, size, duration} = particle; - const elapsed = gameState.levelTime - time; - ctx.globalAlpha = Math.max(0, Math.min(1, 2 - (elapsed / duration) * 2)); - ctx.globalCompositeOperation = "screen"; - drawBall(ctx, color, size, x, y); - drawFuzzyBall(ctx, color, size, x, y); - }); - - if (gameState.perks.extra_life) { - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = "source-over"; - ctx.fillStyle = gameState.puckColor; - for (let i = 0; i < gameState.perks.extra_life; i++) { - ctx.fillRect( - gameState.perks.unbounded ? 0 : gameState.offsetXRoundedDown, - gameState.gameZoneHeight - gameState.puckHeight / 2 + 2 * i, - gameState.perks.unbounded - ? gameState.canvasWidth - : gameState.gameZoneWidthRoundedUp, - 1, - ); - } - } - - ctx.globalAlpha = 1; - ctx.globalCompositeOperation = "source-over"; - gameState.balls.forEach((ball) => { - const drawingColor = gameState.ballsColor; - - // The white border around is to distinguish colored balls from coins/bg - drawBall( - ctx, - drawingColor, - gameState.ballSize, - ball.x, - ball.y, - gameState.puckColor, - ); - - if (isTelekinesisActive(gameState, ball) || isYoyoActive(gameState, ball)) { - - ctx.beginPath(); - ctx.moveTo(gameState.puckPosition, gameState.gameZoneHeight); - if (interferenceFactor(gameState) == -1) { - ctx.lineWidth = 2 - ctx.strokeStyle = 'red' - ctx.setLineDash(redBorderDash) - ctx.lineDashOffset = getDashOffset(gameState) - - } else { - ctx.strokeStyle = gameState.puckColor; - } - ctx.bezierCurveTo( - gameState.puckPosition, - gameState.gameZoneHeight, - gameState.puckPosition, - ball.y, - ball.x, - ball.y, - ); - ctx.stroke(); - - ctx.lineWidth = 2 - ctx.setLineDash(emptyArray) - } - if (gameState.perks.clairvoyant && gameState.ballStickToPuck) { - ctx.strokeStyle = gameState.ballsColor; - ctx.beginPath(); - ctx.moveTo(ball.x, ball.y); - ctx.lineTo(ball.x + ball.vx * 10, ball.y + ball.vy * 10); - ctx.stroke(); - } + drawFuzzyBall( + ctx, + gameState.ballsColor, + gameState.ballSize * 2, + ball.x, + ball.y, + ); }); - // The puck + ctx.globalAlpha = 0.5; + gameState.bricks.forEach((color, index) => { + if (!color) return; + const x = brickCenterX(gameState, index), + y = brickCenterY(gameState, index); + drawFuzzyBall( + ctx, + color == "black" ? "#666" : color, + gameState.brickWidth, + x, + y, + ); + }); + ctx.globalAlpha = 1; + + forEachLiveOne(gameState.particles, (flash) => { + const { x, y, time, color, size, duration } = flash; + const elapsed = gameState.levelTime - time; + ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2); + drawFuzzyBall(ctx, color, size * 3, x, y); + }); + + // Decides how brights the bg black parts can get + ctx.globalAlpha = 0.2; + ctx.globalCompositeOperation = "multiply"; + ctx.fillStyle = "black"; + ctx.fillRect(0, 0, width, height); + // Decides how dark the background black parts are when lit (1=black) + ctx.globalAlpha = 0.8; + ctx.globalCompositeOperation = "multiply"; + if (level.svg && background.width && background.complete) { + if (backgroundCanvas.title !== level.name) { + backgroundCanvas.title = level.name; + backgroundCanvas.width = gameState.canvasWidth; + backgroundCanvas.height = gameState.canvasHeight; + const bgctx = backgroundCanvas.getContext( + "2d", + ) as CanvasRenderingContext2D; + bgctx.fillStyle = level.color || "#000"; + bgctx.fillRect(0, 0, gameState.canvasWidth, gameState.canvasHeight); + const pattern = ctx.createPattern(background, "repeat"); + if (pattern) { + bgctx.fillStyle = pattern; + bgctx.fillRect(0, 0, width, height); + } + } + + ctx.drawImage(backgroundCanvas, 0, 0); + } else { + // Background not loaded yes + ctx.fillStyle = "#000"; + ctx.fillRect(0, 0, width, height); + } + } else { ctx.globalAlpha = 1; ctx.globalCompositeOperation = "source-over"; + ctx.fillStyle = level.color || "#000"; + ctx.fillRect(0, 0, width, height); + forEachLiveOne(gameState.particles, (flash) => { + const { x, y, time, color, size, duration } = flash; + const elapsed = gameState.levelTime - time; + ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2); + drawBall(ctx, color, size, x, y); + }); + } - drawPuck( - ctx, - gameState.puckColor, - gameState.puckWidth, - gameState.puckHeight, - 0, - !!gameState.perks.concave_puck, - gameState.perks.streak_shots && hasCombo ? getDashOffset(gameState) : -1, + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = "source-over"; + const lastExplosionDelay = Date.now() - gameState.lastExplosion + 5; + const shaked = lastExplosionDelay < 200 && !isOptionOn("basic"); + if (shaked) { + const amplitude = + ((gameState.perks.bigger_explosions + 1) * 50) / lastExplosionDelay; + ctx.translate( + Math.sin(Date.now()) * amplitude, + Math.sin(Date.now() + 36) * amplitude, ); - - if (gameState.combo > 1) { - ctx.globalCompositeOperation = "source-over"; - const comboText = "x " + gameState.combo; - const comboTextWidth = (comboText.length * gameState.puckHeight) / 1.8; - const totalWidth = comboTextWidth + gameState.coinSize * 2; - const left = gameState.puckPosition - totalWidth / 2; - if (totalWidth < gameState.puckWidth) { - drawCoin( - ctx, - "gold", - gameState.coinSize, - left + gameState.coinSize / 2, - gameState.gameZoneHeight - gameState.puckHeight / 2, - gameState.puckColor, - 0, - ); - drawText( - ctx, - comboText, - "#000", - gameState.puckHeight, - left + gameState.coinSize * 1.5, - gameState.gameZoneHeight - gameState.puckHeight / 2, - true, - ); - } else { - drawText( - ctx, - comboTextWidth > gameState.puckWidth - ? gameState.combo.toString() - : comboText, - "#000", - comboTextWidth > gameState.puckWidth ? 12 : 20, - gameState.puckPosition, - gameState.gameZoneHeight - gameState.puckHeight / 2, - false, - ); - } - } - // Borders - + } + if (gameState.perks.bigger_explosions && !isOptionOn("basic") && shaked) { + gameCanvas.style.filter = + "brightness(" + (1 + 100 / (1 + lastExplosionDelay)) + ")"; + } else { + gameCanvas.style.filter = ""; + } + // Coins + ctx.globalAlpha = 1; + forEachLiveOne(gameState.coins, (coin) => { ctx.globalCompositeOperation = "source-over"; - ctx.globalAlpha = gameState.perks.unbounded ? 0.1 : 1; + // ctx.globalCompositeOperation = + // coin.color === "gold" || level.color ? "source-over" : "screen"; + drawCoin( + ctx, + coin.color, + coin.size, + coin.x, + coin.y, + (hasCombo && gameState.perks.asceticism && "red") || + (!coin.points && "red") || + level.color || + "black", + coin.a, + ); + }); - if (gameState.offsetXRoundedDown) { - // draw outside of gaming area to avoid capturing borders in recordings - ctx.fillStyle = - hasCombo && gameState.perks.left_is_lava ? "red" : gameState.puckColor; + // Black shadow around balls + if (!isOptionOn("basic")) { + ctx.globalCompositeOperation = "source-over"; + ctx.globalAlpha = Math.min(0.8, liveCount(gameState.coins) / 20); + gameState.balls.forEach((ball) => { + drawBall( + ctx, + level.color || "#000", + gameState.ballSize * 6, + ball.x, + ball.y, + ); + }); - drawStraightLine( - ctx, - gameState, - (hasCombo && - gameState.perks.left_is_lava && - !gameState.perks.unbounded && - "red") || - "white", - gameState.offsetX - 1, - 0, - gameState.offsetX - 1, - height, - gameState.perks.unbounded ? 0.1 : 1, + if (gameState.debuffs.negative_coins) { + // Render crimson coins very bright + ctx.globalCompositeOperation = "source-over"; + ctx.globalAlpha = 0.8; + const red = Math.floor(gameState.levelTime / 100) % 2 > 0; + forEachLiveOne(gameState.coins, (coin) => { + if (coin.color !== "crimson") return; + drawBall(ctx, red ? "red" : "black", coin.size * 3, coin.x, coin.y); + }); + ctx.globalAlpha = 1; + forEachLiveOne(gameState.coins, (coin) => { + if (coin.color !== "crimson") return; + drawCoin( + ctx, + !red ? "red" : "black", + coin.size, + coin.x, + coin.y, + "red", + coin.a, ); + }); + } + } - drawStraightLine( - ctx, - gameState, - (hasCombo && - gameState.perks.right_is_lava && - !gameState.perks.unbounded && - "red") || - "white", - width - gameState.offsetX + 1, - 0, - width - gameState.offsetX + 1, - height, - gameState.perks.unbounded ? 0.1 : 1, - ); + ctx.globalCompositeOperation = "source-over"; + renderAllBricks(); + + ctx.globalCompositeOperation = "screen"; + forEachLiveOne(gameState.lights, (flash) => { + const { x, y, time, color, size, duration } = flash; + const elapsed = gameState.levelTime - time; + ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2) * 0.5; + drawBrick(ctx, color, x, y, -1); + }); + + ctx.globalCompositeOperation = "screen"; + forEachLiveOne(gameState.texts, (flash) => { + const { x, y, time, color, size, duration } = flash; + const elapsed = gameState.levelTime - time; + ctx.globalAlpha = Math.max(0, Math.min(1, 2 - (elapsed / duration) * 2)); + ctx.globalCompositeOperation = "source-over"; + drawText(ctx, flash.text, color, size, x, y - elapsed / 10); + }); + + forEachLiveOne(gameState.particles, (particle) => { + const { x, y, time, color, size, duration } = particle; + const elapsed = gameState.levelTime - time; + ctx.globalAlpha = Math.max(0, Math.min(1, 2 - (elapsed / duration) * 2)); + ctx.globalCompositeOperation = "screen"; + drawBall(ctx, color, size, x, y); + drawFuzzyBall(ctx, color, size, x, y); + }); + + if (gameState.perks.extra_life) { + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = "source-over"; + ctx.fillStyle = gameState.puckColor; + for (let i = 0; i < gameState.perks.extra_life; i++) { + ctx.fillRect( + gameState.perks.unbounded ? 0 : gameState.offsetXRoundedDown, + gameState.gameZoneHeight - gameState.puckHeight / 2 + 2 * i, + gameState.perks.unbounded + ? gameState.canvasWidth + : gameState.gameZoneWidthRoundedUp, + 1, + ); + } + } + + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = "source-over"; + + gameState.balls.forEach((ball) => { + const drawingColor = gameState.ballsColor; + + // The white border around is to distinguish colored balls from coins/bg + drawBall( + ctx, + drawingColor, + gameState.ballSize, + ball.x, + ball.y, + gameState.puckColor, + ); + + if (isTelekinesisActive(gameState, ball) || isYoyoActive(gameState, ball)) { + ctx.beginPath(); + ctx.moveTo(gameState.puckPosition, gameState.gameZoneHeight); + if (interferenceFactor(gameState) == -1) { + ctx.lineWidth = 2; + ctx.strokeStyle = "red"; + ctx.setLineDash(redBorderDash); + ctx.lineDashOffset = getDashOffset(gameState); + } else { + ctx.strokeStyle = gameState.puckColor; + } + ctx.bezierCurveTo( + gameState.puckPosition, + gameState.gameZoneHeight, + gameState.puckPosition, + ball.y, + ball.x, + ball.y, + ); + ctx.stroke(); + + ctx.lineWidth = 2; + ctx.setLineDash(emptyArray); + } + if (gameState.perks.clairvoyant && gameState.ballStickToPuck) { + ctx.strokeStyle = gameState.ballsColor; + ctx.beginPath(); + ctx.moveTo(ball.x, ball.y); + ctx.lineTo(ball.x + ball.vx * 10, ball.y + ball.vy * 10); + ctx.stroke(); + } + }); + // The puck + ctx.globalAlpha = 1; + ctx.globalCompositeOperation = "source-over"; + + drawPuck( + ctx, + gameState.puckColor, + gameState.puckWidth, + gameState.puckHeight, + 0, + !!gameState.perks.concave_puck, + gameState.perks.streak_shots && hasCombo ? getDashOffset(gameState) : -1, + ); + + if (gameState.combo > 1) { + ctx.globalCompositeOperation = "source-over"; + const comboText = "x " + gameState.combo; + const comboTextWidth = (comboText.length * gameState.puckHeight) / 1.8; + const totalWidth = comboTextWidth + gameState.coinSize * 2; + const left = gameState.puckPosition - totalWidth / 2; + if (totalWidth < gameState.puckWidth) { + drawCoin( + ctx, + "gold", + gameState.coinSize, + left + gameState.coinSize / 2, + gameState.gameZoneHeight - gameState.puckHeight / 2, + gameState.puckColor, + 0, + ); + drawText( + ctx, + comboText, + "#000", + gameState.puckHeight, + left + gameState.coinSize * 1.5, + gameState.gameZoneHeight - gameState.puckHeight / 2, + true, + ); } else { - ctx.fillStyle = "red"; - - drawStraightLine( - ctx, - gameState, - (hasCombo && - gameState.perks.left_is_lava && - !gameState.perks.unbounded && - "red") || - "", - 0, - 0, - 0, - height, - 1, - ); - - drawStraightLine( - ctx, - gameState, - (hasCombo && - gameState.perks.right_is_lava && - !gameState.perks.unbounded && - "red") || - "", - width - 1, - 0, - width - 1, - height, - 1, - ); + drawText( + ctx, + comboTextWidth > gameState.puckWidth + ? gameState.combo.toString() + : comboText, + "#000", + comboTextWidth > gameState.puckWidth ? 12 : 20, + gameState.puckPosition, + gameState.gameZoneHeight - gameState.puckHeight / 2, + false, + ); } + } + // Borders + + ctx.globalCompositeOperation = "source-over"; + ctx.globalAlpha = gameState.perks.unbounded ? 0.1 : 1; + + if (gameState.offsetXRoundedDown) { + // draw outside of gaming area to avoid capturing borders in recordings + ctx.fillStyle = + hasCombo && gameState.perks.left_is_lava ? "red" : gameState.puckColor; drawStraightLine( - ctx, - gameState, - (hasCombo && gameState.perks.top_is_lava && "red") || "", - gameState.offsetXRoundedDown, - 1, - width - gameState.offsetXRoundedDown, - 1, - 1, + ctx, + gameState, + (hasCombo && + gameState.perks.left_is_lava && + !gameState.perks.unbounded && + "red") || + "white", + gameState.offsetX - 1, + 0, + gameState.offsetX - 1, + height, + gameState.perks.unbounded ? 0.1 : 1, ); drawStraightLine( - ctx, - gameState, - (hasCombo && gameState.perks.compound_interest && "red") || - (isOptionOn("mobile-mode") && "white") || + ctx, + gameState, + (hasCombo && + gameState.perks.right_is_lava && + !gameState.perks.unbounded && + "red") || + "white", + width - gameState.offsetX + 1, + 0, + width - gameState.offsetX + 1, + height, + gameState.perks.unbounded ? 0.1 : 1, + ); + } else { + ctx.fillStyle = "red"; + + drawStraightLine( + ctx, + gameState, + (hasCombo && + gameState.perks.left_is_lava && + !gameState.perks.unbounded && + "red") || "", - gameState.offsetXRoundedDown, - gameState.gameZoneHeight, - width - gameState.offsetXRoundedDown, - gameState.gameZoneHeight, - 1, + 0, + 0, + 0, + height, + 1, ); - if (isOptionOn("mobile-mode") && !gameState.running) { - drawText( - ctx, - t("play.mobile_press_to_play"), - gameState.puckColor, - gameState.puckHeight, - gameState.canvasWidth / 2, - gameState.gameZoneHeight + - (gameState.canvasHeight - gameState.gameZoneHeight) / 2, - ); - } + drawStraightLine( + ctx, + gameState, + (hasCombo && + gameState.perks.right_is_lava && + !gameState.perks.unbounded && + "red") || + "", + width - 1, + 0, + width - 1, + height, + 1, + ); + } - if (shaked) { - ctx.resetTransform(); - } + drawStraightLine( + ctx, + gameState, + (hasCombo && gameState.perks.top_is_lava && "red") || "", + gameState.offsetXRoundedDown, + 1, + width - gameState.offsetXRoundedDown, + 1, + 1, + ); + + drawStraightLine( + ctx, + gameState, + (hasCombo && gameState.perks.compound_interest && "red") || + (isOptionOn("mobile-mode") && "white") || + "", + gameState.offsetXRoundedDown, + gameState.gameZoneHeight, + width - gameState.offsetXRoundedDown, + gameState.gameZoneHeight, + 1, + ); + + if (isOptionOn("mobile-mode") && !gameState.running) { + drawText( + ctx, + t("play.mobile_press_to_play"), + gameState.puckColor, + gameState.puckHeight, + gameState.canvasWidth / 2, + gameState.gameZoneHeight + + (gameState.canvasHeight - gameState.gameZoneHeight) / 2, + ); + } + + if (shaked) { + ctx.resetTransform(); + } } function drawStraightLine( - ctx: CanvasRenderingContext2D, - gameState: GameState, - mode: "white" | "" | "red", - x1, - y1, - x2, - y2, - alpha = 1, + ctx: CanvasRenderingContext2D, + gameState: GameState, + mode: "white" | "" | "red", + x1, + y1, + x2, + y2, + alpha = 1, ) { - ctx.globalAlpha = alpha; - if (!mode) return; - if (mode == "red") { - ctx.strokeStyle = "red"; - ctx.lineDashOffset = getDashOffset(gameState); - ctx.lineWidth = 2; - ctx.setLineDash(redBorderDash); - } else { - ctx.strokeStyle = "white"; - ctx.lineWidth = 1; - } - ctx.beginPath(); - ctx.moveTo(x1, y1); - ctx.lineTo(x2, y2); - ctx.stroke(); - if (mode == "red") { - ctx.setLineDash(emptyArray); - ctx.lineWidth = 1; - } - ctx.globalAlpha = 1; + ctx.globalAlpha = alpha; + if (!mode) return; + if (mode == "red") { + ctx.strokeStyle = "red"; + ctx.lineDashOffset = getDashOffset(gameState); + ctx.lineWidth = 2; + ctx.setLineDash(redBorderDash); + } else { + ctx.strokeStyle = "white"; + ctx.lineWidth = 1; + } + ctx.beginPath(); + ctx.moveTo(x1, y1); + ctx.lineTo(x2, y2); + ctx.stroke(); + if (mode == "red") { + ctx.setLineDash(emptyArray); + ctx.lineWidth = 1; + } + ctx.globalAlpha = 1; } let cachedBricksRender = document.createElement("canvas"); let cachedBricksRenderKey = ""; export function renderAllBricks() { - ctx.globalAlpha = 1; + ctx.globalAlpha = 1; - const hasCombo = gameState.combo > baseCombo(gameState); - const redBorderOnBricksWithWrongColor = - hasCombo && gameState.perks.picky_eater && !isOptionOn("basic"); + const hasCombo = gameState.combo > baseCombo(gameState); + const redBorderOnBricksWithWrongColor = + hasCombo && gameState.perks.picky_eater && !isOptionOn("basic"); - const redColorOnAllBricks = !!( - gameState.lastPuckMove && - gameState.perks.passive_income && - hasCombo && - gameState.lastPuckMove > - gameState.levelTime - 250 * gameState.perks.passive_income - ); + const redColorOnAllBricks = !!( + gameState.lastPuckMove && + gameState.perks.passive_income && + hasCombo && + gameState.lastPuckMove > + gameState.levelTime - 250 * gameState.perks.passive_income + ); - let offset = getDashOffset(gameState); - if ( - !( - redBorderOnBricksWithWrongColor || - redColorOnAllBricks || - gameState.perks.reach || - gameState.perks.zen - ) - ) { - offset = 0; - } + let offset = getDashOffset(gameState); + if ( + !( + redBorderOnBricksWithWrongColor || + redColorOnAllBricks || + gameState.perks.reach || + gameState.perks.zen + ) + ) { + offset = 0; + } - const clairVoyance = - gameState.perks.clairvoyant && gameState.brickHP.reduce((a, b) => a + b, 0); + const clairVoyance = + gameState.perks.clairvoyant && gameState.brickHP.reduce((a, b) => a + b, 0); - const newKey = - gameState.gameZoneWidth + - "_" + - gameState.bricks.join("_") + - bombSVG.complete + - "_" + - redBorderOnBricksWithWrongColor + - "_" + - redColorOnAllBricks + - "_" + - gameState.ballsColor + - "_" + - gameState.perks.pierce_color + - "_" + - clairVoyance + - "_" + - offset; + const newKey = + gameState.gameZoneWidth + + "_" + + gameState.bricks.join("_") + + bombSVG.complete + + "_" + + redBorderOnBricksWithWrongColor + + "_" + + redColorOnAllBricks + + "_" + + gameState.ballsColor + + "_" + + gameState.perks.pierce_color + + "_" + + clairVoyance + + "_" + + offset; - if (newKey !== cachedBricksRenderKey) { - cachedBricksRenderKey = newKey; + if (newKey !== cachedBricksRenderKey) { + cachedBricksRenderKey = newKey; - cachedBricksRender.width = gameState.gameZoneWidth; - cachedBricksRender.height = gameState.gameZoneWidth + 1; - const canctx = cachedBricksRender.getContext( - "2d", - ) as CanvasRenderingContext2D; - canctx.clearRect(0, 0, gameState.gameZoneWidth, gameState.gameZoneWidth); - canctx.resetTransform(); - canctx.translate(-gameState.offsetX, 0); - // Bricks - gameState.bricks.forEach((color, index) => { - const x = brickCenterX(gameState, index), - y = brickCenterY(gameState, index); + cachedBricksRender.width = gameState.gameZoneWidth; + cachedBricksRender.height = gameState.gameZoneWidth + 1; + const canctx = cachedBricksRender.getContext( + "2d", + ) as CanvasRenderingContext2D; + canctx.clearRect(0, 0, gameState.gameZoneWidth, gameState.gameZoneWidth); + canctx.resetTransform(); + canctx.translate(-gameState.offsetX, 0); + // Bricks + gameState.bricks.forEach((color, index) => { + const x = brickCenterX(gameState, index), + y = brickCenterY(gameState, index); - if (!color) return; + if (!color) return; - let redBecauseOfReach = - gameState.perks.reach && - countBricksAbove(gameState, index) && - !countBricksBelow(gameState, index); + let redBecauseOfReach = + gameState.perks.reach && + countBricksAbove(gameState, index) && + !countBricksBelow(gameState, index); - let redBorder = - color === "crimson" || - (gameState.ballsColor !== color && - color !== "black" && - redBorderOnBricksWithWrongColor) || - (hasCombo && gameState.perks.zen && color === "black") || - redBecauseOfReach || - redColorOnAllBricks; + let redBorder = + color === "crimson" || + (gameState.ballsColor !== color && + color !== "black" && + redBorderOnBricksWithWrongColor) || + (hasCombo && gameState.perks.zen && color === "black") || + redBecauseOfReach || + redColorOnAllBricks; - canctx.globalCompositeOperation = "source-over"; - drawBrick(canctx, color, x, y, redBorder ? offset : -1); - if (gameState.brickHP[index] > 1 && gameState.perks.clairvoyant) { - canctx.globalCompositeOperation = "destination-out"; - drawText( - canctx, - gameState.brickHP[index].toString(), - "white", - gameState.puckHeight, - x, - y, - ); - } + canctx.globalCompositeOperation = "source-over"; + drawBrick(canctx, color, x, y, redBorder ? offset : -1); + if (gameState.brickHP[index] > 1 && gameState.perks.clairvoyant) { + canctx.globalCompositeOperation = "destination-out"; + drawText( + canctx, + gameState.brickHP[index].toString(), + "white", + gameState.puckHeight, + x, + y, + ); + } - if (color === "black") { - canctx.globalCompositeOperation = "source-over"; - drawIMG(canctx, bombSVG, gameState.brickWidth, x, y); - } - }); - } + if (color === "black") { + canctx.globalCompositeOperation = "source-over"; + drawIMG(canctx, bombSVG, gameState.brickWidth, x, y); + } + }); + } - ctx.drawImage(cachedBricksRender, gameState.offsetX, 0); + ctx.drawImage(cachedBricksRender, gameState.offsetX, 0); } let cachedGraphics: { [k: string]: HTMLCanvasElement } = {}; export function drawPuck( - ctx: CanvasRenderingContext2D, - color: colorString, - puckWidth: number, - puckHeight: number, - yOffset = 0, - flipped: boolean, - redBorderOffset: number, + ctx: CanvasRenderingContext2D, + color: colorString, + puckWidth: number, + puckHeight: number, + yOffset = 0, + flipped: boolean, + redBorderOffset: number, ) { - const key = - "puck" + - color + - "_" + - puckWidth + - "_" + - puckHeight + - "_" + - flipped + - "_" + - redBorderOffset; + const key = + "puck" + + color + + "_" + + puckWidth + + "_" + + puckHeight + + "_" + + flipped + + "_" + + redBorderOffset; - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = puckWidth; - can.height = puckHeight * 2; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; - canctx.fillStyle = color; + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = puckWidth; + can.height = puckHeight * 2; + const canctx = can.getContext("2d") as CanvasRenderingContext2D; + canctx.fillStyle = color; - canctx.beginPath(); - canctx.moveTo(0, puckHeight * 2); + canctx.beginPath(); + canctx.moveTo(0, puckHeight * 2); - if (flipped) { - canctx.lineTo(0, puckHeight * 0.75); - canctx.bezierCurveTo( - puckWidth / 2, - puckHeight, - puckWidth / 2, - puckHeight * 1, - puckWidth, - puckHeight * 0.75, - ); - canctx.lineTo(puckWidth, puckHeight * 2); - } else { - canctx.lineTo(0, puckHeight * 1.25); - canctx.bezierCurveTo( - 0, - puckHeight * 0.75, - puckWidth, - puckHeight * 0.75, - puckWidth, - puckHeight * 1.25, - ); - canctx.lineTo(puckWidth, puckHeight * 2); - } - - canctx.fill(); - - if (redBorderOffset !== -1) { - canctx.strokeStyle = "red"; - canctx.lineWidth = 4; - canctx.setLineDash(redBorderDash); - canctx.lineDashOffset = redBorderOffset; - canctx.stroke(); - } - - cachedGraphics[key] = can; + if (flipped) { + canctx.lineTo(0, puckHeight * 0.75); + canctx.bezierCurveTo( + puckWidth / 2, + puckHeight, + puckWidth / 2, + puckHeight * 1, + puckWidth, + puckHeight * 0.75, + ); + canctx.lineTo(puckWidth, puckHeight * 2); + } else { + canctx.lineTo(0, puckHeight * 1.25); + canctx.bezierCurveTo( + 0, + puckHeight * 0.75, + puckWidth, + puckHeight * 0.75, + puckWidth, + puckHeight * 1.25, + ); + canctx.lineTo(puckWidth, puckHeight * 2); } - ctx.drawImage( - cachedGraphics[key], - Math.round(gameState.puckPosition - puckWidth / 2), - gameState.gameZoneHeight - puckHeight * 2 + yOffset, - ); + canctx.fill(); + + if (redBorderOffset !== -1) { + canctx.strokeStyle = "red"; + canctx.lineWidth = 4; + canctx.setLineDash(redBorderDash); + canctx.lineDashOffset = redBorderOffset; + canctx.stroke(); + } + + cachedGraphics[key] = can; + } + + ctx.drawImage( + cachedGraphics[key], + Math.round(gameState.puckPosition - puckWidth / 2), + gameState.gameZoneHeight - puckHeight * 2 + yOffset, + ); } export function drawBall( - ctx: CanvasRenderingContext2D, - color: colorString, - width: number, - x: number, - y: number, - borderColor = "", + ctx: CanvasRenderingContext2D, + color: colorString, + width: number, + x: number, + y: number, + borderColor = "", ) { - const key = "ball" + color + "_" + width + "_" + borderColor; + const key = "ball" + color + "_" + width + "_" + borderColor; - const size = Math.round(width); - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = size; - can.height = size; + const size = Math.round(width); + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = size; + can.height = size; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; - canctx.beginPath(); - canctx.arc(size / 2, size / 2, Math.round(size / 2) - 1, 0, 2 * Math.PI); - canctx.fillStyle = color; - canctx.fill(); - if (borderColor) { - canctx.lineWidth = 2; - canctx.strokeStyle = borderColor; - canctx.stroke(); - } - - cachedGraphics[key] = can; + const canctx = can.getContext("2d") as CanvasRenderingContext2D; + canctx.beginPath(); + canctx.arc(size / 2, size / 2, Math.round(size / 2) - 1, 0, 2 * Math.PI); + canctx.fillStyle = color; + canctx.fill(); + if (borderColor) { + canctx.lineWidth = 2; + canctx.strokeStyle = borderColor; + canctx.stroke(); } - ctx.drawImage( - cachedGraphics[key], - Math.round(x - size / 2), - Math.round(y - size / 2), - ); + + cachedGraphics[key] = can; + } + ctx.drawImage( + cachedGraphics[key], + Math.round(x - size / 2), + Math.round(y - size / 2), + ); } const angles = 32; export function drawCoin( - ctx: CanvasRenderingContext2D, - color: colorString, - size: number, - x: number, - y: number, - borderColor: colorString, - rawAngle: number, + ctx: CanvasRenderingContext2D, + color: colorString, + size: number, + x: number, + y: number, + borderColor: colorString, + rawAngle: number, ) { - const angle = - ((Math.round((rawAngle / Math.PI) * 2 * angles) % angles) + angles) % - angles; - const key = - "coin with halo" + - "_" + - color + - "_" + - size + - "_" + - borderColor + - "_" + - (color === "gold" ? angle : "whatever"); + const angle = + ((Math.round((rawAngle / Math.PI) * 2 * angles) % angles) + angles) % + angles; + const key = + "coin with halo" + + "_" + + color + + "_" + + size + + "_" + + borderColor + + "_" + + (color === "gold" ? angle : "whatever"); - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = size; - can.height = size; + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = size; + can.height = size; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; + const canctx = can.getContext("2d") as CanvasRenderingContext2D; - // coin - canctx.beginPath(); - canctx.arc(size / 2, size / 2, size / 2, 0, 2 * Math.PI); - canctx.fillStyle = color; - canctx.fill(); + // coin + canctx.beginPath(); + canctx.arc(size / 2, size / 2, size / 2, 0, 2 * Math.PI); + canctx.fillStyle = color; + canctx.fill(); - if (color === "gold" || borderColor === "red") { - canctx.strokeStyle = borderColor; - if (borderColor == "red") { - canctx.lineWidth = 2; - canctx.setLineDash(redBorderDash); - } - canctx.stroke(); - } - - if (color === "gold") { - // Fill in - canctx.beginPath(); - canctx.arc(size / 2, size / 2, (size / 2) * 0.6, 0, 2 * Math.PI); - canctx.fillStyle = "rgba(255,255,255,0.5)"; - canctx.fill(); - - canctx.translate(size / 2, size / 2); - canctx.rotate(angle / 16); - canctx.translate(-size / 2, -size / 2); - - canctx.globalCompositeOperation = "multiply"; - drawText(canctx, "$", color, size - 2, size / 2, size / 2 + 1); - drawText(canctx, "$", color, size - 2, size / 2, size / 2 + 1); - } - cachedGraphics[key] = can; + if (color === "gold" || borderColor === "red") { + canctx.strokeStyle = borderColor; + if (borderColor == "red") { + canctx.lineWidth = 2; + canctx.setLineDash(redBorderDash); + } + canctx.stroke(); } - ctx.drawImage( - cachedGraphics[key], - Math.round(x - size / 2), - Math.round(y - size / 2), - ); + + if (color === "gold") { + // Fill in + canctx.beginPath(); + canctx.arc(size / 2, size / 2, (size / 2) * 0.6, 0, 2 * Math.PI); + canctx.fillStyle = "rgba(255,255,255,0.5)"; + canctx.fill(); + + canctx.translate(size / 2, size / 2); + canctx.rotate(angle / 16); + canctx.translate(-size / 2, -size / 2); + + canctx.globalCompositeOperation = "multiply"; + drawText(canctx, "$", color, size - 2, size / 2, size / 2 + 1); + drawText(canctx, "$", color, size - 2, size / 2, size / 2 + 1); + } + cachedGraphics[key] = can; + } + ctx.drawImage( + cachedGraphics[key], + Math.round(x - size / 2), + Math.round(y - size / 2), + ); } export function drawFuzzyBall( - ctx: CanvasRenderingContext2D, - color: colorString, - width: number, - x: number, - y: number, + ctx: CanvasRenderingContext2D, + color: colorString, + width: number, + x: number, + y: number, ) { - const key = "fuzzy-circle" + color + "_" + width; - if (!color) debugger; - const size = Math.round(width * 3); - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = size; - can.height = size; + const key = "fuzzy-circle" + color + "_" + width; + if (!color) debugger; + const size = Math.round(width * 3); + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = size; + can.height = size; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; - const gradient = canctx.createRadialGradient( - size / 2, - size / 2, - 0, - size / 2, - size / 2, - size / 2, - ); - gradient.addColorStop(0, color); - gradient.addColorStop(1, "transparent"); - canctx.fillStyle = gradient; - canctx.fillRect(0, 0, size, size); - cachedGraphics[key] = can; - } - ctx.drawImage( - cachedGraphics[key], - Math.round(x - size / 2), - Math.round(y - size / 2), + const canctx = can.getContext("2d") as CanvasRenderingContext2D; + const gradient = canctx.createRadialGradient( + size / 2, + size / 2, + 0, + size / 2, + size / 2, + size / 2, ); + gradient.addColorStop(0, color); + gradient.addColorStop(1, "transparent"); + canctx.fillStyle = gradient; + canctx.fillRect(0, 0, size, size); + cachedGraphics[key] = can; + } + ctx.drawImage( + cachedGraphics[key], + Math.round(x - size / 2), + Math.round(y - size / 2), + ); } export function drawBrick( - ctx: CanvasRenderingContext2D, - color: colorString, - x: number, - y: number, - offset: number = 0, + ctx: CanvasRenderingContext2D, + color: colorString, + x: number, + y: number, + offset: number = 0, ) { - const tlx = Math.ceil(x - gameState.brickWidth / 2); - const tly = Math.ceil(y - gameState.brickWidth / 2); - const brx = Math.ceil(x + gameState.brickWidth / 2) - 1; - const bry = Math.ceil(y + gameState.brickWidth / 2) - 1; + const tlx = Math.ceil(x - gameState.brickWidth / 2); + const tly = Math.ceil(y - gameState.brickWidth / 2); + const brx = Math.ceil(x + gameState.brickWidth / 2) - 1; + const bry = Math.ceil(y + gameState.brickWidth / 2) - 1; - const width = brx - tlx, - height = bry - tly; - const key = "brick" + color + "_" + "_" + width + "_" + height + "_" + offset; + const width = brx - tlx, + height = bry - tly; + const key = "brick" + color + "_" + "_" + width + "_" + height + "_" + offset; - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = width; - can.height = height; - const bord = 4; - const cornerRadius = 2; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = width; + can.height = height; + const bord = 4; + const cornerRadius = 2; + const canctx = can.getContext("2d") as CanvasRenderingContext2D; - canctx.fillStyle = color; + canctx.fillStyle = color; - canctx.setLineDash(offset !== -1 ? redBorderDash : emptyArray); - canctx.lineDashOffset = offset; - canctx.strokeStyle = offset !== -1 ? "red" : color; - canctx.lineJoin = "round"; - canctx.lineWidth = bord; - roundRect( - canctx, - bord / 2, - bord / 2, - width - bord, - height - bord, - cornerRadius, - ); - canctx.fill(); - canctx.stroke(); + canctx.setLineDash(offset !== -1 ? redBorderDash : emptyArray); + canctx.lineDashOffset = offset; + canctx.strokeStyle = offset !== -1 ? "red" : color; + canctx.lineJoin = "round"; + canctx.lineWidth = bord; + roundRect( + canctx, + bord / 2, + bord / 2, + width - bord, + height - bord, + cornerRadius, + ); + canctx.fill(); + canctx.stroke(); - cachedGraphics[key] = can; - } - ctx.drawImage(cachedGraphics[key], tlx, tly, width, height); - // It's not easy to have a 1px gap between bricks without antialiasing + cachedGraphics[key] = can; + } + ctx.drawImage(cachedGraphics[key], tlx, tly, width, height); + // It's not easy to have a 1px gap between bricks without antialiasing } export function roundRect( - ctx: CanvasRenderingContext2D, - x: number, - y: number, - width: number, - height: number, - radius: number, + ctx: CanvasRenderingContext2D, + x: number, + y: number, + width: number, + height: number, + radius: number, ) { - ctx.beginPath(); - ctx.moveTo(x + radius, y); - ctx.lineTo(x + width - radius, y); - ctx.quadraticCurveTo(x + width, y, x + width, y + radius); - ctx.lineTo(x + width, y + height - radius); - ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); - ctx.lineTo(x + radius, y + height); - ctx.quadraticCurveTo(x, y + height, x, y + height - radius); - ctx.lineTo(x, y + radius); - ctx.quadraticCurveTo(x, y, x + radius, y); - ctx.closePath(); + ctx.beginPath(); + ctx.moveTo(x + radius, y); + ctx.lineTo(x + width - radius, y); + ctx.quadraticCurveTo(x + width, y, x + width, y + radius); + ctx.lineTo(x + width, y + height - radius); + ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); + ctx.lineTo(x + radius, y + height); + ctx.quadraticCurveTo(x, y + height, x, y + height - radius); + ctx.lineTo(x, y + radius); + ctx.quadraticCurveTo(x, y, x + radius, y); + ctx.closePath(); } export function drawIMG( - ctx: CanvasRenderingContext2D, - img: HTMLImageElement, - size: number, - x: number, - y: number, + ctx: CanvasRenderingContext2D, + img: HTMLImageElement, + size: number, + x: number, + y: number, ) { - const key = "svg" + img + "_" + size + "_" + img.complete; + const key = "svg" + img + "_" + size + "_" + img.complete; - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = size; - can.height = size; + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = size; + can.height = size; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; + const canctx = can.getContext("2d") as CanvasRenderingContext2D; - const ratio = size / Math.max(img.width, img.height); - const w = img.width * ratio; - const h = img.height * ratio; - canctx.drawImage(img, (size - w) / 2, (size - h) / 2, w, h); + const ratio = size / Math.max(img.width, img.height); + const w = img.width * ratio; + const h = img.height * ratio; + canctx.drawImage(img, (size - w) / 2, (size - h) / 2, w, h); - cachedGraphics[key] = can; - } - ctx.drawImage( - cachedGraphics[key], - Math.round(x - size / 2), - Math.round(y - size / 2), - ); + cachedGraphics[key] = can; + } + ctx.drawImage( + cachedGraphics[key], + Math.round(x - size / 2), + Math.round(y - size / 2), + ); } export function drawText( - ctx: CanvasRenderingContext2D, - text: string, - color: colorString, - fontSize: number, - x: number, - y: number, - left = false, + ctx: CanvasRenderingContext2D, + text: string, + color: colorString, + fontSize: number, + x: number, + y: number, + left = false, ) { - const key = "text" + text + "_" + color + "_" + fontSize + "_" + left; + const key = "text" + text + "_" + color + "_" + fontSize + "_" + left; - if (!cachedGraphics[key]) { - const can = document.createElement("canvas"); - can.width = fontSize * text.length; - can.height = fontSize; - const canctx = can.getContext("2d") as CanvasRenderingContext2D; - canctx.fillStyle = color; - canctx.textAlign = left ? "left" : "center"; - canctx.textBaseline = "middle"; - canctx.font = fontSize + "px monospace"; + if (!cachedGraphics[key]) { + const can = document.createElement("canvas"); + can.width = fontSize * text.length; + can.height = fontSize; + const canctx = can.getContext("2d") as CanvasRenderingContext2D; + canctx.fillStyle = color; + canctx.textAlign = left ? "left" : "center"; + canctx.textBaseline = "middle"; + canctx.font = fontSize + "px monospace"; - canctx.fillText(text, left ? 0 : can.width / 2, can.height / 2, can.width); + canctx.fillText(text, left ? 0 : can.width / 2, can.height / 2, can.width); - cachedGraphics[key] = can; - } - ctx.drawImage( - cachedGraphics[key], - left ? x : Math.round(x - cachedGraphics[key].width / 2), - Math.round(y - cachedGraphics[key].height / 2), - ); + cachedGraphics[key] = can; + } + ctx.drawImage( + cachedGraphics[key], + left ? x : Math.round(x - cachedGraphics[key].width / 2), + Math.round(y - cachedGraphics[key].height / 2), + ); } export const scoreDisplay = document.getElementById( - "score", + "score", ) as HTMLButtonElement; const menuLabel = document.getElementById("menuLabel") as HTMLButtonElement; @@ -989,8 +985,8 @@ const emptyArray = []; const redBorderDash = [5, 5]; export function getDashOffset(gameState: GameState) { - if (isOptionOn("basic")) { - return 0; - } - return Math.floor(((gameState.levelTime % 500) / 500) * 10) % 10; + if (isOptionOn("basic")) { + return 0; + } + return Math.floor(((gameState.levelTime % 500) / 500) * 10) % 10; } diff --git a/src/types.d.ts b/src/types.d.ts index c5ec7f7..982e5b8 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -83,6 +83,7 @@ export type Coin = { sa: number; weight: number; destroyed?: boolean; + collidedLastFrame?: boolean; coloredABrick?: boolean; }; export type Ball = { @@ -155,12 +156,12 @@ export type PerksMap = { [k in PerkId]: number; }; -type Debuff={ +type Debuff = { id: DebuffId; - max:number; - name:(lvl: number,banned:string)=>string; - help:(lvl: number,perk:string)=>string; -} + max: number; + name: (lvl: number, banned: string) => string; + help: (lvl: number, perk: string) => string; +}; export type DebuffId = (typeof debuffs)[number]["id"]; export type DebuffsMap = { @@ -287,6 +288,7 @@ export type GameState = { }; rerolls: number; loop: number; + baseCombo: number; }; export type RunParams = {