|
|
@@ -138,7 +138,23 @@ class Highlighter(object): |
|
|
|
if self.iterations >= self.max: |
|
|
|
# Choosing time |
|
|
|
self.lastchoice = -1 |
|
|
|
TEAMS[-1].choose() |
|
|
|
# # ** Name-specific choices! ** # # |
|
|
|
for tsub in SUBS: |
|
|
|
if tsub.team == "": |
|
|
|
choosing_sub = tsub |
|
|
|
break |
|
|
|
for j in range(len(TEAMS)): |
|
|
|
if "amy" not in choosing_sub.sub: |
|
|
|
if TEAMS[j].team.lower( |
|
|
|
).startswith(choosing_sub.sub[0].lower()): |
|
|
|
TEAMS[j].choose() |
|
|
|
break |
|
|
|
else: |
|
|
|
if TEAMS[j].team.lower().startswith("a"): |
|
|
|
TEAMS[j].choose() |
|
|
|
break |
|
|
|
# # End Name-specific stuff # # |
|
|
|
# TEAMS[-1].choose() |
|
|
|
pygame.time.set_timer(HIGHLIGHTEVENT, 0) # Disable highlight |
|
|
|
pygame.time.set_timer(CHOOSEEVENT, 5000, True) # make choice |
|
|
|
self.iterations = 0 |
|
|
@@ -152,21 +168,27 @@ def draw_text(text, font, text_col, x, y): |
|
|
|
screen.blit(img, (x, y)) |
|
|
|
|
|
|
|
|
|
|
|
def setup_team_board(): |
|
|
|
def setup_team_board(randomise_teams=False): |
|
|
|
"""Grab teams from text file and set their positions""" |
|
|
|
teamlist = [] |
|
|
|
|
|
|
|
with open(TEAMSFILE, "r") as fh: |
|
|
|
for row in range(TEAMNUMROWS): |
|
|
|
for col in range(TEAMNUMCOLS): |
|
|
|
name = fh.readline().strip() |
|
|
|
if name == "": |
|
|
|
continue |
|
|
|
if "donkey" in name: |
|
|
|
name = name.split(' ', 1)[1] |
|
|
|
print("Adding {} at {},{}".format(name, |
|
|
|
TEAMCOLS[col], |
|
|
|
TEAMROWS[row])) |
|
|
|
TEAMS.append(Team(name, |
|
|
|
TEAMROWS[row], TEAMCOLS[col])) |
|
|
|
teams = fh.readlines() |
|
|
|
teamlist = [team.rstrip() for team in teams if team != ""] |
|
|
|
|
|
|
|
if randomise_teams: |
|
|
|
random.shuffle(teamlist) |
|
|
|
|
|
|
|
for row in range(TEAMNUMROWS): |
|
|
|
for col in range(TEAMNUMCOLS): |
|
|
|
if len(teamlist) == 0: |
|
|
|
continue |
|
|
|
name = teamlist.pop(0) |
|
|
|
print("Adding {} at {},{}".format(name, |
|
|
|
TEAMCOLS[col], |
|
|
|
TEAMROWS[row])) |
|
|
|
TEAMS.append(Team(name, |
|
|
|
TEAMROWS[row], TEAMCOLS[col])) |
|
|
|
|
|
|
|
|
|
|
|
def setup_subs(): |
|
|
@@ -184,7 +206,7 @@ for line in open(SUBSFILE, "r"): |
|
|
|
print(SUBS) |
|
|
|
|
|
|
|
random.shuffle(SUBS) |
|
|
|
setup_team_board() |
|
|
|
setup_team_board(randomise_teams=True) |
|
|
|
random.shuffle(TEAMS) |
|
|
|
setup_subs() |
|
|
|
|
|
|
@@ -223,7 +245,13 @@ while True: |
|
|
|
elif event.type == CHOOSEEVENT: |
|
|
|
for sub in SUBS: |
|
|
|
if sub.team == "": |
|
|
|
sub.team = TEAMS.pop().team |
|
|
|
# # Name-specific again # # |
|
|
|
for k in range(len(TEAMS)): |
|
|
|
if TEAMS[k].colour == RED: |
|
|
|
sub.team = TEAMS.pop(k).team |
|
|
|
break |
|
|
|
# # End name-specific # # |
|
|
|
# sub.team = TEAMS.pop().team |
|
|
|
pygame.time.set_timer(CLEAREVENT, 100, True) |
|
|
|
break |
|
|
|
|
|
|
|