diff options
-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) |