Browse Source

Start working on classes

main
Noëlle 3 years ago
parent
commit
67ba11811a
2 changed files with 30 additions and 6 deletions
  1. 2
    1
      Cargo.toml
  2. 28
    5
      src/main.rs

+ 2
- 1
Cargo.toml View File

@@ -7,4 +7,5 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.3"
rand = "0.8.3"
dict = "0.1.5"

+ 28
- 5
src/main.rs View File

@@ -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);
}

Loading…
Cancel
Save