F6: eventi del mondo con effetti temporanei e notizie

Aggiunge gli eventi della F6: fatti del mondo che cambiano il gioco per
un periodo limitato, leggibili nel notiziario e reversibili.

- Catalogo data/events.json con schema e validazione: incidente e boom
  di un'industria, fiera ed epidemia, boom e crollo della domanda di un
  bene in una zona, maltempo su un'area, sciopero di città o deposito.
- Effetti come moltiplicatori letti da un'unica sorgente
  (World.WorldEvents) dai sistemi esistenti: capacità delle industrie,
  consumi delle città, presenze dei pendolari, velocità dei treni e usura
  del binario. A evento finito il moltiplicatore torna 1.
- EventSystem tra le IA e l'hash, con flusso Rng dedicato «events»,
  bersaglio in ordine di id, frequenza per mappa scalata dalla difficoltà
  (eventFrequencyMultiplier), tetto di 6, niente doppioni, notizie di
  inizio e fine in italiano (EventKind.World).
- Salvataggio corpo versione 5 con gli eventi nell'hash; le versioni 1-4
  si caricano senza eventi e con la frequenza del preset.
- Protocollo: eventi in corso nel DailyDigest e nel MarketReport; client
  con il riquadro «Eventi in corso», avvisi nelle schede e «evento in
  corso» nel Mercato globale.
- Lo scenario Valdoria disattiva gli eventi: con gli eventi attivi la
  flotta F4 senza linea dei ricambi non scendeva più sotto 40, e
  l'accettazione deve misurare la manutenzione, non la fortuna (ADR 0017).
  Accettazione F4 invariata: 35 / 20 guasti senza linea, 75 / 2 con.

Decisioni in docs/adr/0017-eventi-del-mondo.md; 17 test nuovi.

Refs #33.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-07 16:59:48 +01:00
1 parent b258e0858a
commit 1f8da87e51
41 files changed
+1892 -41

No files matched your search

