gamebook: autoplay opponent move when comment is missing

This commit is contained in:
Thibault Duplessis 2017-08-19 21:31:15 -05:00
parent 7a0437528a
commit ea6e480239
2 changed files with 6 additions and 2 deletions

View file

@ -55,6 +55,10 @@ export default class GamebookPlayCtrl {
}
}
this.state = state as State;
if (state.feedback === 'good' && !state.comment) setTimeout(() => {
this.next();
this.redraw();
}, 1000);
}
retry = () => {

View file

@ -51,7 +51,7 @@ function renderFeedback(ctrl: GamebookPlayCtrl, state: State) {
h('i', { attrs: dataIcon('P') }),
h('span', 'Retry')
]);
if (fb === 'good') return h('div.feedback.act.good', {
if (fb === 'good' && state.comment) return h('div.feedback.act.good', {
hook: bind('click', ctrl.next, ctrl.redraw)
}, [
h('i', { attrs: dataIcon('G') }),
@ -61,7 +61,7 @@ function renderFeedback(ctrl: GamebookPlayCtrl, state: State) {
h('i', { attrs: dataIcon('E') }),
h('span', 'Gamebook complete')
]);
return h('div.feedback.' + fb,
return h('div.feedback',
h('span', fb === 'play' ? 'Your turn' : 'Opponent turn')
);
}