Commit Graph

3 Commits

Author SHA1 Message Date
Cal Corum
b61cad2478 CLAUDE: Refactor dice roll functions to use DiceRoll dataclass
Replaced dictionary return values with a DiceRoll dataclass for better
type safety and cleaner code.

Changes:
- Added DiceRoll dataclass with fields: dice_notation, num_dice, die_sides, rolls, total
- Updated _parse_and_roll_single_dice() to return Optional[DiceRoll]
- Updated _parse_and_roll_multiple_dice() to return list[DiceRoll]
- Updated _roll_weighted_scout_dice() to return list[DiceRoll]
- Updated _create_multi_roll_embed() to accept list[DiceRoll]
- Updated _create_fielding_embed() to accept list[DiceRoll]
- Changed all dict key access (result['total']) to dataclass attributes (result.total)
- Updated logging statements to use dataclass attributes
- Updated all 34 test cases to use DiceRoll dataclass

Benefits:
- Improved type safety with explicit dataclass types
- Better IDE autocomplete and type checking
- More maintainable code with clear data structures
- No runtime changes - all functionality preserved

All 34 dice command tests pass.
2025-10-14 14:28:19 -05:00
Cal Corum
4cab227109 CLAUDE: Implement /scout command with weighted dice rolling
Added weighted dice rolling system for scouting cards based on card type.

Features:
- New /scout command with card_type parameter (batter or pitcher)
- Weighted first d6 roll:
  - Batter: Always rolls 1-3 on first d6
  - Pitcher: Always rolls 4-6 on first d6
- Remaining dice (2d6 and 1d20) roll normally
- Uses same embed formatting as /ab command
- Comprehensive test coverage (4 new tests)

Implementation:
- Added _roll_weighted_scout_dice() helper method
- Reuses existing dice rolling and embed creation logic
- Follows established command patterns with @logged_command decorator

Tests:
- test_weighted_scout_dice_batter - Verifies batter weighting (20 iterations)
- test_weighted_scout_dice_pitcher - Verifies pitcher weighting (20 iterations)
- test_scout_command_batter - Tests batter slash command
- test_scout_command_pitcher - Tests pitcher slash command

All 34 dice command tests pass.
2025-10-14 14:20:31 -05:00
Cal Corum
1dd930e4b3 CLAUDE: Complete dice command system with fielding mechanics
Implements comprehensive dice rolling system for gameplay:

## New Features
- `/roll` and `!roll` commands for XdY dice notation with multiple roll support
- `/ab` and `!atbat` commands for baseball at-bat dice shortcuts (1d6;2d6;1d20)
- `/fielding` and `!f` commands for Super Advanced fielding with full position charts

## Technical Implementation
- Complete dice command package in commands/dice/
- Full range and error charts for all 8 defensive positions (1B,2B,3B,SS,LF,RF,CF,C)
- Pre-populated position choices for user-friendly slash command interface
- Backwards compatibility with prefix commands (!roll, !r, !dice, !ab, !atbat, !f, !fielding, !saf)
- Type-safe implementation following "Raise or Return" pattern

## Testing & Quality
- 30 comprehensive tests with 100% pass rate
- Complete test coverage for all dice functionality, parsing, validation, and error handling
- Integration with bot.py command loading system
- Maintainable data structures replacing verbose original implementation

## User Experience
- Consistent embed formatting across all commands
- Detailed fielding results with range and error analysis
- Support for complex dice combinations and multiple roll formats
- Clear error messages for invalid inputs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 22:30:31 -05:00