Fatigue logging

This commit is contained in:
Cal Corum 2025-02-06 15:47:07 -06:00
parent d5f2978b01
commit 8be5e94536

View File

@ -611,17 +611,22 @@ def complete_play(session:Session, this_play: Play):
)).one() )).one()
if outs is None: if outs is None:
outs = 0 outs = 0
logger.info(f'Outs recorded: {outs}')
if new_pitcher.replacing_id is None: if new_pitcher.replacing_id is None:
pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.starter_rating * 3 pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.starter_rating * 3
logger.info(f'Using starter rating, POW outs: {pow_outs}')
else: else:
pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.relief_rating * 3 pow_outs = new_pitcher.card.pitcherscouting.pitchingcard.relief_rating * 3
logger.info(f'Using relief rating, POW outs: {pow_outs}')
if not new_pitcher.is_fatigued: if not new_pitcher.is_fatigued:
logger.info(f'Pitcher is not currently fatigued')
if outs >= pow_outs: if outs >= pow_outs:
logger.info(f'Pitcher is beyond POW - adding fatigue') logger.info(f'Pitcher is beyond POW - adding fatigue')
new_pitcher.is_fatigued = True new_pitcher.is_fatigued = True
elif new_pitcher.replacing_id is None: elif new_pitcher.replacing_id is None:
logger.info(f'Pitcher is not in POW yet')
total_runs = session.exec(select(func.count(Play.id)).where( total_runs = session.exec(select(func.count(Play.id)).where(
Play.game == this_play.game, Play.pitcher == new_pitcher, Play.run == 1 Play.game == this_play.game, Play.pitcher == new_pitcher, Play.run == 1
)).one() )).one()
@ -1604,7 +1609,7 @@ async def check_uncapped_advance(session: Session, interaction: discord.Interact
logger.info(f'Looks like a block the plate check') logger.info(f'Looks like a block the plate check')
await interaction.channel.send(content=None, embeds=block_roll.embeds) await interaction.channel.send(content=None, embeds=block_roll.embeds)
if block_roll.d_twenty > RANGE_CHECKS[c_rating]: if block_roll.d_twenty > RANGE_CHECKS[c_rating.range]:
logger.info(f'Roll of {this_roll.d_twenty} is OUT {AT_BASE[4]}') logger.info(f'Roll of {this_roll.d_twenty} is OUT {AT_BASE[4]}')
runner_thrown_out = True runner_thrown_out = True
q_text = f'Looks like **{lead_runner.player.name}** is OUT {AT_BASE[4]}!' q_text = f'Looks like **{lead_runner.player.name}** is OUT {AT_BASE[4]}!'