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 {
use crate::name::Player;

View File

@ -1,11 +1,14 @@
pub struct Player {
pub team: String,
pub name: String,
pub weapon: String,
pub player_type: PlayerType,
team: String,
name: String,
weapon: String,
player_type: PlayerType,
}
pub const BOSS_NAMES: [&str; 11] = [
"mario", "sonic", "mosquito", "yuri", "slime", "ikaruga", "conan", "aokiji", "lazy", "covid", "saitama",
];
#[derive(Default)]
pub enum PlayerType {
#[default]
@ -15,6 +18,8 @@ pub enum PlayerType {
/// # marker: `seed:`
Seed,
/// 被克隆的玩家
///
/// 似乎有个三种?
Clone,
/// Boss 玩家
/// 其实应该是一大堆
@ -38,12 +43,34 @@ pub enum PlayerType {
}
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 {
team,
name,
weapon,
player_type: player_type.unwrap_or_default(),
player_type,
}
}
pub fn update_player(&mut self) {}
}