Skip to main content

vitium_api/game/
skill.rs

1use super::{Attr, Obj};
2use fe3o4::Id;
3use serde::{Deserialize, Serialize};
4use std::collections::HashSet;
5
6/// Defines a skill instance.
7#[derive(Serialize, Deserialize, Clone)]
8#[cfg_attr(target_family = "wasm", derive(tsify_next::Tsify))]
9#[cfg_attr(
10    target_family = "wasm",
11    tsify(into_wasm_abi, from_wasm_abi, large_number_types_as_bigints)
12)]
13pub struct Skill {
14    /// Bonus provided by profession.
15    pub prof_bonus: i16,
16    /// Bonus provided by race.
17    pub race_bonus: i16,
18    /// Attributions that can give bonus to this skill.
19    pub attr: HashSet<Id<Attr>>,
20}
21
22#[derive(Clone, Serialize, Deserialize)]
23pub struct SkillAction {
24    pub obj: Obj,
25    pub skill: String,
26}