veloren/common/src/comp/ability.rs

46 lines
1.2 KiB
Rust
Raw Normal View History

2020-01-01 17:16:29 +00:00
use crate::comp;
use specs::{Component, FlaggedStorage, HashMapStorage, VecStorage};
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub enum AbilityActionKind {
Primary,
Secondary,
Dodge,
Block,
// UpdatePool?
}
impl Default for AbilityActionKind {
fn default() -> Self {
Self::Primary
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize, Eq, Hash)]
pub struct AbilityAction(pub AbilityActionKind);
impl Component for AbilityAction {
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
}
2020-02-03 10:54:50 +00:00
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
2020-01-01 17:16:29 +00:00
pub struct AbilityPool {
pub primary: Option<comp::CharacterState>,
pub secondary: Option<comp::CharacterState>,
pub block: Option<comp::CharacterState>,
pub dodge: Option<comp::CharacterState>,
2020-01-01 17:16:29 +00:00
}
2020-02-03 10:54:50 +00:00
impl Default for AbilityPool {
fn default() -> Self {
Self {
primary: Some(comp::CharacterState::BasicAttack(None)),
secondary: None,
block: None,
dodge: Some(comp::CharacterState::Roll(None)),
}
}
}
2020-01-01 17:16:29 +00:00
impl Component for AbilityPool {
2020-01-07 15:49:08 +00:00
type Storage = FlaggedStorage<Self, HashMapStorage<Self>>;
2020-01-01 17:16:29 +00:00
}