diff options
author | Florrie <towerofnix@gmail.com> | 2018-08-12 17:12:30 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-08-12 17:15:36 -0300 |
commit | 186be8c409b1272ff5c4f5ef55cebe1427ed971e (patch) | |
tree | 78b55fa15299680dcc6f2b6340418485dad0d50e /index.js | |
parent | 3c383ce7058b09db1ece29e160dd4b481fbaf094 (diff) |
More keyboard controls
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/index.js b/index.js index c645cfa..a5068ec 100644 --- a/index.js +++ b/index.js @@ -576,6 +576,7 @@ class Battle { this.playerCharacter = this.teams[0].characters[0] + // TODO: Two different ActionMenus this.actionMenu = new ActionMenu(this) this.targetMenu = new TargetMenu(this) @@ -929,9 +930,24 @@ canvas.addEventListener('keypress', evt => { battle.showActionMenu({direction: -1}) } } - } else { - // TODO: Backspace to cancel chain - // TODO: E to execute chain immediately + } else if (battle.playerCharacter.willExecuteChain) { + if (evt.keyCode === 8) { + battle.playerCharacter.willExecuteChain = false + battle.showTargetMenu() + } else if (evt.key.toLowerCase() === 'e') { + if (atbBar.getCutoff() > 0) { + battle.playerCharacter.willExecuteChain = false + atbBar.activate() + } else { + atbBar.queuedActions.splice(1) + } + } + } else if (battle.playerCharacter.isExecutingChain) { + if (evt.keyCode === 8) { + atbBar.queuedActions.splice(0) + battle.playerCharacter.isExecutingChain = false + battle.showActionMenu({direction: -1}) + } } if (evt.keyCode === 9) { // Capture tab, but not everything else (like ctrl-R) |