Skip to main content

vitium_api/game/components/
ranged.rs

1use std::collections::{HashMap, HashSet};
2
3use serde::{Deserialize, Serialize};
4
5use crate::{game::DmgType, Dice};
6
7/// Ranged weapons.
8#[derive(Clone, Serialize, Deserialize)]
9#[cfg_attr(target_family = "wasm", derive(tsify_next::Tsify))]
10#[cfg_attr(
11    target_family = "wasm",
12    tsify(into_wasm_abi, from_wasm_abi, large_number_types_as_bigints)
13)]
14pub struct Ranged {
15    pub atk: HashMap<DmgType, Dice>,
16    /// In metres.
17    pub rng: f32,
18    /// The minute-of-angle accuracy.
19    pub moa: f32,
20    /// Moving speed of the bullet.
21    pub speed: f32,
22    /// Items that can be used to charge this weapon.
23    pub charge_item: HashSet<String>,
24    /// How many charges can be stored.
25    pub charge_lim: i16,
26    /// Charges used per shot.
27    pub per_shot: u8,
28    /// Shots able to perform in a turn.
29    pub freq: f32,
30}