From 9a22860ad89ec9218e52232a16ec4cbbf75b68ee Mon Sep 17 00:00:00 2001 From: Sakimori Date: Wed, 3 Feb 2021 04:24:11 -0500 Subject: [PATCH] implemented drizzle --- games.py | 10 +++++++++- main_controller.py | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/games.py b/games.py index 24c2e26..02ec27e 100644 --- a/games.py +++ b/games.py @@ -35,7 +35,9 @@ def all_weathers(): #"Slight Tailwind": weather("Slight Tailwind", "🏌️‍♀️"), "Heavy Snow": weather("Heavy Snow", "❄"), "Twilight" : weather("Twilight", "👻"), - "Thinned Veil" : weather("Thinned Veil", "🌌") + "Thinned Veil" : weather("Thinned Veil", "🌌"), + "Heat Wave" : weather("Heat Wave", "🌄"), + "Drizzle" : weather("Drizzle", "🌧") } return weathers_dic @@ -655,6 +657,12 @@ class game(object): self.over = True self.top_of_inning = not self.top_of_inning + if self.weather.name == "Drizzle": + if self.top_of_inning: + self.bases[2] = self.teams["away"].lineup[(self.teams["away"].lineup_position-1) % len(self.teams["away"].lineup)] + else: + self.bases[2] = self.teams["home"].lineup[(self.teams["home"].lineup_position-1) % len(self.teams["home"].lineup)] + def pitcher_insert(self, this_team): rounds = math.ceil(this_team.lineup_position / len(this_team.lineup)) position = random.randint(0, len(this_team.lineup)-1) diff --git a/main_controller.py b/main_controller.py index f76911e..2dc824d 100644 --- a/main_controller.py +++ b/main_controller.py @@ -172,11 +172,17 @@ def update_loop(): state["batter"] = "-" elif this_game.top_of_inning: state["update_text"] = f"Top of {this_game.inning}. {this_game.teams['away'].name} batting!" + if this_game.weather.name == "Drizzle": + state["update_emoji"] = "🌧" + state["update_text"] += f' Due to inclement weather, {this_game.teams["away"].lineup[(this_game.teams["away"].lineup_position-1) % len(this_game.teams["away"].lineup)].name} is placed on second base.' else: if this_game.inning >= this_game.max_innings: if this_game.teams["home"].score > this_game.teams["away"].score: this_game.victory_lap = True state["update_text"] = f"Bottom of {this_game.inning}. {this_game.teams['home'].name} batting!" + if this_game.weather.name == "Drizzle": + state["update_emoji"] = "🌧" + state["update_text"] += f' Due to inclement weather, {this_game.teams["home"].lineup[(this_game.teams["home"].lineup_position-1) % len(this_game.teams["home"].lineup)].name} is placed on second base.' elif state["update_pause"] != 1 and test_string != "Game not started.": if "steals" in this_game.last_update[0].keys():