1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! The damage-projection engine: pure-function math over schema profiles
//! and a flat [`Buff`](buffs::Buff) stack.
//!
//! Rust mirror of `tools/src/cruncher/` in the
//! [`@alpaca-software/40kdc-data`](https://www.npmjs.com/package/@alpaca-software/40kdc-data)
//! npm package. Both implementations assert against the shared
//! `conformance/cruncher/` corpus to keep their per-stage expected values
//! within `5e-4` of each other.
//!
//! ```
//! use wh40kdc::{Dataset, Phase};
//! use wh40kdc::cruncher::{
//! crunch, AttackProfileRef, EngineContext, EngineInput, TargetProfileRef,
//! };
//!
//! let ds = Dataset::embedded();
//! let weapon = ds.find_weapon("bolt-rifle").expect("bolt-rifle is bundled");
//! let target = ds.find_unit("intercessor-squad").expect("intercessor-squad is bundled");
//!
//! let input = EngineInput {
//! attacker: AttackProfileRef { weapon, profile_index: 0 },
//! target: TargetProfileRef { unit: target, profile_index: 0, model_count: None },
//! models_firing: 5,
//! buffs: Vec::new(),
//! context: EngineContext {
//! phase: Phase::Shooting,
//! attacker_stationary: Some(false),
//! attacker_charged: None,
//! within_half_range: Some(false),
//! attacker_in_cover: None,
//! target_in_cover: None,
//! attacker_keywords: None,
//! target_keywords: None,
//! timing: None,
//! attacker_attached: None,
//! },
//! };
//! let out = crunch(&input, None).expect("crunch succeeds");
//! assert_eq!(out.stages.len(), 7);
//! ```
pub use ;
pub use ;
pub use ;
pub use buffs_from_keyword;