Adds some more events

This commit is contained in:
Dandaedre 2025-11-30 19:35:19 +01:00
parent a7c6e849cd
commit ac7dd20e03
3 changed files with 156 additions and 92 deletions

View File

@ -434,7 +434,10 @@
"name": "earthquake",
"description": "A massive quake ripples across the region.",
"stats": [
{ "stat": "Infrastructure", "value": -15 },
{ "stat": "Transportation", "value": -9 },
{ "stat": "Sprawl", "value": -5 },
{ "stat": "Health", "value": -3 },
{ "stat": "Industry", "value": -2 },
{ "stat": "Population", "value": -10 },
{ "stat": "Happiness", "value": -8 }
]
@ -452,9 +455,10 @@
"name": "town_haunted_market",
"description": "Spectral merchants appear, selling wares that vanish upon purchase, driving up prices.",
"stats": [
{ "stat": "Trade", "value": -9 },
{ "stat": "Economy", "value": -6 },
{ "stat": "Crime", "value": 4 }
{ "stat": "Trade", "value": 9 },
{ "stat": "Food", "value": 13 },
{ "stat": "Crime", "value": 4 },
{ "stat": "Threat", "value": 8 }
]
},
{
@ -470,7 +474,9 @@
"name": "town_giant_earthworm",
"description": "A colossal earthworm burrows beneath the town, destabilizing foundations and causing tremors.",
"stats": [
{ "stat": "Infrastructure", "value": -12 },
{ "stat": "Food", "value": -5 },
{ "stat": "Industry", "value": -2 },
{ "stat": "Happiness", "value": -12 },
{ "stat": "Fortification", "value": -8 },
{ "stat": "Population", "value": -4 }
]
@ -497,7 +503,9 @@
"name": "region_infernal_flood",
"description": "Molten rivers run through the region, boiling over cities and devouring forests.",
"stats": [
{ "stat": "Infrastructure", "value": -20 },
{ "stat": "Transportation", "value": -4 },
{ "stat": "Sprawl", "value": -5 },
{ "stat": "Happiness", "value": -19 },
{ "stat": "Food", "value": -15 },
{ "stat": "Population", "value": -12 }
]
@ -506,7 +514,9 @@
"name": "region_sand_vortex",
"description": "A vortex of shifting sands sweeps the region, burying entire nations under dunes.",
"stats": [
{ "stat": "Infrastructure", "value": -14 },
{ "stat": "Bureaucracy", "value": -14 },
{ "stat": "Transportation", "value": -14 },
{ "stat": "Sprawl", "value": -14 },
{ "stat": "Population", "value": -16 },
{ "stat": "Trade", "value": -10 }
]
@ -516,7 +526,7 @@
"description": "A relentless gale from the gods tears through the region, scattering armies and wrecking supply lines.",
"stats": [
{ "stat": "Transportation", "value": -12 },
{ "stat": "Military", "value": -9 },
{ "stat": "Army", "value": -9 },
{ "stat": "Population", "value": -3 }
]
},
@ -542,25 +552,31 @@
"name": "city_corruption_scandal",
"description": "A high-ranking magistrate is discovered embezzling city funds, sparking public outrage and a demand for accountability.",
"stats": [
{ "stat": "Economy", "value": -9 },
{ "stat": "Food", "value": -4 },
{ "stat": "Industry", "value": -3 },
{ "stat": "Science", "value": -3 },
{ "stat": "Trade", "value": -8 },
{ "stat": "Bureaucracy", "value": -7 },
{ "stat": "Crime", "value": 5 }
{ "stat": "Crime", "value": 7 }
]
},
{
"name": "city_tax_reform",
"description": "The council implements a sweeping tax overhaul that raises revenue but triggers protests among merchants.",
"stats": [
{ "stat": "Economy", "value": 12 },
{ "stat": "Population", "value": -4 },
{ "stat": "Crime", "value": 3 }
{ "stat": "Food", "value": 9 },
{ "stat": "Industry", "value": 10 },
{ "stat": "Science", "value": 7 },
{ "stat": "Trade", "value": 13 },
{ "stat": "Happiness", "value": -4 },
{ "stat": "Crime", "value": 5 }
]
},
{
"name": "city_watch_mutiny",
"description": "The city guard, disgruntled by unpaid wages, mutinies and seizes control of the main gate.",
"stats": [
{ "stat": "Military", "value": -6 },
{ "stat": "Strength", "value": -6 },
{ "stat": "Crime", "value": 8 },
{ "stat": "Population", "value": -2 }
]
@ -578,9 +594,13 @@
"name": "city_bureaucratic_bureaucracy",
"description": "A new procedural reform overhauls city administration, halting projects for months and stalling economic growth.",
"stats": [
{ "stat": "Infrastructure", "value": -7 },
{ "stat": "Economy", "value": -5 },
{ "stat": "Bureaucracy", "value": 10 }
{ "stat": "Bureaucracy", "value": 14 },
{ "stat": "Sprawl", "value": -9 },
{ "stat": "Health", "value": -7 },
{ "stat": "Food", "value": 3 },
{ "stat": "Industry", "value": 2 },
{ "stat": "Science", "value": 3 },
{ "stat": "Trade", "value": 4 }
]
},
{
@ -596,7 +616,7 @@
"name": "city_civic_riot",
"description": "An assembly of disgruntled workers erupts into a violent riot, tearing through market stalls and public buildings.",
"stats": [
{ "stat": "Infrastructure", "value": -12 },
{ "stat": "Trade", "value": -12 },
{ "stat": "Happiness", "value": -9 },
{ "stat": "Crime", "value": 10 }
]
@ -614,7 +634,7 @@
"name": "city_transport_infrastructure_fail",
"description": "The city's main aqueduct collapses, cutting off water supply to half the districts.",
"stats": [
{ "stat": "Infrastructure", "value": -15 },
{ "stat": "Transportation", "value": -15 },
{ "stat": "Population", "value": -4 },
{ "stat": "Bureaucracy", "value": -2 }
]
@ -632,7 +652,8 @@
"name": "city_gold_exodus",
"description": "A sudden discovery of gold in the hinterlands draws merchants away, leaving local markets starved of currency.",
"stats": [
{ "stat": "Economy", "value": -11 },
{ "stat": "Food", "value": -4 },
{ "stat": "Industry", "value": -4 },
{ "stat": "Trade", "value": -8 },
{ "stat": "Population", "value": -2 }
]
@ -642,7 +663,7 @@
"description": "An extended dry spell cripples crop yields, driving up food prices and crippling the agrarian economy.",
"stats": [
{ "stat": "Food", "value": -15 },
{ "stat": "Economy", "value": -9 },
{ "stat": "Trade", "value": -13 },
{ "stat": "Happiness", "value": -5 }
]
},
@ -651,15 +672,18 @@
"description": "The city council imposes a high tariff on imported goods to boost local industry, sparking backlash from merchants.",
"stats": [
{ "stat": "Trade", "value": -10 },
{ "stat": "Economy", "value": 7 },
{ "stat": "Crime", "value": 4 }
{ "stat": "Food", "value": -4 },
{ "stat": "Industry", "value": -6 },
{ "stat": "Science", "value": -3 },
{ "stat": "Crime", "value": 15 }
]
},
{
"name": "market_hoarding",
"description": "A powerful merchant cartel hoards staple goods, manipulating prices to inflate profits at the cost of ordinary citizens.",
"stats": [
{ "stat": "Economy", "value": -8 },
{ "stat": "Food", "value": -7 },
{ "stat": "Industry", "value": -6 },
{ "stat": "Trade", "value": -7 },
{ "stat": "Population", "value": -3 }
]
@ -669,7 +693,9 @@
"description": "A catastrophic blast at the main ironworks destroys equipment and halts production for months.",
"stats": [
{ "stat": "Industry", "value": -18 },
{ "stat": "Economy", "value": -12 },
{ "stat": "Food", "value": -3 },
{ "stat": "Industry", "value": -13 },
{ "stat": "Trade", "value": -7 },
{ "stat": "Population", "value": -4 }
]
},
@ -678,7 +704,8 @@
"description": "A foreign dynasty invests heavily in local mining, sparking a surge in jobs and wealth but also widening inequality.",
"stats": [
{ "stat": "Industry", "value": 12 },
{ "stat": "Economy", "value": 9 },
{ "stat": "Science", "value": 3 },
{ "stat": "Trade", "value": 8 },
{ "stat": "Crime", "value": 5 }
]
},
@ -686,7 +713,10 @@
"name": "tax_evasion_scheme",
"description": "A sophisticated tax evasion network siphons off a large portion of city revenue, forcing austerity measures.",
"stats": [
{ "stat": "Economy", "value": -10 },
{ "stat": "Food", "value": -8 },
{ "stat": "Industry", "value": -7 },
{ "stat": "Trade", "value": -9 },
{ "stat": "Crime", "value": 15 },
{ "stat": "Bureaucracy", "value": -6 },
{ "stat": "Population", "value": -2 }
]
@ -695,7 +725,8 @@
"name": "currency_devaluation",
"description": "The city's coinage is devalued by a sudden policy shift, causing imported goods to skyrocket in price.",
"stats": [
{ "stat": "Economy", "value": -13 },
{ "stat": "Food", "value": -8 },
{ "stat": "Industry", "value": -3 },
{ "stat": "Trade", "value": -9 },
{ "stat": "Health", "value": -4 }
]
@ -705,7 +736,8 @@
"description": "A grand artisan fair attracts wealthy patrons, boosting local crafts and increasing export revenues.",
"stats": [
{ "stat": "Industry", "value": 8 },
{ "stat": "Economy", "value": 6 },
{ "stat": "Industry", "value": 9 },
{ "stat": "Trade", "value": 9 },
{ "stat": "Population", "value": 2 }
]
},
@ -714,8 +746,10 @@
"description": "Sea-borne raiders seize a shipment of precious stones destined for the city, flooding the market with counterfeit goods.",
"stats": [
{ "stat": "Trade", "value": -12 },
{ "stat": "Economy", "value": -7 },
{ "stat": "Crime", "value": 9 }
{ "stat": "Food", "value": -7 },
{ "stat": "Industry", "value": -6 },
{ "stat": "Threat", "value": 3 },
{ "stat": "Crime", "value": 14 }
]
},
{
@ -723,7 +757,8 @@
"description": "A critical failure in the city's primary steel furnace sparks an uncontrollable fire, destroying production lines.",
"stats": [
{ "stat": "Industry", "value": -17 },
{ "stat": "Economy", "value": -10 },
{ "stat": "Trade", "value": -9 },
{ "stat": "Happiness", "value": -2 },
{ "stat": "Population", "value": -3 }
]
},
@ -732,7 +767,9 @@
"description": "A guild of master craftsmen invents a new forging technique that doubles output and lowers raw material usage.",
"stats": [
{ "stat": "Industry", "value": 14 },
{ "stat": "Economy", "value": 8 },
{ "stat": "Industry", "value": 13 },
{ "stat": "Science", "value": 15 },
{ "stat": "Trade", "value": 9 },
{ "stat": "Crime", "value": 3 }
]
},
@ -741,7 +778,6 @@
"description": "Covert saboteurs collapse a major coal shaft, halting fuel supply to all local factories for weeks.",
"stats": [
{ "stat": "Industry", "value": -15 },
{ "stat": "Economy", "value": -9 },
{ "stat": "Crime", "value": 6 }
]
},
@ -750,7 +786,6 @@
"description": "A foreign conglomerate purchases the city's largest textile mill, imposing new quotas that reduce local employment.",
"stats": [
{ "stat": "Industry", "value": -9 },
{ "stat": "Economy", "value": -7 },
{ "stat": "Population", "value": -4 }
]
},
@ -759,7 +794,7 @@
"description": "Skilled blacksmiths organize a strike demanding better wages, halting the production of critical weapons.",
"stats": [
{ "stat": "Industry", "value": -10 },
{ "stat": "Military", "value": -5 },
{ "stat": "Strength", "value": -5 },
{ "stat": "Crime", "value": 4 }
]
},
@ -776,27 +811,17 @@
"name": "bottleneck_transportation",
"description": "The city's main rail line is seized by gangsters, disrupting the flow of raw materials to factories.",
"stats": [
{ "stat": "Infrastructure", "value": -8 },
{ "stat": "Transportation", "value": -8 },
{ "stat": "Industry", "value": -6 },
{ "stat": "Crime", "value": 7 }
]
},
{
"name": "energy_rationing",
"description": "A sudden spike in electricity prices forces factories to shut down during peak hours, halving output.",
"stats": [
{ "stat": "Industry", "value": -13 },
{ "stat": "Economy", "value": -8 },
{ "stat": "Population", "value": -2 }
]
},
{
"name": "export_tariff_relief",
"description": "An unexpected removal of export tariffs on metal goods opens new markets, boosting production rates.",
"stats": [
{ "stat": "Industry", "value": 12 },
{ "stat": "Trade", "value": 9 },
{ "stat": "Economy", "value": 6 }
{ "stat": "Trade", "value": 9 }
]
},
{
@ -812,18 +837,16 @@
"name": "frontline_betrayal",
"description": "A key vanguard commander secretly defects, scattering a significant portion of the army and boosting enemy threat.",
"stats": [
{ "stat": "Army", "value": -10 },
{ "stat": "Military", "value": -6 },
{ "stat": "Threat", "value": 8 }
{ "stat": "Strength", "value": -6 },
{ "stat": "Threat", "value": 11 }
]
},
{
"name": "naval_battle_victory",
"description": "The city's navy defeats a hostile threat, securing coastal trade routes and striking a blow to the enemy's threat level.",
"stats": [
{ "stat": "Military", "value": 12 },
{ "stat": "Threat", "value": -9 },
{ "stat": "Economy", "value": 4 }
{ "stat": "Strength", "value": 12 },
{ "stat": "Threat", "value": -9 }
]
},
{
@ -832,7 +855,7 @@
"stats": [
{ "stat": "Army", "value": -14 },
{ "stat": "Health", "value": -10 },
{ "stat": "Military", "value": -5 }
{ "stat": "Strength", "value": -5 }
]
},
{
@ -841,7 +864,7 @@
"stats": [
{ "stat": "Army", "value": 8 },
{ "stat": "Strength", "value": -9 },
{ "stat": "Military", "value": -3 }
{ "stat": "Threat", "value": 3 }
]
},
{
@ -850,7 +873,7 @@
"stats": [
{ "stat": "Strength", "value": 11 },
{ "stat": "Army", "value": -6 },
{ "stat": "Military", "value": 4 }
{ "stat": "Threat", "value": -5 }
]
},
{
@ -858,7 +881,7 @@
"description": "A covert spy network uncovers threats around, reducing the threat level and providing a tactical advantage.",
"stats": [
{ "stat": "Threat", "value": -10 },
{ "stat": "Military", "value": 3 },
{ "stat": "Influence", "value": 3 },
{ "stat": "Strength", "value": 4 }
]
},
@ -866,9 +889,12 @@
"name": "war_taxes_harsh",
"description": "The council imposes severe war taxes to fund the army, inflating military budgets but cracking public happiness.",
"stats": [
{ "stat": "Military", "value": 9 },
{ "stat": "Strength", "value": 9 },
{ "stat": "Happiness", "value": -8 },
{ "stat": "Economy", "value": -5 }
{ "stat": "Food", "value": -3 },
{ "stat": "Industry", "value": -3 },
{ "stat": "Science", "value": -3 },
{ "stat": "Trade", "value": -3 }
]
},
{
@ -876,8 +902,7 @@
"description": "A revolutionary tactic is adopted on the front lines, dramatically boosting army strength and lowering enemy threat.",
"stats": [
{ "stat": "Strength", "value": 13 },
{ "stat": "Threat", "value": -8 },
{ "stat": "Military", "value": 2 }
{ "stat": "Threat", "value": -8 }
]
},
{
@ -885,7 +910,10 @@
"description": "The city brokered a favorable trade pact with a neighboring realm, opening new markets for local goods.",
"stats": [
{ "stat": "Trade", "value": 12 },
{ "stat": "Economy", "value": 8 },
{ "stat": "Food", "value": 3 },
{ "stat": "Industry", "value": 3 },
{ "stat": "Science", "value": 3 },
{ "stat": "Trade", "value": 3 },
{ "stat": "Population", "value": 3 }
]
},
@ -913,7 +941,8 @@
"stats": [
{ "stat": "Science", "value": 15 },
{ "stat": "Industry", "value": 6 },
{ "stat": "Economy", "value": 5 }
{ "stat": "Food", "value": 3 },
{ "stat": "Trade", "value": 3 }
]
},
{
@ -921,7 +950,10 @@
"description": "A grand festival draws wealthy merchants and foreign dignitaries, boosting tourism and local pride.",
"stats": [
{ "stat": "Tourism", "value": 13 },
{ "stat": "Economy", "value": 7 },
{ "stat": "Science", "value": 3 },
{ "stat": "Trade", "value": 3 },
{ "stat": "Culture", "value": 3 },
{ "stat": "Influence", "value": 3 },
{ "stat": "Happiness", "value": 6 }
]
},
@ -931,7 +963,7 @@
"stats": [
{ "stat": "Strength", "value": 12 },
{ "stat": "Army", "value": 3 },
{ "stat": "Military", "value": 4 }
{ "stat": "Threat", "value": -5 }
]
},
{
@ -948,7 +980,8 @@
"description": "A gathering of master artisans leads to the sharing of techniques that double production efficiency.",
"stats": [
{ "stat": "Industry", "value": 14 },
{ "stat": "Economy", "value": 6 },
{ "stat": "Science", "value": 8 },
{ "stat": "Trade", "value": 3 },
{ "stat": "Population", "value": 2 }
]
},
@ -956,9 +989,13 @@
"name": "infrastructure_repair",
"description": "A massive repair drive restores crumbling roads and bridges, slashing travel time and boosting trade.",
"stats": [
{ "stat": "Infrastructure", "value": 15 },
{ "stat": "Trade", "value": 5 },
{ "stat": "Economy", "value": 3 }
{ "stat": "Sprawl", "value": 10 },
{ "stat": "Transportation", "value": 9 },
{ "stat": "Health", "value": 7 },
{ "stat": "Industry", "value": 7 },
{ "stat": "Trade", "value": 7 },
{ "stat": "Food", "value": 5 },
{ "stat": "Trade", "value": 4 }
]
},
{
@ -975,7 +1012,7 @@
"name": "great_earthquake",
"description": "A massive quake rips through the city, shattering buildings, collapsing bridges, and killing thousands.",
"stats": [
{ "stat": "Infrastructure", "value": -20 },
{ "stat": "Health", "value": -19 },
{ "stat": "Population", "value": -18 },
{ "stat": "Happiness", "value": -15 }
]
@ -984,8 +1021,8 @@
"name": "plague_of_scorpion",
"description": "A deadly disease spreads through the populace, turning citizens into venom-infused monsters.",
"stats": [
{ "stat": "Health", "value": -22 },
{ "stat": "Population", "value": -16 },
{ "stat": "Health", "value": -14 },
{ "stat": "Population", "value": -10 },
{ "stat": "Crime", "value": 8 }
]
},
@ -993,8 +1030,8 @@
"name": "oil_fire_in_barnyard",
"description": "An oil storage depot explodes, sending a wave of fire over the city that reduces the army's morale and strength.",
"stats": [
{ "stat": "Industry", "value": -19 },
{ "stat": "Military", "value": -12 },
{ "stat": "Industry", "value": -9 },
{ "stat": "Happiness", "value": -4 },
{ "stat": "Threat", "value": 10 }
]
},
@ -1011,8 +1048,9 @@
"name": "cursed_great_flood",
"description": "An unseasonal deluge swallows the city, flooding every district, destroying crops, and causing widespread disease.",
"stats": [
{ "stat": "Food", "value": -20 },
{ "stat": "Economy", "value": -17 },
{ "stat": "Food", "value": -13 },
{ "stat": "Industry", "value": -6 },
{ "stat": "Trade", "value": -8 },
{ "stat": "Threat", "value": 13 }
]
},
@ -1021,15 +1059,15 @@
"description": "A minor calamity overpowers the city's fortifications, unleashing a wave of slaughter and chaos.",
"stats": [
{ "stat": "Fortification", "value": -19 },
{ "stat": "Threat", "value": 20 },
{ "stat": "Threat", "value": 19 },
{ "stat": "Happiness", "value": -12 }
]
},
{
"name": "invasion_of_the_undead",
"description": "A horde of reanimated skeletons breaks through the gates, attacking citizens and military alike.",
"description": "A horde of reanimated civilians under the influence of a calamity attack citizens and military alike.",
"stats": [
{ "stat": "Threat", "value": 25 },
{ "stat": "Threat", "value": 14 },
{ "stat": "Crime", "value": -10 },
{ "stat": "Population", "value": -12 }
]

View File

@ -149,15 +149,8 @@ pub static NAMING: Lazy<NamingData> = Lazy::new(|| {
#[cfg(test)]
mod tests {
use super::*;
// use std::fs::{self, File};
// use std::io::Write;
// use std::path::PathBuf;
/// Helper that deserialises the embedded default JSON so we can compare against it.
fn default_data() -> NamingData {
serde_json::from_str::<NamingData>(DEFAULT_JSON_STR)
.expect("DEFAULT_JSON_STR should be a valid JSON")
}
use crate::stats::ListStats;
use std::collections::HashMap;
#[test]
fn try_load() {}
@ -172,7 +165,40 @@ mod tests {
println!("Town: {}", town);
// 3. Pick an event idea
let event = NAMING.generate_long_character_name();
println!("Event idea: {}", event);
let character = NAMING.generate_long_character_name();
println!("Event idea: {}", character);
let _ = NAMING.random_event_idea();
}
#[test]
// TODO[Work]: Add this to a recap function
fn test_all_events() {
let mut values: HashMap<ListStats, usize> = HashMap::new();
for event in &NAMING.event_ideas {
println!("Testing event: {:?}", event);
assert!(event.stats.len() > 1);
for stat in &event.stats {
if let s @ (ListStats::Demographics
| ListStats::Military
| ListStats::Economy
| ListStats::Social
| ListStats::Infrastructure) = stat.stat
{
panic!("Bad stat used {s:?}")
};
match stat.value.abs() {
0..5 => (),
5..10 => (),
10..20 => println!("Big stat"),
s => panic!("The event has a stat that is way too big {s}"),
}
let base_value = values.get(&stat.stat).unwrap_or(&0);
values.insert(stat.stat, base_value + 1);
}
}
println!("{values:#?}");
// panic!()
}
}

View File

@ -286,7 +286,7 @@ pub struct MetaStats {
pub prestige: usize,
}
/// A generic stat pair with (stat, value), used mainly for clap
/// A generic stat pair with (ListStats, GenericStat), used mainly for clap
/// Accepts two forms
/// 1. "cri 10" (two separate tokens)
/// 2. "cri:10" (one token with a separator)