Gacha Simulator for https://bluearchive.jp/
Go to file
Rekai Nyangadzayi Musuka d5df9d4d30 fix: improve type signatures of some methods 2021-04-14 02:12:18 -05:00
examples fix: improve type signatures of some methods 2021-04-14 02:12:18 -05:00
src fix: improve type signatures of some methods 2021-04-14 02:12:18 -05:00
.gitignore feat: ensure that bluearch-recruitment is a library 2021-02-10 16:30:40 -06:00
Cargo.toml feat: rename from bluearch-recruitment to blue-gacha 2021-04-14 01:42:05 -05:00
LICENSE Create LICENSE 2021-02-09 14:50:15 -06:00
README.md feat: reimplement priority gacha system 2021-03-04 22:30:36 -06:00

README.md

Blue Archive Gacha Simulator

Here's an implementation of Blue Archive's Gacha System. I believe it to be correct, though I'm always willing to accept corrections if you have any!

Example

Here's what's needed in order to call .roll() and .roll10().

let mut students_str = String::new();
let mut students = File::open("./examples/students.json").unwrap();
students.read_to_string(&mut students_str).unwrap();

let students: Vec<Student> = serde_json::from_str(&students_str).unwrap();

This Repo contains students.json (in the examples directory) which is an Array where each object within the array contains a Student's Japanese name, English TL name and rarity.

// Here we construct a hypothetical banner featuring a gacha poll of
// everybody but Nozomi
let banner_students: Vec<Student> = students
    .iter()
    .filter(|student| student.name != "ノゾミ")
    .map(|student| student.clone())
    .collect();

let hoshino = find_student(&students, "ホシノ").unwrap()
    .into_priority_student(7.0 / 2.0);
let shiroko = find_student(&students, "シロコ").unwrap()
    .into_priority_student(7.0 / 2.0);

let priority_students = vec![shiroko, hoshino];

let gacha = GachaBuilder::new(79.0, 18.5, 2.5)
    .with_pool(banner_students)
    .with_priority(&priority_students)
    .finish()
    .unwrap();

let pickup_banner = BannerBuilder::new("ピックアップ募集")
    .with_name_translation(Language::English, "Rate-Up Registration")
    .with_sparkable_students(&priority_students)
    .with_gacha(&gacha)
    .finish()
    .unwrap();

After selecting all the students for the banner, we want to declare which units are on rate-up if there are any. In this example, Hoshino and Shiroko have unique rates.

The BannerBuilder and GachaBuilder structs are builders that set up the actual gacha system. After a Banner has successfully been built using the Banner Builder, we can call:

let student: Student = pickup_banner.roll();
// or 
let students: [Student; 10] = pickup_banner.roll10();

to perform gacha rolls using the configurations encoded above.