Adds effects for changing target stats.

This commit is contained in:
2022-09-10 12:20:48 +02:00
parent a710527975
commit 0f85f4f0a4
8 changed files with 218 additions and 0 deletions

View File

@@ -35,6 +35,35 @@ impl EffectParameter {
}
}
}
pub fn as_bool(&self) -> bool {
if let EffectParameter::Bool(b) = self {
return *b;
}
panic!("Unexpected effect parameter type: {}", self);
}
pub fn as_int(&self) -> i64 {
if let EffectParameter::Int(i) = self {
return *i;
}
panic!("Unexpected effect parameter type: {}", self);
}
pub fn as_float(&self) -> f32 {
if let EffectParameter::Float(f) = self {
return *f;
}
panic!("Unexpected effect parameter type: {}", self);
}
pub fn as_string(&self) -> StringKey {
if let EffectParameter::String(s) = self {
return s.clone();
}
panic!("Unexpected effect parameter type: {}", self);
}
}
#[cfg(not(feature = "mock_data"))]