Index: bunco.py ================================================================== --- bunco.py +++ bunco.py @@ -19,11 +19,11 @@ self.name = name self.dex = dex self.math_comprehension = math self.roll_speed = speed self.max_streak = 0 - self.bunco_count = 0 + self.round_bunco_counts = [0] self.round_scores = [0] self.round_roll_counts = [0] self.personal_roll_scores = [0] self.turn_progress = 0 self.current_streak = 0 @@ -42,10 +42,11 @@ def prep_new_round(self): self.round_scores.append(0) self.round_roll_counts.append(0) self.personal_roll_scores.append(0) + self.round_bunco_counts.append(0) self.turn_progress = 0 self.current_streak = 0 def score_last_roll(self): desired_num = Game.current_round() % 6 @@ -67,11 +68,11 @@ self.current_streak += 1 self.max_streak = max(self.current_streak, self.max_streak) self.round_scores[Game.current_round() - 1] += roll_score self.personal_roll_scores[Game.current_round() - 1] += roll_score if roll_score == 21: - self.bunco_count += 1 + self.round_bunco_counts[Game.current_round() - 1] += 1 self.rolled_bunco = True else: self.current_streak = 0 log_roll(self, self.current_roll, roll_score) @@ -259,12 +260,27 @@ bunco_rollers = [p for p in self.players if p.rolled_bunco is True] # If multiple people rolled Bunco this tick, and one of them already has the # fuzzy die, they retain it. # Otherwise, the last person in the list gets the fuzzy die. - if bunco_rollers and Player.fuzzydie_holder not in bunco_rollers: - Player.fuzzydie_holder = bunco_rollers[-1] + if bunco_rollers: + if len(bunco_rollers) == 1: + if bunco_rollers[0] is not Player.fuzzydie_holder: + log("all",f"{bunco_rollers[0]} claimed the fuzzy die!") + else: + log("all",f"{bunco_rollers[0]} rolled a Bunco but already has the fuzzy die!") + else: + for luckyduck in bunco_rollers: + if luckyduck is not Player.fuzzydie_holder: + log(luckyduck,f"{luckyduck} attempted to claim the fuzzy die!") + + if Player.fuzzydie_holder not in bunco_rollers: + Player.fuzzydie_holder = bunco_rollers[-1] + log(Player.fuzzydie_holder, f"{Player.fuzzydie_holder} siezed the fuzzy die!!") + else: + log(Player.fuzzydie_holder, f"{Player.fuzzydie_holder} retained the fuzzy die!!") + for player in bunco_rollers: player.rolled_bunco = False # Reset flag self.increment_tick() @@ -286,11 +302,11 @@ def print_status(self): for n, table in enumerate(self.tables): print(f"== TABLE {n+1} == Team 1:{table.team1_score} pts, Team 2:{table.team2_score} pts") for player in table.players: - print(f" {player.name} {player.round_scores[Game.current_round() - 1]} points, streak {player.max_streak} buncos {player.bunco_count}") + print(f" {player.name} {player.round_scores[Game.current_round() - 1]} points, streak {player.max_streak} buncos {sum(player.round_bunco_counts)}") def prep_next_round(self): # losers from head table move to next table headtable_losers = self.tables[0].losers() log_table_move(headtable_losers, "lost", self.tables[0], self.tables[1])