From 92c7f4769266a519b432e36ce648cd5b4b45d504 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 9 Mar 2025 13:21:08 -0500 Subject: [PATCH] Advance trail runner when thrown at and safe --- command_logic/logic_gameplay.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/command_logic/logic_gameplay.py b/command_logic/logic_gameplay.py index fc2f911..ee3b593 100644 --- a/command_logic/logic_gameplay.py +++ b/command_logic/logic_gameplay.py @@ -1844,6 +1844,17 @@ async def check_uncapped_advance(session: Session, interaction: discord.Interact this_play.on_first_final = None else: this_play.batter_final = None + else: + logger.info(f'Runner is safe') + if this_play.on_first == trail_runner: + this_play.on_first_final += 1 + if this_play.on_first_final == 4: + logger.info(f'Add an rbi') + this_play.rbi += 1 + elif this_play.batter == trail_runner: + this_play.batter_final += 1 + else: + log_exception(LineupsMissingException, f'Could not find trail runner to advance') # Advance lead runner extra base logger.info(f'advancing lead runner') @@ -2016,6 +2027,17 @@ async def check_uncapped_advance(session: Session, interaction: discord.Interact this_play.on_first_final = None else: this_play.batter_final = None + else: + logger.info(f'Runner is safe') + if this_play.on_first == trail_runner: + this_play.on_first_final += 1 + if this_play.on_first_final == 4: + this_play.rbi += 1 + elif this_play.batter == trail_runner: + this_play.batter_final += 1 + else: + log_exception(LineupsMissingException, f'Could not find trail runner to advance') + # Advance lead runner extra base logger.info(f'Advance lead runner extra base')