From 17546026341704c7bd4fc4a44b51d0638e9e0c74 Mon Sep 17 00:00:00 2001 From: Erick Date: Mon, 14 Mar 2022 13:36:45 -0300 Subject: [PATCH] feat: adding bonus score to the user when they complete the bonus (#36) * feat: adding bonus score to the user when they complete the bonus * feat: pr suggestions --- lib/game/bloc/game_bloc.dart | 2 ++ test/game/bloc/game_bloc_test.dart | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/game/bloc/game_bloc.dart b/lib/game/bloc/game_bloc.dart index 74685215..663fee35 100644 --- a/lib/game/bloc/game_bloc.dart +++ b/lib/game/bloc/game_bloc.dart @@ -15,6 +15,7 @@ class GameBloc extends Bloc { } static const bonusWord = 'GOOGLE'; + static const bonusWordScore = 10000; void _onBallLost(BallLost event, Emitter emit) { if (state.balls > 0) { @@ -44,6 +45,7 @@ class GameBloc extends Bloc { ], ), ); + add(const Scored(points: bonusWordScore)); } else { emit( state.copyWith(activatedBonusLetters: newBonusLetters), diff --git a/test/game/bloc/game_bloc_test.dart b/test/game/bloc/game_bloc_test.dart index ad1d6c55..18e50858 100644 --- a/test/game/bloc/game_bloc_test.dart +++ b/test/game/bloc/game_bloc_test.dart @@ -177,6 +177,12 @@ void main() { activatedBonusLetters: [], bonusHistory: [GameBonus.word], ), + GameState( + score: GameBloc.bonusWordScore, + balls: 3, + activatedBonusLetters: [], + bonusHistory: [GameBonus.word], + ), ], ); });