1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
use crate::judger::roles::{Identity, LifeStatus};
use rand::Rng;

use super::Responder;

pub struct DebugBot {
    id: usize,
    status: LifeStatus,
    role: Identity,
    username: String,
}

impl DebugBot {
    #[allow(dead_code)]
    pub fn new() -> Self {
        Self {
            id: 0,
            status: LifeStatus::Alive,
            role: Identity::Raw,
            username: String::new(),
        }
    }
}

impl Responder for DebugBot {
    fn send(&mut self, _msg: &str) {}

    fn rec(&mut self) -> String { 
        panic!("this is ai");
    }

    fn send_number(&mut self, _x: usize) {}

    fn rec_number(&mut self) -> usize {
        panic!("this is ai");
    }

    fn send_begin(&mut self) {}

    fn send_end(&mut self) {}

    fn send_msg(&mut self, msg: &str) {
        self.send(&format!("m{}", msg));
    }

    
    fn rec_text(&mut self) -> String {
        String::from("好人,过。")
    }
    
    fn send_json(&mut self, _jstr: &str) { 
        panic!("this is ai")
    }

    fn vote(&mut self, _msg: &str, list: Vec<(usize, String)>) -> (String, usize) {
        let mut rng = rand::thread_rng();
        let tar: usize = rng.gen::<usize>() % list.len();
        (format!("{} -> {}", self.name(), list[tar].1), list[tar].0)
    }

    fn role(&self) -> Identity {
        self.role.clone()
    }

    fn set_role(&mut self, r: Identity) {
        self.role = r;
    }

    fn status(&self) -> LifeStatus {
        self.status
    }

    fn set_status(&mut self, s: LifeStatus) {
        self.status = s;
    }

    fn set_name(&mut self) {
        self.username = "舔一舔".to_string();
    }

    fn name(&self) -> String { 
        format!("{}({} 号)", &self.username, self.id)
    }

    fn set_id(&mut self, id: usize) {
        self.id = id;
    }

    fn get_id(&self) -> usize { 
        self.id
    }

    fn coutinue_game(&mut self) {}

}