implemented thinned veil and twilight weathers
This commit is contained in:
parent
22115ee2c3
commit
ae256de645
25
games.py
25
games.py
|
@ -31,13 +31,14 @@ def config():
|
||||||
def all_weathers():
|
def all_weathers():
|
||||||
weathers_dic = {
|
weathers_dic = {
|
||||||
#"Supernova" : weather("Supernova", "🌟"),
|
#"Supernova" : weather("Supernova", "🌟"),
|
||||||
"Midnight": weather("Midnight", "🕶"),
|
#"Midnight": weather("Midnight", "🕶"),
|
||||||
"Slight Tailwind": weather("Slight Tailwind", "🏌️♀️"),
|
"Slight Tailwind": weather("Slight Tailwind", "🏌️♀️"),
|
||||||
"Heavy Snow": weather("Heavy Snow", "❄")
|
"Heavy Snow": weather("Heavy Snow", "❄"),
|
||||||
|
"Twilight" : weather("Twilight", "🌃"),
|
||||||
|
"Thinned Veil" : weather("Thinned Veil", "🌌")
|
||||||
}
|
}
|
||||||
return weathers_dic
|
return weathers_dic
|
||||||
|
|
||||||
|
|
||||||
class appearance_outcomes(Enum):
|
class appearance_outcomes(Enum):
|
||||||
strikeoutlooking = "strikes out looking."
|
strikeoutlooking = "strikes out looking."
|
||||||
strikeoutswinging = "strikes out swinging."
|
strikeoutswinging = "strikes out swinging."
|
||||||
|
@ -269,6 +270,13 @@ class game(object):
|
||||||
pb_system_stat = (random.gauss(1*math.erf((bat_stat - pitch_stat)*1.5)-1.8,2.2))
|
pb_system_stat = (random.gauss(1*math.erf((bat_stat - pitch_stat)*1.5)-1.8,2.2))
|
||||||
hitnum = random.gauss(2*math.erf(bat_stat/4)-1,3)
|
hitnum = random.gauss(2*math.erf(bat_stat/4)-1,3)
|
||||||
|
|
||||||
|
if weather.name == "Twilight":
|
||||||
|
error_line = - (math.log(defender.stlats["defense_stars"] + 1)/50) + 1
|
||||||
|
error_roll = random.random()
|
||||||
|
if error_roll > error_line:
|
||||||
|
outcome["error"] == True
|
||||||
|
outcome["defender"] = defender
|
||||||
|
pb_system_stat = 0.1
|
||||||
|
|
||||||
|
|
||||||
if pb_system_stat <= 0:
|
if pb_system_stat <= 0:
|
||||||
|
@ -313,7 +321,7 @@ class game(object):
|
||||||
outcome["ishit"] = True
|
outcome["ishit"] = True
|
||||||
if hitnum < 1:
|
if hitnum < 1:
|
||||||
outcome["text"] = appearance_outcomes.single
|
outcome["text"] = appearance_outcomes.single
|
||||||
elif hitnum < 2.85:
|
elif hitnum < 2.85 or "error" in outcome.keys():
|
||||||
outcome["text"] = appearance_outcomes.double
|
outcome["text"] = appearance_outcomes.double
|
||||||
elif hitnum < 3.1:
|
elif hitnum < 3.1:
|
||||||
outcome["text"] = appearance_outcomes.triple
|
outcome["text"] = appearance_outcomes.triple
|
||||||
|
@ -384,6 +392,11 @@ class game(object):
|
||||||
if base is not None:
|
if base is not None:
|
||||||
runs += 1
|
runs += 1
|
||||||
self.bases = {1 : None, 2 : None, 3 : None}
|
self.bases = {1 : None, 2 : None, 3 : None}
|
||||||
|
if "veil" in outcome.keys():
|
||||||
|
if runs < 4:
|
||||||
|
self.bases[runs] = self.get_batter()
|
||||||
|
else:
|
||||||
|
runs += 1
|
||||||
return runs
|
return runs
|
||||||
|
|
||||||
elif "advance" in outcome.keys():
|
elif "advance" in outcome.keys():
|
||||||
|
@ -535,6 +548,10 @@ class game(object):
|
||||||
elif result["text"] == appearance_outcomes.homerun or result["text"] == appearance_outcomes.grandslam:
|
elif result["text"] == appearance_outcomes.homerun or result["text"] == appearance_outcomes.grandslam:
|
||||||
self.get_batter().game_stats["total_bases"] += 4
|
self.get_batter().game_stats["total_bases"] += 4
|
||||||
self.get_batter().game_stats["home_runs"] += 1
|
self.get_batter().game_stats["home_runs"] += 1
|
||||||
|
if self.weather.name == "Thinned Veil":
|
||||||
|
result["veil"] = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
scores_to_add += self.baserunner_check(defender, result)
|
scores_to_add += self.baserunner_check(defender, result)
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,8 @@ def update_loop():
|
||||||
if this_game.last_update[0]["defender"] != "":
|
if this_game.last_update[0]["defender"] != "":
|
||||||
punc = ". "
|
punc = ". "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if "fc_out" in this_game.last_update[0].keys():
|
if "fc_out" in this_game.last_update[0].keys():
|
||||||
name, base_string = this_game.last_update[0]['fc_out']
|
name, base_string = this_game.last_update[0]['fc_out']
|
||||||
updatestring = f"{this_game.last_update[0]['batter']} {this_game.last_update[0]['text'].value.format(name, base_string)} {this_game.last_update[0]['defender']}{punc}"
|
updatestring = f"{this_game.last_update[0]['batter']} {this_game.last_update[0]['text'].value.format(name, base_string)} {this_game.last_update[0]['defender']}{punc}"
|
||||||
|
@ -121,6 +123,13 @@ def update_loop():
|
||||||
state["update_emoji"] = "🏏"
|
state["update_emoji"] = "🏏"
|
||||||
state["update_text"] = updatestring
|
state["update_text"] = updatestring
|
||||||
|
|
||||||
|
if "veil" in this_game.last_update[0].keys():
|
||||||
|
state["update_emoji"] = "🌌"
|
||||||
|
state["update_text"] += " {this_game.last_update[0]['batter']}'s will manifests on {games.base_string(this_game.last_update[1])} base!"
|
||||||
|
elif "error" in this_game.last_update[0].keys():
|
||||||
|
state["update_emoji"] = "🌃"
|
||||||
|
state["update_text"] = f"{this_game.last_update[0]['defender']} lost sight of the ball! {this_game.last_update[0]['batter']} reaches {games.base_string(this_game.last_update[1])} on the error."
|
||||||
|
|
||||||
state["bases"] = this_game.named_bases()
|
state["bases"] = this_game.named_bases()
|
||||||
|
|
||||||
state["top_of_inning"] = this_game.top_of_inning
|
state["top_of_inning"] = this_game.top_of_inning
|
||||||
|
|
|
@ -1134,6 +1134,7 @@ async def tourney_round_watcher(channel, tourney, games_list, filter_url, finals
|
||||||
wins_in_series[winner_name] = 1
|
wins_in_series[winner_name] = 1
|
||||||
|
|
||||||
final_embed = game_over_embed(game)
|
final_embed = game_over_embed(game)
|
||||||
|
final_embed.add_field(name="Series score:", value=f"{wins_in_series[game.teams['away'].name]} - {wins_in_series[game.teams['home'].name]}")
|
||||||
await channel.send(f"A {tourney.name} game just ended!")
|
await channel.send(f"A {tourney.name} game just ended!")
|
||||||
await channel.send(embed=final_embed)
|
await channel.send(embed=final_embed)
|
||||||
if wins_in_series[winner_name] >= int((tourney.series_length+1)/2) and not finals:
|
if wins_in_series[winner_name] >= int((tourney.series_length+1)/2) and not finals:
|
||||||
|
@ -1502,6 +1503,7 @@ async def league_day_watcher(channel, league, games_list, filter_url, autoplay,
|
||||||
league.update_standings({winner_name : winner_dic, loser_name : loser_dic})
|
league.update_standings({winner_name : winner_dic, loser_name : loser_dic})
|
||||||
leagues.save_league(league)
|
leagues.save_league(league)
|
||||||
final_embed = game_over_embed(game)
|
final_embed = game_over_embed(game)
|
||||||
|
final_embed.add_field(name="Series score:", value=f"{series_results[game.teams['away'].name]['wins']} - {series_results[game.teams['home'].name]['wins']}")
|
||||||
await channel.send(f"A {league.name} game just ended!")
|
await channel.send(f"A {league.name} game just ended!")
|
||||||
await channel.send(embed=final_embed)
|
await channel.send(embed=final_embed)
|
||||||
if series_results[winner_name]["wins"] + series_results[winner_name]["losses"] < league.series_length:
|
if series_results[winner_name]["wins"] + series_results[winner_name]["losses"] < league.series_length:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user