Commit Graph

10 Commits

Author SHA1 Message Date
Cal Corum
325f1e8af5 Refactor turn action tracking from booleans to counters for RulesConfig support
Replace hardcoded boolean flags with integer counters to support configurable
per-turn limits from RulesConfig. This enables custom game modes with different
rules (e.g., 2 energy attachments per turn, unlimited items, etc.).

PlayerState changes:
- energy_attached_this_turn -> energy_attachments_this_turn (int)
- supporter_played_this_turn -> supporters_played_this_turn (int)
- stadium_played_this_turn -> stadiums_played_this_turn (int)
- retreated_this_turn -> retreats_this_turn (int)
- Added items_played_this_turn (int)
- Added can_play_stadium() and can_play_item() methods
- Renamed reset_turn_flags() to reset_turn_state()

Ability/CardInstance changes:
- Ability.once_per_turn (bool) -> uses_per_turn (int|None)
- CardInstance.ability_used_this_turn -> ability_uses_this_turn (int)
- Added CardInstance.can_use_ability(ability) method

All methods now properly compare counters against RulesConfig or Ability limits.
270 tests passing.
2026-01-24 23:16:37 -06:00
Cal Corum
725c8ccc5c Add GameState, PlayerState, Zone models and test fixtures
Core game state models:
- Zone: Card collection with deck operations (draw, shuffle, peek, etc.)
- PlayerState: All player zones, score, and per-turn action flags
- GameState: Complete game state with card registry, turn tracking, win conditions

Test fixtures (conftest.py):
- Sample card definitions: Pokemon (Pikachu, Raichu, Charizard, EX, V, VMAX)
- Trainer cards: Item (Potion), Supporter (Professor Oak), Stadium, Tool
- Energy cards: Basic and special energy
- Pre-configured game states: empty, mid-game, near-win scenarios
- Factory fixtures for CardInstance and SeededRandom

Tests: 55 new tests for game state models (259 total passing)

Note: GameState imported directly from game_state module to avoid
circular imports with config module.
2026-01-24 22:55:31 -06:00
Cal Corum
703bed07fb Document offline fork support architecture
Add long-term design consideration for forking the RPG campaign as a
standalone offline experience.

ARCHITECTURE.md:
- Add 'Offline Standalone Fork' section explaining:
  - Why offline support matters (single-player RPG focus)
  - Architecture principles for fork compatibility
  - Core engine independence requirements
  - Potential package structures and distribution options
  - What stays vs what goes in a fork

AGENTS.md:
- Add 'Core Engine Independence' section with:
  - Rules for keeping app/core/ decoupled
  - Import boundary examples (allowed vs forbidden)
  - Link to full architecture docs

This ensures all contributors understand the design constraint:
the game engine must remain completely independent of network,
database, and authentication concerns.
2026-01-24 22:42:47 -06:00
Cal Corum
91ad2cf0a5 Update PROJECT_PLAN.json with completed task statuses
Completed tasks (10/32):
- CRIT-001: Core module structure
- CRIT-002: Enums module (with PokemonStage/PokemonVariant separation)
- CRIT-003: RulesConfig module (10 sub-configs)
- CRIT-004: RandomProvider module (SeededRandom + SecureRandom)
- TEST-001: Enum tests (28 tests)
- TEST-002: Config tests (31 tests)
- TEST-003: RNG tests (42 tests)
- HIGH-001: Card models (CardDefinition, CardInstance, Attack, Ability)
- HIGH-002: Action models (11 action types as discriminated union)
- TEST-004: Card tests (54 tests)
- TEST-005: Action tests (48 tests)

Week 1 complete, Week 2 in progress. 205 tests passing.
2026-01-24 22:37:38 -06:00
Cal Corum
32541af682 Add card/action models with stage/variant separation
- Add CardDefinition and CardInstance models for card templates and in-game state
- Add Attack, Ability, and WeaknessResistance models for Pokemon card components
- Add 11 action types as discriminated union (PlayPokemon, Evolve, Attack, etc.)
- Split PokemonStage (BASIC, STAGE_1, STAGE_2) from PokemonVariant (NORMAL, EX, GX, V, VMAX, VSTAR)
- Stage determines evolution mechanics, variant determines knockout points
- Update PrizeConfig to use variant for knockout point calculation
- VSTAR and VMAX both worth 3 points; EX, GX, V worth 2 points; NORMAL worth 1 point

Tests: 204 passing, all linting clean
2026-01-24 22:35:31 -06:00
Cal Corum
3e82280efb Add game engine foundation: enums, config, and RNG modules
- Create core module structure with models and effects subdirectories
- Add enums module with CardType, EnergyType, TurnPhase, StatusCondition, etc.
- Add RulesConfig with Mantimon TCG defaults (40-card deck, 4 points to win)
- Add RandomProvider protocol with SeededRandom (testing) and SecureRandom (production)
- Include comprehensive tests for all modules (97 tests passing)

Defaults reflect GAME_RULES.md: Pokemon Pocket-style energy deck,
first turn can attack but not attach energy, 30-turn limit enabled.
2026-01-24 22:14:45 -06:00
Cal Corum
2cb99e9676
Update GAME_RULES.md 2026-01-24 20:57:10 -06:00
Cal Corum
46e7420395 Add RPG campaign structure inspired by GBC Pokemon TCG
- Define campaign loop: Clubs → Leaders → Medals → Grand Masters → Champion
- Update PROJECT_PLAN with campaign as core experience, multiplayer as optional
- Add Campaign Structure section to GAME_RULES with clubs, NPCs, rewards
- Reorganize development phases to prioritize campaign mode
- Update CLAUDE.md project overview and uv commands
2026-01-24 18:22:36 -06:00
Cal Corum
234e9a95c1 Add backend foundation with uv, Black, and pre-commit hooks
- Initialize FastAPI backend with uv package manager
- Configure Black, Ruff, pytest, mypy in pyproject.toml
- Add health check endpoint and initial test
- Create AGENTS.md with coding guidelines for AI agents
- Add pre-commit hook to enforce linting and tests
2026-01-24 00:12:33 -06:00
Cal Corum
f473f94bce Initial project setup: documentation and structure
- Add PROJECT_PLAN.md with 7-phase development roadmap
- Add CLAUDE.md with AI agent coding guidelines
- Add docs/ARCHITECTURE.md with technical deep-dive
- Add docs/GAME_RULES.md template for home rule definitions
- Create directory structure for frontend, backend, shared
2026-01-23 23:41:34 -06:00