commit
96bd8f5d71
15
README.md
15
README.md
|
@ -161,6 +161,20 @@ accepting pull requests, check the issues for to-dos.
|
|||
- m;roman [number]
|
||||
- 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!
|
||||
|
||||
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
|
||||
- yooori
|
||||
- Bend
|
||||
- ALC
|
||||
|
||||
## Attribution
|
||||
|
||||
|
|
7
games.py
7
games.py
|
@ -225,6 +225,13 @@ class game(object):
|
|||
self.weather = weather.Weather(self)
|
||||
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):
|
||||
if self.top_of_inning:
|
||||
bat_team = self.teams["away"]
|
||||
|
|
|
@ -919,7 +919,7 @@ class LeagueLeadersCommand(Command):
|
|||
|
||||
class LeagueDivisionDisplayCommand(Command):
|
||||
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."
|
||||
|
||||
async def execute(self, msg, command):
|
||||
|
@ -1251,15 +1251,15 @@ class OBLLeaderboardCommand(Command):
|
|||
|
||||
async def execute(self, msg, command):
|
||||
leaders_list = db.obl_leaderboards()[:15]
|
||||
leaders = {}
|
||||
leaders = []
|
||||
rank = 1
|
||||
for team, points in leaders_list:
|
||||
leaders[team] = {"rank" : rank, "points" : points}
|
||||
leaders.append({"name" : team, "points" : points})
|
||||
rank += 1
|
||||
|
||||
embed = discord.Embed(color=discord.Color.red(), title="The One Big League")
|
||||
for team in leaders.keys():
|
||||
embed.add_field(name=f"{leaders[team]['rank']}. {team}", value=f"{leaders[team]['points']} points" , inline = False)
|
||||
for index in range(0, len(leaders)):
|
||||
embed.add_field(name=f"{index+1}. {leaders[index]['name']}", value=f"{leaders[index]['points']} points" , inline = False)
|
||||
await msg.channel.send(embed=embed)
|
||||
|
||||
class OBLTeamCommand(Command):
|
||||
|
|
68
weather.py
68
weather.py
|
@ -60,12 +60,6 @@ class SlightTailwind(Weather):
|
|||
self.emoji = "🏌️♀️"
|
||||
|
||||
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:
|
||||
mulligan_roll_target = -((((game.get_batter().stlats["batting_stars"])-5)/6)**2)+1
|
||||
|
@ -78,6 +72,37 @@ class SlightTailwind(Weather):
|
|||
"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):
|
||||
def __init__(self, game):
|
||||
self.name = "Heavy Snow"
|
||||
|
@ -268,6 +293,33 @@ class Breezy(Weather):
|
|||
"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():
|
||||
weathers_dic = {
|
||||
"Supernova" : Supernova,
|
||||
|
@ -278,7 +330,9 @@ def all_weathers():
|
|||
"Thinned Veil" : ThinnedVeil,
|
||||
"Heat Wave" : HeatWave,
|
||||
"Drizzle" : Drizzle,
|
||||
"Breezy": Breezy
|
||||
"Breezy": Breezy,
|
||||
"Starlight" : Starlight,
|
||||
"Meteor Shower" : MeteorShower
|
||||
}
|
||||
return weathers_dic
|
||||
|
||||
|
|
Loading…
Reference in a new issue