|
@ -101,3 +101,23 @@ async fn test_item_ids_reset_when_rejoining_rooms() { |
|
|
_ => panic!(),
|
|
|
_ => panic!(),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
|
|
async fn test_load_rare_monster_default_appear_rates() {
|
|
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
let (_user1, _char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
|
|
|
.build());
|
|
|
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
|
|
|
|
join_lobby(&mut ship, ClientId(1)).await;
|
|
|
|
|
|
create_room(&mut ship, ClientId(1), "room", "").await;
|
|
|
|
|
|
|
|
|
|
|
|
// assume episode 1
|
|
|
|
|
|
let room = ship.blocks.0[0].rooms[0].as_ref().unwrap();
|
|
|
|
|
|
println!("rare monster table: {:?}", room.rare_monster_table);
|
|
|
|
|
|
let rates = &*room.rare_monster_table;
|
|
|
|
|
|
for (_monster, rate) in rates.clone().appear_rate {
|
|
|
|
|
|
assert_eq!(rate, 0.001953125f32); // 1/512 = 0.001953125
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|