You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
740 B

const Immutable = require('immutable');
import * as ScorebarActions from '../../actions/board/scorebar.actions';
import Values from '../Values';
import { SETTINGS } from '../../App';
const initial = { current: 0, high: 999, lives: SETTINGS.LIVES };
const reducer = (state = initial, action) => {
if (action.type !== ScorebarActions.SCOREBAR_ACTION) {
return state;
}
switch (action.action) {
case ScorebarActions.MUNCH_SUCCEEDED:
return Immutable.Map(state).set('current', state.current + 10).toObject();
case ScorebarActions.MUNCH_FAILED:
return Immutable.Map(state).set('lives', state.lives - 1).toObject();
}
return state;
};
export default reducer;