feat: make gacha student pool excplicit

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-02-15 23:04:15 -06:00
parent 06591c0df2
commit 0cbcac06af
2 changed files with 50 additions and 21 deletions

View File

@ -152,6 +152,15 @@
},
"rarity": 3
},
{
"name": {
"translations": {
"eng": "Mashiro",
"jpn": "マシロ"
}
},
"rarity": 3
},
{
"name": {
"translations": {
@ -403,14 +412,5 @@
}
},
"rarity": 1
},
{
"name": {
"translations": {
"eng": "Mashiro",
"jpn": "マシロ"
}
},
"rarity": 3
}
]

View File

@ -182,15 +182,19 @@ pub async fn banner(ctx: &Context, msg: &Message) -> CommandResult {
Ok(())
}
pub fn create_2021_02_04_hoshino_shiroko_banner() -> Banner {
fn _create_2021_02_04_hoshino_shiroko_banner() -> Banner {
// TODO: Make who's in the gacha pool explicit
// e.g. state who we're adding to the banner, rather than who we're
// removing
let pool: Vec<Student> = STUDENTS
.iter()
.filter(|student| student.name != "ノゾミ" || student.name == "マシロ")
.cloned()
.collect();
let three_star_students = "ヒナ, イオリ, ハルナ, イズミ, アル, スミレ, エイミ, カリン, ネル, マキ, ヒビキ, サヤ, シュン, シロコ, ホシノ, ヒフミ, ツルギ";
let two_star_students = "アカリ, ジュンコ, ムツキ, カヨコ, フウカ, ユウカ, アカネ, ハレ, ウタハ, チセ, ツバキ, セリカ, アヤネ, ハスミ, ハナエ, アイリ";
let one_star_students =
"チナツ, ハルカ, ジュリ, コタマ, アスナ, コトリ, フィーナ, スズミ, シミコ, セリナ, ヨシミ";
let mut pool = Vec::new();
pool.extend(get_students(three_star_students));
pool.extend(get_students(two_star_students));
pool.extend(get_students(one_star_students));
let sparkable: Vec<Student> = pool
.iter()
@ -212,12 +216,16 @@ pub fn create_2021_02_04_hoshino_shiroko_banner() -> Banner {
.unwrap()
}
pub fn create_2021_02_11_mashiro_banner() -> Banner {
let pool: Vec<Student> = STUDENTS
.iter()
.filter(|student| student.name != "ノゾミ")
.cloned()
.collect();
fn create_2021_02_11_mashiro_banner() -> Banner {
let three_star_students = "ヒナ, イオリ, ハルナ, イズミ, アル, スミレ, エイミ, カリン, ネル, マキ, ヒビキ, サヤ, シュン, シロコ, ホシノ, ヒフミ, ツルギ, マシロ";
let two_star_students = "アカリ, ジュンコ, ムツキ, カヨコ, フウカ, ユウカ, アカネ, ハレ, ウタハ, チセ, ツバキ, セリカ, アヤネ, ハスミ, ハナエ, アイリ";
let one_star_students =
"チナツ, ハルカ, ジュリ, コタマ, アスナ, コトリ, フィーナ, スズミ, シミコ, セリナ, ヨシミ";
let mut pool = Vec::new();
pool.extend(get_students(three_star_students));
pool.extend(get_students(two_star_students));
pool.extend(get_students(one_star_students));
let sparkable: Vec<Student> = pool
.iter()
@ -239,6 +247,27 @@ pub fn create_2021_02_11_mashiro_banner() -> Banner {
.unwrap()
}
fn get_students(student_list: &str) -> Vec<Student> {
let names = student_list.split(", ");
let mut students = match names.size_hint().1 {
Some(size) => Vec::with_capacity(size),
None => Vec::new(),
};
for name in names {
let maybe_student = STUDENTS.iter().find(|student| student.name == name);
match maybe_student {
Some(student) => {
students.push(student.clone());
}
None => error!("Could not find {} in students.json", name),
};
}
students
}
fn get_rarity_colour(rarity: Rarity) -> Colour {
match rarity {
Rarity::One => Colour::from_rgb(227, 234, 240),