Skip to content

Commit

Permalink
Create divine-smite.js
Browse files Browse the repository at this point in the history
  • Loading branch information
krbz999 authored Dec 15, 2024
1 parent e12b582 commit b9538ad
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dnd5e_spells/divine-smite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Use a weapon and roll attack, then optionally use Divine Smite. The damage of
* the spell will be configured depending on the activity but not rolled, instead
* it will be added on top of the weapon's damage roll.
* This macro assumes the use of the Divine Smite spell from the 24 PHB but is
* likely to work with similar setups.
*/

const weapon = actor.items.get("<id of the weapon>");
const smite = actor.items.get("<id of divine smite spell>");

/* ------------------------------------------------------- */

const weaponUse = await weapon.use({legacy: false});
if (!weaponUse) return;
const smiteUse = await smite.use({legacy: false, subsequentActions: false});
if (!smiteUse) return;
const {scaling, activity: {id: activityId}} = smiteUse.message.flags.dnd5e;
const config = smite.clone({"flags.dnd5e.scaling": scaling}, {keepId: true}).system.activities.get(activityId).getDamageConfig();
return weapon.system.activities.get(weaponUse.message.flags.dnd5e.activity.id).rollDamage({rolls: config.rolls});

0 comments on commit b9538ad

Please sign in to comment.