Skip to main content

chaos_rpg_core/
lib.rs

1#![allow(dead_code, unused_variables, unused_imports, unused_mut, unused_parens, named_arguments_used_positionally)]
2// Style lints that would mean restructuring game code without changing behavior.
3#![allow(
4    clippy::too_many_arguments,
5    clippy::needless_range_loop,
6    clippy::type_complexity,
7    clippy::should_implement_trait
8)]
9
10//! Game logic for [CHAOS RPG](https://gitlab.com/mattbusel/chaos-rpg): every
11//! dice roll in the game is a chain of real math engines, and this crate is
12//! where that happens.
13//!
14//! ```
15//! use chaos_rpg_core::chaos_pipeline::chaos_roll_verbose;
16//!
17//! // Same input and seed, same chain, every time.
18//! let roll = chaos_roll_verbose(0.5, 666);
19//! for step in &roll.chain {
20//!     println!("{:<24} {:>6.3} -> {:>6.3}", step.engine_name, step.input, step.output);
21//! }
22//! assert!((-1.0..=1.0).contains(&roll.final_value));
23//! let d20 = roll.as_d20();
24//! assert!((1..=20).contains(&d20));
25//! ```
26//!
27//! Run `cargo run -p chaos-rpg-core --example roll -- 666` in the repository
28//! to print a full attack roll and destiny roll.
29//!
30//! Where to look:
31//!
32//! - [`chaos_pipeline`][]: [`chaos_roll_verbose`](chaos_pipeline::chaos_roll_verbose),
33//!   [`destiny_roll`](chaos_pipeline::destiny_roll) and
34//!   [`ChaosRollResult`](chaos_pipeline::ChaosRollResult), the rolls behind everything.
35//! - [`math_engines`]: the 10 engines (Lorenz attractor, Fourier harmonic, prime
36//!   density sieve, Riemann zeta partial sum, Fibonacci golden spiral,
37//!   Mandelbrot escape, logistic map, Euler's totient, Collatz chain, modular
38//!   exponentiation hash).
39//! - [`character`], [`combat`], [`enemy`], [`world`]: the game itself.
40//!
41//! Rendering is the job of the frontend crates:
42//! [`chaos-rpg`](https://crates.io/crates/chaos-rpg) (terminal),
43//! [`chaos-rpg-graphical`](https://crates.io/crates/chaos-rpg-graphical) and
44//! [`chaos-rpg-proof`](https://crates.io/crates/chaos-rpg-proof).
45
46pub mod audio_events;
47pub mod audio_synth;
48pub mod power_tier;
49pub mod misery_system;
50pub mod run_stats;
51pub mod legacy_system;
52pub mod achievement_system;
53pub mod achievements;
54pub mod run_history;
55pub mod chaos_config;
56pub mod daily_leaderboard;
57pub mod dice;
58pub mod io_util;
59pub mod paths;
60pub mod time_util;
61pub mod atlas;
62pub mod body;
63pub mod bosses;
64pub mod chaos_pipeline;
65pub mod character;
66pub mod combat;
67pub mod crafting;
68pub mod dialogue;
69pub mod dungeon;
70pub mod enemy;
71pub mod enemy_ai;
72pub mod faction_system;
73pub mod factions;
74pub mod items;
75pub mod loot_system;
76pub mod magic;
77pub mod math_engines;
78pub mod nemesis;
79pub mod npcs;
80pub mod passive_tree;
81pub mod quest;
82pub mod recipes;
83pub mod save_system;
84pub mod scoreboard;
85pub mod skill_checks;
86pub mod skill_tree;
87pub mod spells;
88pub mod status_effects;
89pub mod world;
90pub mod world_map;
91pub mod weather_system;
92pub mod economy;
93pub mod skill_tree_v2;
94pub mod inventory_system;
95pub mod combat_simulator;
96pub mod npc_generator;
97pub mod party_system;
98pub mod class_system;
99pub mod dungeon_generator_v2;
100pub mod dialogue_system;
101pub mod map_generator;
102pub mod merchant_system;
103pub mod crafting_system_v2;
104pub mod magic_system;
105pub mod relationship_system;
106pub mod trap_system;
107pub mod time_system;
108pub mod crafting_system;
109pub mod bestiary;
110pub mod quest_system;
111pub mod combat_system;
112pub mod character_creator;
113pub mod dungeon_generator;
114pub mod loot_table;
115pub mod lore;
116pub mod character_lore;
117pub mod player_bestiary;
118pub mod codex_progress;