sc2_techtree/
weapon.rs

1//! Terminology:
2//! Attack = Single projectile or strike
3//! Hit = Attack that connects with the target
4
5use noisy_float::prelude::*;
6use serde::{Deserialize, Serialize};
7
8use super::attribute::Attribute;
9
10/// Weapon target type
11#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
12pub enum WeaponTargetType {
13    /// To ground only
14    Ground,
15    /// To air only
16    Air,
17    /// To ground and air both
18    Any,
19}
20
21/// Weapon bonus
22#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
23pub struct WeaponBonus {
24    /// Bonus affects attacks against units having this attribute
25    against: Attribute,
26    /// The amount of bonus damage per hit
27    damage: R32,
28}
29
30/// Weapon
31#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
32pub struct Weapon {
33    target_type: WeaponTargetType,
34    /// Damage per hit, no upgrades
35    damage_per_hit: R32,
36    /// Percentage
37    damage_splash: R32,
38    /// Attacks per one attack tick, e.g. 2 for Colossus
39    attacks: u32,
40    /// Range
41    range: R32,
42    /// Cooldown
43    cooldown: R32,
44    /// Bonuses
45    bonuses: Vec<WeaponBonus>,
46}