fixed bug with saveteam errors, double play not always advancing runners, and emoji deletion on pagination

This commit is contained in:
Sakimori 2020-12-27 14:23:17 -05:00
parent ad99c4e4ab
commit 3750fd439a
2 changed files with 7 additions and 4 deletions

View File

@ -264,7 +264,7 @@ class game(object):
self.bases[3] = None self.bases[3] = None
if self.bases[2] is not None: if self.bases[2] is not None:
run_roll = random.gauss(2*math.erf((random_star_gen("baserunning_stars", self.bases[2])-def_stat)/4)-1,3) run_roll = random.gauss(2*math.erf((random_star_gen("baserunning_stars", self.bases[2])-def_stat)/4)-1,3)
if run_roll > 1.5: if run_roll > 1.5 or outcome["text"] == appearance_outcomes.doubleplay: #double play gives them time to run, guaranteed
self.bases[3] = self.bases[2] self.bases[3] = self.bases[2]
self.bases[2] = None self.bases[2] = None
if self.bases[1] is not None: #double plays set this to None before this call if self.bases[1] is not None: #double plays set this to None before this call
@ -421,7 +421,10 @@ class game(object):
self.get_batter().game_stats["plate_appearances"] += 1 self.get_batter().game_stats["plate_appearances"] += 1
offense_team.score += scores_to_add if self.outs < 3:
offense_team.score += scores_to_add #only add points if inning isn't over
else:
scores_to_add = 0
self.get_batter().game_stats["rbis"] += scores_to_add self.get_batter().game_stats["rbis"] += scores_to_add
self.get_pitcher().game_stats["runs_allowed"] += scores_to_add self.get_pitcher().game_stats["runs_allowed"] += scores_to_add
offense_team.lineup_position += 1 #put next batter up offense_team.lineup_position += 1 #put next batter up

View File

@ -658,11 +658,11 @@ async def save_team_batch(message, command):
for rosternum in range(2,len(roster)-1): for rosternum in range(2,len(roster)-1):
if roster[rosternum] != "": if roster[rosternum] != "":
if len(roster[rosternum]) > 70: if len(roster[rosternum]) > 70:
await channel.send(f"{roster[rosternum]} is too long, chief. 70 or less.") await message.channel.send(f"{roster[rosternum]} is too long, chief. 70 or less.")
return return
newteam.add_lineup(games.player(ono.get_stats(roster[rosternum].rstrip()))) newteam.add_lineup(games.player(ono.get_stats(roster[rosternum].rstrip())))
if len(roster[len(roster)-1]) > 70: if len(roster[len(roster)-1]) > 70:
await channel.send(f"{roster[len(roster)-1]} is too long, chief. 70 or less.") await message.channel.send(f"{roster[len(roster)-1]} is too long, chief. 70 or less.")
return return
newteam.set_pitcher(games.player(ono.get_stats(roster[len(roster)-1].rstrip()))) #last line is pitcher name newteam.set_pitcher(games.player(ono.get_stats(roster[len(roster)-1].rstrip()))) #last line is pitcher name