patch guess langue issue
This commit is contained in:
@@ -37,9 +37,15 @@ class GameEngine {
|
||||
}
|
||||
|
||||
final normalizedGuess = _normalize(guess.trim().toLowerCase());
|
||||
final normalizedActual = _normalize(pokemon.name.toLowerCase());
|
||||
|
||||
if (normalizedGuess == normalizedActual) {
|
||||
// Accept the name in either language so a language switch mid-game never blocks the player.
|
||||
final acceptedNames = <String>{
|
||||
pokemon.name,
|
||||
if (pokemon.nameFr != null) pokemon.nameFr!,
|
||||
if (pokemon.nameEn != null) pokemon.nameEn!,
|
||||
}.map((n) => _normalize(n.toLowerCase())).toSet();
|
||||
|
||||
if (acceptedNames.contains(normalizedGuess)) {
|
||||
final newSession = s.sessionCorrectCount + 1;
|
||||
final gained = s.isShiny ? AppConstants.pointsShiny : AppConstants.pointsNormal;
|
||||
final newScore = s.currentScore + gained;
|
||||
|
||||
Reference in New Issue
Block a user