Skip to content

Commit

Permalink
Prevent removal of damage mods for non-attack roll monster feature de…
Browse files Browse the repository at this point in the history
…scription enrichers
  • Loading branch information
MrPrimate committed May 19, 2024
1 parent 5732a03 commit 6e038ca
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Fix for Beholder Zombie Eye Ray macro
- Improve formating for stat blocks in features such as the Steel Defender.
- The Lucky racial trait could be lost on import if you had the Lucky feat as well. Frankly this is a sickening combo.
- Some monster features which were saves would not calculate the correct damage in the rollable enriched field in the descripton. e.g. Mind Flayer Prophet, Mind Whip.

# 5.1.25

Expand Down
24 changes: 21 additions & 3 deletions src/lib/DDBReferenceLinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,29 @@ function damageRollGenerator({ text, damageType, actor, document, extraMods = []
const finalMods = mods.length > 0
? `${useMod} + ${mods}`
: useMod;

// console.warn("RESULTS", {
// text,
// diceParse,
// baseAbility,
// baseAbilityMod,
// bonusMod,
// useMod,
// finalMods
// });

const reParse = utils.diceStringResultBuild(diceParse.diceMap, diceParse.dice, bonusMod, finalMods, "");
result = `[[/damage ${reParse.diceString}${damageHint} average=true]]`;
} else {
const reParse = utils.diceStringResultBuild(diceParse.diceMap, diceParse.dice, undefined, mods, "");
result = `[[/damage ${reParse.diceString}${damageHint} average=true]]`;
// console.warn("RESULTS2", {
// text,
// diceParse,
// baseAbility,
// document,
// });
// const reParse = utils.diceStringResultBuild(diceParse.diceMap, diceParse.dice, undefined, mods, "");
// result = `[[/damage ${reParse.diceString}${damageHint} average=true]]`;
result = `[[/damage ${diceParse.diceString}${damageHint} average=true]]`;
}

return result;
Expand Down Expand Up @@ -329,7 +347,7 @@ export function parseDamageRolls({ text, document, actor } = {}) {
: dmg[3] ?? dmg[2];

if (damage && includesDiceRegExp.test(damage)) {
const parsedDiceDamage = damageRollGenerator({ text: damage, damageType: dmg[4], actor, document });
const parsedDiceDamage = damageRollGenerator({ text: damage, damageType: dmg[4], actor, document, bonusMods });
const replaceValue = `${dmg[1]}${parsedDiceDamage} damage`;
// console.warn("DAMAGE PARSE", {
// damage,
Expand Down

0 comments on commit 6e038ca

Please sign in to comment.