Enum Modifier

Source
#[repr(u8)]
pub enum Modifier { Min(i32), Max(i32), Exploding(ExplodingKind, Option<ComparePoint>), ReRoll(bool, Option<ComparePoint>), Unique(bool, Option<ComparePoint>), TargetSuccess(ComparePoint), TargetFailure(ComparePoint, ComparePoint), CriticalSuccess(Option<ComparePoint>), CriticalFailure(Option<ComparePoint>), Keep(KeepKind, u32), Drop(KeepKind, u32), Sort(SortKind), }
Expand description

Modifiers are special optional notations placed after a die or expression group.

Group expression can only use Keep/Drop, TargetSuccess/Failure, and Sort. Modifiers are applied in the order of the list below even if they were written in a different order in the input.
If more than one of the same modifier appears in the input, the last modifier is the one that will be applied.

Variants§

§

Min(i32)

min{amount}
Update the roll value to amount if it was below it.

§

Max(i32)

max{amount}
Update the roll value to amount if it was above it.

§

Exploding(ExplodingKind, Option<ComparePoint>)

The roll explodes whenever the value passed the compare point or it’s the highest value on the dice if not specified.
The roll can explode more than once. See ExplodingKind for the different variants of exploding available.

§

ReRoll(bool, Option<ComparePoint>)

r or r{compare_point} | ro or ro{compare_point} for reroll once
Rerolls the dice if it was the lowest number on the dice or it hit the compare point.

§

Unique(bool, Option<ComparePoint>)

u or u{compare_point} | uo or uo{compare_point} for reroll unique once
Rerolls the dice if the value was previously seen before.

§

TargetSuccess(ComparePoint)

{compare_point}
The final roll value sum will be now determined by the amount of rolls that passed the compare point, +1 for every roll.

§

TargetFailure(ComparePoint, ComparePoint)

{success_compare_point}f{failure_compare_point}
The final roll value sum will be now determined by the amount of rolls that passed or failed the compare points, +1 for every success roll, -1 for every fail roll.

§

CriticalSuccess(Option<ComparePoint>)

cs or cs{compare_point}
Purely cosmetic, adds the ** notation if the roll was the highest value on the dice or passed the compare point.

§

CriticalFailure(Option<ComparePoint>)

cf or cf{compare_point}
Purely cosmetic, adds the __ notation if the roll was the lowest value on the dice or hit the compare point.

§

Keep(KeepKind, u32)

k{amount}, kh{amount} or kl{amount}
Drops every roll except the highest or lowest {amount}. (Defaults to keep highest).

§

Drop(KeepKind, u32)

d{amount}, dh{amount} or dl{amount}
Drops {amount} of lowest or highest rolls. (Defaults to drop lowest).

§

Sort(SortKind)

s, sa or sd
Sorts the roll values in ascending or descending order. (Defaults to sort ascending).

Implementations§

Source§

impl Modifier

Source

pub fn discriminant(&self) -> u8

Source

pub fn join_all(modifiers: &[Modifier]) -> String

Trait Implementations§

Source§

impl Clone for Modifier

Source§

fn clone(&self) -> Modifier

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Modifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Modifier

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Modifier

Source§

fn eq(&self, other: &Modifier) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Modifier

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Modifier

Source§

impl StructuralPartialEq for Modifier

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V