+4 -4
View File
@@ -6,25 +6,25 @@
"presets": [
{ "id": "apprendista", "name_it": "Apprendista", "name_en": "Apprentice",
"initialCapital": 50000000, "initialCredit": 50000000, "baseInterestRate": 0.03,
"constructionCostMultiplier": 0.8, "tariffMultiplier": 1.15, "wearMultiplier": 0.7, "marketVolatilityMultiplier": 0.6,
"constructionCostMultiplier": 0.8, "tariffMultiplier": 1.15, "wearMultiplier": 0.7, "marketVolatilityMultiplier": 0.6, "eventFrequencyMultiplier": 0.7,
"aiCompetitors": 1, "aiCapitalMultiplier": 0.7, "aiCostDiscount": 0.0,
"playerTakeover": "disabled", "takeoverRansomYears": 0, "bankruptcyDays": 180,
"publicFromStart": false, "playerShareAtStart": 1.0, "ironman": "no", "depletion": "slow" },
{ "id": "imprenditore", "name_it": "Imprenditore", "name_en": "Entrepreneur",
"initialCapital": 25000000, "initialCredit": 30000000, "baseInterestRate": 0.05,
"constructionCostMultiplier": 1.0, "tariffMultiplier": 1.0, "wearMultiplier": 1.0, "marketVolatilityMultiplier": 1.0,
"constructionCostMultiplier": 1.0, "tariffMultiplier": 1.0, "wearMultiplier": 1.0, "marketVolatilityMultiplier": 1.0, "eventFrequencyMultiplier": 1.0,
"aiCompetitors": 2, "aiCapitalMultiplier": 1.0, "aiCostDiscount": 0.0,
"playerTakeover": "ransom", "takeoverRansomYears": 3, "bankruptcyDays": 90,
"publicFromStart": false, "playerShareAtStart": 1.0, "ironman": "optional", "depletion": "normal" },
{ "id": "magnate", "name_it": "Magnate", "name_en": "Tycoon",
"initialCapital": 15000000, "initialCredit": 15000000, "baseInterestRate": 0.07,
"constructionCostMultiplier": 1.25, "tariffMultiplier": 0.9, "wearMultiplier": 1.3, "marketVolatilityMultiplier": 1.3,
"constructionCostMultiplier": 1.25, "tariffMultiplier": 0.9, "wearMultiplier": 1.3, "marketVolatilityMultiplier": 1.3, "eventFrequencyMultiplier": 1.2,
"aiCompetitors": 3, "aiCapitalMultiplier": 1.5, "aiCostDiscount": 0.10,
"playerTakeover": "ransom", "takeoverRansomYears": 1, "bankruptcyDays": 60,
"publicFromStart": false, "playerShareAtStart": 1.0, "ironman": "optional", "depletion": "fast" },
{ "id": "ferro_e_sangue", "name_it": "Ferro e sangue", "name_en": "Iron and blood",
"initialCapital": 10000000, "initialCredit": 10000000, "baseInterestRate": 0.09,
"constructionCostMultiplier": 1.5, "tariffMultiplier": 0.8, "wearMultiplier": 1.6, "marketVolatilityMultiplier": 1.6,
"constructionCostMultiplier": 1.5, "tariffMultiplier": 0.8, "wearMultiplier": 1.6, "marketVolatilityMultiplier": 1.6, "eventFrequencyMultiplier": 1.4,
"aiCompetitors": 5, "aiCapitalMultiplier": 2.0, "aiCostDiscount": 0.20,
"playerTakeover": "immediate", "takeoverRansomYears": 0, "bankruptcyDays": 30,
"publicFromStart": true, "playerShareAtStart": 0.6, "ironman": "yes", "depletion": "fast" }
+52
View File
@@ -0,0 +1,52 @@
{
"$schema": "schema/events.schema.json",
"version": 1,
"maxActive": 6,
"events": [
{ "id": "industry_accident", "name_it": "Incidente in un impianto", "name_en": "Plant accident",
"target": "industry", "chancePerYear": 1.2, "durationDays": [ 10, 45 ], "minYear": 1850, "severity": "warning",
"effects": [ { "kind": "industryCapacity", "min": 0.0, "max": 0.5 } ],
"news_it": "Incidente a {target}: produzione al {pct} per {days} giorni",
"newsEnd_it": "{target}: la produzione riprende dopo l'incidente" },
{ "id": "industry_boom", "name_it": "Boom di produzione", "name_en": "Production boom",
"target": "industry", "chancePerYear": 1.0, "durationDays": [ 30, 120 ], "minYear": 1850, "severity": "opportunity",
"effects": [ { "kind": "industryCapacity", "min": 1.2, "max": 1.5 } ],
"news_it": "Boom di produzione a {target}: capacità al {pct} per {days} giorni",
"newsEnd_it": "{target}: finito il boom di produzione" },
{ "id": "town_fair", "name_it": "Fiera cittadina", "name_en": "Town fair",
"target": "town", "chancePerYear": 1.0, "durationDays": [ 7, 20 ], "minYear": 1850, "minPopulation": 1500, "severity": "opportunity",
"effects": [ { "kind": "townDemand", "min": 1.3, "max": 1.8 } ],
"news_it": "Fiera a {target}: consumi della città al {pct} per {days} giorni",
"newsEnd_it": "{target}: chiusa la fiera, i consumi tornano normali" },
{ "id": "epidemic", "name_it": "Epidemia", "name_en": "Epidemic",
"target": "town", "chancePerYear": 0.4, "durationDays": [ 30, 90 ], "minYear": 1850, "minPopulation": 2000, "severity": "warning",
"effects": [ { "kind": "townDemand", "min": 0.7, "max": 0.9 }, { "kind": "attendance", "min": 0.5, "max": 0.8 } ],
"news_it": "Epidemia a {target}: consumi al {pct} e lavoratori assenti per {days} giorni",
"newsEnd_it": "{target}: l'epidemia è finita" },
{ "id": "good_demand_boom", "name_it": "Domanda in crescita", "name_en": "Demand boom",
"target": "townGood", "radiusKm": 15, "chancePerYear": 0.8, "durationDays": [ 60, 180 ], "minYear": 1850, "severity": "opportunity",
"effects": [ { "kind": "goodDemand", "min": 1.4, "max": 2.0 } ],
"news_it": "Domanda di {good} in forte crescita intorno a {target}: consumi al {pct} per {days} giorni",
"newsEnd_it": "Intorno a {target} la domanda di {good} torna normale" },
{ "id": "good_demand_slump", "name_it": "Crollo della domanda", "name_en": "Demand slump",
"target": "townGood", "radiusKm": 15, "chancePerYear": 0.8, "durationDays": [ 60, 180 ], "minYear": 1850, "severity": "warning",
"effects": [ { "kind": "goodDemand", "min": 0.3, "max": 0.7 } ],
"news_it": "Crolla la domanda di {good} intorno a {target}: consumi al {pct} per {days} giorni",
"newsEnd_it": "Intorno a {target} la domanda di {good} torna normale" },
{ "id": "storm", "name_it": "Maltempo", "name_en": "Storm",
"target": "area", "radiusKm": 12, "chancePerYear": 1.5, "durationDays": [ 3, 12 ], "minYear": 1850, "severity": "warning",
"effects": [ { "kind": "trainSpeed", "min": 0.5, "max": 0.8 }, { "kind": "trackWear", "min": 2.0, "max": 4.0 } ],
"news_it": "Maltempo intorno a {target}: treni al {pct} della velocità e binari che si consumano di più per {days} giorni",
"newsEnd_it": "Torna il sereno intorno a {target}" },
{ "id": "strike_town", "name_it": "Sciopero dei lavoratori", "name_en": "Workers' strike",
"target": "town", "chancePerYear": 0.5, "durationDays": [ 5, 20 ], "minYear": 1850, "minPopulation": 1000, "severity": "warning",
"effects": [ { "kind": "attendance", "min": 0.2, "max": 0.6 } ],
"news_it": "Sciopero dei lavoratori di {target}: presenze al {pct} per {days} giorni",
"newsEnd_it": "{target}: finito lo sciopero, i lavoratori tornano al lavoro" },
{ "id": "strike_depot", "name_it": "Sciopero in deposito", "name_en": "Depot strike",
"target": "depot", "chancePerYear": 0.5, "durationDays": [ 5, 20 ], "minYear": 1850, "severity": "warning",
"effects": [ { "kind": "attendance", "min": 0.0, "max": 0.5 } ],
"news_it": "Sciopero del personale a {target}: presenze al {pct} per {days} giorni",
"newsEnd_it": "{target}: finito lo sciopero del personale" }
]
}
+6
View File
@@ -87,6 +87,11 @@
"minimum": 0,
"maximum": 10
},
"eventFrequencyMultiplier": {
"type": "number",
"minimum": 0,
"maximum": 10
},
"aiCompetitors": {
"type": "integer",
"minimum": 0,
@@ -156,6 +161,7 @@
"tariffMultiplier",
"wearMultiplier",
"marketVolatilityMultiplier",
"eventFrequencyMultiplier",
"aiCompetitors",
"aiCapitalMultiplier",
"aiCostDiscount",
+171
View File
@@ -0,0 +1,171 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Eventi del mondo (events.json)",
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"version": {
"type": "integer",
"minimum": 1
},
"maxActive": {
"type": "integer",
"minimum": 0,
"maximum": 64
},
"events": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$"
},
"name_it": {
"type": "string",
"minLength": 1
},
"name_en": {
"type": "string",
"minLength": 1
},
"target": {
"type": "string",
"enum": [
"industry",
"town",
"townGood",
"area",
"depot"
]
},
"radiusKm": {
"type": "number",
"minimum": 0.5,
"maximum": 200
},
"chancePerYear": {
"type": "number",
"minimum": 0,
"maximum": 100
},
"durationDays": {
"type": "array",
"items": {
"type": "integer",
"minimum": 1,
"maximum": 3600
},
"minItems": 2,
"maxItems": 2
},
"minYear": {
"type": "integer",
"minimum": 1800,
"maximum": 2200
},
"minPopulation": {
"type": "integer",
"minimum": 0
},
"goods": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-z][a-z0-9_]*$"
},
"minItems": 1
},
"industryKinds": {
"type": "array",
"items": {
"type": "string",
"enum": [
"primary",
"processing",
"manufacturing"
]
},
"minItems": 1
},
"severity": {
"type": "string",
"enum": [
"info",
"opportunity",
"warning",
"critical"
]
},
"effects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"industryCapacity",
"townDemand",
"goodDemand",
"attendance",
"trainSpeed",
"trackWear"
]
},
"min": {
"type": "number",
"minimum": 0,
"maximum": 10
},
"max": {
"type": "number",
"minimum": 0,
"maximum": 10
}
},
"required": [
"kind",
"min",
"max"
],
"additionalProperties": false
},
"minItems": 1
},
"news_it": {
"type": "string",
"minLength": 1
},
"newsEnd_it": {
"type": "string",
"minLength": 1
}
},
"required": [
"id",
"name_it",
"name_en",
"target",
"chancePerYear",
"durationDays",
"minYear",
"severity",
"effects",
"news_it",
"newsEnd_it"
],
"additionalProperties": false
}
}
},
"required": [
"version",
"maxActive",
"events"
],
"additionalProperties": false
}