Skip to content

Commit

Permalink
fix(spell-slots): Make Divine Smite deduct spell slots.
Browse files Browse the repository at this point in the history
fixes #420
  • Loading branch information
symposion committed Apr 6, 2017
1 parent e208c18 commit 2f5f9bf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/modules/spell-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ module.exports = class SpellManager extends ShapedModule {

registerChatListeners(chatWatcher) {
chatWatcher.registerChatListener(['character', 'spell', 'castAsLevel'], this.handleSpellCast.bind(this));
chatWatcher.registerChatListener(['title', 'subheader'], this.handleDivineSmite.bind(this));
}

handleDivineSmite(options) {
if (options.title === 'Divine Smite') {
options.spell = options.title;
const match = options.subheader.match(/\(as (?:(\(4\))|(\d))\)/);
options.castAsLevel = match[1] ? 5 : parseInt(match[2], 10);
return this.handleSpellCast(options);
}
return null;
}

handleSpellCast(options) {
Expand Down

0 comments on commit 2f5f9bf

Please sign in to comment.