diff --git a/CHANGELOG.md b/CHANGELOG.md index effe6cf..79bc4e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project are documented here. The project follows - Pie Control's Launch tab now says how long each crust you are filling takes to fill at your current pace. When that is more than two years, it suggests another launch pad at your coastal POP nearest the equator, with a button to build it. - Buoys, ships' mail and sensors that can live with gaps in the sky now pay a little before a crust carries anything: from 10% coverage, up to about $30M a month for the Shortcrust at 40%, as long as one pie dish works under it. Between 40% and 60% they make way for regular orbit customers, and the Traffic tab lists them. - While your crusts are under 30% covered, the Dishes tab reminds you that pie dishes earn nothing until the sky fills up, so it pays to wait. +- The Founder of your rocket company now does something daft every few months, and the markets get jumpy every time: a sleepless posting spree that makes orbit customers nervous, a fight with a country's regulator, a launch date leaked early that makes launch insurance dearer, a promise of Mars by next year that costs a few customers when it slips, and worse. It always wears off: Pie Control's Company tab shows how jittery the market is and how soon it calms down. With no chaos in your ruleset he only posts. - The month a crust starts carrying traffic is its grand opening: for 30 days orbit customers call every day and up to four offers wait, so regular customers sign up while the gap-tolerant ones fade out. - The NOC tab is tidier: Pie Control is a button in its top row next to the NOC dashboard, the traceroute moved into Routing & DDoS, and the Connections button is gone (the list is still in the NOC dashboard). - Pie Control has four tabs in one row that fits a phone: Traffic, Company, Launch and Dishes. The Founder's posts and your orbit books moved into the Company tab. diff --git a/docs/plans/pie-in-the-sky.md b/docs/plans/pie-in-the-sky.md index 997c032..f516eac 100644 --- a/docs/plans/pie-in-the-sky.md +++ b/docs/plans/pie-in-the-sky.md @@ -27,7 +27,7 @@ S.pie = null | {born, co:{name}, fac:bool, rd:{reuse:bool,heavy:bool,heavyTests: pads:[{city,next,boosters:[{id,flights}]}], crusts:{short|frozen|upper|flaky:{cohorts:[{n,day,las}], queued}}, dishes:[{id,city,ant,down}], lic:{[cc]:{state,until}}, q:[launches], - founder:{posts:[...last 20], promises, broken}, book:{spent,earned,wouldHave}, + founder:{posts:[...last 20], promises, broken, due, jit, next, kid, bill, nerv, hype, leak, mars}, (antics: 60-features/99-pie-jitters.js) book:{spent,earned,wouldHave}, spat:{...active geopolitical spats}, safe:bool} ``` Pies are cohorts, never one object per satellite. `sanitize()` clamps all of it. diff --git a/site/i18n/de.js b/site/i18n/de.js index 88a1481..c39c736 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3424,24 +3424,34 @@ "pie.founder_feed":"Der Gründer postet", "pie.fp_3am":"Poste um 3 Uhr nachts, denn Schlaf ist ein Legacy-Protokoll. Unsere Pies schmecken 40 % besser als letztes Quartal.", "pie.fp_astro":"Astronomen sagen, unsere Pies fotobomben ihre Teleskope. Haben sie mal zwischen ihnen durchgeschaut?", +"pie.fp_backup":"Die Abrechnung läuft wieder, aus dem Backup von letztem Dienstag. Der kleine {nick} hat Hausarrest, bis er Prepared Statements versteht.", "pie.fp_baked":"{crust} ist durchgebacken. Nächster Halt: Mars. Wahrscheinlich nächstes Jahr.", "pie.fp_booster":"Der Booster ist bei der Landung umgekippt. Das war ein geplantes Kippen. Wir nennen es schnelle horizontale Bergung.", "pie.fp_debris":"Eine kleine Essensschlacht in {crust}. Krümel sind ein Zeichen für eine gesunde Konstellation.", "pie.fp_dish":"Unsere erste Pie-Schüssel steht. Meine Mutter sagt, der Empfang ist super.", "pie.fp_fail":"Der heutige Start war ein voller Erfolg. Die Rakete ist jetzt an vielen Orten gleichzeitig.", "pie.fp_found":"{co} gegründet. Unsere Mission: Pies in den Himmel, damit jeder ein Stück abbekommt.", +"pie.fp_kid":"Willkommen auf der Welt, {kid}. Kurz: der kleine {nick}. Stolzer Papa.", "pie.fp_launch":"{n} weitere Pies in {crust}. Mutig. Visionär. Pünktlich (dieses Mal).", +"pie.fp_leak":"Nächster Start: Dienstag, 6:42, Rampe zwei, Foto der Nutzlast anbei. Die Rechtsabteilung sagt, ich soll das löschen. Ich lösche das nicht.", +"pie.fp_leak_kid":"Der kleine {nick} hat den nächsten Starttermin von meinem Handy gepostet. Kinder halt. (Ich war's.)", +"pie.fp_mars":"Mars nächstes Jahr. Pies auf dem Mars. Jetzt buchen.", +"pie.fp_mars_kid":"Dem kleinen {nick} eine Geburtstagsparty auf dem Mars versprochen. Nächstes Jahr. Ganz bestimmt nächstes Jahr.", +"pie.fp_mars_slip":"Mars ist jetzt Jahr {n}. Mars war immer Jahr {n}. Der rote Planet kann warten.", "pie.fp_promise":"Versprochen: volle Abdeckung bis Jahr {n}. Schreibt es auf.", +"pie.fp_reg":"Regulierer sind nur Firewalls mit Schlüsselband. Kommt doch.", "pie.fp_rename":"Wir heißen jetzt {co}. Der alte Name hat die Vision ausgebremst.", "pie.fp_slip":"Volle Abdeckung ist jetzt Jahr {n}. Es war immer Jahr {n}. Lest das Kleingedruckte.", "pie.fp_spat":"Irgendeine Regierung hat Fragen. Wir lieben Fragen. Wir beantworten alle, irgendwann, in einem Thread.", +"pie.fp_spree":"Thread 1/{n}: warum Schlaf ein Legacy-Protokoll ist, warum Pies ein Lebensgefühl sind und warum meine Kritiker Bots sind.", +"pie.fp_spree_kid":"Schon wieder 3 Uhr nachts. Der kleine {nick} zahnt, also hab ich einen Thread geschrieben. 1/{n}.", "pie.fp_storm":"Die Sonne ist neidisch auf {crust}. Völlig normal. Weltraumwetter ist einfach Wetter, nur mehr.", "pie.fp_test":"Testflug {n} endete in einem Feuerball, genau wie erhofft. Wir haben so viel gelernt.", "pie.fp_tour":"Ich trete als Tier 1 kurz zurück und gehe auf Zuhörtour. Reden werde hauptsächlich ich.", "pie.half_baked":"Halbgar", "pie.heavy_tests":"Testflüge geflogen: {n} von {max}. Die ersten explodieren immer.", "pie.ins_off":"Versicherung: aus", -"pie.ins_on":"Versicherung: an (8 %)", +"pie.ins_on_p":"Versicherung: an ({p})", "pie.landing_rights":"Landerechte", "pie.las_off":"Laser: aus", "pie.las_on":"Laser: an (+$0.5M pro Pie)", @@ -3514,6 +3524,22 @@ "pie.why_queue_full":"Der Startplan ist voll.", "pie.why_stock":"Braucht {n} Pies; die Fabrik hat {have}.", "pie.would_have":"Hätte gekostet", +"pie_ant.backup":"Die Orbit-Abrechnung ist aus dem Backup wiederhergestellt. Die Rechnungen gehen wieder raus.", +"pie_ant.bill_paused":"Die Orbit-Abrechnung steht bis {d}: Die Datenbank verschluckt sich noch an {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosität am Markt: 😌 ruhig", +"pie_ant.jit_high":"😬 hoch", +"pie_ant.jit_line":{"one":"Nervosität am Markt: {lvl}, beruhigt sich in ~{n} Tag","other":"Nervosität am Markt: {lvl}, beruhigt sich in ~{n} Tagen"}, +"pie_ant.jit_low":"🙂 gering", +"pie_ant.jit_mid":"😟 nervös", +"pie_ant.kid":"Der Gründer hat seinen Sohn {kid} genannt. Die Abrechnungsdatenbank hat die Geburtsanzeige gelesen und sich verschluckt: {n} Tage lang gehen keine Orbit-Rechnungen raus.", +"pie_ant.leak":"Der Gründer hat den nächsten Starttermin gepostet, die Rampe und ein Foto der Nutzlast. Die Startversicherer finden das nicht lustig: Die Versicherung kostet {n} Tage lang {p}.", +"pie_ant.mars":"Der Gründer hat den Mars bis nächstes Jahr versprochen. Der Orbit-Vertrieb ist {n} Tage lang aus dem Häuschen; niemand fragt, was nächstes Jahr passiert.", +"pie_ant.mars_slip":{"one":"Der Mars ist wieder ein Jahr nach hinten gerutscht. {n} Orbit-Kunde hat leise gekündigt.","other":"Der Mars ist wieder ein Jahr nach hinten gerutscht. {n} Orbit-Kunden haben leise gekündigt."}, +"pie_ant.mars_slip_none":"Der Mars ist wieder ein Jahr nach hinten gerutscht. Die Orbit-Kunden verdrehen die Augen.", +"pie_ant.reg":"Der Gründer hat einen Regulierer live auf Sendung ein Legacy-Protokoll genannt. Der Regulierer hat geantwortet, schriftlich.", +"pie_ant.reg_none":"Der Gründer hat einen Regulierer live auf Sendung ein Legacy-Protokoll genannt. Alle warten auf die Antwort.", +"pie_ant.spree":"Der Gründer hat zwischen 3 und 4 Uhr nachts {n}-mal gepostet. Die Orbit-Kunden sind nervös: {d} Tage lang weniger Anfragen und grantigere Kunden.", "pie_globe.switch_to_day_view":"Zur Tagansicht wechseln", "pie_globe.switch_to_night_view":"Zur Nachtansicht wechseln", "pie_globe.your_pies_in_orbit":"Deine Kuchen im Orbit, zum Drehen der Erde ziehen", diff --git a/site/i18n/es.js b/site/i18n/es.js index 9182266..0b95e12 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"Lo que publica el Fundador", "pie.fp_3am":"Publico a las 3 de la mañana porque dormir es un protocolo obsoleto. Nuestras tartas son un 40 % más ricas que el trimestre pasado.", "pie.fp_astro":"Los astrónomos dicen que nuestras tartas se cuelan en sus telescopios. ¿Han probado a mirar entre ellas?", +"pie.fp_backup":"La facturación vuelve desde la copia de seguridad del martes pasado. El pequeño {nick} está castigado hasta que aprenda qué son las consultas preparadas.", "pie.fp_baked":"{crust} está bien horneada. Próxima parada: Marte. Probablemente el año que viene.", "pie.fp_booster":"El propulsor se volcó al aterrizar. Fue un vuelco planeado. Lo llamamos recuperación horizontal rápida.", "pie.fp_debris":"Una pequeña guerra de comida en {crust}. Las migas son señal de una constelación sana.", "pie.fp_dish":"Nuestra primera antena-tarta ya funciona. Mi madre dice que la señal es genial.", "pie.fp_fail":"El lanzamiento de hoy ha sido un éxito enorme. El cohete ahora está en muchos sitios a la vez.", "pie.fp_found":"Fundada {co}. Nuestra misión: tartas en el cielo para que todos tengan su porción.", +"pie.fp_kid":"Bienvenido al mundo, {kid}. El pequeño {nick}, para abreviar. Papá orgulloso.", "pie.fp_launch":"{n} tartas más en {crust}. Audaz. Visionario. A tiempo (esta vez).", +"pie.fp_leak":"Próximo lanzamiento: martes, 6:42, rampa dos, foto de la carga adjunta. Legal dice que lo borre. No lo borro.", +"pie.fp_leak_kid":"El pequeño {nick} publicó la fecha del próximo lanzamiento desde mi móvil. Niños. (Fui yo.)", +"pie.fp_mars":"Marte el año que viene. Pies en Marte. Reserva ya.", +"pie.fp_mars_kid":"Le prometí al pequeño {nick} una fiesta de cumpleaños en Marte. El año que viene. Seguro que el año que viene.", +"pie.fp_mars_slip":"Marte es ahora el año {n}. Marte siempre fue el año {n}. El planeta rojo puede esperar.", "pie.fp_promise":"Promesa: cobertura total para el año {n}. Apuntadlo.", +"pie.fp_reg":"Los reguladores son cortafuegos con acreditación. Venid a por mí.", "pie.fp_rename":"Ahora somos {co}. El nombre viejo frenaba la visión.", "pie.fp_slip":"La cobertura total es ahora para el año {n}. Siempre fue el año {n}. Leed la letra pequeña.", "pie.fp_spat":"Algún gobierno tiene preguntas. Nos encantan las preguntas. Las contestamos todas, algún día, en un hilo.", +"pie.fp_spree":"Hilo 1/{n}: por qué dormir es un protocolo heredado, por qué los pies son un estilo de vida y por qué mis críticos son bots.", +"pie.fp_spree_kid":"Otra vez las 3 de la mañana. Al pequeño {nick} le salen los dientes, así que escribí un hilo. 1/{n}.", "pie.fp_storm":"El Sol tiene envidia de {crust}. Totalmente normal. El clima espacial es clima, pero más.", "pie.fp_test":"El vuelo de prueba {n} acabó en una bola de fuego, tal como esperábamos. Hemos aprendido muchísimo.", "pie.fp_tour":"Me aparto del Tier 1 para hacer una gira de escucha. Sobre todo hablaré yo.", "pie.half_baked":"A medio hornear", "pie.heavy_tests":"Vuelos de prueba hechos: {n} de {max}. Los primeros siempre explotan.", "pie.ins_off":"Seguro: no", -"pie.ins_on":"Seguro: sí (8 %)", +"pie.ins_on_p":"Seguro: sí ({p})", "pie.landing_rights":"Derechos de aterrizaje", "pie.las_off":"Láseres: no", "pie.las_on":"Láseres: sí (+$0.5M por tarta)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"El calendario de lanzamientos está lleno.", "pie.why_stock":"Necesita {n} tartas; la fábrica tiene {have}.", "pie.would_have":"Habría costado", +"pie_ant.backup":"La facturación orbital se ha restaurado desde la copia de seguridad. Las facturas vuelven a salir.", +"pie_ant.bill_paused":"La facturación orbital está caída hasta el {d}: la base de datos aún se atraganta con {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervios en el mercado: 😌 calma", +"pie_ant.jit_high":"😬 altos", +"pie_ant.jit_line":{"one":"Nervios en el mercado: {lvl}, se calman en ~{n} día","other":"Nervios en el mercado: {lvl}, se calman en ~{n} días"}, +"pie_ant.jit_low":"🙂 bajos", +"pie_ant.jit_mid":"😟 inquietos", +"pie_ant.kid":"El Fundador llamó a su hijo {kid}. La base de datos de facturación leyó el anuncio del nacimiento y se atragantó: durante {n} días no sale ninguna factura orbital.", +"pie_ant.leak":"El Fundador publicó la fecha del próximo lanzamiento, la rampa y una foto de la carga. A las aseguradoras no les hace gracia: el seguro cuesta {p} durante {n} días.", +"pie_ant.mars":"El Fundador prometió Marte para el año que viene. Las ventas orbitales están eufóricas durante {n} días; nadie pregunta qué pasará el año que viene.", +"pie_ant.mars_slip":{"one":"Marte se retrasa otro año. {n} cliente orbital se ha dado de baja sin hacer ruido.","other":"Marte se retrasa otro año. {n} clientes orbitales se han dado de baja sin hacer ruido."}, +"pie_ant.mars_slip_none":"Marte se retrasa otro año. Los clientes orbitales ponen los ojos en blanco.", +"pie_ant.reg":"El Fundador llamó protocolo heredado a un regulador, en directo. El regulador ha respondido, por escrito.", +"pie_ant.reg_none":"El Fundador llamó protocolo heredado a un regulador, en directo. Todos esperan la respuesta.", +"pie_ant.spree":"El Fundador publicó {n} veces entre las 3 y las 4 de la mañana. Los clientes orbitales están nerviosos: menos llamadas y clientes más gruñones durante {d} días.", "pie_globe.switch_to_day_view":"Cambiar a vista de día", "pie_globe.switch_to_night_view":"Cambiar a vista nocturna", "pie_globe.your_pies_in_orbit":"Tus tartas en órbita, arrastra para girar la Tierra", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index f91d0a3..b787b96 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"Les posts du Fondateur", "pie.fp_3am":"Je poste à 3 h du matin, car le sommeil est un protocole obsolète. Nos tartes sont 40 % plus délicieuses qu'au trimestre dernier.", "pie.fp_astro":"Les astronomes disent que nos tartes s'incrustent dans leurs télescopes. Ont-ils essayé de regarder entre elles ?", +"pie.fp_backup":"La facturation revient de la sauvegarde de mardi dernier. Le petit {nick} est privé de sortie jusqu'à ce qu'il comprenne les requêtes préparées.", "pie.fp_baked":"{crust} est bien cuite. Prochain arrêt : Mars. Sans doute l'an prochain.", "pie.fp_booster":"Le booster s'est renversé à l'atterrissage. C'était prévu. On appelle ça une récupération horizontale rapide.", "pie.fp_debris":"Une petite bataille de nourriture dans {crust}. Les miettes sont le signe d'une constellation en bonne santé.", "pie.fp_dish":"Notre première antenne-tarte est en service. Ma mère dit que le signal est super.", "pie.fp_fail":"Le lancement d'aujourd'hui est un immense succès. La fusée est désormais à plusieurs endroits à la fois.", "pie.fp_found":"{co} est fondée. Notre mission : mettre des tartes dans le ciel pour que chacun ait sa part.", +"pie.fp_kid":"Bienvenue au monde, {kid}. Le petit {nick}, pour faire court. Papa fier.", "pie.fp_launch":"{n} tartes de plus sur {crust}. Audacieux. Visionnaire. À l'heure (cette fois).", +"pie.fp_leak":"Prochain lancement : mardi, 6 h 42, pas de tir deux, photo de la charge utile jointe. Le service juridique dit de supprimer. Je ne supprime pas.", +"pie.fp_leak_kid":"Le petit {nick} a publié la date du prochain lancement depuis mon téléphone. Les enfants, hein. (C'était moi.)", +"pie.fp_mars":"Mars l'an prochain. Des pies sur Mars. Réservez maintenant.", +"pie.fp_mars_kid":"J'ai promis au petit {nick} un anniversaire sur Mars. L'an prochain. Sûrement l'an prochain.", +"pie.fp_mars_slip":"Mars, c'est maintenant l'année {n}. Mars a toujours été l'année {n}. La planète rouge peut attendre.", "pie.fp_promise":"Promis : couverture totale d'ici l'an {n}. Notez-le.", +"pie.fp_reg":"Les régulateurs ne sont que des pare-feu avec un badge. Venez.", "pie.fp_rename":"On s'appelle {co} maintenant. L'ancien nom bridait la vision.", "pie.fp_slip":"La couverture totale, c'est maintenant l'an {n}. Ça a toujours été l'an {n}. Lisez les notes de bas de page.", "pie.fp_spat":"Un gouvernement a des questions. On adore les questions. On y répond toutes, un jour, dans un thread.", +"pie.fp_spree":"Thread 1/{n} : pourquoi le sommeil est un protocole obsolète, pourquoi les pies sont un art de vivre et pourquoi mes critiques sont des bots.", +"pie.fp_spree_kid":"Encore 3 h du matin. Le petit {nick} fait ses dents, alors j'ai écrit un thread. 1/{n}.", "pie.fp_storm":"Le Soleil est jaloux de {crust}. Tout à fait normal. La météo spatiale, c'est de la météo, en plus fort.", "pie.fp_test":"Le vol d'essai {n} a fini en boule de feu, exactement comme espéré. On a tellement appris.", "pie.fp_tour":"Je prends du recul sur le Tier 1 pour une tournée d'écoute. Surtout, je vais parler.", "pie.half_baked":"À moitié cuite", "pie.heavy_tests":"Vols d'essai effectués : {n} sur {max}. Les premiers explosent toujours.", "pie.ins_off":"Assurance : non", -"pie.ins_on":"Assurance : oui (8 %)", +"pie.ins_on_p":"Assurance : oui ({p})", "pie.landing_rights":"Droits d'atterrissage", "pie.las_off":"Lasers : non", "pie.las_on":"Lasers : oui (+0,5 M$ par tarte)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"Le calendrier des lancements est plein.", "pie.why_stock":"Il faut {n} tartes ; l'usine en a {have}.", "pie.would_have":"Aurait coûté", +"pie_ant.backup":"La facturation orbitale est restaurée depuis la sauvegarde. Les factures repartent.", +"pie_ant.bill_paused":"La facturation orbitale est en panne jusqu'au {d} : la base de données s'étrangle encore sur {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosité du marché : 😌 calme", +"pie_ant.jit_high":"😬 forte", +"pie_ant.jit_line":{"one":"Nervosité du marché : {lvl}, retour au calme dans ~{n} jour","other":"Nervosité du marché : {lvl}, retour au calme dans ~{n} jours"}, +"pie_ant.jit_low":"🙂 faible", +"pie_ant.jit_mid":"😟 inquiète", +"pie_ant.kid":"Le Fondateur a appelé son fils {kid}. La base de facturation a lu le faire-part et s'est étranglée : aucune facture orbitale ne part pendant {n} jours.", +"pie_ant.leak":"Le Fondateur a publié la date du prochain lancement, le pas de tir et une photo de la charge utile. Les assureurs n'apprécient pas : l'assurance coûte {p} pendant {n} jours.", +"pie_ant.mars":"Le Fondateur a promis Mars pour l'an prochain. Les ventes orbitales s'emballent pendant {n} jours ; personne ne demande ce qui se passera l'an prochain.", +"pie_ant.mars_slip":{"one":"Mars glisse encore d'un an. {n} client orbital a résilié sans bruit.","other":"Mars glisse encore d'un an. {n} clients orbitaux ont résilié sans bruit."}, +"pie_ant.mars_slip_none":"Mars glisse encore d'un an. Les clients orbitaux lèvent les yeux au ciel.", +"pie_ant.reg":"Le Fondateur a traité un régulateur de protocole obsolète, en direct. Le régulateur a répondu, par écrit.", +"pie_ant.reg_none":"Le Fondateur a traité un régulateur de protocole obsolète, en direct. Tout le monde attend la réponse.", +"pie_ant.spree":"Le Fondateur a publié {n} fois entre 3 h et 4 h du matin. Les clients orbitaux sont nerveux : moins d'appels et des clients plus grincheux pendant {d} jours.", "pie_globe.switch_to_day_view":"Passer en vue de jour", "pie_globe.switch_to_night_view":"Passer en vue de nuit", "pie_globe.your_pies_in_orbit":"Tes tartes en orbite, fais glisser pour tourner la Terre", diff --git a/site/i18n/it.js b/site/i18n/it.js index be89ce2..71b2ced 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"I post del Fondatore", "pie.fp_3am":"Posto alle 3 di notte perché il sonno è un protocollo legacy. Le nostre torte sono il 40% più buone dello scorso trimestre.", "pie.fp_astro":"Gli astronomi dicono che le nostre torte fanno photobombing nei loro telescopi. Hanno provato a guardare in mezzo?", +"pie.fp_backup":"La fatturazione è tornata dal backup di martedì scorso. Il piccolo {nick} è in punizione finché non impara le prepared statement.", "pie.fp_baked":"{crust} è ben cotta. Prossima fermata: Marte. Probabilmente l'anno prossimo.", "pie.fp_booster":"Il booster si è ribaltato all'atterraggio. Era un ribaltamento previsto. Lo chiamiamo recupero orizzontale rapido.", "pie.fp_debris":"Una piccola battaglia di cibo in {crust}. Le briciole sono segno di una costellazione in salute.", "pie.fp_dish":"La nostra prima parabola-torta è attiva. Mia mamma dice che il segnale è ottimo.", "pie.fp_fail":"Il lancio di oggi è stato un enorme successo. Il razzo ora si trova in molti posti contemporaneamente.", "pie.fp_found":"Fondata {co}. La nostra missione: torte in cielo, così ognuno ha la sua fetta.", +"pie.fp_kid":"Benvenuto al mondo, {kid}. Il piccolo {nick}, per gli amici. Papà orgoglioso.", "pie.fp_launch":"Altre {n} torte in {crust}. Audace. Visionario. In orario (stavolta).", +"pie.fp_leak":"Prossimo lancio: martedì, 6:42, rampa due, foto del carico in allegato. L'ufficio legale dice di cancellarlo. Non lo cancello.", +"pie.fp_leak_kid":"Il piccolo {nick} ha postato la data del prossimo lancio dal mio telefono. Bambini, eh. (Sono stato io.)", +"pie.fp_mars":"Marte l'anno prossimo. Pie su Marte. Prenota ora.", +"pie.fp_mars_kid":"Ho promesso al piccolo {nick} una festa di compleanno su Marte. L'anno prossimo. Sicuramente l'anno prossimo.", +"pie.fp_mars_slip":"Marte adesso è l'anno {n}. Marte è sempre stato l'anno {n}. Il pianeta rosso può aspettare.", "pie.fp_promise":"Promessa: copertura totale entro l'anno {n}. Segnatevelo.", +"pie.fp_reg":"I regolatori sono solo firewall con il badge. Fatevi sotto.", "pie.fp_rename":"Ora ci chiamiamo {co}. Il vecchio nome frenava la visione.", "pie.fp_slip":"La copertura totale ora è per l'anno {n}. È sempre stato l'anno {n}. Leggete le note a piè di pagina.", "pie.fp_spat":"Un governo ha delle domande. Adoriamo le domande. Rispondiamo a tutte, prima o poi, in un thread.", +"pie.fp_spree":"Thread 1/{n}: perché il sonno è un protocollo legacy, perché le pie sono uno stile di vita e perché i miei critici sono bot.", +"pie.fp_spree_kid":"Di nuovo le 3 di notte. Al piccolo {nick} stanno spuntando i denti, quindi ho scritto un thread. 1/{n}.", "pie.fp_storm":"Il Sole è geloso di {crust}. Tutto normale. Il meteo spaziale è meteo, solo di più.", "pie.fp_test":"Il volo di prova {n} è finito in una palla di fuoco, proprio come speravamo. Abbiamo imparato tantissimo.", "pie.fp_tour":"Faccio un passo indietro dal Tier 1 per un tour dell'ascolto. Parlerò soprattutto io.", "pie.half_baked":"Mezza cruda", "pie.heavy_tests":"Voli di prova fatti: {n} di {max}. I primi esplodono sempre.", "pie.ins_off":"Assicurazione: no", -"pie.ins_on":"Assicurazione: sì (8%)", +"pie.ins_on_p":"Assicurazione: sì ({p})", "pie.landing_rights":"Diritti di atterraggio", "pie.las_off":"Laser: no", "pie.las_on":"Laser: sì (+$0.5M a torta)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"Il calendario dei lanci è pieno.", "pie.why_stock":"Servono {n} torte; la fabbrica ne ha {have}.", "pie.would_have":"Sarebbe costato", +"pie_ant.backup":"La fatturazione orbitale è stata ripristinata dal backup. Le fatture ripartono.", +"pie_ant.bill_paused":"La fatturazione orbitale è ferma fino al {d}: il database si sta ancora strozzando con {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosismo del mercato: 😌 calmo", +"pie_ant.jit_high":"😬 alto", +"pie_ant.jit_line":{"one":"Nervosismo del mercato: {lvl}, si calma tra ~{n} giorno","other":"Nervosismo del mercato: {lvl}, si calma tra ~{n} giorni"}, +"pie_ant.jit_low":"🙂 basso", +"pie_ant.jit_mid":"😟 agitato", +"pie_ant.kid":"Il Fondatore ha chiamato suo figlio {kid}. Il database della fatturazione ha letto l'annuncio della nascita e si è strozzato: per {n} giorni non parte nessuna fattura orbitale.", +"pie_ant.leak":"Il Fondatore ha postato la data del prossimo lancio, la rampa e una foto del carico. Gli assicuratori non ridono: l'assicurazione costa {p} per {n} giorni.", +"pie_ant.mars":"Il Fondatore ha promesso Marte entro l'anno prossimo. Le vendite orbitali sono euforiche per {n} giorni; nessuno chiede cosa succede l'anno prossimo.", +"pie_ant.mars_slip":{"one":"Marte slitta di un altro anno. {n} cliente orbitale ha disdetto in silenzio.","other":"Marte slitta di un altro anno. {n} clienti orbitali hanno disdetto in silenzio."}, +"pie_ant.mars_slip_none":"Marte slitta di un altro anno. I clienti orbitali alzano gli occhi al cielo.", +"pie_ant.reg":"Il Fondatore ha dato del protocollo legacy a un regolatore, in diretta. Il regolatore ha risposto, per iscritto.", +"pie_ant.reg_none":"Il Fondatore ha dato del protocollo legacy a un regolatore, in diretta. Tutti aspettano la risposta.", +"pie_ant.spree":"Il Fondatore ha postato {n} volte tra le 3 e le 4 di notte. I clienti orbitali sono nervosi: meno chiamate e clienti più scontrosi per {d} giorni.", "pie_globe.switch_to_day_view":"Passa alla vista diurna", "pie_globe.switch_to_night_view":"Passa alla vista notturna", "pie_globe.your_pies_in_orbit":"Le tue torte in orbita, trascina per girare la Terra", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 007658f..1db0fd0 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3422,24 +3422,34 @@ "pie.founder_feed":"Os posts do Fundador", "pie.fp_3am":"Postando às 3 da manhã porque dormir é um protocolo legado. Nossas tortas estão 40% mais gostosas que no último trimestre.", "pie.fp_astro":"Astrônomos dizem que nossas tortas aparecem de penetra nos telescópios. Já tentaram olhar entre elas?", +"pie.fp_backup":"A faturação voltou do backup da terça passada. O pequeno {nick} está de castigo até aprender o que são prepared statements.", "pie.fp_baked":"{crust} está bem assada. Próxima parada: Marte. Provavelmente no ano que vem.", "pie.fp_booster":"O propulsor tombou no pouso. Foi um tombo planejado. Chamamos de recuperação horizontal rápida.", "pie.fp_debris":"Uma pequena guerra de comida em {crust}. Migalhas são sinal de uma constelação saudável.", "pie.fp_dish":"Nossa primeira antena-torta está no ar. Minha mãe disse que o sinal está ótimo.", "pie.fp_fail":"O lançamento de hoje foi um enorme sucesso. O foguete agora está em vários lugares ao mesmo tempo.", "pie.fp_found":"Fundei a {co}. Nossa missão: tortas no céu para todo mundo ganhar uma fatia.", +"pie.fp_kid":"Bem-vindo ao mundo, {kid}. O pequeno {nick}, para encurtar. Pai orgulhoso.", "pie.fp_launch":"Mais {n} tortas em {crust}. Ousado. Visionário. No prazo (desta vez).", +"pie.fp_leak":"Próximo lançamento: terça, 6:42, plataforma dois, foto da carga em anexo. O jurídico diz para apagar. Não vou apagar.", +"pie.fp_leak_kid":"O pequeno {nick} publicou a data do próximo lançamento no meu telemóvel. Crianças, né. (Fui eu.)", +"pie.fp_mars":"Marte no ano que vem. Pies em Marte. Reserve já.", +"pie.fp_mars_kid":"Prometi ao pequeno {nick} uma festa de aniversário em Marte. No ano que vem. De certeza no ano que vem.", +"pie.fp_mars_slip":"Marte agora é o ano {n}. Marte sempre foi o ano {n}. O planeta vermelho pode esperar.", "pie.fp_promise":"Promessa: cobertura total até o ano {n}. Anotem.", +"pie.fp_reg":"Reguladores são só firewalls com crachá. Venham.", "pie.fp_rename":"Agora somos a {co}. O nome antigo segurava a visão.", "pie.fp_slip":"A cobertura total agora é no ano {n}. Sempre foi o ano {n}. Leiam as notas de rodapé.", "pie.fp_spat":"Algum governo tem perguntas. Adoramos perguntas. Respondemos todas, um dia, numa thread.", +"pie.fp_spree":"Fio 1/{n}: porque dormir é um protocolo legado, porque pies são um estilo de vida e porque os meus críticos são bots.", +"pie.fp_spree_kid":"Outra vez 3 da manhã. O pequeno {nick} está com os dentes a nascer, então escrevi um fio. 1/{n}.", "pie.fp_storm":"O Sol está com inveja de {crust}. Totalmente normal. Clima espacial é clima, só que mais.", "pie.fp_test":"O voo de teste {n} terminou numa bola de fogo, exatamente como esperávamos. Aprendemos muito.", "pie.fp_tour":"Vou me afastar do Tier 1 para uma turnê de escuta. Quem vai falar sou eu, principalmente.", "pie.half_baked":"Meio crua", "pie.heavy_tests":"Voos de teste feitos: {n} de {max}. Os primeiros sempre explodem.", "pie.ins_off":"Seguro: não", -"pie.ins_on":"Seguro: sim (8%)", +"pie.ins_on_p":"Seguro: sim ({p})", "pie.landing_rights":"Direitos de pouso", "pie.las_off":"Lasers: não", "pie.las_on":"Lasers: sim (+$0.5M por torta)", @@ -3512,6 +3522,22 @@ "pie.why_queue_full":"O calendário de lançamentos está cheio.", "pie.why_stock":"Precisa de {n} tortas; a fábrica tem {have}.", "pie.would_have":"Teria custado", +"pie_ant.backup":"A faturação orbital foi restaurada do backup. As faturas voltam a sair.", +"pie_ant.bill_paused":"A faturação orbital está em baixo até {d}: a base de dados ainda se engasga com {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Nervosismo do mercado: 😌 calmo", +"pie_ant.jit_high":"😬 alto", +"pie_ant.jit_line":{"one":"Nervosismo do mercado: {lvl}, acalma em ~{n} dia","other":"Nervosismo do mercado: {lvl}, acalma em ~{n} dias"}, +"pie_ant.jit_low":"🙂 baixo", +"pie_ant.jit_mid":"😟 agitado", +"pie_ant.kid":"O Fundador deu ao filho o nome {kid}. A base de dados da faturação leu o anúncio do nascimento e engasgou-se: durante {n} dias não sai nenhuma fatura orbital.", +"pie_ant.leak":"O Fundador publicou a data do próximo lançamento, a plataforma e uma foto da carga. As seguradoras não acharam graça: o seguro custa {p} durante {n} dias.", +"pie_ant.mars":"O Fundador prometeu Marte até ao ano que vem. As vendas orbitais andam eufóricas durante {n} dias; ninguém pergunta o que acontece no ano que vem.", +"pie_ant.mars_slip":{"one":"Marte escorregou mais um ano. {n} cliente orbital cancelou em silêncio.","other":"Marte escorregou mais um ano. {n} clientes orbitais cancelaram em silêncio."}, +"pie_ant.mars_slip_none":"Marte escorregou mais um ano. Os clientes orbitais reviram os olhos.", +"pie_ant.reg":"O Fundador chamou protocolo legado a um regulador, em direto. O regulador respondeu, por escrito.", +"pie_ant.reg_none":"O Fundador chamou protocolo legado a um regulador, em direto. Todos esperam a resposta.", +"pie_ant.spree":"O Fundador publicou {n} vezes entre as 3 e as 4 da manhã. Os clientes orbitais estão nervosos: menos chamadas e clientes mais rabugentos durante {d} dias.", "pie_globe.switch_to_day_view":"Mudar para a visão diurna", "pie_globe.switch_to_night_view":"Mudar para a visão noturna", "pie_globe.your_pies_in_orbit":"Suas tortas em órbita, arraste para girar a Terra", diff --git a/src/agent/30-docs.js b/src/agent/30-docs.js index 8874bf1..d37b6e3 100644 --- a/src/agent/30-docs.js +++ b/src/agent/30-docs.js @@ -53,7 +53,7 @@ const API_STATE_DOC={ scrubMode:{type:'string',doc:'always | ondemand.'}, cnLic:{type:'map',doc:'Mainland China licence: none | pending (with ready day) | ok.'}, pieV:{type:'number',doc:'Pie in the Sky version stamp: 1 in games started since it shipped (only those unlock it, on a Tier 1 win).'}, - pie:{type:'map',doc:'The rocket company (Pie in the Sky), or null: company, factory, stock, pads, crusts (cohorts of pies by launch day), dishes, landing rights (lic), launch queue (q), R&D, spats, founder posts, books, and government money (gov: auctions, awards, Ex-Im).'}, + pie:{type:'map',doc:'The rocket company (Pie in the Sky), or null: company, factory, stock, pads, crusts (cohorts of pies by launch day), dishes, landing rights (lic), launch queue (q), R&D, spats, the founder (posts, promises made and broken with their due days, and his antics: jit, the market jitters 0..1 that fade over 30 days and lower orbit offer odds and happiness; next, the day of the next antic; kid, 1 + the index of PIE_KIDS once he has named his son; bill, the day orbit billing comes back (no orbit income until then); nerv, hype, leak: days a posting spree, Mars hype and a leaked launch date (dearer launch insurance) last until; mars, the due day of the Mars promise, whose slip loses a few orbit customers; all only with chaos on), books, and government money (gov: auctions, awards, Ex-Im).'}, ppol:{type:'string',doc:'Your published peering policy: open | selective | closed.'}, pdesk:{type:'map',doc:'This week\'s peering desk summary: sessions accepted and declined at which exchanges.'}, pdeskRep:{type:'map',doc:'Last week\'s peering desk summary, as the NOC log reported it.'}, @@ -95,7 +95,7 @@ const API_STATE_DOC={ }; const API_RESULTS_DOC={ - pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev, including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, + pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev; 0 while the founder has orbit billing down, with billOff what it would have been; including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'}, nt:{type:'map',doc:'Traffic per network through transit, by net id.'}, tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'}, reachNT:{type:'number',doc:'Networks reachable without transit.'}, diff --git a/src/game/60-features/99-pie-in-the-sky.js b/src/game/60-features/99-pie-in-the-sky.js index d2253f4..4dfe8ec 100644 --- a/src/game/60-features/99-pie-in-the-sky.js +++ b/src/game/60-features/99-pie-in-the-sky.js @@ -18,7 +18,7 @@ - book.earned: revenue from orbit, for the customers that come with routing. */ function pieBlank(day){const crusts={};for(const id in CRUSTS)crusts[id]={cohorts:[],queued:0}; return {born:day,co:null,fac:false,stock:0,rd:{reuse:false,heavy:false,heavyTests:0},pads:[],crusts,dishes:[],lic:{},q:[], - founder:{posts:[],promises:0,broken:0,due:[]},book:{spent:0,earned:0,wouldHave:0},spat:{},safe:false,gov:pieGovBlank()};} + founder:{posts:[],promises:0,broken:0,due:[],jit:0,next:0,kid:0,bill:0,nerv:0,hype:0,leak:0,mars:0},book:{spent:0,earned:0,wouldHave:0},spat:{},safe:false,gov:pieGovBlank()};} function pieInit(){if(!S.pie)S.pie=pieBlank(S.day);return S.pie;} // The unlock: only on the Tier 1 transition of a save of this version, and only in a normal game. function pieUnlock(){if(S.pie||!(S.pieV>=1)||S.mode!=='normal'||S.scn)return;pieInit();track('pie_unlock'); @@ -50,8 +50,8 @@ function pieSpatDay(d){const sp=S.pie.spat;for(const k of Object.keys(sp)){const const pieYear=d=>1+Math.floor(d/360); function pieFounder(k,v={}){const F=S.pie.founder,p={d:S.day,k};if(v.n!==undefined)p.n=v.n;if(v.c)p.c=v.c;F.posts.unshift(p);if(F.posts.length>PIE_POSTS)F.posts.length=PIE_POSTS;} // Every promise slips by a year: made today, due in a year, broken then. -function piePromise(){const F=S.pie.founder;F.promises++;const due=S.day+360;F.due.push(due);if(F.due.length>8)F.due.shift();pieFounder(N_('pie.fp_promise'),{n:pieYear(due)});} -function pieFpText(p){const C=own(CRUSTS,p.c||'')?tr(CRUSTS[p.c].n):'',n=p.n||0;return tr(p.k,{co:pieCoName(),n,crust:C});} +function piePromise(k=N_('pie.fp_promise')){const F=S.pie.founder;F.promises++;const due=S.day+360;F.due.push(due);if(F.due.length>8)F.due.shift();pieFounder(k,{n:pieYear(due)});return due;} +function pieFpText(p){const C=own(CRUSTS,p.c||'')?tr(CRUSTS[p.c].n):'',n=p.n||0,K=pieKid();return tr(p.k,{co:pieCoName(),n,crust:C,kid:K?K.n:'',nick:K?K.k:''});} // Pads that can reach a crust: an orbit's inclination is at least the pad's latitude. const piePadOk=(c,cr)=>CRUSTS[cr].polar||Math.abs(CITY[c].lat)<=CRUSTS[cr].inc; const pieRkOk=rk=>{const R0=ROCKETS[rk];return !R0.rd||!!S.pie.rd[R0.rd];}; @@ -68,7 +68,7 @@ function pieQuote(rk,cr,o={}){const P=S.pie;if(!P||!own(ROCKETS,rk)||!own(CRUSTS if(!test&&pieLive(cr)+P.crusts[cr].queued+n>C.full*PIE_SPARE)return {why:tr('pie.why_full')}; const t0=S.day+leadDays(PIE_PREP),pad=pads.slice().sort((a,b)=>Math.max(t0,a.next)-Math.max(t0,b.next)||Math.abs(CITY[a.city].lat)-Math.abs(CITY[b.city].lat))[0]; const rocket=piePrice(R0.cost)*(1-pieEq(pad.city))*pieCrMul(cr),boost=rk==='again'&&!pad.boosters.length?piePrice(PIE_BOOST):0,pies=n*piePrice(PIE_PIE+(o.las?PIE_LAS:0)); - const ins=o.ins&&!test?Math.round((rocket+pies)*PIE_INS):0; + const ins=o.ins&&!test?Math.round((rocket+pies)*PIE_INS*pieInsMul()):0; return {ok:true,test,n,pad:pad.city,day:Math.max(t0,pad.next),cost:Math.round(rocket+boost+pies+ins),insured:Math.round(rocket+pies),ins:!!ins};} // The cheapest a crust can be filled from nothing (one-off costs only): rule O7. function pieFullCost(cr){const C=CRUSTS[cr],base=PIE_CO+PIE_FAC+PIE_PAD,pies=C.full*PIE_PIE; @@ -112,7 +112,7 @@ function pieDay(d){const P=S.pie;if(!P)return; if(P.q.length){const due=P.q.filter(L=>L.day<=d);if(due.length){P.q=P.q.filter(L=>L.day>d);for(const L of due)pieFly(L);}} for(const id in CRUSTS){const c=P.crusts[id],life=CRUSTS[id].life;if(c.cohorts.length&&d-c.cohorts[0].day>=life)c.cohorts=c.cohorts.filter(k=>d-k.dayob(x)&&FOUNDER_POSTS.includes(x.k)).slice(0,PIE_POSTS).map(x=>{const q={d:int(x.d,0,day,day),k:x.k};if(x.n!==undefined)q.n=n(x.n,1e7);if(own(CRUSTS,x.c||''))q.c=x.c;return q;}); - o.founder.due=(Array.isArray(F.due)?F.due:[]).map(v=>int(v,0,day+720,day)).sort((a,b)=>a-b).slice(-8);} + o.founder.due=(Array.isArray(F.due)?F.due:[]).map(v=>int(v,0,day+720,day)).sort((a,b)=>a-b).slice(-8);pieAnticFix(o.founder,F,day);} if(ob(p.book))for(const k of ['spent','earned','wouldHave'])o.book[k]=m(p.book[k],1e15); if(ob(p.spat))for(const k of Object.keys(p.spat)){const D=PIE_SPATS[k];if(!D||!ob(p.spat[k]))continue;const v=D.fix?D.fix(p.spat[k],s):null;if(v)o.spat[k]=v;} o.gov=pieGovFix(p.gov,s); diff --git a/src/game/60-features/99-pie-jitters.js b/src/game/60-features/99-pie-jitters.js new file mode 100644 index 0000000..79d6a4e --- /dev/null +++ b/src/game/60-features/99-pie-jitters.js @@ -0,0 +1,68 @@ +/* ---------- Pie in the Sky: the Founder's antics and the market's jitters (docs/plans/pie-in-the-sky.md) ---------- + Every 60 to 120 days while a rocket company exists, the Founder does something daft: a post, a gasp (a toast) and a + real effect that wears off. Each antic also bumps the market's jitters (S.pie.founder.jit, 0..1), which fade to nothing + over PIE_JIT_DAYS and meanwhile make orbit customers call less and keep the happiest a little less happy (at most + PIE_JIT_CAP under 100, never low enough to cancel over it): Ooooh, Uuuuuh, then it normalises. + Rule O5: the harm needs pieChaos() (chaos on, the 90 quiet days over); without it he still posts and nothing else + happens. Dice are rolled only with a company (pieAnticDay returns first), so every other game plays as before. + State in S.pie.founder (pieBlank, pieSanitize): jit; next, the day of the next antic (0: not planned yet); kid, 1 + an + index of PIE_KIDS (once a game, then a running gag); bill, the day orbit billing is back; nerv, hype, leak: the days + those last until; mars, the due day (in due) of the Mars promise, whose slip costs a few orbit customers. */ +const PIE_ANTIC_FIRST=90,PIE_ANTIC_GAP=60,PIE_ANTIC_SPAN=61,PIE_JIT_DAYS=30,PIE_JIT_OFFER=0.3,PIE_JIT_CAP=25, + PIE_KID_DAYS=3,PIE_SPREE_DAYS=14,PIE_NERV=0.6,PIE_SPREE_MOOD=4,PIE_LEAK_DAYS=30,PIE_LEAK_INS=1.75,PIE_HYPE_DAYS=14,PIE_HYPE=1.5,PIE_MARS_CHURN=0.02; +// The kid's name (code, not words: never translated) and what the feed calls him afterwards. +const PIE_KIDS=[{n:"Orbit'); DROP TABLE invoices;--",k:'Orby Tables'},{n:"Perigee'); DELETE FROM billing;--",k:'Perry Tables'},{n:"Max Q'); TRUNCATE customers;--",k:'Maxie Tables'}]; +FOUNDER_POSTS.push(N_('pie.fp_backup'),N_('pie.fp_kid'),N_('pie.fp_leak'),N_('pie.fp_leak_kid'),N_('pie.fp_mars'),N_('pie.fp_mars_kid'),N_('pie.fp_mars_slip'),N_('pie.fp_reg'),N_('pie.fp_spree'),N_('pie.fp_spree_kid')); +const pieKid=()=>{const F=S&&S.pie&&S.pie.founder;return F&&F.kid?PIE_KIDS[F.kid-1]:null;}; +const pieBump=(F,v)=>{F.jit=Math.min(1,+(F.jit+v).toFixed(4));}; +const pieOrbitBiz=()=>S.biz.filter(b=>BIZ_T[b.type].orbit); +// Read by pieMoney() (no orbit income while billing is down), pieQuote() (insurance) and the orbit sales desk (offers). +function pieBillOff(){const P=S&&S.pie;return !!P&&P.founder.bill>S.day&&pieChaos();} +function pieInsMul(){const P=S&&S.pie;return P&&P.founder.leak>S.day&&pieChaos()?PIE_LEAK_INS:1;} +function pieOfferMul(){const P=S.pie;if(!P||!pieChaos())return 1;const F=P.founder;let m=1-PIE_JIT_OFFER*F.jit;if(F.nerv>S.day)m*=PIE_NERV;if(F.hype>S.day)m*=PIE_HYPE;return m;} +// The antics: w their weight, ok(F) whether he can, go(F,harm,d) posts and, with harm, does it and returns the toast's text; +// j: how much it rattles the market. +const PIE_ANTICS={ + kid:{w:1.5,j:0.7,ok:F=>!F.kid,go:(F,h,d)=>{F.kid=1+Math.floor(Math.random()*PIE_KIDS.length);pieFounder(N_('pie.fp_kid'));if(!h)return ''; + const n=rint(PIE_KID_DAYS,3);F.bill=d+n+1;return tr('pie_ant.kid',{kid:esc(pieKid().n),n});}}, + spree:{w:3,j:0.6,ok:()=>true,go:(F,h,d)=>{const n=rint(40,50);pieFounder(F.kid?N_('pie.fp_spree_kid'):N_('pie.fp_spree'),{n});if(!h)return ''; + F.nerv=d+PIE_SPREE_DAYS;pieMood(b=>!!BIZ_T[b.type].orbit,-PIE_SPREE_MOOD);return tr('pie_ant.spree',{n,d:PIE_SPREE_DAYS});}}, + reg:{w:1,j:0.4,ok:()=>true,go:(F,h)=>{pieFounder(N_('pie.fp_reg'));if(!h)return '';const P=S.pie; + // A country where you have a dish or landing rights, through the spats' own machinery (pieSpatStart). + if(Object.keys(P.spat).lengthtrue,go:(F,h,d)=>{pieFounder(F.kid?N_('pie.fp_leak_kid'):N_('pie.fp_leak'));if(!h)return ''; + F.leak=d+PIE_LEAK_DAYS;return tr('pie_ant.leak',{p:pct(PIE_INS*PIE_LEAK_INS),n:PIE_LEAK_DAYS});}}, + mars:{w:2,j:0.3,ok:F=>!F.mars,go:(F,h,d)=>{F.mars=piePromise(F.kid?N_('pie.fp_mars_kid'):N_('pie.fp_mars'));if(!h)return ''; + F.hype=d+PIE_HYPE_DAYS;return tr('pie_ant.mars',{n:PIE_HYPE_DAYS});}}, +}; +const PIE_ANTIC_KEYS=Object.keys(PIE_ANTICS); +// One antic (k forces which, for tests); true when he did something. +function pieAntic(k){const P=S.pie;if(!P||!P.co)return false;const F=P.founder,d=S.day,h=pieChaos(); + if(!k){const o=PIE_ANTIC_KEYS.filter(x=>PIE_ANTICS[x].ok(F));let r=Math.random()*o.reduce((a,x)=>a+PIE_ANTICS[x].w,0);k=o[o.length-1];for(const x of o){r-=PIE_ANTICS[x].w;if(r<=0){k=x;break;}}} + const A=PIE_ANTICS[k];if(!A||!A.ok(F))return false;S.stats.pieAnt=(S.stats.pieAnt||0)+1; + const b=A.go(F,h,d);if(!h)return true; + pieBump(F,A.j);toast(`😱 ${tr('pie_ant.gasp')}
${b}`,'bad');sfx('alert');return true;} +// The Mars promise slipped (pieDay, when its due day comes): the unhappiest few orbit customers had enough. +function pieMarsSlip(d){const F=S.pie.founder;F.mars=0;pieFounder(N_('pie.fp_mars_slip'),{n:pieYear(d+360)});if(!pieChaos())return;pieBump(F,PIE_ANTICS.mars.j); + const bs=pieOrbitBiz().sort((a,b)=>a.mood-b.mood),n=Math.round(bs.length*PIE_MARS_CHURN); + if(n){const go=new Set(bs.slice(0,n));S.biz=S.biz.filter(b=>!go.has(b));S.stats.pieChurn=(S.stats.pieChurn||0)+n;} + toast(`😱 ${tr('pie_ant.gasp')}
${n?trn('pie_ant.mars_slip',n):tr('pie_ant.mars_slip_none')}`,'bad');} +function pieAnticDay(d){const P=S.pie,F=P.founder;if(!P.co)return; + if(F.bill&&d>=F.bill-1){F.bill=0;pieFounder(N_('pie.fp_backup'));if(pieChaos())toast(tr('pie_ant.backup'),'good');} + if(F.mars&&!F.due.includes(F.mars))F.mars=0; + if(F.jit>0){if(pieChaos()){const top=100-PIE_JIT_CAP*F.jit;for(const b of S.biz)if(BIZ_T[b.type].orbit&&b.mood>top)b.mood=top;}const j=+(F.jit-1/PIE_JIT_DAYS).toFixed(4);F.jit=j<0.005?0:j;} + if(!F.next)F.next=d+PIE_ANTIC_FIRST;else if(d>=F.next){F.next=d+rint(PIE_ANTIC_GAP,PIE_ANTIC_SPAN);pieAntic();}} +PIE_ON.day.push(pieAnticDay); +// sanitize: the antics' part of S.pie.founder (o: the repaired founder, F: the saved one). +function pieAnticFix(o,F,day){const n=(v,hi)=>int(v,0,hi,0);o.jit=clamp(num(F.jit,0),0,1);o.next=n(F.next,day+PIE_ANTIC_FIRST+PIE_ANTIC_GAP+PIE_ANTIC_SPAN);o.kid=n(F.kid,PIE_KIDS.length); + o.bill=n(F.bill,day+PIE_KID_DAYS+3);if(o.bill<=day)o.bill=0;o.nerv=n(F.nerv,day+PIE_SPREE_DAYS);o.hype=n(F.hype,day+PIE_HYPE_DAYS);o.leak=n(F.leak,day+PIE_LEAK_DAYS); + o.mars=n(F.mars,day+720);if(!o.due.includes(o.mars))o.mars=0;} +// The Company tab, next to the feed: how jumpy the market is and how long until it calms down. +function pieJitHtml(F){const j=F.jit||0,K=pieKid();let h=''; + if(!(j>0))h=`

