wowlab_engine_domain/
base_stats.rs1mod table;
4
5use table::CLASS_BASE_STATS;
6use wowlab_types::game::{ClassId, RaceId};
7
8use crate::{MAX_BASE_STAT_LEVEL, stats::PrimaryStats};
9
10const TWO: f64 = 2.0;
11const THREE: f64 = 3.0;
12
13#[must_use]
15pub(crate) fn class_base_stats(class: ClassId, level: u32) -> PrimaryStats {
16 let class_index = (class as usize) - 1;
17 let level_index = (level as usize).clamp(1, MAX_BASE_STAT_LEVEL) - 1;
18 let [strength, agility, stamina, intellect] = CLASS_BASE_STATS[class_index][level_index];
20
21 PrimaryStats {
22 strength,
23 agility,
24 intellect,
25 stamina,
26 }
27}
28
29#[must_use]
31pub(crate) const fn race_stat_deltas(race: RaceId) -> PrimaryStats {
32 let (strength, agility, stamina, intellect) = match race {
33 RaceId::Human | RaceId::Dracthyr | RaceId::EarthenA | RaceId::EarthenH => {
34 (0.0, 0.0, 0.0, 0.0)
35 }
36 RaceId::Orc | RaceId::MagharOrc => (THREE, -THREE, 1.0, -1.0),
37 RaceId::Dwarf | RaceId::DarkIronDwarf => (TWO, -TWO, 1.0, -1.0),
38 RaceId::NightElf => (-TWO, TWO, 0.0, 0.0),
39 RaceId::Undead => (TWO, -1.0, 1.0, -TWO),
40 RaceId::Tauren => (TWO, -TWO, TWO, -TWO),
41 RaceId::Gnome | RaceId::Goblin => (-THREE, 1.0, -1.0, THREE),
42 RaceId::Troll | RaceId::ZandalariTroll => (1.0, TWO, 0.0, -THREE),
43 RaceId::BloodElf | RaceId::VoidElf => (-THREE, 1.0, 0.0, TWO),
44 RaceId::Draenei => (1.0, -THREE, TWO, 0.0),
45 RaceId::Vulpera => (-THREE, THREE, -1.0, 1.0),
46 RaceId::Mechagnome | RaceId::Nightborne => (-TWO, 1.0, -1.0, TWO),
47 RaceId::Worgen => (TWO, 1.0, 0.0, -THREE),
48 RaceId::PandarenA | RaceId::PandarenH => (0.0, -TWO, TWO, 0.0),
49 RaceId::HighmountainTauren | RaceId::KulTiran => (1.0, -TWO, TWO, -1.0),
50 RaceId::LightforgedDraenei => (0.0, -1.0, 1.0, 0.0),
51 };
52
53 PrimaryStats {
54 strength,
55 agility,
56 intellect,
57 stamina,
58 }
59}