random games (also bugfix for same)
This commit is contained in:
parent
dcbc934f86
commit
d6011a69d7
14
games.py
14
games.py
|
@ -235,7 +235,7 @@ class game(object):
|
|||
self.over = False
|
||||
self.random_weather_flag = False
|
||||
self.teams = {"away" : team1, "home" : team2}
|
||||
self.archetypes = {team1.name : team1.archetypes, team2.name : team2.archetypes}
|
||||
|
||||
self.offense_archetypes = {}
|
||||
self.defense_archetypes = {}
|
||||
self.inning = 1
|
||||
|
@ -254,10 +254,14 @@ class game(object):
|
|||
self.voice = None
|
||||
self.current_batter = None
|
||||
|
||||
for this_team in [team1, team2]:
|
||||
for this_player in this_team.lineup + this_team.rotation:
|
||||
if this_player.name in this_team.archetypes.keys():
|
||||
this_team.archetypes[this_player.name].modify_player_stats(this_player)
|
||||
try:
|
||||
self.archetypes = {team1.name : team1.archetypes, team2.name : team2.archetypes}
|
||||
for this_team in [team1, team2]:
|
||||
for this_player in this_team.lineup + this_team.rotation:
|
||||
if this_player.name in this_team.archetypes.keys():
|
||||
this_team.archetypes[this_player.name].modify_player_stats(this_player)
|
||||
except:
|
||||
pass
|
||||
|
||||
def occupied_bases(self):
|
||||
occ_dic = {}
|
||||
|
|
|
@ -178,21 +178,22 @@ async def startgame(interaction, away: str, home: str, innings: Optional[int]=9,
|
|||
|
||||
class StartRandomGameCommand(Command):
|
||||
name = "randomgame"
|
||||
template = "m;randomgame"
|
||||
template = "randomgame"
|
||||
description = "Starts a 9-inning game between 2 entirely random teams. Embrace chaos!"
|
||||
|
||||
async def execute(self, msg, command, flags):
|
||||
if config()["game_freeze"]:
|
||||
raise CommandError("Patch incoming. We're not allowing new games right now.")
|
||||
@client.tree.command()
|
||||
async def randomgame(interaction):
|
||||
if config()["game_freeze"]:
|
||||
raise CommandError("Patch incoming. We're not allowing new games right now.")
|
||||
|
||||
channel = msg.channel
|
||||
await channel.send("Rolling the bones... This might take a while.")
|
||||
teamslist = games.get_all_teams()
|
||||
channel = interaction.channel
|
||||
await interaction.response.send_message("Rolling the bones... This might take a while.")
|
||||
teamslist = games.get_all_teams()
|
||||
|
||||
game = games.game(random.choice(teamslist).finalize(), random.choice(teamslist).finalize())
|
||||
game = games.game(random.choice(teamslist).finalize(), random.choice(teamslist).finalize())
|
||||
|
||||
game_task = asyncio.create_task(watch_game(channel, game, user="the winds of chaos"))
|
||||
await game_task
|
||||
game_task = asyncio.create_task(watch_game(channel, game, user="the winds of chaos"))
|
||||
await game_task
|
||||
|
||||
class SetupGameCommand(Command):
|
||||
name = "setupgame"
|
||||
|
|
Loading…
Reference in a new issue