Skip to main content

vitium_api/game/components/
melee.rs

1use std::collections::{HashMap, HashSet};
2
3use serde::{Deserialize, Serialize};
4
5use fe3o4::Id;
6
7use crate::{
8    game::{DmgType, Mart, Skill},
9    Dice,
10};
11
12/// Melee weapons.
13#[derive(Clone, Serialize, Deserialize)]
14#[cfg_attr(target_family = "wasm", derive(tsify_next::Tsify))]
15#[cfg_attr(
16    target_family = "wasm",
17    tsify(into_wasm_abi, from_wasm_abi, large_number_types_as_bigints)
18)]
19pub struct Melee {
20    /// Damage dice.
21    pub atk: HashMap<DmgType, Dice>,
22    /// In milimetres.
23    pub rng: i32,
24    /// Whether this weapon is one-handed.
25    pub one_hand: bool,
26    /// Skills that give bonus to fighting with this weapon.
27    pub skill: HashSet<Id<Skill>>,
28    /// Martial arts that can be performed with this weapon.
29    pub mart: HashSet<Id<Mart>>,
30}