namerena-rs/namerena-runner/src/player.rs

77 lines
1.8 KiB
Rust
Raw Normal View History

2024-05-04 17:28:19 +08:00
pub struct Player {
2024-05-04 17:56:33 +08:00
team: String,
name: String,
weapon: String,
player_type: PlayerType,
2024-05-04 17:28:19 +08:00
}
2024-05-04 17:56:33 +08:00
pub const BOSS_NAMES: [&str; 11] = [
"mario", "sonic", "mosquito", "yuri", "slime", "ikaruga", "conan", "aokiji", "lazy", "covid", "saitama",
];
2024-05-04 17:28:19 +08:00
#[derive(Default)]
pub enum PlayerType {
#[default]
Normal,
2024-05-04 17:41:59 +08:00
/// 种子玩家
2024-05-04 17:56:33 +08:00
///
2024-05-04 17:41:59 +08:00
/// # marker: `seed:`
Seed,
/// 被克隆的玩家
2024-05-04 17:56:33 +08:00
///
/// 似乎有个三种?
2024-05-04 17:41:59 +08:00
Clone,
/// Boss 玩家
/// 其实应该是一大堆
Boss,
/// 被特殊增强的玩家
2024-05-04 17:56:33 +08:00
///
2024-05-04 17:41:59 +08:00
/// 有一堆
Boost,
/// 标准测号用靶子
2024-05-04 17:56:33 +08:00
///
2024-05-04 17:41:59 +08:00
/// # marker: `\u0002`
Test1,
/// 没用到的测号用玩家
2024-05-04 17:56:33 +08:00
///
2024-05-04 17:41:59 +08:00
/// # marker: `\u0003`
Test2,
/// 比标准测号再强一点的测号用靶子
2024-05-04 17:56:33 +08:00
///
2024-05-04 17:41:59 +08:00
/// # marker: `!`
TestEx,
2024-05-04 17:28:19 +08:00
}
impl Player {
2024-05-04 17:56:33 +08:00
pub fn new(team: String, name: String, weapon: String) -> Self {
let player_type = {
if name.starts_with("seed:") {
// 种子
PlayerType::Seed
} else {
match team.as_str() {
"!" => {
if BOSS_NAMES.contains(&name.as_str()) {
PlayerType::Boss
} else {
// 高强度测号用靶子
PlayerType::TestEx
}
}
"\u{0002}" => PlayerType::Test1,
"\u{0003}" => PlayerType::Test2,
_ => PlayerType::Normal,
}
}
};
2024-05-04 17:28:19 +08:00
Player {
team,
name,
weapon,
2024-05-04 17:56:33 +08:00
player_type,
2024-05-04 17:28:19 +08:00
}
}
2024-05-04 17:56:33 +08:00
pub fn update_player(&mut self) {}
2024-05-04 17:28:19 +08:00
}