Skip to content

Commit 29d41bc

Browse files
committed
Add support for Barbarian Reckless Attack and Frenzy
Fixes #1247
1 parent 34802bd commit 29d41bc

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

src/common/settings.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,17 @@ const character_settings = {
622622
"type": "bool",
623623
"default": true
624624
},
625+
"barbarian-reckless": {
626+
"title": "Barbarian: Reckless Attack",
627+
"description": "Attack recklessly, giving advantage on your attack rolls, but granting advantage to attacks against you",
628+
"type": "bool",
629+
"default": false,
630+
"lock": "barbarian-reckless-lock"
631+
},
632+
"barbarian-reckless-lock": {
633+
"type": "bool",
634+
"default": false
635+
},
625636
"bloodhunter-crimson-rite": {
626637
"title": "Bloodhunter: Crimson Rite",
627638
"description": "Add Crimson Rite damage",

src/dndbeyond/content-scripts/character.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,17 @@ function handleSpecialMeleeAttacks(damages=[], damage_types=[], properties, sett
411411
damages.push(String(rage_damage));
412412
damage_types.push("Rage");
413413
effects.push("Rage");
414+
if (character.getSetting("barbarian-reckless", false)) {
415+
effects.push("Reckless Attack");
416+
const isLocked = character.getSetting("barbarian-reckless-lock", false);
417+
if(!isLocked) settings_to_change["barbarian-reckless"] = false;
418+
if (character.hasClassFeature("Frenzy")) {
419+
damages.push(`${rage_damage}d6`);
420+
damage_types.push("Frenzy");
421+
effects.push("Frenzy");
422+
}
423+
424+
}
414425
}
415426
}
416427

@@ -1115,7 +1126,9 @@ async function rollItem(force_display = false, force_to_hit_only = false, force_
11151126

11161127
const isLocked = character.getSetting("rogue-assassinate-lock", false);
11171128
if(!isLocked) settings_to_change["rogue-assassinate"] = false;
1118-
1129+
}
1130+
if (effects.includes("Reckless Attack")) {
1131+
roll_properties["advantage"] = RollType.OVERRIDE_ADVANTAGE;
11191132
}
11201133
// Sorcerer: Clockwork Soul - Trance of Order
11211134
if (character.hasClassFeature("Trance of Order") && character.getSetting("sorcerer-trance-of-order", false))

src/extension/popup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ function populateCharacter(response) {
197197
e = createHTMLOption("barbarian-rage", false, character_settings);
198198
options.append(e);
199199
}
200+
if (response["class-features"].includes("Reckless Attack")) {
201+
e = createHTMLOption("barbarian-reckless", false, character_settings);
202+
options.append(e);
203+
}
200204
if (response["class-features"].includes("Divine Fury")) {
201205
e = createHTMLOption("barbarian-divine-fury", false, character_settings);
202206
options.append(e);

0 commit comments

Comments
 (0)