pub enum StatConditionType {
MinValue(f64),
BetweenValue(f64, f64),
MaxValue(f64),
MinPercent(f64),
BetweenPercent(f64, f64),
MaxPercent(f64),
DivisibleBy(i32),
}Expand description
A condition based on a stat’s value.
Variants§
MinValue(f64)
The stat value must be higher or equal to this value.
BetweenValue(f64, f64)
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.
BetweenPercent(f64, 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.
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).
Implementations§
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_min_value(f0: f64) -> StatConditionType
pub fn new_min_value(f0: f64) -> StatConditionType
Constructs a new StatConditionType::MinValue.
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_between_value(f0: f64, f1: f64) -> StatConditionType
pub fn new_between_value(f0: f64, f1: f64) -> StatConditionType
Constructs a new StatConditionType::BetweenValue.
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_max_value(f0: f64) -> StatConditionType
pub fn new_max_value(f0: f64) -> StatConditionType
Constructs a new StatConditionType::MaxValue.
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_min_percent(f0: f64) -> StatConditionType
pub fn new_min_percent(f0: f64) -> StatConditionType
Constructs a new StatConditionType::MinPercent.
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_between_percent(f0: f64, f1: f64) -> StatConditionType
pub fn new_between_percent(f0: f64, f1: f64) -> StatConditionType
Constructs a new StatConditionType::BetweenPercent.
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_max_percent(f0: f64) -> StatConditionType
pub fn new_max_percent(f0: f64) -> StatConditionType
Constructs a new StatConditionType::MaxPercent.
Source§impl StatConditionType
impl StatConditionType
Sourcepub fn new_divisible_by(f0: i32) -> StatConditionType
pub fn new_divisible_by(f0: i32) -> StatConditionType
Constructs a new StatConditionType::DivisibleBy.
Trait Implementations§
Source§impl Clone for StatConditionType
impl Clone for StatConditionType
Source§fn clone(&self) -> StatConditionType
fn clone(&self) -> StatConditionType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StatConditionType
impl Debug for StatConditionType
Source§impl<'de> Deserialize<'de> for StatConditionType
impl<'de> Deserialize<'de> for StatConditionType
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StatConditionType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StatConditionType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for StatConditionType
impl Serialize for StatConditionType
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for StatConditionType
impl RefUnwindSafe for StatConditionType
impl Send for StatConditionType
impl Sync for StatConditionType
impl Unpin for StatConditionType
impl UnwindSafe for StatConditionType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more