Skip to content

Set up domain foundation for batching strategy#11

Merged
CoderMariusz merged 2 commits intomainfrom
claude/domain-foundation-batching-01UKe9AaD8Yfj1nRAotbemTE
Nov 23, 2025
Merged

Set up domain foundation for batching strategy#11
CoderMariusz merged 2 commits intomainfrom
claude/domain-foundation-batching-01UKe9AaD8Yfj1nRAotbemTE

Conversation

@CoderMariusz
Copy link
Copy Markdown
Owner

No description provided.

Complete implementation of city-building game domain layer with comprehensive test coverage.

## BATCH 0: Foundation (3 SP) ✅
- Building entity with production & upgrade mechanics
- Time-based resource accumulation
- Level scaling (+20% production, +50% costs per level)

## BATCH 1: Domain Foundation (3 SP) ✅
- Resource entity (gold, wood, stone, food)
- PlayerEconomy entity for resource management
- Resource validation and inventory operations

## BATCH 2: Domain Use Cases (10 SP) ✅
- CollectResources use case (single + batch operations)
- UpgradeBuilding use case (with preview & validation)
- Complete error handling with custom exceptions

## Files Added

### Domain Entities (3 files)
- lib/features/city_builder/domain/entities/building.dart
- lib/features/city_builder/domain/entities/resource.dart
- lib/features/city_builder/domain/entities/player_economy.dart

### Use Cases (2 files)
- lib/features/city_builder/domain/usecases/collect_resources.dart
- lib/features/city_builder/domain/usecases/upgrade_building.dart

### Tests (5 files, 78 tests total)
- test/features/city_builder/domain/entities/building_test.dart (23 tests)
- test/features/city_builder/domain/entities/resource_test.dart (6 tests)
- test/features/city_builder/domain/entities/player_economy_test.dart (14 tests)
- test/features/city_builder/domain/usecases/collect_resources_test.dart (25 tests)
- test/features/city_builder/domain/usecases/upgrade_building_test.dart (20 tests)

### Documentation
- lib/features/city_builder/README.md

## Key Features

### Building Entity
- Production rates (resources per hour)
- Upgrade cost calculation
- Time-based resource accumulation
- Level progression mechanics

### Resource Management
- Multiple resource types (gold, wood, stone, food)
- Max storage limits
- Add/subtract operations with validation
- Total wealth calculation

### Use Cases
- Collect resources from buildings (single + batch)
- Upgrade buildings with cost validation
- Preview upgrades before executing
- Comprehensive error handling

## Technical Details
- Clean Architecture (domain layer only)
- Immutable entities (Freezed pattern)
- Result type for error handling
- Batch operations for performance
- 78 unit tests with full coverage

## Next Steps
- BATCH 3: Flame Grid & Camera (13 SP)
- BATCH 4: Presentation & Integration (8 SP)

Story Points: 16 SP (3 + 3 + 10)
Test Coverage: 78 unit tests
@CoderMariusz CoderMariusz merged commit 003eb42 into main Nov 23, 2025
6 of 15 checks passed
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