veloren/common/src/comp/ability.rs
2020-03-07 10:15:02 -08:00

39 lines
985 B
Rust

use specs::{Component, DenseVecStorage, FlaggedStorage, HashMapStorage};
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub enum AbilityState {
BasicAttack,
BasicBlock,
Roll,
}
impl Default for AbilityState {
fn default() -> Self { Self::BasicAttack }
}
impl Component for AbilityState {
type Storage = DenseVecStorage<Self>;
}
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
pub struct AbilityPool {
pub primary: Option<AbilityState>,
pub secondary: Option<AbilityState>,
pub block: Option<AbilityState>,
pub dodge: Option<AbilityState>,
}
impl Default for AbilityPool {
fn default() -> Self {
Self {
primary: Some(AbilityState::BasicAttack),
secondary: Some(AbilityState::BasicAttack),
block: None,
dodge: Some(AbilityState::Roll),
}
}
}
impl Component for AbilityPool {
type Storage = FlaggedStorage<Self, HashMapStorage<Self>>;
}