Show charts on SPD checks
Fix gb chart with OBC 5, 7 Add 1998 to player command
This commit is contained in:
parent
479a335373
commit
50895fef90
@ -1409,7 +1409,7 @@ class Gameplay(commands.Cog):
|
||||
logger.info(f'log xcheck - this_play: {this_play}')
|
||||
this_play = await xchecks(session, interaction, this_play, position.value)
|
||||
|
||||
await self.complete_and_post_play(session, interaction, this_play)
|
||||
await self.complete_and_post_play(session, interaction, this_play, buffer_message='X-Check logged')
|
||||
|
||||
|
||||
@group_log.command(name='undo-play', description='Roll back most recent play from the log')
|
||||
|
||||
@ -445,10 +445,7 @@ class Players(commands.Cog):
|
||||
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
|
||||
async def player_slash_command(
|
||||
self, interaction: discord.Interaction, player_name: str,
|
||||
cardset: Literal['All', '2024 Season', '2024 Promos', '2023 Season', '2023 Promos', '2022 Season',
|
||||
'2022 Promos', '2021 Season', '2019 Season', '2018 Season', '2018 Promos', '2016 Season', '2013 Season',
|
||||
'2012 Season', '2008 Season', 'Backyard Baseball', 'Mario Super Sluggers', 'Sams Choice'] = 'All'):
|
||||
# min_rarity: Literal['Replacement', 'Reserve', 'Starter', 'All-Star', 'MVP'] = None):
|
||||
cardset: Literal['All', '1998 Live', '1998 Promos', '2024 Season', '2024 Promos', '2023 Season', '2023 Promos', '2022 Season', '2022 Promos', '2021 Season', '2019 Season', '2018 Season', '2018 Promos', '2016 Season', '2013 Season', '2012 Season', '2008 Season', 'Backyard Baseball', 'Mario Super Sluggers', 'Sams Choice'] = 'All'):
|
||||
ephemeral = False
|
||||
if interaction.channel.name in ['paper-dynasty-chat', 'pd-news-ticker']:
|
||||
ephemeral = True
|
||||
|
||||
@ -658,7 +658,7 @@ def complete_play(session:Session, this_play: Play):
|
||||
logger.info(f'checking for runners in POW')
|
||||
runners_in_pow = session.exec(select(func.count(Play.id)).where(
|
||||
Play.game == this_play.game, Play.pitcher == new_pitcher, Play.in_pow == True, Play.batter_final != None
|
||||
)).one()
|
||||
)).one() # change to hits and walks
|
||||
logger.info(f'runners in pow: {runners_in_pow}')
|
||||
if runners_in_pow >= 3:
|
||||
new_pitcher.is_fatigued = True
|
||||
@ -2506,7 +2506,7 @@ async def xchecks(session: Session, interaction: discord.Interaction, this_play:
|
||||
error_result = this_roll.error_result
|
||||
is_rare_play = this_roll.is_chaos
|
||||
|
||||
logger.info(f'X-Check in Game #{this_play.game_id} at {this_play.check_pos} for {this_play.defender.card.player.name_with_desc} of the {this_play.pitcher.team.sname} / hit_result: {hit_result} / error_result: {error_result} / is_correct: {is_correct}')
|
||||
logger.info(f'X-Check in Game #{this_play.game_id} at {this_play.check_pos} for {this_play.defender.card.player.name_with_desc} of the {this_play.pitcher.team.sname} / hit_result: {hit_result} / error_result: {error_result} / is_rare_play: {is_rare_play} / is_correct: {is_correct}')
|
||||
|
||||
if not is_correct:
|
||||
logger.error(f'{interaction.user.name} says the result was wrong.')
|
||||
@ -2580,17 +2580,52 @@ async def xchecks(session: Session, interaction: discord.Interaction, this_play:
|
||||
hit_result = new_hit_result
|
||||
error_result = new_error_result
|
||||
|
||||
logger.info(f'hit_result == "SPD" ({hit_result == 'SPD'}) and not is_rare_play ({not is_rare_play})')
|
||||
if hit_result == 'SPD' and not is_rare_play:
|
||||
is_out = ask_confirm(
|
||||
interaction,
|
||||
f'Is {this_play.batter.player.name} thrown out at first?',
|
||||
custom_confirm_label='Out at first',
|
||||
custom_cancel_label='Safe at first'
|
||||
logger.info(f'Non-rare play SPD check')
|
||||
|
||||
runner_speed = this_play.batter.card.batterscouting.battingcard.running
|
||||
speed_embed = this_play.batter.team.embed
|
||||
speed_embed.title = f'Catcher X-Check - Speed Check'
|
||||
speed_embed.description = f'{this_play.batter.player.name} Speed Check'
|
||||
speed_embed.add_field(
|
||||
name=f'Runner Speed',
|
||||
value=f'{runner_speed}'
|
||||
)
|
||||
if is_out:
|
||||
hit_result = 'G3'
|
||||
speed_embed.add_field(name="", value="", inline=False)
|
||||
speed_embed.add_field(name='Safe Range', value=f'1 - {runner_speed}')
|
||||
speed_embed.add_field(name='Out Range', value=f'{runner_speed + 1} - 20')
|
||||
|
||||
this_roll = d_twenty_roll(this_play.batter.team, this_play.game)
|
||||
if this_roll.d_twenty <= runner_speed:
|
||||
result = 'SAFE'
|
||||
else:
|
||||
this_play = await singles(session, interaction, this_play, '*')
|
||||
result = 'OUT'
|
||||
logger.info(f'SPD check roll: {this_roll.d_twenty} / runner_speed: {runner_speed} / result: {result}')
|
||||
|
||||
await interaction.channel.send(
|
||||
content=None,
|
||||
embeds=[speed_embed, *this_roll.embeds]
|
||||
)
|
||||
|
||||
is_correct = await ask_confirm(
|
||||
interaction,
|
||||
f'Looks like **{this_play.batter.player.name}** is {result} at first! Is that correct?',
|
||||
label_type='yes'
|
||||
)
|
||||
if is_correct:
|
||||
logger.info(f'Result is correct')
|
||||
if result == 'OUT':
|
||||
hit_result = 'G3'
|
||||
else:
|
||||
hit_result = 'SI1'
|
||||
else:
|
||||
logger.info(f'Result is NOT correct')
|
||||
if result == 'OUT':
|
||||
hit_result = 'SI1'
|
||||
else:
|
||||
hit_result = 'G3'
|
||||
logger.info(f'Final SPD check result: {hit_result}')
|
||||
|
||||
if '#' in hit_result:
|
||||
logger.info(f'Checking if the # result becomes a hit')
|
||||
@ -3510,8 +3545,32 @@ async def groundballs(session: Session, interaction: discord.Interaction, this_p
|
||||
logger.info(f'def_alignment: {def_alignment}')
|
||||
|
||||
if def_alignment.infield_in:
|
||||
logger.info(f'playing in, gb 7')
|
||||
this_play = gb_result_7(session, this_play)
|
||||
if this_play.on_base_code == 5:
|
||||
logger.info(f'playing in, gb 7')
|
||||
this_play = gb_result_7(session, this_play)
|
||||
|
||||
else:
|
||||
logger.info(f'playing in, gb 10')
|
||||
this_play = gb_result_10(session, this_play)
|
||||
|
||||
elif def_alignment.corners_in:
|
||||
logger.info(f'Checking if ball was hit to 1B/3B')
|
||||
to_cif = await ask_confirm(
|
||||
interaction,
|
||||
f'Was that ball hit to 1B/3B?',
|
||||
label_type='yes'
|
||||
)
|
||||
if to_cif:
|
||||
if this_play.on_base_code == 5:
|
||||
logger.info(f'Corners in, gb 7')
|
||||
this_play = gb_result_7(session, this_play)
|
||||
|
||||
else:
|
||||
logger.info(f'Corners in, gb 10')
|
||||
this_play = gb_result_10(session, this_play)
|
||||
else:
|
||||
logger.info(f'Corners back, gb 2')
|
||||
this_play = gb_result_2(session, this_play)
|
||||
|
||||
else:
|
||||
logger.info(f'playing back, gb 2')
|
||||
@ -3524,10 +3583,14 @@ async def groundballs(session: Session, interaction: discord.Interaction, this_p
|
||||
label_type='yes'
|
||||
)
|
||||
|
||||
if playing_in:
|
||||
if playing_in and this_play.on_base_code == 5:
|
||||
logger.info(f'playing in, gb 7')
|
||||
this_play = gb_result_7(session, this_play)
|
||||
|
||||
elif playing_in:
|
||||
logger.info(f'playing in, gb 10')
|
||||
this_play = gb_result_10(session, this_play)
|
||||
|
||||
else:
|
||||
logger.info(f'playing back, gb 2')
|
||||
this_play = gb_result_2(session, this_play)
|
||||
|
||||
@ -301,7 +301,6 @@ SELECT_CARDSET_OPTIONS = [
|
||||
]
|
||||
ACTIVE_EVENT_LITERAL = Literal['1998 Season', 'Brilliant Stars']
|
||||
DEFENSE_LITERAL = Literal['Pitcher', 'Catcher', 'First Base', 'Second Base', 'Third Base', 'Shortstop', 'Left Field', 'Center Field', 'Right Field']
|
||||
ACTIVE_EVENT_LITERAL = Literal['1998 Season', 'Brilliant Stars']
|
||||
COLORS = {
|
||||
'sba': int('a6ce39', 16),
|
||||
'yellow': int('FFEA00', 16),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user