${tr('pie_ant.jit_calm')}

`; + else{const l=j>=0.6?tr('pie_ant.jit_high'):j>=0.3?tr('pie_ant.jit_mid'):tr('pie_ant.jit_low'); + h=`

${trn('pie_ant.jit_line',Math.ceil(j*PIE_JIT_DAYS),{lvl:l})}

`;} + if(pieBillOff())h+=`

${tr('pie_ant.bill_paused',{d:dateStr(F.bill),kid:esc(K?K.n:'')})}

`; + return h;} diff --git a/src/game/60-features/99-pie-orbit-customers.js b/src/game/60-features/99-pie-orbit-customers.js index 22b8f5d..53e4883 100644 --- a/src/game/60-features/99-pie-orbit-customers.js +++ b/src/game/60-features/99-pie-orbit-customers.js @@ -32,4 +32,4 @@ function pieSpawn(t){const T=BIZ_T[t],min=T.opts[0],ok=pieCands(t).filter(c=>{if const PIE_OPEN_DAYS=30,PIE_OPEN_OFFERS=4; function pieOpening(){const P=S.pie;let on=false;for(const id of pieHubs()){const c=P.crusts[id];if(!c)continue;if(c.open===undefined&&pieCap(id)>0)c.open=S.day;if(c.open!==undefined&&S.day-c.open{const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random(){const op=pieOpening();if(S.offers.filter(o=>BIZ_T[o.type].orbit).length>=(op?PIE_OPEN_OFFERS:PIE_OFFERS))return;const t=pieOfferTypes();if(t.length&&(op||Math.random()${tr('pie.pace_pad_none')}

`;} return x;})()}
${Object.keys(ROCKETS).filter(pieRkOk).map(rk=>{const q=pieQuote(rk,id,{ins:!!UI.pieIns,las:!!UI.pieLas});return btn(`${tr(ROCKETS[rk].n)} ${q.ok?(q.test?tr('pie.test_flight')+' · ':'')+fmt$(q.cost):esc(q.why)}`,'pieLaunch',{rk,cr:id},'ghost sm',!q.ok);}).join('')}
`;}).join(''); - h+=`
${btn(UI.pieIns?tr('pie.ins_on'):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}
`; + h+=`
${btn(UI.pieIns?tr('pie.ins_on_p',{p:pct(PIE_INS*pieInsMul())}):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}
`; h+=`

${tr('pie.stock_line',{n:Math.floor(P.stock)})}

`; if(P.q.length)h+=`

${tr('pie.queue')}

`+P.q.slice().sort((a,b)=>a.day-b.day).map(L=>`
${esc(tr(ROCKETS[L.rk].n))} → ${esc(tr(CRUSTS[L.cr].n))}${L.test?tr('pie.test_flight'):L.n} · ${esc(CITY[L.pad].name)} · ${dateStr(L.day)}
`).join(''); }else if(T==='dish'){ @@ -61,6 +61,6 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi openModal(h,'pie');{const cv=document.querySelector('#modal .pgcv');if(cv)pieGlobeOpen(cv,pieGlobeData);}} // The Founder's posts are flavour: the newest few at the bottom of the Company tab, the older ones folded away. function pieFeedHtml(F){const post=p=>`
${esc(dateStr(p.d))}
${esc(pieFpText(p))}
`,top=F.posts.slice(0,PIE_FEED_TOP),more=F.posts.slice(PIE_FEED_TOP); - return `

${tr('pie.founder_feed')}

${tr('pie.promises')}${tr('pie.promises_line',{n:F.promises,b:F.broken})}
` + return `

${tr('pie.founder_feed')}

${tr('pie.promises')}${tr('pie.promises_line',{n:F.promises,b:F.broken})}
`+pieJitHtml(F) +(top.length?top.map(post).join(''):`

${tr('pie.feed_empty')}

`) +(more.length?`
${trn('pie.feed_older',more.length)}${more.map(post).join('')}
`:'')+'
';} diff --git a/src/i18n/en.js b/src/i18n/en.js index 98d9496..7f946fa 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3423,24 +3423,34 @@ "pie.founder_feed":"The Founder posts", "pie.fp_3am":"Posting at 3 a.m. because sleep is a legacy protocol. Our pies are 40% more delicious than last quarter.", "pie.fp_astro":"Astronomers say our pies photobomb their telescopes. Have they tried looking between them?", +"pie.fp_backup":"Billing is back from last Tuesday's backup. Little {nick} is grounded until he learns about prepared statements.", "pie.fp_baked":"{crust} is fully baked. Next stop: Mars. Probably next year.", "pie.fp_booster":"The booster tipped over on landing. It was a planned tip. We call it a rapid horizontal recovery.", "pie.fp_debris":"A minor food fight in {crust}. Crumbs are a sign of a healthy constellation.", "pie.fp_dish":"Our first pie dish is up. My mum says the signal is great.", "pie.fp_fail":"Today's launch was a huge success. The rocket is now in many places at once.", "pie.fp_found":"Founded {co}. Our mission: put pies in the sky so everyone gets a slice.", +"pie.fp_kid":"Welcome to the world, {kid}. Little {nick} for short. Proud dad.", "pie.fp_launch":"{n} more pies in {crust}. Bold. Visionary. On schedule (this one).", +"pie.fp_leak":"Next launch: Tuesday, 6:42, pad two, payload photo attached. Legal says delete this. Not deleting this.", +"pie.fp_leak_kid":"Little {nick} posted the next launch date from my phone. Kids, eh. (It was me.)", +"pie.fp_mars":"Mars next year. Pies on Mars. Book now.", +"pie.fp_mars_kid":"Promised little {nick} a birthday party on Mars. Next year. Definitely next year.", +"pie.fp_mars_slip":"Mars is now year {n}. Mars was always year {n}. The red planet can wait.", "pie.fp_promise":"Promise: full coverage by year {n}. Write it down.", +"pie.fp_reg":"Regulators are just firewalls with lanyards. Come at me.", "pie.fp_rename":"We are {co} now. The old name was holding back the vision.", "pie.fp_slip":"Full coverage is now year {n}. It was always year {n}. Read the footnotes.", "pie.fp_spat":"Some government has questions. We love questions. We answer them all, eventually, in a thread.", +"pie.fp_spree":"Thread 1/{n}: why sleep is a legacy protocol, why pies are a lifestyle, and why my critics are bots.", +"pie.fp_spree_kid":"3 a.m. again. Little {nick} is teething, so I wrote a thread. 1/{n}.", "pie.fp_storm":"The Sun is jealous of {crust}. Totally normal. Space weather is just weather, but more.", "pie.fp_test":"Test flight {n} ended in a fireball, exactly as we hoped. We learned so much.", "pie.fp_tour":"Stepping back from Tier 1 to go on a listening tour. Mostly I will be talking.", "pie.half_baked":"Half-baked", "pie.heavy_tests":"Test flights flown: {n} of {max}. The first ones always explode.", "pie.ins_off":"Insurance: off", -"pie.ins_on":"Insurance: on (8%)", +"pie.ins_on_p":"Insurance: on ({p})", "pie.landing_rights":"Landing rights", "pie.las_off":"Lasers: off", "pie.las_on":"Lasers: on (+$0.5M a pie)", @@ -3513,6 +3523,22 @@ "pie.why_queue_full":"The launch schedule is full.", "pie.why_stock":"Needs {n} pies; the factory has {have}.", "pie.would_have":"Would have cost", +"pie_ant.backup":"Orbit billing is restored from backup. Invoices are going out again.", +"pie_ant.bill_paused":"Orbit billing is down until {d}: the database is still choking on {kid}.", +"pie_ant.gasp":"Ooooh. Uuuuuh.", +"pie_ant.jit_calm":"Market jitters: 😌 calm", +"pie_ant.jit_high":"😬 high", +"pie_ant.jit_line":{"one":"Market jitters: {lvl}, calming down in ~{n} day","other":"Market jitters: {lvl}, calming down in ~{n} days"}, +"pie_ant.jit_low":"🙂 low", +"pie_ant.jit_mid":"😟 nervous", +"pie_ant.kid":"The Founder named his son {kid}. The billing database read the birth announcement and choked: no orbit invoices go out for {n} days.", +"pie_ant.leak":"The Founder posted the next launch date, the pad and a photo of the payload. Launch insurers are not amused: insurance costs {p} for {n} days.", +"pie_ant.mars":"The Founder promised Mars by next year. Orbit sales are giddy for {n} days; nobody asks what happens next year.", +"pie_ant.mars_slip":{"one":"Mars slipped another year. {n} orbit customer quietly cancelled.","other":"Mars slipped another year. {n} orbit customers quietly cancelled."}, +"pie_ant.mars_slip_none":"Mars slipped another year. Orbit customers roll their eyes.", +"pie_ant.reg":"The Founder called a regulator a legacy protocol, live on air. The regulator has replied, in writing.", +"pie_ant.reg_none":"The Founder called a regulator a legacy protocol, live on air. Everyone is waiting for the reply.", +"pie_ant.spree":"The Founder posted {n} times between 3 and 4 a.m. Orbit customers are nervous: fewer calls and grumpier customers for {d} days.", "pie_globe.switch_to_day_view":"Switch to day view", "pie_globe.switch_to_night_view":"Switch to night view", "pie_globe.your_pies_in_orbit":"Your pies in orbit, drag to turn the Earth", diff --git a/src/styles/36-ops.css b/src/styles/36-ops.css index d4ebf86..fcd9486 100644 --- a/src/styles/36-ops.css +++ b/src/styles/36-ops.css @@ -18,6 +18,8 @@ .pie-feed{border-top:2px solid var(--line);margin-top:12px;padding-top:4px} .pie-feed h3{font-size:15px;margin:8px 0 4px} .pie-feed summary{cursor:pointer;font-weight:800;font-size:13px;color:var(--ink2);padding:8px 0;min-height:24px} +.pie-jit{margin:6px 0 2px;overflow-wrap:anywhere} +.pie-jit-bar{margin-bottom:6px} /* Government money in the bank: the same boxes as the loans next to it. */ .bank-gov>.meta{font-size:13px;color:var(--ink2);margin:2px 0 6px;line-height:1.35} .bank-gov .ops-o{border:2.5px solid var(--ink);border-radius:14px;padding:10px 12px;margin-top:10px} diff --git a/tests/pie-balance.test.js b/tests/pie-balance.test.js index 3897434..05f4c39 100644 --- a/tests/pie-balance.test.js +++ b/tests/pie-balance.test.js @@ -24,7 +24,7 @@ const YEARS = +(process.env.PIE_BALANCE_YEARS || 0); // With gov (the second test), the same player also takes government money: asks 50% in every Rural Digital Pie Fund // auction, takes the Ex-Im Pie Bank's loan and keeps a dish in its country (the covenant). // compute() runs every 30 days and whenever what the sky carries changes (coverage in 10% steps, hubs, lasers, -// safe mode, an orbit incident or spat starting or ending); orbit income is booked from the last one, as in the game. +// safe mode, an orbit incident or spat starting or ending, orbit billing going down or coming back); orbit income is booked from the last one, as in the game. function sim(days, stop = false, seed = 7, gov = false) { const g = load({ seed }); const save = fs.readFileSync(path.join(__dirname, 'fixtures', 'big-network.json'), 'utf8'); @@ -46,7 +46,7 @@ function sim(days, stop = false, seed = 7, gov = false) { if(window.__gov){const G=P.gov;for(const a of G.auc)if(a.bid!==0.5)ACT.pieBid({id:a.id,f:0.5});if(G.ex)ACT.pieExim(); const l=pieEximLoan();if(l&&!pieEximDishOk(l)){const c=Object.keys(S.pops).filter(c=>CITY[c].cc===l.pie.cc&&pieCovers('short',c)&&!P.dishes.some(x=>x.city===c)).sort((a,b)=>sfOf(R,b)-sfOf(R,a))[0]; if(c){if(!pieLicOk(l.pie.cc))ACT.pieLic({cc:l.pie.cc});ACT.pieDish({city:c});}}} - const key=[pieHubs().join(),Math.round(pieCarry('short')*10),Math.round(pieCov('short')*10),pieLased('short'),P.safe,S.inc.filter(i=>PIE_INC.includes(i.type)&&i.until>S.day).map(i=>i.id).join(),Object.keys(P.spat).join(),P.gov.aw.length].join('|');if(key!==window.__key)dirty=true;window.__key=key; + const key=[pieHubs().join(),Math.round(pieCarry('short')*10),Math.round(pieCov('short')*10),pieLased('short'),P.safe,S.inc.filter(i=>PIE_INC.includes(i.type)&&i.until>S.day).map(i=>i.id).join(),Object.keys(P.spat).join(),P.gov.aw.length,P.founder.bill>S.day].join('|');if(key!==window.__key)dirty=true;window.__key=key; const real=compute;compute=()=>{if(dirty||S.day%30===0){window.__nC=(window.__nC||0)+1;real();}};try{dayTick();}finally{compute=real;}}; window.__year=()=>({y:Math.round(S.day/360),spent:S.pie.book.spent,earned:S.pie.book.earned,mo:(R.pie&&R.pie.rev)||0,cov:pieCov('short'),cust:S.biz.filter(b=>BIZ_T[b.type].orbit).length,dishes:S.pie.dishes.length,nC:window.__nC|0}); window.__gov=${gov};closeModal()`); diff --git a/tests/pie-founder.test.js b/tests/pie-founder.test.js new file mode 100644 index 0000000..1e2d422 --- /dev/null +++ b/tests/pie-founder.test.js @@ -0,0 +1,260 @@ +// The Founder's antics and the market's jitters (src/game/60-features/99-pie-jitters.js): seeded; each antic is forced +// with pieAntic(k), the clock moved with dayTick(). +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +// On-call with open gates: real chaos, everything buildable. Dishes in Amsterdam, Brussels, Frankfurt and Singapore, a +// baked Shortcrust, the 90 quiet days over, and 40 orbit customers in Frankfurt and Amsterdam. +const sky = (ev, o = {}) => { + ev(`beginGame('Sky','fra',{mode:'normal',preset:'oncall',rules:${JSON.stringify(Object.assign({ gates: 'open' }, o))}});if(UI.pendGame)ACT.pitchSkip();S.cash=1e12;S.nextFail=1e9;S.nextEvent=1e9;S.monkey&&(S.monkey.next=1e9)`); + ev("for(const c of ['sin','ams','bru'])ACT.buildPop({city:c});ACT.pieFound();ACT.pieFactory();ACT.piePad({city:'sin'});for(const c of ['ams','bru','fra','sin'])ACT.pieDish({city:c});for(const cc of ['NL','BE','DE','SG'])ACT.pieLic({cc})"); + ev("for(const x of S.pie.dishes)x.ant=PIE_ANT_MAX;pieCohort('short',1200,true);S.day=S.pie.born+120;compute();S.pie.stock=400"); + ev("for(const c of ['fra','ams'])ACT.buyTransit({city:c,net:'cog',tier:1});for(let i=0;i<40;i++)S.biz.push({id:'o'+i,type:'pizza',city:i%2?'fra':'ams',city2:null,bw:1,rate:BIZ_T.pizza.rate,reqs:[],latMax:null,route:'normal',name:'o'+i,mood:80,since:0,sites:null});compute()"); + // No antic of its own while a test drives them; no other orbit incidents or spats by chance. + ev('S.pie.founder.next=1e9;for(const f of [pieIncDay,pieSpatDayAll])PIE_ON.day.splice(PIE_ON.day.indexOf(f),1)'); +}; +const F = (ev) => JSON.parse(ev('JSON.stringify(S.pie.founder)')); +const days = (ev, n) => ev(`for(let i=0;i<${n};i++)dayTick()`); +const orbitMood = (ev) => ev("S.biz.filter(b=>BIZ_T[b.type].orbit).reduce((a,b)=>a+b.mood,0)/S.biz.filter(b=>BIZ_T[b.type].orbit).length"); + +test('the kid is named once: orbit billing stops for 3 to 5 days, then comes back from backup, and he is remembered', () => { + const { ev, errors } = load(); + sky(ev); + const rev = ev('R.pie.rev'); + assert.ok(rev > 0, 'orbit earns before'); + assert.equal(ev("pieAntic('kid')"), true); + const f = F(ev), kid = ev('pieKid().n'), n = f.bill - ev('S.day') - 1; + assert.ok(n >= 3 && n <= 5, `billing down 3 to 5 days (${n})`); + assert.match(kid, /'\);/, 'a name that injects'); + assert.match(ev('S.log[0].t'), /Ooooh\. Uuuuuh\./); + assert.ok(ev("S.log[0].t.includes(pieKid().n)"), 'the toast says his name'); + for (let i = 0; i < n; i++) { + days(ev, 1); + assert.equal(ev('R.pie.rev'), 0, `no orbit income on day ${i + 1}`); + assert.ok(ev('R.pie.billOff') > 0, 'what it would have been is kept'); + } + assert.equal(F(ev).bill, 0, 'billing is back after the last day'); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_backup', 'restored from backup'); + assert.match(ev('pieFpText(S.pie.founder.posts[0])'), / Tables /, 'the post calls him by his nickname'); + days(ev, 1); + assert.ok(ev('R.pie.rev') > 0, 'orbit earns again'); + // Once a game, and later posts bring him back. + assert.equal(ev("pieAntic('kid')"), false, 'never twice'); + assert.equal(ev("PIE_ANTIC_KEYS.filter(x=>PIE_ANTICS[x].ok(S.pie.founder)).includes('kid')"), false, 'not in the draw any more'); + ev("pieAntic('spree')"); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_spree_kid'); + assert.ok(ev('pieFpText(S.pie.founder.posts[0]).includes(pieKid().k)'), 'the running gag'); + assert.deepEqual(errors, []); +}); + +test('a 3 a.m. spree: fewer orbit calls and grumpier customers for two weeks, then the market calms down', () => { + const { ev, errors } = load(); + sky(ev); + const m0 = orbitMood(ev); + assert.equal(ev('pieOfferMul()'), 1); + ev("pieAntic('spree')"); + assert.ok(orbitMood(ev) <= m0 - 3.5, 'a dip at once'); + const j = F(ev).jit; + assert.equal(j, 0.6); + assert.ok(ev('pieOfferMul()') < 0.55, `offers well down (${ev('pieOfferMul()')})`); + days(ev, 14); + assert.ok(ev('pieOfferMul()') > 0.5 && ev('pieOfferMul()') < 1, 'nerves gone, jitters left'); + days(ev, 5); + assert.equal(F(ev).jit, 0, 'jitters fade within 30 days of a 0.6 bump'); + assert.equal(ev('pieOfferMul()'), 1, 'back to normal'); + days(ev, 20); + assert.ok(orbitMood(ev) >= m0, 'happiness recovers'); + assert.equal(ev('S.biz.filter(b=>BIZ_T[b.type].orbit).length'), 40, 'nobody left over a spree'); + assert.deepEqual(errors, []); +}); + +test('jitters stack up to 1 and fade to nothing over 30 days, nudging offers and moods while high', () => { + const { ev, errors } = load(); + sky(ev); + ev("pieAntic('leak');pieAntic('spree');pieAntic('leak')"); + assert.equal(F(ev).jit, 1, 'capped at 1'); + ev('S.pie.founder.nerv=0'); + assert.equal(ev('pieOfferMul()'), 0.7); + ev("for(const b of S.biz)b.mood=100"); + days(ev, 10); + assert.ok(Math.abs(orbitMood(ev) - (100 - 25 * 20 / 30)) < 1, `the happiest are held under 100 while jitters are high (${orbitMood(ev)})`); + assert.ok(orbitMood(ev) > 50, 'never low enough to cancel at renewal'); + assert.ok(Math.abs(F(ev).jit - 20 / 30) < 0.01, 'a thirtieth a day'); + days(ev, 20); + assert.equal(F(ev).jit, 0); + assert.equal(ev('pieOfferMul()'), 1); + days(ev, 15); + assert.equal(orbitMood(ev), 100, 'and back to happy'); + // The orbit sales desk rolls its odds through pieOfferMul(). + assert.match(ev("PIE_ON.day.map(String).join()"), /PIE_OFFER_RATE\*pieOfferMul\(\)/); + assert.deepEqual(errors, []); +}); + +test('picking a fight with a regulator starts a spat in a country with a dish of yours', () => { + const { ev, errors } = load(); + sky(ev); + assert.equal(ev("pieAntic('reg')"), true); + const sp = JSON.parse(ev('JSON.stringify(S.pie.spat)')), ks = Object.keys(sp); + assert.equal(ks.length, 1, 'one spat'); + assert.ok(['lic', 'kill'].includes(ks[0]), `a regulator's spat (${ks[0]})`); + assert.ok(['NL', 'BE', 'DE', 'SG'].includes(sp[ks[0]].cc), `where you have a dish (${sp[ks[0]].cc})`); + assert.ok(ev("S.pie.founder.posts.some(p=>p.k==='pie.fp_reg')")); + assert.equal(F(ev).jit, 0.4); + // At the spat limit he still rants, but nothing new starts. + ev("S.pie.spat.grab={st:'on',ask:S.day,until:S.day+100,c:0,m:0.1,left:5}"); + assert.equal(ev("pieAntic('reg')"), true); + assert.equal(ev('Object.keys(S.pie.spat).length'), 2); + assert.deepEqual(errors, []); +}); + +test('a leaked launch date makes launch insurance dearer for 30 days', () => { + const { ev, errors } = load(); + sky(ev); + const q = () => JSON.parse(ev("JSON.stringify(pieQuote('falcon','short',{ins:true}))")); + const q0 = q(), base = q0.cost - Math.round(q0.insured * 0.08); + ev("pieAntic('leak')"); + const q1 = q(); + assert.equal(q1.cost - base, Math.round(q1.insured * 0.08 * 1.75), 'premium 14% instead of 8%'); + ev("UI.pieIns=true;UI.pieTab='fly';ACT.pieOpen()"); + assert.match(ev("document.querySelector('#modal').textContent"), /Insurance: on \(14%\)/); + ev('closeModal()'); + days(ev, 29); + assert.ok(q().cost > q0.cost, 'still dear on day 29'); + days(ev, 1); + assert.equal(q().cost, q0.cost, 'back to normal after 30 days'); + assert.deepEqual(errors, []); +}); + +test('Mars next year: two weeks of hype, then the slip costs a few orbit customers', () => { + const { ev, errors } = load(); + sky(ev); + const p0 = F(ev).promises; + ev("pieAntic('mars')"); + const f = F(ev); + assert.equal(f.promises, p0 + 1, 'a promise'); + assert.ok(f.due.includes(f.mars), 'due like the others'); + assert.equal(ev("pieAntic('mars')"), false, 'one Mars at a time'); + assert.ok(ev('pieOfferMul()') > 1, 'hype: more calls'); + days(ev, 14); + assert.ok(ev('pieOfferMul()') <= 1, 'hype over'); + // Bring the due day forward instead of playing a year. + ev('{const F=S.pie.founder,i=F.due.indexOf(F.mars);F.due[i]=F.mars=S.day+1;F.due.sort((a,b)=>a-b);for(const d of F.due)if(db.id==='o7').mood=5"); + const b0 = F(ev).broken; + days(ev, 1); + assert.equal(F(ev).broken, b0 + 1, 'broken'); + assert.equal(F(ev).mars, 0); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_mars_slip'); + assert.equal(ev('S.biz.filter(b=>BIZ_T[b.type].orbit).length'), 39, '2% of 40 cancel'); + assert.equal(ev("S.biz.some(b=>b.id==='o7')"), false, 'the unhappiest one'); + assert.match(ev('S.log[0].t'), /1 orbit customer quietly cancelled/); + assert.deepEqual(errors, []); +}); + +test('with chaos off he still posts, and nothing else happens', () => { + const { ev, errors } = load(); + sky(ev, { chaos: 'none' }); + const n0 = ev('S.log.length'), cash = ev('S.cash'); + for (const k of ['kid', 'spree', 'reg', 'leak', 'mars']) assert.equal(ev(`pieAntic('${k}')`), true, k); + const f = F(ev); + for (const k of ['fp_kid', 'fp_spree_kid', 'fp_reg', 'fp_leak_kid', 'fp_mars_kid']) assert.ok(f.posts.some((p) => p.k === 'pie.' + k), k); + assert.equal(f.jit, 0); + assert.equal(f.bill, 0); + assert.equal(ev('Object.keys(S.pie.spat).length'), 0, 'no spat'); + assert.equal(ev('S.log.length'), n0, 'no toasts'); + assert.equal(ev('pieOfferMul()'), 1); + assert.equal(ev('pieInsMul()'), 1); + assert.equal(ev('S.cash'), cash); + days(ev, 1); + assert.ok(ev('R.pie.rev') > 0, 'billing never stops'); + ev('{const F=S.pie.founder,i=F.due.indexOf(F.mars);F.due=[F.mars=S.day+1]}'); + days(ev, 1); + assert.equal(ev('S.biz.filter(b=>BIZ_T[b.type].orbit).length'), 40, 'Mars slips, nobody leaves'); + assert.equal(ev('S.pie.founder.posts[0].k'), 'pie.fp_mars_slip'); + // The schedule still runs: he posts every 60 to 120 days. + ev('S.pie.founder.next=S.day+1;S.stats.pieAnt=0'); + days(ev, 1 + 121 * 2); + assert.ok(ev('S.stats.pieAnt') >= 2, 'antics keep coming'); + assert.equal(F(ev).jit, 0); + assert.deepEqual(errors, []); +}); + +test('antics come every 60 to 120 days, and only with a rocket company', () => { + const { ev, errors } = load(); + sky(ev); + ev('S.pie.founder.next=0;S.stats.pieAnt=0'); + days(ev, 1); + const first = F(ev).next; + assert.equal(first, ev('S.day') + 90, 'the first one comes 90 days on, no dice'); + ev('{const f=pieAntic;pieAntic=k=>{(window.__ant=window.__ant||[]).push(S.day);return f(k);}}'); + days(ev, 90 + 360); + const at = JSON.parse(ev('JSON.stringify(window.__ant)')); + assert.ok(at.length >= 4, `several antics in a year (${at.length})`); + assert.equal(at[0], first); + for (let i = 1; i < at.length; i++) { const g = at[i] - at[i - 1]; assert.ok(g >= 60 && g <= 120, `gap ${g}`); } + // Unlocked but no company: no plan, no dice. + const q = load(); + q.ev(`beginGame('Sky','fra',{mode:'normal',preset:'oncall',rules:{gates:'open'}});if(UI.pendGame)ACT.pitchSkip();pieInit()`); + q.ev('{const r=Math.random;window.__rolls=0;Math.random=()=>{window.__rolls++;return r();};for(let i=0;i<200;i++)pieAnticDay(S.day+i);Math.random=r}'); + assert.equal(q.ev('__rolls'), 0, 'no dice without a company'); + assert.equal(q.ev('S.pie.founder.next'), 0); + assert.equal(q.ev('S.stats.pieAnt|0'), 0); + assert.deepEqual(errors, []); + assert.deepEqual(q.errors, []); +}); + +test('saves keep the antics, old saves load calm, and junk is repaired', () => { + const { ev, errors } = load(); + sky(ev); + ev("pieAntic('kid');pieAntic('spree');pieAntic('leak');pieAntic('mars');S.pie.founder.next=S.day+50"); + const before = F(ev); + ev('S=migrate(JSON.parse(JSON.stringify(S)));compute()'); + assert.deepEqual(F(ev), before, 'a round trip keeps everything'); + assert.equal(ev('R.pie.rev'), 0, 'billing still down after loading'); + // A save from before the antics: no fields at all. + ev("{const o=JSON.parse(JSON.stringify(S));for(const k of ['jit','next','kid','bill','nerv','hype','leak','mars'])delete o.pie.founder[k];S=migrate(o);compute()}"); + const old = F(ev); + for (const k of ['jit', 'next', 'kid', 'bill', 'nerv', 'hype', 'leak', 'mars']) assert.equal(old[k], 0, `${k} defaults to 0`); + assert.ok(ev('R.pie.rev') > 0); + assert.equal(ev('pieKid()'), null); + // Junk. + ev("{const o=JSON.parse(JSON.stringify(S)),F=o.pie.founder;Object.assign(F,{jit:7,next:'x',kid:99,bill:S.day-3,nerv:1e9,hype:-5,leak:'soon',mars:S.day+12345});S=migrate(o)}"); + const j = F(ev), d = ev('S.day'); + assert.equal(j.jit, 1); + assert.equal(j.next, 0); + assert.ok(j.kid >= 0 && j.kid <= ev('PIE_KIDS.length')); + assert.ok(ev('!S.pie.founder.kid||!!pieKid()'), 'a kid that exists'); + assert.equal(j.bill, 0, 'a pause in the past is over'); + assert.ok(j.nerv <= d + 14); + assert.equal(j.hype, 0); + assert.equal(j.leak, 0); + assert.equal(j.mars, 0, 'a Mars promise that is not due is dropped'); + ev("{const o=JSON.parse(JSON.stringify(S));o.pie.founder.posts.push({d:1,k:'pie.fp_kid'},{d:1,k:'pie.fp_nonsense'});S=migrate(o)}"); + assert.ok(ev("S.pie.founder.posts.some(p=>p.k==='pie.fp_kid')"), 'antic posts survive'); + assert.equal(ev("S.pie.founder.posts.some(p=>p.k==='pie.fp_nonsense')"), false); + assert.deepEqual(errors, []); +}); + +test('the Company tab shows the jitters in one line at 360 px, next to the feed', () => { + const { dom, ev, errors } = load(); + sky(ev); + ev("window.innerWidth=360;UI.pieTab='co';ACT.pieOpen()"); + const card = () => dom.window.document.querySelector('#modalCard'); + assert.match(card().querySelector('.pie-feed .pie-jit').textContent, /^Market jitters: 😌 calm$/); + ev("pieAntic('kid');pieAntic('spree');ACT.pieTab({t:'co'})"); + const feed = card().querySelector('.pie-feed'); + const line = feed.querySelector('p.pie-jit').textContent; + assert.match(line, /^Market jitters: 😬 high, calming down in ~30 days$/); + assert.ok(line.length < 60, 'short enough for a phone line'); + assert.ok(feed.querySelector('.bar.pie-jit-bar'), 'a small meter'); + assert.match(feed.textContent, /Orbit billing is down until/); + assert.match(feed.textContent, /3 a\.m\. again\. Little \w+ Tables/); + assert.doesNotMatch(feed.textContent, /pie_ant\.|pie\.fp_|undefined|NaN/); + assert.equal(/style="[^"]*width:\s*\d{3,}px/.test(card().innerHTML), false, 'no fixed widths'); + days(ev, 20); + ev("ACT.pieTab({t:'co'})"); + assert.match(card().querySelector('.pie-feed p.pie-jit').textContent, /calming down in ~1\d days|calming down in ~\d days/); + ev('closeModal()'); + assert.deepEqual(errors, []); +});