Skip to content

Implement Move Kill Tracking in Pokémon Battle Simulator#5

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/vscode1760933403358
Draft

Implement Move Kill Tracking in Pokémon Battle Simulator#5
Copilot wants to merge 3 commits intomainfrom
copilot/vscode1760933403358

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 20, 2025

This PR implements a comprehensive move kill tracking system that attributes knockouts to specific moves used in battle, providing more detailed battle statistics.

Problem

Previously, the battle simulator only tracked total knockouts per Pokémon without recording which specific moves achieved those knockouts. This made it difficult to analyze which moves were most effective in securing KOs during battles.

Solution

Implemented a move kill tracking system with proper move classification to ensure only direct attacking moves receive credit for knockouts:

Key Changes

1. Enhanced PokemonData tracking (pokemon_tracker.py)

  • Added move_kills dictionary to track kills per move for each Pokémon
  • Implemented track_move_kill() method to increment move-specific kill counts
  • Updated battle summary to include move kill statistics

2. Intelligent move classification (battle_simulator.py)

  • Created comprehensive NON_ATTACK_MOVES set containing 70+ moves across categories:
    • Status moves (Toxic, Thunder Wave, Will-O-Wisp, etc.)
    • Entry hazards (Stealth Rock, Spikes, Toxic Spikes)
    • Field effects (Trick Room, Rain Dance, Reflect, etc.)
    • Stat boosting moves (Swords Dance, Nasty Plot, etc.)
    • Recovery moves (Recover, Roost, Rest, etc.)
  • Implemented _is_attack_move() to distinguish direct attacks from support moves
  • Updated _handle_faint() to attribute kills only to attacking moves

3. Enhanced CLI output (cli.py)

  • Added "Move Kills:" section to Pokémon stats display
  • Shows individual moves with kill counts (e.g., "Flamethrower: 2 KOs")
  • Only displays moves that have at least one knockout
  • Proper singular/plural formatting (KO vs KOs)

Edge Cases Handled

  • ✅ Status condition kills (poison, burn) are not attributed
  • ✅ Entry hazard kills (Stealth Rock) are not attributed
  • ✅ Pivot moves correctly classified (U-turn deals damage = attack; Teleport = not attack)
  • ✅ Multiple kills with same move tracked correctly
  • ✅ Multiple kills with different moves tracked separately

Example Output

Charizard (Charizard) - Level 100
----------------------------------------
  Ability: Solar Power
  Moves: Flamethrower, Air Slash, Solar Beam, Roost
  Move Kills:
    Flamethrower: 2 KOs
    Air Slash: 1 KO
  Stats:
    K/D Ratio: 3.00 (3/1)
    Damage Dealt: 245
    Damage Taken: 178

Testing

Added comprehensive test suite (tests/test_move_kills.py) with 6 new test cases:

  • Attack move classification validation
  • Direct attack kill tracking
  • Status/hazard kill filtering
  • Multiple kills per move
  • Multiple moves with kills

All 17 tests pass (11 existing + 6 new)

Original prompt

Implement Move Kill Tracking in Pokémon Battle Simulator

Feature Overview

Implement a system to track and display which moves are getting kills (knockouts) in Pokémon battles. This should track kills per move for each Pokémon individually and only count direct attacking moves (not status moves, hazards, or indirect damage).

Requirements

  1. Move Kill Tracking

    • Each Pokémon should track kills for each of its moves separately
    • Only count kills from direct attacking moves
    • Ignore kills from status effects, entry hazards, or weather damage
    • Track the kills in the move_kills dictionary that already exists in PokemonData
  2. Move Classification

    • Implement proper move type classification in _is_attack_move
    • Maintain a comprehensive list of non-attacking moves to filter out
    • Categories to filter: status moves, entry hazards, field effects, boosting moves, recovery moves
  3. Kill Attribution

    • When a Pokémon faints, properly attribute the kill to the last attacking move used
    • Handle edge cases like switching and multiple damage sources
  4. Display

    • Show move kills in the battle summary for each Pokémon
    • Only display moves that have at least 1 kill
    • Format as "Move Name: X KO(s)" under each Pokémon's stats

Files to Modify

  1. pokemon_tracker.py:

    • Fix the track_move_kill method to properly increment move kills
    • Ensure move kills are included in the summary
  2. battle_simulator.py:

    • Implement proper move classification in _is_attack_move
    • Update _handle_faint to correctly attribute kills
    • Add debug logging for move kill tracking
  3. cli.py:

    • Update the text output formatting for move kills
    • Ensure proper indentation and clear display

Testing

  • Test with different battle scenarios
  • Verify kills are only counted for actual attacking moves
  • Check edge cases like status move deaths
  • Validate the display format

Example Output Format

Charizard (Charizard) - Level 100
----------------------------------------
  Ability: Solar Power
  Moves: Flamethrower, Air Slash, Solar Beam, Roost
  Move Kills:
    Flamethrower: 2 KO(s)
    Air Slash: 1 KO(s)
  Stats:
    K/D Ratio: 3.00 (3/1)
    Damage Dealt: 245
    Damage Taken: 178

Implementation Notes

  • Use existing debug infrastructure to track move execution and faints
  • Maintain a list of non-attacking moves for proper filtering
  • Consider battle mechanics like switching and multiple damage sources
  • Ensure thread safety and proper state management

Created from VS Code via the GitHub Pull Request extension.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: frxyoz <59369019+frxyoz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add move kill tracking system in Pokémon Battle Simulator Implement Move Kill Tracking in Pokémon Battle Simulator Oct 20, 2025
Copilot AI requested a review from frxyoz October 20, 2025 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants