| //use dict::{ Dict, DictIface }; | //use dict::{ Dict, DictIface }; | ||||
| //use std::collections::HashMap; | //use std::collections::HashMap; | ||||
| #[derive(Debug, Hash)] | |||||
| #[derive(Debug)] | |||||
| enum Cls { | enum Cls { | ||||
| Artificer = 0, | Artificer = 0, | ||||
| Barbarian, | Barbarian, | ||||
| Wizard | Wizard | ||||
| } | } | ||||
| impl PartialEq for Cls { | |||||
| fn eq(&self, other: &Self) -> bool { | |||||
| self == other | |||||
| } | |||||
| } | |||||
| impl Default for Cls { | impl Default for Cls { | ||||
| fn default() -> Self { Cls::Fighter } | fn default() -> Self { Cls::Fighter } | ||||
| } | } | ||||
| self.class = rand::random(); | self.class = rand::random(); | ||||
| } | } | ||||
| fn gen_stats(&mut self) { | fn gen_stats(&mut self) { | ||||
| let associated_stats = vec![ | |||||
| let associated_stats = vec!( | |||||
| [3,1,2,5,4,0], | [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); | // println!("{:?}", associated_stats); | ||||
| self.strength = roll_stat(); | self.strength = roll_stat(); | ||||
| self.dexterity = roll_stat(); | self.dexterity = roll_stat(); |