|
|
@@ -1,10 +1,10 @@ |
|
|
|
use rand::{ distributions:: {Distribution, Standard}, |
|
|
|
Rng |
|
|
|
}; |
|
|
|
use rand::{ distributions:: {Distribution, Standard}, Rng }; |
|
|
|
//use dict::{ Dict, DictIface }; |
|
|
|
//use std::collections::HashMap; |
|
|
|
|
|
|
|
#[derive(Debug)] |
|
|
|
#[derive(Debug, Hash)] |
|
|
|
enum Cls { |
|
|
|
Artificer, |
|
|
|
Artificer = 0, |
|
|
|
Barbarian, |
|
|
|
Bard, |
|
|
|
Cleric, |
|
|
@@ -19,6 +19,12 @@ enum Cls { |
|
|
|
Wizard |
|
|
|
} |
|
|
|
|
|
|
|
impl PartialEq for Cls { |
|
|
|
fn eq(&self, other: &Self) -> bool { |
|
|
|
self == other |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
impl Default for Cls { |
|
|
|
fn default() -> Self { Cls::Fighter } |
|
|
|
} |
|
|
@@ -60,6 +66,22 @@ impl Character { |
|
|
|
self.class = rand::random(); |
|
|
|
} |
|
|
|
fn gen_stats(&mut self) { |
|
|
|
let associated_stats = vec![ |
|
|
|
[3,1,2,5,4,0], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[], |
|
|
|
[] |
|
|
|
]; |
|
|
|
// println!("{:?}", associated_stats); |
|
|
|
self.strength = roll_stat(); |
|
|
|
self.dexterity = roll_stat(); |
|
|
|
self.constitution = roll_stat(); |
|
|
@@ -88,4 +110,5 @@ fn main() { |
|
|
|
chr.pick_class(); |
|
|
|
chr.gen_stats(); |
|
|
|
println!("{:?}", chr); |
|
|
|
println!("{:?}", chr.class as u32); |
|
|
|
} |