[][src]Struct dsa::commands::Roll

pub struct Roll;

Methods

impl Roll[src]

pub fn new_action() -> Box<dyn Action>[src]

Trait Implementations

impl Action for Roll[src]

Rolls the dice for a certain skill of the Hero, supports modifiers.

Examples

let mut roll = Roll::new_action();
hero.qualities.extend(
    vec![
        (Agility,1),
        (Dexterity,2),
        (Strength,3),
    ]
);
hero.skills.insert("bogen".to_string(),(4,[Agility,Dexterity,Strength]));
let matches = roll.usage().get_matches_from(&["roll","-m","-5","--mod","3","bogen"]);
let output = roll.call(&hero,&matches).unwrap();
assert_eq!(1,output.len());
 
if let Output::Roll { base, stat, mods, .. } = &output[0] {
    assert_eq!(4, *base);
    assert_eq!(&[1,2,3], stat);
    assert_eq!(-2, *mods);
}

Auto Trait Implementations

impl RefUnwindSafe for Roll

impl Send for Roll

impl Sync for Roll

impl Unpin for Roll

impl UnwindSafe for Roll

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]