Skip to content

Commit

Permalink
moved any and pick designation to the proper, grammatical place
Browse files Browse the repository at this point in the history
  • Loading branch information
LtHummus committed Dec 27, 2015
1 parent 34a7168 commit aa05b90
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion SpyPartyDraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def draft_map(message):
chosen_map = [x for x in room.draft.map_pool if x.slug == message['choice']][0]
chosen_map_name = chosen_map.name
if room.draft.state.startswith('PICK') and not chosen_map.slug.endswith('k2'):
chosen_map_name += ' PICK' if message['is_pick'] else ' ANY'
chosen_map_name = chosen_map.map_mode_name(message['is_pick'])

if room.draft.state.startswith('BAN'):
room.post_event("{} has banned {}".format(room.draft.current_player, chosen_map_name))
Expand Down
4 changes: 1 addition & 3 deletions draft/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def mark_map(self, map, is_pick):
self.banned_maps.append(map.name)
self.map_pool.remove(map)
else:
map_name = map.name
if not map.slug.endswith('k2'):
map_name += ' PICK' if is_pick else ' ANY'
map_name = map.map_mode_name(is_pick)
self.picked_maps.append(map_name)
for x in [x for x in self.map_pool if x.family == map.family]:
self.map_pool.remove(x)
Expand Down
11 changes: 9 additions & 2 deletions draft/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ def __init__(self, name, slug, family):
def __repr__(self):
return self.name

def map_mode_name(self, is_pick):
if self.slug.endswith('k2'):
return self.name
parts = self.name.split(' ')
return parts[0] + (' PICK ' if is_pick else ' ANY ') + parts[1]

def as_map(self):
return {
'name': self.name,
Expand All @@ -25,6 +31,7 @@ def generate_map_pool(file_name, tourney):
return [Map(x['name'], x['slug'], x['family']) for x in tourney_json]

if __name__ == '__main__':
data = Map.generate_map_pool('map_pools.json', 'scl_season_1')
print data
m = Map("Balcony 2/3", "balcony23", "balcony")
print m.map_mode_name(False)
print m.map_mode_name(True)

0 comments on commit aa05b90

Please sign in to comment.