From 24fab2896e0b68f175141b8902870e9e122acf7a Mon Sep 17 00:00:00 2001 From: Aaron Angert Date: Sun, 20 Oct 2019 14:14:03 -0500 Subject: [PATCH] added random team sizes option to admin settings --- colors.py | 16 ++++++++-------- common.py | 1 + joust.py | 15 ++++++++------- piparty.py | 21 +++++++++++++++++++-- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/colors.py b/colors.py index 24e57e90..23d11e41 100644 --- a/colors.py +++ b/colors.py @@ -86,14 +86,14 @@ class Colors(Enum): #pick one color, then pick among the colors not near the first dual_teams = { - Colors.Pink : [Colors.Yellow,Colors.Green,Colors.Turquoise,Colors.Blue], - Colors.Magenta : [Colors.Yellow,Colors.Green,Colors.Turquoise,Colors.Blue], + Colors.Pink : [Colors.Yellow,Colors.Green], + Colors.Magenta : [Colors.Yellow,Colors.Green], Colors.Orange : [Colors.Green,Colors.Turquoise,Colors.Blue,Colors.Purple], Colors.Yellow : [Colors.Turquoise,Colors.Blue,Colors.Purple,Colors.Pink,Colors.Magenta], Colors.Green : [Colors.Purple,Colors.Pink,Colors.Magenta,Colors.Orange], - Colors.Turquoise : [Colors.Purple,Colors.Pink,Colors.Magenta,Colors.Orange,Colors.Yellow], - Colors.Blue : [Colors.Pink,Colors.Magenta,Colors.Orange,Colors.Yellow], - Colors.Purple : [Colors.Orange,Colors.Yellow,Colors.Green,Colors.Turquoise] + Colors.Turquoise : [Colors.Purple,Colors.Orange,Colors.Yellow], + Colors.Blue : [Colors.Orange,Colors.Yellow], + Colors.Purple : [Colors.Orange,Colors.Yellow,Colors.Green] } #remove pairings from dual_teams that don't have a shared third color @@ -104,12 +104,12 @@ class Colors(Enum): Colors.Orange : [Colors.Green,Colors.Turquoise,Colors.Purple], Colors.Yellow : [Colors.Turquoise,Colors.Blue,Colors.Purple,Colors.Pink,Colors.Magenta], Colors.Green : [Colors.Purple,Colors.Orange], - Colors.Turquoise : [Colors.Purple,Colors.Pink,Colors.Magenta,Colors.Orange,Colors.Yellow], + Colors.Turquoise : [Colors.Pink,Colors.Magenta,Colors.Orange,Colors.Yellow], Colors.Blue : [Colors.Pink,Colors.Magenta,Colors.Yellow], - Colors.Purple : [Colors.Orange,Colors.Yellow,Colors.Green,Colors.Turquoise] + Colors.Purple : [Colors.Orange,Colors.Yellow,Colors.Green] } """ quad_teams - generated above, here's how all groups have green and blue, one of orange/yellow, one of pink/magenta/purple -""" \ No newline at end of file +""" diff --git a/common.py b/common.py index 1143a9cb..10a9b64b 100644 --- a/common.py +++ b/common.py @@ -190,4 +190,5 @@ def __str__(self): 'red_on_kill', 'random_teams', 'menu_voice', +'random_team_size', ] diff --git a/joust.py b/joust.py index 30955d07..15131ee4 100644 --- a/joust.py +++ b/joust.py @@ -190,7 +190,7 @@ def track_move(move, game_mode, team, team_color_enum, dead_move, force_color, \ class Joust(): - def __init__(self, moves, command_queue, ns, music, teams, game_mode,controller_teams, controller_colors, dead_moves, force_move_colors,music_speed,werewolf_reveal, show_team_colors, red_on_kill, restart): + def __init__(self, moves, command_queue, ns, music, teams, game_mode,controller_teams, controller_colors, dead_moves, force_move_colors,music_speed,werewolf_reveal, show_team_colors, red_on_kill, restart, num_teams=4): self.command_queue = command_queue self.ns = ns self.voice = self.ns.settings['menu_voice'] @@ -243,12 +243,13 @@ def __init__(self, moves, command_queue, ns, music, teams, game_mode,controller_ if game_mode == common.Games.JoustFFA or game_mode == common.Games.NonStop: self.num_teams = len(moves) if game_mode == common.Games.JoustRandomTeams: - if len(moves) <= 5: - self.num_teams = 2 - elif len(moves) in [6,7]: - self.num_teams = 3 - else: #8 or more - self.num_teams = 4 + self.num_teams=num_teams + #if len(moves) <= 5: + # self.num_teams = 2 + #elif len(moves) in [6,7]: + # self.num_teams = 3 + #else: #8 or more + # self.num_teams = 4 if game_mode == common.Games.Traitor: if len(moves) <= 8: diff --git a/piparty.py b/piparty.py index 27f4a0f8..71c4c29e 100644 --- a/piparty.py +++ b/piparty.py @@ -21,6 +21,7 @@ SENSITIVITY_MODES = 5 +RANDOM_TEAM_SIZES = 6 class Opts(Enum): alive = 0 @@ -643,8 +644,23 @@ def check_admin_controls(self): self.admin_control_option = (self.admin_control_option + 1) % len(self.admin_options) if(self.admin_options[self.admin_control_option] == 'random_team_size'): Audio('audio/Menu/vox/' + self.ns.settings['menu_voice'] + '/adminop_random_team_size.wav').start_effect() + + if admin_opt[Opts.selection.value] == Selections.change_mode_forward.value: + admin_opt[Opts.selection.value] = Selections.nothing.value + if(self.admin_options[self.admin_control_option] == 'random_team_size'): + self.update_setting('random_team_size', (self.ns.settings['random_team_size'] + 1) % (RANDOM_TEAM_SIZES+1)) + if (self.ns.settings['random_team_size'] < 2): + self.update_setting('random_team_size', 2) + Audio('audio/Menu/vox/{}/adminop_{}.wav'.format(self.ns.settings['menu_voice'],self.ns.settings['random_team_size'])).start_effect() + + if admin_opt[Opts.selection.value] == Selections.change_mode_backward.value: + admin_opt[Opts.selection.value] = Selections.nothing.value + if(self.admin_options[self.admin_control_option] == 'random_team_size'): + self.update_setting('random_team_size', (self.ns.settings['random_team_size'] - 1)) + if (self.ns.settings['random_team_size'] < 2): + self.update_setting('random_team_size', RANDOM_TEAM_SIZES) + Audio('audio/Menu/vox/{}/adminop_{}.wav'.format(self.ns.settings['menu_voice'],self.ns.settings['random_team_size'])).start_effect() - #to play instructions or not if admin_opt[Opts.selection.value] == Selections.change_instructions.value: admin_opt[Opts.selection.value] = Selections.nothing.value @@ -722,6 +738,7 @@ def initialize_settings(self): 'red_on_kill': True, 'random_teams': True, 'color_lock': False, + 'random_team_size': 4, 'color_lock_choices':{ 2: ['Magenta','Green'], 3: ['Orange','Turquoise','Purple'], @@ -956,7 +973,7 @@ def start_game(self, random_mode=False): game.run_loop() else: #may need to put in moves that have selected to not be in the game - joust.Joust(game_moves, self.command_queue, self.ns, self.joust_music, self.teams, self.game_mode, self.controller_teams, self.controller_colors, self.dead_moves, self.force_color,self.music_speed,self.werewolf_reveal, self.show_team_colors, self.red_on_kill, self.restart) + joust.Joust(game_moves, self.command_queue, self.ns, self.joust_music, self.teams, self.game_mode, self.controller_teams, self.controller_colors, self.dead_moves, self.force_color,self.music_speed,self.werewolf_reveal, self.show_team_colors, self.red_on_kill, self.restart,self.ns.settings['random_team_size']) if random_mode: self.game_mode = common.Games.Random if self.ns.settings['play_instructions']: