implemented downpour

This commit is contained in:
Sakimori 2021-03-03 17:32:35 -05:00
parent 317ef782a2
commit a1c3bf4108
2 changed files with 24 additions and 1 deletions

View file

@ -147,6 +147,8 @@ def update_loop():
state["display_top_of_inning"] = state["top_of_inning"] state["display_top_of_inning"] = state["top_of_inning"]
this_game.weather.modify_gamestate(this_game, state)
if state["start_delay"] <= 0: if state["start_delay"] <= 0:
if this_game.top_of_inning != state["top_of_inning"]: if this_game.top_of_inning != state["top_of_inning"]:
state["update_pause"] = 2 state["update_pause"] = 2

View file

@ -37,6 +37,9 @@ class Weather:
def modify_atbat_message(self, game, state): def modify_atbat_message(self, game, state):
pass pass
def modify_gamestate(self, game, state):
pass
class Supernova(Weather): class Supernova(Weather):
def __init__(self, game): 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(): def all_weathers():
weathers_dic = { weathers_dic = {
"Supernova" : Supernova, "Supernova" : Supernova,
@ -384,7 +404,8 @@ def all_weathers():
"Starlight" : Starlight, "Starlight" : Starlight,
"Meteor Shower" : MeteorShower, "Meteor Shower" : MeteorShower,
"Hurricane" : Hurricane, "Hurricane" : Hurricane,
"Tornado" : Tornado "Tornado" : Tornado,
"Torrential Downpour" : Downpour
} }
return weathers_dic return weathers_dic