import '../../core/config/app_constants.dart'; import '../entities/pokemon.dart'; /// Phase courante de la partie. enum GameStatus { loading, playing, roundWon, gameOver, error } /// Résultat d'une soumission de réponse. enum GuessResult { correct, wrong, gameOver, invalid } /// État immuable d'une partie. class GameState { final Pokemon? currentPokemon; final int lives; final int skips; final int hints; final int sessionCorrectCount; final int currentScore; final int bestScore; final bool isShiny; final bool isHintUsed; final GameStatus status; const GameState({ this.currentPokemon, this.lives = AppConstants.startingLives, this.skips = AppConstants.startingSkips, this.hints = AppConstants.startingHints, this.sessionCorrectCount = 0, this.currentScore = 0, this.bestScore = 0, this.isShiny = false, this.isHintUsed = false, this.status = GameStatus.loading, }); GameState copyWith({ Pokemon? currentPokemon, int? lives, int? skips, int? hints, int? sessionCorrectCount, int? currentScore, int? bestScore, bool? isShiny, bool? isHintUsed, GameStatus? status, }) { return GameState( currentPokemon: currentPokemon ?? this.currentPokemon, lives: lives ?? this.lives, skips: skips ?? this.skips, hints: hints ?? this.hints, sessionCorrectCount: sessionCorrectCount ?? this.sessionCorrectCount, currentScore: currentScore ?? this.currentScore, bestScore: bestScore ?? this.bestScore, isShiny: isShiny ?? this.isShiny, isHintUsed: isHintUsed ?? this.isHintUsed, status: status ?? this.status, ); } } /// Issue d'un appel à GameEngine.submitGuess : nouvel état + nature du résultat. class GuessOutcome { final GameState state; final GuessResult result; const GuessOutcome(this.state, this.result); }