Runner on 3rd, gb checks updated

This commit is contained in:
Cal Corum 2025-02-03 13:46:58 -06:00
parent 3b6bcfb186
commit 9700a9abd6

View File

@ -3397,9 +3397,29 @@ async def groundballs(session: Session, interaction: discord.Interaction, this_p
logger.info(f'Groundball {groundball_letter} with runner on third') logger.info(f'Groundball {groundball_letter} with runner on third')
def_alignment = this_play.managerai.defense_alignment(session, this_play.game) def_alignment = this_play.managerai.defense_alignment(session, this_play.game)
if this_play.game.ai_team is not None and this_play.pitcher.team.is_ai and def_alignment.infield_in: if this_play.game.ai_team is not None and this_play.pitcher.team.is_ai:
logger.info(f'AI on defense, hit to MIF, playing in') if def_alignment.infield_in:
this_play = gb_result_7(session, this_play) logger.info(f'AI on defense, playing in')
if groundball_letter == 'a':
this_play = gb_result_7(session, this_play)
else:
this_play = gb_result_1(session, this_play)
else:
logger.info(f'AI on defense, playing back')
to_mif = await ask_confirm(
interaction,
question=f'Was that ball hit to either 2B or SS?',
label_type='yes'
)
if to_mif or not def_alignment.corners_in:
logger.info(f'playing back, gb 5')
this_play = gb_result_5(session, this_play, to_mif)
else:
logger.info(f'corners in, gb 7')
this_play = gb_result_7(session, this_play)
else: else:
logger.info(f'Checking if hit to MIF') logger.info(f'Checking if hit to MIF')
@ -3409,23 +3429,53 @@ async def groundballs(session: Session, interaction: discord.Interaction, this_p
label_type='yes' label_type='yes'
) )
if not to_mif: if to_mif:
logger.info(f'Not to a MIF, gb 7') playing_in = await ask_confirm(
this_play = gb_result_7(session, this_play)
else:
logger.info(f'AI batting, hit to MIF')
mif_playing_in = await ask_confirm(
interaction, interaction,
question=f'Were they playing in?', question=f'Were they playing in?',
label_type='yes', label_type='yes',
) )
if mif_playing_in:
logger.info(f'playing in, gb 7') if playing_in:
this_play = gb_result_7(session, this_play) logger.info(f'To MIF, batter out, runners hold')
this_play = gb_result_1(session, this_play)
else: else:
logger.info(f'playing back, gb 5') logger.info(f'To MIF, playing back, gb 3')
this_play = gb_result_5(session, this_play, to_mif) this_play = gb_result_3(session, this_play)
else:
logger.info(f'Batter out, runners hold')
this_play = gb_result_1(session, this_play)
elif this_play.on_base_code in [4, 5, 7] and groundball_letter == 'a':
logger.info(f'Groundball {groundball_letter} with runners on including third')
if this_play.ai_team is not None and this_play.pitcher.team.is_ai:
def_alignment = this_play.managerai.defense_alignment(session, this_play.game)
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)
else:
logger.info(f'playing back, gb 2')
this_play = gb_result_2(session, this_play)
else:
playing_in = await ask_confirm(
interaction,
question='Was the defender playing in?',
label_type='yes'
)
if playing_in:
logger.info(f'playing in, gb 7')
this_play = gb_result_7(session, this_play)
else:
logger.info(f'playing back, gb 2')
this_play = gb_result_2(session, this_play)
else: else:
this_play = await gb_letter(session, interaction, this_play, groundball_letter.upper(), 'None', False) this_play = await gb_letter(session, interaction, this_play, groundball_letter.upper(), 'None', False)