Merge pull request #212 from Sakimori/indev

Indev
This commit is contained in:
Sakimori 2021-02-28 13:19:08 -05:00 committed by GitHub
commit 96bd8f5d71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 12 deletions

View file

@ -161,6 +161,20 @@ accepting pull requests, check the issues for to-dos.
- m;roman [number] - m;roman [number]
- converts any natural number less than 4,000,000 into roman numerals, this one is just for fun. - converts any natural number less than 4,000,000 into roman numerals, this one is just for fun.
## weathers
- all current simsim weathers are listed here with a short description of their effects except for the most recent weathers whose effects remain a mystery.
- supernova 🌟: makes all pitchers pitch worse.
- midnight 🕶: significantly increased the chance that players will attempt to steal a base.
- heavy snow ❄: occasionally causes the team's pitcher to bat in place of the scheduled batter.
- slight tailwind 🏌️‍♀: occasionally batters get a mulligan and start the at bat over if they would have gotten out, significantly more likely to happen for weaker batters.
- thinned veil 🌌: when a player hits a dinger, they end up on the base corresponding to the number of runs the dinger scored, 1st base if it's a solo home run, up to none base if it's a grand slam, resulting in 5 runs scoring.
- twilight 👻: occasionally turns outs into hit by causing the ball to go ethereal, preventing the fielder from catching it.
- drizzle 🌧: causes each inning to start with the previous inning's final batter on second base.
- heat wave 🌄: occasionally causes pitchers to be relieved by a random player from the lineup.
- breezy 🎐: occasionally swaps letters of a player's name, altering their name for the remainder of the game and changing their stats.
- starlight 🌃: current patch weather, effects will be revealed the next time weathers are added.
- meteor shower 🌠: current patch weather, effects will be revealed the next time weathers are added.
## patreon! ## patreon!
these folks are helping me a *ton* via patreon, and i cannot possibly thank them enough: these folks are helping me a *ton* via patreon, and i cannot possibly thank them enough:
@ -173,6 +187,7 @@ these folks are helping me a *ton* via patreon, and i cannot possibly thank them
- iliana etaoin - iliana etaoin
- yooori - yooori
- Bend - Bend
- ALC
## Attribution ## Attribution

View file

@ -225,6 +225,13 @@ class game(object):
self.weather = weather.Weather(self) self.weather = weather.Weather(self)
self.current_batter = None self.current_batter = None
def occupied_bases(self):
occ_dic = {}
for base in self.bases.keys():
if self.bases[base] is not None:
occ_dic[base] = self.bases[base]
return occ_dic
def choose_next_batter(self): def choose_next_batter(self):
if self.top_of_inning: if self.top_of_inning:
bat_team = self.teams["away"] bat_team = self.teams["away"]

View file

@ -919,7 +919,7 @@ class LeagueLeadersCommand(Command):
class LeagueDivisionDisplayCommand(Command): class LeagueDivisionDisplayCommand(Command):
name = "divisionstandings" name = "divisionstandings"
template = "m;divisionstandings [league name]\n[team name]" template = "m;divisionstandings [league name]\n[division name]"
description = "Displays the current standings for the given division in the given league." description = "Displays the current standings for the given division in the given league."
async def execute(self, msg, command): async def execute(self, msg, command):
@ -1251,15 +1251,15 @@ class OBLLeaderboardCommand(Command):
async def execute(self, msg, command): async def execute(self, msg, command):
leaders_list = db.obl_leaderboards()[:15] leaders_list = db.obl_leaderboards()[:15]
leaders = {} leaders = []
rank = 1 rank = 1
for team, points in leaders_list: for team, points in leaders_list:
leaders[team] = {"rank" : rank, "points" : points} leaders.append({"name" : team, "points" : points})
rank += 1 rank += 1
embed = discord.Embed(color=discord.Color.red(), title="The One Big League") embed = discord.Embed(color=discord.Color.red(), title="The One Big League")
for team in leaders.keys(): for index in range(0, len(leaders)):
embed.add_field(name=f"{leaders[team]['rank']}. {team}", value=f"{leaders[team]['points']} points" , inline = False) embed.add_field(name=f"{index+1}. {leaders[index]['name']}", value=f"{leaders[index]['points']} points" , inline = False)
await msg.channel.send(embed=embed) await msg.channel.send(embed=embed)
class OBLTeamCommand(Command): class OBLTeamCommand(Command):

