From 49451e912f73786e727a621241bc1b942a383096 Mon Sep 17 00:00:00 2001 From: Sam Maselli Date: Fri, 17 Jan 2025 00:36:45 -0500 Subject: [PATCH] decide if can choose fellow insiders --- server/src/game/components/syndicate_gun_item.rs | 1 + server/src/game/role/ambusher.rs | 1 + server/src/game/role/apostle.rs | 1 + server/src/game/role/armorsmith.rs | 1 + server/src/game/role/arsonist.rs | 1 + server/src/game/role/blackmailer.rs | 1 + server/src/game/role/bodyguard.rs | 1 + server/src/game/role/bouncer.rs | 1 + server/src/game/role/common_role.rs | 16 ++++++++++++---- server/src/game/role/consort.rs | 1 + server/src/game/role/cop.rs | 1 + server/src/game/role/counterfeiter.rs | 1 + server/src/game/role/detective.rs | 1 + server/src/game/role/doctor.rs | 1 + server/src/game/role/engineer.rs | 1 + server/src/game/role/escort.rs | 1 + server/src/game/role/forger.rs | 1 + server/src/game/role/godfather.rs | 1 + server/src/game/role/gossip.rs | 1 + server/src/game/role/hypnotist.rs | 1 + server/src/game/role/impostor.rs | 1 + server/src/game/role/informant.rs | 1 + server/src/game/role/krampus.rs | 1 + server/src/game/role/lookout.rs | 1 + server/src/game/role/mafioso.rs | 1 + server/src/game/role/psychic.rs | 1 + server/src/game/role/pyrolisk.rs | 1 + server/src/game/role/recruiter.rs | 1 + server/src/game/role/scarecrow.rs | 1 + server/src/game/role/serial_killer.rs | 1 + server/src/game/role/snoop.rs | 1 + server/src/game/role/spiral.rs | 1 + server/src/game/role/spy.rs | 1 + server/src/game/role/tracker.rs | 1 + server/src/game/role/vigilante.rs | 1 + server/src/game/role/werewolf.rs | 1 + server/src/game/role/yer.rs | 1 + server/src/game/role/zealot.rs | 1 + 38 files changed, 49 insertions(+), 4 deletions(-) diff --git a/server/src/game/components/syndicate_gun_item.rs b/server/src/game/components/syndicate_gun_item.rs index 97fdc0c92..74b4e033e 100644 --- a/server/src/game/components/syndicate_gun_item.rs +++ b/server/src/game/components/syndicate_gun_item.rs @@ -43,6 +43,7 @@ impl SyndicateGunItem { game, player_with_gun, false, + false, game.day_number() <= 1, ControllerID::syndicate_gun_item_shoot() ).combine_overwrite_owned( diff --git a/server/src/game/role/ambusher.rs b/server/src/game/role/ambusher.rs index 8bb456301..646f27edc 100644 --- a/server/src/game/role/ambusher.rs +++ b/server/src/game/role/ambusher.rs @@ -84,6 +84,7 @@ impl RoleStateImpl for Ambusher { game, actor_ref, false, + false, !(game.day_number() > 1), ControllerID::role(actor_ref, Role::Ambusher, 0) ) diff --git a/server/src/game/role/apostle.rs b/server/src/game/role/apostle.rs index 84e8fd289..f55485a18 100644 --- a/server/src/game/role/apostle.rs +++ b/server/src/game/role/apostle.rs @@ -76,6 +76,7 @@ impl RoleStateImpl for Apostle { game, actor_ref, false, + false, grayed_out, ControllerID::role(actor_ref, Role::Apostle, 0) ) diff --git a/server/src/game/role/armorsmith.rs b/server/src/game/role/armorsmith.rs index 0ce4dddcf..b25bdd506 100644 --- a/server/src/game/role/armorsmith.rs +++ b/server/src/game/role/armorsmith.rs @@ -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) ) diff --git a/server/src/game/role/arsonist.rs b/server/src/game/role/arsonist.rs index 27589770b..76b281d29 100644 --- a/server/src/game/role/arsonist.rs +++ b/server/src/game/role/arsonist.rs @@ -53,6 +53,7 @@ impl RoleStateImpl for Arsonist { game, actor_ref, true, + true, false, ControllerID::role(actor_ref, Role::Arsonist, 0) ) diff --git a/server/src/game/role/blackmailer.rs b/server/src/game/role/blackmailer.rs index c7ad3254d..6273f8c6a 100644 --- a/server/src/game/role/blackmailer.rs +++ b/server/src/game/role/blackmailer.rs @@ -34,6 +34,7 @@ impl RoleStateImpl for Blackmailer { actor_ref, false, false, + false, ControllerID::role(actor_ref, Role::Blackmailer, 0) ) } diff --git a/server/src/game/role/bodyguard.rs b/server/src/game/role/bodyguard.rs index ce8847dac..516f3f2df 100644 --- a/server/src/game/role/bodyguard.rs +++ b/server/src/game/role/bodyguard.rs @@ -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) ) diff --git a/server/src/game/role/bouncer.rs b/server/src/game/role/bouncer.rs index a448efc0f..1a9a1ca0f 100644 --- a/server/src/game/role/bouncer.rs +++ b/server/src/game/role/bouncer.rs @@ -32,6 +32,7 @@ impl RoleStateImpl for Bouncer { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Bouncer, 0) ) diff --git a/server/src/game/role/common_role.rs b/server/src/game/role/common_role.rs index b6f8e51a7..7c72441bb 100644 --- a/server/src/game/role/common_role.rs +++ b/server/src/game/role/common_role.rs @@ -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 { @@ -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, diff --git a/server/src/game/role/consort.rs b/server/src/game/role/consort.rs index bdbca442e..71bdb3f1b 100644 --- a/server/src/game/role/consort.rs +++ b/server/src/game/role/consort.rs @@ -34,6 +34,7 @@ impl RoleStateImpl for Consort { actor_ref, false, false, + false, ControllerID::role(actor_ref, Role::Consort, 0) ) } diff --git a/server/src/game/role/cop.rs b/server/src/game/role/cop.rs index fe3fb00f0..6dce4e634 100644 --- a/server/src/game/role/cop.rs +++ b/server/src/game/role/cop.rs @@ -97,6 +97,7 @@ impl RoleStateImpl for Cop { game, actor_ref, false, + true, !(game.day_number() > 1), ControllerID::role(actor_ref, Role::Cop, 0) ) diff --git a/server/src/game/role/counterfeiter.rs b/server/src/game/role/counterfeiter.rs index af26d7fd1..d6d4482d1 100644 --- a/server/src/game/role/counterfeiter.rs +++ b/server/src/game/role/counterfeiter.rs @@ -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( diff --git a/server/src/game/role/detective.rs b/server/src/game/role/detective.rs index 70827adc4..842c1e050 100644 --- a/server/src/game/role/detective.rs +++ b/server/src/game/role/detective.rs @@ -42,6 +42,7 @@ impl RoleStateImpl for Detective { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Detective, 0) ) diff --git a/server/src/game/role/doctor.rs b/server/src/game/role/doctor.rs index f3b7ab8cb..0fc022957 100644 --- a/server/src/game/role/doctor.rs +++ b/server/src/game/role/doctor.rs @@ -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) ) diff --git a/server/src/game/role/engineer.rs b/server/src/game/role/engineer.rs index 62f63b035..92197d700 100644 --- a/server/src/game/role/engineer.rs +++ b/server/src/game/role/engineer.rs @@ -147,6 +147,7 @@ impl RoleStateImpl for Engineer { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Engineer, 0) ) diff --git a/server/src/game/role/escort.rs b/server/src/game/role/escort.rs index 70a763e10..2aa69d67c 100644 --- a/server/src/game/role/escort.rs +++ b/server/src/game/role/escort.rs @@ -32,6 +32,7 @@ impl RoleStateImpl for Escort { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Escort, 0) ) diff --git a/server/src/game/role/forger.rs b/server/src/game/role/forger.rs index d18f38ed4..4e3640ecf 100644 --- a/server/src/game/role/forger.rs +++ b/server/src/game/role/forger.rs @@ -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( diff --git a/server/src/game/role/godfather.rs b/server/src/game/role/godfather.rs index fab9fe0a2..1fce522d1 100644 --- a/server/src/game/role/godfather.rs +++ b/server/src/game/role/godfather.rs @@ -28,6 +28,7 @@ impl RoleStateImpl for Godfather { game, actor_ref, false, + false, game.day_number() <= 1, ControllerID::role(actor_ref, Role::Godfather, 0) ) diff --git a/server/src/game/role/gossip.rs b/server/src/game/role/gossip.rs index 1d9a3453d..8726f59a7 100644 --- a/server/src/game/role/gossip.rs +++ b/server/src/game/role/gossip.rs @@ -41,6 +41,7 @@ impl RoleStateImpl for Gossip { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Gossip, 0) ) diff --git a/server/src/game/role/hypnotist.rs b/server/src/game/role/hypnotist.rs index 9c2259a13..7936e0cc9 100644 --- a/server/src/game/role/hypnotist.rs +++ b/server/src/game/role/hypnotist.rs @@ -96,6 +96,7 @@ impl RoleStateImpl for Hypnotist { actor_ref, false, false, + false, ControllerID::role(actor_ref, Role::Hypnotist, 0) ) } diff --git a/server/src/game/role/impostor.rs b/server/src/game/role/impostor.rs index fd5c64493..1506252a7 100644 --- a/server/src/game/role/impostor.rs +++ b/server/src/game/role/impostor.rs @@ -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( diff --git a/server/src/game/role/informant.rs b/server/src/game/role/informant.rs index bec08d216..d1c03e9cb 100644 --- a/server/src/game/role/informant.rs +++ b/server/src/game/role/informant.rs @@ -47,6 +47,7 @@ impl RoleStateImpl for Informant { actor_ref, false, false, + false, ControllerID::role(actor_ref, Role::Informant, 0) ) } diff --git a/server/src/game/role/krampus.rs b/server/src/game/role/krampus.rs index e2010315c..7c5478aa8 100644 --- a/server/src/game/role/krampus.rs +++ b/server/src/game/role/krampus.rs @@ -110,6 +110,7 @@ impl RoleStateImpl for Krampus { actor_ref, false, false, + false, ControllerID::role(actor_ref, Role::Krampus, ability_index) ) } diff --git a/server/src/game/role/lookout.rs b/server/src/game/role/lookout.rs index 5968f5c91..3652aa52a 100644 --- a/server/src/game/role/lookout.rs +++ b/server/src/game/role/lookout.rs @@ -39,6 +39,7 @@ impl RoleStateImpl for Lookout { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Lookout, 0) ) diff --git a/server/src/game/role/mafioso.rs b/server/src/game/role/mafioso.rs index 5c2f55a42..8484bf55e 100644 --- a/server/src/game/role/mafioso.rs +++ b/server/src/game/role/mafioso.rs @@ -35,6 +35,7 @@ impl RoleStateImpl for Mafioso { game, actor_ref, false, + false, game.day_number() <= 1, ControllerID::role(actor_ref, Role::Mafioso, 0) ) diff --git a/server/src/game/role/psychic.rs b/server/src/game/role/psychic.rs index 0046aad9d..08d7c8861 100644 --- a/server/src/game/role/psychic.rs +++ b/server/src/game/role/psychic.rs @@ -40,6 +40,7 @@ impl RoleStateImpl for Psychic { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Psychic, 0) ) diff --git a/server/src/game/role/pyrolisk.rs b/server/src/game/role/pyrolisk.rs index 4b3d22038..44cb655b8 100644 --- a/server/src/game/role/pyrolisk.rs +++ b/server/src/game/role/pyrolisk.rs @@ -64,6 +64,7 @@ impl RoleStateImpl for Pyrolisk { game, actor_ref, false, + true, game.day_number() <= 1 , ControllerID::role(actor_ref, Role::Pyrolisk, 0) ) diff --git a/server/src/game/role/recruiter.rs b/server/src/game/role/recruiter.rs index dc43674c7..e02d400ed 100644 --- a/server/src/game/role/recruiter.rs +++ b/server/src/game/role/recruiter.rs @@ -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( diff --git a/server/src/game/role/scarecrow.rs b/server/src/game/role/scarecrow.rs index 512ab3099..cc4038dad 100644 --- a/server/src/game/role/scarecrow.rs +++ b/server/src/game/role/scarecrow.rs @@ -52,6 +52,7 @@ impl RoleStateImpl for Scarecrow { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Scarecrow, 0) ) diff --git a/server/src/game/role/serial_killer.rs b/server/src/game/role/serial_killer.rs index c62ad86f5..a5b38f53c 100644 --- a/server/src/game/role/serial_killer.rs +++ b/server/src/game/role/serial_killer.rs @@ -42,6 +42,7 @@ impl RoleStateImpl for SerialKiller { game, actor_ref, false, + true, game.day_number() <= 1, ControllerID::role(actor_ref, Role::SerialKiller, 0) ) diff --git a/server/src/game/role/snoop.rs b/server/src/game/role/snoop.rs index 2abbbe774..57bafec6f 100644 --- a/server/src/game/role/snoop.rs +++ b/server/src/game/role/snoop.rs @@ -44,6 +44,7 @@ impl RoleStateImpl for Snoop { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Snoop, 0) ) diff --git a/server/src/game/role/spiral.rs b/server/src/game/role/spiral.rs index e6593fcaa..6ab910113 100644 --- a/server/src/game/role/spiral.rs +++ b/server/src/game/role/spiral.rs @@ -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) ) diff --git a/server/src/game/role/spy.rs b/server/src/game/role/spy.rs index dd4d0a22e..64937d361 100644 --- a/server/src/game/role/spy.rs +++ b/server/src/game/role/spy.rs @@ -75,6 +75,7 @@ impl RoleStateImpl for Spy { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Spy, 0) ) diff --git a/server/src/game/role/tracker.rs b/server/src/game/role/tracker.rs index 237926edd..c5e366c6e 100644 --- a/server/src/game/role/tracker.rs +++ b/server/src/game/role/tracker.rs @@ -41,6 +41,7 @@ impl RoleStateImpl for Tracker { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Tracker, 0) ) diff --git a/server/src/game/role/vigilante.rs b/server/src/game/role/vigilante.rs index 964c21ddf..aabe18c79 100644 --- a/server/src/game/role/vigilante.rs +++ b/server/src/game/role/vigilante.rs @@ -88,6 +88,7 @@ impl RoleStateImpl for Vigilante { game, actor_ref, false, + true, !can_shoot, ControllerID::role(actor_ref, Role::Vigilante, 0) ) diff --git a/server/src/game/role/werewolf.rs b/server/src/game/role/werewolf.rs index 1c22afa5b..7c9c1abe3 100644 --- a/server/src/game/role/werewolf.rs +++ b/server/src/game/role/werewolf.rs @@ -127,6 +127,7 @@ impl RoleStateImpl for Werewolf { game, actor_ref, false, + true, false, ControllerID::role(actor_ref, Role::Werewolf, 0) ) diff --git a/server/src/game/role/yer.rs b/server/src/game/role/yer.rs index be28b1255..c09c489a7 100644 --- a/server/src/game/role/yer.rs +++ b/server/src/game/role/yer.rs @@ -103,6 +103,7 @@ impl RoleStateImpl for Yer { game, actor_ref, false, + true, game.day_number() <= 1, ControllerID::role(actor_ref, Role::Yer, 1) ) diff --git a/server/src/game/role/zealot.rs b/server/src/game/role/zealot.rs index 61bf406df..e10ad7d9d 100644 --- a/server/src/game/role/zealot.rs +++ b/server/src/game/role/zealot.rs @@ -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) )