Struct twt_werewolf_master_ng::judger::Judger
source · pub struct Judger {
players: Vec<Box<dyn Responder>>,
groups: Vec<Box<dyn RoleGroup>>,
bind_addr: String,
enabled_roles: Vec<(Identity, usize)>,
player_num: usize,
ai_num: usize,
log: Log,
}
Expand description
Fields§
§players: Vec<Box<dyn Responder>>
§groups: Vec<Box<dyn RoleGroup>>
§bind_addr: String
§enabled_roles: Vec<(Identity, usize)>
§player_num: usize
§ai_num: usize
§log: Log
Implementations§
source§impl Judger
impl Judger
pub fn new() -> Self
fn get_bind_addr(&mut self)
sourcefn get_enabled(&mut self)
fn get_enabled(&mut self)
获得启用的角色。狼人和平民是狼人杀的核心,不在选项内,直接加入。
这个函数中只获取启用的角色。角色数量和接入 AI 数量到 get_nums
中设置。
sourcefn get_config(&mut self)
fn get_config(&mut self)
设置绑定地址和接入角色。
sourcefn get_option(&mut self)
fn get_option(&mut self)
获取所有设置。
sourcefn build_connect(&mut self)
fn build_connect(&mut self)
先接入人类用户,再接入指定数目的 AI。连接完成后获得每个玩家的用户名和编号。
sourcefn assign_role(&mut self)
fn assign_role(&mut self)
随机分配角色。
sourcefn night(
players: &mut Vec<Box<dyn Responder>>,
groups: &Vec<Box<dyn RoleGroup>>,
log: &mut Log
)
fn night( players: &mut Vec<Box<dyn Responder>>, groups: &Vec<Box<dyn RoleGroup>>, log: &mut Log )
sourcefn day(players: &mut Vec<Box<dyn Responder>>, log: &mut Log)
fn day(players: &mut Vec<Box<dyn Responder>>, log: &mut Log)
白天。由讨论和投票两部组成。白天的开始是明确的,不需要发送开始信号。
sourcefn devide(
players: &mut Vec<Box<dyn Responder>>
) -> (Vec<&'_ mut Box<dyn Responder>>, Vec<&'_ mut Box<dyn Responder>>, Vec<&'_ mut Box<dyn Responder>>)
fn devide( players: &mut Vec<Box<dyn Responder>> ) -> (Vec<&'_ mut Box<dyn Responder>>, Vec<&'_ mut Box<dyn Responder>>, Vec<&'_ mut Box<dyn Responder>>)
将玩家分成平民、狼人和神职三组,返回指向它们的可变引用构成的向量。
Auto Trait Implementations§
impl Freeze for Judger
impl !RefUnwindSafe for Judger
impl !Send for Judger
impl !Sync for Judger
impl Unpin for Judger
impl !UnwindSafe for Judger
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more