Explorar el Código

Add vector of stat weights

main
Noëlle hace 3 años
padre
commit
7dae7ccefa
Se han modificado 1 ficheros con 17 adiciones y 21 borrados
  1. 17
    21
      src/main.rs

+ 17
- 21
src/main.rs Ver fichero

@@ -2,7 +2,7 @@ use rand::{ distributions:: {Distribution, Standard}, Rng };
//use dict::{ Dict, DictIface };
//use std::collections::HashMap;

#[derive(Debug, Hash)]
#[derive(Debug)]
enum Cls {
Artificer = 0,
Barbarian,
@@ -19,12 +19,6 @@ enum Cls {
Wizard
}

impl PartialEq for Cls {
fn eq(&self, other: &Self) -> bool {
self == other
}
}

impl Default for Cls {
fn default() -> Self { Cls::Fighter }
}
@@ -66,21 +60,23 @@ impl Character {
self.class = rand::random();
}
fn gen_stats(&mut self) {
let associated_stats = vec![
let associated_stats = vec!(
[3,1,2,5,4,0],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
];
[0,2,1,5,4,3],
[5,1,3,4,2,0],
[4,2,0,3,5,1],
[4,2,3,1,0,5],
[0,2,1,3,4,5],
[1,4,2,0,3,5],
[0,5,2,4,1,3],
[1,4,0,2,3,5],
[1,3,5,2,0,4],
[5,2,3,4,1,0],
[5,2,3,4,1,0],
[3,4,2,5,1,0]
);
let cls = self.class as u32;
println!("{:?}", associated_stats[cls]);
// println!("{:?}", associated_stats);
self.strength = roll_stat();
self.dexterity = roll_stat();

Cargando…
Cancelar
Guardar