veloren/common/src/effect.rs

18 lines
415 B
Rust
Raw Normal View History

use crate::comp;
/// An effect that may be applied to an entity
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Effect {
Health(i32, comp::HealthSource),
Xp(i64),
}
2019-10-09 19:28:05 +00:00
impl Effect {
pub fn info(&self) -> String {
match self {
Effect::Health(n, _) => format!("{:+} health", n),
Effect::Xp(n) => format!("{:+} exp", n),
}
}
}