View file

@ -60,12 +60,6 @@ class SlightTailwind(Weather):
self.emoji = "🏌️‍♀️" self.emoji = "🏌️‍♀️"
def activate(self, game, result): def activate(self, game, result):
if game.top_of_inning:
offense_team = game.teams["away"]
defense_team = game.teams["home"]
else:
offense_team = game.teams["home"]
defense_team = game.teams["away"]
if "mulligan" not in game.last_update[0].keys() and not result["ishit"] and result["text"] != appearance_outcomes.walk: if "mulligan" not in game.last_update[0].keys() and not result["ishit"] and result["text"] != appearance_outcomes.walk:
mulligan_roll_target = -((((game.get_batter().stlats["batting_stars"])-5)/6)**2)+1 mulligan_roll_target = -((((game.get_batter().stlats["batting_stars"])-5)/6)**2)+1
@ -78,6 +72,37 @@ class SlightTailwind(Weather):
"weather_message": True, "weather_message": True,
}) })
class Starlight(Weather):
def __init__(self, game):
self.name = "Starlight"
self.emoji = "🌃"
def activate(self, game, result):
if (result["text"] == appearance_outcomes.homerun or result["text"] == appearance_outcomes.grandslam):
result["weather_message"] = True
dinger_roll = random.random()
if "dragon" in game.get_batter().name.lower():
result["dragin_the_park"] = True
elif dinger_roll < 0.941:
result.clear()
result.update({
"text": f"{game.get_batter()} hits a dinger, but the stars do not approve! The ball pulls foul.",
"text_only": True
})
else:
result["in_the_park"] = True
def modify_atbat_message(self, game, state):
result = game.last_update[0]
if "in_the_park" in result.keys():
state["update_text"] = f"The stars are pleased with {result['batter']}, and allow a dinger! {game.last_update[1]} runs scored!"
elif "dragin_the_park" in result.keys():
state["update_text"] = f"The stars enjoy watching dragons play baseball, and allow {result['batter']} to hit a dinger! {game.last_update[1]} runs scored!"
class HeavySnow(Weather): class HeavySnow(Weather):
def __init__(self, game): def __init__(self, game):
self.name = "Heavy Snow" self.name = "Heavy Snow"
@ -268,6 +293,33 @@ class Breezy(Weather):
"weather_message": True "weather_message": True
}) })
class MeteorShower(Weather):
def __init__(self, game):
self.name = "Meteor Shower"
self.emoji = "🌠"
self.activation_chance = 0.13
def activate(self, game, result):
if random.random() < self.activation_chance and game.occupied_bases() != {}:
base, runner = random.choice(list(game.occupied_bases().items()))
runner = game.bases[base]
game.bases[base] = None
if game.top_of_inning:
bat_team = game.teams["away"]
else:
bat_team = game.teams["home"]
bat_team.score += 1
result.clear()
result.update({
"text": f"{runner.name} wished upon one of the shooting stars, and was warped to None base!! 1 runs score!",
"text_only": True,
"weather_message": True
})
def all_weathers(): def all_weathers():
weathers_dic = { weathers_dic = {
"Supernova" : Supernova, "Supernova" : Supernova,
@ -278,7 +330,9 @@ def all_weathers():
"Thinned Veil" : ThinnedVeil, "Thinned Veil" : ThinnedVeil,
"Heat Wave" : HeatWave, "Heat Wave" : HeatWave,
"Drizzle" : Drizzle, "Drizzle" : Drizzle,
"Breezy": Breezy "Breezy": Breezy,
"Starlight" : Starlight,
"Meteor Shower" : MeteorShower
} }
return weathers_dic return weathers_dic