Skip to content

Commit

Permalink
Merge pull request kakaroto#547 from Aeristoka/wizard-bladesong-impro…
Browse files Browse the repository at this point in the history
…vement

Addition to "Wizard Bladesong"
  • Loading branch information
kakaroto authored Oct 6, 2020
2 parents 872b7ed + 83e233c commit 9de2c41
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dist/dndbeyond_character.js
Original file line number Diff line number Diff line change
Expand Up @@ -4586,6 +4586,18 @@ function rollAbilityOrSavingThrow(paneClass, rollType) {
const min = character.getAbility("STR").score - parseInt(modifier);
roll_properties.d20 = `1d20min${min}`
}
// Wizard Bladesong Concentration Check Bonus
if (character.hasClassFeature("Bladesong") && character.getSetting("wizard-bladesong", false) &&
rollType == "saving-throw" && ability == "CON") {
// Using confirm because the parent function is not async
if (confirm('Your Bladesong whispers: "Is this a Concentration Check?"')) {
const intelligence = character.getAbility("INT") || {mod: 0};
const mod = Math.max((parseInt(intelligence.mod) || 0), 1);
modifier = parseInt(modifier) + mod;
modifier = modifier >= 0 ? `+${modifier}` : `-${modifier}`;
roll_properties["modifier"] = modifier;
}
}
sendRollWithCharacter(rollType, "1d20" + modifier, roll_properties);
}

Expand Down
12 changes: 12 additions & 0 deletions src/dndbeyond/content-scripts/character.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ function rollAbilityOrSavingThrow(paneClass, rollType) {
const min = character.getAbility("STR").score - parseInt(modifier);
roll_properties.d20 = `1d20min${min}`
}
// Wizard Bladesong Concentration Check Bonus
if (character.hasClassFeature("Bladesong") && character.getSetting("wizard-bladesong", false) &&
rollType == "saving-throw" && ability == "CON") {
// Using confirm because the parent function is not async
if (confirm('Your Bladesong whispers: "Is this a Concentration Check?"')) {
const intelligence = character.getAbility("INT") || {mod: 0};
const mod = Math.max((parseInt(intelligence.mod) || 0), 1);
modifier = parseInt(modifier) + mod;
modifier = modifier >= 0 ? `+${modifier}` : `-${modifier}`;
roll_properties["modifier"] = modifier;
}
}
sendRollWithCharacter(rollType, "1d20" + modifier, roll_properties);
}

Expand Down

0 comments on commit 9de2c41

Please sign in to comment.