Added new roles
parent
b91223d6ed
commit
fa7d78c272
|
@ -43,10 +43,14 @@ pub enum Role {
|
||||||
Jester,
|
Jester,
|
||||||
Mason,
|
Mason,
|
||||||
Shepard,
|
Shepard,
|
||||||
|
Dreamer,
|
||||||
|
ApprenticeSeer,
|
||||||
// Wolf Roles
|
// Wolf Roles
|
||||||
MasterWolf,
|
MasterWolf,
|
||||||
WolfShaman,
|
WolfShaman,
|
||||||
Wolf,
|
Wolf,
|
||||||
|
WolfAgent,
|
||||||
|
WolfDreamer,
|
||||||
// Custom Role
|
// Custom Role
|
||||||
Custom(String, RoleColor),
|
Custom(String, RoleColor),
|
||||||
}
|
}
|
||||||
|
@ -72,6 +76,10 @@ impl Display for Role {
|
||||||
Role::WolfShaman => "Wolf Shaman",
|
Role::WolfShaman => "Wolf Shaman",
|
||||||
Role::Wolf => "Wolf",
|
Role::Wolf => "Wolf",
|
||||||
Role::Custom(role_name, _) => role_name,
|
Role::Custom(role_name, _) => role_name,
|
||||||
|
Role::Dreamer => "Dreamer",
|
||||||
|
Role::ApprenticeSeer => "Apprentice Seer",
|
||||||
|
Role::WolfAgent => "Wolf Agent",
|
||||||
|
Role::WolfDreamer => "Wolf Dreamer",
|
||||||
};
|
};
|
||||||
|
|
||||||
write!(f, "{}", s)
|
write!(f, "{}", s)
|
||||||
|
@ -92,14 +100,18 @@ impl Role {
|
||||||
Role::Psychic => RoleColor::Blue,
|
Role::Psychic => RoleColor::Blue,
|
||||||
Role::Miller => RoleColor::Red,
|
Role::Miller => RoleColor::Red,
|
||||||
Role::Herring => RoleColor::Blue,
|
Role::Herring => RoleColor::Blue,
|
||||||
Role::Spy => RoleColor::Blue,
|
Role::Spy => RoleColor::Green,
|
||||||
Role::Jester => RoleColor::Purple,
|
Role::Jester => RoleColor::Purple,
|
||||||
Role::Mason => RoleColor::Green,
|
Role::Mason => RoleColor::Green,
|
||||||
Role::Shepard => RoleColor::Green,
|
Role::Shepard => RoleColor::Green,
|
||||||
Role::MasterWolf => RoleColor::Green,
|
Role::MasterWolf => RoleColor::Green,
|
||||||
Role::WolfShaman => RoleColor::Red,
|
Role::WolfShaman => RoleColor::Red,
|
||||||
Role::Wolf => RoleColor::Red,
|
Role::Wolf => RoleColor::Red,
|
||||||
|
Role::Dreamer => RoleColor::Red,
|
||||||
Role::Custom(_, color) => color.clone(),
|
Role::Custom(_, color) => color.clone(),
|
||||||
|
Role::ApprenticeSeer => RoleColor::Blue,
|
||||||
|
Role::WolfAgent => RoleColor::Red,
|
||||||
|
Role::WolfDreamer =>RoleColor::Red,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,6 +119,7 @@ impl Role {
|
||||||
pub fn player_color(&self) -> RoleColor {
|
pub fn player_color(&self) -> RoleColor {
|
||||||
match self {
|
match self {
|
||||||
Role::Miller => RoleColor::Green,
|
Role::Miller => RoleColor::Green,
|
||||||
|
Role::Herring => RoleColor::Green,
|
||||||
_ => self.seer_color(),
|
_ => self.seer_color(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,6 +128,7 @@ impl Role {
|
||||||
pub fn player_role_name(&self) -> String {
|
pub fn player_role_name(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Role::Miller => Role::Villager.to_string(),
|
Role::Miller => Role::Villager.to_string(),
|
||||||
|
Role::Herring => Role::Villager.to_string(),
|
||||||
_ => self.to_string(),
|
_ => self.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +136,8 @@ impl Role {
|
||||||
pub fn register_role_listener(&self, listeners: &mut Listeners) {
|
pub fn register_role_listener(&self, listeners: &mut Listeners) {
|
||||||
#[allow(clippy::single_match)]
|
#[allow(clippy::single_match)]
|
||||||
match self {
|
match self {
|
||||||
Role::Spy => listeners.add_listener(Box::new(SpyListener {})),
|
Role::Spy => listeners.add_listener(Box::new(SpyListener {role: Role::Spy})),
|
||||||
|
Role::WolfAgent => listeners.add_listener(Box::new(SpyListener {role: Role::WolfAgent})),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ use serenity::model::prelude::UserId;
|
||||||
use serenity::utils::MessageBuilder;
|
use serenity::utils::MessageBuilder;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SpyListener {}
|
pub struct SpyListener {
|
||||||
|
pub role: Role
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl Listener for SpyListener {
|
impl Listener for SpyListener {
|
||||||
|
@ -43,7 +45,7 @@ impl Listener for SpyListener {
|
||||||
.game_state()?
|
.game_state()?
|
||||||
.player_data
|
.player_data
|
||||||
.iter()
|
.iter()
|
||||||
.find(|p| p.alive && p.role == Role::Spy);
|
.find(|p| p.alive && p.role == self.role);
|
||||||
|
|
||||||
if let Some(spy_player) = spy_player {
|
if let Some(spy_player) = spy_player {
|
||||||
if spy_player.discord_id == dest_player.discord_id
|
if spy_player.discord_id == dest_player.discord_id
|
||||||
|
|
Loading…
Reference in New Issue