From b0eb6cabf691789965b9cbb5760d9f3f32cb9a5a Mon Sep 17 00:00:00 2001 From: Erick Zanardo Date: Fri, 11 Mar 2022 17:50:03 -0300 Subject: [PATCH] feat: adding bonus score to the user when they complete the bonus --- lib/game/bloc/game_bloc.dart | 2 ++ test/game/bloc/game_bloc_test.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/game/bloc/game_bloc.dart b/lib/game/bloc/game_bloc.dart index 74685215..c5e45e28 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) { @@ -37,6 +38,7 @@ class GameBloc extends Bloc { if (newBonusLetters.length == bonusWord.length) { emit( state.copyWith( + score: state.score + bonusWordScore, activatedBonusLetters: [], bonusHistory: [ ...state.bonusHistory, diff --git a/test/game/bloc/game_bloc_test.dart b/test/game/bloc/game_bloc_test.dart index ad1d6c55..6e18acc4 100644 --- a/test/game/bloc/game_bloc_test.dart +++ b/test/game/bloc/game_bloc_test.dart @@ -172,7 +172,7 @@ void main() { bonusHistory: [], ), GameState( - score: 0, + score: GameBloc.bonusWordScore, balls: 3, activatedBonusLetters: [], bonusHistory: [GameBonus.word],