New weather effects added I really hope this is working

This commit is contained in:
Kevin Rode 2021-01-03 20:49:51 -05:00
parent 57e7847f5a
commit 3ca24b313a

View File

@ -28,9 +28,21 @@ def all_weathers():
#generate default config
super_weather_json = jsonpickle.encode(weather("Supernova", "🌟"))
mid_weather_json = jsonpickle.encode(weather("Midnight", "🕶"))
crow_weather_json = jsonpickle.encode(weather("Crowstorm", ""))
slime_weather_json = jsonpickle.encode(weather("Slime", "🟢"))
peanut_weather_json = jsonpickle.encode(weather("Peanado", "🥜"))
thickair_weather_json = jsonpickle.encode(weather("Thick Air", "🌫️"))
molasses_weather_json = jsonpickle.encode(weather("Molasses", "🧇"))
coke_weather_json = jsonpickle.encode(weather("Coke Raine", "🥤"))
config_dic = {
"Supernova" : super_weather_json,
"Midnight": mid_weather_json
"Midnight" : mid_weather_json,
"Crowstorm" : crow_weather_json,
"Slime" : slime_weather_json,
"Peanado" : peanut_weather_json,
"Thick Air" : thickair_weather_json,
"Molasses" : molasses_weather_json,
"Coke Raine" : coke_weather_json
}
with open("weather_config.json", "w") as config_file:
json.dump(config_dic, config_file, indent=4)
@ -185,6 +197,8 @@ class game(object):
bat_stat = random_star_gen("batting_stars", batter)
pitch_stat = random_star_gen("pitching_stars", pitcher)
if weather.name == "Supernova":
pitch_stat = pitch_stat / 0.9
elif weather.name == "Thick Air":
pitch_stat = pitch_stat * 0.9
pb_system_stat = (random.gauss(1*math.erf((bat_stat - pitch_stat)*1.5)-1.8,2.2))
@ -223,6 +237,10 @@ class game(object):
if self.outs < 2 and len(runners) > 1: #fielder's choice replaces not great groundouts if any forceouts are present
def_stat = random_star_gen("defense_stars", defender)
if self.weather.name == "Coke Raine":
def_stat = def_stat / 0.9
elif self.weather.name == "Molasses":
def_stat = def_stat * 0.9
if -1.5 <= hitnum and hitnum < -0.5: #poorly hit groundouts
outcome["text"] = appearance_outcomes.fielderschoice
outcome["defender"] = ""
@ -256,6 +274,8 @@ class game(object):
run_stars = random_star_gen("baserunning_stars", baserunner)*config()["stolen_base_chance_mod"]
if self.weather.name == "Midnight":
run_stars = run_stars*2
elif self.weather.name == "Slime":
run_stars = run_stars*.75
def_stars = random_star_gen("defense_stars", self.get_pitcher())
if run_stars >= (def_stars - 1.5): #if baserunner isn't worse than pitcher
roll = random.random()