diff --git a/main_controller.py b/main_controller.py index b666684..f7c335a 100644 --- a/main_controller.py +++ b/main_controller.py @@ -147,6 +147,8 @@ def update_loop(): state["display_top_of_inning"] = state["top_of_inning"] + this_game.weather.modify_gamestate(this_game, state) + if state["start_delay"] <= 0: if this_game.top_of_inning != state["top_of_inning"]: state["update_pause"] = 2 diff --git a/weather.py b/weather.py index 858cf90..d2fca67 100644 --- a/weather.py +++ b/weather.py @@ -37,6 +37,9 @@ class Weather: def modify_atbat_message(self, game, state): pass + def modify_gamestate(self, game, state): + pass + class Supernova(Weather): def __init__(self, game): @@ -370,6 +373,23 @@ class Tornado(Weather): +class Downpour(Weather): + def __init__(self, game): + self.name = "Torrential Downpour" + self.emoji = '⛈' + self.target = game.max_innings + + def on_flip_inning(self, game): + high_score = game.teams["home"].score if game.teams["home"].score > game.teams["away"].score else game.teams["away"].score + if high_score >= self.target and game.teams["home"].score != game.teams["away"].score: + game.max_innings = 0 + else: + game.max_innings = game.inning + 1 + + def modify_gamestate(self, game, state): + state["max_innings"] = "∞" + + def all_weathers(): weathers_dic = { "Supernova" : Supernova, @@ -384,7 +404,8 @@ def all_weathers(): "Starlight" : Starlight, "Meteor Shower" : MeteorShower, "Hurricane" : Hurricane, - "Tornado" : Tornado + "Tornado" : Tornado, + "Torrential Downpour" : Downpour } return weathers_dic