Skip to content

Instantly share code, notes, and snippets.

@aburgd
Created September 12, 2019 02:40
Show Gist options
  • Select an option

  • Save aburgd/7fa92226e0b75080353437fd33b5afac to your computer and use it in GitHub Desktop.

Select an option

Save aburgd/7fa92226e0b75080353437fd33b5afac to your computer and use it in GitHub Desktop.
wip courier implementation
use rand::Rng;
struct Courier {
special: Special,
skills: Vec<String>,
traits: Vec<String>,
}
impl Courier {
fn tag_skills() -> Vec<String> {
let available_skills: [&str; 9] = ["energy weapons", "melee weapons", "guns", "barter",
"repair", "speech", "explosives", "unarmed", "medicine"];
let mut player_skills: Vec<String> = Vec::new();
for _ in 0..2 {
player_skills.push(String::from(
available_skills[rand::thread_rng().gen_range(0, 8)]
));
}
player_skills.sort();
player_skills.dedup();
while player_skills.len() < 2 {
player_skills.push(String::from(
available_skills[rand::thread_rng().gen_range(0, 8)]
));
player_skills.dedup();
}
return player_skills;
}
fn pick_traits() -> Vec<String> {
let available_traits: [&str; 10] = ["built to destroy", "fast shot", "four eyes", "good natured", "heavy handed",
"kamikaze", "loose cannon", "small frame", "trigger discipline", "wild wasteland"];
let mut player_traits: Vec<String> = Vec::new();
for _ in 0..3 {
player_traits.push(String::from(
available_traits[rand::thread_rng().gen_range(0, 9)]
));
}
player_traits.sort();
player_traits.dedup();
while player_traits.len() < 3 {
player_traits.push(String::from(
available_traits[rand::thread_rng().gen_range(0, 9)]
));
player_traits.dedup();
}
return player_traits;
}
fn new(special: Special, skills: Vec<String>, traits: Vec<String>) -> Courier {
Courier { special: special, skills: skills, traits: traits }
}
}
struct Special {
strength: i8,
perception: i8,
endurance: i8,
charisma: i8,
intelligence: i8,
agility: i8,
luck: i8
}
enum GameGender {
Male,
Female
}
enum PlayerGender {
Male,
Female,
Nonbinary,
Agender,
Androgyne,
Transmasculine,
Transfeminine
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment