Enum game_features::StatConditionType [−][src]
pub enum StatConditionType { MinValue(f64), BetweenValue(f64, f64), MaxValue(f64), MinPercent(f64), BetweenPercent(f64, f64), MaxPercent(f64), DivisibleBy(i32), Custom(fn(_: f64) -> bool), }
Expand description
A condition based on a stat’s value.
Variants
MinValue(f64)
The stat value must be higher or equal to this value.
The stat value must be between these values.
MaxValue(f64)
The stat value must be lower or equal to this value.
MinPercent(f64)
The minimum progress of the value between its minimum and maximum. This calculates the distance between the minimum and maximum values, then assigns a value between 0.0 and 1.0 that correspond to the absolute distance from the minimum. If the minimum value is 10 and the maximum is 20 and we have a value of 15, then this corresponds to a “distance” of 0.5 (50%!) of the way between 10 and 20.
The minimum progress of the value between its minimum and maximum. This calculates the distance between the minimum and maximum values, then assigns a value between 0.0 and 1.0 that correspond to the absolute distance from the minimum. If the minimum value is 10 and the maximum is 20 and we have a value of 15, then this corresponds to a “distance” of 0.5 (50%!) of the way between 10 and 20.
MaxPercent(f64)
The minimum progress of the value between its minimum and maximum. This calculates the distance between the minimum and maximum values, then assigns a value between 0.0 and 1.0 that correspond to the absolute distance from the minimum. If the minimum value is 10 and the maximum is 20 and we have a value of 15, then this corresponds to a “distance” of 0.5 (50%!) of the way between 10 and 20.
DivisibleBy(i32)
The value is divisible by this value. DivisibleBy(2) is equivalent to (value % 2 == 0).
A custom function that takes the value and returns whether the condition passed or not.
Implementations
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_min_value(f0: f64) -> Self
[src]
pub fn new_min_value(f0: f64) -> Self
[src]Constructs a new StatConditionType::MinValue
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_between_value(f0: f64, f1: f64) -> Self
[src]
pub fn new_between_value(f0: f64, f1: f64) -> Self
[src]Constructs a new StatConditionType::BetweenValue
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_max_value(f0: f64) -> Self
[src]
pub fn new_max_value(f0: f64) -> Self
[src]Constructs a new StatConditionType::MaxValue
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_min_percent(f0: f64) -> Self
[src]
pub fn new_min_percent(f0: f64) -> Self
[src]Constructs a new StatConditionType::MinPercent
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_between_percent(f0: f64, f1: f64) -> Self
[src]
pub fn new_between_percent(f0: f64, f1: f64) -> Self
[src]Constructs a new StatConditionType::BetweenPercent
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_max_percent(f0: f64) -> Self
[src]
pub fn new_max_percent(f0: f64) -> Self
[src]Constructs a new StatConditionType::MaxPercent
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_divisible_by(f0: i32) -> Self
[src]
pub fn new_divisible_by(f0: i32) -> Self
[src]Constructs a new StatConditionType::DivisibleBy
.
impl StatConditionType
[src]
impl StatConditionType
[src]pub fn new_custom(f0: fn(_: f64) -> bool) -> Self
[src]
pub fn new_custom(f0: fn(_: f64) -> bool) -> Self
[src]Constructs a new StatConditionType::Custom
.
Trait Implementations
impl Clone for StatConditionType
[src]
impl Clone for StatConditionType
[src]fn clone(&self) -> StatConditionType
[src]
fn clone(&self) -> StatConditionType
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for StatConditionType
[src]
impl Debug for StatConditionType
[src]impl<'de> Deserialize<'de> for StatConditionType
[src]
impl<'de> Deserialize<'de> for StatConditionType
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Serialize for StatConditionType
[src]
impl Serialize for StatConditionType
[src]Auto Trait Implementations
impl RefUnwindSafe for StatConditionType
impl Send for StatConditionType
impl Sync for StatConditionType
impl Unpin for StatConditionType
impl UnwindSafe for StatConditionType
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,