Skip to content

Commit

Permalink
clamped font scale when generating pop up text
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ committed Aug 7, 2023
1 parent 6140146 commit d14e20e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export function extractDamageInfoCombined(rolls) {
}

export function getFontScale(scaleType, dmg, tok) {
let scale = game.settings.get("pf2e-rpg-numbers", 'max-font-scale') - 1;
const maxFontScale = game.settings.get("pf2e-rpg-numbers", 'max-font-scale');
let scale = maxFontScale - 1;
if (scaleType === "percentMaxHealth") {
scale *= (dmg / (tok.actor.system.attributes.hp.max + tok.actor.system.attributes.hp.temp));
}
Expand All @@ -116,5 +117,5 @@ export function getFontScale(scaleType, dmg, tok) {
if (scaleType === "none") {
return 1;
}
return scale + 1;
return max(1, min(scale + 1, maxFontScale))
}

0 comments on commit d14e20e

Please sign in to comment.