Skip to content
Permalink
Browse files

added random team sizes option to admin settings

  • Loading branch information...
adangert committed Oct 20, 2019
1 parent 65582d8 commit 24fab2896e0b68f175141b8902870e9e122acf7a
Showing with 36 additions and 17 deletions.
  1. +8 −8 colors.py
  2. +1 −0 common.py
  3. +8 −7 joust.py
  4. +19 −2 piparty.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
"""
"""
@@ -190,4 +190,5 @@ def __str__(self):
'red_on_kill',
'random_teams',
'menu_voice',
'random_team_size',
]
@@ -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:
@@ -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']:

0 comments on commit 24fab28

Please sign in to comment.
You can’t perform that action at this time.