This commit is contained in:
shenjack 2024-05-04 17:56:33 +08:00
parent 431fc3001e
commit 434d5c9b9b
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 42 additions and 12 deletions

View File

@ -1,3 +1,6 @@
pub const PROFILE_START: u32 = 33554431;
pub mod runners { pub mod runners {
use crate::name::Player; use crate::name::Player;

View File

@ -1,49 +1,76 @@
pub struct Player { pub struct Player {
pub team: String, team: String,
pub name: String, name: String,
pub weapon: String, weapon: String,
pub player_type: PlayerType, player_type: PlayerType,
} }
pub const BOSS_NAMES: [&str; 11] = [
"mario", "sonic", "mosquito", "yuri", "slime", "ikaruga", "conan", "aokiji", "lazy", "covid", "saitama",
];
#[derive(Default)] #[derive(Default)]
pub enum PlayerType { pub enum PlayerType {
#[default] #[default]
Normal, Normal,
/// 种子玩家 /// 种子玩家
/// ///
/// # marker: `seed:` /// # marker: `seed:`
Seed, Seed,
/// 被克隆的玩家 /// 被克隆的玩家
///
/// 似乎有个三种?
Clone, Clone,
/// Boss 玩家 /// Boss 玩家
/// 其实应该是一大堆 /// 其实应该是一大堆
Boss, Boss,
/// 被特殊增强的玩家 /// 被特殊增强的玩家
/// ///
/// 有一堆 /// 有一堆
Boost, Boost,
/// 标准测号用靶子 /// 标准测号用靶子
/// ///
/// # marker: `\u0002` /// # marker: `\u0002`
Test1, Test1,
/// 没用到的测号用玩家 /// 没用到的测号用玩家
/// ///
/// # marker: `\u0003` /// # marker: `\u0003`
Test2, Test2,
/// 比标准测号再强一点的测号用靶子 /// 比标准测号再强一点的测号用靶子
/// ///
/// # marker: `!` /// # marker: `!`
TestEx, TestEx,
} }
impl Player { impl Player {
pub fn new(team: String, name: String, weapon: String, player_type: Option<PlayerType>) -> Self { 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,
}
}
};
Player { Player {
team, team,
name, name,
weapon, weapon,
player_type: player_type.unwrap_or_default(), player_type,
} }
} }
pub fn update_player(&mut self) {}
} }