Update gauntlets.py
Added randomized Mario round in draft
This commit is contained in:
parent
7daee29dca
commit
a83bc10581
73
gauntlets.py
73
gauntlets.py
@ -1,6 +1,7 @@
|
||||
import copy
|
||||
import datetime
|
||||
import logging
|
||||
import random
|
||||
|
||||
import discord
|
||||
import requests
|
||||
@ -136,7 +137,7 @@ async def run_draft(interaction: discord.Interaction, main_team, this_event, dra
|
||||
embed_title = f'{main_team["lname"]} - {this_event["name"]} Draft'
|
||||
embed_description = f'{this_event["name"]}'
|
||||
base_params = ai_manager.MAJOR_CARDSET_PARAMS
|
||||
base_params.append(('limit', 8))
|
||||
base_params.extend([('limit', 8), ('cardset_id', 8)])
|
||||
else:
|
||||
logging.error(f'run_draft - Event ID {this_event["id"]} not recognized')
|
||||
raise KeyError(f'Draft data not found for Gauntlet {this_event["id"]}')
|
||||
@ -183,6 +184,25 @@ async def run_draft(interaction: discord.Interaction, main_team, this_event, dra
|
||||
round_num = 1
|
||||
counter = 0
|
||||
|
||||
view = helpers.Confirm([interaction.user])
|
||||
view.confirm.label = 'Let\'s Go!'
|
||||
|
||||
intro_embed = get_embed(this_event=this_event)
|
||||
intro_embed.title += ' - Are you ready?'
|
||||
|
||||
await interaction.edit_original_response(
|
||||
content=None,
|
||||
embed=intro_embed,
|
||||
view=view
|
||||
)
|
||||
|
||||
await view.wait()
|
||||
|
||||
if not view.value:
|
||||
await interaction.edit_original_response(content=None, embed=intro_embed, view=None)
|
||||
await interaction.channel.send('You\'ll be back')
|
||||
return
|
||||
|
||||
def get_embeds(include_links=True):
|
||||
top_embed = helpers.get_team_embed(f'{embed_title} - Round {round_num}')
|
||||
top_embed.description = f'Rarity Counts'
|
||||
@ -246,6 +266,7 @@ async def run_draft(interaction: discord.Interaction, main_team, this_event, dra
|
||||
)
|
||||
|
||||
if this_event['id'] == 1:
|
||||
mario_round = None
|
||||
while round_num <= 26 and counter < 50:
|
||||
counter += 1
|
||||
# Set params based on current round
|
||||
@ -267,17 +288,32 @@ async def run_draft(interaction: discord.Interaction, main_team, this_event, dra
|
||||
('min_rarity', RARITY['Reserve']), ('max_rarity', RARITY['Reserve'])
|
||||
])
|
||||
elif round_num == 10:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['MVP']), ('max_rarity', RARITY['MVP']), ('pos_exc', 'RP')
|
||||
])
|
||||
if random.randint(1, 2) == 1:
|
||||
params = [
|
||||
('min_rarity', RARITY['MVP']), ('max_rarity', RARITY['MVP']), ('cardset_id', 8)
|
||||
]
|
||||
else:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['MVP']), ('max_rarity', RARITY['MVP']), ('pos_exc', 'RP')
|
||||
])
|
||||
elif round_num == 11:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['All-Star']), ('max_rarity', RARITY['All-Star'])
|
||||
])
|
||||
if random.randint(1, 2) == 1 and mario_round is None:
|
||||
params = [
|
||||
('min_rarity', RARITY['All-Star']), ('max_rarity', RARITY['All-Star']), ('cardset_id', 8)
|
||||
]
|
||||
else:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['All-Star']), ('max_rarity', RARITY['All-Star'])
|
||||
])
|
||||
elif round_num == 12:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['Starter']), ('max_rarity', RARITY['Starter'])
|
||||
])
|
||||
if mario_round is None:
|
||||
params = [
|
||||
('min_rarity', RARITY['Starter']), ('max_rarity', RARITY['Starter']), ('cardset_id', 8)
|
||||
]
|
||||
else:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['Starter']), ('max_rarity', RARITY['Starter'])
|
||||
])
|
||||
elif round_num <= 15:
|
||||
params.extend([
|
||||
('min_rarity', RARITY['Replacement']), ('max_rarity', RARITY['Replacement'])
|
||||
@ -476,17 +512,20 @@ async def post_result(run_id: int, is_win: bool, this_team, bot, ctx):
|
||||
f'**{this_event["name"]} Gauntlet** with a record of {this_run["wins"]}-'
|
||||
f'{this_run["losses"]}!'
|
||||
)
|
||||
final_message = f'That\'s number 10! Way to go - you have completed the **{this_event["name"]} Gauntlet** ' \
|
||||
f'with a record of {this_run["wins"]}-{this_run["losses"]}!'
|
||||
else:
|
||||
final_message = f'Big win there! Your {this_event["name"]} record is now **{this_run["wins"]}-' \
|
||||
f'{this_run["losses"]}**. '
|
||||
if len(reward_string) > 0:
|
||||
final_message += f"You earned the following rewards:\n{reward_string}"
|
||||
final_message += f'\n\nGo share the highlights in {get_channel(ctx, "pd-news-ticker").mention}!'
|
||||
|
||||
await ctx.send(
|
||||
content=final_message,
|
||||
embed=get_embed(this_run)
|
||||
)
|
||||
if len(reward_string) > 0:
|
||||
final_message += f"You earned the following rewards:\n{reward_string}"
|
||||
final_message += f'\n\nGo share the highlights in {get_channel(ctx, "pd-news-ticker").mention}!'
|
||||
|
||||
await ctx.send(
|
||||
content=final_message,
|
||||
embed=get_embed(this_run)
|
||||
)
|
||||
else:
|
||||
this_run = db_patch(
|
||||
'gauntletruns',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user