Skip to content

Commit

Permalink
decide if can choose fellow insiders
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSammyM committed Jan 17, 2025
1 parent 7c1abcb commit 49451e9
Show file tree
Hide file tree
Showing 38 changed files with 49 additions and 4 deletions.
1 change: 1 addition & 0 deletions server/src/game/components/syndicate_gun_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl SyndicateGunItem {
game,
player_with_gun,
false,
false,
game.day_number() <= 1,
ControllerID::syndicate_gun_item_shoot()
).combine_overwrite_owned(
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/ambusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl RoleStateImpl for Ambusher {
game,
actor_ref,
false,
false,
!(game.day_number() > 1),
ControllerID::role(actor_ref, Role::Ambusher, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/apostle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl RoleStateImpl for Apostle {
game,
actor_ref,
false,
false,
grayed_out,
ControllerID::role(actor_ref, Role::Apostle, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/armorsmith.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl RoleStateImpl for Armorsmith {
game,
actor_ref,
false,
true,
self.open_shops_remaining <= 0,
ControllerID::role(actor_ref, Role::Armorsmith, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/arsonist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl RoleStateImpl for Arsonist {
game,
actor_ref,
true,
true,
false,
ControllerID::role(actor_ref, Role::Arsonist, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/blackmailer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl RoleStateImpl for Blackmailer {
actor_ref,
false,
false,
false,
ControllerID::role(actor_ref, Role::Blackmailer, 0)
)
}
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/bodyguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ impl RoleStateImpl for Bodyguard {
game,
actor_ref,
self.self_shields_remaining > 0,
true,
!(game.day_number() > 1),
ControllerID::role(actor_ref, Role::Bodyguard, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/bouncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl RoleStateImpl for Bouncer {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Bouncer, 0)
)
Expand Down
16 changes: 12 additions & 4 deletions server/src/game/role/common_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub fn controller_parameters_map_player_list_night_typical(
game: &Game,
actor_ref: PlayerReference,
can_select_self: bool,
can_select_insiders: bool,
grayed_out: bool,
ability_id: ControllerID,
) -> ControllerParametersMap {
Expand All @@ -35,10 +36,17 @@ pub fn controller_parameters_map_player_list_night_typical(
AvailableAbilitySelection::new_player_list(
PlayerReference::all_players(game)
.into_iter()
.filter(|p| can_select_self || *p != actor_ref)
.filter(|player|
player.alive(game) &&
!InsiderGroupID::in_same_revealed_group(game, actor_ref, *player)
.filter(|player|
if !player.alive(game){
false
}else if *player == actor_ref{
can_select_self
}else if InsiderGroupID::in_same_revealed_group(game, actor_ref, *player){
can_select_insiders
}else{
true
}

)
.collect(),
false,
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/consort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl RoleStateImpl for Consort {
actor_ref,
false,
false,
false,
ControllerID::role(actor_ref, Role::Consort, 0)
)
}
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/cop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ impl RoleStateImpl for Cop {
game,
actor_ref,
false,
true,
!(game.day_number() > 1),
ControllerID::role(actor_ref, Role::Cop, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/counterfeiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ impl RoleStateImpl for Counterfeiter {
game,
actor_ref,
false,
false,
game.day_number() <= 1,
ControllerID::role(actor_ref, Role::Counterfeiter, 0)
).combine_overwrite_owned(
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/detective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl RoleStateImpl for Detective {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Detective, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ impl RoleStateImpl for Doctor {
game,
actor_ref,
self.self_heals_remaining > 0,
true,
false,
ControllerID::role(actor_ref, Role::Doctor, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/engineer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ impl RoleStateImpl for Engineer {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Engineer, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/escort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ impl RoleStateImpl for Escort {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Escort, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/forger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl RoleStateImpl for Forger {
game,
actor_ref,
false,
false,
self.forges_remaining == 0,
ControllerID::role(actor_ref, Role::Forger, 0)
).combine_overwrite_owned(
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/godfather.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ impl RoleStateImpl for Godfather {
game,
actor_ref,
false,
false,
game.day_number() <= 1,
ControllerID::role(actor_ref, Role::Godfather, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl RoleStateImpl for Gossip {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Gossip, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/hypnotist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ impl RoleStateImpl for Hypnotist {
actor_ref,
false,
false,
false,
ControllerID::role(actor_ref, Role::Hypnotist, 0)
)
}
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/impostor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ impl RoleStateImpl for Impostor {
game,
actor_ref,
false,
false,
game.day_number() <= 1,
ControllerID::role(actor_ref, Role::Impostor, 0)
).combine_overwrite_owned(ControllerParametersMap::new_controller_fast(
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/informant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl RoleStateImpl for Informant {
actor_ref,
false,
false,
false,
ControllerID::role(actor_ref, Role::Informant, 0)
)
}
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/krampus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ impl RoleStateImpl for Krampus {
actor_ref,
false,
false,
false,
ControllerID::role(actor_ref, Role::Krampus, ability_index)
)
}
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/lookout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl RoleStateImpl for Lookout {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Lookout, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/mafioso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl RoleStateImpl for Mafioso {
game,
actor_ref,
false,
false,
game.day_number() <= 1,
ControllerID::role(actor_ref, Role::Mafioso, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/psychic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl RoleStateImpl for Psychic {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Psychic, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/pyrolisk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl RoleStateImpl for Pyrolisk {
game,
actor_ref,
false,
true,
game.day_number() <= 1 ,
ControllerID::role(actor_ref, Role::Pyrolisk, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/recruiter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl RoleStateImpl for Recruiter {
game,
actor_ref,
false,
false,
(!choose_attack && self.recruits_remaining <= 0) || (choose_attack && game.day_number() == 1),
ControllerID::role(actor_ref, Role::Recruiter, 0)
).combine_overwrite_owned(
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/scarecrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl RoleStateImpl for Scarecrow {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Scarecrow, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/serial_killer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl RoleStateImpl for SerialKiller {
game,
actor_ref,
false,
true,
game.day_number() <= 1,
ControllerID::role(actor_ref, Role::SerialKiller, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/snoop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl RoleStateImpl for Snoop {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Snoop, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/spiral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ impl RoleStateImpl for Spiral {
game,
actor_ref,
false,
true,
game.day_number() <= 1 || !self.spiraling.is_empty(),
ControllerID::role(actor_ref, Role::Spiral, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/spy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl RoleStateImpl for Spy {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Spy, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ impl RoleStateImpl for Tracker {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Tracker, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/vigilante.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl RoleStateImpl for Vigilante {
game,
actor_ref,
false,
true,
!can_shoot,
ControllerID::role(actor_ref, Role::Vigilante, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/werewolf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl RoleStateImpl for Werewolf {
game,
actor_ref,
false,
true,
false,
ControllerID::role(actor_ref, Role::Werewolf, 0)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/yer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl RoleStateImpl for Yer {
game,
actor_ref,
false,
true,
game.day_number() <= 1,
ControllerID::role(actor_ref, Role::Yer, 1)
)
Expand Down
1 change: 1 addition & 0 deletions server/src/game/role/zealot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl RoleStateImpl for Zealot {
game,
actor_ref,
false,
false,
Cult::next_ability(game) != CultAbility::Kill,
ControllerID::role(actor_ref, Role::Zealot, 0)
)
Expand Down

0 comments on commit 49451e9

Please sign in to comment.